X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=T0%2FAliT0RawReader.cxx;h=618324151fcf236a98c81c3f73bab80b54a26222;hb=0f786b969f785e95c4788474d533c151d62ad1ca;hp=1b33d158bc4de92832e31135d5091dbc5d02f6f6;hpb=dc7ca31de92d1b061fddc1358c9d984ed869aa95;p=u%2Fmrichter%2FAliRoot.git diff --git a/T0/AliT0RawReader.cxx b/T0/AliT0RawReader.cxx index 1b33d158bc4..618324151fc 100644 --- a/T0/AliT0RawReader.cxx +++ b/T0/AliT0RawReader.cxx @@ -1,6 +1,27 @@ +/************************************************************************** + * 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 "AliT0RawData.h" -#include "AliT0digit.h" +#include "AliT0Parameters.h" #include "AliBitPacking.h" #include "TBits.h" @@ -12,29 +33,41 @@ ClassImp(AliT0RawReader) - AliT0RawReader::AliT0RawReader (AliRawReader *rawReader, TTree* tree) + AliT0RawReader::AliT0RawReader (AliRawReader *rawReader, Bool_t isOnline) : TTask("T0RawReader","read raw T0 data"), - fDigits(NULL), - fTree(tree), fRawReader(rawReader), fData(NULL), - fPosition(0) + fPosition(0), + fParam(NULL), + fIsOnline(isOnline) { // // create an object to read T0raw digits AliDebug(1,"Start "); - if (fDigits == 0x0) fDigits = new AliT0digit(); - fTree->Branch("T0","AliT0digit",&fDigits,405,1); fRawReader->Reset(); fRawReader->Select("T0"); - + fParam = AliT0Parameters::Instance(); + if (fIsOnline) + fParam->InitIfOnline(); + else + fParam->Init(); } AliT0RawReader::~AliT0RawReader () { // } +/* +AliT0RawReader::AliT0RawReader(const AliT0RawReader& o): TTask(o), + fRawReader(rawReader), + fData(NULL), + fPosition(0) +{ + // +} +*/ + Bool_t AliT0RawReader::Next() { @@ -64,119 +97,143 @@ Bool_t AliT0RawReader::Next() // allData[48] mean (T0) signal // allData[49] time difference (vertex) + 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, meanTime, timeDiff ; - Int_t allData[107]; - - TArrayI *timeTDC1 = new TArrayI(24); - TArrayI * chargeTDC1 = new TArrayI(24); - TArrayI *timeTDC2 = new TArrayI(24); - TArrayI *chargeTDC2 = new TArrayI(24); - - for ( Int_t k=0; k<107; k++) allData[k]=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(); - } - //TRMheader - word = GetNextWord(); - numberOfWordsInTRM=AliBitPacking::UnpackWord(word,4,16); - iTRM=AliBitPacking::UnpackWord(word,0,3); - - //chain header - word = GetNextWord(); + Int_t tdcTime, koef,hit=0; + Int_t koefhits[110]; + Int_t trm_chain_header = 0x00000000; + Int_t trm_chain_trailer = 0x10000000; - for (Int_t i=0; iGetNumberOfTRMs(); + for ( Int_t k=0; k<110; k++) { + koefhits[k]=0; + for ( Int_t jj=0; jj<5; jj++) { + fAllData[k][jj]=0; + } } - - for (Int_t in=0; in<24; in++) - { - timeTDC1->AddAt(allData[in],in); - timeTDC2->AddAt(allData[in+24],in); - chargeTDC1->AddAt(allData[in+54],in); - chargeTDC2->AddAt(allData[in+78],in); - } - - meanTime = allData[48]; // T0 !!!!!! - timeDiff = allData[49]; - - word = GetNextWord(); - word = GetNextWord(); - - fDigits->SetTime(*timeTDC2); - fDigits->SetADC(*chargeTDC1); - - fDigits->SetTimeAmp(*timeTDC1); - fDigits->SetADCAmp(*chargeTDC2); - - fDigits->SetMeanTime(meanTime); - fDigits->SetDiffTime(timeDiff); - fTree->Fill(); - - delete timeTDC1 ; - delete chargeTDC1; - delete timeTDC2 ; - delete chargeTDC2; - - return kTRUE; -} -//_____________________________________________________________________________ -/* -void AliT0RawReader::UnpackTime(Int_t outTime, Int_t outCh) -{ - UInt_t word=0; - UInt_t unpackword=0; + do { + if (!fRawReader->ReadNextData(fData)) return kFALSE; + } while (fRawReader->GetDataSize() == 0); + fPosition = 0; + cout.setf( ios_base::hex, ios_base::basefield ); + + //DRM header + for (Int_t i=0; i<6; i++) { word = GetNextWord(); - unpackword=AliBitPacking::UnpackWord(word,0,12); - outTime=unpackword; - unpackword= AliBitPacking::UnpackWord(word,21,27); - outCh=unpackword; - } - */ + // cout<<" DRM header "<AddFatalErrorLog(kWrongDRMHeader,Form("w=%x",word)); + break; + } + } + // cout<<" fNTRM "<AddMajorErrorLog(kWrongTRMHeader,Form("w=%x",word)); + break; + } + numberOfWordsInTRM=AliBitPacking::UnpackWord(word,4,16); + // cout<<" numberOfWordsInTRM "<AddMajorErrorLog(kWrongChain0Header,Form("w=%x",word)); + break; + } + word = GetNextWord(); +// cout<<" next "<GetChannel(iTRM,itdc,ichain,ichannel); + if (koef != 0 ) + // cout<<"RawReader>> "<<"koef "<AddMajorErrorLog(kIncorrectLUT); + correct=kFALSE; + } + if(correct){ + hit=koefhits[koef]; + if(hit>5) { + AliWarning(Form("Too many hits for %i channel - %i ! ",koef,koefhits[koef] )); + hit=5; + } + fAllData[koef][hit]=time; + koefhits[koef]++; + } + word = GetNextWord(); + // cout<<" next word in cycle "<AddMajorErrorLog(kWrongChain0Trailer,Form("w=%x",word)); + break; + } + } + + word = GetNextWord(); //TRM trailer + // cout<<" TRM trailer "<AddMajorErrorLog(kWrongTRMTrailer,Form("w=%x",word)); + break; + } + } //TRM loop + word = GetNextWord(); // + // cout<<" after TRM trailer "<AddFatalErrorLog(kWrongDRMTrailer,Form("w=%x",word)); + } + cout.setf( ios_base::dec, ios_base::basefield ); + + return kTRUE; +} //_____________________________________________________________________________ Int_t AliT0RawReader::GetPosition() {