#include <Riostream.h>
#include "AliTriggerIR.h"
using std::endl;
using std::cout;
using std::dec;
using std::hex;
ClassImp(AliTriggerIR)
AliTriggerIR::AliTriggerIR():
TObject(),
fOrbit(0),
fNWord(0),
fInt1(NULL),
fInt2(NULL),
fBC(NULL),
fIncomplete(kFALSE),
fTransErr(kFALSE)
{
}
AliTriggerIR::AliTriggerIR(UInt_t orbit, UInt_t nwords, UInt_t *words, Bool_t incomplete, Bool_t transerr):
TObject(),
fOrbit(orbit),
fNWord(nwords),
fInt1(NULL),
fInt2(NULL),
fBC(NULL),
fIncomplete(incomplete),
fTransErr(transerr)
{
if(fNWord){
fInt1 = new Bool_t[fNWord];
fInt2 = new Bool_t[fNWord];
fBC = new UShort_t[fNWord];
for(UInt_t i = 0; i < fNWord; i++) {
fInt1[i] = words[i] & 0x1000;
fInt2[i] = words[i] & 0x2000;
fBC[i] = words[i] & 0xFFF;
}
}
}
AliTriggerIR::AliTriggerIR(const AliTriggerIR &rec):
TObject(rec),
fOrbit(rec.fOrbit),
fNWord(rec.fNWord),
fInt1(NULL),
fInt2(NULL),
fBC(NULL),
fIncomplete(rec.fIncomplete),
fTransErr(rec.fTransErr)
{
if(fNWord){
fInt1 = new Bool_t[fNWord];
fInt2 = new Bool_t[fNWord];
fBC = new UShort_t[fNWord];
for (UInt_t i = 0; i < fNWord; i++) {
fInt1[i] = rec.fInt1[i];
fInt2[i] = rec.fInt2[i];
fBC[i] = rec.fBC[i];
}
}
}
AliTriggerIR &AliTriggerIR::operator =(const AliTriggerIR& rec)
{
if(this==&rec) return *this;
((TObject *)this)->operator=(rec);
fOrbit = rec.fOrbit;
fNWord = rec.fNWord;
if(fNWord){
if (fInt1) delete fInt1;
fInt1 = new Bool_t[fNWord];
if (fInt2) delete fInt2;
fInt2 = new Bool_t[fNWord];
if (fBC) delete fBC;
fBC = new UShort_t[fNWord];
for (UInt_t i = 0; i < fNWord; i++) {
fInt1[i] = rec.fInt1[i];
fInt2[i] = rec.fInt2[i];
fBC[i] = rec.fBC[i];
}
}
fIncomplete = rec.fIncomplete;
fTransErr = rec.fTransErr;
return *this;
}
AliTriggerIR::~AliTriggerIR()
{
if (fInt1) delete [] fInt1;
if (fInt2) delete [] fInt2;
if (fBC) delete [] fBC;
}
void AliTriggerIR::Print( const Option_t* ) const
{
cout << "Trigger Interaction Record:" << endl;
cout << " Orbit: 0x" << hex << fOrbit << dec << endl;
cout << " Number of signals: " << fNWord << endl;
for (UInt_t i = 0; i < fNWord; i++)
cout << " BC: 0x" << hex << fBC[i] << dec << " Interaction1: " << fInt1[i] << " Interaction2: " << fInt2[i] << endl;
cout << " Record incomplete: " << fIncomplete << endl;
cout << " Transmission Error: " << fTransErr << endl;
}