]>
Commit | Line | Data |
---|---|---|
1dfe075f | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
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 | **************************************************************************/ | |
0b28fd57 | 15 | |
16 | /* $Id$ */ | |
17 | ||
1dfe075f | 18 | //_________________________________________________________________________ |
19 | // An analysis task to check the HMPID data in simulated data | |
20 | // | |
21 | //*-- Annalisa Mastroserio | |
22 | ////////////////////////////////////////////////////////////////////////////// | |
23 | ||
0b28fd57 | 24 | #include <TCanvas.h> |
1dfe075f | 25 | #include <TChain.h> |
0b28fd57 | 26 | #include <TF1.h> |
27 | #include <TFile.h> | |
1dfe075f | 28 | #include <TH1F.h> |
29 | #include <TH2F.h> | |
1dfe075f | 30 | #include <TLegend.h> |
0b28fd57 | 31 | #include <TROOT.h> |
1dfe075f | 32 | #include <TVector3.h> |
1f588058 | 33 | #include <TString.h> |
1dfe075f | 34 | |
35 | #include "AliHMPIDQATask.h" | |
36 | #include "AliESD.h" | |
37 | #include "AliLog.h" | |
38 | #include "AliPID.h" | |
39 | ||
40 | //______________________________________________________________________________ | |
41 | AliHMPIDQATask::AliHMPIDQATask(const char *name) : | |
42 | AliAnalysisTask(name,""), | |
43 | fChain(0), | |
44 | fESD(0), | |
5effd3c6 | 45 | fOutputContainer(0), |
1dfe075f | 46 | fhHMPIDCkovP(0), |
47 | fhHMPIDMipXY(0), | |
48 | fhHMPIDDifXY(0), | |
49 | fhHMPIDSigP(0) | |
50 | { | |
51 | // Constructor. | |
52 | // Input slot #0 works with an Ntuple | |
53 | DefineInput(0, TChain::Class()); | |
54 | // Output slot #0 writes into a TH1 container | |
55 | DefineOutput(0, TObjArray::Class()) ; | |
56 | ||
57 | Int_t i ; | |
58 | for(i = 0 ; i < 5 ; i++) | |
59 | fhHMPIDProb[i]=0; | |
60 | } | |
61 | ||
62 | //______________________________________________________________________________ | |
63 | AliHMPIDQATask::~AliHMPIDQATask() | |
64 | { | |
65 | // dtor | |
66 | fOutputContainer->Clear() ; | |
67 | delete fOutputContainer ; | |
68 | ||
69 | delete fhHMPIDCkovP ; | |
70 | delete fhHMPIDMipXY ; | |
71 | delete fhHMPIDDifXY ; | |
63424920 | 72 | delete fhHMPIDSigP ; |
73 | for (Int_t i=0; i<5; i++) | |
74 | delete fhHMPIDProb[i] ; | |
1dfe075f | 75 | } |
76 | ||
77 | //______________________________________________________________________________ | |
c52c2132 | 78 | void AliHMPIDQATask::ConnectInputData(const Option_t*) |
1dfe075f | 79 | { |
80 | // Initialisation of branch container and histograms | |
81 | ||
82 | AliInfo(Form("*** Initialization of %s", GetName())) ; | |
83 | ||
84 | // Get input data | |
85 | fChain = dynamic_cast<TChain *>(GetInputData(0)) ; | |
86 | if (!fChain) { | |
87 | AliError(Form("Input 0 for %s not found\n", GetName())); | |
88 | return ; | |
89 | } | |
90 | ||
c52c2132 | 91 | // One should first check if the branch address was taken by some other task |
92 | char ** address = (char **)GetBranchAddress(0, "ESD"); | |
93 | if (address) { | |
94 | fESD = (AliESD*)(*address); | |
95 | } else { | |
96 | fESD = new AliESD(); | |
97 | SetBranchAddress(0, "ESD", &fESD); | |
1dfe075f | 98 | } |
c52c2132 | 99 | } |
100 | ||
101 | //________________________________________________________________________ | |
102 | void AliHMPIDQATask::CreateOutputObjects() | |
103 | { | |
1dfe075f | 104 | // create histograms |
1e20f195 | 105 | |
106 | OpenFile(0) ; | |
107 | ||
1dfe075f | 108 | fhHMPIDCkovP = new TH2F("CkovP" , "#theta_{c}, [rad];P, [GeV]", 150, 0, 7 ,100, -3, 1); |
109 | fhHMPIDSigP = new TH2F("SigP" ,"#sigma_{#theta_c}" , 150, 0, 7 ,100, 0, 1e20); | |
110 | fhHMPIDMipXY = new TH2F("MipXY" ,"mip position" , 260, 0,130 ,252,0,126); | |
111 | fhHMPIDDifXY = new TH2F("DifXY" ,"diff" , 260, -10, 10 ,252,-10,10); | |
112 | ||
113 | fhHMPIDProb[0] = new TH1F("PidE" ,"PID: e yellow #mu magenta" ,100,0,1); | |
114 | fhHMPIDProb[0]->SetLineColor(kYellow); | |
115 | fhHMPIDProb[1] = new TH1F("PidMu","pid of #mu" ,100,0,1); | |
116 | fhHMPIDProb[1]->SetLineColor(kMagenta); | |
117 | fhHMPIDProb[2] = new TH1F("PidPi","PID: #pi red K green p blue",100,0,1); | |
118 | fhHMPIDProb[2]->SetLineColor(kRed); | |
119 | fhHMPIDProb[3] = new TH1F("PidK" ,"pid of K" ,100,0,1); | |
120 | fhHMPIDProb[3]->SetLineColor(kGreen); | |
121 | fhHMPIDProb[4] = new TH1F("PidP" ,"pid of p" ,100,0,1); | |
122 | fhHMPIDProb[4]->SetLineColor(kBlue); | |
123 | ||
124 | ||
125 | ||
126 | // create output container | |
127 | ||
128 | fOutputContainer = new TObjArray(9) ; | |
129 | fOutputContainer->SetName(GetName()) ; | |
130 | ||
131 | fOutputContainer->AddAt(fhHMPIDCkovP, 0) ; | |
132 | fOutputContainer->AddAt(fhHMPIDSigP, 1) ; | |
133 | fOutputContainer->AddAt(fhHMPIDMipXY, 2) ; | |
134 | fOutputContainer->AddAt(fhHMPIDDifXY, 3) ; | |
135 | fOutputContainer->AddAt(fhHMPIDProb[0], 4) ; | |
136 | fOutputContainer->AddAt(fhHMPIDProb[1], 5) ; | |
137 | fOutputContainer->AddAt(fhHMPIDProb[2], 6) ; | |
138 | fOutputContainer->AddAt(fhHMPIDProb[3], 7) ; | |
139 | fOutputContainer->AddAt(fhHMPIDProb[4], 8) ; | |
140 | } | |
141 | ||
142 | //______________________________________________________________________________ | |
143 | void AliHMPIDQATask::Exec(Option_t *) | |
144 | { | |
145 | // Processing of one event | |
146 | ||
147 | Long64_t entry = fChain->GetReadEntry() ; | |
148 | ||
149 | if (!fESD) { | |
150 | AliError("fESD is not connected to the input!") ; | |
151 | return ; | |
152 | } | |
153 | ||
154 | if ( !((entry-1)%100) ) | |
155 | AliInfo(Form("%s ----> Processing event # %lld", (dynamic_cast<TChain *>(fChain))->GetFile()->GetName(), entry)) ; | |
156 | ||
157 | // ************************ HMPID ************************************* | |
158 | Int_t iTrk ; | |
159 | for(iTrk = 0 ; iTrk < fESD->GetNumberOfTracks() ; iTrk++){ | |
160 | AliESDtrack *pTrk = fESD->GetTrack(iTrk) ; | |
161 | ||
162 | fhHMPIDCkovP->Fill( pTrk->GetP(), pTrk->GetHMPIDsignal() ) ; | |
163 | fhHMPIDSigP ->Fill( pTrk->GetP(), TMath::Sqrt(pTrk->GetHMPIDchi2()) ) ; | |
164 | ||
165 | // Float_t xm,ym; Int_t q,np; pTrk->GetHMPIDmip(xm,ym,q,np); fMipXY->Fill(xm,ym); //mip info | |
166 | // Float_t xd,yd,th,ph; pTrk->GetHMPIDtrk(xd,yd,th,ph); fDifXY->Fill(xd,yd); //track info | |
167 | ||
168 | Double_t pid[5] ; | |
169 | pTrk->GetHMPIDpid(pid) ; | |
170 | Int_t i ; | |
171 | for(i = 0 ; i < 5 ; i++) | |
172 | fhHMPIDProb[i]->Fill(pid[i]) ; | |
173 | }//tracks loop | |
174 | ||
175 | PostData(0, fOutputContainer); | |
176 | } | |
177 | ||
178 | //______________________________________________________________________________ | |
179 | void AliHMPIDQATask::Terminate(Option_t *) | |
180 | { | |
181 | // Processing when the event loop is ended | |
c52c2132 | 182 | fOutputContainer = (TObjArray*)GetOutputData(0); |
183 | fhHMPIDCkovP = (TH2F*)fOutputContainer->At(0); | |
184 | fhHMPIDSigP = (TH2F*)fOutputContainer->At(1); | |
185 | fhHMPIDMipXY = (TH2F*)fOutputContainer->At(2); | |
186 | fhHMPIDDifXY = (TH2F*)fOutputContainer->At(3); | |
187 | fhHMPIDProb[0] = (TH1F*)fOutputContainer->At(4); | |
188 | fhHMPIDProb[1] = (TH1F*)fOutputContainer->At(5); | |
189 | fhHMPIDProb[2] = (TH1F*)fOutputContainer->At(6); | |
190 | fhHMPIDProb[3] = (TH1F*)fOutputContainer->At(7); | |
191 | fhHMPIDProb[4] = (TH1F*)fOutputContainer->At(8); | |
84eb42a1 | 192 | |
2704006a | 193 | Bool_t problem = kFALSE ; |
84eb42a1 | 194 | AliInfo(Form(" *** %s Report:", GetName())) ; |
195 | ||
1dfe075f | 196 | Float_t n = 1.292 ; //mean freon ref idx |
197 | TF1 * hHMPIDpPi = new TF1("RiPiTheo", "acos(sqrt(x*x+[0]*[0])/(x*[1]))", 1.2, 7) ; | |
198 | hHMPIDpPi->SetLineWidth(1) ; | |
199 | hHMPIDpPi->SetParameter(1,n) ; | |
200 | ||
201 | AliPID ppp ; | |
202 | hHMPIDpPi->SetLineColor(kRed); | |
203 | hHMPIDpPi->SetParameter(0,AliPID::ParticleMass(AliPID::kPion)); //mass | |
204 | ||
205 | TF1 * hHMPIDK = static_cast<TF1*>(hHMPIDpPi->Clone()) ; | |
206 | hHMPIDK ->SetLineColor(kGreen) ; | |
207 | hHMPIDK ->SetParameter(0, AliPID::ParticleMass(AliPID::kKaon)) ; | |
208 | ||
209 | TF1 * hHMPIDP=static_cast<TF1*>(hHMPIDpPi->Clone()) ; | |
210 | hHMPIDP ->SetLineColor(kBlue) ; | |
211 | hHMPIDP ->SetParameter(0,AliPID::ParticleMass(AliPID::kProton)) ; | |
212 | ||
213 | TCanvas * cHMPID = new TCanvas("cHMPID","HMPID ESD Test") ; | |
214 | cHMPID->SetFillColor(10) ; | |
215 | cHMPID->SetHighLightColor(10) ; | |
216 | cHMPID->Divide(3,2) ; | |
217 | ||
218 | cHMPID->cd(1); | |
219 | fhHMPIDCkovP->Draw() ; | |
220 | hHMPIDpPi->Draw("same") ; | |
221 | hHMPIDK->Draw("same") ; | |
222 | hHMPIDP->Draw("same") ; | |
223 | ||
224 | cHMPID->cd(2) ; | |
225 | fhHMPIDMipXY->Draw() ; | |
226 | ||
227 | cHMPID->cd(3) ; | |
228 | fhHMPIDProb[0]->Draw() ; | |
229 | fhHMPIDProb[1]->Draw("same") ; | |
230 | ||
231 | cHMPID->cd(4) ; | |
232 | fhHMPIDSigP ->Draw() ; | |
233 | ||
234 | cHMPID->cd(5) ; | |
235 | fhHMPIDDifXY->Draw() ; | |
236 | ||
237 | cHMPID->cd(6) ; | |
238 | fhHMPIDProb[2]->Draw() ; | |
239 | fhHMPIDProb[3]->Draw("same") ; | |
240 | fhHMPIDProb[4]->Draw("same") ; | |
241 | ||
242 | cHMPID->Print("HMPID.eps"); | |
243 | ||
244 | char line[1024] ; | |
84eb42a1 | 245 | sprintf(line, ".!tar -zcf %s.tar.gz *.eps", GetName()) ; |
1dfe075f | 246 | gROOT->ProcessLine(line); |
247 | sprintf(line, ".!rm -fR *.eps"); | |
248 | gROOT->ProcessLine(line); | |
249 | ||
2704006a | 250 | AliInfo(Form("!!! All the eps files are in %s.tar.gz !!!", GetName())) ; |
251 | ||
1f588058 | 252 | TString report ; |
2704006a | 253 | if(problem) |
254 | report="Problems found, please check!!!"; | |
255 | else | |
256 | report="OK"; | |
257 | ||
1f588058 | 258 | AliInfo(Form("*** %s Summary Report: %s \n",GetName(), report.Data())) ; |
1dfe075f | 259 | } |