]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/AliPHOSReconstructor.cxx
Added Debug options to control verbosity
[u/mrichter/AliRoot.git] / PHOS / AliPHOSReconstructor.cxx
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 /* $Id$ */
17
18 //_________________________________________________________________________
19 //*--
20 //*-- Yves Schutz (SUBATECH) 
21 // Reconstruction class. Redesigned from the old AliReconstructionner class and 
22 // derived from STEER/AliReconstructor. 
23 // 
24 // --- ROOT system ---
25
26 // --- Standard library ---
27
28 // --- AliRoot header files ---
29 #include "AliESD.h"
30 #include "AliPHOSReconstructor.h"
31 #include "AliPHOSClusterizerv1.h"
32 #include "AliPHOSTrackSegmentMakerv1.h"
33 #include "AliPHOSPIDv1.h"
34 #include "AliPHOSGetter.h"
35
36  
37 ClassImp(AliPHOSReconstructor)
38
39 Bool_t AliPHOSReconstructor::fgDebug = kFALSE ; 
40
41 //____________________________________________________________________________
42   AliPHOSReconstructor::AliPHOSReconstructor() 
43 {
44   // ctor
45
46
47
48 //____________________________________________________________________________
49   AliPHOSReconstructor::~AliPHOSReconstructor()
50 {
51   // dtor
52
53
54
55 //____________________________________________________________________________
56 void AliPHOSReconstructor::Reconstruct(AliRunLoader* runLoader) const 
57 {
58   // method called by AliReconstruction; 
59   // Only the clusterization is performed,; the rest of the reconstruction is done in FillESD because the track
60   // segment maker needs access to the AliESD object to retrieve the tracks reconstructed by 
61   // the global tracking.
62  
63   TString headerFile(runLoader->GetFileName()) ; 
64   TString branchName(runLoader->GetEventFolder()->GetName()) ;  
65   
66   AliPHOSClusterizerv1 clu(headerFile, branchName);
67   clu.SetEventRange(0, -1) ; // do all the events
68   if ( Debug() ) 
69     clu.ExecuteTask("deb all") ; 
70   else 
71     clu.ExecuteTask("") ;  
72
73 }
74
75 //____________________________________________________________________________
76 void AliPHOSReconstructor::FillESD(AliRunLoader* runLoader, AliESD* esd) const
77 {
78   // Called by AliReconstruct after Reconstruct() and global tracking and vertxing 
79   //Creates the tracksegments and Recparticles
80   
81   Int_t eventNumber = runLoader->GetEventNumber() ;
82
83   TString headerFile(runLoader->GetFileName()) ; 
84   TString branchName(runLoader->GetEventFolder()->GetName()) ;  
85
86   AliPHOSTrackSegmentMakerv1 tsm(headerFile, branchName);
87   tsm.SetESD(esd) ; 
88   AliPHOSPIDv1 pid(headerFile, branchName);
89
90   // do current event; the loop over events is done by AliReconstruction::Run()
91   tsm.SetEventRange(eventNumber, eventNumber) ; 
92   pid.SetEventRange(eventNumber, eventNumber) ; 
93   if ( Debug() ) {
94    tsm.ExecuteTask("deb all") ;
95    pid.ExecuteTask("deb all") ;
96   }
97   else {
98     tsm.ExecuteTask("") ;
99     pid.ExecuteTask("") ;
100   }
101   
102   // Creates AliESDtrack from AliPHOSRecParticles 
103   AliPHOSGetter::Instance()->Event(eventNumber, "P") ; 
104   TClonesArray *recParticles = AliPHOSGetter::Instance()->RecParticles();
105   Int_t nOfRecParticles = recParticles->GetEntries();
106   esd->SetNumberOfPHOSParticles(nOfRecParticles) ; 
107   esd->SetFirstPHOSParticle(esd->GetNumberOfTracks()) ; 
108
109   for (Int_t recpart = 0 ; recpart < nOfRecParticles ; recpart++) {
110     AliPHOSRecParticle * rp = dynamic_cast<AliPHOSRecParticle*>(recParticles->At(recpart));
111     if (Debug()) 
112       rp->Print();
113     AliESDtrack * et = new AliESDtrack() ; 
114     // fills the ESDtrack
115     Double_t xyz[3];
116     for (Int_t ixyz=0; ixyz<3; ixyz++) 
117       xyz[ixyz] = rp->GetPos()[ixyz];
118     et->SetPHOSposition(xyz) ; 
119     et->SetPHOSsignal  (rp->Energy()) ; 
120     et->SetPHOSpid     (rp->GetPID()) ;
121     // add the track to the esd object
122     esd->AddTrack(et);
123     delete et;
124   }
125 }