]>
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 EMCAL photon data in simulated data | |
20 | // | |
21 | //*-- Yves Schutz | |
22 | ////////////////////////////////////////////////////////////////////////////// | |
23 | ||
0b28fd57 | 24 | #include <TCanvas.h> |
1dfe075f | 25 | #include <TChain.h> |
0b28fd57 | 26 | #include <TFile.h> |
1dfe075f | 27 | #include <TH1.h> |
28 | #include <TH1F.h> | |
29 | #include <TH1I.h> | |
1dfe075f | 30 | #include <TLegend.h> |
0b28fd57 | 31 | #include <TNtuple.h> |
32 | #include <TROOT.h> | |
1dfe075f | 33 | #include <TVector3.h> |
1dfe075f | 34 | |
35 | #include "AliEMCALQATask.h" | |
36 | #include "AliESD.h" | |
37 | #include "AliLog.h" | |
38 | ||
39 | //______________________________________________________________________________ | |
40 | AliEMCALQATask::AliEMCALQATask(const char *name) : | |
41 | AliAnalysisTask(name,""), | |
42 | fChain(0), | |
43 | fESD(0), | |
44 | fhEMCALPos(0), | |
45 | fhEMCAL(0), | |
46 | fhEMCALEnergy(0), | |
47 | fhEMCALDigits(0), | |
48 | fhEMCALRecParticles(0), | |
49 | fhEMCALPhotons(0), | |
50 | fhEMCALInvariantMass(0), | |
51 | fhEMCALDigitsEvent(0) | |
52 | { | |
53 | // Constructor. | |
54 | // Input slot #0 works with an Ntuple | |
55 | DefineInput(0, TChain::Class()); | |
56 | // Output slot #0 writes into a TH1 container | |
57 | DefineOutput(0, TObjArray::Class()) ; | |
58 | } | |
59 | ||
60 | //______________________________________________________________________________ | |
61 | AliEMCALQATask::~AliEMCALQATask() | |
62 | { | |
63 | // dtor | |
64 | fOutputContainer->Clear() ; | |
65 | delete fOutputContainer ; | |
66 | ||
67 | delete fhEMCALPos ; | |
68 | delete fhEMCAL ; | |
69 | delete fhEMCALEnergy ; | |
70 | delete fhEMCALDigits ; | |
71 | delete fhEMCALRecParticles ; | |
72 | delete fhEMCALPhotons ; | |
73 | delete fhEMCALInvariantMass ; | |
74 | delete fhEMCALDigitsEvent ; | |
75 | } | |
76 | ||
77 | //______________________________________________________________________________ | |
c52c2132 | 78 | void AliEMCALQATask::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 | } |
1dfe075f | 100 | |
c52c2132 | 101 | //______________________________________________________________________________ |
102 | void AliEMCALQATask::CreateOutputObjects() | |
103 | { | |
104 | // create histograms | |
1e20f195 | 105 | |
106 | OpenFile(0) ; | |
107 | ||
1dfe075f | 108 | fhEMCALPos = new TNtuple("EMCALPos" , "Position in EMCAL" , "x:y:z"); |
109 | fhEMCAL = new TNtuple("EMCAL" , "EMCAL" , "event:digits:clusters:photons"); | |
110 | fhEMCALEnergy = new TH1D("EMCALEnergy" , "EMCALEnergy" , 1000, 0., 10. ) ; | |
111 | fhEMCALDigits = new TH1I("EMCALDigitsCluster" , "EMCALDigits" , 20 , 0 , 20 ) ; | |
112 | fhEMCALRecParticles = new TH1D("EMCALRecParticles" , "EMCALRecParticles", 20 , 0., 20. ) ; | |
113 | fhEMCALPhotons = new TH1I("EMCALPhotons" , "EMCALPhotons" , 20 , 0 , 20 ) ; | |
114 | fhEMCALInvariantMass = new TH1D("EMCALInvariantMass" , "EMCALInvariantMass", 400, 0., 400.) ; | |
115 | fhEMCALDigitsEvent = new TH1I("EMCALDigitsEvent" , "EMCALDigitsEvent" , 30 , 0 , 30 ) ; | |
116 | ||
117 | // create output container | |
118 | ||
119 | fOutputContainer = new TObjArray(8) ; | |
120 | fOutputContainer->SetName(GetName()) ; | |
121 | ||
122 | fOutputContainer->AddAt(fhEMCALPos, 0) ; | |
123 | fOutputContainer->AddAt(fhEMCAL, 1) ; | |
124 | fOutputContainer->AddAt(fhEMCALEnergy, 2) ; | |
125 | fOutputContainer->AddAt(fhEMCALDigits, 3) ; | |
126 | fOutputContainer->AddAt(fhEMCALRecParticles, 4) ; | |
127 | fOutputContainer->AddAt(fhEMCALPhotons, 5) ; | |
128 | fOutputContainer->AddAt(fhEMCALInvariantMass, 6) ; | |
129 | fOutputContainer->AddAt(fhEMCALDigitsEvent, 7) ; | |
130 | } | |
131 | ||
132 | //______________________________________________________________________________ | |
133 | void AliEMCALQATask::Exec(Option_t *) | |
134 | { | |
135 | // Processing of one event | |
136 | ||
137 | Long64_t entry = fChain->GetReadEntry() ; | |
138 | ||
139 | if (!fESD) { | |
140 | AliError("fESD is not connected to the input!") ; | |
141 | return ; | |
142 | } | |
143 | ||
144 | if ( !((entry-1)%100) ) | |
145 | AliInfo(Form("%s ----> Processing event # %lld", (dynamic_cast<TChain *>(fChain))->GetFile()->GetName(), entry)) ; | |
146 | ||
147 | //************************ EMCAL ************************************* | |
148 | Int_t firstEmcalCluster = fESD->GetFirstEMCALCluster() ; | |
149 | const Int_t mumberOfEmcalClusters = fESD->GetNumberOfEMCALClusters() ; | |
150 | ||
151 | TVector3 ** emcalVector = new TVector3*[mumberOfEmcalClusters] ; | |
152 | Float_t * emcalPhotonsEnergy = new Float_t[mumberOfEmcalClusters] ; | |
153 | Int_t emcalCluster ; | |
154 | Int_t numberOfEmcalClustersv1 = 0 ; | |
155 | Int_t numberOfPhotonsInEmcal = 0 ; | |
156 | Int_t numberOfDigitsInEmcal = 0 ; | |
157 | ||
158 | ||
159 | // loop over all the EMCAL Cluster | |
160 | for(emcalCluster = firstEmcalCluster ; emcalCluster < firstEmcalCluster + mumberOfEmcalClusters ; emcalCluster++) { | |
161 | AliESDCaloCluster * caloCluster = fESD->GetCaloCluster(emcalCluster) ; | |
162 | if (caloCluster) { | |
163 | Float_t pos[3] ; | |
1dfe075f | 164 | if(caloCluster->GetClusterType() == AliESDCaloCluster::kClusterv1) { |
165 | caloCluster->GetGlobalPosition(pos) ; | |
11c5d692 | 166 | fhEMCALPos->Fill(pos[0],pos[1],pos[2]) ; |
1dfe075f | 167 | fhEMCALEnergy->Fill(caloCluster->GetClusterEnergy()) ; |
168 | fhEMCALDigits->Fill(entry, caloCluster->GetNumberOfDigits()) ; | |
169 | numberOfEmcalClustersv1++ ; | |
170 | numberOfDigitsInEmcal += caloCluster->GetNumberOfDigits() ; | |
171 | // Float_t * pid = clus->GetPid() ; | |
172 | // if(pid[AliPID::kPhoton]>0.9){ | |
173 | emcalVector[numberOfPhotonsInEmcal] = new TVector3(pos[0],pos[1],pos[2]) ; | |
174 | emcalPhotonsEnergy[numberOfPhotonsInEmcal] = caloCluster->GetClusterEnergy() ; | |
175 | numberOfPhotonsInEmcal++ ; | |
176 | } | |
177 | } | |
178 | } // EMCAL clusters loop | |
179 | ||
180 | fhEMCALRecParticles->Fill(numberOfEmcalClustersv1); | |
181 | fhEMCALPhotons->Fill(numberOfPhotonsInEmcal); | |
182 | fhEMCALDigitsEvent->Fill(numberOfDigitsInEmcal); | |
183 | fhEMCAL->Fill(entry, numberOfDigitsInEmcal, numberOfEmcalClustersv1, numberOfPhotonsInEmcal) ; | |
184 | ||
185 | // invariant Mass | |
186 | if (numberOfPhotonsInEmcal > 1 ) { | |
187 | Int_t emcalPhoton1, emcalPhoton2 ; | |
188 | for(emcalPhoton1 = 0 ; emcalPhoton1 < numberOfPhotonsInEmcal ; emcalPhoton1++) { | |
189 | for(emcalPhoton2 = emcalPhoton1 + 1 ; emcalPhoton2 < numberOfPhotonsInEmcal ; emcalPhoton2++) { | |
190 | Float_t tempMass = TMath::Sqrt( 2 * emcalPhotonsEnergy[emcalPhoton1] * emcalPhotonsEnergy[emcalPhoton2] * | |
191 | ( 1 - TMath::Cos( emcalVector[emcalPhoton1]->Angle(*emcalVector[emcalPhoton2])) | |
192 | ) | |
193 | ); | |
194 | fhEMCALInvariantMass->Fill(tempMass*1000.); | |
195 | } | |
196 | } | |
197 | } | |
198 | ||
199 | PostData(0, fOutputContainer); | |
200 | ||
201 | delete [] emcalVector ; | |
202 | delete [] emcalPhotonsEnergy ; | |
203 | } | |
204 | ||
205 | //______________________________________________________________________________ | |
206 | void AliEMCALQATask::Terminate(Option_t *) | |
207 | { | |
208 | // Processing when the event loop is ended | |
c52c2132 | 209 | fOutputContainer = (TObjArray*)GetOutputData(0); |
210 | fhEMCALEnergy = (TH1D*)fOutputContainer->At(2); | |
211 | fhEMCALDigits = (TH1I*)fOutputContainer->At(3); | |
212 | fhEMCALRecParticles = (TH1D*)fOutputContainer->At(4); | |
213 | fhEMCALPhotons = (TH1I*)fOutputContainer->At(5); | |
214 | fhEMCALInvariantMass = (TH1D*)fOutputContainer->At(6); | |
215 | fhEMCALDigitsEvent = (TH1I*)fOutputContainer->At(7); | |
84eb42a1 | 216 | |
2704006a | 217 | Bool_t problem = kFALSE ; |
84eb42a1 | 218 | AliInfo(Form(" *** %s Report:", GetName())) ; |
219 | printf(" EMCALEnergy Mean : %5.3f , RMS : %5.3f \n", fhEMCALEnergy->GetMean(), fhEMCALEnergy->GetRMS() ) ; | |
220 | printf(" EMCALDigits Mean : %5.3f , RMS : %5.3f \n", fhEMCALDigits->GetMean(), fhEMCALDigits->GetRMS() ) ; | |
221 | printf(" EMCALRecParticles Mean : %5.3f , RMS : %5.3f \n", fhEMCALRecParticles->GetMean(), fhEMCALRecParticles->GetRMS() ) ; | |
222 | printf(" EMCALPhotons Mean : %5.3f , RMS : %5.3f \n", fhEMCALPhotons->GetMean(), fhEMCALPhotons->GetRMS() ) ; | |
223 | printf(" EMCALInvariantMass Mean : %5.3f , RMS : %5.3f \n", fhEMCALInvariantMass->GetMean(), fhEMCALInvariantMass->GetRMS() ) ; | |
224 | printf(" EMCALDigitsEvent Mean : %5.3f , RMS : %5.3f \n", fhEMCALDigitsEvent->GetMean(), fhEMCALDigitsEvent->GetRMS() ) ; | |
1dfe075f | 225 | |
226 | TCanvas * cEMCAL = new TCanvas("EMCAL", "EMCAL ESD Test", 400, 10, 600, 700); | |
227 | cEMCAL->Divide(3, 2) ; | |
228 | ||
229 | cEMCAL->cd(1) ; | |
84eb42a1 | 230 | if ( fhEMCALEnergy->GetMaximum() > 0. ) |
231 | gPad->SetLogy(); | |
1dfe075f | 232 | fhEMCALEnergy->SetAxisRange(0, 25.); |
233 | fhEMCALEnergy->SetXTitle("Energy (GeV)"); | |
234 | fhEMCALEnergy->Draw(); | |
235 | ||
236 | cEMCAL->cd(2) ; | |
84eb42a1 | 237 | if ( fhEMCALDigits->GetMaximum() > 0. ) |
238 | gPad->SetLogy(); | |
1dfe075f | 239 | fhEMCALDigits->SetAxisRange(0, 25.); |
240 | fhEMCALDigits->SetXTitle("DigitsPerCluster"); | |
241 | fhEMCALDigits->Draw(); | |
242 | ||
243 | cEMCAL->cd(3) ; | |
84eb42a1 | 244 | if ( fhEMCALRecParticles->GetMaximum() > 0. ) |
245 | gPad->SetLogy(); | |
1dfe075f | 246 | fhEMCALRecParticles->SetAxisRange(0, 25.); |
247 | fhEMCALRecParticles->SetXTitle("RecParticles"); | |
248 | fhEMCALRecParticles->Draw(); | |
249 | ||
250 | cEMCAL->cd(4) ; | |
84eb42a1 | 251 | if ( fhEMCALPhotons->GetMaximum() > 0. ) |
252 | gPad->SetLogy(); | |
1dfe075f | 253 | fhEMCALPhotons->SetAxisRange(0, 25.); |
254 | fhEMCALPhotons->SetXTitle("Photons"); | |
255 | fhEMCALPhotons->Draw(); | |
256 | ||
257 | cEMCAL->cd(5) ; | |
258 | fhEMCALInvariantMass->SetXTitle("InvariantMass (MeV/c²)"); | |
259 | fhEMCALInvariantMass->Draw(); | |
260 | ||
261 | cEMCAL->cd(6) ; | |
84eb42a1 | 262 | if ( fhEMCALDigitsEvent->GetMaximum() > 0. ) |
263 | gPad->SetLogy(); | |
1dfe075f | 264 | fhEMCALDigitsEvent->SetAxisRange(0, 40.); |
265 | fhEMCALDigitsEvent->SetXTitle("DigitsPerEvent"); | |
266 | fhEMCALDigitsEvent->Draw(); | |
267 | ||
268 | cEMCAL->Print("EMCAL.eps"); | |
269 | ||
270 | char line[1024] ; | |
84eb42a1 | 271 | sprintf(line, ".!tar -zcf %s.tar.gz *.eps", GetName()) ; |
1dfe075f | 272 | gROOT->ProcessLine(line); |
273 | sprintf(line, ".!rm -fR *.eps"); | |
274 | gROOT->ProcessLine(line); | |
275 | ||
2704006a | 276 | AliInfo(Form("!!! All the eps files are in %s.tar.gz !!!", GetName())) ; |
277 | ||
278 | char * report ; | |
279 | if(problem) | |
280 | report="Problems found, please check!!!"; | |
281 | else | |
282 | report="OK"; | |
283 | ||
284 | AliInfo(Form("*** %s Summary Report: %s \n",GetName(), report)) ; | |
1dfe075f | 285 | } |