//________________________________________________________________
AliT0CalibWalk::AliT0CalibWalk(): TNamed(),
fWalk(0),
- fAmpLEDRec(0)
+ fAmpLEDRec(0),
+ fQTC(0),
+ fAmpLED(0)
{
//
}
//________________________________________________________________
AliT0CalibWalk::AliT0CalibWalk(const char* name):TNamed(),
fWalk(0),
- fAmpLEDRec(0)
+ fAmpLEDRec(0), fQTC(0),
+ fAmpLED(0)
+
{
TString namst = "Calib_";
namst += name;
AliT0CalibWalk::AliT0CalibWalk(const AliT0CalibWalk& calibda) :
TNamed(calibda),
fWalk(0),
- fAmpLEDRec(0)
-
+ fAmpLEDRec(0),
+ fQTC(0),
+ fAmpLED(0)
+
{
// copy constructor
SetName(calibda.GetName());
TGraph* gr = new TGraph(isum, amplitude, time);
fWalk.AddAtAndExpand(gr,ipmt);
+
+ //should be change to real
+ Double_t xq[10] = { 1220, 1370, 1542, 1697, 1860, 2023,2171,2331,2495,2684};
+ Double_t yq[10] = {1,2,3,4,5,6,7,8,9,10};
+ TGraph* gr1 = new TGraph(10, xq, yq);
+ fQTC.AddAtAndExpand(gr1,ipmt);
}
//________________________________________________________________
y1[ir]=y[i-ir]; x1[ir]=x[i-ir];}
TGraph* gr = new TGraph(i,y1,x1);
fAmpLEDRec.AddAtAndExpand(gr,ipmt);
+ //should be change to real
+ Double_t xq[10] = { 411, 412,413,415,417,419,422,428,437,452};
+ Double_t yq[10] = {1,2,3,4,5,6,7,8,9,10};
+ TGraph* gr1 = new TGraph(10, xq, yq);
+ fAmpLED.AddAtAndExpand(gr1,ipmt);
}
void AliT0CalibWalk::MakeWalkCorrGraph(const char *laserFile)
{
//make walk corerction for preprocessor
-
+
+ Double_t *grY ; //= new grY[2500] ;
+ Double_t *grX ;
TFile *gFile = TFile::Open(laserFile);
-
- Int_t npeaks = 20;
- Double_t sigma=3.;
- Bool_t down = false;
-
- Int_t index[20];
- Char_t buf1[20], buf2[20],buf3[20];
+ // gFile->ls();
+ Float_t x1[10], y1[10];
+ Float_t x2[10], y2[10];
+
+ Float_t xx1[10],yy1[10], xx[10];
+
+ TH2F* hCFDvsQTC[24][10]; TH2F* hCFDvsLED[24][10];
+
for (Int_t i=0; i<24; i++)
{
- if(i>11) { sprintf(buf1,"T0_A_%i_CFD",i+1-12); }
-
- if(i<12) { sprintf(buf1,"T0_C_%i_CFD",i+1); }
-
- sprintf(buf2,"CFDvsQTC%i",i+1);
- sprintf(buf3,"CFDvsLED%i",i+1);
- // cout<<buf1<<" "<<buf2<<" "<<buf3<<endl;
- TH2F *qtcVScfd = (TH2F*) gFile->Get(buf2);
- // qtcVScfd->Print();
- TH2F *ledVScfd = (TH2F*) gFile->Get(buf3);
- TH1F *cfd = (TH1F*) gFile->Get(buf1);
-
- TSpectrum *s = new TSpectrum(2*npeaks,1);
- Int_t nfound = s->Search(cfd,sigma,"goff",0.1);
- // cout<<"Found "<<nfound<<" peaks sigma "<<sigma<<endl;;
- if(nfound!=0){
- Float_t *xpeak = s->GetPositionX();
- TMath::Sort(nfound, xpeak, index,down);
- Float_t xp = xpeak[index[0]];
- Int_t xbin = cfd->GetXaxis()->FindBin(xp);
- Float_t yp = cfd->GetBinContent(xbin);
- // cout<<"xbin = "<<xbin<<"\txpeak = "<<xpeak[1]<<"\typeak = "<<yp<<endl;
- Float_t hmax = xp+20*sigma;
- Float_t hmin = xp-20*sigma;
- }
- //QTC
- Int_t nbins= qtcVScfd->GetXaxis()->GetNbins();
- TProfile *prY = qtcVScfd->ProfileX();
- Float_t hmin = qtcVScfd->GetYaxis()->GetXmin();
- Float_t hmax = qtcVScfd->GetYaxis()->GetXmax();
- prY->SetMaximum(hmax);
- prY->SetMinimum(hmin);
- Int_t np=0; //=nbins/5;
- Double_t *xx = new Double_t[nbins];
- Double_t *yy = new Double_t[nbins];
- Int_t ng=0;
- Double_t yg=0;
- for (Int_t ip=1; ip<nbins; ip++)
- {
-
- if(ip%5 != 0 )
- {
- // if (prY->GetBinContent(ip) !=0)
- if (prY->GetBinContent(ip) >hmin && prY->GetBinContent(ip)<hmax){
- yg +=prY->GetBinContent(ip);
- ng++;
- // cout<<" ip "<<ip<<" Y "<<yg<<endl;
- }
- }
- else {
- if (/*prY->GetBinContent(ip) >hmin && prY->GetBinContent(ip)<hmax &&*/ ng>0){
- // xx[ip/5] = Float_t (prY->GetBinCenter(ip));
- // yy[ip/5] = yg/ng;
- xx[np] = Float_t (prY->GetBinCenter(ip));
- yy[np] = yg/ng;
- yg=0;
- ng=0;
- // cout<<" ip "<<ip<<" np "<<np<<" XX "<<xx[np]<<" YY "<<yy[np]<<endl;
- np++;
- }
- }
- }
+ for (Int_t im=0; im<10; im++)
+ {
+
+ TString qtc = Form("QTCvsCFD%i_%i",i+1,im+1);
+ TString led = Form("LEDvsCFD%i_%i",i+1,im+1);
+ hCFDvsQTC[i][im] = (TH2F*) gFile->Get(qtc.Data()) ;
+ hCFDvsLED[i][im] = (TH2F*) gFile->Get(led.Data());
- TGraph *gr = new TGraph(np,xx,yy);
- gr->SetMinimum(hmin);
- gr->SetMaximum(hmax);
- fWalk.AddAtAndExpand(gr,i);
+ x1[im] = hCFDvsQTC[i][im]->GetMean(1);
+ y1[im] = hCFDvsQTC[i][im]->GetMean(2);
+ x2[im] = hCFDvsLED[i][im]->GetMean(1);
+ y2[im] = hCFDvsLED[i][im]->GetMean(2);
+ xx[im]=im+1;
+ //cout<<" qtc "<< x1[im]<<" "<< y1[im]<<endl;
+ }
+ for (Int_t imi=0; imi<10; imi++)
+ {
+ yy1[imi] = Float_t (10-imi);
+ xx1[imi]=x2[10-imi-1];
+
+ // cout<<i<<" "<<imi<<" "<<" qtc " <<x1[imi]<<" "<<xx[imi]<<
+ // " led "<<x2[imi]<<" "<<y2[imi]<<" led2d "<<yy1[imi]<<" "<<xx1[imi]<<endl;
+ }
+ TGraph *gr1 = new TGraph (10,x1,y1);
+ TGraph *gr2 = new TGraph (10,x2,y2);
+ fWalk.AddAtAndExpand(gr1,i);
+ fAmpLEDRec.AddAtAndExpand(gr2,i);
+
- //LED
- Int_t nbinsled= ledVScfd->GetXaxis()->GetNbins();
- cout<<" nbins led "<<nbinsled<<endl;
- TProfile *prledY = ledVScfd->ProfileX();
-
- Int_t npled = 0; //nbinsled/5;
- Double_t *xxled = new Double_t[nbinsled];
- Double_t *yyled = new Double_t[nbinsled];
- Int_t ngled=0;
- Double_t ygled=0;
- for (Int_t ip=1; ip<nbinsled; ip++)
- {
- if(ip%5 != 0 ) {
- if (prledY->GetBinContent(ip) !=0)
- ygled +=prledY->GetBinContent(ip);
- ngled++;}
- else {
- xxled[npled] = Float_t (prledY->GetBinCenter(ip));
- yyled[npled] = ygled/ngled;
- ygled=0;
- ngled=0;
- npled++;
- }
+
+ TGraph *gr4 = new TGraph (10,xx1,yy1);
+ TGraph *gr3 = new TGraph (10,x1,xx);
+ /*
+ if(gr4) {
+ Int_t np=gr4->GetN();
+ if(np>0) {
+ grY = gr4->GetY();
+ grX = gr4->GetX();
+ for (Int_t ig=0; ig<np; ig++)
+ cout<<i<<" "<<ig<<" "<<grX[ig]<<" "<<grY[ig]<<" eval "<<gr4->Eval(grX[ig])<<endl;
+ }
}
-
- TGraph *grled = new TGraph(npled,xxled,yyled);
- grled->SetMinimum(hmin);
- grled->SetMaximum(hmax);
- fAmpLEDRec.AddAtAndExpand(grled,i);
+ */
+ fQTC.AddAtAndExpand(gr3,i);
+ fAmpLED.AddAtAndExpand(gr4,i);
+ // for (Int_t im=0; im<10; im++) { x2[im]=0; y2[im]=0; xx1[im]=0; xx[im]=0;}
- delete [] xx;
- delete [] yy;
- delete [] xxled;
- delete [] yyled;
- delete prY;
- delete prledY;
-
- // }
- delete cfd;
- delete qtcVScfd;
- delete ledVScfd;
}
-
}
+
+
+
TGraph *GetWalk(Int_t ipmt ) const {return (TGraph*)fWalk.At(ipmt);}
- Float_t GetWalkVal(Int_t ipmt, Float_t mv ) const {return ((TGraph*)fWalk.At(ipmt))->Eval(mv);}
void SetWalk(Int_t ipmt) ;
+ TObjArray* GetfWalk() {return &fWalk;}
+
+ TGraph *GetQTC(Int_t ipmt ) const {return (TGraph*)fQTC.At(ipmt);}
+ // void SetQTC(Int_t ipmt) ;
+
+ TGraph *GetAmpLED(Int_t ipmt ) const {return (TGraph*)fAmpLED.At(ipmt);}
+ // void SetAmpLED(Int_t ipmt) ;
+
void MakeWalkCorrGraph(const char *laserFile);
+
TGraph * GetAmpLEDRec(Int_t ipmt) const {return (TGraph*)fAmpLEDRec.At(ipmt);}
- Float_t GetAmpLEDRecVal(Int_t ipmt, Float_t mv) const
- {return((TGraph*)fAmpLEDRec.At(ipmt))->Eval(mv);}
void SetAmpLEDRec(Int_t ipmt) ;
- TObjArray* GetfWalk() {return &fWalk;}
protected:
TObjArray fWalk; //time - amp. walk
TObjArray fAmpLEDRec; //time - amp. LED-CFD for reconstruction
-
+ TObjArray fQTC; //time - amp. walk
+ TObjArray fAmpLED; //time - amp. LED-CFD for reconstruction
+
//
- ClassDef(AliT0CalibWalk,1) // T0 Sensor Calibration data
+ ClassDef(AliT0CalibWalk,2) // T0 Sensor Calibration data
};
typedef AliT0CalibWalk AliSTARTCalibWalk; // for backward compatibility
//__________________________________________________________________
-Float_t AliT0Parameters::GetWalkVal(Int_t ipmt, Float_t mv) const
+TGraph *AliT0Parameters::GetQTC(Int_t ipmt) const
{
if (!fSlewCorr) {
- return ((TGraph*)fWalk.At(ipmt))->Eval(mv);
+ AliError("No walk correction is available!");
+ // return (TGraph*)fQTC.At(ipmt);
+ return 0;
}
- return fgSlewCorr -> GetWalkVal(ipmt, mv) ;
+ return fgSlewCorr -> GetQTC(ipmt) ;
}
+//__________________________________________________________________
+TGraph *AliT0Parameters::GetAmpLED(Int_t ipmt) const
+{
+ if (!fSlewCorr) {
+ AliError("No walk correction is available!");
+ // return (TGraph*)fQTC.At(ipmt);
+ return 0;
+ }
+ return fgSlewCorr -> GetAmpLED(ipmt) ;
+}
//__________________________________________________________________
void
TGraph * GetAmpLEDRec(Int_t ipmt) const;
-
TGraph *GetWalk(Int_t ipmt ) const;
- Float_t GetWalkVal(Int_t ipmt, Float_t mv ) const ;
+ TGraph *GetQTC(Int_t ipmt) const;
+ TGraph *GetAmpLED(Int_t ipmt) const;
Float_t GetTimeDelayCFD(Int_t ipmt);
// Float_t GetTimeV0(Int_t ipmt = 512) {return fTimeV0;}
TObjArray fAmpLEDRec; // array of amlitude vs LED-CFD (simulation & reconstruction)
TObjArray fPMTeff; //array PMT registration efficiency
TObjArray fWalk; //array time-amplitude walk
+ TObjArray fQTC; //array of TGraphs for QTC vs number of MIPs
+ TObjArray fAmpLED; //array of TGraphs for LED-CFD vs number of MIPs
+
Float_t fTimeDelayCFD; // sum time delay for CFD channel
// Float_t fTimeV0; // sum time delay for CFD channel
fZposition(0),
fParam(NULL),
fAmpLEDrec(),
+ fQTC(0),
+ fAmpLED(0),
fCalib()
{
//constructor
fParam = AliT0Parameters::Instance();
fParam->Init();
-
+ TString option = GetOption();
+
for (Int_t i=0; i<24; i++){
TGraph* gr = fParam ->GetAmpLEDRec(i);
if (gr) fAmpLEDrec.AddAtAndExpand(gr,i) ;
-}
+ TGraph* gr1 = fParam ->GetAmpLED(i);
+ if (gr1) fAmpLED.AddAtAndExpand(gr1,i) ;
+ TGraph* gr2 = fParam ->GetQTC(i);
+ if (gr2) fQTC.AddAtAndExpand(gr2,i) ;
+
+ }
fdZonC = TMath::Abs(fParam->GetZPositionShift("T0/C/PMT1"));
fdZonA = TMath::Abs(fParam->GetZPositionShift("T0/A/PMT15"));
fZposition(0),
fParam(NULL),
fAmpLEDrec(),
+ fQTC(0),
+ fAmpLED(0),
fCalib()
{
fDigits->GetQT0(*chargeQT0);
fDigits->GetQT1(*chargeQT1);
Int_t onlineMean = fDigits->MeanTime();
- cout<<" !!!! onlineMean "<<onlineMean<<endl;
+
Float_t besttimeA=999999;
Float_t besttimeC=999999;
Int_t pmtBestC=99999;
Float_t timeDiff=999999, meanTime=0;
+ Int_t mv2MIP = fParam-> GetmV2Mip();
+
AliT0RecPoint* frecpoints= new AliT0RecPoint ();
clustersTree->Branch( "T0", "AliT0RecPoint" ,&frecpoints, 405,1);
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.);
- 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);
+ AliDebug(1,Form(" ipmt %i QTC %f ch QTC in MIP %f, time in chann %f (led-cfd) %f in MIPs %f",
+ ipmt, adc[ipmt], adc[ipmt]/Float_t(mv2MIP), time[ipmt],sl, qt/Float_t(mv2MIP)));
+
+ frecpoints->SetTime(ipmt,time[ipmt]);
+ frecpoints->SetAmp(ipmt,adc[ipmt]/Float_t(mv2MIP));
+ frecpoints->SetAmpLED(ipmt,qt/Float_t(mv2MIP));
}
else {
time[ipmt] = 0;
Int_t pmtBestC=99999;
Float_t timeDiff=9999999, meanTime=0;
Double_t qt=0;
-
+ Int_t mv2MIP = fParam-> GetmV2Mip();
+
AliT0RecPoint* frecpoints= new AliT0RecPoint ();
recTree->Branch( "T0", "AliT0RecPoint" ,&frecpoints, 405,1);
timeLED[in+12] = allData[in+68+1][0] ;
}
- for (Int_t in=0; in<24; in=in+2)
+ for (Int_t in=0; in<12; in++)
{
- Int_t cc=in/2;
- chargeQT1[cc]=allData[in+25][0];
- chargeQT0[cc]=allData[in+26][0];
+ chargeQT1[in]=allData[2*in+25][0];
+ chargeQT0[in]=allData[2*in+26][0];
}
- for (Int_t in=24; in<48; in=in+2)
+
+ for (Int_t in=12; in<24; in++)
{
- Int_t cc=in/2;
- chargeQT1[cc]=allData[in+57][0];
- chargeQT0[cc]=allData[in+58][0];
+ chargeQT1[in]=allData[2*in+57][0];
+ chargeQT0[in]=allData[2*in+58][0];
}
}
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]));
+ AliDebug(10, Form(" readed Raw %i %i %i %i %i",
+ in, timeLED[in],timeCFD[in],chargeQT0[in],chargeQT1[in]));
Int_t onlineMean = allData[49][0];
Float_t time[24], adc[24];
Double_t sl = (timeLED[ipmt] - time[ipmt])*channelWidth;
if(fAmpLEDrec.At(ipmt))
qt=((TGraph*)fAmpLEDrec.At(ipmt))->Eval(sl/1000.);
- frecpoints->SetTime(ipmt,Int_t(time[ipmt]));
- frecpoints->SetAmp(ipmt,Int_t(adc[ipmt]));
- frecpoints->SetAmpLED(ipmt,qt);
+ frecpoints->SetTime(ipmt,time[ipmt]);
+ frecpoints->SetAmp(ipmt,adc[ipmt]/Float_t(mv2MIP));
+ frecpoints->SetAmpLED(ipmt,qt/Float_t(mv2MIP));
AliDebug(10,Form(" QTC %f mv, time in chann %f ampLED %f",adc[ipmt] ,time[ipmt], qt));
+ AliDebug(10,Form(" Amlitude in MIPS LED %f , QTC %f \n ", adc[ipmt]/Float_t(mv2MIP),qt/Float_t(mv2MIP)));
}
if(option == "cosmic") {
// if(ipmt == 15) continue; //skip crashed PMT
else
adc[ipmt] = 0;
// time[ipmt] = fCalib-> WalkCorrection( ipmt, adc[ipmt], timeCFD[ipmt],"cosmic" ) ;
- // time[ipmt] = timeCFD[ipmt] ;
+
Double_t sl = timeLED[ipmt] - timeCFD[ipmt];
time[ipmt] = fCalib-> WalkCorrection( ipmt, Int_t(sl), timeCFD[ipmt],"cosmic" ) ;
- if(fAmpLEDrec.At(ipmt))
- qt=((TGraph*)fAmpLEDrec.At(ipmt))->Eval(sl);
+ // if(fAmpLEDrec.At(ipmt))
+ // qt=((TGraph*)fAmpLEDrec.At(ipmt))->Eval(sl);
time[ipmt] = time[ipmt] - allData[0][0] + 5000;
- AliDebug(10,Form(" ipmt %i QTC %i , time in chann %i (led-cfd) %i ampLED %f",
- ipmt, Int_t(adc[ipmt]) ,Int_t(time[ipmt]),Int_t( sl), qt));
+ 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)));
+ 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 \n ",ampMip,qtMip));
+
frecpoints->SetTime(ipmt, Float_t(time[ipmt]) );
- frecpoints->SetAmp(ipmt, Float_t(adc[ipmt]));
- frecpoints->SetAmpLED(ipmt, Float_t(qt));
+ frecpoints->SetAmp(ipmt, Float_t( ampMip)); //for cosmic &pp beam
+ frecpoints->SetAmpLED(ipmt, Float_t(qtMip));
+
+
}
}
Float_t fTime0vertex[24]; // time position if Zvertex=0
AliT0Parameters *fParam; //pointer to T0 parameters class
TObjArray fAmpLEDrec; // amp LED-CFD
- // TObjArray fWalk; // amp LED-CFD
+ TObjArray fQTC; // QTC vs #MIPs
+ TObjArray fAmpLED; // LED-CFD vs #MIPs
AliT0Calibrator *fCalib; //pointer to T0 Calibrator
- ClassDef(AliT0Reconstructor, 2) // class for the T0 reconstruction
+ ClassDef(AliT0Reconstructor, 3) // class for the T0 reconstruction
};