#include "AliT0RawReader.h" #include "AliT0Parameters.h" #include "AliBitPacking.h" #include "TBits.h" #include #include "TMath.h" #include "TH1F.h" #include "TArrayI.h" #include "AliLog.h" ClassImp(AliT0RawReader) AliT0RawReader::AliT0RawReader (AliRawReader *rawReader) : TTask("T0RawReader","read raw T0 data"), fRawReader(rawReader), fData(NULL), fPosition(0) { // // create an object to read T0raw digits AliDebug(1,"Start "); fRawReader->Reset(); fRawReader->Select("T0"); cout<<" AliT0RawReader::AliT0RawReaderfRawReader->Select "<Branch("T0","AliT0digit",&fDigits,405,1); UInt_t word; Int_t time=0, itdc=0, ichannel=0; Int_t numberOfWordsInTRM=0, iTRM=0; Int_t tdcTime, koef,hit, meanTime, timeDiff ; Int_t numTRM=2; // number of TRMs in game For test =1 !!!!! AliT0Parameters* param = AliT0Parameters::Instance(); //-->Zhenya param->Init(); for ( Int_t k=0; k<110; k++) { for ( Int_t jj=0; jj<5; jj++) { fAllData[k][jj]=0; } } do { if (!fRawReader->ReadNextData(fData)) return kFALSE; } while (fRawReader->GetDataSize() == 0); // fPosition = GetPosition(); fPosition = 0; //DRM header for (Int_t i=0; i<4; i++) { word = GetNextWord(); } for (Int_t ntrm=0; ntrm< numTRM; ntrm++) { //TRMheader word = GetNextWord(); numberOfWordsInTRM=AliBitPacking::UnpackWord(word,4,16); iTRM=AliBitPacking::UnpackWord(word,0,3); //chain header Int_t ichain=0; word = GetNextWord(); for (Int_t i=0; iGetChannel(iTRM,itdc,ichain,ichannel); // cout<<" RawReader::Next ::"<GetDataSize() * 8) % 32) != 0) AliFatal(Form("Incorrect raw data size ! %d words are found !",fRawReader->GetDataSize())); return (fRawReader->GetDataSize() * 8) / 32; } //_____________________________________________________________________________ UInt_t AliT0RawReader::GetNextWord() { // Read the next 32 bit word in backward direction // The input stream access is given by fData and fPosition // fPosition--; Int_t iBit = fPosition * 32; Int_t iByte = iBit / 8; UInt_t word = 0; word = fData[iByte+3]<<24; word |= fData[iByte+2]<<16; word |= fData[iByte+1]<<8; word |= fData[iByte]; fPosition++; return word; }