- recTree->Branch( "T0", "AliT0RecPoint" ,&frecpoints, 405,1);
-
-
- Float_t time[24], adc[24];
- for (Int_t ipmt=0; ipmt<24; ipmt++) {
- if(timeCFD->At(ipmt)>0 ){
-
- if(option == "pdc"){
- Double_t qt0 = Double_t(chargeQT0->At(ipmt));
- Double_t qt1 = Double_t(chargeQT1->At(ipmt));
- if((qt1-qt0)>0) adc[ipmt] = TMath::Exp( Double_t (channelWidth*(qt1-qt0)/1000));
- // time[ipmt] = channelWidth * (calib-> WalkCorrection( ipmt,qt1 , timeCFD->At(ipmt) ) ) ;
- time[ipmt] = calib-> WalkCorrection( ipmt,Int_t(qt1) , timeCFD->At(ipmt) ) ;
- Double_t sl = (timeLED->At(ipmt) - time[ipmt])*channelWidth;
- Double_t qt=((TGraph*)fAmpLEDrec.At(ipmt))->Eval(sl/1000.);
- frecpoints->SetTime(ipmt,time[ipmt]);
- frecpoints->SetAmp(ipmt,adc[ipmt]);
- frecpoints->SetAmpLED(ipmt,qt);
- AliDebug(1,Form(" QTC %f mv, QTC %f MIPS time in chann %f time %f ",adc[ipmt], adc[ipmt]/50.,time[ipmt], time[ipmt]*channelWidth));
- }
- if(option == "cosmic") {
- Float_t qt0 = Float_t(chargeQT0->At(ipmt));
- Float_t qt1 = Float_t(chargeQT1->At(ipmt));
- if((qt0-qt1)>0) adc[ipmt] = qt0-qt1;
- time[ipmt] = calib-> WalkCorrection( ipmt, Int_t(adc[ipmt]), timeCFD->At(ipmt) ) ;
- Double_t sl = timeLED->At(ipmt) - time[ipmt];
- Double_t qt=((TGraph*)fAmpLEDrec.At(ipmt))->Eval(sl);
- frecpoints->SetTime(ipmt,time[ipmt]);
- frecpoints->SetAmp(ipmt,adc[ipmt]);
- frecpoints->SetAmpLED(ipmt,qt);
- AliDebug(10,Form(" QTC %i , time in chann %i led %i ",
- Int_t(adc[ipmt]) ,Int_t(time[ipmt]),Int_t( qt)));
- }
+ 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);
+ }
+ }
+
+ for (Int_t in=0; in<12; in++)
+ {
+ for (Int_t iHit=0; iHit<5; iHit++)
+ {
+ if(allData[in+1][iHit] > low[in] &&
+ allData[in+1][iHit] < high[in])
+ {
+ timeCFD[in] = allData[in+1][iHit] ;
+ break;
+ }
+ }
+ for (Int_t iHit=0; iHit<5; iHit++)
+ {
+ if(allData[in+1+56][iHit] > low[in] &&
+ allData[in+1+56][iHit] < high[in])
+ {
+ timeCFD[in+12] = allData[in+56+1][iHit] ;
+ break;
+ }
+ }
+ timeLED[in+12] = allData[in+68+1][0] ;
+ timeLED[in] = allData[in+12+1][0] ;
+ AliDebug(50, 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];
+ AliDebug(25, Form(" readed Raw %i %i %i",
+ in, chargeQT0[in],chargeQT1[in]));
+ }
+ 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]));
+ }
+
+ 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*/ ){
+ //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] ) ;
+ 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 ",
+ ipmt, Int_t(adc[ipmt]) ,Int_t(time[ipmt]),Int_t( sl)));
+ Double_t ampMip = 0;
+ TGraph * ampGraph = (TGraph*)fAmpLED.At(ipmt);
+ if (ampGraph) ampMip = ampGraph->Eval(sl);
+ Double_t qtMip = 0;
+ TGraph * qtGraph = (TGraph*)fQTC.At(ipmt);
+ if (qtGraph) qtMip = qtGraph->Eval(adc[ipmt]);
+ AliDebug(10,Form(" Amlitude in MIPS LED %f ; QTC %f; in channels %f\n ",ampMip,qtMip, adc[ipmt]));
+ if( qtMip>lowAmpThreshold && qtMip<highAmpThreshold )
+ {
+ if( equalize ==0 )
+ 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 {
+ 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 )
+ {
+ if(time[ipmt]<besttimeC) besttimeC=time[ipmt]; //timeC
+ if(TMath::Abs(time[ipmt])<TMath::Abs(besttimeC_best))
+ besttimeC_best=time[ipmt]; //timeC
+ }
+ }
+ for ( Int_t ipmt=12; ipmt<24; ipmt++)
+ {
+ if(time[ipmt] != 0 && time[ipmt] > -9000
+ /* && badpmt[ipmt]==0*/
+ && adcmip[ipmt]>lowAmpThreshold && adcmip[ipmt]<highAmpThreshold)
+ {
+ if(time[ipmt]<besttimeA) besttimeA=time[ipmt];
+ if(TMath::Abs(time[ipmt] ) < TMath::Abs(besttimeA_best))
+ besttimeA_best=time[ipmt]; //timeA
+ }
+ }
+
+ if(besttimeA < 999999 && besttimeA!=0 ) {
+ if( equalize ==0 )
+ frecpoints.SetTime1stA((besttimeA * channelWidth)- 1000.*fLatencyHPTDC + 1000.*fLatencyL1A - 1000.*fGRPdelays - fTimeMeanShift[1] );
+ else
+ {
+ frecpoints.SetTimeBestA((besttimeA_best * channelWidth ));
+ frecpoints.SetTime1stA((besttimeA * channelWidth - fTimeMeanShift[1]));
+ }
+ }
+ if( besttimeC < 999999 && besttimeC!=0) {
+ if( equalize ==0 )
+ frecpoints.SetTime1stC((besttimeC * channelWidth)- 1000.*fLatencyHPTDC +1000.*fLatencyL1C - 1000.*fGRPdelays - fTimeMeanShift[2]);
+ else
+ {
+ frecpoints.SetTimeBestC((besttimeC_best * channelWidth ));
+ frecpoints.SetTime1stC((besttimeC * channelWidth - fTimeMeanShift[2]));
+ }
+ }
+ AliDebug(5,Form("1stimeA %f , besttimeA %f 1sttimeC %f besttimeC %f ",
+ besttimeA, besttimeA_best,
+ besttimeC, besttimeC_best) );
+ AliDebug(5,Form("fRecPoints::: 1stimeA %f , besttimeA %f 1sttimeC %f besttimeC %f shiftA %f shiftC %f ",
+ frecpoints.Get1stTimeA(), frecpoints.GetBestTimeA(),
+ frecpoints.Get1stTimeC(), frecpoints.GetBestTimeC(),
+ fTimeMeanShift[1],fTimeMeanShift[2] ) );
+ if( besttimeC < 999999 && besttimeA < 999999) {
+ if(equalize ==0 )
+ timeclock = ((besttimeC * channelWidth)- 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;
+ }
+
+ } //if phys event
+ AliDebug(1,Form(" timeDiff %f #channel, meanTime %f #ps, TOFmean%f vertex %f cm meanVertex %f \n",timeDiff, meanTime,timeclock, vertex,meanVertex));
+ frecpoints.SetT0clock(timeclock);
+ frecpoints.SetVertex(vertex);
+ frecpoints.SetMeanTime(meanTime);
+ frecpoints.SetOnlineMean(Int_t(onlineMean));