1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15 //_________________________________________________________________________
16 // An analysis task to check the TOF in simulated data
19 //-Distributions of the matching performance
20 //-TOF Time info and (TOF - expected time) plots
21 //-Summary Plots on TOF Pid
22 //////////////////////////////////////////////////////////////////////////////
32 #include <TSpectrum.h>
36 #include "AliTOFQATask.h"
38 #include "AliESDtrack.h"
41 //______________________________________________________________________________
42 AliTOFQATask::AliTOFQATask(const char *name) :
43 AliAnalysisTask(name,""),
71 // Input slot #0 works with an Ntuple
72 DefineInput(0, TChain::Class());
73 // Output slot #0 writes into a TH1 container
74 DefineOutput(0, TObjArray::Class()) ;
77 //______________________________________________________________________________
78 AliTOFQATask::AliTOFQATask(const AliTOFQATask &qatask) :
79 AliAnalysisTask("AliTOFQATask",""),
107 fChain=qatask.fChain;
109 fOutputContainer=qatask.fOutputContainer;
110 fhTOFMatch=qatask.fhTOFMatch;
111 fhESDeffPhi=qatask.fhESDeffPhi;
112 fhESDeffTheta=qatask.fhESDeffTheta;
113 fhESDeffMom=qatask.fhESDeffMom;
114 fhTOFeffPhi=qatask.fhTOFeffPhi;
115 fhTOFeffTheta=qatask.fhTOFeffTheta;
116 fhTOFeffMom=qatask.fhTOFeffMom;
117 fhTOFeffPhiMT=qatask.fhTOFeffPhiMT;
118 fhTOFeffThetaMT=qatask.fhTOFeffThetaMT;
119 fhTOFeffMomMT=qatask.fhTOFeffMomMT;
120 fhTOFsector=qatask.fhTOFsector;
121 fhTOFsectorMT=qatask.fhTOFsectorMT;
122 fhTOFTime=qatask.fhTOFTime;
123 fhTOFDeltaTime=qatask.fhTOFDeltaTime;
124 fhTOFDeltaTimeMT=qatask.fhTOFDeltaTimeMT;
125 fhTOFIDSpecies=qatask.fhTOFIDSpecies;
126 fhTOFMassVsMom=qatask.fhTOFMassVsMom;
127 fhTOFMass=qatask.fhTOFMass;
128 fmatchFracMin=qatask.fmatchFracMin;
129 fmatchEffMin=qatask.fmatchEffMin;
130 ftimePeakMax=qatask.ftimePeakMax;
131 fmassPeakMax=qatask.fmassPeakMax;
133 //______________________________________________________________________________
134 AliTOFQATask:: ~AliTOFQATask()
136 delete fOutputContainer;
139 delete fhESDeffTheta;
142 delete fhTOFeffTheta;
144 delete fhTOFeffPhiMT;
145 delete fhTOFeffThetaMT;
146 delete fhTOFeffMomMT;
148 delete fhTOFsectorMT;
150 delete fhTOFDeltaTime;
151 delete fhTOFDeltaTimeMT;
152 delete fhTOFIDSpecies;
153 delete fhTOFMassVsMom;
156 //______________________________________________________________________________
157 AliTOFQATask& AliTOFQATask::operator=(const AliTOFQATask &qatask)
159 //assignment operator
160 this->fChain=qatask.fChain;
161 this->fESD=qatask.fESD;
162 this->fOutputContainer=qatask.fOutputContainer;
163 this->fhTOFMatch=qatask.fhTOFMatch;
164 this->fhESDeffPhi=qatask.fhESDeffPhi;
165 this->fhESDeffTheta=qatask.fhESDeffTheta;
166 this->fhESDeffMom=qatask.fhESDeffMom;
167 this->fhTOFeffPhi=qatask.fhTOFeffPhi;
168 this->fhTOFeffTheta=qatask.fhTOFeffTheta;
169 this->fhTOFeffMom=qatask.fhTOFeffMom;
170 this->fhTOFeffPhiMT=qatask.fhTOFeffPhiMT;
171 this->fhTOFeffThetaMT=qatask.fhTOFeffThetaMT;
172 this->fhTOFeffMomMT=qatask.fhTOFeffMomMT;
173 this->fhTOFsector=qatask.fhTOFsector;
174 this->fhTOFsectorMT=qatask.fhTOFsectorMT;
175 this->fhTOFTime=qatask.fhTOFTime;
176 this->fhTOFDeltaTime=qatask.fhTOFDeltaTime;
177 this->fhTOFDeltaTimeMT=qatask.fhTOFDeltaTimeMT;
178 this->fhTOFIDSpecies=qatask.fhTOFIDSpecies;
179 this->fhTOFMassVsMom=qatask.fhTOFMassVsMom;
180 this->fhTOFMass=qatask.fhTOFMass;
181 this->fmatchFracMin=qatask.fmatchFracMin;
182 this->fmatchEffMin=qatask.fmatchEffMin;
183 this->ftimePeakMax=qatask.ftimePeakMax;
184 this->fmassPeakMax=qatask.fmassPeakMax;
187 //______________________________________________________________________________
188 void AliTOFQATask::ConnectInputData(const Option_t*)
190 // Initialisation of branch container and histograms
192 AliInfo(Form("*** Initialization of %s", GetName())) ;
195 fChain = dynamic_cast<TChain *>(GetInputData(0)) ;
197 AliError(Form("Input 0 for %s not found\n", GetName()));
201 // One should first check if the branch address was taken by some other task
202 char ** address = (char **)GetBranchAddress(0, "ESD") ;
204 fESD = (AliESD *)(*address) ;
206 fESD = new AliESD() ;
207 SetBranchAddress(0, "ESD", &fESD) ;
211 //______________________________________________________________________________
212 void AliTOFQATask::Exec(Option_t *)
215 //******* The loop over events --------------------------------------------------
220 Int_t pisel=0,kasel=0,prsel=0,elsel=0,musel=0;
221 //Set equal a-priori weights (just charged hadrions)
222 const Int_t nCalinSec=8736;
223 Double_t c[5]={0, 0, 1, 1, 1};
224 // Processing of one event
225 Long64_t entry = fChain->GetReadEntry() ;
227 AliError("fESD is not connected to the input!") ;
231 if ( !((entry-1)%100) )
232 AliInfo(Form("%s ----> Processing event # %lld", (dynamic_cast<TChain *>(fChain))->GetFile()->GetName(), entry)) ;
234 // ************************ TOF *************************************
237 Int_t ntrk = fESD->GetNumberOfTracks() ;
241 AliESDtrack * t = fESD->GetTrack(ntrk) ;
242 if ( (t->GetStatus() & AliESDtrack::kTIME)==0 )continue;
246 Double_t mom = t->GetP() ;
247 Double_t phi = TMath::ATan2(t->GetX(),t->GetY()) ;
248 Double_t theta = TMath::ACos(t->GetZ()/
249 TMath::Sqrt(t->GetX()*t->GetX()+t->GetY()*t->GetY()+t->GetZ()*t->GetZ()));
250 phi*=180/TMath::Pi();
251 theta*=180/TMath::Pi();
253 fhESDeffPhi->Fill(phi);
254 fhESDeffTheta->Fill(theta);
255 fhESDeffMom->Fill(mom);
258 if(t->GetTOFsignal()<0)continue;
262 Double_t time=t->GetTOFsignal();//TOF time in ps
263 Int_t detid=t->GetTOFCalChannel();//which pad was hit
264 Int_t sector = detid/nCalinSec;
265 fhTOFTime->Fill(time*1.E-3);
266 fhTOFeffPhi->Fill(phi);
267 fhTOFeffTheta->Fill(theta);
268 fhTOFeffMom->Fill(mom);
269 fhTOFsector->Fill(sector);
272 Int_t label=TMath::Abs(t->GetLabel());
273 Int_t clab[3]; t->GetTOFLabel(clab);
274 if(label==clab[0] || label==clab[1] || label==clab[2]) {
275 fhTOFeffPhiMT->Fill(phi);
276 fhTOFeffThetaMT->Fill(theta);
277 fhTOFeffMomMT->Fill(mom);
278 fhTOFsectorMT->Fill(sector);
283 UInt_t status=AliESDtrack::kESDpid;status|=AliESDtrack::kTOFpid;
284 if (!((t->GetStatus()&status) == status))continue;
287 t->GetIntegratedTimes(times);//ps
288 Double_t l =t->GetIntegratedLength()/100.; // (m)
290 Double_t invBetaGamma= (0.299*time*1.E-3/l)*(0.299*time*1.E-3/l) -1.;
291 if(invBetaGamma<0){mass = -mom*TMath::Sqrt(-invBetaGamma);}
292 else{mass = mom*TMath::Sqrt(invBetaGamma);}
294 //The Mass/ vs Momentum Plot:
295 fhTOFMassVsMom->Fill(mass,mom);
296 fhTOFMass->Fill(mass);
299 Double_t r[10]; t->GetTOFpid(r);
302 for (i=0; i<AliPID::kSPECIES; i++) rcc+=(c[i]*r[i]);
303 if (rcc==0.) continue;
305 for (i=0; i<AliPID::kSPECIES; i++) w[i]=c[i]*r[i]/rcc;
307 fhTOFDeltaTime->Fill((time-times[2])*1.E-3);
309 if(label==clab[0] || label==clab[1] || label==clab[2]) {
310 fhTOFDeltaTimeMT->Fill((time-times[2])*1.E-3);
313 if (w[4]>w[0] && w[4]>w[1] && w[4]>w[2] && w[4]>w[3]){
315 fhTOFIDSpecies->Fill(4);
317 if (w[3]>w[0] && w[3]>w[1] && w[3]>w[2] && w[3]>w[4]){
319 fhTOFIDSpecies->Fill(3);
321 if (w[2]>w[0] && w[2]>w[1] && w[2]>w[3] && w[2]>w[4]){
323 fhTOFIDSpecies->Fill(2);
325 if (w[1]>w[0] && w[1]>w[2] && w[1]>w[3] && w[1]>w[4]){
327 fhTOFIDSpecies->Fill(1);
329 if (w[0]>w[1] && w[0]>w[2] && w[0]>w[3] && w[0]>w[4]){
331 fhTOFIDSpecies->Fill(0);
336 if(nselESD>10)fracM=((Float_t) nmatchTOF)/((Float_t) nselESD);
337 fhTOFMatch->Fill(fracM);
339 PostData(0, fOutputContainer);
342 //______________________________________________________________________________
343 void AliTOFQATask::CreateOutputObjects()
345 // Construct histograms:
350 new TH1F("hTOFMatch","Fraction of Matched TOF tracks",101,-0.005,1.005);
352 new TH1F("hESDeffPhi","ESD tracks Phi(vtx)", 180, -180., 180.) ;
354 new TH1F("hESDeffTheta","ESD tracks Theta (vtx)",90, 45., 135.) ;
356 new TH1F("hESDeffMom","ESD tracks Momentum (vtx)",40, 0., 6.) ;
358 new TH1F("hTOFeffPhi","TOF, Matched vs Phi(vtx)", 180,-180, 180.);
360 new TH1F("hTOFeffPhiMT","TOF, Well Matched vs Phi(vtx)",180,-180,180.);
362 new TH1F("hTOFeffTheta","TOF, Matched vs Theta(vtx)",90,45.,135.);
364 new TH1F("hTOFeffThetaMT","TOF, Well Matched vs Theta(vtx)",90,45.,135.);
366 new TH1F("hTOFeffMom","TOF, Matched vs Momentum ", 40, 0.,6.);
368 new TH1F("hTOFeffMomMT","TOF, Well Matched vs Momentum ", 40, 0.,6.);
370 new TH1F("hTOFsector","TOF, Matched vs Sector ", 18,0.,18.);
372 new TH1F("hTOFsectorMT","TOF, Well Matched vs Sector", 18, 0.,18.);
374 fhESDeffMom->Sumw2(); fhTOFeffMom->Sumw2(); fhTOFeffMomMT->Sumw2();
375 fhESDeffTheta->Sumw2(); fhTOFeffTheta->Sumw2(); fhTOFeffThetaMT->Sumw2();
376 fhESDeffPhi->Sumw2(); fhTOFeffPhi->Sumw2(); fhTOFeffPhiMT->Sumw2();
377 fhTOFsector->Sumw2(); fhTOFsectorMT->Sumw2();
380 new TH1F("hTOFTime","TOF, t(TOF)in ns ",1000,0,100.);
382 new TH1F("hTOFDeltaTime","TOF,t(TOF)-t(exp,pion), ns ",1000,-4.4,20.);
384 new TH1F("hTOFDeltaTimeMT","TOF, t(TOF)-t(exp,pion) for Well Matched, ns ",1000,-4.4,20.);
386 new TH1F("hTOFIDSpecies","TOF, ID Sample Composition ",5,-0.5,4.5);
388 new TH2F("hTOFMassVsMom","TOF, Mass Vs Momentum ",280,-0.2,1.2,600,0.,6.);
390 new TH1F("hTOFMass","TOF, reconstructed mass ",240,0.,1.2);
393 // create the output container
395 fOutputContainer = new TObjArray(18) ;
396 fOutputContainer->SetName(GetName()) ;
398 fOutputContainer->AddAt(fhTOFMatch, 0) ;
399 fOutputContainer->AddAt(fhESDeffPhi, 1) ;
400 fOutputContainer->AddAt(fhESDeffTheta, 2) ;
401 fOutputContainer->AddAt(fhESDeffMom, 3) ;
402 fOutputContainer->AddAt(fhTOFeffPhi, 4) ;
403 fOutputContainer->AddAt(fhTOFeffPhiMT, 5) ;
404 fOutputContainer->AddAt(fhTOFeffTheta, 6) ;
405 fOutputContainer->AddAt(fhTOFeffThetaMT, 7) ;
406 fOutputContainer->AddAt(fhTOFeffMom, 8) ;
407 fOutputContainer->AddAt(fhTOFeffMomMT, 9) ;
408 fOutputContainer->AddAt(fhTOFsector, 10) ;
409 fOutputContainer->AddAt(fhTOFsectorMT, 11) ;
410 fOutputContainer->AddAt(fhTOFTime, 12) ;
411 fOutputContainer->AddAt(fhTOFDeltaTime , 13) ;
412 fOutputContainer->AddAt(fhTOFDeltaTimeMT, 14) ;
413 fOutputContainer->AddAt(fhTOFIDSpecies, 15) ;
414 fOutputContainer->AddAt(fhTOFMassVsMom, 16) ;
415 fOutputContainer->AddAt(fhTOFMass, 17) ;
418 //______________________________________________________________________________
419 void AliTOFQATask::GetEfficiency()
421 // calculates the efficiency
424 fhTOFeffPhiMT->Divide(fhTOFeffPhiMT,fhTOFeffPhi,1,1,"B");
425 fhTOFeffThetaMT->Divide(fhTOFeffThetaMT,fhTOFeffTheta,1,1,"B");
426 fhTOFeffMomMT->Divide(fhTOFeffMomMT,fhTOFeffMom,1,1,"B");
428 fhTOFeffPhi->Divide(fhTOFeffPhi,fhESDeffPhi,1,1,"B");
429 fhTOFeffTheta->Divide(fhTOFeffTheta,fhESDeffTheta,1,1,"B");
430 fhTOFeffMom->Divide(fhTOFeffMom,fhESDeffMom,1,1,"B");
434 //______________________________________________________________________________
435 Bool_t AliTOFQATask::DrawHistos()
439 Int_t TOFsectors[18]={0,1,1,0,0,0,1,1,0,1,1,1,1,0,0,1,1,1};//TOF sectors which are supposed to be present
440 const char* part[3]={"pions","kaons","protons"};// pi,ka,pr
441 const Float_t masses[3]={0.1396,0.494,0.938};// particle masses pi,ka,pr
444 gROOT->SetStyle("Plain");
445 gStyle->SetPalette(1);
446 gStyle->SetOptStat(111110);
447 gStyle->SetPalette(1);
448 gStyle->SetCanvasColor(0);
449 gStyle->SetFrameFillColor(0);
451 TGaxis::SetMaxDigits(3);
452 gStyle->SetLabelFont(52, "XYZ");
453 gStyle->SetTitleFont(62, "XYZ");
454 gStyle->SetPadRightMargin(0.02);
457 TCanvas * cTOFeff = new TCanvas("cTOFeff", "TOF ESD General", 400, 30, 550, 630) ;
459 cTOFeff->Divide(1,2) ;
461 fhTOFMatch->GetXaxis()->SetTitle("Fraction of matched ESD tracks/event");
462 fhTOFMatch->GetYaxis()->SetTitle("Events");
463 fhTOFMatch->SetFillColor(4);
466 TPad *b = (TPad*)gPad;
469 fhTOFsector->GetXaxis()->SetTitle("Sector index of matched TOF Cluster");
470 fhTOFsector->GetYaxis()->SetTitle("Entries");
471 fhTOFsector->SetFillColor(4);
472 fhTOFsector->SetMinimum(0.);
473 fhTOFsector->GetYaxis()->SetNdivisions(205);
474 fhTOFsector->GetYaxis()->SetTitleOffset(1.2);
475 fhTOFsector->Draw("histo");
477 fhTOFeffMom->SetMaximum(1.2);
478 fhTOFeffMom->GetXaxis()->SetTitle("Track momentum (GeV/c)");
479 fhTOFeffMom->GetYaxis()->SetNdivisions(205);
480 fhTOFeffMom->GetYaxis()->SetTitleOffset(1.2);
481 fhTOFeffMom->GetYaxis()->SetTitle("Fraction of matched ESD tracks");
482 fhTOFeffMom->SetFillColor(4);
484 fhTOFeffMom->Fit("pol0","Q","",0.5,3.);
485 TF1 *fitMom = fhTOFeffMom->GetFunction("pol0");
486 fhTOFeffMom->Draw("histo,same");
488 cTOFeff->Print("TOF_eff.eps");
492 TCanvas * cTOFtime = new TCanvas("cTOFtime", "TOF measured Times ", 400, 30, 550, 630) ;
493 cTOFtime->Divide(1,2) ;
495 if ( fhTOFTime->GetMaximum() > 0 )
496 cTOFtime->GetPad(1)->SetLogy(1);
497 fhTOFTime->GetXaxis()->SetTitle("TOF time (ns)");
498 fhTOFTime->GetYaxis()->SetTitle("Entries");
499 fhTOFTime->SetFillColor(4);
502 if ( fhTOFDeltaTime->GetMaximum() > 0 )
503 cTOFtime->GetPad(2)->SetLogy(1);
504 fhTOFDeltaTime->GetXaxis()->SetTitle("t^{TOF}-t^{exp}_{#pi} (ns)");
505 fhTOFDeltaTime->GetYaxis()->SetTitle("Entries");
506 fhTOFDeltaTime->SetFillColor(4);
508 TSpectrum *timeDiff = new TSpectrum(ntimepeak);
509 Int_t ntime = timeDiff->Search(fhTOFDeltaTime,ntimepeak,"new",0.1);
510 fhTOFDeltaTime->Draw();
512 cTOFtime->Print("TOF_time.eps");
515 TCanvas * cTOFpid = new TCanvas("cTOFpid", "TOF PID ", 400, 30, 550, 630) ;
516 cTOFpid->Divide(1,3) ;
518 if ( fhTOFMass->GetMaximum() > 0 )
520 fhTOFMass->GetXaxis()->SetTitle("Reconstructed Mass (GeV/c^{2})");
521 fhTOFMass->GetYaxis()->SetTitle("Entries");
522 fhTOFMass->SetFillColor(4);
524 if(fhTOFMass->GetEntries()>1000)npmass=3;
525 TSpectrum *mass = new TSpectrum(npmass);
526 Int_t nmass = mass->Search(fhTOFMass,npmass,"new",0.02);
528 if ( fhTOFMassVsMom->GetMaximum() > 0 )
531 fhTOFMassVsMom->GetYaxis()->SetRange(0,400);
532 fhTOFMassVsMom->GetXaxis()->SetTitle("Reconstructed Mass (GeV/c^{2})");
533 fhTOFMassVsMom->GetYaxis()->SetTitle("Track Momentum (GeV/c)");
534 fhTOFMassVsMom->GetXaxis()->SetTitleSize(0.05);
535 fhTOFMassVsMom->GetYaxis()->SetTitleSize(0.05);
536 fhTOFMassVsMom->SetMarkerStyle(20);
537 fhTOFMassVsMom->SetMarkerSize(0.05);
538 fhTOFMassVsMom->SetMarkerColor(2);
539 fhTOFMassVsMom->Draw();
542 TLatex * tex = new TLatex(1., 1.25, "Bayesian PID: a-priori concentrations: [0,0,1,1,1]");
543 tex->SetTextColor(1);
544 tex->SetTextSize(0.045);
545 tex->SetLineWidth(2);
547 Float_t norm=1./fhTOFIDSpecies->GetEntries();
548 fhTOFIDSpecies->Scale(norm);
549 fhTOFIDSpecies->SetMaximum(1.2);
550 fhTOFIDSpecies->GetXaxis()->SetTitle("Particle Type");
551 fhTOFIDSpecies->GetYaxis()->SetTitle("ID Fractions");
552 fhTOFIDSpecies->GetXaxis()->SetTitleSize(0.05);
553 fhTOFIDSpecies->GetYaxis()->SetTitleSize(0.05);
554 fhTOFIDSpecies->SetFillColor(4);
555 fhTOFIDSpecies->Draw();
560 Float_t pifrac=fhTOFIDSpecies->GetBinContent(3);
561 Float_t kafrac=fhTOFIDSpecies->GetBinContent(4);
562 Float_t prfrac=fhTOFIDSpecies->GetBinContent(5);
564 sprintf(ch,"[2]:pion fraction = %5.3f",pifrac);
565 TLatex * texpi = new TLatex(-0.3, 0.9, ch);
566 texpi->SetTextColor(1);
567 texpi->SetTextSize(0.05);
568 texpi->SetLineWidth(2);
570 sprintf(ch,"[3]:kaon fraction = %5.3f",kafrac);
571 TLatex * texka = new TLatex(-0.3, 0.8, ch);
572 texka->SetTextColor(1);
573 texka->SetTextSize(0.05);
574 texka->SetLineWidth(2);
576 sprintf(ch,"[4]:proton fraction = %5.3f",prfrac);
577 TLatex * texpr = new TLatex(-0.3, 0.7, ch);
578 texpr->SetTextColor(1);
579 texpr->SetTextSize(0.05);
580 texpr->SetLineWidth(2);
584 cTOFpid->Print("TOF_pid.eps");
587 sprintf(line, ".!tar -zcf %s.tar.gz *.eps", GetName()) ;
588 gROOT->ProcessLine(line);
589 sprintf(line, ".!rm -fR *.eps");
590 gROOT->ProcessLine(line);
591 AliInfo(Form("*** TOF QA plots saved in %s.tar.gz...", GetName())) ;
593 Bool_t hardProblem=kFALSE;
594 Bool_t softProblem=kFALSE;
595 //------------------------------Matching Efficiency
598 Float_t matchFrac= fhTOFMatch->GetMean();
599 if(matchFrac<fmatchFracMin){
600 AliWarning(Form("*** Overall Fraction of matched tracks too low! Fraction = %f", matchFrac)) ;
603 AliInfo(Form("*** Fraction of matched tracks = %f", matchFrac)) ;
606 if(fhTOFeffMom->GetEntries()<1.){
607 AliWarning(Form("*** No tracks matching with TOF! Fraction is = %f", matchFrac)) ;
613 //The efficiency as a function of momentum:
614 Float_t eff= fitMom->GetParameter(0);
615 Float_t deff= fitMom->GetParError(0);
616 if(eff+3*deff<fmatchEffMin){
617 AliWarning(Form("*** Fraction of matched tracks vs Momentum is too low! Fraction= %f", eff)) ;
620 AliInfo(Form("*** Fraction of matched tracks for p>0.5 GeV is = %f", eff)) ;
623 //Matched tracks vs TOF Sector:
624 for(Int_t isec=1;isec<=18;isec++){
625 if(fhTOFsector->GetBinContent(isec)<1 && TOFsectors[isec-1]>0){
626 AliWarning(Form("*** Missing Entries in sector %i", isec));
629 if(fhTOFsector->GetBinContent(isec)>0 && TOFsectors[isec-1]==0){
630 AliWarning(Form("*** Unexpected Entries in sector %i", isec));
635 //-----------------------------Pid Quality
637 // Look at the time - expected time:
639 AliWarning("*** No peak was found in time difference spectrum!");
642 Float_t *timePos = timeDiff->GetPositionX();
643 if(TMath::Abs(timePos[0])>3*ftimePeakMax){
644 AliWarning(Form("*** Main Peak position in tTOF-TEXP spectrum is sitting very far from where expected! Tpeak = %f ps",timePos[0]*1.E3));
647 else if(TMath::Abs(timePos[0])>ftimePeakMax){
648 AliWarning(Form("*** Main Peak position in tTOF-TEXP spectrum is sitting far from where expected! Tpeak = %f ps",timePos[0]*1.E3));
651 AliInfo(Form("*** Main Peak position in tTOF-TEXP found at = %f ps",timePos[0]*1.E3));
655 // Look at the Mass Spectrum:
657 AliWarning("*** No peak was found in Mass difference spectrum!");
662 Float_t *massPos = mass->GetPositionX();
663 //check the found peaks (sorted in ascending mass order)
664 TMath::Sort(nmass,massPos,massind,kFALSE);
665 for(Int_t imass=0;imass<TMath::Min(nmass,3);imass++){
666 AliInfo(Form("*** the Mass peak for %s found at = %f GeV/c^2",part[imass],massPos[massind[imass]]));
667 if(TMath::Abs( massPos[massind[imass]]-masses[imass])> fmassPeakMax){
668 AliWarning(Form("*** the Mass peak position for %s is not in the right place, found at = %f GeV/c^2",part[imass],massPos[massind[imass]]));
672 // harder check on the pion peak (more statistically significant)
673 if(TMath::Abs( massPos[massind[0]]-masses[0])> 3*fmassPeakMax){
677 // Look at the ID Species:
679 if(fhTOFIDSpecies->GetEntries()>1000){
680 if(pifrac<0.8 || (kafrac<0.01 || kafrac>0.2) || (prfrac<0.01 || prfrac>0.2)){
681 AliWarning(Form("*** Unexpected Id fractions: pions = %f, kaons = %f, protons %f", pifrac,kafrac,prfrac));
688 return hardProblem || softProblem ;
691 //______________________________________________________________________________
692 void AliTOFQATask::Terminate(Option_t *)
694 // Processing when the event loop is ended, some plots+checks
696 AliInfo(Form("*** %s Report:", GetName())) ;
698 Bool_t problem = DrawHistos() ;
702 report="Problems found, please check!!!";
706 AliInfo(Form("*** %s Summary Report: %s\n",GetName(), report)) ;