AliCDBEntry *entry4 = AliCDBManager::Instance()->Get("GRP/Calib/LHCClockPhase");
if (!entry4) AliFatal("LHC clock-phase shift is not found in OCDB !");
AliLHCClockPhase *phase = (AliLHCClockPhase*)entry4->GetObject();
-
+
fGRPdelays = l1Delay - phase->GetMeanPhase();
-
+
AliCDBEntry *entry5 = AliCDBManager::Instance()->Get("T0/Calib/TimeAdjust");
if (entry5) {
AliT0CalibSeasonTimeShift *timeshift = (AliT0CalibSeasonTimeShift*)entry5->GetObject();
fTimeMeanShift = timeshift->GetT0Means();
fTimeSigmaShift = timeshift->GetT0Sigmas();
- }
+ }
else
AliWarning("Time Adjust is not found in OCDB !");
TGraph* gr2 = fParam ->GetQTC(i);
if (gr2) fQTC.AddAtAndExpand(gr2,i) ;
fTime0vertex[i] = fParam->GetCFD(i);
- AliDebug(2,Form("OCDB mean CFD time %i %f \n",i, fTime0vertex[i]));
}
fLatencyL1 = fParam->GetLatencyL1();
fLatencyL1A = fParam->GetLatencyL1A();
AliDebug(2,Form(" LatencyL1 %f latencyL1A %f latencyL1C %f latencyHPTDC %f \n",fLatencyL1, fLatencyL1A, fLatencyL1C, fLatencyHPTDC));
for (Int_t i=0; i<24; i++) {
- if( fTime0vertex[i] < 500 || fTime0vertex[i] > 50000) fTime0vertex[i] =( 1000.*fLatencyHPTDC - 1000.*fLatencyL1 + 1000.*fGRPdelays)/24.4;
- // printf(" calulated mean %i %f \n",i, fTime0vertex[i]);
+ if( fTime0vertex[i] < 500 || fTime0vertex[i] > 60000) fTime0vertex[i] =( 1000.*fLatencyHPTDC - 1000.*fLatencyL1 + 1000.*fGRPdelays)/24.4;
+ AliDebug(2,Form("OCDB mean CFD time %i %f \n",i, fTime0vertex[i]));
}
//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();
fESDTZERO = new AliESDTZERO();
-
+
}
Float_t c = 29.9792458; // cm/ns
Float_t channelWidth = fParam->GetChannelWidth() ;
- Double32_t vertex = 9999999, meanVertex = 9999999 ;
+ Double32_t vertex = 9999999, meanVertex = 0 ;
Double32_t timeDiff=999999, meanTime=999999, timeclock=999999;
Float_t lowAmpThreshold = GetRecoParam()->GetAmpLowThreshold();
Float_t highAmpThreshold = GetRecoParam()->GetAmpHighThreshold();
- printf( "AliT0Reconstructor::Reconstruct::: RecoParam amplitude %f %f \n",lowAmpThreshold, highAmpThreshold);
-
+ printf("Reconstruct(TTree*digitsTree highAmpThreshold %f lowAmpThreshold %f \n",lowAmpThreshold, highAmpThreshold);
+
+ //shift T0A, T0C , T0AC
+ Float_t shiftA = GetRecoParam() -> GetLow(310);
+ Float_t shiftC = GetRecoParam() -> GetLow(311);
+ Float_t shiftAC = GetRecoParam() -> GetLow(312);
+ AliDebug(2, Form("Reconstruct(TTree*digitsTree shiftA %f shiftC %f shiftAC %f \n",shiftA, shiftC, shiftAC));
+
Double32_t besttimeA=9999999; Double32_t besttimeA_best=9999999;
Double32_t besttimeC=9999999; Double32_t besttimeC_best=9999999;
Int_t timeDelayCFD[24];
Float_t time[24], adc[24], adcmip[24];
for (Int_t ipmt=0; ipmt<24; ipmt++) {
if(timeCFD->At(ipmt)>0 ) {
+ Float_t timefull = 0.001*( timeCFD->At(ipmt) - 511 - timeDelayCFD[ipmt]) * channelWidth;
+ frecpoints.SetTimeFull(ipmt, 0 ,timefull) ;
if(( chargeQT1->At(ipmt) - chargeQT0->At(ipmt))>0)
adc[ipmt] = chargeQT1->At(ipmt) - chargeQT0->At(ipmt);
else
adc[ipmt] = 0;
time[ipmt] = fCalib-> WalkCorrection(refAmp, ipmt, Int_t(adc[ipmt]), timeCFD->At(ipmt)) ;
-
+ time[ipmt] = time[ipmt] - 511;
Double_t sl = Double_t(timeLED->At(ipmt) - timeCFD->At(ipmt));
// time[ipmt] = fCalib-> WalkCorrection( refAmp,ipmt, Int_t(sl), timeCFD->At(ipmt) ) ;
- AliDebug(5,Form(" ipmt %i QTC %i , time in chann %i (led-cfd) %i ",
+ 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 = 0;
}
else {
- time[ipmt] = 0;
+ time[ipmt] = -99999;
adc[ipmt] = 0;
adcmip[ipmt] = 0;
}
for (Int_t ipmt=0; ipmt<12; ipmt++){
- if(time[ipmt] !=0 && time[ipmt] > -9000
+ if(time[ipmt] !=0 && time[ipmt] > 0
&& adcmip[ipmt]>lowAmpThreshold && adcmip[ipmt]<highAmpThreshold )
{
if(time[ipmt]<besttimeC) besttimeC=time[ipmt]; //timeC
}
for ( Int_t ipmt=12; ipmt<24; ipmt++)
{
- if(time[ipmt] != 0 && time[ipmt] > -9000
+ if(time[ipmt] != 0 && time[ipmt] > 0
&& adcmip[ipmt]>lowAmpThreshold && adcmip[ipmt]<highAmpThreshold)
{
if(time[ipmt]<besttimeA) besttimeA=time[ipmt];
}
if( besttimeA < 999999 && besttimeA!=0) {
- frecpoints.SetTimeBestA((besttimeA_best * channelWidth - fdZonA/c) - 12500.);
- frecpoints.SetTime1stA((besttimeA * channelWidth - fdZonA/c) - 12500.);
+ frecpoints.SetTimeBestA((besttimeA_best * channelWidth - fdZonA/c) );
+ frecpoints.SetTime1stA((besttimeA * channelWidth - fdZonA/c - shiftA) );
tr[1]=true;
}
if( besttimeC < 999999 && besttimeC!=0) {
- frecpoints.SetTimeBestC((besttimeC_best * channelWidth - fdZonC/c) - 12500.);
- frecpoints.SetTime1stC((besttimeC * channelWidth - fdZonC/c) - 12500.);
+ frecpoints.SetTimeBestC((besttimeC_best * channelWidth - fdZonC/c) );
+ frecpoints.SetTime1stC((besttimeC * channelWidth - fdZonC/c - shiftC) );
tr[2]=true;
}
// timeDiff = (besttimeC - besttimeA)*channelWidth;
timeDiff = (besttimeA - besttimeC)*channelWidth;
meanTime = channelWidth * (besttimeA_best + besttimeC_best)/2. ;
- timeclock = channelWidth * (besttimeA + besttimeC)/2. ;
- vertex = meanVertex - c*(timeDiff)/2.;// + (fdZonA - fdZonC)/2;
+ timeclock = channelWidth * (besttimeA + besttimeC)/2. - shiftAC ;
+ vertex = meanVertex - 0.001* c*(timeDiff)/2.;// + (fdZonA - fdZonC)/2;
tr[0]=true;
}
frecpoints.SetVertex(vertex);
- frecpoints.SetMeanTime(meanTime - 12500.);
- frecpoints.SetT0clock(timeclock - 12500.);
+ frecpoints.SetMeanTime(meanTime );
+ frecpoints.SetT0clock(timeclock );
frecpoints.SetT0Trig(tr);
- AliDebug(5,Form("fRecPoints::: 1stimeA %f , besttimeA %f 1sttimeC %f besttimeC %f shiftA %f shiftC %f ",
+ AliDebug(5,Form("fRecPoints::: 1stimeA %f , besttimeA %f 1sttimeC %f besttimeC %f vertex %f",
frecpoints.Get1stTimeA(), frecpoints.GetBestTimeA(),
frecpoints.Get1stTimeC(), frecpoints.GetBestTimeC(),
- fTimeMeanShift[1],fTimeMeanShift[2] ) );
+ vertex ) );
AliDebug(5,Form("T0 triggers %d %d %d %d %d",tr[0],tr[1],tr[2],tr[3],tr[4]));
Float_t meanOrA = fTime0vertex[0] + 587;
Float_t meanOrC = fTime0vertex[0] + 678;
Float_t meanTVDC = fTime0vertex[0] + 2564;
- Int_t timeDelayCFD[24];
+ Float_t meanQT1 = fTime0vertex[0] + 2564;
+ Float_t meanQT0 = fTime0vertex[0] + 3564;
-
+ Int_t timeDelayCFD[24];
+ Int_t corridor = GetRecoParam() -> GetCorridor();
+ // printf("!!!! corridor %i \n",corridor);
Int_t badpmt[24];
//Bad channel
for (Int_t i=0; i<24; i++) {
printf( "AliT0Reconstructor::Reconstruct::: RecoParam %i \n",equalize);
fCalib->SetEq(equalize);
Int_t low[500], high[500];
- Float_t timefull=-9999;;
- Float_t tvdc = -9999; Float_t ora = -9999; Float_t orc = -9999;
-
+ Float_t timefull=-99999;;
+ Float_t tvdc = -99999; Float_t ora = -99999; Float_t orc = -99999;
+
Int_t allData[110][5];
Int_t timeCFD[24], timeLED[24], chargeQT0[24], chargeQT1[24];
Double32_t vertex = 9999999;
Int_t onlineMean=0;
Float_t meanVertex = 0;
+ Int_t pedestal[24];
for (Int_t i0=0; i0<24; i0++) {
- low[i0] = Int_t(fTime0vertex[i0]) - 200;
- high[i0] = Int_t(fTime0vertex[i0]) + 200;
+ low[i0] = Int_t(fTime0vertex[i0]) - corridor;
+ high[i0] = Int_t(fTime0vertex[i0]) + corridor;
time2zero[i0] = 99999;
+ pedestal[i0]=Int_t (GetRecoParam()->GetLow(100+i0) );
+ printf(" pmt %i low %i high %i pedestal %i\n",i0, low[i0], high[i0], pedestal[i0]);
}
for (Int_t i0=0; i0<110; i0++)
{
timeCFD[i]=0; timeLED[i]=0; chargeQT0[i]=0; chargeQT1[i]=0;
}
- Int_t fBCID=Int_t (rawReader->GetBCID());
- Int_t trmbunch= myrawreader.GetTRMBunchID();
- AliDebug(10,Form(" CDH BC ID %i, TRM BC ID %i \n", fBCID, trmbunch ));
-
+
if(type == 7 ) { //only physics
for (Int_t i=0; i<107; i++) {
for (Int_t iHit=0; iHit<5; iHit++)
{
allData[i][iHit] = myrawreader.GetData(i,iHit);
+ if(allData[i][iHit]>0) printf(" alldata %i pmt hit %i allData[i][iHit] %i\n",
+ i, iHit, allData[i][iHit]);
}
}
+ Int_t fBCID=Int_t (rawReader->GetBCID());
+ Int_t trmbunch= myrawreader.GetTRMBunchID();
+ AliDebug(10,Form(" CDH BC ID %i, TRM BC ID %i \n", fBCID, trmbunch ));
+ if( (trmbunch-fBCID)!=37 ) {
+ AliDebug(0,Form("wrong :::: CDH BC ID %i, TRM BC ID %i \n", fBCID, trmbunch ));
+ // type = -1;
+ }
for (Int_t in=0; in<12; in++)
{
for (Int_t iHit=0; iHit<5; iHit++)
allData[in+1][iHit] < high[in])
{
timeCFD[in] = allData[in+1][iHit] ;
- break;
+ break;
}
}
for (Int_t iHit=0; iHit<5; iHit++)
{
- if(allData[in+1+56][iHit] > low[in] &&
- allData[in+1+56][iHit] < high[in])
+ if(allData[in+1+56][iHit] > low[in+12] &&
+ allData[in+1+56][iHit] < high[in+12])
{
timeCFD[in+12] = allData[in+56+1][iHit] ;
break;
}
-
for (Int_t in=0; in<12; in++)
{
- chargeQT0[in]=allData[2*in+25][0];
- chargeQT1[in]=allData[2*in+26][0];
- AliDebug(25, Form(" readed Raw %i %i %i",
- in, chargeQT0[in],chargeQT1[in]));
+ for (Int_t iHit=0; iHit<5; iHit++)
+ {
+ if (allData[2*in+26][iHit] > fTime0vertex[0]+2000 &&
+ allData[2*in+26][iHit] <fTime0vertex[0]+3000 &&
+ allData[2*in+25][iHit] > fTime0vertex[0]+3000)
+ {
+ chargeQT0[in]=allData[2*in+25][0];
+ chargeQT1[in]=allData[2*in+26][0];
+ AliDebug(25, Form(" readed Raw %i %i %i",
+ in, chargeQT0[in],chargeQT1[in]));
+ break;
+ }
+ }
}
for (Int_t in=12; in<24; in++)
{
- chargeQT0[in]=allData[2*in+57][0];
- chargeQT1[in]=allData[2*in+58][0];
- AliDebug(25, Form(" readed Raw %i %i %i",
- in, chargeQT0[in],chargeQT1[in]));
+ for (Int_t iHit=0; iHit<5; iHit++)
+ {
+ if (allData[2*in+58][iHit] > fTime0vertex[0]+2000 &&
+ allData[2*in+58][iHit] <fTime0vertex[0]+3000 &&
+ allData[2*in+57][iHit] > fTime0vertex[0]+3000)
+ {
+ chargeQT0[in]=allData[2*in+57][0];
+ chargeQT1[in]=allData[2*in+58][0];
+ AliDebug(25, Form(" readed Raw %i %i %i",
+ in, chargeQT0[in],chargeQT1[in]));
+ break;
+ }
+ }
}
onlineMean = allData[49][0];
Double32_t time[24], adc[24], adcmip[24], noncalibtime[24];
for (Int_t ipmt=0; ipmt<24; ipmt++) {
- if(timeCFD[ipmt] > 0 /* && badpmt[ipmt]==0*/ ){
+ if(timeCFD[ipmt] > 0 && (chargeQT0[ipmt] - chargeQT1[ipmt])> 0 ){
//for simulated data
//for physics data
- if(( chargeQT0[ipmt] - chargeQT1[ipmt])>0) {
- adc[ipmt] = chargeQT0[ipmt] - chargeQT1[ipmt];
- }
- else
- adc[ipmt] = 0;
- // time[ipmt] = fCalib-> WalkCorrection(refAmp, ipmt, Int_t(adc[ipmt]), timeCFD[ipmt] ) ;
-
- time[ipmt] = fCalib-> WalkCorrection(Int_t (fTime0vertex[ipmt]), ipmt, Int_t(adc[ipmt]), timeCFD[ipmt] ) ;
+ adc[ipmt] = chargeQT0[ipmt] - chargeQT1[ipmt];
+ Int_t refAmp = Int_t (fTime0vertex[ipmt]);
+ time[ipmt] = fCalib-> WalkCorrection( refAmp, ipmt, Int_t(adc[ipmt]), timeCFD[ipmt] ) ;
Double_t sl = timeLED[ipmt] - 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 ",
frecpoints.SetTime(ipmt, Float_t(time[ipmt]) );
else
frecpoints.SetTime(ipmt, Float_t(time[ipmt] + fTime0vertex[ipmt]) );
-
+ // frecpoints.SetTime(ipmt, Float_t(time[ipmt] ) );
frecpoints.SetAmp(ipmt, Double32_t( qtMip));
adcmip[ipmt]=qtMip;
frecpoints.SetAmpLED(ipmt, Double32_t(ampMip));
noncalibtime[ipmt]= Double32_t (timeCFD[ipmt]);
- }
- else {
+ }
+ else {
time[ipmt] = -9999;
adc[ipmt] = 0;
adcmip[ipmt] = 0;
noncalibtime[ipmt] = -9999;
- }
+ }
}
fESDTZEROfriend->SetT0timeCorr(noncalibtime) ;
for (Int_t ipmt=0; ipmt<12; ipmt++){
if(time[ipmt] !=0 && time[ipmt] > -9000
/*&& badpmt[ipmt]==0 */
- && adcmip[ipmt]>lowAmpThreshold && adcmip[ipmt]<highAmpThreshold )
+ && adcmip[ipmt]>lowAmpThreshold )
{
if(time[ipmt]<besttimeC) besttimeC=time[ipmt]; //timeC
if(TMath::Abs(time[ipmt])<TMath::Abs(besttimeC_best))
{
if(time[ipmt] != 0 && time[ipmt] > -9000
/* && badpmt[ipmt]==0*/
- && adcmip[ipmt]>lowAmpThreshold && adcmip[ipmt]<highAmpThreshold)
+ && adcmip[ipmt]>lowAmpThreshold )
{
if(time[ipmt]<besttimeA) besttimeA=time[ipmt];
if(TMath::Abs(time[ipmt] ) < TMath::Abs(besttimeA_best))
frecpoints.Get1stTimeC(), frecpoints.GetBestTimeC(),
fTimeMeanShift[1],fTimeMeanShift[2] ) );
if( besttimeC < 999999 && besttimeA < 999999) {
- timeclock = channelWidth * Float_t( besttimeA+besttimeC)/2. - fTimeMeanShift[0];
- meanTime = channelWidth * Float_t(besttimeA_best + besttimeC_best )/2.;
+ if(equalize ==0 )
+ timeclock = (channelWidth*(besttimeC + besttimeA)/2.- 1000.*fLatencyHPTDC +1000.*fLatencyL1 - 1000.*fGRPdelays - fTimeMeanShift[0]);
+ else
+ {
+ timeclock = channelWidth * Float_t( besttimeA+besttimeC)/2. - fTimeMeanShift[0];
+ meanTime = channelWidth * Float_t(besttimeA_best + besttimeC_best )/2.;
+ }
timeDiff = ( besttimeA - besttimeC)* 0.001* channelWidth ;
vertex = meanVertex - c*(timeDiff)/2. ; //+ (fdZonA - fdZonC)/2;
}
//Set MPD
- if(allData[53][0]>0 && allData[54][0])
- frecpoints.SetMultA(allData[53][0]-allData[54][0]);
- if(allData[105][0]>0 && allData[106][0])
- frecpoints.SetMultC(allData[105][0]-allData[106][0]);
-
+ for (Int_t iHit=0; iHit<5; iHit++)
+ {
+ if (allData[54][iHit] > fTime0vertex[0]+2000 &&
+ allData[54][iHit] <fTime0vertex[0]+3000 &&
+ allData[53][iHit] > fTime0vertex[0]+3000) {
+ frecpoints.SetMultA(allData[53][iHit]-allData[54][iHit]);
+ break;
+ }
+ }
+ for (Int_t iHit=0; iHit<5; iHit++)
+ if (allData[106][iHit] > fTime0vertex[0]+2000 &&
+ allData[106][iHit] <fTime0vertex[0]+3000 &&
+ allData[105][iHit] > fTime0vertex[0]+3000)
+ {
+ frecpoints.SetMultC(allData[105][iHit]-allData[106][iHit]);
+ break;
+ }
} // if (else )raw data
recTree->Fill();
Bool_t AliT0Reconstructor::BackgroundFlag() const
{
+
Bool_t background = false;
-
- Float_t orA = fESDTZERO->GetOrA(0);
- Float_t orC = fESDTZERO->GetOrC(0);
- Float_t tvdc = fESDTZERO->GetTVDC(0);
-
- if ( (orA > -5 && orA <5) && (orC > -5 && orC <5) && (tvdc < -5 || tvdc > 5)) {
- background = true;
- // printf(" orA %f orC %f tvdc %f\n", orA, orC, tvdc);
- }
+ /*
+ Float_t orA = fESDTZERO->GetOrA(0);
+ Float_t orC = fESDTZERO->GetOrC(0);
+ Float_t tvdc = fESDTZERO->GetTVDC(ih);
+
+ if ( (orA > -5 && orA <5) && (orC > -5 && orC <5) && (tvdc < -5 || tvdc > 5)) {
+ background = true;
+ // printf(" orA %f orC %f tvdc %f\n", orA, orC, tvdc);
+ }
+ */
return background;