]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/AliEMCALReconstructor.cxx
Station2 detailed geometry builder (Sanjoy, Sukalyan, Shakeel)
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALReconstructor.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 "AliEMCALReconstructor.h"
31 #include "AliEMCALClusterizerv1.h"
32 #include "AliEMCALPIDv1.h"
33 #include "AliEMCALGetter.h"
34 #include "AliEMCALTracker.h"
35 #include "AliRawReaderFile.h"
36
37 ClassImp(AliEMCALReconstructor)
38
39 //____________________________________________________________________________
40   AliEMCALReconstructor::AliEMCALReconstructor() : fDebug(kFALSE) 
41 {
42   // ctor
43
44
45
46
47 //____________________________________________________________________________
48 AliEMCALReconstructor::~AliEMCALReconstructor()
49 {
50   // dtor
51
52
53 //____________________________________________________________________________
54 void AliEMCALReconstructor::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(runLoader->GetEventFolder()->GetName() ) ;  
63   
64   AliEMCALClusterizerv1 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 }
72
73 //____________________________________________________________________________
74 void AliEMCALReconstructor::Reconstruct(AliRunLoader* runLoader, AliRawReaderFile* rawreader) const 
75 {
76   // method called by AliReconstruction; 
77   // Only the clusterization is performed,; the rest of the reconstruction is done in FillESD because the track
78   // segment maker needs access to the AliESD object to retrieve the tracks reconstructed by 
79   // the global tracking.
80   // Here we reconstruct from Raw Data
81   
82   rawreader->Reset() ; 
83   TString headerFile(runLoader->GetFileName()) ; 
84   TString branchName(runLoader->GetEventFolder()->GetName()) ;  
85   
86   AliEMCALClusterizerv1 clu(headerFile, branchName);
87   clu.SetEventRange(0, -1) ; // do all the events
88   if ( Debug() ) 
89     clu.ExecuteTask("deb all") ; 
90   else 
91     clu.ExecuteTask("") ;  
92
93 }
94
95 //____________________________________________________________________________
96 void AliEMCALReconstructor::FillESD(AliRunLoader* runLoader, AliESD* esd) const
97 {
98   // Called by AliReconstruct after Reconstruct() and global tracking and vertxing 
99   //Creates the tracksegments and Recparticles
100   
101   Int_t eventNumber = runLoader->GetEventNumber() ;
102
103   // Creates AliESDtrack from AliEMCALRecParticles 
104   AliEMCALGetter::Instance()->Event(eventNumber, "P") ; 
105   TClonesArray *recParticles = AliEMCALGetter::Instance()->RecParticles();
106   Int_t nOfRecParticles = recParticles->GetEntries();
107   esd->SetNumberOfEMCALParticles(nOfRecParticles) ; 
108   esd->SetFirstEMCALParticle(esd->GetNumberOfTracks()) ; 
109   for (Int_t recpart = 0 ; recpart < nOfRecParticles ; recpart++) {
110     AliEMCALRecParticle * rp = dynamic_cast<AliEMCALRecParticle*>(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->SetEMCALposition(xyz) ; 
119     et->SetEMCALsignal  (rp->Energy()) ; 
120     et->SetEMCALpid     (rp->GetPID()) ;
121     // add the track to the esd object
122     esd->AddTrack(et);
123     delete et;
124   }
125 }
126
127 AliTracker* AliEMCALReconstructor::CreateTracker(AliRunLoader* runLoader) const
128 {
129 // creates the EMCAL tracker
130   if (!runLoader) return NULL; 
131   return new AliEMCALTracker(runLoader);
132 }