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