]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/AliPHOSReconstructor.cxx
Reading raw data
[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 #include "AliPHOSTracker.h"
36 #include "AliRawReader.h"
37
38  
39 ClassImp(AliPHOSReconstructor)
40
41 Bool_t AliPHOSReconstructor::fgDebug = kFALSE ; 
42
43 //____________________________________________________________________________
44   AliPHOSReconstructor::AliPHOSReconstructor() 
45 {
46   // ctor
47
48
49
50 //____________________________________________________________________________
51   AliPHOSReconstructor::~AliPHOSReconstructor()
52 {
53   // dtor
54
55
56
57 //____________________________________________________________________________
58 void AliPHOSReconstructor::Reconstruct(AliRunLoader* runLoader) const 
59 {
60   // method called by AliReconstruction; 
61   // Only the clusterization is performed,; the rest of the reconstruction is done in FillESD because the track
62   // segment maker needs access to the AliESD object to retrieve the tracks reconstructed by 
63   // the global tracking.
64  
65   TString headerFile(runLoader->GetFileName()) ; 
66   TString branchName(runLoader->GetEventFolder()->GetName()) ;  
67   
68   AliPHOSClusterizerv1 clu(headerFile, branchName);
69   clu.SetEventRange(0, -1) ; // do all the events
70   if ( Debug() ) 
71     clu.ExecuteTask("deb all") ; 
72   else 
73     clu.ExecuteTask("") ;  
74
75 }
76
77 //____________________________________________________________________________
78 void AliPHOSReconstructor::Reconstruct(AliRunLoader* runLoader, AliRawReader* rawreader) const 
79 {
80   // method called by AliReconstruction; 
81   // Only the clusterization is performed,; the rest of the reconstruction is done in FillESD because the track
82   // segment maker needs access to the AliESD object to retrieve the tracks reconstructed by 
83   // the global tracking.
84   // Here we reconstruct from Raw Data
85   
86   rawreader->Reset() ; 
87   TString headerFile(runLoader->GetFileName()) ; 
88   TString branchName(runLoader->GetEventFolder()->GetName()) ;  
89   
90   AliPHOSClusterizerv1 clu(headerFile, branchName);
91   clu.SetEventRange(0, 0) ; // reconstruct one events
92   clu.SetRawReader(rawreader);
93   if ( Debug() ) 
94     clu.ExecuteTask("deb all") ; 
95   else 
96     clu.ExecuteTask("") ;
97
98 }
99
100 //____________________________________________________________________________
101 void AliPHOSReconstructor::FillESD(AliRunLoader* runLoader, AliESD* esd) const
102 {
103   // This function creates AliESDtracks from AliPHOSRecParticles
104   //         and
105   // writes them to the ESD
106
107   Int_t eventNumber = runLoader->GetEventNumber() ;
108
109   AliPHOSGetter::Instance()->Event(eventNumber, "P") ; 
110   TClonesArray *recParticles = AliPHOSGetter::Instance()->RecParticles();
111   Int_t nOfRecParticles = recParticles->GetEntries();
112   esd->SetNumberOfPHOSParticles(nOfRecParticles) ; 
113   esd->SetFirstPHOSParticle(esd->GetNumberOfTracks()) ; 
114
115   for (Int_t recpart = 0 ; recpart < nOfRecParticles ; recpart++) {
116     AliPHOSRecParticle * rp = dynamic_cast<AliPHOSRecParticle*>(recParticles->At(recpart));
117     if (Debug()) 
118       rp->Print();
119     AliESDtrack * et = new AliESDtrack() ; 
120     // fills the ESDtrack
121     Double_t xyz[3];
122     for (Int_t ixyz=0; ixyz<3; ixyz++) 
123       xyz[ixyz] = rp->GetPos()[ixyz];
124     et->SetPHOSposition(xyz) ; 
125     et->SetPHOSsignal  (rp->Energy()) ; 
126     et->SetPHOSpid     (rp->GetPID()) ;
127     et->SetLabel       (rp->GetPrimaryIndex());
128     // add the track to the esd object
129     esd->AddTrack(et);
130     delete et;
131   }
132 }
133
134 AliTracker* AliPHOSReconstructor::CreateTracker(AliRunLoader* runLoader) const
135 {
136 // creates the PHOS tracker
137   if (!runLoader) return NULL; 
138   return new AliPHOSTracker(runLoader);
139 }
140