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