1 // The following methods are defined in this file:
2 // Begin(): called everytime a loop on the tree starts, a convenient place to create your histograms.
3 // SlaveBegin(): called after Begin(), when on PROOF called only on the slave servers.
4 // Process(): called for each event, in this function you decide what to read and fill your histograms.
5 // SlaveTerminate: called at the end of the loop on the tree, when on PROOF called only on the slave servers.
6 // Terminate(): called at the end of the loop on the tree, a convenient place to draw/fit your histograms.
8 #include "EsdQa.h" //class header
9 #include <TCanvas.h> //Terminate()
12 #include <TBenchmark.h>
14 #include <fstream> //caf()
15 #include <TProof.h> //caf()
16 #include <TDSet.h> //caf()
17 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
18 void EsdQa::Begin(TTree *)
20 // The Begin() function is called at the start of the query.
21 // When running with PROOF Begin() is only called on the client.
22 // The tree argument is deprecated (on PROOF 0 is passed).
24 TString option = GetOption();
27 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
28 void EsdQa::SlaveBegin(TTree *tree)
30 // The SlaveBegin() function is called after the Begin() function.
31 // When running with PROOF SlaveBegin() is called on each slave server.
32 // The tree argument is deprecated (on PROOF 0 is passed).
36 TString option = GetOption();
38 // create histograms on each slave server
39 fCkovP = new TH2F("CkovP" , "#theta_{c}, [rad];P, [GeV]", 150, 0, 7 ,100, 0, 1);
40 fSigP = new TH2F("SigP" ,"#sigma_{#theta_c}" , 150, 0, 7 ,100, 0, 1e20);
41 fMipXY = new TH2F("MipXY" ,"mip position" , 260, 0,130 ,252,0,126);
42 fDifXY = new TH2F("DifXY" ,"diff" , 260, -10, 10 ,252,-10,10);
44 fProb[0] = new TH1F("PidE" ,"PID: e yellow #mu magenta" ,100,0,1); fProb[0]->SetLineColor(kYellow);
45 fProb[1] = new TH1F("PidMu","pid of #mu" ,100,0,1); fProb[1]->SetLineColor(kMagenta);
46 fProb[2] = new TH1F("PidPi","PID: #pi red K green p blue",100,0,1); fProb[2]->SetLineColor(kRed);
47 fProb[3] = new TH1F("PidK" ,"pid of K" ,100,0,1); fProb[3]->SetLineColor(kGreen);
48 fProb[4] = new TH1F("PidP" ,"pid of p" ,100,0,1); fProb[4]->SetLineColor(kBlue);
50 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
51 void EsdQa::Init(TTree *tree)
53 // The Init() function is called when the selector needs to initialize
54 // a new tree or chain. Typically here the branch addresses of the tree
55 // will be set. It is normaly not necessary to make changes to the
56 // generated code, but the routine can be extended by the user if needed.
57 // Init() will be called many times when running with PROOF.
59 // Set branch addresses
63 fChain->SetBranchAddress("ESD", &fEsd) ;
65 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
66 Bool_t EsdQa::Notify()
68 // The Notify() function is called when a new file is opened. This
69 // can be either for a new TTree in a TChain or when when a new TTree
70 // is started when using PROOF. Typically here the branch pointers
71 // will be retrieved. It is normaly not necessary to make changes
72 // to the generated code, but the routine can be extended by the
75 // Get branch pointers
79 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
80 Bool_t EsdQa::Process(Long64_t entry)
82 // The Process() function is called for each entry in the tree (or possibly
83 // keyed object in the case of PROOF) to be processed. The entry argument
84 // specifies which entry in the currently loaded tree is to be processed.
85 // It can be passed to either TTree::GetEntry() or TBranch::GetEntry()
86 // to read either all or the required parts of the data. When processing
87 // keyed objects with PROOF, the object is already loaded and is available
88 // via the fObject pointer.
90 // This function should contain the "body" of the analysis. It can contain
91 // simple or elaborate selection criteria, run algorithms on the data
92 // of the event and typically fill histograms.
94 // WARNING when a selector is used with a TChain, you must use
95 // the pointer to the current TTree to call GetEntry(entry).
96 // The entry is always the local entry number in the current tree.
97 // Assuming that fChain is the pointer to the TChain being processed,
98 // use fChain->GetTree()->GetEntry(entry).
100 fChain->GetTree()->GetEntry(entry);
102 for(Int_t iTrk=0;iTrk<fEsd->GetNumberOfTracks();iTrk++){
103 AliESDtrack *pTrk=fEsd->GetTrack(iTrk);
105 if(pTrk->GetRICHsignal()<0) continue;
107 fCkovP->Fill(pTrk->GetP(),pTrk->GetRICHsignal()) ;
108 fSigP ->Fill(pTrk->GetP(),TMath::Sqrt(pTrk->GetRICHchi2()));
110 Float_t xm,ym; pTrk->GetRICHmipXY(xm,ym); fMipXY->Fill(xm,ym);
111 Float_t xd,yd; pTrk->GetRICHdxdy(xd,yd); fDifXY->Fill(xd,yd);
113 Double_t pid[5]; pTrk->GetRICHpid(pid); for(Int_t i =0;i<5;i++) fProb[i]->Fill(pid[i]);
118 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
119 void EsdQa::SlaveTerminate()
121 // The SlaveTerminate() function is called after all entries or objects
122 // have been processed. When running with PROOF SlaveTerminate() is called
123 // on each slave server.
125 // Add the histograms to the output on each slave server
127 fOutput->Add(fCkovP);
129 fOutput->Add(fMipXY);
130 fOutput->Add(fDifXY);
132 for(Int_t i=0;i<5;i++) fOutput->Add(fProb[i]);
134 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
135 void EsdQa::Terminate()
137 // The Terminate() function is the last function to be called during
138 // a query. It always runs on the client, it can be used to present
139 // the results graphically or save the results to file.
141 fCkovP = dynamic_cast<TH2F*>(fOutput->FindObject("CkovP")) ;
142 fSigP = dynamic_cast<TH2F*>(fOutput->FindObject("SigP")) ;
143 fMipXY = dynamic_cast<TH2F*>(fOutput->FindObject("MipXY")) ;
144 fDifXY = dynamic_cast<TH2F*>(fOutput->FindObject("DifXY")) ;
146 fProb[0] = dynamic_cast<TH1F*>(fOutput->FindObject("PidE")) ;
147 fProb[1] = dynamic_cast<TH1F*>(fOutput->FindObject("PidMu")) ;
148 fProb[2] = dynamic_cast<TH1F*>(fOutput->FindObject("PidPi")) ;
149 fProb[3] = dynamic_cast<TH1F*>(fOutput->FindObject("PidK")) ;
150 fProb[4] = dynamic_cast<TH1F*>(fOutput->FindObject("PidP")) ;
152 Float_t n=1.292; //mean freon ref idx
153 TF1 *pPi=new TF1("RiPiTheo","acos(sqrt(x*x+[0]*[0])/(x*[1]))",1.2,7); pPi->SetLineWidth(1); pPi->SetParameter(1,n);
154 AliPID ppp; pPi->SetLineColor(kRed); pPi->SetParameter(0,AliPID::ParticleMass(AliPID::kPion)); //mass
155 TF1 *pK=(TF1*)pPi->Clone(); pK ->SetLineColor(kGreen); pK ->SetParameter(0,AliPID::ParticleMass(AliPID::kKaon));
156 TF1 *pP=(TF1*)pPi->Clone(); pP ->SetLineColor(kBlue); pP ->SetParameter(0,AliPID::ParticleMass(AliPID::kProton));
158 TCanvas *pC=new TCanvas("c1","ESD QA");pC->SetFillColor(10); pC->SetHighLightColor(10); pC->Divide(3,2);
159 pC->cd(1); fCkovP->Draw(); pPi->Draw("same"); pK->Draw("same"); pP->Draw("same"); pC->cd(2); fMipXY->Draw(); pC->cd(3); fProb[0]->Draw(); fProb[1]->Draw("same");
160 pC->cd(4); fSigP ->Draw(); pC->cd(5); fDifXY->Draw(); pC->cd(6); fProb[2]->Draw(); fProb[3]->Draw("same"); fProb[4]->Draw("same");
163 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
167 TChain* pChain =new TChain("esdTree");
168 pChain->Add("AliESDs.root");
170 pChain->Process("EsdQa.C+");
175 gBenchmark->Start("PRooF exec");
176 TChain* pChain =new TChain("esdTree");
178 ifstream list; list.open("list.txt");
183 if (!file.Contains("root")) continue; //it's wrong file name
184 pChain->Add(file.Data());
188 pChain->GetListOfFiles()->Print();
190 TVirtualProof *pProof=TProof::Open("kir@lxb6046.cern.ch");
191 pProof->UploadPackage("ESD.par");
192 pProof->EnablePackage("ESD");
194 pChain->MakeTDSet()->Process("EsdQa.C+");
196 gBenchmark->Show("PRooF exec");