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