AliDebug(1,"processed");
fParam = AliT0Parameters::Instance();
fParam->Init();
+ Int_t index[25000];
+ Bool_t down=true;
for (Int_t i=0; i<24; i++){
TGraph* gr = fParam ->GetAmpLEDRec(i);
}
TGraph *grInverse = new TGraph(np,y1,x1);
- delete [] x1;
- delete [] y1;
fAmpLED.AddAtAndExpand(grInverse,i);
+
+ TGraph* grw = fParam ->GetWalk(i);
+ Int_t npw = grw->GetN();
+ Double_t *yw = grw->GetY();
+ TMath::Sort(npw, yw, index,down);
+ fMaxValue[i]=Int_t(yw[index[0]]);
}
+
+ // delete [] x1;
+ // delete [] y1;
}
+
//------------------------------------------------------------------------
AliT0Digitizer::~AliT0Digitizer()
{
qt= 50.*al/ph2Mip; // 50mv/Mip amp in mV
// fill TDC
timeDelayCFD[i] = fParam->GetTimeDelayCFD(i);
- trCFD = Int_t (timeGaus[i]/channelWidth + (timeDelayCFD[i]-timeDelayCFD[0]));
+ trCFD = Int_t (timeGaus[i]/channelWidth + timeDelayCFD[i]);
TGraph* gr = ((TGraph*)fAmpLED.At(i));
sl = gr->Eval(qt);
// put slewing
TGraph *fu=(TGraph*) fParam ->GetWalk(i) ;
Float_t slew=fu->Eval(Float_t(qtCh));
- hr=fu->GetHistogram();
- Float_t maxValue=hr->GetMaximum(50);
- trCFD=trCFD-Int_t((maxValue-slew)/channelWidth);
+
+ trCFD=trCFD-Int_t(fMaxValue[i]-slew);
ftimeCFD->AddAt(Int_t (trCFD),i);
AliDebug(10,Form(" pmt %i : time in ns %f time in channels %i ",
i, timeGaus[i],trCFD ));
fdZonC = TMath::Abs(fParam->GetZPositionShift("T0/C/PMT1"));
fdZonA = TMath::Abs(fParam->GetZPositionShift("T0/A/PMT15"));
- fCalib = new AliT0Calibrator();
+ fCalib = new AliT0Calibrator();
+
}
//____________________________________________________________________
// Int_t mV2Mip = param->GetmV2Mip();
//mV2Mip = param->GetmV2Mip();
Float_t channelWidth = fParam->GetChannelWidth() ;
- Int_t meanT0 = fParam->GetMeanT0();
+ // Int_t meanT0 = fParam->GetMeanT0();
AliDebug(1,Form("Start DIGITS reconstruction "));
AliT0RecPoint* frecpoints= new AliT0RecPoint ();
clustersTree->Branch( "T0", "AliT0RecPoint" ,&frecpoints, 405,1);
- Float_t time[24], adc[24];
+ Float_t time[24], adc[24];
for (Int_t ipmt=0; ipmt<24; ipmt++) {
if(timeCFD->At(ipmt)>0 ){
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));
+ if((qt1-qt0)>0) adc[ipmt] = Int_t (TMath::Exp( Double_t (channelWidth*(qt1-qt0)/1000)));
+
time[ipmt] = fCalib-> WalkCorrection( ipmt, Int_t(qt1) , timeCFD->At(ipmt), "pdc" ) ;
//LED
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]);
+ AliDebug(1,Form(" ipmt %i QTC %i , time in chann %i (led-cfd) %i ",
+ ipmt, Int_t(adc[ipmt]) ,Int_t(time[ipmt]),Int_t( sl)));
+ frecpoints->SetTime(ipmt,Int_t(time[ipmt]));
+ frecpoints->SetAmp(ipmt,Int_t (adc[ipmt]));
frecpoints->SetAmpLED(ipmt,qt);
}
else {
}
if(besttimeA !=999999) frecpoints->SetTimeBestA(Int_t(besttimeA));
if( besttimeC != 999999 ) frecpoints->SetTimeBestC(Int_t(besttimeC));
- AliDebug(1,Form(" besttimeA %f ps, besttimeC %f ps",besttimeA, besttimeC));
+ AliDebug(1,Form(" besttimeA %f ch, besttimeC %f ch",besttimeA, besttimeC));
Float_t c = 0.0299792; // cm/ps
Float_t vertex = 0;
if(besttimeA !=999999 && besttimeC != 999999 ){
- timeDiff =(besttimeC - besttimeA)*channelWidth;
- meanTime = (meanT0 - (besttimeA + besttimeC)/2) * channelWidth;
+ timeDiff = (besttimeC - besttimeA)*channelWidth;
+ meanTime = (Float_t((besttimeA + besttimeC)/2) * channelWidth);
+ // meanTime = (meanT0 - (besttimeA + besttimeC)/2) * channelWidth;
vertex = c*(timeDiff)/2. + (fdZonA - fdZonC)/2; //-(lenr-lenl))/2;
AliDebug(1,Form(" timeDiff %f ps, meanTime %f ps, vertex %f cm",timeDiff, meanTime,vertex ));
frecpoints->SetVertex(vertex);
for (Int_t ipmt=0; ipmt<24; ipmt++) {
if(time[ipmt]>1) {
// time[ipmt] = (time[ipmt] - fTime0vertex[ipmt])*channelWidth;
- time[ipmt] = time[ipmt] * channelWidth;
+ time[ipmt] =Int_t ( Float_t(time[ipmt]) * channelWidth);
frecpoints->SetTime(ipmt,time[ipmt]);
}
}
for (Int_t j0=0; j0<5; j0++) allData[i0][j0]=0;
}
- Int_t besttimeA=9999999;
- Int_t besttimeC=9999999;
+ Float_t besttimeA=9999999;
+ Float_t besttimeC=9999999;
Int_t pmtBestA=99999;
Int_t pmtBestC=99999;
- Int_t timeDiff=9999999, meanTime=0;
+ Float_t timeDiff=9999999, meanTime=0;
Double_t qt=0;
AliT0RecPoint* frecpoints= new AliT0RecPoint ();
Float_t channelWidth = fParam->GetChannelWidth() ;
- Int_t meanT0 = fParam->GetMeanT0();
+ // Int_t meanT0 = fParam->GetMeanT0();
if(option == "pdc"){
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]));
- Int_t time[24], adc[24];
+ Float_t time[24], adc[24];
for (Int_t ipmt=0; ipmt<24; ipmt++) {
if(timeCFD[ipmt]>0 && timeLED[ipmt]>0){
Double_t sl = (timeLED[ipmt] - time[ipmt])*channelWidth;
if(fAmpLEDrec.At(ipmt))
qt=((TGraph*)fAmpLEDrec.At(ipmt))->Eval(sl/1000.);
- frecpoints->SetTime(ipmt,time[ipmt]);
- frecpoints->SetAmp(ipmt,adc[ipmt]);
+ frecpoints->SetTime(ipmt,Int_t(time[ipmt]));
+ frecpoints->SetAmp(ipmt,Int_t(adc[ipmt]));
frecpoints->SetAmpLED(ipmt,qt);
- AliDebug(10,Form(" QTC %i mv, time in chann %i ",adc[ipmt] ,time[ipmt]));
+ AliDebug(10,Form(" QTC %f mv, time in chann %f ",adc[ipmt] ,time[ipmt]));
}
if(option == "cosmic") {
// if(ipmt == 15) continue; //skip crashed PMT
}
if(besttimeA !=9999999) frecpoints->SetTimeBestA(Int_t(besttimeA));
if( besttimeC != 9999999 ) frecpoints->SetTimeBestC(Int_t(besttimeC));
- AliDebug(1,Form(" besttimeA %i ps, besttimeC %i ps",besttimeA, besttimeC));
+ AliDebug(1,Form(" besttimeA %f ps, besttimeC %f ps",besttimeA, besttimeC));
Float_t c = 0.0299792; // cm/ps
Float_t vertex = 99999;
if(besttimeA <9999999 && besttimeC < 9999999 ){
- timeDiff =Int_t (( besttimeC - besttimeA) *channelWidth);
+ timeDiff = ( besttimeC - besttimeA) *channelWidth;
if(option == "pdc")
- meanTime = Int_t((meanT0 - (besttimeA + besttimeC)/2) * channelWidth);
- if(option == "cosmic") meanTime = (besttimeA + besttimeC)/2;
- vertex = c*(Float_t(timeDiff))/2.+ (fdZonA - fdZonC)/2;
- AliDebug(1,Form(" timeDiff %i ps, meanTime %i ps, vertex %f cm",timeDiff, meanTime,vertex ));
+ // meanTime = Int_t((meanT0 - (besttimeA + besttimeC)/2) * channelWidth);
+ meanTime = (besttimeA + besttimeC)/2 * channelWidth;
+ if(option == "cosmic")
+ meanTime = Float_t((besttimeA + besttimeC)/2);
+ vertex = c*(timeDiff)/2.+ (fdZonA - fdZonC)/2;
+ AliDebug(1,Form(" timeDiff %f ps, meanTime %f ps, vertex %f cm",timeDiff, meanTime,vertex ));
frecpoints->SetVertex(vertex);
frecpoints->SetMeanTime(Int_t(meanTime));