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