X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=T0%2FAliT0RawReader.cxx;h=f0a36b5273107bc595aa0f30f4cff2dc5a75faf9;hb=cdf48647dbb6687692d159eb75af9ecb0f06b2e9;hp=7171dd0c2c33870df332031c245e2fc508c5cdea;hpb=c41ceaac6d4656983aebd086f4cb7e947eb70d07;p=u%2Fmrichter%2FAliRoot.git diff --git a/T0/AliT0RawReader.cxx b/T0/AliT0RawReader.cxx index 7171dd0c2c3..f0a36b52731 100644 --- a/T0/AliT0RawReader.cxx +++ b/T0/AliT0RawReader.cxx @@ -1,3 +1,25 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +/* $Id: */ + +//____________________________________________________________________ +// +// T0 +// Class for reading T0 RAW data in TOF data format +// #include "AliT0RawReader.h" #include "AliT0Parameters.h" #include "AliBitPacking.h" @@ -9,14 +31,21 @@ #include "TArrayI.h" #include "AliLog.h" +using std::cout; +using std::endl; +using std::ios_base; ClassImp(AliT0RawReader) - AliT0RawReader::AliT0RawReader (AliRawReader *rawReader) + AliT0RawReader::AliT0RawReader (AliRawReader *rawReader, Bool_t isOnline) : TTask("T0RawReader","read raw T0 data"), fRawReader(rawReader), fData(NULL), - fPosition(0) - + fPosition(0), + fParam(NULL), + fIsOnline(isOnline), + fBunchID(0), + fPrintout(kFALSE) + { // // create an object to read T0raw digits @@ -24,8 +53,12 @@ ClassImp(AliT0RawReader) fRawReader->Reset(); fRawReader->Select("T0"); + fParam = AliT0Parameters::Instance(); + if (fIsOnline) + fParam->InitIfOnline(); + else + fParam->Init(); - cout<<" AliT0RawReader::AliT0RawReaderfRawReader->Select "<Branch("T0","AliT0digit",&fDigits,405,1); - UInt_t word; - Int_t time=0, itdc=0, ichannel=0; + Int_t time=0, itdc=0, ichannel=0, uu; 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 !!!!! - - + Int_t tdcTime, koef,hit=0; + Int_t koefhits[110]; + Int_t trm_chain_header = 0x00000000; + Int_t trm_chain_trailer = 0x10000000; + + UInt_t filler = 0x70000000; + Bool_t correct=kTRUE; + Int_t header; - AliT0Parameters* param = AliT0Parameters::Instance(); //-->Zhenya - param->Init(); - - for ( Int_t k=0; k<110; k++) { + Int_t fNTRM = fParam->GetNumberOfTRMs(); + for ( Int_t k=0; k<110; k++) { + koefhits[k]=0; for ( Int_t jj=0; jj<5; jj++) { fAllData[k][jj]=0; } } - do { + do { if (!fRawReader->ReadNextData(fData)) return kFALSE; } while (fRawReader->GetDataSize() == 0); - // fPosition = GetPosition(); fPosition = 0; - + // cout.setf( ios_base::hex, ios_base::basefield ); + if(fPrintout) + cout<<" CDH :: BC ID "<< (fRawReader->GetBCID())<< + " Event size"<GetDataSize()<< + " orbit ID "<GetOrbitID()<< + " event index "<GetEventIndex()<< + " event type " <GetType()<AddFatalErrorLog(kWrongDRMHeader,Form("w=%x",word)); + break; + } + } + for (Int_t ntrm=0; ntrm< fNTRM; ntrm++) + { + //TRMheader word = GetNextWord(); - tdcTime = AliBitPacking::UnpackWord(word,31,31); - - if ( tdcTime == 1) + // cout<<" TRM "<GetChannel(iTRM,itdc,ichain,ichannel); - // cout<<" RawReader::Next ::"<AddMajorErrorLog(kWrongTRMHeader,Form("w=%x",word)); + break; + } + numberOfWordsInTRM=AliBitPacking::UnpackWord(word,4,16); + if(fPrintout) { + cout<<" TRM header :: event words "<AddMajorErrorLog(kWrongChain0Header,Form("w=%x",word)); + break; + } + fBunchID=AliBitPacking::UnpackWord(word,4,15); + if(fPrintout) + cout<<" chain "<< ichain<<" header:: BunchID "<GetChannel(iTRM,itdc,ichain,ichannel); + if (koef != 0 ) + // cout<<"RawReader>> "<<"koef "<AddMajorErrorLog(kIncorrectLUT); + correct=kFALSE; + } + if(correct){ + hit=koefhits[koef]; + if(hit>4) { + AliDebug(10,Form("Too many hits for %i channel - %i ! ",koef,koefhits[koef] )); + hit=4; + } + fAllData[koef][hit]=time; + koefhits[koef]++; + } + word = GetNextWord(); + + tdcTime = AliBitPacking::UnpackWord(word,31,31); + + } + // cout<<" trailer :: "<AddMajorErrorLog(kWrongChain0Trailer,Form("w=%x",word)); + break; + } + if(fPrintout) + cout<<" trailer:: event counter "<< AliBitPacking::UnpackWord(word,16,27)<AddMajorErrorLog(kWrongTRMTrailer,Form("w=%x",word)); + break; } + if(fPrintout) + cout<<" TRM trailer :: event counter "<< AliBitPacking::UnpackWord(word,16,27)<AddFatalErrorLog(kWrongDRMTrailer,Form("w=%x",word)); } - word = GetNextWord(); //chain trailer - word = GetNextWord(); //TRM trailer - } //TRM loop - return kTRUE; + if(fPrintout) + cout<<" DRM trailer ::event counter "<< AliBitPacking::UnpackWord(word,4,15)<