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