]>
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 | //_________________________________________________________________________ | |
fa42b1f3 | 19 | //-- |
20 | //-- Yves Schutz (SUBATECH) | |
f6019cda | 21 | // Reconstruction class. Redesigned from the old AliReconstructionner class and |
22 | // derived from STEER/AliReconstructor. | |
23 | // | |
85c25c2e | 24 | //-- Aleksei Pavlinov : added staf for EMCAL jet trigger 9Apr 25, 2008) |
25 | // : fgDigitsArr should read just once at event | |
26 | ||
f6019cda | 27 | // --- ROOT system --- |
85c25c2e | 28 | #include <TList.h> |
29 | #include <TClonesArray.h> | |
60d8ad94 | 30 | #include <TH2.h> |
0c5b726e | 31 | #include "TGeoManager.h" |
32 | #include "TGeoMatrix.h" | |
f6019cda | 33 | |
34 | // --- Standard library --- | |
35 | ||
36 | // --- AliRoot header files --- | |
f6019cda | 37 | #include "AliEMCALReconstructor.h" |
5dee926e | 38 | |
aaa3cb7c | 39 | #include "AliCodeTimer.h" |
23ca956b | 40 | #include "AliCaloCalibPedestal.h" |
41 | #include "AliEMCALCalibData.h" | |
af885e0f | 42 | #include "AliESDEvent.h" |
89ffc0b0 | 43 | #include "AliESDCaloCluster.h" |
0e7c6655 | 44 | #include "AliESDCaloCells.h" |
6a0cf740 | 45 | #include "AliESDtrack.h" |
5dee926e | 46 | #include "AliEMCALLoader.h" |
98e9578e | 47 | #include "AliEMCALRawUtils.h" |
0e7c6655 | 48 | #include "AliEMCALDigit.h" |
f6019cda | 49 | #include "AliEMCALClusterizerv1.h" |
ee08edde | 50 | #include "AliEMCALClusterizerNxN.h" |
5dee926e | 51 | #include "AliEMCALRecPoint.h" |
dc293ae9 | 52 | #include "AliEMCALPID.h" |
0964c2e9 | 53 | #include "AliEMCALTrigger.h" |
1d59832c | 54 | #include "AliRawReader.h" |
fa42b1f3 | 55 | #include "AliCDBEntry.h" |
56 | #include "AliCDBManager.h" | |
65bdc82f | 57 | #include "AliEMCALGeometry.h" |
ac8ae9fe | 58 | #include "AliEMCAL.h" |
85c25c2e | 59 | #include "AliESDVZERO.h" |
0c5b726e | 60 | #include "AliCDBManager.h" |
72c58de0 | 61 | #include "AliRunLoader.h" |
62 | #include "AliRun.h" | |
916f1e76 | 63 | #include "AliEMCALTriggerData.h" |
64 | #include "AliEMCALTriggerElectronics.h" | |
fff39dd1 | 65 | #include "AliEMCALTriggerDCSConfigDB.h" |
66 | #include "AliEMCALTriggerDCSConfig.h" | |
1d59832c | 67 | |
85c25c2e | 68 | ClassImp(AliEMCALReconstructor) |
f6019cda | 69 | |
b57cc9b9 | 70 | const AliEMCALRecParam* AliEMCALReconstructor::fgkRecParam = 0; // EMCAL rec. parameters |
71 | AliEMCALRawUtils* AliEMCALReconstructor::fgRawUtils = 0; // EMCAL raw utilities class | |
72 | AliEMCALClusterizer* AliEMCALReconstructor::fgClusterizer = 0; // EMCAL clusterizer class | |
73 | TClonesArray* AliEMCALReconstructor::fgDigitsArr = 0; // list of digits, to be used multiple times | |
74 | TObjArray* AliEMCALReconstructor::fgClustersArr = 0; // list of clusters, to be used multiple times | |
916f1e76 | 75 | AliEMCALTriggerElectronics* AliEMCALReconstructor::fgTriggerProcessor = 0x0; |
f6019cda | 76 | //____________________________________________________________________________ |
18a21c7c | 77 | AliEMCALReconstructor::AliEMCALReconstructor() |
40164976 | 78 | : fDebug(kFALSE), fList(0), fGeom(0),fCalibData(0),fPedestalData(0) |
f6019cda | 79 | { |
80 | // ctor | |
65bdc82f | 81 | |
82 | fgRawUtils = new AliEMCALRawUtils; | |
72c58de0 | 83 | |
84 | //To make sure we match with the geometry in a simulation file, | |
85 | //let's try to get it first. If not, take the default geometry | |
33c3c91a | 86 | AliRunLoader *rl = AliRunLoader::Instance(); |
72c58de0 | 87 | if (rl->GetAliRun() && rl->GetAliRun()->GetDetector("EMCAL")) { |
88 | fGeom = dynamic_cast<AliEMCAL*>(rl->GetAliRun()->GetDetector("EMCAL"))->GetGeometry(); | |
89 | } else { | |
90 | AliInfo(Form("Using default geometry in reconstruction")); | |
937d0661 | 91 | fGeom = AliEMCALGeometry::GetInstance(AliEMCALGeometry::GetDefaultGeometryName()); |
65bdc82f | 92 | } |
0e7c6655 | 93 | |
0c5b726e | 94 | //Get calibration parameters |
95 | if(!fCalibData) | |
96 | { | |
97 | AliCDBEntry *entry = (AliCDBEntry*) | |
98 | AliCDBManager::Instance()->Get("EMCAL/Calib/Data"); | |
99 | if (entry) fCalibData = (AliEMCALCalibData*) entry->GetObject(); | |
100 | } | |
101 | ||
102 | if(!fCalibData) | |
103 | AliFatal("Calibration parameters not found in CDB!"); | |
104 | ||
40164976 | 105 | //Get calibration parameters |
106 | if(!fPedestalData) | |
107 | { | |
108 | AliCDBEntry *entry = (AliCDBEntry*) | |
109 | AliCDBManager::Instance()->Get("EMCAL/Calib/Pedestals"); | |
110 | if (entry) fPedestalData = (AliCaloCalibPedestal*) entry->GetObject(); | |
111 | } | |
112 | ||
ee08edde | 113 | if(!fPedestalData) |
114 | AliFatal("Dead map not found in CDB!"); | |
0c5b726e | 115 | |
ee08edde | 116 | InitClusterizer(); |
117 | ||
72c58de0 | 118 | if(!fGeom) AliFatal(Form("Could not get geometry!")); |
119 | ||
fff39dd1 | 120 | AliEMCALTriggerDCSConfigDB* dcsConfigDB = AliEMCALTriggerDCSConfigDB::Instance(); |
121 | ||
122 | const AliEMCALTriggerDCSConfig* dcsConfig = dcsConfigDB->GetTriggerDCSConfig(); | |
123 | ||
124 | if (!dcsConfig) AliFatal("No Trigger DCS Configuration from OCDB!"); | |
125 | fgTriggerProcessor = new AliEMCALTriggerElectronics( dcsConfig ); | |
b57cc9b9 | 126 | |
127 | //Init temporary list of digits | |
128 | fgDigitsArr = new TClonesArray("AliEMCALDigit",1000); | |
129 | fgClustersArr = new TObjArray(1000); | |
130 | ||
f6019cda | 131 | } |
132 | ||
f6019cda | 133 | //____________________________________________________________________________ |
134 | AliEMCALReconstructor::~AliEMCALReconstructor() | |
135 | { | |
136 | // dtor | |
23ca956b | 137 | |
138 | if(fGeom) delete fGeom; | |
139 | if(fCalibData) delete fCalibData; | |
140 | if(fPedestalData) delete fPedestalData; | |
141 | ||
b57cc9b9 | 142 | if(fgDigitsArr){ |
143 | fgDigitsArr->Clear("C"); | |
144 | delete fgDigitsArr; | |
145 | } | |
146 | ||
147 | if(fgClustersArr){ | |
148 | fgClustersArr->Clear(); | |
149 | delete fgClustersArr; | |
150 | } | |
151 | ||
23ca956b | 152 | if(fgRawUtils) delete fgRawUtils; |
153 | if(fgClusterizer) delete fgClusterizer; | |
154 | if(fgTriggerProcessor) delete fgTriggerProcessor; | |
b57cc9b9 | 155 | |
aaa3cb7c | 156 | AliCodeTimer::Instance()->Print(); |
f6019cda | 157 | } |
158 | ||
40871053 | 159 | // //____________________________________________________________________________ |
160 | // void AliEMCALReconstructor::Init() | |
161 | // { | |
162 | // // Trigger hists - Oct 24, 2007 | |
163 | // fList = AliEMCALHistoUtilities::GetTriggersListOfHists(kTRUE); | |
164 | // } | |
85c25c2e | 165 | |
ee08edde | 166 | //____________________________________________________________________________ |
167 | void AliEMCALReconstructor::InitClusterizer() | |
168 | { | |
169 | //Init the clusterizer with geometry and calibration pointers, avoid doing it twice. | |
170 | ||
171 | AliEMCALRecParam *recParam = NULL; | |
172 | AliCDBEntry *entry = (AliCDBEntry*) | |
173 | AliCDBManager::Instance()->Get("EMCAL/Calib/RecoParam"); | |
174 | //Get The reco param for the default event specie | |
175 | if (entry) | |
176 | recParam = (AliEMCALRecParam*)((TObjArray *) entry->GetObject())->At(0); | |
177 | ||
178 | if(!recParam) | |
179 | AliFatal("RecoParam not found in CDB!"); | |
180 | ||
181 | if (recParam->GetClusterizerFlag() == AliEMCALRecParam::kClusterizerv1) | |
182 | { | |
183 | fgClusterizer = new AliEMCALClusterizerv1(fGeom, fCalibData,fPedestalData); | |
184 | } | |
185 | else | |
186 | { | |
187 | fgClusterizer = new AliEMCALClusterizerNxN(fGeom, fCalibData,fPedestalData); | |
188 | } | |
189 | ||
190 | } | |
191 | ||
f6019cda | 192 | //____________________________________________________________________________ |
c47157cd | 193 | void AliEMCALReconstructor::Reconstruct(TTree* digitsTree, TTree* clustersTree) const |
f6019cda | 194 | { |
195 | // method called by AliReconstruction; | |
196 | // Only the clusterization is performed,; the rest of the reconstruction is done in FillESD because the track | |
197 | // segment maker needs access to the AliESD object to retrieve the tracks reconstructed by | |
198 | // the global tracking. | |
c47157cd | 199 | // Works on the current event. |
fa42b1f3 | 200 | |
1a429a6b | 201 | AliCodeTimerAuto("",0) |
aaa3cb7c | 202 | |
85c25c2e | 203 | ReadDigitsArrayFromTree(digitsTree); |
ee08edde | 204 | |
0832a2bf | 205 | fgClusterizer->InitParameters(); |
4601e3a7 | 206 | fgClusterizer->SetOutput(clustersTree); |
e853f058 | 207 | |
916f1e76 | 208 | AliEMCALTriggerData* trgData = new AliEMCALTriggerData(); |
209 | ||
210 | Int_t bufferSize = 32000; | |
211 | ||
212 | if (TBranch* triggerBranch = clustersTree->GetBranch("EMTRG")) | |
e853f058 | 213 | triggerBranch->SetAddress(&trgData); |
214 | else | |
215 | clustersTree->Branch("EMTRG","AliEMCALTriggerData",&trgData,bufferSize); | |
916f1e76 | 216 | |
916f1e76 | 217 | TClonesArray *trgDigits = new TClonesArray("AliEMCALRawDigit",1000); |
218 | TBranch *branchdig = digitsTree->GetBranch("EMTRG"); | |
219 | if (!branchdig) | |
220 | { | |
221 | AliError("Can't get the branch with the EMCAL trigger digits !"); | |
222 | return; | |
223 | } | |
224 | ||
225 | branchdig->SetAddress(&trgDigits); | |
226 | branchdig->GetEntry(0); | |
916f1e76 | 227 | |
e853f058 | 228 | //Skip clusterization of LED events |
229 | if (GetRecParam()->GetEventSpecie()!=AliRecoParam::kCalib){ | |
0341167b | 230 | |
e853f058 | 231 | Int_t v0M[2] = {0,0}; |
232 | fgTriggerProcessor->Digits2Trigger(trgDigits, v0M, trgData); | |
233 | ||
234 | ||
235 | if(fgDigitsArr && fgDigitsArr->GetEntries()) { | |
85c25c2e | 236 | |
e853f058 | 237 | fgClusterizer->SetInput(digitsTree); |
9517d886 | 238 | |
e853f058 | 239 | if(Debug()) |
240 | fgClusterizer->Digits2Clusters("deb all") ; | |
241 | else | |
242 | fgClusterizer->Digits2Clusters(""); | |
9517d886 | 243 | |
e853f058 | 244 | fgClusterizer->Clear(); |
9517d886 | 245 | |
e853f058 | 246 | }//digits array exists and has somethind |
247 | }//not a LED event | |
248 | ||
916f1e76 | 249 | clustersTree->Fill(); |
e853f058 | 250 | trgDigits->Delete(); |
251 | delete trgDigits; trgDigits = 0x0; | |
252 | delete trgData; trgData = 0x0; | |
916f1e76 | 253 | |
f6019cda | 254 | } |
255 | ||
a68156e6 | 256 | //____________________________________________________________________________ |
c47157cd | 257 | void AliEMCALReconstructor::ConvertDigits(AliRawReader* rawReader, TTree* digitsTree) const |
98e9578e | 258 | |
a68156e6 | 259 | { |
c47157cd | 260 | // Conversion from raw data to |
261 | // EMCAL digits. | |
262 | // Works on a single-event basis | |
85c60a8e | 263 | |
98e9578e | 264 | rawReader->Reset() ; |
b57cc9b9 | 265 | if(fgDigitsArr) fgDigitsArr->Clear("C"); |
266 | ||
916f1e76 | 267 | TClonesArray *digitsTrg = new TClonesArray("AliEMCALRawDigit", 200); |
268 | ||
c47157cd | 269 | Int_t bufsize = 32000; |
b57cc9b9 | 270 | digitsTree->Branch("EMCAL", &fgDigitsArr, bufsize); |
916f1e76 | 271 | digitsTree->Branch("EMTRG", &digitsTrg, bufsize); |
46f1d25f | 272 | |
e853f058 | 273 | //Skip calibration events do the rest |
274 | Bool_t doFit = kTRUE; | |
275 | if ( !(GetRecParam()->FitLEDEvents()) && GetRecParam()->GetEventSpecie()==AliRecoParam::kCalib) doFit = kFALSE; | |
276 | if (doFit){ | |
277 | //must be done here because, in constructor, option is not yet known | |
278 | fgRawUtils->SetOption(GetOption()); | |
279 | ||
280 | fgRawUtils->SetRawFormatHighLowGainFactor(GetRecParam()->GetHighLowGainFactor()); | |
281 | fgRawUtils->SetRawFormatOrder(GetRecParam()->GetOrderParameter()); | |
282 | fgRawUtils->SetRawFormatTau(GetRecParam()->GetTau()); | |
283 | fgRawUtils->SetNoiseThreshold(GetRecParam()->GetNoiseThreshold()); | |
284 | fgRawUtils->SetNPedSamples(GetRecParam()->GetNPedSamples()); | |
285 | fgRawUtils->SetRemoveBadChannels(GetRecParam()->GetRemoveBadChannels()); | |
286 | fgRawUtils->SetFittingAlgorithm(GetRecParam()->GetFittingAlgorithm()); | |
287 | fgRawUtils->SetFALTROUsage(GetRecParam()->UseFALTRO()); | |
288 | fgRawUtils->SetTimeMin(GetRecParam()->GetTimeMin()); | |
289 | fgRawUtils->SetTimeMax(GetRecParam()->GetTimeMax()); | |
290 | ||
b57cc9b9 | 291 | fgRawUtils->Raw2Digits(rawReader,fgDigitsArr,fPedestalData,digitsTrg); |
793176c1 | 292 | }//skip calibration event |
e853f058 | 293 | else{ |
294 | AliDebug(1," Calibration Event, skip!"); | |
e853f058 | 295 | } |
296 | ||
c615db53 | 297 | digitsTree->Fill(); |
916f1e76 | 298 | digitsTrg->Delete(); |
916f1e76 | 299 | delete digitsTrg; |
c615db53 | 300 | |
a68156e6 | 301 | } |
302 | ||
85c25c2e | 303 | |
f6019cda | 304 | //____________________________________________________________________________ |
0e7c6655 | 305 | void AliEMCALReconstructor::FillESD(TTree* digitsTree, TTree* clustersTree, |
c47157cd | 306 | AliESDEvent* esd) const |
f6019cda | 307 | { |
98e9578e | 308 | // Called by AliReconstruct after Reconstruct() and global tracking and vertexing |
85c25c2e | 309 | // and V0 |
c47157cd | 310 | // Works on the current event |
85c25c2e | 311 | // printf(" ## AliEMCALReconstructor::FillESD() is started ### \n "); |
312 | //return; | |
92da3372 | 313 | |
0e7c6655 | 314 | //######################################## |
315 | //##############Fill CaloCells############### | |
316 | //######################################## | |
b57cc9b9 | 317 | ReadDigitsArrayFromTree(digitsTree); |
aaa3cb7c | 318 | |
b57cc9b9 | 319 | // TClonesArray *digits = new TClonesArray("AliEMCALDigit",1000); |
320 | // TBranch *branchdig = digitsTree->GetBranch("EMCAL"); | |
321 | // if (!branchdig) { | |
322 | // AliError("can't get the branch with the EMCAL digits !"); | |
323 | // return; | |
324 | // } | |
325 | // branchdig->SetAddress(&digits); | |
326 | // digitsTree->GetEvent(0); | |
327 | Int_t nDigits = fgDigitsArr->GetEntries(), idignew = 0 ; | |
0e7c6655 | 328 | AliDebug(1,Form("%d digits",nDigits)); |
329 | ||
330 | AliESDCaloCells &emcCells = *(esd->GetEMCALCells()); | |
331 | emcCells.CreateContainer(nDigits); | |
c8fe2783 | 332 | emcCells.SetType(AliVCaloCells::kEMCALCell); |
0c5b726e | 333 | Float_t energy = 0; |
0e7c6655 | 334 | for (Int_t idig = 0 ; idig < nDigits ; idig++) { |
b57cc9b9 | 335 | const AliEMCALDigit * dig = (const AliEMCALDigit*)fgDigitsArr->At(idig); |
829ba234 | 336 | if(dig->GetAmplitude() > 0 ){ |
ee08edde | 337 | energy = fgClusterizer->Calibrate(dig->GetAmplitude(),dig->GetTime(),dig->GetId()); //TimeR or Time? |
40164976 | 338 | if(energy > 0){ //Digits tagged as bad (dead, hot, not alive) are set to 0 in calibrate, remove them |
339 | emcCells.SetCell(idignew,dig->GetId(),energy, dig->GetTime()); | |
340 | idignew++; | |
341 | } | |
0e7c6655 | 342 | } |
343 | } | |
344 | emcCells.SetNumberOfCells(idignew); | |
345 | emcCells.Sort(); | |
346 | ||
347 | //------------------------------------------------------------ | |
348 | //-----------------CLUSTERS----------------------------- | |
349 | //------------------------------------------------------------ | |
9dce5a21 | 350 | clustersTree->SetBranchStatus("*",0); //disable all branches |
351 | clustersTree->SetBranchStatus("EMCALECARP",1); //Enable only the branch we need | |
b57cc9b9 | 352 | if(fgClustersArr) fgClustersArr->Clear(); |
0e7c6655 | 353 | TBranch *branch = clustersTree->GetBranch("EMCALECARP"); |
b57cc9b9 | 354 | branch->SetAddress(&fgClustersArr); |
9dce5a21 | 355 | branch->GetEntry(0); |
356 | //clustersTree->GetEvent(0); | |
0e7c6655 | 357 | |
b57cc9b9 | 358 | Int_t nClusters = fgClustersArr->GetEntries(), nClustersNew=0; |
0e7c6655 | 359 | AliDebug(1,Form("%d clusters",nClusters)); |
85c25c2e | 360 | |
6a0cf740 | 361 | //###################################################### |
362 | //#######################TRACK MATCHING############### | |
363 | //###################################################### | |
364 | //Fill list of integers, each one is index of track to which the cluster belongs. | |
365 | ||
366 | // step 1 - initialize array of matched track indexes | |
367 | Int_t *matchedTrack = new Int_t[nClusters]; | |
368 | for (Int_t iclus = 0; iclus < nClusters; iclus++) | |
369 | matchedTrack[iclus] = -1; // neg. index --> no matched track | |
370 | ||
371 | // step 2, change the flag for all matched clusters found in tracks | |
372 | Int_t iemcalMatch = -1; | |
373 | Int_t endtpc = esd->GetNumberOfTracks(); | |
374 | for (Int_t itrack = 0; itrack < endtpc; itrack++) { | |
375 | AliESDtrack * track = esd->GetTrack(itrack) ; // retrieve track | |
376 | iemcalMatch = track->GetEMCALcluster(); | |
65f4a419 | 377 | if(iemcalMatch >= 0) matchedTrack[iemcalMatch] = itrack; |
6a0cf740 | 378 | } |
85c25c2e | 379 | |
6a0cf740 | 380 | //######################################## |
85c25c2e | 381 | //##############Fill CaloClusters############# |
6a0cf740 | 382 | //######################################## |
5dee926e | 383 | for (Int_t iClust = 0 ; iClust < nClusters ; iClust++) { |
b57cc9b9 | 384 | const AliEMCALRecPoint * clust = (const AliEMCALRecPoint*)fgClustersArr->At(iClust); |
c8fe2783 | 385 | //if(clust->GetClusterType()== AliVCluster::kEMCALClusterv1) nRP++; else nPC++; |
85c60a8e | 386 | if (Debug()) clust->Print(); |
a7a5421e | 387 | // Get information from EMCAL reconstruction points |
85c60a8e | 388 | Float_t xyz[3]; |
5dee926e | 389 | TVector3 gpos; |
390 | clust->GetGlobalPosition(gpos); | |
35397e76 | 391 | for (Int_t ixyz=0; ixyz<3; ixyz++) |
5dee926e | 392 | xyz[ixyz] = gpos[ixyz]; |
85c25c2e | 393 | Float_t elipAxis[2]; |
394 | clust->GetElipsAxis(elipAxis); | |
35397e76 | 395 | //Create digits lists |
396 | Int_t cellMult = clust->GetMultiplicity(); | |
397 | //TArrayS digiList(digitMult); | |
398 | Float_t *amplFloat = clust->GetEnergiesList(); | |
399 | Int_t *digitInts = clust->GetAbsId(); | |
400 | TArrayS absIdList(cellMult); | |
eb972628 | 401 | TArrayD fracList(cellMult); |
35397e76 | 402 | |
403 | Int_t newCellMult = 0; | |
404 | for (Int_t iCell=0; iCell<cellMult; iCell++) { | |
405 | if (amplFloat[iCell] > 0) { | |
406 | absIdList[newCellMult] = (UShort_t)(digitInts[iCell]); | |
eb972628 | 407 | //Uncomment when unfolding is done |
408 | //if(emcCells.GetCellAmplitude(digitInts[iCell])>0) | |
409 | //fracList[newCellMult] = amplFloat[iCell]/(emcCells.GetCellAmplitude(digitInts[iCell])*calibration);//get cell calibration value | |
410 | //else | |
411 | fracList[newCellMult] = 0; | |
35397e76 | 412 | newCellMult++; |
92da3372 | 413 | } |
92da3372 | 414 | } |
85c25c2e | 415 | |
eb972628 | 416 | absIdList.Set(newCellMult); |
417 | fracList.Set(newCellMult); | |
418 | ||
35397e76 | 419 | if(newCellMult > 0) { // accept cluster if it has some digit |
420 | nClustersNew++; | |
65721814 | 421 | //Primaries |
7592dfc4 | 422 | Int_t parentMult = 0; |
fa42b1f3 | 423 | Int_t *parentList = clust->GetParents(parentMult); |
a7a5421e | 424 | // fills the ESDCaloCluster |
35397e76 | 425 | AliESDCaloCluster * ec = new AliESDCaloCluster() ; |
c8fe2783 | 426 | ec->SetType(AliVCluster::kEMCALClusterv1); |
7592dfc4 | 427 | ec->SetPosition(xyz); |
428 | ec->SetE(clust->GetEnergy()); | |
40164976 | 429 | |
ee08edde | 430 | //Distance to the nearest bad crystal |
431 | ec->SetDistanceToBadChannel(clust->GetDistanceToBadTower()); | |
40164976 | 432 | |
35397e76 | 433 | ec->SetNCells(newCellMult); |
434 | //Change type of list from short to ushort | |
435 | UShort_t *newAbsIdList = new UShort_t[newCellMult]; | |
ee08edde | 436 | Double_t *newFracList = new Double_t[newCellMult]; |
35397e76 | 437 | for(Int_t i = 0; i < newCellMult ; i++) { |
438 | newAbsIdList[i]=absIdList[i]; | |
eb972628 | 439 | newFracList[i]=fracList[i]; |
35397e76 | 440 | } |
441 | ec->SetCellsAbsId(newAbsIdList); | |
eb972628 | 442 | ec->SetCellsAmplitudeFraction(newFracList); |
c8fe2783 | 443 | ec->SetDispersion(clust->GetDispersion()); |
444 | ec->SetChi2(-1); //not yet implemented | |
35397e76 | 445 | ec->SetM02(elipAxis[0]*elipAxis[0]) ; |
446 | ec->SetM20(elipAxis[1]*elipAxis[1]) ; | |
78902954 | 447 | ec->SetTOF(clust->GetTime()) ; //time-of-fligh |
225cd96d | 448 | ec->SetNExMax(clust->GetNExMax()); //number of local maxima |
35397e76 | 449 | TArrayI arrayTrackMatched(1);// Only one track, temporal solution. |
450 | arrayTrackMatched[0]= matchedTrack[iClust]; | |
451 | ec->AddTracksMatched(arrayTrackMatched); | |
452 | ||
453 | TArrayI arrayParents(parentMult,parentList); | |
454 | ec->AddLabels(arrayParents); | |
455 | ||
6a0cf740 | 456 | // add the cluster to the esd object |
eb972628 | 457 | esd->AddCaloCluster(ec); |
a7a5421e | 458 | delete ec; |
85d4cbde | 459 | delete [] newAbsIdList ; |
eb972628 | 460 | delete [] newFracList ; |
35397e76 | 461 | } |
462 | } // cycle on clusters | |
85c25c2e | 463 | |
35397e76 | 464 | delete [] matchedTrack; |
85c25c2e | 465 | |
35397e76 | 466 | //Fill ESDCaloCluster with PID weights |
1942834a | 467 | AliEMCALPID *pid = new AliEMCALPID; |
468 | //pid->SetPrintInfo(kTRUE); | |
469 | pid->SetReconstructor(kTRUE); | |
470 | pid->RunPID(esd); | |
471 | delete pid; | |
eb972628 | 472 | |
b57cc9b9 | 473 | //delete digits; |
474 | //delete clusters; | |
eb972628 | 475 | |
1942834a | 476 | //Store EMCAL misalignment matrixes |
477 | FillMisalMatrixes(esd) ; | |
0c5b726e | 478 | |
479 | } | |
480 | ||
481 | //================================================================================== | |
482 | void AliEMCALReconstructor::FillMisalMatrixes(AliESDEvent* esd)const{ | |
483 | //Store EMCAL matrixes in ESD Header | |
484 | ||
485 | //Check, if matrixes was already stored | |
cb8a44fb | 486 | for(Int_t sm = 0 ; sm < fGeom->GetNumberOfSuperModules(); sm++){ |
0c5b726e | 487 | if(esd->GetEMCALMatrix(sm)!=0) |
488 | return ; | |
489 | } | |
490 | ||
491 | //Create and store matrixes | |
492 | if(!gGeoManager){ | |
493 | AliError("Can not store misal. matrixes: no gGeoManager! \n") ; | |
494 | return ; | |
495 | } | |
496 | //Note, that owner of copied marixes will be header | |
497 | char path[255] ; | |
5e3106bc | 498 | TGeoHMatrix * m = 0x0; |
cb8a44fb | 499 | for(Int_t sm = 0; sm < fGeom->GetNumberOfSuperModules(); sm++){ |
0c5b726e | 500 | sprintf(path,"/ALIC_1/XEN1_1/SMOD_%d",sm+1) ; //In Geometry modules numbered 1,2,.,5 |
501 | if(sm >= 10) sprintf(path,"/ALIC_1/XEN1_1/SM10_%d",sm-10+1) ; | |
502 | ||
9ddc5deb | 503 | if (gGeoManager->CheckPath(path)){ |
cb8a44fb | 504 | gGeoManager->cd(path); |
0c5b726e | 505 | m = gGeoManager->GetCurrentMatrix() ; |
cb8a44fb | 506 | // printf("================================================= \n"); |
507 | // printf("AliEMCALReconstructor::FixMisalMatrixes(), sm %d, \n",sm); | |
508 | // m->Print(""); | |
0c5b726e | 509 | esd->SetEMCALMatrix(new TGeoHMatrix(*m),sm) ; |
cb8a44fb | 510 | // printf("================================================= \n"); |
0c5b726e | 511 | } |
512 | else{ | |
513 | esd->SetEMCALMatrix(NULL,sm) ; | |
514 | } | |
515 | } | |
f6019cda | 516 | } |
dc293ae9 | 517 | |
0c5b726e | 518 | |
519 | ||
9517d886 | 520 | //__________________________________________________________________________ |
85c25c2e | 521 | void AliEMCALReconstructor::ReadDigitsArrayFromTree(TTree *digitsTree) const |
522 | { | |
523 | // See AliEMCALClusterizer::SetInput(TTree *digitsTree); | |
524 | if(fgDigitsArr) { | |
525 | // Clear previous digits | |
b57cc9b9 | 526 | fgDigitsArr->Clear("C"); |
527 | //delete fgDigitsArr; | |
85c25c2e | 528 | } |
529 | // Read the digits from the input tree | |
530 | TBranch *branch = digitsTree->GetBranch("EMCAL"); | |
531 | if (!branch) { | |
532 | AliError("can't get the branch with the EMCAL digits !"); | |
533 | return; | |
534 | } | |
535 | fgDigitsArr = new TClonesArray("AliEMCALDigit",100); | |
536 | branch->SetAddress(&fgDigitsArr); | |
537 | branch->GetEntry(0); | |
538 | } | |
98e9578e | 539 | |
916f1e76 | 540 |