From 8f62094527b2ebd1845b7a1cf943db2184133f86 Mon Sep 17 00:00:00 2001 From: alla Date: Tue, 20 Jul 2010 09:36:31 +0000 Subject: [PATCH] added possibility to read TRM BC ID, calibration done by QTC amplitude --- T0/AliT0Calibrator.cxx | 15 +++--- T0/AliT0RawReader.cxx | 70 ++++++++++++++++--------- T0/AliT0RawReader.h | 8 ++- T0/AliT0Reconstructor.cxx | 104 ++++++++++++++++++++------------------ 4 files changed, 113 insertions(+), 84 deletions(-) diff --git a/T0/AliT0Calibrator.cxx b/T0/AliT0Calibrator.cxx index be4a7874c8b..8a8cbef3888 100644 --- a/T0/AliT0Calibrator.cxx +++ b/T0/AliT0Calibrator.cxx @@ -55,9 +55,9 @@ ClassImp(AliT0Calibrator) for (Int_t i=0; i<24; i++){ fMaxValue[i]=0; fTimeDelayCFD[i] = Int_t (param->GetTimeDelayCFD(i)); - // TGraph* fu = param ->GetWalk(i); + TGraph* fu = param ->GetWalk(i); // fWalk.AddAtAndExpand(fu,i); - TGraph* fu = param ->GetAmpLEDRec(i); + //TGraph* fu = param ->GetAmpLEDRec(i); fWalk.AddAtAndExpand(fu,i); } @@ -108,16 +108,17 @@ Int_t AliT0Calibrator::WalkCorrection(Int_t refAmp, Int_t ipmt, Int_t qt, Int_ if(fu1 && fu1->GetN()>0) { grY = fu1->GetY(); fMaxValue[ipmt]=grY[refAmp-1]; - // TGraph* fu = param ->GetAmpLEDRec(i); - walk = Int_t (fMaxValue[ipmt]) + Int_t(fu1->Eval(Double_t(qt))); + // TGraph* fu = param ->GetAmpLEDRec(i); + // walk = Int_t (fMaxValue[ipmt]) + Int_t(fu1->Eval(Double_t(qt))); + walk = Int_t(fu1->Eval(Double_t(qt))); } timeWalk = time - walk ; timeEq= timeWalk - fTimeDelayCFD[ipmt]; - // printf(" ipmt %i time before %i timeWalk %i , walk %i qt %i fTimeDelayCFD[ipmt] %i timeEq %i \n ", + // printf(" ipmt %i time before %i timeWalk %i , walk %i qt %i fTimeDelayCFD[ipmt] %i timeEq %i \n ", // ipmt, time,timeWalk, walk, qt,fTimeDelayCFD[ipmt], timeEq ); - // AliDebug(10,Form(" ipmt %i time before %i timeWalk %i , walk %i qt %i timeEq %i \n ", - // ipmt, time,timeWalk, walk, qt, timeEq )); + AliDebug(10,Form(" ipmt %i time before %i timeWalk %i , walk %i qt %i timeEq %i \n ", + ipmt, time,timeWalk, walk, qt, timeEq )); return timeEq; } diff --git a/T0/AliT0RawReader.cxx b/T0/AliT0RawReader.cxx index 894e81a0c1f..3aefb2d7f1d 100644 --- a/T0/AliT0RawReader.cxx +++ b/T0/AliT0RawReader.cxx @@ -39,7 +39,10 @@ ClassImp(AliT0RawReader) fData(NULL), fPosition(0), fParam(NULL), - fIsOnline(isOnline) + fIsOnline(isOnline), + fBunchID(0), + fPrintout(kFALSE) + { // // create an object to read T0raw digits @@ -97,7 +100,6 @@ 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, uu; Int_t numberOfWordsInTRM=0, iTRM=0; @@ -110,39 +112,45 @@ Bool_t AliT0RawReader::Next() Bool_t correct=kTRUE; Int_t header; - Int_t fNTRM = fParam->GetNumberOfTRMs(); - 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 { - if (!fRawReader->ReadNextData(fData)) return kFALSE; - } while (fRawReader->GetDataSize() == 0); - - fPosition = 0; - cout.setf( ios_base::hex, ios_base::basefield ); - - //DRM header + } + } + do { + if (!fRawReader->ReadNextData(fData)) return kFALSE; + } while (fRawReader->GetDataSize() == 0); + + 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; } } - // cout<<" fNTRM "<AddMajorErrorLog(kWrongChain0Header,Form("w=%x",word)); break; } + fBunchID=AliBitPacking::UnpackWord(word,4,15); + if(fPrintout) + cout<<" chain "<< ichain<<" header:: BunchID "<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)); } + if(fPrintout) + cout<<" DRM trailer ::event counter "<< AliBitPacking::UnpackWord(word,4,15)<GetZPositionShift("T0/C/PMT1")); //fdZonA = TMath::Abs(fParam->GetZPositionShift("T0/A/PMT15")); - + //here real Z position + fdZonC = TMath::Abs(fParam->GetZPosition("T0/C/PMT1")); + fdZonA = TMath::Abs(fParam->GetZPosition("T0/A/PMT15")); fCalib = new AliT0Calibrator(); fESDTZEROfriend = new AliESDTZEROfriend(); @@ -147,10 +149,10 @@ void AliT0Reconstructor::Reconstruct(TTree*digitsTree, TTree*clustersTree) const else adc[ipmt] = 0; - // time[ipmt] = fCalib-> WalkCorrection(refAmp, ipmt, adc[ipmt], timeCFD->At(ipmt)) ; + time[ipmt] = fCalib-> WalkCorrection(refAmp, ipmt, adc[ipmt], timeCFD->At(ipmt)) ; Double_t sl = Double_t(timeLED->At(ipmt) - timeCFD->At(ipmt)); - time[ipmt] = fCalib-> WalkCorrection( refAmp,ipmt, Int_t(sl), timeCFD->At(ipmt) ) ; + // time[ipmt] = fCalib-> WalkCorrection( refAmp,ipmt, Int_t(sl), timeCFD->At(ipmt) ) ; AliDebug(10,Form(" ipmt %i QTC %i , time in chann %i (led-cfd) %i ", ipmt, Int_t(adc[ipmt]) ,Int_t(time[ipmt]),Int_t( sl))); @@ -185,11 +187,11 @@ void AliT0Reconstructor::Reconstruct(TTree*digitsTree, TTree*clustersTree) const } } if(besttimeA < 999999) { - frecpoints->SetTimeBestA(Int_t(besttimeA *channelWidth)); + frecpoints->SetTimeBestA(Int_t(besttimeA *channelWidth - fdZonA/c)); tr[1]=true; } if( besttimeC < 999999 ) { - frecpoints->SetTimeBestC(Int_t(besttimeC *channelWidth)); + frecpoints->SetTimeBestC(Int_t(besttimeC *channelWidth - fdZonA/c)); tr[2]=true; } AliDebug(10,Form(" besttimeA %f ch, besttimeC %f ch",besttimeA, besttimeC)); @@ -197,7 +199,7 @@ void AliT0Reconstructor::Reconstruct(TTree*digitsTree, TTree*clustersTree) const // timeDiff = (besttimeC - besttimeA)*channelWidth; timeDiff = (besttimeA - besttimeC)*channelWidth; meanTime = (besttimeA + besttimeC)/2;// * channelWidth); - timeclock = meanTime *channelWidth ; + timeclock = meanTime *channelWidth -fdZonA/c ; vertex = meanVertex - c*(timeDiff)/2.;// + (fdZonA - fdZonC)/2; tr[0]=true; } @@ -206,7 +208,7 @@ void AliT0Reconstructor::Reconstruct(TTree*digitsTree, TTree*clustersTree) const frecpoints->SetT0clock(timeclock); frecpoints->SetT0Trig(tr); - AliInfo(Form("T0 triggers %d %d %d %d %d",tr[0],tr[1],tr[2],tr[3],tr[4])); + AliDebug(10,Form("T0 triggers %d %d %d %d %d",tr[0],tr[1],tr[2],tr[3],tr[4])); //online mean frecpoints->SetOnlineMean(Int_t(onlineMean)); @@ -268,53 +270,55 @@ void AliT0Reconstructor::Reconstruct(AliRawReader* rawReader, TTree*recTree) con AliDebug(1,Form(" no raw data found!!")); else { - if(type == 7) { //only physics - for (Int_t i=0; i<105; i++) { + Int_t fBCID=Int_t (rawReader->GetBCID()); + Int_t trmbunch= myrawreader.GetTRMBunchID(); + if(type == 7 &&( trmbunch -fBCID )==37 ) { //only physics + for (Int_t i=0; i<105; i++) { for (Int_t iHit=0; iHit<5; iHit++) { allData[i][iHit] = myrawreader.GetData(i,iHit); } - } - Int_t ref=0; - if (refPoint>0) - ref = allData[refPoint][0]-5000; + } + Int_t ref=0; + if (refPoint>0) + ref = allData[refPoint][0]-5000; + + Float_t channelWidth = fParam->GetChannelWidth() ; + + // Int_t meanT0 = fParam->GetMeanT0(); + + + for (Int_t in=0; in<12; in++) + { + timeCFD[in] = allData[in+1][0] ; + timeCFD[in+12] = allData[in+56+1][0] ; + timeLED[in] = allData[in+12+1][0] ; + timeLED[in+12] = allData[in+68+1][0] ; + AliDebug(10, Form(" readed i %i cfdC %i cfdA %i ledC %i ledA%i ", + in, timeCFD[in],timeCFD[in+12],timeLED[in], + timeLED[in+12])); + } + + for (Int_t in=0; in<12; in++) + { + chargeQT0[in]=allData[2*in+25][0]; + chargeQT1[in]=allData[2*in+26][0]; + } + + for (Int_t in=12; in<24; in++) + { + chargeQT0[in]=allData[2*in+57][0]; + chargeQT1[in]=allData[2*in+58][0]; + } + - Float_t channelWidth = fParam->GetChannelWidth() ; - - // Int_t meanT0 = fParam->GetMeanT0(); - - - for (Int_t in=0; in<12; in++) - { - timeCFD[in] = allData[in+1][0] ; - timeCFD[in+12] = allData[in+56+1][0] ; - timeLED[in] = allData[in+12+1][0] ; - timeLED[in+12] = allData[in+68+1][0] ; - AliDebug(10, Form(" readed i %i cfdC %i cfdA %i ledC %i ledA%i ", - in, timeCFD[in],timeCFD[in+12],timeLED[in], - timeLED[in+12])); - } - - for (Int_t in=0; in<12; in++) - { - chargeQT0[in]=allData[2*in+25][0]; - chargeQT1[in]=allData[2*in+26][0]; - } - - for (Int_t in=12; in<24; in++) - { - chargeQT0[in]=allData[2*in+57][0]; - chargeQT1[in]=allData[2*in+58][0]; - } - - // } //cosmic with physics event - for (Int_t in=0; in<24; in++) - AliDebug(10, Form(" readed Raw %i %i %i %i %i", - in, timeLED[in],timeCFD[in],chargeQT0[in],chargeQT1[in])); + for (Int_t in=0; in<24; in++) + AliDebug(10, Form(" readed Raw %i %i %i %i %i", + in, timeLED[in],timeCFD[in],chargeQT0[in],chargeQT1[in])); onlineMean = allData[49][0]; - + Double32_t time[24], adc[24], noncalibtime[24]; - for (Int_t ipmt=0; ipmt<24; ipmt++) { + for (Int_t ipmt=0; ipmt<24; ipmt++) { if(timeCFD[ipmt]>0 && timeLED[ipmt]>0){ //for simulated data //for physics data @@ -325,17 +329,17 @@ void AliT0Reconstructor::Reconstruct(AliRawReader* rawReader, TTree*recTree) con adc[ipmt] = 0; - // time[ipmt] = fCalib-> WalkCorrection(refAmp, ipmt, adc[ipmt], timeCFD[ipmt] ) ; + time[ipmt] = fCalib-> WalkCorrection(refAmp, ipmt, adc[ipmt], timeCFD[ipmt] ) ; Double_t sl = timeLED[ipmt] - timeCFD[ipmt]; - time[ipmt] = fCalib-> WalkCorrection( refAmp,ipmt, Int_t(sl), timeCFD[ipmt] ) ; + // time[ipmt] = fCalib-> WalkCorrection( refAmp,ipmt, Int_t(sl), timeCFD[ipmt] ) ; AliDebug(5,Form(" ipmt %i QTC %i , time in chann %i (led-cfd) %i ", ipmt, Int_t(adc[ipmt]) ,Int_t(time[ipmt]),Int_t( sl))); Double_t ampMip =( (TGraph*)fAmpLED.At(ipmt))->Eval(sl); Double_t qtMip = ((TGraph*)fQTC.At(ipmt))->Eval(adc[ipmt]); AliDebug(10,Form(" Amlitude in MIPS LED %f ; QTC %f; in channels %i\n ",ampMip,qtMip, adc[ipmt])); //bad peak removing - if(sl<540) { + if(sl<550) { frecpoints->SetTime(ipmt, Float_t(time[ipmt]) ); // frecpoints->SetTime(ipmt,Double32_t(timeCFD[ipmt])); frecpoints->SetAmpLED(ipmt, Double32_t( qtMip)); //for cosmic &pp beam -- 2.43.0