From f8bea4204a172c931d54f74352b2de5015186bd8 Mon Sep 17 00:00:00 2001 From: alla Date: Fri, 1 Jun 2007 13:20:07 +0000 Subject: [PATCH] hardcoded lookup table for online reading --- T0/AliT0LookUpValue.h | 15 ++++++++++----- T0/AliT0Parameters.cxx | 42 +++++++++++++++++++++++++++++++++++++++--- T0/AliT0Parameters.h | 5 ++++- T0/AliT0RawReader.cxx | 32 +++++++++++++++++++++----------- T0/AliT0RawReader.h | 12 ++++++++---- 5 files changed, 82 insertions(+), 24 deletions(-) diff --git a/T0/AliT0LookUpValue.h b/T0/AliT0LookUpValue.h index c24f16b8b69..3d0f5259677 100644 --- a/T0/AliT0LookUpValue.h +++ b/T0/AliT0LookUpValue.h @@ -22,7 +22,7 @@ class AliT0LookUpValue: public TObject void SetChain(Int_t n) {fChain=n;}; void SetChannel(Int_t n) {fChannel=n;}; virtual void Clear (void) {fTRM = -1; fTDC=-1; fChain=-1; fChannel=-1;} -// void Clear(); + void Clear(const Option_t*) {}; protected: @@ -39,13 +39,18 @@ class AliT0LookUpKey: public TObject public: AliT0LookUpKey(); AliT0LookUpKey(Int_t key); + AliT0LookUpKey(TString name); Int_t GetKey(void) const {return fKey;}; void SetKey(Int_t n) {fKey=n;}; - virtual Bool_t IsEqual(const TObject *obj) const; - virtual ULong_t Hash(void) const {return fKey;}; -// virtual void Clear(void) {fKey=0;} + TString GetChannelName() {return fName;}; + void SetChannelName(TString name) {fName = name;}; + virtual Bool_t IsEqual(const TObject *obj) const; + virtual ULong_t Hash(void) const {return TString::Hash(this, sizeof(*this));}; + // virtual void Clear(void) {fKey=0;} protected: - Int_t fKey; //logical channel name + Int_t fKey; //logical channel number + TString fName; //logical channel name + ClassDef(AliT0LookUpKey,1) //Hits for detector T0 }; diff --git a/T0/AliT0Parameters.cxx b/T0/AliT0Parameters.cxx index 754f7fe9a9e..a5074322979 100644 --- a/T0/AliT0Parameters.cxx +++ b/T0/AliT0Parameters.cxx @@ -69,7 +69,7 @@ AliT0Parameters::AliT0Parameters() fPMTeff(), fTimeDelayDA(0),fTimeDelayCFD(0),fTimeDelayTVD(0),fMeanT0(499), fCalibentry(), fLookUpentry(),fSlewCorr(), - fLookUp(0), fNumberOfTRMs(0) + fLookUp(0), fNumberOfTRMs(2) { // Default constructor @@ -146,6 +146,39 @@ AliT0Parameters::Init() //__________________________________________________________________ + +void AliT0Parameters::InitIfOnline() +{ +// should be used in online +// for switching to this one should write + // AliT0RawReader myrawreader(rawReader); +// myrawreader.SetOnlineMode(kTRUE); + + + if (fIsInit) return; + + Int_t trm=0; Int_t tdc=0; Int_t chain=0; Int_t channel=0; + for (Int_t ik=0; ik<110; ik++) + { + AliT0LookUpKey * lookkey= new AliT0LookUpKey(); + AliT0LookUpValue * lookvalue= new AliT0LookUpValue(); + + + lookvalue->SetTRM(trm); + lookvalue->SetTDC(tdc); + lookvalue->SetChain(chain); + lookvalue->SetChannel(channel); + lookkey->SetKey(ik); + if(ik==55) { trm=1; tdc=0; channel=0;} + if (channel<6) channel +=2; + else {channel = 0; tdc++;} + fLookUp.Add((TObject*)lookvalue,(TObject*)lookkey); + } + + fIsInit=kTRUE; +} +//__________________________________________________________________ + Float_t AliT0Parameters::GetTimeDelayDA(Int_t ipmt) { @@ -372,8 +405,11 @@ AliT0Parameters::GetChannel(Int_t trm, Int_t tdc, Int_t chain, Int_t channel) AliT0LookUpKey * lookkey; //= new AliT0LookUpKey(); AliT0LookUpValue * lookvalue= new AliT0LookUpValue(trm,tdc,chain,channel); - - lookkey = (AliT0LookUpKey*) fgLookUp->GetMapLookup()->GetValue((TObject*)lookvalue); + if (fgLookUp) + lookkey = (AliT0LookUpKey*) fgLookUp->GetMapLookup()->GetValue((TObject*)lookvalue); + else + lookkey = (AliT0LookUpKey*) fLookUp.GetValue((TObject*)lookvalue); + if (!lookkey ) { cout<<" no such address "<Reset(); fRawReader->Select("T0"); - AliT0Parameters* fParam = AliT0Parameters::Instance(); - fParam->Init(); + // AliT0Parameters* fParam = AliT0Parameters::Instance(); + // fIsOnline = isOnline; + // fIsOnline=kTRUE; + /* if (fIsOnline) + fParam->InitIfOnline(); + else + fParam->Init(); + */ } AliT0RawReader::~AliT0RawReader () { @@ -91,17 +98,20 @@ Bool_t AliT0RawReader::Next() Bool_t correct=kTRUE; Int_t header; - // AliT0Parameters* param = AliT0Parameters::Instance(); - // param->Init(); - - Int_t fNTRM = fParam->GetNumberOfTRMs(); - - for ( Int_t k=0; k<110; k++) { + AliT0Parameters* fParam = AliT0Parameters::Instance(); + if (fIsOnline) + fParam->InitIfOnline(); + else + fParam->Init(); + + 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 { if (!fRawReader->ReadNextData(fData)) return kFALSE; } while (fRawReader->GetDataSize() == 0); diff --git a/T0/AliT0RawReader.h b/T0/AliT0RawReader.h index 24443eea61e..04cad3e4513 100644 --- a/T0/AliT0RawReader.h +++ b/T0/AliT0RawReader.h @@ -16,7 +16,8 @@ class AliT0RawReader : public TTask { fRawReader(0), fData(NULL), fPosition(0), - fParam(0) + fParam(0), + fIsOnline(kFALSE) {} AliT0RawReader& operator=(const AliT0RawReader&) { return *this; } @@ -41,18 +42,21 @@ class AliT0RawReader : public TTask { kIncorrectLUT = 10 }; - + void SetOnlineMode(Bool_t on=kFALSE) {fIsOnline=on;} + Bool_t IsOnlineMode () {return fIsOnline;} + protected : AliRawReader* fRawReader; // object for reading the raw data UChar_t* fData; // raw data Int_t fPosition; // current (32 bit) position in fData AliT0Parameters *fParam; - // Int_t fNTRM; //number of TRMs, 1 - testbeam; 2 - simulation +// Int_t fNTRM; //number of TRMs, 1 - testbeam; 2 - simulation + Bool_t fIsOnline; Int_t fAllData[110][5]; - ClassDef(AliT0RawReader,1) //class for reading T0 Raw data + ClassDef(AliT0RawReader,2) //class for reading T0 Raw data }; typedef AliT0RawReader AliSTARTRawReader; // for backward compatibility -- 2.39.3