]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/AliPHOSReconstructor.cxx
Renove the clusterizer after Reconstruct. Use as much the runloader instead of the...
[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 //____________________________________________________________________________
40   AliPHOSReconstructor::AliPHOSReconstructor() : fDebug(kFALSE) 
41 {
42   // ctor
43
44
45
46 //____________________________________________________________________________
47   AliPHOSReconstructor::~AliPHOSReconstructor()
48 {
49   // dtor
50
51
52
53 //____________________________________________________________________________
54 void AliPHOSReconstructor::Reconstruct(AliRunLoader* runLoader) const 
55 {
56   // method called by AliReconstruction; 
57   // Only the clusterization is performed,; the rest of the reconstruction is done in FillESD because the track
58   // segment maker needs access to the AliESD object to retrieve the tracks reconstructed by 
59   // the global tracking.
60  
61   TString headerFile(runLoader->GetFileName()) ; 
62   TString branchName("Default") ;  
63   
64   AliPHOSClusterizerv1 clu(headerFile, branchName);
65   clu.SetEventRange(0, -1) ; // do all the events
66   if ( Debug() ) 
67     clu.ExecuteTask("deb all") ; 
68   else 
69     clu.ExecuteTask("") ;  
70
71   AliPHOSGetter::Instance()->PhosLoader()->CleanReconstructioner();
72 }
73
74 //____________________________________________________________________________
75 void AliPHOSReconstructor::FillESD(AliRunLoader* runLoader, AliESD* esd) const
76 {
77   // Called by AliReconstruct after Reconstruct() and global tracking and vertxing 
78   //Creates the tracksegments and Recparticles
79   
80   TString headerFile(runLoader->GetFileName()) ; 
81   TString branchName("Default") ;  
82
83   AliPHOSTrackSegmentMakerv1 tsm(headerFile, branchName);
84   AliPHOSPIDv1 pid(headerFile, branchName);
85
86   //  AliPHOSGetter *gime = AliPHOSGetter::Instance() ;
87   Int_t eventNumber = runLoader->GetEventNumber() ;
88   // do current event; the loop over events is done by AliReconstruction::Run()
89   Info("FillESD 1", "%d", eventNumber) ;
90   tsm.SetEventRange(eventNumber, eventNumber) ; 
91   pid.SetEventRange(eventNumber, eventNumber) ; 
92   if ( Debug() ) {
93    tsm.ExecuteTask("deb all") ;
94    pid.ExecuteTask("deb all") ;
95   }
96   else {
97     tsm.ExecuteTask("") ;
98     pid.ExecuteTask("") ;
99   }
100   
101   // Creates AliESDtrack from AliPHOSRecParticles 
102   AliPHOSGetter::Instance()->Event(eventNumber, "P") ; 
103   TClonesArray *recParticles = AliPHOSGetter::Instance()->RecParticles();
104   Int_t nOfRecParticles = recParticles->GetEntries();
105   for (Int_t recpart = 0 ; recpart < nOfRecParticles ; recpart++) {
106     AliPHOSRecParticle * rp = dynamic_cast<AliPHOSRecParticle*>(recParticles->At(recpart));
107     if (Debug()) 
108       rp->Print();
109     AliESDtrack * et = new AliESDtrack() ; 
110     // fills the ESDtrack
111     Double_t xyz[3];
112     for (Int_t ixyz=0; ixyz<3; ixyz++) xyz[ixyz] = rp->GetPos()[ixyz];
113     et->SetPHOSposition(xyz) ; 
114     et->SetPHOSsignal  (rp->Energy()) ; 
115     et->SetPHOSpid     (rp->GetPID()) ;
116     // add the track to the esd object
117     esd->AddTrack(et);
118     delete et;
119   }
120 }