1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 //_________________________________________________________________________
19 // Algorythm class to analyze PHOSv1 events:
20 // Construct histograms and displays them.
21 // Use the macro EditorBar.C for best access to the functionnalities
23 //*-- Author: Y. Schutz (SUBATECH) & Gines Martinez (SUBATECH)
24 //////////////////////////////////////////////////////////////////////////////
26 // --- ROOT system ---
33 #include "TParticle.h"
34 #include "TClonesArray.h"
40 // --- Standard library ---
45 // --- AliRoot header files ---
48 #include "AliPHOSv1.h"
49 #include "AliPHOSAnalyze.h"
50 #include "AliPHOSClusterizerv1.h"
51 #include "AliPHOSTrackSegmentMakerv1.h"
52 #include "AliPHOSPIDv1.h"
53 #include "AliPHOSReconstructioner.h"
54 #include "AliPHOSDigit.h"
55 #include "AliPHOSTrackSegment.h"
56 #include "AliPHOSRecParticle.h"
57 #include "AliPHOSIndexToObject.h"
58 #include "AliPHOSHit.h"
59 #include "AliPHOSCpvRecPoint.h"
60 #include "AliPHOSPpsdRecPoint.h"
62 ClassImp(AliPHOSAnalyze)
64 //____________________________________________________________________________
65 AliPHOSAnalyze::AliPHOSAnalyze()
67 // default ctor (useless)
72 //____________________________________________________________________________
73 AliPHOSAnalyze::AliPHOSAnalyze(Text_t * name)
75 // ctor: analyze events from root file "name"
77 Bool_t ok = OpenRootFile(name) ;
79 cout << " AliPHOSAnalyze > Error opening " << name << endl ;
82 //========== Get AliRun object from file
83 gAlice = (AliRun*) fRootFile->Get("gAlice") ;
85 //=========== Get the PHOS object and associated geometry from the file
86 fPHOS = (AliPHOSv1 *)gAlice->GetDetector("PHOS") ;
87 fGeom = AliPHOSGeometry::GetInstance( fPHOS->GetGeometry()->GetName(), fPHOS->GetGeometry()->GetTitle() );
89 //========== Initializes the Index to Object converter
90 fObjGetter = AliPHOSIndexToObject::GetInstance() ; // <--- To be redone
91 //========== Current event number
103 //____________________________________________________________________________
104 AliPHOSAnalyze::AliPHOSAnalyze(const AliPHOSAnalyze & ana)
107 ( (AliPHOSAnalyze &)ana ).Copy(*this) ;
110 //____________________________________________________________________________
111 void AliPHOSAnalyze::Copy(TObject & obj)
113 // copy an analysis into an other one
115 // I do nothing more because the copy is silly but the Code checkers requires one
118 //____________________________________________________________________________
119 AliPHOSAnalyze::~AliPHOSAnalyze()
123 if(fRootFile->IsOpen()) fRootFile->Close() ;
124 if(fRootFile) {delete fRootFile ; fRootFile=0 ;}
125 if(fPHOS) {delete fPHOS ; fPHOS =0 ;}
126 // if(fClu) {delete fClu ; fClu =0 ;}
127 // if(fPID) {delete fPID ; fPID =0 ;}
128 // if(fRec) {delete fRec ; fRec =0 ;}
129 // if(fTrs) {delete fTrs ; fTrs =0 ;}
132 //____________________________________________________________________________
133 void AliPHOSAnalyze::DrawRecon(Int_t Nevent,Int_t Nmod){
134 // //Draws pimary particles and reconstructed
135 // //digits, RecPoints, RecPartices etc
136 // //for event Nevent in the module Nmod.
138 // TH2F * digitOccupancy = new TH2F("digitOccupancy","EMC digits", 64,-71.,71.,64,-71.,71.);
139 // TH2F * sdigitOccupancy = new TH2F("sdigitOccupancy","EMC sdigits", 64,-71.,71.,64,-71.,71.);
140 // TH2F * emcOccupancy = new TH2F("emcOccupancy","EMC RecPoints",64,-71.,71.,64,-71.,71.);
141 // TH2F * ppsdUp = new TH2F("ppsdUp","PPSD Up digits", 128,-71.,71.,128,-71.,71.) ;
142 // TH2F * ppsdUpCl = new TH2F("ppsdUpCl","PPSD Up RecPoints",128,-71.,71.,128,-71.,71.) ;
143 // TH2F * ppsdLow = new TH2F("ppsdLow","PPSD Low digits", 128,-71.,71.,128,-71.,71.) ;
144 // TH2F * ppsdLowCl = new TH2F("ppsdLowCl","PPSD Low RecPoints",128,-71.,71.,128,-71.,71.) ;
145 // TH2F * nbar = new TH2F("nbar","Primary nbar", 64,-71.,71.,64,-71.,71.);
146 // TH2F * phot = new TH2F("phot","Primary Photon", 64,-71.,71.,64,-71.,71.);
147 // TH2F * charg = new TH2F("charg","Primary charged",64,-71.,71.,64,-71.,71.);
148 // TH2F * recPhot = new TH2F("recPhot","RecParticles with primary Photon",64,-71.,71.,64,-71.,71.);
149 // TH2F * recNbar = new TH2F("recNbar","RecParticles with primary Nbar", 64,-71.,71.,64,-71.,71.);
151 // //========== Create the Clusterizer
152 // // fClu = new AliPHOSClusterizerv1() ;
154 // gAlice->GetEvent(Nevent);
156 // TParticle * primary ;
158 // for ( iPrimary = 0 ; iPrimary < gAlice->GetNtrack() ; iPrimary++)
160 // primary = gAlice->Particle(iPrimary) ;
161 // Int_t primaryType = primary->GetPdgCode() ;
162 // if( (primaryType == 211)||(primaryType == -211)||(primaryType == 2212)||(primaryType == -2212) ) {
163 // Int_t moduleNumber ;
164 // Double_t primX, primZ ;
165 // fGeom->ImpactOnEmc(primary->Theta(), primary->Phi(), moduleNumber, primX, primZ) ;
166 // if(moduleNumber==Nmod)
167 // charg->Fill(primZ,primX,primary->Energy()) ;
169 // if( primaryType == 22 ) {
170 // Int_t moduleNumber ;
171 // Double_t primX, primZ ;
172 // fGeom->ImpactOnEmc(primary->Theta(), primary->Phi(), moduleNumber, primX, primZ) ;
173 // if(moduleNumber==Nmod)
174 // phot->Fill(primZ,primX,primary->Energy()) ;
177 // if( primaryType == -2112 ) {
178 // Int_t moduleNumber ;
179 // Double_t primX, primZ ;
180 // fGeom->ImpactOnEmc(primary->Theta(), primary->Phi(), moduleNumber, primX, primZ) ;
181 // if(moduleNumber==Nmod)
182 // nbar->Fill(primZ,primX,primary->Energy()) ;
187 // //Set TreeS here and get AliPHOSSdigitizer
190 // gAlice->TreeS()->GetEvent(0) ;
193 // AliPHOSDigit * sdigit ;
195 // if(fPHOS->SDigits()){
196 // for(iSDigit = 0; iSDigit < fPHOS->SDigits()->GetEntries(); iSDigit++)
198 // sdigit = (AliPHOSDigit *) fPHOS->SDigits()->At(iSDigit) ;
200 // fGeom->AbsToRelNumbering(sdigit->GetId(), relid) ;
202 // fGeom->RelPosInModule(relid,x,z) ;
203 // Float_t e = 1 ; //<--- fPHOS->Calibrate(sdigit->GetAmp()) ;
204 // if(relid[0]==Nmod){
205 // if(relid[1]==0) //EMC
206 // sdigitOccupancy->Fill(x,z,e) ;
207 // if((relid[1]>0)&&(relid[1]<17))
208 // ppsdUp->Fill(x,z,e) ;
210 // ppsdLow->Fill(x,z,e) ;
215 // cout << "No SDigits read " << endl ;
218 // gAlice->TreeD()->GetEvent(0) ;
220 // if(fPHOS->Digits()){
222 // AliPHOSDigit * digit ;
223 // for(iDigit = 0; iDigit < fPHOS->Digits()->GetEntries(); iDigit++)
225 // digit = (AliPHOSDigit *) fPHOS->Digits()->At(iDigit) ;
227 // fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
229 // fGeom->RelPosInModule(relid,x,z) ;
230 // Float_t e = 1; //<--- fClu->Calibrate(digit->GetAmp()) ;
231 // if(relid[0]==Nmod){
232 // if(relid[1]==0) //EMC
233 // digitOccupancy->Fill(x,z,e) ;
234 // if((relid[1]>0)&&(relid[1]<17))
235 // ppsdUp->Fill(x,z,e) ;
237 // ppsdLow->Fill(x,z,e) ;
242 // cout << "No Digits read " << endl ;
245 // gAlice->TreeR()->GetEvent(0) ;
247 // TObjArray * emcRecPoints = fPHOS->EmcRecPoints() ;
248 // TObjArray * ppsdRecPoints = fPHOS->PpsdRecPoints() ;
249 // TClonesArray * recParticleList = fPHOS->RecParticles() ;
255 // if(emcRecPoints ){
256 // for(irecp = 0; irecp < emcRecPoints->GetEntries() ; irecp ++){
257 // AliPHOSEmcRecPoint * emc= (AliPHOSEmcRecPoint*)emcRecPoints->At(irecp) ;
258 // if(emc->GetPHOSMod()==Nmod){
259 // emc->GetLocalPosition(pos) ;
260 // emcOccupancy->Fill(pos.X(),pos.Z(),emc->GetEnergy());
265 // cout << "No EMC rec points read " << endl ;
268 // if(ppsdRecPoints ){
269 // for(irecp = 0; irecp < ppsdRecPoints->GetEntries() ; irecp ++){
270 // AliPHOSPpsdRecPoint * ppsd= (AliPHOSPpsdRecPoint *)ppsdRecPoints->At(irecp) ;
272 // ppsd->GetLocalPosition(pos) ;
273 // cout << "PPSD " << irecp << " " << ppsd->GetPHOSMod() << " " << pos.X() << " " << pos.Z() << endl ;
275 // if(ppsd->GetPHOSMod()==Nmod){
276 // ppsd->GetLocalPosition(pos) ;
278 // ppsdUpCl->Fill(pos.X(),pos.Z(),ppsd->GetEnergy());
280 // ppsdLowCl->Fill(pos.X(),pos.Z(),ppsd->GetEnergy());
285 // cout << "No PPSD/CPV rec points read " << endl ;
288 // AliPHOSRecParticle * recParticle ;
289 // Int_t iRecParticle ;
290 // if(recParticleList ){
291 // for(iRecParticle = 0; iRecParticle < recParticleList->GetEntries() ;iRecParticle++ )
293 // recParticle = (AliPHOSRecParticle *) recParticleList->At(iRecParticle) ;
295 // Int_t moduleNumberRec ;
296 // Double_t recX, recZ ;
297 // fGeom->ImpactOnEmc(recParticle->Theta(), recParticle->Phi(), moduleNumberRec, recX, recZ) ;
298 // if(moduleNumberRec == Nmod){
300 // Double_t minDistance = 5. ;
301 // Int_t closestPrimary = -1 ;
303 // Int_t numberofprimaries ;
304 // Int_t * listofprimaries = recParticle->GetPrimaries(numberofprimaries) ;
306 // TParticle * primary ;
307 // Double_t distance = minDistance ;
309 // for ( index = 0 ; index < numberofprimaries ; index++){
310 // primary = gAlice->Particle(listofprimaries[index]) ;
311 // Int_t moduleNumber ;
312 // Double_t primX, primZ ;
313 // fGeom->ImpactOnEmc(primary->Theta(), primary->Phi(), moduleNumber, primX, primZ) ;
314 // if(moduleNumberRec == moduleNumber)
315 // distance = TMath::Sqrt((recX-primX)*(recX-primX)+(recZ-primZ)*(recZ-primZ) ) ;
316 // if(minDistance > distance)
318 // minDistance = distance ;
319 // closestPrimary = listofprimaries[index] ;
323 // if(closestPrimary >=0 ){
325 // Int_t primaryType = gAlice->Particle(closestPrimary)->GetPdgCode() ;
327 // if(primaryType==22)
328 // recPhot->Fill(recZ,recX,recParticle->Energy()) ;
330 // if(primaryType==-2112)
331 // recNbar->Fill(recZ,recX,recParticle->Energy()) ;
337 // cout << "Not Rec Prticles read " << endl ;
340 // digitOccupancy->Draw("box") ;
341 // sdigitOccupancy->SetLineColor(5) ;
342 // sdigitOccupancy->Draw("box") ;
343 // emcOccupancy->SetLineColor(2) ;
344 // emcOccupancy->Draw("boxsame") ;
345 // ppsdUp->SetLineColor(3) ;
346 // ppsdUp->Draw("boxsame") ;
347 // ppsdLow->SetLineColor(4) ;
348 // ppsdLow->Draw("boxsame") ;
349 // phot->SetLineColor(8) ;
350 // phot->Draw("boxsame") ;
351 // nbar->SetLineColor(6) ;
352 // nbar->Draw("boxsame") ;
355 // //____________________________________________________________________________
356 // void AliPHOSAnalyze::Reconstruct(Int_t nevents,Int_t firstEvent )
359 // // Performs reconstruction of EMC and CPV (GPS2, IHEP or MIXT)
360 // // for events from FirstEvent to Nevents
363 // for ( ievent=firstEvent; ievent<nevents; ievent++) {
364 // if (ievent==firstEvent) {
365 // cout << "Analyze > Starting Reconstructing " << endl ;
366 // //========== Create the Clusterizer
367 // fClu = new AliPHOSClusterizerv1() ;
369 // //========== Creates the track segment maker
370 // fTrs = new AliPHOSTrackSegmentMakerv1() ;
371 // // fTrs->UnsetUnfoldFlag() ;
373 // //========== Creates the particle identifier
374 // fPID = new AliPHOSPIDv1() ;
375 // fPID->SetShowerProfileCuts(0.3, 1.8, 0.3, 1.8 ) ;
377 // //========== Creates the Reconstructioner
378 // fRec = new AliPHOSReconstructioner(fClu, fTrs, fPID) ;
379 // if (fDebugLevel != 0) fRec -> SetDebugReconstruction(kTRUE);
382 // if (fDebugLevel != 0 ||
383 // (ievent+1) % (Int_t)TMath::Power( 10, (Int_t)TMath::Log10(ievent+1) ) == 0)
384 // cout << "======= Analyze ======> Event " << ievent+1 << endl ;
387 // gAlice->GetEvent(ievent) ;
388 // gAlice->SetEvent(ievent) ;
390 // if(gAlice->TreeS() == 0) gAlice->MakeTree("S");
391 // fPHOS->MakeBranch("S") ;
393 // fPHOS->Hits2SDigits() ;
395 // if(gAlice->TreeD() == 0) gAlice->MakeTree("D");
396 // fPHOS->MakeBranch("D") ;
398 // fPHOS->SDigits2Digits() ;
400 // if(gAlice->TreeR() == 0) gAlice->MakeTree("R");
402 // fPHOS->Reconstruction(fRec);
404 // gAlice->TreeS()->Fill() ;
405 // gAlice->TreeS()->Write(0,TObject::kOverwrite);
407 // gAlice->TreeD()->Fill() ;
408 // gAlice->TreeD()->Write(0,TObject::kOverwrite);
412 // if(fClu) {delete fClu ; fClu =0 ;}
413 // if(fPID) {delete fPID ; fPID =0 ;}
414 // if(fRec) {delete fRec ; fRec =0 ;}
415 // if(fTrs) {delete fTrs ; fTrs =0 ;}
419 //-------------------------------------------------------------------------------------
420 void AliPHOSAnalyze::ReadAndPrintCPV(Int_t EvFirst, Int_t EvLast)
423 // // Read and print generated and reconstructed hits in CPV
424 // // for events from EvFirst to Nevent.
425 // // If only EvFirst is defined, print only this one event.
426 // // Author: Yuri Kharlov
427 // // 12 October 2000
430 // if (EvFirst!=0 && EvLast==0) EvLast=EvFirst;
431 // for ( Int_t ievent=EvFirst; ievent<=EvLast; ievent++) {
433 // //========== Event Number>
434 // cout << endl << "==== ReadAndPrintCPV ====> Event is " << ievent+1 << endl ;
436 // //=========== Connects the various Tree's for evt
437 // Int_t ntracks = gAlice->GetEvent(ievent);
439 // //========== Creating branches ===================================
440 // AliPHOSRecPoint::RecPointsList ** emcRecPoints = fPHOS->EmcRecPoints() ;
441 // gAlice->TreeR()->SetBranchAddress( "PHOSEmcRP" , emcRecPoints ) ;
443 // AliPHOSRecPoint::RecPointsList ** cpvRecPoints = fPHOS->PpsdRecPoints() ;
444 // gAlice->TreeR()->SetBranchAddress( "PHOSPpsdRP", cpvRecPoints ) ;
446 // // Read and print CPV hits
448 // AliPHOSCPVModule cpvModule;
449 // TClonesArray *cpvHits;
451 // AliPHOSCPVHit *cpvHit;
453 // Float_t xgen, zgen;
455 // Int_t nGenHits = 0;
456 // for (Int_t itrack=0; itrack<ntracks; itrack++) {
457 // //=========== Get the Hits Tree for the Primary track itrack
458 // gAlice->ResetHits();
459 // gAlice->TreeH()->GetEvent(itrack);
460 // Int_t iModule = 0 ;
461 // for (iModule=0; iModule < fGeom->GetNCPVModules(); iModule++) {
462 // cpvModule = fPHOS->GetCPVModule(iModule);
463 // cpvHits = cpvModule.Hits();
464 // nCPVhits = cpvHits->GetEntriesFast();
465 // for (Int_t ihit=0; ihit<nCPVhits; ihit++) {
467 // cpvHit = (AliPHOSCPVHit*)cpvHits->UncheckedAt(ihit);
468 // p = cpvHit->GetMomentum();
469 // xgen = cpvHit->X();
470 // zgen = cpvHit->Y();
471 // ipart = cpvHit->GetIpart();
472 // printf("CPV hit in module %d: ",iModule+1);
473 // printf(" p = (%f, %f, %f, %f) GeV,\n",
474 // p.Px(),p.Py(),p.Pz(),p.Energy());
475 // printf(" (X,Z) = (%8.4f, %8.4f) cm, ipart = %d\n",
481 // // Read and print CPV reconstructed points
483 // //=========== Gets the Reconstruction TTree
484 // gAlice->TreeR()->GetEvent(0) ;
485 // printf("Recpoints: %d\n",(*fPHOS->CpvRecPoints())->GetEntries());
486 // TIter nextRP(*fPHOS->CpvRecPoints() ) ;
487 // AliPHOSCpvRecPoint *cpvRecPoint ;
488 // Int_t nRecPoints = 0;
489 // while( ( cpvRecPoint = (AliPHOSCpvRecPoint *)nextRP() ) ) {
492 // cpvRecPoint->GetLocalPosition(locpos);
493 // Int_t phosModule = cpvRecPoint->GetPHOSMod();
494 // printf("CPV recpoint in module %d: (X,Z) = (%f,%f) cm\n",
495 // phosModule,locpos.X(),locpos.Z());
497 // printf("This event has %d generated hits and %d reconstructed points\n",
498 // nGenHits,nRecPoints);
502 //____________________________________________________________________________
503 void AliPHOSAnalyze::AnalyzeCPV(Int_t Nevents)
506 // // Analyzes CPV characteristics
507 // // Author: Yuri Kharlov
511 // // Book histograms
513 // TH1F *hDx = new TH1F("hDx" ,"CPV x-resolution@reconstruction",100,-5. , 5.);
514 // TH1F *hDz = new TH1F("hDz" ,"CPV z-resolution@reconstruction",100,-5. , 5.);
515 // TH1F *hDr = new TH1F("hDr" ,"CPV r-resolution@reconstruction",100, 0. , 5.);
516 // TH1S *hNrp = new TH1S("hNrp" ,"CPV rec.point multiplicity", 21,-0.5,20.5);
517 // TH1S *hNrpX = new TH1S("hNrpX","CPV rec.point Phi-length" , 21,-0.5,20.5);
518 // TH1S *hNrpZ = new TH1S("hNrpZ","CPV rec.point Z-length" , 21,-0.5,20.5);
520 // cout << "Start CPV Analysis"<< endl ;
521 // for ( Int_t ievent=0; ievent<Nevents; ievent++) {
523 // //========== Event Number>
524 // // if ( (ievent+1) % (Int_t)TMath::Power( 10, (Int_t)TMath::Log10(ievent+1) ) == 0)
525 // cout << endl << "==== AnalyzeCPV ====> Event is " << ievent+1 << endl ;
527 // //=========== Connects the various Tree's for evt
528 // Int_t ntracks = gAlice->GetEvent(ievent);
530 // //========== Creating branches ===================================
531 // AliPHOSRecPoint::RecPointsList ** emcRecPoints = fPHOS->EmcRecPoints() ;
532 // gAlice->TreeR()->SetBranchAddress( "PHOSEmcRP" , emcRecPoints ) ;
534 // AliPHOSRecPoint::RecPointsList ** cpvRecPoints = fPHOS->PpsdRecPoints() ;
535 // gAlice->TreeR()->SetBranchAddress( "PHOSPpsdRP", cpvRecPoints ) ;
537 // // Create and fill arrays of hits for each CPV module
539 // Int_t nOfModules = fGeom->GetNModules();
540 // TClonesArray **hitsPerModule = new TClonesArray *[nOfModules];
541 // Int_t iModule = 0;
542 // for (iModule=0; iModule < nOfModules; iModule++)
543 // hitsPerModule[iModule] = new TClonesArray("AliPHOSCPVHit",100);
545 // AliPHOSCPVModule cpvModule;
546 // TClonesArray *cpvHits;
548 // AliPHOSCPVHit *cpvHit;
553 // // First go through all primary tracks and fill the arrays
554 // // of hits per each CPV module
556 // for (Int_t itrack=0; itrack<ntracks; itrack++) {
557 // // Get the Hits Tree for the Primary track itrack
558 // gAlice->ResetHits();
559 // gAlice->TreeH()->GetEvent(itrack);
560 // for (Int_t iModule=0; iModule < nOfModules; iModule++) {
561 // cpvModule = fPHOS->GetCPVModule(iModule);
562 // cpvHits = cpvModule.Hits();
563 // nCPVhits = cpvHits->GetEntriesFast();
564 // for (Int_t ihit=0; ihit<nCPVhits; ihit++) {
565 // cpvHit = (AliPHOSCPVHit*)cpvHits->UncheckedAt(ihit);
566 // p = cpvHit->GetMomentum();
567 // xzgen[0] = cpvHit->X();
568 // xzgen[1] = cpvHit->Y();
569 // ipart = cpvHit->GetIpart();
570 // TClonesArray &lhits = *(TClonesArray *)hitsPerModule[iModule];
571 // new(lhits[hitsPerModule[iModule]->GetEntriesFast()]) AliPHOSCPVHit(*cpvHit);
573 // cpvModule.Clear();
576 // for (iModule=0; iModule < nOfModules; iModule++) {
577 // Int_t nsum = hitsPerModule[iModule]->GetEntriesFast();
578 // printf("Module %d has %d hits\n",iModule,nsum);
581 // // Then go through reconstructed points and for each find
582 // // the closeset hit
583 // // The distance from the rec.point to the closest hit
584 // // gives the coordinate resolution of the CPV
586 // // Get the Reconstruction Tree
587 // gAlice->TreeR()->GetEvent(0) ;
588 // TIter nextRP(*fPHOS->PpsdRecPoints() ) ;
589 // AliPHOSCpvRecPoint *cpvRecPoint ;
590 // Float_t xgen, zgen;
591 // while( ( cpvRecPoint = (AliPHOSCpvRecPoint *)nextRP() ) ) {
593 // cpvRecPoint->GetLocalPosition(locpos);
594 // Int_t phosModule = cpvRecPoint->GetPHOSMod();
595 // Int_t rpMult = cpvRecPoint->GetDigitsMultiplicity();
596 // Int_t rpMultX, rpMultZ;
597 // cpvRecPoint->GetClusterLengths(rpMultX,rpMultZ);
598 // Float_t xrec = locpos.X();
599 // Float_t zrec = locpos.Z();
600 // Float_t dxmin = 1.e+10;
601 // Float_t dzmin = 1.e+10;
602 // Float_t r2min = 1.e+10;
605 // cpvHits = hitsPerModule[phosModule-1];
606 // Int_t nCPVhits = cpvHits->GetEntriesFast();
607 // for (Int_t ihit=0; ihit<nCPVhits; ihit++) {
608 // cpvHit = (AliPHOSCPVHit*)cpvHits->UncheckedAt(ihit);
609 // xgen = cpvHit->X();
610 // zgen = cpvHit->Y();
611 // r2 = TMath::Power((xgen-xrec),2) + TMath::Power((zgen-zrec),2);
612 // if ( r2 < r2min ) {
614 // dxmin = xgen - xrec;
615 // dzmin = zgen - zrec;
618 // hDx ->Fill(dxmin);
619 // hDz ->Fill(dzmin);
620 // hDr ->Fill(TMath::Sqrt(r2min));
621 // hNrp ->Fill(rpMult);
622 // hNrpX->Fill(rpMultX);
623 // hNrpZ->Fill(rpMultZ);
625 // delete [] hitsPerModule;
627 // // Save histograms
629 // Text_t outputname[80] ;
630 // sprintf(outputname,"%s.analyzed",fRootFile->GetName());
631 // TFile output(outputname,"RECREATE");
641 // // Plot histograms
643 // TCanvas *cpvCanvas = new TCanvas("CPV","CPV analysis",20,20,800,400);
644 // gStyle->SetOptStat(111111);
645 // gStyle->SetOptFit(1);
646 // gStyle->SetOptDate(1);
647 // cpvCanvas->Divide(3,2);
650 // gPad->SetFillColor(10);
651 // hNrp->SetFillColor(16);
655 // gPad->SetFillColor(10);
656 // hNrpX->SetFillColor(16);
660 // gPad->SetFillColor(10);
661 // hNrpZ->SetFillColor(16);
665 // gPad->SetFillColor(10);
666 // hDx->SetFillColor(16);
671 // gPad->SetFillColor(10);
672 // hDz->SetFillColor(16);
677 // gPad->SetFillColor(10);
678 // hDr->SetFillColor(16);
681 // cpvCanvas->Print("CPV.ps");
685 //____________________________________________________________________________
686 void AliPHOSAnalyze::InvariantMass(Int_t Nevents )
688 // // Calculates Real and Mixed invariant mass distributions
690 // const Int_t knMixedEvents = 4 ; //# of events used for calculation of 'mixed' distribution
691 // Int_t mixedLoops = (Int_t )TMath::Ceil(Nevents/knMixedEvents) ;
693 // //========== Booking Histograms
694 // TH2D * hRealEM = new TH2D("hRealEM", "Real for EM particles", 250,0.,1.,40,0.,4.) ;
695 // TH2D * hRealPhot = new TH2D("hRealPhot", "Real for kPhoton particles", 250,0.,1.,40,0.,4.) ;
696 // TH2D * hMixedEM = new TH2D("hMixedEM", "Mixed for EM particles", 250,0.,1.,40,0.,4.) ;
697 // TH2D * hMixedPhot= new TH2D("hMixedPhot","Mixed for kPhoton particles",250,0.,1.,40,0.,4.) ;
700 // Int_t eventInMixedLoop ;
702 // Int_t nRecParticles[4];//knMixedEvents] ;
704 // AliPHOSRecParticle::RecParticlesList * allRecParticleList = new TClonesArray("AliPHOSRecParticle", knMixedEvents*1000) ;
706 // for(eventInMixedLoop = 0; eventInMixedLoop < mixedLoops; eventInMixedLoop++ ){
707 // Int_t iRecPhot = 0 ;
709 // for ( ievent=0; ievent < knMixedEvents; ievent++){
711 // Int_t absEventNumber = eventInMixedLoop*knMixedEvents + ievent ;
713 // //=========== Connects the various Tree's for evt
714 // gAlice->GetEvent(absEventNumber);
716 // //========== Creating branches ===================================
717 // fPHOS->SetTreeAddress() ;
719 // gAlice->TreeD()->GetEvent(0) ;
720 // gAlice->TreeR()->GetEvent(0) ;
722 // TClonesArray * recParticleList = fPHOS->RecParticles() ;
725 // AliPHOSRecParticle * recParticle ;
726 // Int_t iRecParticle ;
727 // for(iRecParticle = 0; iRecParticle < recParticleList->GetEntries() ;iRecParticle++ )
729 // recParticle = (AliPHOSRecParticle *) recParticleList->At(iRecParticle) ;
730 // if((recParticle->GetType() == AliPHOSFastRecParticle::kGAMMA)||
731 // (recParticle->GetType() == AliPHOSFastRecParticle::kNEUTRALEM)){
732 // new( (*allRecParticleList)[iRecPhot] ) AliPHOSRecParticle(*recParticle) ;
737 // nRecParticles[ievent] = iRecPhot-1 ;
740 // //Now calculate invariant mass:
742 // Int_t nCurEvent = 0 ;
744 // for(irp1 = 0; irp1 < allRecParticleList->GetEntries()-1; irp1++){
745 // AliPHOSRecParticle * rp1 = (AliPHOSRecParticle *)allRecParticleList->At(irp1) ;
747 // for(irp2 = irp1+1; irp2 < allRecParticleList->GetEntries(); irp2++){
748 // AliPHOSRecParticle * rp2 = (AliPHOSRecParticle *)allRecParticleList->At(irp2) ;
750 // Double_t invMass ;
751 // invMass = (rp1->Energy()+rp2->Energy())*(rp1->Energy()+rp2->Energy())-
752 // (rp1->Px()+rp2->Px())*(rp1->Px()+rp2->Px())-
753 // (rp1->Py()+rp2->Py())*(rp1->Py()+rp2->Py())-
754 // (rp1->Pz()+rp2->Pz())*(rp1->Pz()+rp2->Pz()) ;
757 // invMass = TMath::Sqrt(invMass);
760 // pt = TMath::Sqrt((rp1->Px()+rp2->Px() )*( rp1->Px()+rp2->Px() ) +(rp1->Py()+rp2->Py())*(rp1->Py()+rp2->Py()));
762 // if(irp1 > nRecParticles[nCurEvent])
765 // if(irp2 <= nRecParticles[nCurEvent]){ //'Real' event
766 // hRealEM->Fill(invMass,pt);
767 // if((rp1->GetType() == AliPHOSFastRecParticle::kGAMMA)&&(rp2->GetType() == AliPHOSFastRecParticle::kGAMMA))
768 // hRealPhot->Fill(invMass,pt);
771 // hMixedEM->Fill(invMass,pt);
772 // if((rp1->GetType() == AliPHOSFastRecParticle::kGAMMA)&&(rp2->GetType() == AliPHOSFastRecParticle::kGAMMA))
773 // hMixedPhot->Fill(invMass,pt);
776 // } //loop over second rp
777 // }//loop over first rp
778 // allRecParticleList->Delete() ;
779 // } //Loop over events
781 // delete allRecParticleList ;
784 // TFile output("invmass.root","RECREATE");
787 // hRealEM->Write() ;
788 // hRealPhot->Write() ;
789 // hMixedEM->Write() ;
790 // hMixedPhot->Write() ;
797 //____________________________________________________________________________
798 void AliPHOSAnalyze::ReadAndPrintEMC(Int_t EvFirst, Int_t EvLast)
801 // // Read and print generated and reconstructed hits in EMC
802 // // for events from EvFirst to Nevent.
803 // // If only EvFirst is defined, print only this one event.
804 // // Author: Yuri Kharlov
805 // // 24 November 2000
808 // if (EvFirst!=0 && EvLast==0) EvLast=EvFirst;
810 // for (ievent=EvFirst; ievent<=EvLast; ievent++) {
812 // //========== Event Number>
813 // cout << endl << "==== ReadAndPrintEMC ====> Event is " << ievent+1 << endl ;
815 // //=========== Connects the various Tree's for evt
816 // Int_t ntracks = gAlice->GetEvent(ievent);
817 // fPHOS->SetTreeAddress() ;
819 // gAlice->TreeD()->GetEvent(0) ;
820 // gAlice->TreeR()->GetEvent(0) ;
822 // // Loop over reconstructed particles
824 // TClonesArray ** recParticleList = fPHOS->RecParticles() ;
825 // AliPHOSRecParticle * recParticle ;
826 // Int_t iRecParticle ;
829 // for(iRecParticle = 0; iRecParticle < (*recParticleList)->GetEntries() ;iRecParticle++ ) {
830 // recParticle = (AliPHOSRecParticle *) (*recParticleList)->At(iRecParticle) ;
831 // Float_t recE = recParticle->Energy();
832 // primList = recParticle->GetPrimaries(nPrimary);
833 // Int_t moduleNumberRec ;
834 // Double_t recX, recZ ;
835 // fGeom->ImpactOnEmc(recParticle->Theta(), recParticle->Phi(), moduleNumberRec, recX, recZ) ;
836 // printf("Rec point: module %d, (X,Z) = (%8.4f,%8.4f) cm, E = %.3f GeV, primary = %d\n",
837 // moduleNumberRec,recX,recZ,recE,*primList);
840 // // Read and print EMC hits from EMCn branches
842 // AliPHOSCPVModule emcModule;
843 // TClonesArray *emcHits;
845 // AliPHOSCPVHit *emcHit;
847 // Float_t xgen, zgen;
848 // Int_t ipart, primary;
849 // Int_t nGenHits = 0;
850 // for (Int_t itrack=0; itrack<ntracks; itrack++) {
851 // //=========== Get the Hits Tree for the Primary track itrack
852 // gAlice->ResetHits();
853 // gAlice->TreeH()->GetEvent(itrack);
854 // Int_t iModule = 0 ;
855 // for (iModule=0; iModule < fGeom->GetNModules(); iModule++) {
856 // emcModule = fPHOS->GetEMCModule(iModule);
857 // emcHits = emcModule.Hits();
858 // nEMChits = emcHits->GetEntriesFast();
859 // for (Int_t ihit=0; ihit<nEMChits; ihit++) {
861 // emcHit = (AliPHOSCPVHit*)emcHits->UncheckedAt(ihit);
862 // p = emcHit->GetMomentum();
863 // xgen = emcHit->X();
864 // zgen = emcHit->Y();
865 // ipart = emcHit->GetIpart();
866 // primary= emcHit->GetTrack();
867 // printf("EMC hit A: module %d, ",iModule+1);
868 // printf(" p = (%f .4, %f .4, %f .4, %f .4) GeV,\n",
869 // p.Px(),p.Py(),p.Pz(),p.Energy());
870 // printf(" (X,Z) = (%8.4f, %8.4f) cm, ipart = %d, primary = %d\n",
871 // xgen,zgen,ipart,primary);
876 // // // Read and print EMC hits from PHOS branch
878 // // for (Int_t itrack=0; itrack<ntracks; itrack++) {
879 // // //=========== Get the Hits Tree for the Primary track itrack
880 // // gAlice->ResetHits();
881 // // gAlice->TreeH()->GetEvent(itrack);
882 // // TClonesArray *hits = fPHOS->Hits();
883 // // AliPHOSHit *hit ;
885 // // for ( ihit = 0 ; ihit < hits->GetEntries() ; ihit++ ) {
886 // // hit = (AliPHOSHit*)hits->At(ihit) ;
887 // // Float_t hitXYZ[3];
888 // // hitXYZ[0] = hit->X();
889 // // hitXYZ[1] = hit->Y();
890 // // hitXYZ[2] = hit->Z();
891 // // ipart = hit->GetPid();
892 // // primary = hit->GetPrimary();
893 // // Int_t absId = hit->GetId();
894 // // Int_t relId[4];
895 // // fGeom->AbsToRelNumbering(absId, relId) ;
896 // // Int_t module = relId[0];
897 // // if (relId[1]==0 && !(hitXYZ[0]==0 && hitXYZ[2]==0))
898 // // printf("EMC hit B: module %d, (X,Z) = (%8.4f, %8.4f) cm, ipart = %d, primary = %d\n",
899 // // module,hitXYZ[0],hitXYZ[2],ipart,primary);
906 //____________________________________________________________________________
907 void AliPHOSAnalyze::AnalyzeEMC(Int_t Nevents)
910 // // Read generated and reconstructed hits in EMC for Nevents events.
911 // // Plots the coordinate and energy resolution histograms.
912 // // Coordinate resolution is a difference between the reconstructed
913 // // coordinate and the exact coordinate on the face of the PHOS
914 // // Author: Yuri Kharlov
915 // // 27 November 2000
918 // // Book histograms
920 // TH1F *hDx1 = new TH1F("hDx1" ,"EMC x-resolution", 100,-5. , 5.);
921 // TH1F *hDz1 = new TH1F("hDz1" ,"EMC z-resolution", 100,-5. , 5.);
922 // TH1F *hDE1 = new TH1F("hDE1" ,"EMC E-resolution", 100,-2. , 2.);
924 // TH2F *hDx2 = new TH2F("hDx2" ,"EMC x-resolution", 100, 0., 10., 100,-5. , 5.);
925 // TH2F *hDz2 = new TH2F("hDz2" ,"EMC z-resolution", 100, 0., 10., 100,-5. , 5.);
926 // TH2F *hDE2 = new TH2F("hDE2" ,"EMC E-resolution", 100, 0., 10., 100, 0. , 5.);
928 // cout << "Start EMC Analysis"<< endl ;
929 // for (Int_t ievent=0; ievent<Nevents; ievent++) {
931 // //========== Event Number>
932 // if ( (ievent+1) % (Int_t)TMath::Power( 10, (Int_t)TMath::Log10(ievent+1) ) == 0)
933 // cout << "==== AnalyzeEMC ====> Event is " << ievent+1 << endl ;
935 // //=========== Connects the various Tree's for evt
936 // Int_t ntracks = gAlice->GetEvent(ievent);
938 // fPHOS->SetTreeAddress() ;
940 // gAlice->TreeD()->GetEvent(0) ;
941 // gAlice->TreeR()->GetEvent(0) ;
943 // // Create and fill arrays of hits for each EMC module
945 // Int_t nOfModules = fGeom->GetNModules();
946 // TClonesArray **hitsPerModule = new TClonesArray *[nOfModules];
948 // for (iModule=0; iModule < nOfModules; iModule++)
949 // hitsPerModule[iModule] = new TClonesArray("AliPHOSCPVHit",100);
951 // AliPHOSCPVModule emcModule;
952 // TClonesArray *emcHits;
954 // AliPHOSCPVHit *emcHit;
956 // // First go through all primary tracks and fill the arrays
957 // // of hits per each EMC module
959 // for (Int_t itrack=0; itrack<ntracks; itrack++) {
960 // // Get the Hits Tree for the Primary track itrack
961 // gAlice->ResetHits();
962 // gAlice->TreeH()->GetEvent(itrack);
963 // for (Int_t iModule=0; iModule < nOfModules; iModule++) {
964 // emcModule = fPHOS->GetEMCModule(iModule);
965 // emcHits = emcModule.Hits();
966 // nEMChits = emcHits->GetEntriesFast();
967 // for (Int_t ihit=0; ihit<nEMChits; ihit++) {
968 // emcHit = (AliPHOSCPVHit*)emcHits->UncheckedAt(ihit);
969 // TClonesArray &lhits = *(TClonesArray *)hitsPerModule[iModule];
970 // new(lhits[hitsPerModule[iModule]->GetEntriesFast()]) AliPHOSCPVHit(*emcHit);
972 // emcModule.Clear();
976 // // Loop over reconstructed particles
978 // TClonesArray ** recParticleList = fPHOS->RecParticles() ;
979 // AliPHOSRecParticle * recParticle ;
980 // Int_t nEMCrecs = (*recParticleList)->GetEntries();
981 // if (nEMCrecs == 1) {
982 // recParticle = (AliPHOSRecParticle *) (*recParticleList)->At(0) ;
983 // Float_t recE = recParticle->Energy();
985 // Double_t recX, recZ ;
986 // fGeom->ImpactOnEmc(recParticle->Theta(), recParticle->Phi(), phosModule, recX, recZ) ;
988 // // for this rec.point take the hit list in the same PHOS module
990 // emcHits = hitsPerModule[phosModule-1];
991 // Int_t nEMChits = emcHits->GetEntriesFast();
992 // if (nEMChits == 1) {
993 // Float_t genX, genZ, genE;
994 // for (Int_t ihit=0; ihit<nEMChits; ihit++) {
995 // emcHit = (AliPHOSCPVHit*)emcHits->UncheckedAt(ihit);
996 // genX = emcHit->X();
997 // genZ = emcHit->Y();
998 // genE = emcHit->GetMomentum().E();
1000 // Float_t dx = recX - genX;
1001 // Float_t dz = recZ - genZ;
1002 // Float_t de = recE - genE;
1006 // hDx2 ->Fill(genE,dx);
1007 // hDz2 ->Fill(genE,dz);
1008 // hDE2 ->Fill(genE,recE);
1011 // delete [] hitsPerModule;
1013 // // Save histograms
1015 // Text_t outputname[80] ;
1016 // sprintf(outputname,"%s.analyzed",fRootFile->GetName());
1017 // TFile output(outputname,"RECREATE");
1027 // // Plot histograms
1029 // TCanvas *emcCanvas = new TCanvas("EMC","EMC analysis",20,20,700,300);
1030 // gStyle->SetOptStat(111111);
1031 // gStyle->SetOptFit(1);
1032 // gStyle->SetOptDate(1);
1033 // emcCanvas->Divide(3,1);
1035 // emcCanvas->cd(1);
1036 // gPad->SetFillColor(10);
1037 // hDx1->SetFillColor(16);
1040 // emcCanvas->cd(2);
1041 // gPad->SetFillColor(10);
1042 // hDz1->SetFillColor(16);
1045 // emcCanvas->cd(3);
1046 // gPad->SetFillColor(10);
1047 // hDE1->SetFillColor(16);
1050 // emcCanvas->Print("EMC.ps");
1054 //____________________________________________________________________________
1055 void AliPHOSAnalyze::AnalyzeResolutions(Int_t Nevents )
1057 // // analyzes Nevents events and calculate Energy and Position resolution as well as
1058 // // probaility of correct indentifiing of the incident particle
1060 // //========== Booking Histograms
1061 // cout << "AnalyzeResolutions > " << "Booking Histograms" << endl ;
1062 // BookResolutionHistograms();
1064 // Int_t counter[9][5] ;
1065 // Int_t i1,i2,totalInd = 0 ;
1066 // for(i1 = 0; i1<9; i1++)
1067 // for(i2 = 0; i2<5; i2++)
1068 // counter[i1][i2] = 0 ;
1070 // Int_t totalPrimary = 0 ;
1071 // Int_t totalRecPart = 0 ;
1072 // Int_t totalRPwithPrim = 0 ;
1075 // cout << "Start Analysing"<< endl ;
1076 // for ( ievent=0; ievent<Nevents; ievent++)
1079 // //========== Event Number>
1080 // // if ( ( log10((Float_t)(ievent+1)) - (Int_t)(log10((Float_t)(ievent+1))) ) == 0. )
1081 // cout << "AnalyzeResolutions > " << "Event is " << ievent << endl ;
1083 // //=========== Connects the various Tree's for evt
1084 // gAlice->GetEvent(ievent);
1086 // //=========== Gets the Kine TTree
1087 // gAlice->TreeK()->GetEvent(0) ;
1089 // //=========== Gets the list of Primari Particles
1091 // TParticle * primary ;
1093 // for ( iPrimary = 0 ; iPrimary < gAlice->GetNtrack() ; iPrimary++)
1095 // primary = gAlice->Particle(iPrimary) ;
1096 // Int_t primaryType = primary->GetPdgCode() ;
1097 // if( primaryType == 22 ) {
1098 // Int_t moduleNumber ;
1099 // Double_t primX, primZ ;
1100 // fGeom->ImpactOnEmc(primary->Theta(), primary->Phi(), moduleNumber, primX, primZ) ;
1101 // if(moduleNumber){
1102 // fhPrimary->Fill(primary->Energy()) ;
1103 // if(primary->Energy() > 0.3)
1109 // fPHOS->SetTreeAddress() ;
1111 // gAlice->TreeD()->GetEvent(0) ;
1112 // gAlice->TreeR()->GetEvent(0) ;
1114 // TClonesArray * recParticleList = fPHOS->RecParticles() ;
1116 // AliPHOSRecParticle * recParticle ;
1117 // Int_t iRecParticle ;
1118 // for(iRecParticle = 0; iRecParticle < recParticleList->GetEntries() ;iRecParticle++ )
1120 // recParticle = (AliPHOSRecParticle *) recParticleList->At(iRecParticle) ;
1121 // fhAllRP->Fill(CorrectEnergy(recParticle->Energy())) ;
1123 // Int_t moduleNumberRec ;
1124 // Double_t recX, recZ ;
1125 // fGeom->ImpactOnEmc(recParticle->Theta(), recParticle->Phi(), moduleNumberRec, recX, recZ) ;
1127 // Double_t minDistance = 100. ;
1128 // Int_t closestPrimary = -1 ;
1130 // Int_t numberofprimaries ;
1131 // Int_t * listofprimaries = recParticle->GetPrimaries(numberofprimaries) ;
1133 // TParticle * primary ;
1134 // Double_t distance = minDistance ;
1136 // Double_t dXmin = 0.;
1137 // Double_t dZmin = 0. ;
1138 // for ( index = 0 ; index < numberofprimaries ; index++){
1139 // primary = gAlice->Particle(listofprimaries[index]) ;
1140 // Int_t moduleNumber ;
1141 // Double_t primX, primZ ;
1142 // fGeom->ImpactOnEmc(primary->Theta(), primary->Phi(), moduleNumber, primX, primZ) ;
1143 // if(moduleNumberRec == moduleNumber) {
1144 // dX = recX - primX;
1145 // dZ = recZ - primZ;
1146 // distance = TMath::Sqrt(dX*dX + dZ*dZ) ;
1147 // if(minDistance > distance) {
1148 // minDistance = distance ;
1151 // closestPrimary = listofprimaries[index] ;
1157 // if(closestPrimary >=0 ){
1158 // totalRPwithPrim++;
1160 // Int_t primaryType = gAlice->Particle(closestPrimary)->GetPdgCode() ;
1161 // // TParticlePDG* pDGparticle = gAlice->ParticleAt(closestPrimary)->GetPDG();
1162 // // Double_t charge = PDGparticle->Charge() ;
1164 // // cout <<"Primary " <<primaryType << " E " << ((TParticle *)primaryList->At(closestPrimary))->Energy() << endl ;
1165 // Int_t primaryCode ;
1166 // switch(primaryType)
1169 // primaryCode = 0; //Photon
1170 // fhAllEnergy ->Fill(gAlice->Particle(closestPrimary)->Energy(), recParticle->Energy()) ;
1171 // fhAllPosition ->Fill(gAlice->Particle(closestPrimary)->Energy(), minDistance) ;
1172 // fhAllPositionX->Fill(dXmin);
1173 // fhAllPositionZ->Fill(dZmin);
1176 // primaryCode = 1; //Electron
1179 // primaryCode = 1; //positron
1182 // primaryCode = 4; //K+
1185 // primaryCode = 4; //K-
1188 // primaryCode = 4; //K0s
1191 // primaryCode = 4; //K0l
1194 // primaryCode = 2; //K0l
1197 // primaryCode = 2; //K0l
1200 // primaryCode = 2; //K0l
1203 // primaryCode = 2; //K0l
1206 // primaryCode = 3; //ELSE
1210 // switch(recParticle->GetType())
1212 // case AliPHOSFastRecParticle::kGAMMA:
1213 // if(primaryType == 22){
1214 // fhPhotEnergy->Fill(gAlice->Particle(closestPrimary)->Energy(), recParticle->Energy() ) ;
1215 // fhEMEnergy->Fill(gAlice->Particle(closestPrimary)->Energy(), recParticle->Energy() ) ;
1216 // fhPPSDEnergy->Fill(gAlice->Particle(closestPrimary)->Energy(), recParticle->Energy() ) ;
1218 // fhPhotPosition->Fill(gAlice->Particle(closestPrimary)->Energy(),minDistance) ;
1219 // fhEMPosition->Fill(gAlice->Particle(closestPrimary)->Energy(),minDistance) ;
1220 // fhPPSDPosition->Fill(gAlice->Particle(closestPrimary)->Energy(),minDistance) ;
1222 // fhPhotReg->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1223 // fhPhotEM->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1224 // fhPhotPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1226 // fhPhotPhot->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1228 // if(primaryType == 2112){ //neutron
1229 // fhNReg->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1230 // fhNEM->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1231 // fhNPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1234 // if(primaryType == -2112){ //neutron ~
1235 // fhNBarReg->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1236 // fhNBarEM->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1237 // fhNBarPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1240 // if(primaryCode == 2){
1241 // fhChargedReg->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1242 // fhChargedEM->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1243 // fhChargedPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1246 // fhAllReg->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1247 // fhAllEM->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1248 // fhAllPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1249 // fhShape->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1250 // fhVeto->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1251 // fhPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1252 // counter[0][primaryCode]++;
1254 // case AliPHOSFastRecParticle::kELECTRON:
1255 // if(primaryType == 22){
1256 // fhPhotElec->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1257 // fhEMEnergy->Fill(gAlice->Particle(closestPrimary)->Energy(), recParticle->Energy() ) ;
1258 // fhEMPosition->Fill(gAlice->Particle(closestPrimary)->Energy(),minDistance) ;
1259 // fhPhotEM->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1260 // fhPhotPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1262 // if(primaryType == 2112){ //neutron
1263 // fhNEM->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1264 // fhNPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1267 // if(primaryType == -2112){ //neutron ~
1268 // fhNBarEM->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1269 // fhNBarPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1272 // if(primaryCode == 2){
1273 // fhChargedEM->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1274 // fhChargedPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1277 // fhAllEM->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1278 // fhAllPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1279 // fhShape->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1280 // fhPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1281 // counter[1][primaryCode]++;
1283 // case AliPHOSFastRecParticle::kNEUTRALHA:
1284 // if(primaryType == 22)
1285 // fhPhotNeuH->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1287 // fhVeto->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1288 // counter[2][primaryCode]++;
1290 // case AliPHOSFastRecParticle::kNEUTRALEM:
1291 // if(primaryType == 22){
1292 // fhEMEnergy->Fill(gAlice->Particle(closestPrimary)->Energy(),recParticle->Energy() ) ;
1293 // fhEMPosition->Fill(gAlice->Particle(closestPrimary)->Energy(),minDistance ) ;
1295 // fhPhotNuEM->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1296 // fhPhotEM->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1298 // if(primaryType == 2112) //neutron
1299 // fhNEM->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1301 // if(primaryType == -2112) //neutron ~
1302 // fhNBarEM->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1304 // if(primaryCode == 2)
1305 // fhChargedEM->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1307 // fhAllEM->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1308 // fhShape->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1309 // fhVeto->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1311 // counter[3][primaryCode]++;
1313 // case AliPHOSFastRecParticle::kCHARGEDHA:
1314 // if(primaryType == 22) //photon
1315 // fhPhotChHa->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1317 // counter[4][primaryCode]++ ;
1319 // case AliPHOSFastRecParticle::kGAMMAHA:
1320 // if(primaryType == 22){ //photon
1321 // fhPhotGaHa->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1322 // fhPPSDEnergy->Fill(gAlice->Particle(closestPrimary)->Energy(), recParticle->Energy() ) ;
1323 // fhPPSDPosition->Fill(gAlice->Particle(closestPrimary)->Energy(),minDistance) ;
1324 // fhPhotPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1326 // if(primaryType == 2112){ //neutron
1327 // fhNPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1330 // if(primaryType == -2112){ //neutron ~
1331 // fhNBarPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1333 // if(primaryCode == 2){
1334 // fhChargedPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1337 // fhAllPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1338 // fhVeto->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1339 // fhPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1340 // counter[5][primaryCode]++ ;
1342 // case AliPHOSFastRecParticle::kABSURDEM:
1343 // counter[6][primaryCode]++ ;
1344 // fhShape->Fill(CorrectEnergy(recParticle->Energy()) ) ;
1346 // case AliPHOSFastRecParticle::kABSURDHA:
1347 // counter[7][primaryCode]++ ;
1350 // counter[8][primaryCode]++ ;
1356 // SaveHistograms();
1357 // cout << "Resolutions: Analyzed " << Nevents << " event(s)" << endl ;
1358 // cout << "Resolutions: Total primary " << totalPrimary << endl ;
1359 // cout << "Resoluitons: Total reconstracted " << totalRecPart << endl ;
1360 // cout << "TotalReconstructed with Primarie " << totalRPwithPrim << endl ;
1361 // cout << " Primary: Photon Electron Ch. Hadr. Neutr. Hadr Kaons" << endl ;
1362 // cout << " Detected as photon " << counter[0][0] << " " << counter[0][1] << " " << counter[0][2] << " " <<counter[0][3] << " " << counter[0][4] << endl ;
1363 // cout << " Detected as electron " << counter[1][0] << " " << counter[1][1] << " " << counter[1][2] << " " <<counter[1][3] << " " << counter[1][4] << endl ;
1364 // cout << " Detected as neutral hadron " << counter[2][0] << " " << counter[2][1] << " " << counter[2][2] << " " <<counter[2][3] << " " << counter[2][4] << endl ;
1365 // cout << " Detected as neutral EM " << counter[3][0] << " " << counter[3][1] << " " << counter[3][2] << " " <<counter[3][3] << " " << counter[3][4] << endl ;
1366 // cout << " Detected as charged hadron " << counter[4][0] << " " << counter[4][1] << " " << counter[4][2] << " " <<counter[4][3] << " " << counter[4][4] << endl ;
1367 // cout << " Detected as gamma-hadron " << counter[5][0] << " " << counter[5][1] << " " << counter[5][2] << " " <<counter[5][3] << " " << counter[5][4] << endl ;
1368 // cout << " Detected as Absurd EM " << counter[6][0] << " " << counter[6][1] << " " << counter[6][2] << " " <<counter[6][3] << " " << counter[6][4] << endl ;
1369 // cout << " Detected as absurd hadron " << counter[7][0] << " " << counter[7][1] << " " << counter[7][2] << " " <<counter[7][3] << " " << counter[7][4] << endl ;
1370 // cout << " Detected as undefined " << counter[8][0] << " " << counter[8][1] << " " << counter[8][2] << " " <<counter[8][3] << " " << counter[8][4] << endl ;
1372 // for(i1 = 0; i1<9; i1++)
1373 // for(i2 = 0; i2<5; i2++)
1374 // totalInd+=counter[i1][i2] ;
1375 // cout << "Indentified particles " << totalInd << endl ;
1380 //____________________________________________________________________________
1381 void AliPHOSAnalyze::BookingHistograms()
1383 // Books the histograms where the results of the analysis are stored (to be changed)
1386 delete fhVetoDigit ;
1387 delete fhConvertorDigit ;
1388 delete fhEmcCluster ;
1389 delete fhVetoCluster ;
1390 delete fhConvertorCluster ;
1391 delete fhConvertorEmc ;
1393 fhEmcDigit = new TH1F("hEmcDigit", "hEmcDigit", 1000, 0. , 25.);
1394 fhVetoDigit = new TH1F("hVetoDigit", "hVetoDigit", 500, 0. , 3.e-5);
1395 fhConvertorDigit = new TH1F("hConvertorDigit","hConvertorDigit", 500, 0. , 3.e-5);
1396 fhEmcCluster = new TH1F("hEmcCluster", "hEmcCluster", 1000, 0. , 30.);
1397 fhVetoCluster = new TH1F("hVetoCluster", "hVetoCluster", 500, 0. , 3.e-5);
1398 fhConvertorCluster = new TH1F("hConvertorCluster","hConvertorCluster",500, 0. , 3.e-5);
1399 fhConvertorEmc = new TH2F("hConvertorEmc", "hConvertorEmc", 200, 1. , 3., 200, 0., 3.e-5);
1402 //____________________________________________________________________________
1403 void AliPHOSAnalyze::BookResolutionHistograms()
1405 // Books the histograms where the results of the Resolution analysis are stored
1408 // delete fhAllEnergy ;
1410 // delete fhPhotEnergy ;
1412 // delete fhEMEnergy ;
1414 // delete fhPPSDEnergy ;
1417 fhAllEnergy = new TH2F("hAllEnergy", "Energy of any RP with primary photon",100, 0., 5., 100, 0., 5.);
1418 fhPhotEnergy = new TH2F("hPhotEnergy", "Energy of kGAMMA with primary photon",100, 0., 5., 100, 0., 5.);
1419 fhEMEnergy = new TH2F("hEMEnergy", "Energy of EM with primary photon", 100, 0., 5., 100, 0., 5.);
1420 fhPPSDEnergy = new TH2F("hPPSDEnergy", "Energy of PPSD with primary photon", 100, 0., 5., 100, 0., 5.);
1422 // if(fhAllPosition)
1423 // delete fhAllPosition ;
1424 // if(fhPhotPosition)
1425 // delete fhPhotPosition ;
1427 // delete fhEMPosition ;
1428 // if(fhPPSDPosition)
1429 // delete fhPPSDPosition ;
1432 fhAllPosition = new TH2F("hAllPosition", "Position of any RP with primary photon",100, 0., 5., 100, 0., 5.);
1433 fhPhotPosition = new TH2F("hPhotPosition", "Position of kGAMMA with primary photon",100, 0., 5., 100, 0., 5.);
1434 fhEMPosition = new TH2F("hEMPosition", "Position of EM with primary photon", 100, 0., 5., 100, 0., 5.);
1435 fhPPSDPosition = new TH2F("hPPSDPosition", "Position of PPSD with primary photon", 100, 0., 5., 100, 0., 5.);
1437 fhAllPositionX = new TH1F("hAllPositionX", "#Delta X of any RP with primary photon",100, -2., 2.);
1438 fhAllPositionZ = new TH1F("hAllPositionZ", "#Delta X of any RP with primary photon",100, -2., 2.);
1441 // delete fhAllReg ;
1443 // delete fhPhotReg ;
1447 // delete fhNBarReg ;
1449 // delete fhChargedReg ;
1451 fhAllReg = new TH1F("hAllReg", "All primaries registered as photon", 100, 0., 5.);
1452 fhPhotReg = new TH1F("hPhotReg", "Photon registered as photon", 100, 0., 5.);
1453 fhNReg = new TH1F("hNReg", "N registered as photon", 100, 0., 5.);
1454 fhNBarReg = new TH1F("hNBarReg", "NBar registered as photon", 100, 0., 5.);
1455 fhChargedReg= new TH1F("hChargedReg", "Charged hadron registered as photon",100, 0., 5.);
1460 // delete fhPhotEM ;
1464 // delete fhNBarEM ;
1466 // delete fhChargedEM ;
1468 fhAllEM = new TH1F("hAllEM", "All primary registered as EM",100, 0., 5.);
1469 fhPhotEM = new TH1F("hPhotEM", "Photon registered as EM", 100, 0., 5.);
1470 fhNEM = new TH1F("hNEM", "N registered as EM", 100, 0., 5.);
1471 fhNBarEM = new TH1F("hNBarEM", "NBar registered as EM", 100, 0., 5.);
1472 fhChargedEM= new TH1F("hChargedEM","Charged registered as EM",100, 0., 5.);
1475 // delete fhAllPPSD ;
1477 // delete fhPhotPPSD ;
1481 // delete fhNBarPPSD ;
1482 // if(fhChargedPPSD)
1483 // delete fhChargedPPSD ;
1485 fhAllPPSD = new TH1F("hAllPPSD", "All primary registered as PPSD",100, 0., 5.);
1486 fhPhotPPSD = new TH1F("hPhotPPSD", "Photon registered as PPSD", 100, 0., 5.);
1487 fhNPPSD = new TH1F("hNPPSD", "N registered as PPSD", 100, 0., 5.);
1488 fhNBarPPSD = new TH1F("hNBarPPSD", "NBar registered as PPSD", 100, 0., 5.);
1489 fhChargedPPSD= new TH1F("hChargedPPSD","Charged registered as PPSD",100, 0., 5.);
1492 // delete fhPrimary ;
1493 fhPrimary= new TH1F("hPrimary", "hPrimary", 100, 0., 5.);
1504 fhAllRP = new TH1F("hAllRP","All Reconstructed particles", 100, 0., 5.);
1505 fhVeto = new TH1F("hVeto", "All uncharged particles", 100, 0., 5.);
1506 fhShape = new TH1F("hShape","All particles with EM shaower",100, 0., 5.);
1507 fhPPSD = new TH1F("hPPSD", "All PPSD photon particles", 100, 0., 5.);
1511 // delete fhPhotPhot ;
1513 // delete fhPhotElec ;
1515 // delete fhPhotNeuH ;
1517 // delete fhPhotNuEM ;
1519 // delete fhPhotChHa ;
1521 // delete fhPhotGaHa ;
1523 fhPhotPhot = new TH1F("hPhotPhot","hPhotPhot", 100, 0., 5.); //Photon registered as photon
1524 fhPhotElec = new TH1F("hPhotElec","hPhotElec", 100, 0., 5.); //Photon registered as Electron
1525 fhPhotNeuH = new TH1F("hPhotNeuH","hPhotNeuH", 100, 0., 5.); //Photon registered as Neutral Hadron
1526 fhPhotNuEM = new TH1F("hPhotNuEM","hPhotNuEM", 100, 0., 5.); //Photon registered as Neutral EM
1527 fhPhotChHa = new TH1F("hPhotChHa","hPhotChHa", 100, 0., 5.); //Photon registered as Charged Hadron
1528 fhPhotGaHa = new TH1F("hPhotGaHa","hPhotGaHa", 100, 0., 5.); //Photon registered as Gamma-Hadron
1531 //____________________________________________________________________________
1532 Bool_t AliPHOSAnalyze::OpenRootFile(Text_t * name)
1534 // Open the root file named "name"
1536 fRootFile = new TFile(name, "update") ;
1537 return fRootFile->IsOpen() ;
1540 //____________________________________________________________________________
1541 void AliPHOSAnalyze::SaveHistograms()
1543 // Saves the histograms in a root file named "name.analyzed"
1545 Text_t outputname[80] ;
1546 sprintf(outputname,"%s.analyzed",fRootFile->GetName());
1547 TFile output(outputname,"RECREATE");
1551 fhAllEnergy->Write() ;
1553 fhPhotEnergy->Write() ;
1555 fhEMEnergy->Write() ;
1557 fhPPSDEnergy->Write() ;
1559 fhAllPosition->Write() ;
1561 fhAllPositionX->Write() ;
1563 fhAllPositionZ->Write() ;
1565 fhPhotPosition->Write() ;
1567 fhEMPosition->Write() ;
1569 fhPPSDPosition->Write() ;
1573 fhPhotReg->Write() ;
1577 fhNBarReg->Write() ;
1579 fhChargedReg->Write() ;
1589 fhChargedEM->Write() ;
1591 fhAllPPSD->Write() ;
1593 fhPhotPPSD->Write() ;
1597 fhNBarPPSD->Write() ;
1599 fhChargedPPSD->Write() ;
1601 fhPrimary->Write() ;
1611 fhPhotPhot->Write() ;
1613 fhPhotElec->Write() ;
1615 fhPhotNeuH->Write() ;
1617 fhPhotNuEM->Write() ;
1619 fhPhotNuEM->Write() ;
1621 fhPhotChHa->Write() ;
1623 fhPhotGaHa->Write() ;
1624 if(fhEnergyCorrelations)
1625 fhEnergyCorrelations->Write() ;
1630 //____________________________________________________________________________
1631 Float_t AliPHOSAnalyze::CorrectEnergy(Float_t ERecPart)
1633 return ERecPart/0.8783 ;
1636 //____________________________________________________________________________
1637 void AliPHOSAnalyze::ResetHistograms()
1639 fhEnergyCorrelations = 0 ; //Energy correlations between Eloss in Convertor and PPSD(2)
1641 fhEmcDigit = 0 ; // Histo of digit energies in the Emc
1642 fhVetoDigit = 0 ; // Histo of digit energies in the Veto
1643 fhConvertorDigit = 0 ; // Histo of digit energies in the Convertor
1644 fhEmcCluster = 0 ; // Histo of Cluster energies in Emc
1645 fhVetoCluster = 0 ; // Histo of Cluster energies in Veto
1646 fhConvertorCluster = 0 ; // Histo of Cluster energies in Convertor
1647 fhConvertorEmc = 0 ; // 2d Convertor versus Emc energies
1650 fhPhotEnergy = 0 ; // Total spectrum of detected photons
1651 fhEMEnergy = 0 ; // Spectrum of detected electrons with electron primary
1654 fhAllPositionX = 0 ;
1655 fhAllPositionZ = 0 ;
1656 fhPhotPosition = 0 ;
1658 fhPPSDPosition = 0 ;