]>
Commit | Line | Data |
---|---|---|
6ad0bfa0 | 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 | **************************************************************************/ | |
15 | ||
16 | //_________________________________________________________________________ | |
17 | // Algorythm class to analyze PHOS events | |
18 | //*-- Y. Schutz : SUBATECH | |
19 | ////////////////////////////////////////////////////////////////////////////// | |
20 | ||
21 | // --- ROOT system --- | |
22 | ||
92862013 | 23 | #include "TFile.h" |
24 | #include "TH1.h" | |
25 | #include "TPad.h" | |
6ad0bfa0 | 26 | #include "TH2.h" |
27 | #include "TParticle.h" | |
28 | #include "TClonesArray.h" | |
29 | #include "TTree.h" | |
30 | #include "TMath.h" | |
31 | #include "TCanvas.h" | |
32 | ||
33 | // --- Standard library --- | |
34 | ||
92862013 | 35 | #include <iostream> |
36 | #include <cstdio> | |
37 | ||
6ad0bfa0 | 38 | // --- AliRoot header files --- |
39 | ||
40 | #include "AliRun.h" | |
41 | #include "AliPHOSAnalyze.h" | |
42 | #include "AliPHOSClusterizerv1.h" | |
43 | #include "AliPHOSTrackSegmentMakerv1.h" | |
26d4b141 | 44 | #include "AliPHOSPIDv1.h" |
6ad0bfa0 | 45 | #include "AliPHOSReconstructioner.h" |
46 | #include "AliPHOSDigit.h" | |
47 | #include "AliPHOSTrackSegment.h" | |
48 | #include "AliPHOSRecParticle.h" | |
49 | ||
50 | ClassImp(AliPHOSAnalyze) | |
51 | ||
52 | ||
53 | //____________________________________________________________________________ | |
54 | AliPHOSAnalyze::AliPHOSAnalyze() | |
55 | { | |
56 | // ctor | |
57 | ||
58 | fRootFile = 0 ; | |
59 | } | |
60 | ||
61 | //____________________________________________________________________________ | |
62 | AliPHOSAnalyze::AliPHOSAnalyze(Text_t * name) | |
63 | { | |
64 | // ctor | |
65 | ||
92862013 | 66 | Bool_t ok = OpenRootFile(name) ; |
67 | if ( !ok ) { | |
6ad0bfa0 | 68 | cout << " AliPHOSAnalyze > Error opening " << name << endl ; |
69 | } | |
70 | else { | |
71 | gAlice = (AliRun*) fRootFile->Get("gAlice"); | |
72 | fPHOS = (AliPHOSv0 *)gAlice->GetDetector("PHOS") ; | |
73 | fGeom = AliPHOSGeometry::GetInstance( fPHOS->GetGeometry()->GetName(), fPHOS->GetGeometry()->GetTitle() ) ; | |
74 | fEvt = -999 ; | |
75 | } | |
76 | } | |
77 | ||
78 | //____________________________________________________________________________ | |
79 | AliPHOSAnalyze::~AliPHOSAnalyze() | |
80 | { | |
81 | // dtor | |
82 | ||
83 | fRootFile->Close() ; | |
84 | delete fRootFile ; | |
85 | fRootFile = 0 ; | |
86 | ||
87 | delete fPHOS ; | |
88 | fPHOS = 0 ; | |
89 | ||
90 | delete fClu ; | |
91 | fClu = 0 ; | |
92 | ||
26d4b141 | 93 | delete fPID ; |
94 | fPID = 0 ; | |
6ad0bfa0 | 95 | |
96 | delete fRec ; | |
97 | fRec = 0 ; | |
98 | ||
99 | delete fTrs ; | |
100 | fTrs = 0 ; | |
101 | ||
102 | } | |
103 | ||
104 | //____________________________________________________________________________ | |
105 | void AliPHOSAnalyze::AnalyzeOneEvent(Int_t evt) | |
106 | { | |
92862013 | 107 | Bool_t ok = Init(evt) ; |
6ad0bfa0 | 108 | |
92862013 | 109 | if ( ok ) { |
6ad0bfa0 | 110 | //=========== Get the number of entries in the Digits array |
111 | ||
112 | Int_t nId = fPHOS->Digits()->GetEntries(); | |
113 | printf("AnalyzeOneEvent > Number of entries in the Digit array is %d \n",nId); | |
114 | ||
115 | //=========== Do the reconstruction | |
116 | ||
117 | cout << "AnalyzeOneEvent > Found " << nId << " digits in PHOS" << endl ; | |
118 | ||
119 | fPHOS->Reconstruction(fRec); | |
120 | ||
121 | // =========== End of reconstruction | |
122 | ||
123 | cout << "AnalyzeOneEvent > event # " << fEvt << " processed" << endl ; | |
92862013 | 124 | } // ok |
6ad0bfa0 | 125 | else |
126 | cout << "AnalyzeOneEvent > filed to process event # " << evt << endl ; | |
127 | ||
128 | } | |
129 | ||
92862013 | 130 | //____________________________________________________________________________ |
131 | void AliPHOSAnalyze::AnalyzeManyEvents(Int_t Nevents, Int_t module) // analyzes many events | |
132 | { | |
133 | ||
134 | if ( fRootFile == 0 ) | |
135 | cout << "AnalyzeManyEvents > " << "Root File not openned" << endl ; | |
136 | else | |
137 | { | |
138 | //========== Get AliRun object from file | |
139 | gAlice = (AliRun*) fRootFile->Get("gAlice") ; | |
140 | //=========== Get the PHOS object and associated geometry from the file | |
141 | fPHOS = (AliPHOSv0 *)gAlice->GetDetector("PHOS") ; | |
142 | fGeom = AliPHOSGeometry::GetInstance( fPHOS->GetGeometry()->GetName(), fPHOS->GetGeometry()->GetTitle() ); | |
143 | //========== Booking Histograms | |
144 | cout << "AnalyzeManyEvents > " << "Booking Histograms" << endl ; | |
145 | BookingHistograms(); | |
146 | Int_t ievent; | |
147 | Int_t relid[4] ; | |
148 | AliPHOSDigit * digit ; | |
149 | AliPHOSEmcRecPoint * emc ; | |
150 | AliPHOSPpsdRecPoint * ppsd ; | |
38f8ae6d | 151 | // AliPHOSTrackSegment * tracksegment ; |
152 | AliPHOSRecParticle * recparticle; | |
92862013 | 153 | for ( ievent=0; ievent<Nevents; ievent++) |
154 | { | |
155 | if (ievent==0) cout << "AnalyzeManyEvents > " << "Starting Analyzing " << endl ; | |
156 | //========== Create the Clusterizer | |
157 | fClu = new AliPHOSClusterizerv1() ; | |
158 | fClu->SetEmcEnergyThreshold(0.025) ; | |
159 | fClu->SetEmcClusteringThreshold(0.75) ; | |
160 | fClu->SetPpsdEnergyThreshold (0.0000002) ; | |
161 | fClu->SetPpsdClusteringThreshold(0.0000001) ; | |
162 | fClu->SetLocalMaxCut(0.03) ; | |
163 | fClu->SetCalibrationParameters(0., 0.00000001) ; | |
164 | //========== Creates the track segment maker | |
6727be7e | 165 | fTrs = new AliPHOSTrackSegmentMakerv1() ; |
166 | fTrs->SetUnfoldFlag() ; | |
26d4b141 | 167 | //========== Creates the particle identifier |
168 | fPID = new AliPHOSPIDv1() ; | |
09fc14a0 | 169 | fPID->SetShowerProfileCuts(0.5, 1.5, 0.5, 1.5 ) ; |
170 | fPID->Print() ; | |
92862013 | 171 | //========== Creates the Reconstructioner |
26d4b141 | 172 | fRec = new AliPHOSReconstructioner(fClu, fTrs, fPID) ; |
92862013 | 173 | //========== Event Number |
174 | if ( ( log10(ievent+1) - (Int_t)(log10(ievent+1)) ) == 0. ) cout << "AnalyzeManyEvents > " << "Event is " << ievent << endl ; | |
175 | //=========== Connects the various Tree's for evt | |
176 | gAlice->GetEvent(ievent); | |
177 | //=========== Gets the Digit TTree | |
178 | gAlice->TreeD()->GetEvent(0) ; | |
179 | //=========== Gets the number of entries in the Digits array | |
180 | TIter nextdigit(fPHOS->Digits()) ; | |
181 | while( ( digit = (AliPHOSDigit *)nextdigit() ) ) | |
182 | { | |
183 | fGeom->AbsToRelNumbering(digit->GetId(), relid) ; | |
184 | if (fClu->IsInEmc(digit)) fhEmcDigit->Fill(fClu->Calibrate(digit->GetAmp())) ; | |
185 | else | |
186 | { | |
187 | if (relid[1]<17) fhVetoDigit->Fill(fClu->Calibrate(digit->GetAmp())); | |
188 | if (relid[1]>16) fhConvertorDigit->Fill(fClu->Calibrate(digit->GetAmp())); | |
189 | } | |
190 | } | |
191 | //=========== Do the reconstruction | |
192 | fPHOS->Reconstruction(fRec); | |
193 | //=========== Cluster in module | |
194 | TIter nextEmc(fPHOS->EmcClusters() ) ; | |
195 | while((emc = (AliPHOSEmcRecPoint *)nextEmc())) | |
196 | { | |
197 | if ( emc->GetPHOSMod() == module ) | |
198 | { | |
199 | fhEmcCluster->Fill( emc->GetTotalEnergy() ); | |
200 | TIter nextPpsd( fPHOS->PpsdClusters()) ; | |
201 | while((ppsd = (AliPHOSPpsdRecPoint *)nextPpsd())) | |
202 | { | |
203 | if ( ppsd->GetPHOSMod() == module ) | |
204 | { | |
205 | if (!ppsd->GetUp()) fhConvertorEmc->Fill(emc->GetTotalEnergy(),ppsd->GetTotalEnergy()) ; | |
206 | } | |
207 | } | |
208 | } | |
209 | } | |
210 | //=========== Cluster in module PPSD Down | |
211 | TIter nextPpsd(fPHOS->PpsdClusters() ) ; | |
212 | while((ppsd = (AliPHOSPpsdRecPoint *)nextPpsd())) | |
213 | { | |
214 | if ( ppsd->GetPHOSMod() == module ) | |
215 | { | |
216 | if (!ppsd->GetUp()) fhConvertorCluster->Fill(ppsd->GetTotalEnergy()) ; | |
217 | if (ppsd->GetUp()) fhVetoCluster ->Fill(ppsd->GetTotalEnergy()) ; | |
218 | } | |
219 | } | |
220 | //========== TRackSegments in the event | |
38f8ae6d | 221 | TIter nextRecParticle(fPHOS->RecParticles() ) ; |
222 | while((recparticle = (AliPHOSRecParticle *)nextRecParticle())) | |
92862013 | 223 | { |
38f8ae6d | 224 | if ( recparticle->GetPHOSTrackSegment()->GetPHOSMod() == module ) |
92862013 | 225 | { |
38f8ae6d | 226 | cout << "Particle type is " << recparticle->GetType() << endl ; |
227 | switch(recparticle->GetType()) | |
92862013 | 228 | { |
09fc14a0 | 229 | case kGAMMA: |
38f8ae6d | 230 | fhPhotonEnergy->Fill(recparticle->Energy() ) ; |
09fc14a0 | 231 | //fhPhotonPositionX->Fill(recpart. ) ; |
232 | //fhPhotonPositionY->Fill(recpart. ) ; | |
38f8ae6d | 233 | cout << "PHOTON" << endl; |
92862013 | 234 | break; |
09fc14a0 | 235 | case kELECTRON: |
38f8ae6d | 236 | fhElectronEnergy->Fill(recparticle->Energy() ) ; |
09fc14a0 | 237 | //fhElectronPositionX->Fill(recpart. ) ; |
238 | //fhElectronPositionY->Fill(recpart. ) ; | |
38f8ae6d | 239 | cout << "ELECTRON" << endl; |
92862013 | 240 | break; |
b9bbdad1 | 241 | case kNEUTRALHADRON: |
38f8ae6d | 242 | fhNeutralHadronEnergy->Fill(recparticle->Energy() ) ; |
b9bbdad1 | 243 | //fhNeutralHadronPositionX->Fill(recpart. ) ; |
244 | //fhNeutralHadronPositionY->Fill(recpart. ) ; | |
38f8ae6d | 245 | cout << "NEUTRAl HADRON" << endl; |
b9bbdad1 | 246 | break ; |
247 | case kNEUTRALEM: | |
38f8ae6d | 248 | fhNeutralEMEnergy->Fill(recparticle->Energy() ) ; |
b9bbdad1 | 249 | //fhNeutralEMPositionX->Fill(recpart. ) ; |
250 | //fhNeutralEMPositionY->Fill(recpart. ) ; | |
251 | //cout << "NEUTRAL EM" << endl; | |
92862013 | 252 | break ; |
0dd37dda | 253 | case kCHARGEDHADRON: |
38f8ae6d | 254 | fhChargedHadronEnergy->Fill(recparticle->Energy() ) ; |
09fc14a0 | 255 | //fhChargedHadronPositionX->Fill(recpart. ) ; |
256 | //fhChargedHadronPositionY->Fill(recpart. ) ; | |
38f8ae6d | 257 | cout << "CHARGED HADRON" << endl; |
92862013 | 258 | break ; |
c1d256cb | 259 | case kGAMMAHADRON: |
260 | fhPhotonHadronEnergy->Fill(recparticle->Energy() ) ; | |
261 | //fhPhotonHadronPositionX->Fill(recpart. ) ; | |
262 | //fhPhotonHadronPositionY->Fill(recpart. ) ; | |
263 | cout << "PHOTON HADRON" << endl; | |
264 | break ; | |
92862013 | 265 | } |
266 | } | |
267 | } | |
26d4b141 | 268 | // Deleting fClu, fTrs, fPID et fRec |
92862013 | 269 | fClu->Delete(); |
270 | fTrs->Delete(); | |
26d4b141 | 271 | fPID->Delete(); |
92862013 | 272 | fRec->Delete(); |
273 | ||
274 | } // endfor | |
275 | SavingHistograms(); | |
276 | } // endif | |
277 | } // endfunction | |
278 | ||
279 | ||
280 | //____________________________________________________________________________ | |
281 | void AliPHOSAnalyze::BookingHistograms() | |
282 | { | |
b9bbdad1 | 283 | if (fhEmcDigit ) |
284 | delete fhEmcDigit ; | |
285 | if (fhVetoDigit ) | |
286 | delete fhVetoDigit ; | |
287 | if (fhConvertorDigit ) | |
288 | delete fhConvertorDigit ; | |
289 | if (fhEmcCluster ) | |
290 | delete fhEmcCluster ; | |
291 | if (fhVetoCluster ) | |
292 | delete fhVetoCluster ; | |
293 | if (fhConvertorCluster ) | |
294 | delete fhConvertorCluster ; | |
295 | if (fhConvertorEmc ) | |
296 | delete fhConvertorEmc ; | |
297 | ||
298 | fhEmcDigit = new TH1F("hEmcDigit", "hEmcDigit", 1000, 0. , 25.); | |
299 | fhVetoDigit = new TH1F("hVetoDigit", "hVetoDigit", 500, 0. , 3.e-5); | |
300 | fhConvertorDigit = new TH1F("hConvertorDigit","hConvertorDigit", 500, 0. , 3.e-5); | |
301 | fhEmcCluster = new TH1F("hEmcCluster", "hEmcCluster", 1000, 0. , 30.); | |
302 | fhVetoCluster = new TH1F("hVetoCluster", "hVetoCluster", 500, 0. , 3.e-5); | |
303 | fhConvertorCluster = new TH1F("hConvertorCluster","hConvertorCluster",500, 0. , 3.e-5); | |
304 | fhConvertorEmc = new TH2F("hConvertorEmc", "hConvertorEmc", 200, 1. , 3., 200, 0., 3.e-5); | |
305 | fhPhotonEnergy = new TH1F("hPhotonEnergy", "hPhotonEnergy", 1000, 0. , 30.); | |
306 | fhElectronEnergy = new TH1F("hElectronEnergy","hElectronEnergy", 1000, 0. , 30.); | |
307 | fhNeutralHadronEnergy = new TH1F("hNeutralHadronEnergy", "hNeutralHadronEnergy", 1000, 0. , 30.); | |
308 | fhNeutralEMEnergy = new TH1F("hNeutralEMEnergy", "hNeutralEMEnergy", 1000, 0. , 30.); | |
309 | fhChargedHadronEnergy = new TH1F("hChargedHadronEnergy", "hChargedHadronEnergy", 1000, 0. , 30.); | |
c1d256cb | 310 | fhPhotonHadronEnergy = new TH1F("hPhotonHadronEnergy","hPhotonHadronEnergy",500,-80. , 80.); |
b9bbdad1 | 311 | fhPhotonPositionX = new TH1F("hPhotonPositionX","hPhotonPositionX", 500,-80. , 80.); |
312 | fhElectronPositionX = new TH1F("hElectronPositionX","hElectronPositionX",500,-80. , 80.); | |
313 | fhNeutralHadronPositionX = new TH1F("hNeutralHadronPositionX","hNeutralHadronPositionX",500,-80. , 80.); | |
314 | fhNeutralEMPositionX = new TH1F("hNeutralEMPositionX","hNeutralEMPositionX",500,-80. , 80.); | |
09fc14a0 | 315 | fhChargedHadronPositionX = new TH1F("hChargedHadronPositionX","hChargedHadronPositionX",500,-80. , 80.); |
c1d256cb | 316 | fhPhotonHadronPositionX = new TH1F("hPhotonHadronPositionX","hPhotonHadronPositionX",500,-80. , 80.); |
b9bbdad1 | 317 | fhPhotonPositionY = new TH1F("hPhotonPositionY","hPhotonPositionY", 500,-80. , 80.); |
318 | fhElectronPositionY = new TH1F("hElectronPositionY","hElectronPositionY",500,-80. , 80.); | |
319 | fhNeutralHadronPositionY = new TH1F("hNeutralHadronPositionY","hNeutralHadronPositionY",500,-80. , 80.); | |
320 | fhNeutralEMPositionY = new TH1F("hNeutralEMPositionY","hNeutralEMPositionY",500,-80. , 80.); | |
09fc14a0 | 321 | fhChargedHadronPositionY = new TH1F("hChargedHadronPositionY","hChargedHadronPositionY",500,-80. , 80.); |
c1d256cb | 322 | fhPhotonHadronPositionY = new TH1F("hPhotonHadronPositionY","hPhotonHadronPositionY",500,-80. , 80.); |
92862013 | 323 | |
324 | } | |
6ad0bfa0 | 325 | //____________________________________________________________________________ |
326 | Bool_t AliPHOSAnalyze::Init(Int_t evt) | |
327 | { | |
328 | ||
92862013 | 329 | Bool_t ok = kTRUE ; |
6ad0bfa0 | 330 | |
331 | //========== Open galice root file | |
332 | ||
333 | if ( fRootFile == 0 ) { | |
334 | Text_t * name = new Text_t[80] ; | |
335 | cout << "AnalyzeOneEvent > Enter file root file name : " ; | |
336 | cin >> name ; | |
92862013 | 337 | Bool_t ok = OpenRootFile(name) ; |
338 | if ( !ok ) | |
6ad0bfa0 | 339 | cout << " AliPHOSAnalyze > Error opening " << name << endl ; |
340 | else { | |
341 | //========== Get AliRun object from file | |
342 | ||
343 | gAlice = (AliRun*) fRootFile->Get("gAlice") ; | |
344 | ||
345 | //=========== Get the PHOS object and associated geometry from the file | |
346 | ||
347 | fPHOS = (AliPHOSv0 *)gAlice->GetDetector("PHOS") ; | |
348 | fGeom = AliPHOSGeometry::GetInstance( fPHOS->GetGeometry()->GetName(), fPHOS->GetGeometry()->GetTitle() ); | |
92862013 | 349 | } // else !ok |
6ad0bfa0 | 350 | } // if fRootFile |
351 | ||
92862013 | 352 | if ( ok ) { |
6ad0bfa0 | 353 | |
354 | //========== Create the Clusterizer | |
355 | ||
356 | fClu = new AliPHOSClusterizerv1() ; | |
92862013 | 357 | fClu->SetEmcEnergyThreshold(0.025) ; |
358 | fClu->SetEmcClusteringThreshold(0.75) ; | |
359 | fClu->SetPpsdEnergyThreshold (0.0000002) ; | |
360 | fClu->SetPpsdClusteringThreshold(0.0000001) ; | |
6ad0bfa0 | 361 | fClu->SetLocalMaxCut(0.03) ; |
92862013 | 362 | fClu->SetCalibrationParameters(0., 0.00000001) ; |
6ad0bfa0 | 363 | cout << "AnalyzeOneEvent > using clusterizer " << fClu->GetName() << endl ; |
364 | fClu->PrintParameters() ; | |
365 | ||
366 | //========== Creates the track segment maker | |
367 | ||
368 | fTrs = new AliPHOSTrackSegmentMakerv1() ; | |
369 | cout << "AnalyzeOneEvent > using tack segment maker " << fTrs->GetName() << endl ; | |
370 | ||
26d4b141 | 371 | //========== Creates the particle identifier |
6ad0bfa0 | 372 | |
26d4b141 | 373 | fPID = new AliPHOSPIDv1() ; |
374 | cout << "AnalyzeOneEvent > using particle identifier " << fPID->GetName() << endl ; | |
6ad0bfa0 | 375 | |
376 | //========== Creates the Reconstructioner | |
377 | ||
26d4b141 | 378 | fRec = new AliPHOSReconstructioner(fClu, fTrs, fPID) ; |
6ad0bfa0 | 379 | |
380 | //=========== Connect the various Tree's for evt | |
381 | ||
382 | if ( evt == -999 ) { | |
383 | cout << "AnalyzeOneEvent > Enter event number : " ; | |
384 | cin >> evt ; | |
385 | cout << evt << endl ; | |
386 | } | |
387 | fEvt = evt ; | |
388 | gAlice->GetEvent(evt); | |
389 | ||
390 | //=========== Get the Digit TTree | |
391 | ||
392 | gAlice->TreeD()->GetEvent(0) ; | |
393 | ||
92862013 | 394 | } // ok |
6ad0bfa0 | 395 | |
92862013 | 396 | return ok ; |
6ad0bfa0 | 397 | } |
398 | ||
92862013 | 399 | |
6ad0bfa0 | 400 | //____________________________________________________________________________ |
92862013 | 401 | void AliPHOSAnalyze::DisplayKineEvent(Int_t evt) |
6ad0bfa0 | 402 | { |
403 | if (evt == -999) | |
404 | evt = fEvt ; | |
405 | ||
92862013 | 406 | Int_t module ; |
6ad0bfa0 | 407 | cout << "DisplayKineEvent > which module (1-5, -1: all) ? " ; |
92862013 | 408 | cin >> module ; cout << module << endl ; |
6ad0bfa0 | 409 | |
92862013 | 410 | Int_t testparticle ; |
6ad0bfa0 | 411 | cout << " 22 : PHOTON " << endl |
412 | << " (-)11 : (POSITRON)ELECTRON " << endl | |
413 | << " (-)2112 : (ANTI)NEUTRON " << endl | |
414 | << " -999 : Everything else " << endl ; | |
415 | cout << "DisplayKineEvent > enter PDG particle code to display " ; | |
92862013 | 416 | cin >> testparticle ; cout << testparticle << endl ; |
6ad0bfa0 | 417 | |
92862013 | 418 | Text_t histoname[80] ; |
419 | sprintf(histoname,"Event %d: Incident particles in module %d", evt, module) ; | |
6ad0bfa0 | 420 | |
92862013 | 421 | Double_t tm, tM, pm, pM ; // min and Max theta and phi covered by module |
422 | fGeom->EmcModuleCoverage(module, tm, tM, pm, pM, kDegre) ; | |
6ad0bfa0 | 423 | |
424 | Double_t theta, phi ; | |
425 | fGeom->EmcXtalCoverage(theta, phi, kDegre) ; | |
426 | ||
427 | Int_t tdim = (Int_t)( (tM - tm) / theta ) ; | |
428 | Int_t pdim = (Int_t)( (pM - pm) / phi ) ; | |
429 | ||
430 | tm -= theta ; | |
431 | tM += theta ; | |
432 | pm -= phi ; | |
433 | pM += phi ; | |
434 | ||
92862013 | 435 | TH2F * histoparticle = new TH2F("histoparticle", histoname, |
6ad0bfa0 | 436 | pdim, pm, pM, tdim, tm, tM) ; |
92862013 | 437 | histoparticle->SetStats(kFALSE) ; |
6ad0bfa0 | 438 | |
439 | // Get pointers to Alice Particle TClonesArray | |
440 | ||
92862013 | 441 | TParticle * particle; |
442 | TClonesArray * particlearray = gAlice->Particles(); | |
6ad0bfa0 | 443 | |
92862013 | 444 | Text_t canvasname[80]; |
445 | sprintf(canvasname,"Particles incident in PHOS/EMC module # %d",module) ; | |
446 | TCanvas * kinecanvas = new TCanvas("kinecanvas", canvasname, 650, 500) ; | |
6ad0bfa0 | 447 | |
448 | // get the KINE Tree | |
449 | ||
92862013 | 450 | TTree * kine = gAlice->TreeK() ; |
451 | Stat_t nParticles = kine->GetEntries() ; | |
452 | cout << "DisplayKineEvent > events in kine " << nParticles << endl ; | |
6ad0bfa0 | 453 | |
454 | // loop over particles | |
455 | ||
92862013 | 456 | Double_t kRADDEG = 180. / TMath::Pi() ; |
6ad0bfa0 | 457 | Int_t index1 ; |
458 | Int_t nparticlein = 0 ; | |
92862013 | 459 | for (index1 = 0 ; index1 < nParticles ; index1++){ |
460 | Int_t nparticle = particlearray->GetEntriesFast() ; | |
6ad0bfa0 | 461 | Int_t index2 ; |
462 | for( index2 = 0 ; index2 < nparticle ; index2++) { | |
92862013 | 463 | particle = (TParticle*)particlearray->UncheckedAt(index2) ; |
464 | Int_t particletype = particle->GetPdgCode() ; | |
465 | if (testparticle == -999 || testparticle == particletype) { | |
466 | Double_t phi = particle->Phi() ; | |
467 | Double_t theta = particle->Theta() ; | |
6ad0bfa0 | 468 | Int_t mod ; |
469 | Double_t x, z ; | |
92862013 | 470 | fGeom->ImpactOnEmc(theta, phi, mod, z, x) ; |
471 | if ( mod == module ) { | |
6ad0bfa0 | 472 | nparticlein++ ; |
92862013 | 473 | histoparticle->Fill(phi*kRADDEG, theta*kRADDEG, particle->Energy() ) ; |
6ad0bfa0 | 474 | } |
475 | } | |
476 | } | |
477 | } | |
92862013 | 478 | kinecanvas->Draw() ; |
479 | histoparticle->Draw("color") ; | |
480 | TPaveText * pavetext = new TPaveText(294, 100, 300, 101); | |
6ad0bfa0 | 481 | Text_t text[40] ; |
482 | sprintf(text, "Particles: %d ", nparticlein) ; | |
92862013 | 483 | pavetext->AddText(text) ; |
484 | pavetext->Draw() ; | |
485 | kinecanvas->Update(); | |
6ad0bfa0 | 486 | |
487 | } | |
488 | //____________________________________________________________________________ | |
489 | void AliPHOSAnalyze::DisplayRecParticles() | |
490 | { | |
491 | if (fEvt == -999) { | |
15605d3c | 492 | cout << "DisplayRecParticles > Analyze an event first ... (y/n) " ; |
6ad0bfa0 | 493 | Text_t answer[1] ; |
494 | cin >> answer ; cout << answer ; | |
495 | if ( answer == "y" ) | |
496 | AnalyzeOneEvent() ; | |
497 | } | |
498 | if (fEvt != -999) { | |
499 | ||
92862013 | 500 | Int_t module ; |
15605d3c | 501 | cout << "DisplayRecParticles > which module (1-5, -1: all) ? " ; |
92862013 | 502 | cin >> module ; cout << module << endl ; |
503 | Text_t histoname[80] ; | |
504 | sprintf(histoname,"Event %d: Reconstructed particles in module %d", fEvt, module) ; | |
505 | Double_t tm, tM, pm, pM ; // min and Max theta and phi covered by module | |
506 | fGeom->EmcModuleCoverage(module, tm, tM, pm, pM, kDegre) ; | |
6ad0bfa0 | 507 | Double_t theta, phi ; |
508 | fGeom->EmcXtalCoverage(theta, phi, kDegre) ; | |
509 | Int_t tdim = (Int_t)( (tM - tm) / theta ) ; | |
510 | Int_t pdim = (Int_t)( (pM - pm) / phi ) ; | |
511 | tm -= theta ; | |
512 | tM += theta ; | |
513 | pm -= phi ; | |
92862013 | 514 | TH2F * histoRparticle = new TH2F("histoRparticle", histoname, |
6ad0bfa0 | 515 | pdim, pm, pM, tdim, tm, tM) ; |
92862013 | 516 | histoRparticle->SetStats(kFALSE) ; |
517 | Text_t canvasname[80] ; | |
518 | sprintf(canvasname, "Reconstructed particles in PHOSmodule # %d", module) ; | |
519 | TCanvas * rparticlecanvas = new TCanvas("RparticleCanvas", canvasname, 650, 500) ; | |
6ad0bfa0 | 520 | RecParticlesList * rpl = fPHOS->RecParticles() ; |
92862013 | 521 | Int_t nRecParticles = rpl->GetEntries() ; |
522 | Int_t nRecParticlesInModule = 0 ; | |
6ad0bfa0 | 523 | TIter nextRecPart(rpl) ; |
524 | AliPHOSRecParticle * rp ; | |
92862013 | 525 | cout << "DisplayRecParticles > " << nRecParticles << " reconstructed particles " << endl ; |
526 | Double_t kRADDEG = 180. / TMath::Pi() ; | |
6ad0bfa0 | 527 | while ( (rp = (AliPHOSRecParticle *)nextRecPart() ) ) { |
528 | AliPHOSTrackSegment * ts = rp->GetPHOSTrackSegment() ; | |
92862013 | 529 | if ( ts->GetPHOSMod() == module ) { |
530 | nRecParticlesInModule++ ; | |
531 | Double_t theta = rp->Theta() * kRADDEG ; | |
532 | Double_t phi = rp->Phi() * kRADDEG ; | |
6ad0bfa0 | 533 | Double_t energy = rp->Energy() ; |
92862013 | 534 | histoRparticle->Fill(phi, theta, energy) ; |
6ad0bfa0 | 535 | } |
536 | } | |
92862013 | 537 | histoRparticle->Draw("color") ; |
15605d3c | 538 | |
539 | nextRecPart.Reset() ; | |
540 | while ( (rp = (AliPHOSRecParticle *)nextRecPart() ) ) { | |
541 | AliPHOSTrackSegment * ts = rp->GetPHOSTrackSegment() ; | |
542 | if ( ts->GetPHOSMod() == module ) | |
543 | rp->Draw("P") ; | |
544 | } | |
545 | ||
6ad0bfa0 | 546 | Text_t text[80] ; |
92862013 | 547 | sprintf(text, "reconstructed particles: %d", nRecParticlesInModule) ; |
548 | TPaveText * pavetext = new TPaveText(292, 100, 300, 101); | |
549 | pavetext->AddText(text) ; | |
550 | pavetext->Draw() ; | |
551 | rparticlecanvas->Update() ; | |
6ad0bfa0 | 552 | } |
553 | } | |
554 | ||
555 | //____________________________________________________________________________ | |
556 | void AliPHOSAnalyze::DisplayRecPoints() | |
557 | { | |
558 | if (fEvt == -999) { | |
559 | cout << "DisplayRecPoints > Analyze an event first ... (y/n) " ; | |
560 | Text_t answer[1] ; | |
561 | cin >> answer ; cout << answer ; | |
562 | if ( answer == "y" ) | |
563 | AnalyzeOneEvent() ; | |
564 | } | |
565 | if (fEvt != -999) { | |
566 | ||
92862013 | 567 | Int_t module ; |
6ad0bfa0 | 568 | cout << "DisplayRecPoints > which module (1-5, -1: all) ? " ; |
92862013 | 569 | cin >> module ; cout << module << endl ; |
6ad0bfa0 | 570 | |
92862013 | 571 | Text_t canvasname[80]; |
572 | sprintf(canvasname,"Digits in PHOS/EMC module # %d",module) ; | |
573 | TCanvas * modulecanvas = new TCanvas("module", canvasname, 650, 500) ; | |
574 | modulecanvas->Draw() ; | |
6ad0bfa0 | 575 | |
92862013 | 576 | //=========== Creating 2d-histogram of the PHOS module |
6ad0bfa0 | 577 | // a little bit junkie but is used to test Geom functinalities |
578 | ||
92862013 | 579 | Double_t tm, tM, pm, pM ; // min and Max theta and phi covered by module |
6ad0bfa0 | 580 | |
92862013 | 581 | fGeom->EmcModuleCoverage(module, tm, tM, pm, pM); |
6ad0bfa0 | 582 | // convert angles into coordinates local to the EMC module of interest |
583 | ||
92862013 | 584 | Int_t emcModuleNumber ; |
585 | Double_t emcModulexm, emcModulezm ; // minimum local coordinate in a given EMCA module | |
586 | Double_t emcModulexM, emcModulezM ; // maximum local coordinate in a given EMCA module | |
587 | fGeom->ImpactOnEmc(tm, pm, emcModuleNumber, emcModulezm, emcModulexm) ; | |
588 | fGeom->ImpactOnEmc(tM, pM, emcModuleNumber, emcModulezM, emcModulexM) ; | |
589 | Int_t xdim = (Int_t)( ( emcModulexM - emcModulexm ) / fGeom->GetCrystalSize(0) ) ; | |
590 | Int_t zdim = (Int_t)( ( emcModulezM - emcModulezm ) / fGeom->GetCrystalSize(2) ) ; | |
591 | Float_t xmin = emcModulexm - fGeom->GetCrystalSize(0) ; | |
592 | Float_t xMax = emcModulexM + fGeom->GetCrystalSize(0) ; | |
593 | Float_t zmin = emcModulezm - fGeom->GetCrystalSize(2) ; | |
594 | Float_t zMax = emcModulezM + fGeom->GetCrystalSize(2) ; | |
595 | Text_t histoname[80]; | |
596 | sprintf(histoname,"Event %d: Digits and RecPoints in module %d", fEvt, module) ; | |
597 | TH2F * hModule = new TH2F("HistoReconstructed", histoname, | |
6ad0bfa0 | 598 | xdim, xmin, xMax, zdim, zmin, zMax) ; |
599 | hModule->SetMaximum(2.0); | |
600 | hModule->SetMinimum(0.0); | |
601 | hModule->SetStats(kFALSE); | |
602 | ||
603 | TIter next(fPHOS->Digits()) ; | |
92862013 | 604 | Float_t energy, y, z; |
605 | Float_t etot=0.; | |
606 | Int_t relid[4]; Int_t nDigits = 0 ; | |
6ad0bfa0 | 607 | AliPHOSDigit * digit ; |
6ad0bfa0 | 608 | while((digit = (AliPHOSDigit *)next())) |
609 | { | |
92862013 | 610 | fGeom->AbsToRelNumbering(digit->GetId(), relid) ; |
611 | if (relid[0] == module) | |
6ad0bfa0 | 612 | { |
92862013 | 613 | nDigits++ ; |
614 | energy = fClu->Calibrate(digit->GetAmp()) ; | |
615 | etot += energy ; | |
616 | fGeom->RelPosInModule(relid,y,z) ; | |
617 | if (energy > 0.01 ) | |
618 | hModule->Fill(y, z, energy) ; | |
6ad0bfa0 | 619 | } |
620 | } | |
92862013 | 621 | cout <<"DrawRecPoints > Found in module " |
622 | << module << " " << nDigits << " digits with total energy " << etot << endl ; | |
6ad0bfa0 | 623 | hModule->Draw("col2") ; |
624 | ||
92862013 | 625 | //=========== Cluster in module |
6ad0bfa0 | 626 | |
92862013 | 627 | TClonesArray * emcRP = fPHOS->EmcClusters() ; |
628 | etot = 0.; | |
629 | Int_t totalnClusters = 0 ; | |
630 | Int_t nClusters = 0 ; | |
631 | TIter nextemc(emcRP) ; | |
6ad0bfa0 | 632 | AliPHOSEmcRecPoint * emc ; |
633 | while((emc = (AliPHOSEmcRecPoint *)nextemc())) | |
634 | { | |
cf239357 | 635 | Int_t numberofprimaries ; |
636 | Int_t * primariesarray = new Int_t[10] ; | |
637 | emc->GetPrimaries(numberofprimaries, primariesarray) ; | |
92862013 | 638 | totalnClusters++ ; |
639 | if ( emc->GetPHOSMod() == module ) | |
6ad0bfa0 | 640 | { |
92862013 | 641 | nClusters++ ; |
642 | energy = emc->GetTotalEnergy() ; | |
643 | etot+= energy ; | |
26d4b141 | 644 | emc->Draw("M") ; |
6ad0bfa0 | 645 | } |
646 | } | |
92862013 | 647 | cout << "DrawRecPoints > Found " << totalnClusters << " EMC Clusters in PHOS" << endl ; |
648 | cout << "DrawRecPoints > Found in module " << module << " " << nClusters << " EMC Clusters " << endl ; | |
649 | cout << "DrawRecPoints > total energy " << etot << endl ; | |
6ad0bfa0 | 650 | |
92862013 | 651 | TPaveText * pavetext = new TPaveText(22, 80, 83, 90); |
6ad0bfa0 | 652 | Text_t text[40] ; |
92862013 | 653 | sprintf(text, "digits: %d; clusters: %d", nDigits, nClusters) ; |
654 | pavetext->AddText(text) ; | |
655 | pavetext->Draw() ; | |
656 | modulecanvas->Update(); | |
6ad0bfa0 | 657 | |
92862013 | 658 | //=========== Cluster in module PPSD Down |
6ad0bfa0 | 659 | |
92862013 | 660 | TClonesArray * ppsdRP = fPHOS->PpsdClusters() ; |
661 | etot = 0.; | |
662 | TIter nextPpsd(ppsdRP) ; | |
663 | AliPHOSPpsdRecPoint * ppsd ; | |
664 | while((ppsd = (AliPHOSPpsdRecPoint *)nextPpsd())) | |
6ad0bfa0 | 665 | { |
92862013 | 666 | totalnClusters++ ; |
667 | if ( ppsd->GetPHOSMod() == module ) | |
6ad0bfa0 | 668 | { |
92862013 | 669 | nClusters++ ; |
670 | energy = ppsd->GetEnergy() ; | |
671 | etot+=energy ; | |
672 | if (!ppsd->GetUp()) ppsd->Draw("P") ; | |
6ad0bfa0 | 673 | } |
674 | } | |
92862013 | 675 | cout << "DrawRecPoints > Found " << totalnClusters << " Ppsd Down Clusters in PHOS" << endl ; |
676 | cout << "DrawRecPoints > Found in module " << module << " " << nClusters << " Ppsd Down Clusters " << endl ; | |
677 | cout << "DrawRecPoints > total energy " << etot << endl ; | |
6ad0bfa0 | 678 | |
92862013 | 679 | //=========== Cluster in module PPSD Up |
6ad0bfa0 | 680 | |
92862013 | 681 | ppsdRP = fPHOS->PpsdClusters() ; |
682 | etot = 0.; | |
683 | TIter nextPpsdUp(ppsdRP) ; | |
684 | while((ppsd = (AliPHOSPpsdRecPoint *)nextPpsdUp())) | |
6ad0bfa0 | 685 | { |
92862013 | 686 | totalnClusters++ ; |
687 | if ( ppsd->GetPHOSMod() == module ) | |
6ad0bfa0 | 688 | { |
92862013 | 689 | nClusters++ ; |
690 | energy = ppsd->GetEnergy() ; | |
691 | etot+=energy ; | |
692 | if (ppsd->GetUp()) ppsd->Draw("P") ; | |
6ad0bfa0 | 693 | } |
694 | } | |
92862013 | 695 | cout << "DrawRecPoints > Found " << totalnClusters << " Ppsd Up Clusters in PHOS" << endl ; |
696 | cout << "DrawRecPoints > Found in module " << module << " " << nClusters << " Ppsd Up Clusters " << endl ; | |
697 | cout << "DrawRecPoints > total energy " << etot << endl ; | |
6ad0bfa0 | 698 | |
699 | } // if !-999 | |
700 | } | |
701 | ||
702 | //____________________________________________________________________________ | |
703 | void AliPHOSAnalyze::DisplayTrackSegments() | |
704 | { | |
705 | if (fEvt == -999) { | |
706 | cout << "DisplayTrackSegments > Analyze an event first ... (y/n) " ; | |
707 | Text_t answer[1] ; | |
708 | cin >> answer ; cout << answer ; | |
709 | if ( answer == "y" ) | |
710 | AnalyzeOneEvent() ; | |
711 | } | |
712 | if (fEvt != -999) { | |
713 | ||
92862013 | 714 | Int_t module ; |
6ad0bfa0 | 715 | cout << "DisplayTrackSegments > which module (1-5, -1: all) ? " ; |
92862013 | 716 | cin >> module ; cout << module << endl ; |
717 | //=========== Creating 2d-histogram of the PHOS module | |
6ad0bfa0 | 718 | // a little bit junkie but is used to test Geom functinalities |
719 | ||
92862013 | 720 | Double_t tm, tM, pm, pM ; // min and Max theta and phi covered by module |
6ad0bfa0 | 721 | |
92862013 | 722 | fGeom->EmcModuleCoverage(module, tm, tM, pm, pM); |
6ad0bfa0 | 723 | // convert angles into coordinates local to the EMC module of interest |
724 | ||
92862013 | 725 | Int_t emcModuleNumber ; |
726 | Double_t emcModulexm, emcModulezm ; // minimum local coordinate in a given EMCA module | |
727 | Double_t emcModulexM, emcModulezM ; // maximum local coordinate in a given EMCA module | |
728 | fGeom->ImpactOnEmc(tm, pm, emcModuleNumber, emcModulezm, emcModulexm) ; | |
729 | fGeom->ImpactOnEmc(tM, pM, emcModuleNumber, emcModulezM, emcModulexM) ; | |
730 | Int_t xdim = (Int_t)( ( emcModulexM - emcModulexm ) / fGeom->GetCrystalSize(0) ) ; | |
731 | Int_t zdim = (Int_t)( ( emcModulezM - emcModulezm ) / fGeom->GetCrystalSize(2) ) ; | |
732 | Float_t xmin = emcModulexm - fGeom->GetCrystalSize(0) ; | |
733 | Float_t xMax = emcModulexM + fGeom->GetCrystalSize(0) ; | |
734 | Float_t zmin = emcModulezm - fGeom->GetCrystalSize(2) ; | |
735 | Float_t zMax = emcModulezM + fGeom->GetCrystalSize(2) ; | |
736 | Text_t histoname[80]; | |
737 | sprintf(histoname,"Event %d: Track Segments in module %d", fEvt, module) ; | |
738 | TH2F * histotrack = new TH2F("histotrack", histoname, | |
6ad0bfa0 | 739 | xdim, xmin, xMax, zdim, zmin, zMax) ; |
92862013 | 740 | histotrack->SetStats(kFALSE); |
741 | Text_t canvasname[80]; | |
742 | sprintf(canvasname,"Track segments in PHOS/EMC-PPSD module # %d", module) ; | |
743 | TCanvas * trackcanvas = new TCanvas("TrackSegmentCanvas", canvasname, 650, 500) ; | |
744 | histotrack->Draw() ; | |
6ad0bfa0 | 745 | |
746 | TrackSegmentsList * trsegl = fPHOS->TrackSegments() ; | |
747 | AliPHOSTrackSegment * trseg ; | |
748 | ||
92862013 | 749 | Int_t nTrackSegments = trsegl->GetEntries() ; |
6ad0bfa0 | 750 | Int_t index ; |
92862013 | 751 | Float_t etot = 0 ; |
752 | Int_t nTrackSegmentsInModule = 0 ; | |
753 | for(index = 0; index < nTrackSegments ; index++){ | |
6ad0bfa0 | 754 | trseg = (AliPHOSTrackSegment * )trsegl->At(index) ; |
92862013 | 755 | etot+= trseg->GetEnergy() ; |
756 | if ( trseg->GetPHOSMod() == module ) { | |
757 | nTrackSegmentsInModule++ ; | |
6ad0bfa0 | 758 | trseg->Draw("P"); |
759 | } | |
760 | } | |
761 | Text_t text[80] ; | |
92862013 | 762 | sprintf(text, "track segments: %d", nTrackSegmentsInModule) ; |
763 | TPaveText * pavetext = new TPaveText(22, 80, 83, 90); | |
764 | pavetext->AddText(text) ; | |
765 | pavetext->Draw() ; | |
766 | trackcanvas->Update() ; | |
767 | cout << "DisplayTrackSegments > Found " << trsegl->GetEntries() << " Track segments with total energy "<< etot << endl ; | |
6ad0bfa0 | 768 | |
769 | } | |
770 | } | |
771 | //____________________________________________________________________________ | |
772 | Bool_t AliPHOSAnalyze::OpenRootFile(Text_t * name) | |
773 | { | |
774 | fRootFile = new TFile(name) ; | |
775 | return fRootFile->IsOpen() ; | |
776 | } | |
92862013 | 777 | //____________________________________________________________________________ |
778 | void AliPHOSAnalyze::SavingHistograms() | |
779 | { | |
3862b681 | 780 | Text_t outputname[80] ;// = fRootFile->GetName(); |
781 | sprintf(outputname,"%s.analyzed",fRootFile->GetName()); | |
782 | TFile output(outputname,"RECREATE"); | |
92862013 | 783 | output.cd(); |
b9bbdad1 | 784 | if (fhEmcDigit ) |
785 | fhEmcDigit->Write() ; | |
786 | if (fhVetoDigit ) | |
787 | fhVetoDigit->Write() ; | |
788 | if (fhConvertorDigit ) | |
789 | fhConvertorDigit->Write() ; | |
790 | if (fhEmcCluster ) | |
791 | fhEmcCluster->Write() ; | |
792 | if (fhVetoCluster ) | |
793 | fhVetoCluster->Write() ; | |
794 | if (fhConvertorCluster ) | |
795 | fhConvertorCluster->Write() ; | |
796 | if (fhConvertorEmc ) | |
797 | fhConvertorEmc->Write() ; | |
798 | if (fhPhotonEnergy) | |
799 | fhPhotonEnergy->Write() ; | |
800 | if (fhPhotonPositionX) | |
801 | fhPhotonPositionX->Write() ; | |
802 | if (fhPhotonPositionY) | |
803 | fhPhotonPositionX->Write() ; | |
804 | if (fhElectronEnergy) | |
805 | fhElectronEnergy->Write() ; | |
806 | if (fhElectronPositionX) | |
807 | fhElectronPositionX->Write() ; | |
808 | if (fhElectronPositionY) | |
809 | fhElectronPositionX->Write() ; | |
810 | if (fhNeutralHadronEnergy) | |
811 | fhNeutralHadronEnergy->Write() ; | |
812 | if (fhNeutralHadronPositionX) | |
813 | fhNeutralHadronPositionX->Write() ; | |
814 | if (fhNeutralHadronPositionY) | |
815 | fhNeutralHadronPositionX->Write() ; | |
816 | if (fhNeutralEMEnergy) | |
817 | fhNeutralEMEnergy->Write() ; | |
818 | if (fhNeutralEMPositionX) | |
819 | fhNeutralEMPositionX->Write() ; | |
820 | if (fhNeutralEMPositionY) | |
821 | fhNeutralEMPositionX->Write() ; | |
822 | if (fhChargedHadronEnergy) | |
823 | fhChargedHadronEnergy->Write() ; | |
824 | if (fhChargedHadronPositionX) | |
825 | fhChargedHadronPositionX->Write() ; | |
826 | if (fhChargedHadronPositionY) | |
827 | fhChargedHadronPositionX->Write() ; | |
c1d256cb | 828 | if (fhPhotonHadronEnergy) |
829 | fhPhotonHadronEnergy->Write() ; | |
830 | if (fhPhotonHadronPositionX) | |
831 | fhPhotonHadronPositionX->Write() ; | |
832 | if (fhPhotonHadronPositionY) | |
833 | fhPhotonHadronPositionX->Write() ; | |
92862013 | 834 | |
835 | output.Write(); | |
836 | output.Close(); | |
837 | } |