f6019cda |
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 --- |
f6019cda |
29 | #include "AliEMCALReconstructor.h" |
5dee926e |
30 | |
31 | #include "AliESD.h" |
32 | #include "AliRunLoader.h" |
33 | #include "AliEMCALLoader.h" |
f6019cda |
34 | #include "AliEMCALClusterizerv1.h" |
5dee926e |
35 | #include "AliEMCALRecPoint.h" |
1d59832c |
36 | #include "AliRawReader.h" |
37 | |
f6019cda |
38 | |
39 | ClassImp(AliEMCALReconstructor) |
40 | |
41 | //____________________________________________________________________________ |
42 | AliEMCALReconstructor::AliEMCALReconstructor() : fDebug(kFALSE) |
43 | { |
44 | // ctor |
45 | |
46 | } |
47 | |
48 | |
49 | //____________________________________________________________________________ |
50 | AliEMCALReconstructor::~AliEMCALReconstructor() |
51 | { |
52 | // dtor |
53 | } |
54 | |
55 | //____________________________________________________________________________ |
56 | void AliEMCALReconstructor::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()) ; |
b4975670 |
64 | TString branchName(runLoader->GetEventFolder()->GetName() ) ; |
f6019cda |
65 | |
66 | AliEMCALClusterizerv1 clu(headerFile, branchName); |
67 | clu.SetEventRange(0, -1) ; // do all the events |
68 | if ( Debug() ) |
69 | clu.ExecuteTask("deb all") ; |
70 | else |
85c60a8e |
71 | clu.ExecuteTask("pseudo") ; |
72 | |
f6019cda |
73 | } |
74 | |
a68156e6 |
75 | //____________________________________________________________________________ |
5dee926e |
76 | void AliEMCALReconstructor::Reconstruct(AliRunLoader* runLoader, AliRawReader* rawreader) const |
a68156e6 |
77 | { |
78 | // method called by AliReconstruction; |
79 | // Only the clusterization is performed,; the rest of the reconstruction is done in FillESD because the track |
80 | // segment maker needs access to the AliESD object to retrieve the tracks reconstructed by |
81 | // the global tracking. |
82 | // Here we reconstruct from Raw Data |
83 | |
84 | rawreader->Reset() ; |
85 | TString headerFile(runLoader->GetFileName()) ; |
86 | TString branchName(runLoader->GetEventFolder()->GetName()) ; |
85c60a8e |
87 | |
a68156e6 |
88 | AliEMCALClusterizerv1 clu(headerFile, branchName); |
89 | clu.SetEventRange(0, -1) ; // do all the events |
90 | if ( Debug() ) |
85c60a8e |
91 | clu.ExecuteTask("deb pseudo all") ; |
a68156e6 |
92 | else |
85c60a8e |
93 | clu.ExecuteTask("pseudo") ; |
a68156e6 |
94 | |
95 | } |
96 | |
f6019cda |
97 | //____________________________________________________________________________ |
98 | void AliEMCALReconstructor::FillESD(AliRunLoader* runLoader, AliESD* esd) const |
99 | { |
100 | // Called by AliReconstruct after Reconstruct() and global tracking and vertxing |
92da3372 |
101 | |
b4975670 |
102 | Int_t eventNumber = runLoader->GetEventNumber() ; |
103 | |
1963b290 |
104 | TString headerFile(runLoader->GetFileName()) ; |
105 | TString branchName(runLoader->GetEventFolder()->GetName()) ; |
85c60a8e |
106 | // Creates AliESDCaloCluster from AliEMCALRecPoints |
5dee926e |
107 | AliRunLoader *rl = AliRunLoader::GetRunLoader(); |
108 | AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(rl->GetDetectorLoader("EMCAL")); |
109 | rl->LoadRecPoints(); |
92da3372 |
110 | rl->LoadKinematics(); // To get the primary label |
111 | rl->LoadDigits(); // To get the primary label |
112 | rl->LoadHits(); // To get the primary label |
5dee926e |
113 | rl->GetEvent(eventNumber); |
114 | TObjArray *clusters = emcalLoader->RecPoints(); |
115 | Int_t nClusters = clusters->GetEntries(); |
85c60a8e |
116 | esd->SetNumberOfEMCALClusters(nClusters) ; |
117 | esd->SetFirstEMCALCluster(esd->GetNumberOfCaloClusters()) ; |
92da3372 |
118 | |
5dee926e |
119 | for (Int_t iClust = 0 ; iClust < nClusters ; iClust++) { |
120 | const AliEMCALRecPoint * clust = emcalLoader->RecPoint(iClust); |
85c60a8e |
121 | |
122 | if (Debug()) clust->Print(); |
85c60a8e |
123 | AliESDCaloCluster * ec = new AliESDCaloCluster() ; |
124 | // fills the ESDCaloCluster |
125 | Float_t xyz[3]; |
5dee926e |
126 | TVector3 gpos; |
127 | clust->GetGlobalPosition(gpos); |
f6019cda |
128 | for (Int_t ixyz=0; ixyz<3; ixyz++) |
5dee926e |
129 | xyz[ixyz] = gpos[ixyz]; |
92da3372 |
130 | |
85c60a8e |
131 | Int_t digitMult = clust->GetMultiplicity(); |
132 | UShort_t *amplList = new UShort_t[digitMult]; |
133 | UShort_t *timeList = new UShort_t[digitMult]; |
134 | UShort_t *digiList = new UShort_t[digitMult]; |
135 | Float_t *amplFloat = clust->GetEnergiesList(); |
136 | Float_t *timeFloat = clust->GetTimeList(); |
137 | Int_t *digitInts = clust->GetAbsId(); |
92da3372 |
138 | Float_t *elipAxis = new Float_t(); |
139 | clust->GetElipsAxis(elipAxis); |
85c60a8e |
140 | |
92da3372 |
141 | // Convert Float_t* and Int_t* to UShort_t* to save memory |
142 | Int_t newdigitMult = digitMult ; |
143 | for (Int_t iDigit=0; iDigit<digitMult; iDigit++) { |
144 | if(timeFloat[iDigit] < 65536/1e9*100){ |
145 | amplList[iDigit] = (UShort_t)(amplFloat[iDigit]*500); |
146 | timeList[iDigit] = (UShort_t)(timeFloat[iDigit]*1e9*100); //Time in units of 100 ns = 0.1 ps |
147 | digiList[iDigit] = (UShort_t)(digitInts[iDigit]); |
148 | } |
149 | else |
150 | newdigitMult = newdigitMult - 1 ; |
151 | } |
152 | |
85c60a8e |
153 | ec->SetClusterType(clust->GetClusterType()); |
154 | ec->SetGlobalPosition(xyz); |
155 | ec->SetClusterEnergy(clust->GetEnergy()); |
85c60a8e |
156 | ec->SetDigitAmplitude(amplList); //energies |
157 | ec->SetDigitTime(timeList); //times |
158 | ec->SetDigitIndex(digiList); //indices |
92da3372 |
159 | ec->SetNumberOfDigits(newdigitMult); |
1d59832c |
160 | if(clust->GetClusterType()== AliESDCaloCluster::kClusterv1){ |
92da3372 |
161 | ec->SetClusterDisp(clust->GetDispersion()); |
162 | ec->SetClusterChi2(-1); //not yet implemented |
163 | ec->SetM02(elipAxis[0]*elipAxis[0]) ; |
164 | ec->SetM20(elipAxis[1]*elipAxis[1]) ; |
165 | ec->SetM11(-1) ; //not yet implemented |
166 | ec->SetPrimaryIndex(clust->GetPrimaryIndex()); |
167 | } |
85c60a8e |
168 | // add the cluster to the esd object |
169 | esd->AddCaloCluster(ec); |
170 | delete ec; |
f6019cda |
171 | } |
172 | } |