]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - PWG4/UserTasks/EmcalTasks/AliAnalysisTaskEMCALClusterizeFast.cxx
timing cut on fast ors
[u/mrichter/AliRoot.git] / PWG4 / UserTasks / EmcalTasks / AliAnalysisTaskEMCALClusterizeFast.cxx
... / ...
CommitLineData
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// --- Root ---
19#include <TClonesArray.h>
20#include <TGeoManager.h>
21#include <TObjArray.h>
22#include <TString.h>
23#include <TTree.h>
24
25// --- AliRoot ---
26#include "AliAODCaloCluster.h"
27#include "AliAODEvent.h"
28#include "AliAnalysisManager.h"
29#include "AliCDBEntry.h"
30#include "AliCDBManager.h"
31#include "AliCaloCalibPedestal.h"
32#include "AliEMCALAfterBurnerUF.h"
33#include "AliEMCALCalibData.h"
34#include "AliEMCALClusterizerNxN.h"
35#include "AliEMCALClusterizerv1.h"
36#include "AliEMCALClusterizerv2.h"
37#include "AliEMCALClusterizerFixedWindow.h"
38#include "AliEMCALDigit.h"
39#include "AliEMCALGeometry.h"
40#include "AliEMCALRecParam.h"
41#include "AliEMCALRecPoint.h"
42#include "AliEMCALRecoUtils.h"
43#include "AliESDEvent.h"
44#include "AliInputEventHandler.h"
45#include "AliLog.h"
46
47#include "AliAnalysisTaskEMCALClusterizeFast.h"
48
49ClassImp(AliAnalysisTaskEMCALClusterizeFast)
50
51//________________________________________________________________________
52AliAnalysisTaskEMCALClusterizeFast::AliAnalysisTaskEMCALClusterizeFast()
53 : AliAnalysisTaskSE(),
54 fRun(-1),
55 fDigitsArr(0),
56 fClusterArr(0),
57 fRecParam(0),
58 fClusterizer(0),
59 fUnfolder(0),
60 fJustUnfold(kFALSE),
61 fGeomName(),
62 fGeomMatrixSet(kFALSE),
63 fLoadGeomMatrices(kFALSE),
64 fOCDBpath(),
65 fCalibData(0),
66 fPedestalData(0),
67 fOutputAODBranch(0),
68 fOutputAODBrName(),
69 fRecoUtils(0),
70 fLoadCalib(0),
71 fLoadPed(0),
72 fAttachClusters(0),
73 fRecalibOnly(0),
74 fSubBackground(0),
75 fCreatePattern(0),
76 fOverwrite(1),
77 fNewClusterArrayName("newCaloClusters"),
78 fNPhi(4),
79 fNEta(4),
80 fShiftPhi(2),
81 fShiftEta(2),
82 fTRUShift(0),
83 fClusterizeFastORs(0),
84 fMinFastORtime(0),
85 fMaxFastORtime(20)
86{
87 // Constructor
88}
89
90//________________________________________________________________________
91AliAnalysisTaskEMCALClusterizeFast::AliAnalysisTaskEMCALClusterizeFast(const char *name)
92 : AliAnalysisTaskSE(name),
93 fRun(-1),
94 fDigitsArr(0),
95 fClusterArr(0),
96 fRecParam(new AliEMCALRecParam),
97 fClusterizer(0),
98 fUnfolder(0),
99 fJustUnfold(kFALSE),
100 fGeomName("EMCAL_FIRSTYEARV1"),
101 fGeomMatrixSet(kFALSE),
102 fLoadGeomMatrices(kFALSE),
103 fOCDBpath(),
104 fCalibData(0),
105 fPedestalData(0),
106 fOutputAODBranch(0),
107 fOutputAODBrName(),
108 fRecoUtils(0),
109 fLoadCalib(0),
110 fLoadPed(0),
111 fAttachClusters(0),
112 fRecalibOnly(0),
113 fSubBackground(0),
114 fCreatePattern(0),
115 fOverwrite(1),
116 fNewClusterArrayName("newCaloClusters"),
117 fNPhi(4),
118 fNEta(4),
119 fShiftPhi(2),
120 fShiftEta(2),
121 fTRUShift(0),
122 fClusterizeFastORs(0),
123 fMinFastORtime(0),
124 fMaxFastORtime(20)
125{
126 // Constructor
127
128 fBranchNames = "ESD:AliESDHeader.,AliESDRun.,EMCALCells. AOD:header,emcalCells";
129 for(Int_t i = 0; i < 12; ++i)
130 fGeomMatrix[i] = 0;
131}
132
133//________________________________________________________________________
134AliAnalysisTaskEMCALClusterizeFast::~AliAnalysisTaskEMCALClusterizeFast()
135{
136 // Destructor.
137
138 delete fDigitsArr;
139 delete fClusterizer;
140 delete fUnfolder;
141 delete fRecoUtils;
142}
143
144//-------------------------------------------------------------------
145void AliAnalysisTaskEMCALClusterizeFast::UserCreateOutputObjects()
146{
147 // Create output objects.
148
149 if (!fOutputAODBrName.IsNull()) {
150 fOutputAODBranch = new TClonesArray("AliAODCaloCluster", 0);
151 fOutputAODBranch->SetName(fOutputAODBrName);
152 AddAODBranch("TClonesArray", &fOutputAODBranch);
153 AliInfo(Form("Created Branch: %s",fOutputAODBrName.Data()));
154 }
155}
156
157//________________________________________________________________________
158void AliAnalysisTaskEMCALClusterizeFast::UserExec(Option_t *)
159{
160 // Main loop, called for each event
161
162 // remove the contents of output list set in the previous event
163 if (fOutputAODBranch)
164 fOutputAODBranch->Clear("C");
165
166 AliESDEvent *esdevent = dynamic_cast<AliESDEvent*>(InputEvent());
167 AliAODEvent *aodevent = dynamic_cast<AliAODEvent*>(InputEvent());
168
169 if (!esdevent&&!aodevent) {
170 Error("UserExec","Event not available");
171 return;
172 }
173
174 LoadBranches();
175
176 UInt_t offtrigger = 0;
177 if (esdevent) {
178 UInt_t mask1 = esdevent->GetESDRun()->GetDetectorsInDAQ();
179 UInt_t mask2 = esdevent->GetESDRun()->GetDetectorsInReco();
180 Bool_t desc1 = (mask1 >> 18) & 0x1;
181 Bool_t desc2 = (mask2 >> 18) & 0x1;
182 if (desc1==0 || desc2==0) { //AliDAQ::OfflineModuleName(180=="EMCAL"
183 AliError(Form("EMCAL not in DAQ/RECO: %u (%u)/%u (%u)",
184 mask1, esdevent->GetESDRun()->GetDetectorsInReco(),
185 mask2, esdevent->GetESDRun()->GetDetectorsInDAQ()));
186 return;
187 }
188 AliAnalysisManager *am = AliAnalysisManager::GetAnalysisManager();
189 offtrigger = ((AliInputEventHandler*)(am->GetInputEventHandler()))->IsEventSelected();
190 } else if (aodevent) {
191 offtrigger = aodevent->GetHeader()->GetOfflineTrigger();
192 }
193 if (offtrigger & AliVEvent::kFastOnly) {
194 AliWarning(Form("EMCAL not in fast only partition"));
195 return;
196 }
197
198 Init();
199
200 if (fJustUnfold) {
201 AliWarning("Unfolding not implemented");
202 return;
203 }
204
205 FillDigitsArray();
206
207 if (fRecalibOnly) {
208 UpdateCells();
209 return; // not requested to run clusterizer
210 }
211
212 Clusterize();
213 UpdateCells();
214 UpdateClusters();
215
216 if (fOutputAODBranch)
217 RecPoints2Clusters(fOutputAODBranch);
218}
219
220//________________________________________________________________________
221void AliAnalysisTaskEMCALClusterizeFast::Clusterize()
222{
223 // Clusterize
224
225 if (fSubBackground) {
226 fClusterizer->SetInputCalibrated(kTRUE);
227 fClusterizer->SetCalibrationParameters(0);
228 }
229
230 fClusterizer->Digits2Clusters("");
231 if (fSubBackground) {
232 if (fCalibData) {
233 fClusterizer->SetInputCalibrated(kFALSE);
234 fClusterizer->SetCalibrationParameters(fCalibData);
235 }
236 }
237}
238
239//________________________________________________________________________
240void AliAnalysisTaskEMCALClusterizeFast::FillDigitsArray()
241{
242 // Fill digits array
243
244 fDigitsArr->Clear("C");
245
246 if (fCreatePattern) { // Fill digits from a pattern
247 AliEMCALGeometry *fGeom = AliEMCALGeometry::GetInstance(fGeomName);
248 Int_t maxd = fGeom->GetNCells() / 4;
249 for (Int_t idigit = 0; idigit < maxd; idigit++){
250 if (idigit % 24 == 12) idigit += 12;
251 AliEMCALDigit *digit = static_cast<AliEMCALDigit*>(fDigitsArr->New(idigit));
252 digit->SetId(idigit * 4);
253 digit->SetTime(600);
254 digit->SetTimeR(600);
255 digit->SetIndexInList(idigit);
256 digit->SetType(AliEMCALDigit::kHG);
257 digit->SetAmplitude(0.1);
258 }
259
260 } else if (fClusterizeFastORs) { // Fill digits from FastORs
261
262 AliEMCALGeometry *fGeom = AliEMCALGeometry::GetInstance(fGeomName);
263
264 AliESDEvent* esd = dynamic_cast<AliESDEvent*>(InputEvent());
265 if (!esd){
266 AliError("Cannot get the ESD event");
267 return;
268 }
269
270 AliESDCaloTrigger *triggers = esd->GetCaloTrigger("EMCAL");
271
272 if (!triggers || !(triggers->GetEntries() > 0))
273 return;
274
275 Int_t idigit = 0;
276 triggers->Reset();
277
278 while ((triggers->Next())) {
279 Float_t triggerAmplitude = 0;
280 triggers->GetAmplitude(triggerAmplitude);
281 if (triggerAmplitude <= 0)
282 continue;
283
284 Int_t triggerTime = 0;
285 Int_t ntimes = 0;
286 triggers->GetNL0Times(ntimes);
287 if (ntimes > 0) {
288 Int_t trgtimes[25];
289 triggers->GetL0Times(trgtimes);
290 triggerTime = trgtimes[0];
291 }
292
293 if (triggerTime < fMinFastORtime || triggerTime > fMaxFastORtime)
294 continue;
295
296 Int_t triggerCol = 0, triggerRow = 0;
297 triggers->GetPosition(triggerCol, triggerRow);
298
299 Int_t find = -1;
300 fGeom->GetAbsFastORIndexFromPositionInEMCAL(triggerCol, triggerRow, find);
301
302 if (find<0)
303 continue;
304
305 Int_t cidx[4] = {-1};
306 Bool_t ret = fGeom->GetCellIndexFromFastORIndex(find, cidx);
307
308 if (!ret)
309 continue;
310
311 for (Int_t idxpos = 0; idxpos < 4; idxpos++) {
312 Int_t triggerNumber = cidx[idxpos];
313 AliEMCALDigit *digit = static_cast<AliEMCALDigit*>(fDigitsArr->New(idigit));
314 digit->SetId(triggerNumber);
315 digit->SetTime(triggerTime);
316 digit->SetTimeR(triggerTime);
317 digit->SetIndexInList(idigit);
318 digit->SetType(AliEMCALDigit::kHG);
319 digit->SetAmplitude(triggerAmplitude);
320 idigit++;
321 }
322 }
323
324 } else { // Fill digits from cells.
325
326 AliVCaloCells *cells = InputEvent()->GetEMCALCells();
327 Double_t avgE = 0; // for background subtraction
328 Int_t ncells = cells->GetNumberOfCells();
329 for (Int_t icell = 0, idigit = 0; icell < ncells; ++icell) {
330 Double_t cellAmplitude=0, cellTime=0;
331 Short_t cellNumber=0;
332 if (cells->GetCell(icell, cellNumber, cellAmplitude, cellTime) != kTRUE)
333 break;
334 AliEMCALDigit *digit = static_cast<AliEMCALDigit*>(fDigitsArr->New(idigit));
335 digit->SetId(cellNumber);
336 digit->SetTime(cellTime);
337 digit->SetTimeR(cellTime);
338 digit->SetIndexInList(idigit);
339 digit->SetType(AliEMCALDigit::kHG);
340 if (fRecalibOnly||fSubBackground) {
341 Float_t energy = cellAmplitude;
342 Float_t time = cellTime;
343 fClusterizer->Calibrate(energy,time,cellNumber);
344 digit->SetAmplitude(energy);
345 avgE += energy;
346 } else {
347 digit->SetAmplitude(cellAmplitude);
348 }
349 idigit++;
350 }
351
352 if (fSubBackground) {
353 avgE /= AliEMCALGeometry::GetInstance(fGeomName)->GetNumberOfSuperModules()*48*24;
354 Int_t ndigis = fDigitsArr->GetEntries();
355 for (Int_t i = 0; i < ndigis; ++i) {
356 AliEMCALDigit *digit = static_cast<AliEMCALDigit*>(fDigitsArr->At(i));
357 Double_t energy = digit->GetAmplitude() - avgE;
358 if (energy<=0.001) {
359 digit->SetAmplitude(0);
360 } else {
361 digit->SetAmplitude(energy);
362 }
363 }
364 }
365 }
366}
367
368//________________________________________________________________________________________
369void AliAnalysisTaskEMCALClusterizeFast::RecPoints2Clusters(TClonesArray *clus)
370{
371 // Cluster energy, global position, cells and their amplitude fractions are restored.
372
373 Bool_t esdobjects = 0;
374 if (strcmp(clus->GetClass()->GetName(),"AliESDCaloCluster")==0)
375 esdobjects = 1;
376
377 AliVCaloCells *cells = InputEvent()->GetEMCALCells();
378 AliEMCALGeometry *geom = AliEMCALGeometry::GetInstance(fGeomName);
379
380 Int_t Ncls = fClusterArr->GetEntriesFast();
381 for(Int_t i=0, nout=clus->GetEntries(); i < Ncls; ++i) {
382 AliEMCALRecPoint *recpoint = static_cast<AliEMCALRecPoint*>(fClusterArr->At(i));
383 Int_t ncells_true = 0;
384 const Int_t ncells = recpoint->GetMultiplicity();
385 UShort_t absIds[ncells];
386 Double32_t ratios[ncells];
387 Int_t *dlist = recpoint->GetDigitsList();
388 Float_t *elist = recpoint->GetEnergiesList();
389 for (Int_t c = 0; c < ncells; ++c) {
390 AliEMCALDigit *digit = static_cast<AliEMCALDigit*>(fDigitsArr->At(dlist[c]));
391 absIds[ncells_true] = digit->GetId();
392 ratios[ncells_true] = elist[c]/digit->GetAmplitude();
393 ++ncells_true;
394 }
395
396 if (ncells_true < 1) {
397 AliWarning("Skipping cluster with no cells");
398 continue;
399 }
400
401 // calculate new cluster position
402 TVector3 gpos;
403 recpoint->GetGlobalPosition(gpos);
404 Float_t g[3];
405 gpos.GetXYZ(g);
406
407 AliVCluster *c = static_cast<AliVCluster*>(clus->New(nout++));
408 c->SetType(AliVCluster::kEMCALClusterv1);
409 c->SetE(recpoint->GetEnergy());
410 c->SetPosition(g);
411 c->SetNCells(ncells_true);
412 c->SetDispersion(recpoint->GetDispersion());
413 c->SetEmcCpvDistance(-1); //not yet implemented
414 c->SetChi2(-1); //not yet implemented
415 c->SetTOF(recpoint->GetTime()) ; //time-of-flight
416 c->SetNExMax(recpoint->GetNExMax()); //number of local maxima
417 Float_t elipAxis[2];
418 recpoint->GetElipsAxis(elipAxis);
419 c->SetM02(elipAxis[0]*elipAxis[0]) ;
420 c->SetM20(elipAxis[1]*elipAxis[1]) ;
421 if (fRecoUtils && fRecoUtils->IsBadChannelsRemovalSwitchedOn()) {
422 fRecoUtils->RecalculateClusterDistanceToBadChannel(geom, cells, c);
423 } else {
424 if (fPedestalData)
425 recpoint->EvalDistanceToBadChannels(fPedestalData);
426 c->SetDistanceToBadChannel(recpoint->GetDistanceToBadTower());
427 }
428
429 if (esdobjects) {
430 AliESDCaloCluster *cesd = static_cast<AliESDCaloCluster*>(c);
431 cesd->SetCellsAbsId(absIds);
432 cesd->SetCellsAmplitudeFraction(ratios);
433 cesd->SetID(recpoint->GetUniqueID());
434 } else {
435 AliAODCaloCluster *caod = static_cast<AliAODCaloCluster*>(c);
436 caod->SetCellsAbsId(absIds);
437 caod->SetCellsAmplitudeFraction(ratios);
438 }
439 }
440
441 AliESDEvent *esdevent = dynamic_cast<AliESDEvent*>(InputEvent());
442 if (!esdevent)
443 return;
444 if (!fRecoUtils)
445 return;
446
447 AliAnalysisManager::GetAnalysisManager()->LoadBranch("Tracks");
448 fRecoUtils->FindMatches(esdevent,clus);
449
450 if (!esdobjects) {
451 Int_t Nclus = clus->GetEntries();
452 for(Int_t i=0; i < Nclus; ++i) {
453 AliAODCaloCluster *c = static_cast<AliAODCaloCluster*>(clus->At(i));
454 Int_t trackIndex = fRecoUtils->GetMatchedTrackIndex(i);
455 if (trackIndex >= 0) {
456 Float_t dR, dZ;
457 fRecoUtils->GetMatchedResiduals(i,dR, dZ);
458 c->AddTrackMatched(0x0); //esdevent->GetTrack(trackIndex));
459 c->SetTrackDistance(dR,dZ); // not implemented
460 c->SetEmcCpvDistance(dR);
461 c->SetChi2(dZ);
462 if (DebugLevel() > 1)
463 AliInfo(Form("Matched Track index %d to new cluster %d\n",trackIndex,i));
464 }
465 }
466 } else {
467 Int_t Nclus = clus->GetEntries();
468 for(Int_t i=0; i < Nclus; ++i) {
469 AliESDCaloCluster *c = static_cast<AliESDCaloCluster*>(clus->At(i));
470 Int_t trackIndex = fRecoUtils->GetMatchedTrackIndex(i);
471 if (trackIndex >= 0) {
472 Float_t dR, dZ;
473 fRecoUtils->GetMatchedResiduals(i,dR, dZ);
474 c->SetTrackDistance(dR,dZ);
475 c->SetEmcCpvDistance(dR); //to be consistent with AODs
476 c->SetChi2(dZ); //to be consistent with AODs
477 TArrayI tm(1,&trackIndex);
478 c->AddTracksMatched(tm);
479 if (DebugLevel() > 1)
480 AliInfo(Form("Matched Track index %d to new cluster %d\n",trackIndex,i));
481 }
482 }
483 }
484}
485
486//________________________________________________________________________
487void AliAnalysisTaskEMCALClusterizeFast::UpdateCells()
488{
489 // Update cells in case re-calibration was done.
490
491 if (!fCalibData&&!fSubBackground)
492 return;
493
494 AliVCaloCells *cells = InputEvent()->GetEMCALCells();
495 Int_t ncells = cells->GetNumberOfCells();
496 Int_t ndigis = fDigitsArr->GetEntries();
497
498 if (ncells!=ndigis) {
499 cells->DeleteContainer();
500 cells->CreateContainer(ndigis);
501 }
502 for (Int_t idigit = 0; idigit < ndigis; ++idigit) {
503 AliEMCALDigit *digit = static_cast<AliEMCALDigit*>(fDigitsArr->At(idigit));
504 Double_t cellAmplitude = digit->GetCalibAmp();
505 Short_t cellNumber = digit->GetId();
506 Double_t cellTime = digit->GetTime();
507 cells->SetCell(idigit, cellNumber, cellAmplitude, cellTime);
508 }
509}
510
511//________________________________________________________________________
512void AliAnalysisTaskEMCALClusterizeFast::UpdateClusters()
513{
514 // Update cells in case re-calibration was done.
515
516 if (!fAttachClusters)
517 return;
518
519 TClonesArray *clus = 0;
520
521 if (fOverwrite)
522 {
523 clus = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject("caloClusters"));
524 if (!clus)
525 clus = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject("CaloClusters"));
526 if (!clus)
527 return;
528
529 Int_t nents = clus->GetEntries();
530 for (Int_t i=0;i<nents;++i) {
531 AliVCluster *c = static_cast<AliVCluster*>(clus->At(i));
532 if (!c)
533 continue;
534 if (c->IsEMCAL())
535 delete clus->RemoveAt(i);
536 }
537 } else {
538 clus = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject(fNewClusterArrayName));
539 if (!clus) {
540 clus = new TClonesArray("AliESDCaloCluster");
541 clus->SetName(fNewClusterArrayName);
542 InputEvent()->AddObject(clus);
543 } else {
544 Int_t nents = clus->GetEntries();
545 for (Int_t i=0;i<nents;++i) {
546 AliVCluster *c = static_cast<AliVCluster*>(clus->At(i));
547 if (!c)
548 continue;
549 delete clus->RemoveAt(i);
550 }
551 clus->Compress();
552 }
553 }
554
555 RecPoints2Clusters(clus);
556}
557
558//________________________________________________________________________________________
559void AliAnalysisTaskEMCALClusterizeFast::Init()
560{
561 //Select clusterization/unfolding algorithm and set all the needed parameters
562
563 AliVEvent * event = InputEvent();
564 if (!event) {
565 AliWarning("Event not available!!!");
566 return;
567 }
568
569 if (event->GetRunNumber()==fRun)
570 return;
571 fRun = event->GetRunNumber();
572
573 if (fJustUnfold){
574 // init the unfolding afterburner
575 delete fUnfolder;
576 fUnfolder = new AliEMCALAfterBurnerUF(fRecParam->GetW0(),fRecParam->GetLocMaxCut());
577 return;
578 }
579
580 AliEMCALGeometry *geometry = AliEMCALGeometry::GetInstance(fGeomName);
581 if (!geometry) {
582 AliFatal("Geometry not available!!!");
583 return;
584 }
585
586 if (!fGeomMatrixSet) {
587 if (fLoadGeomMatrices) {
588 for(Int_t mod=0; mod < geometry->GetNumberOfSuperModules(); ++mod) {
589 if (fGeomMatrix[mod]){
590 if (DebugLevel() > 2)
591 fGeomMatrix[mod]->Print();
592 geometry->SetMisalMatrix(fGeomMatrix[mod],mod);
593 }
594 }
595 } else { // get matrix from file (work around bug in aliroot)
596 for(Int_t mod=0; mod < geometry->GetEMCGeometry()->GetNumberOfSuperModules(); ++mod) {
597 const TGeoHMatrix *gm = 0;
598 AliESDEvent *esdevent = dynamic_cast<AliESDEvent*>(event);
599 if (esdevent) {
600 gm = esdevent->GetEMCALMatrix(mod);
601 } else {
602 AliAODHeader *aodheader = dynamic_cast<AliAODHeader*>(event->GetHeader());
603 if (aodheader) {
604 gm = aodheader->GetEMCALMatrix(mod);
605 }
606 }
607 if (gm) {
608 if (DebugLevel() > 2)
609 gm->Print();
610 geometry->SetMisalMatrix(gm,mod);
611 }
612 }
613 }
614 fGeomMatrixSet=kTRUE;
615 }
616
617 // setup digit array if needed
618 if (!fDigitsArr) {
619 fDigitsArr = new TClonesArray("AliEMCALDigit", 1000);
620 fDigitsArr->SetOwner(1);
621 }
622
623 // then setup clusterizer
624 delete fClusterizer;
625 if (fRecParam->GetClusterizerFlag() == AliEMCALRecParam::kClusterizerv1)
626 fClusterizer = new AliEMCALClusterizerv1(geometry);
627 else if (fRecParam->GetClusterizerFlag() == AliEMCALRecParam::kClusterizerNxN) {
628 AliEMCALClusterizerNxN *clusterizer = new AliEMCALClusterizerNxN(geometry);
629 clusterizer->SetNRowDiff(fRecParam->GetNRowDiff());
630 clusterizer->SetNColDiff(fRecParam->GetNColDiff());
631 fClusterizer = clusterizer;
632 } else if (fRecParam->GetClusterizerFlag() == AliEMCALRecParam::kClusterizerv2)
633 fClusterizer = new AliEMCALClusterizerv2(geometry);
634 else if (fRecParam->GetClusterizerFlag() == AliEMCALRecParam::kClusterizerFW){
635 AliEMCALClusterizerFixedWindow *clusterizer = new AliEMCALClusterizerFixedWindow(geometry);
636 clusterizer->SetNphi(fNPhi);
637 clusterizer->SetNeta(fNEta);
638 clusterizer->SetShiftPhi(fShiftPhi);
639 clusterizer->SetShiftEta(fShiftEta);
640 clusterizer->SetTRUshift(fTRUShift);
641 fClusterizer = clusterizer;
642 }
643 else{
644 AliFatal(Form("Clusterizer < %d > not available", fRecParam->GetClusterizerFlag()));
645 }
646 fClusterizer->InitParameters(fRecParam);
647
648 if ((!fCalibData&&fLoadCalib) || (!fPedestalData&&fLoadPed)) {
649 AliCDBManager *cdb = AliCDBManager::Instance();
650 if (!cdb->IsDefaultStorageSet() && !fOCDBpath.IsNull())
651 cdb->SetDefaultStorage(fOCDBpath);
652 if (fRun!=cdb->GetRun())
653 cdb->SetRun(fRun);
654 }
655 if (!fCalibData&&fLoadCalib&&fRun>0) {
656 AliCDBEntry *entry = static_cast<AliCDBEntry*>(AliCDBManager::Instance()->Get("EMCAL/Calib/Data"));
657 if (entry)
658 fCalibData = static_cast<AliEMCALCalibData*>(entry->GetObject());
659 if (!fCalibData)
660 AliFatal("Calibration parameters not found in CDB!");
661 }
662 if (!fPedestalData&&fLoadPed&&fRun>0) {
663 AliCDBEntry *entry = static_cast<AliCDBEntry*>(AliCDBManager::Instance()->Get("EMCAL/Calib/Pedestals"));
664 if (entry)
665 fPedestalData = static_cast<AliCaloCalibPedestal*>(entry->GetObject());
666 }
667 if (fCalibData) {
668 fClusterizer->SetInputCalibrated(kFALSE);
669 fClusterizer->SetCalibrationParameters(fCalibData);
670 } else {
671 fClusterizer->SetInputCalibrated(kTRUE);
672 }
673 if (!fClusterizeFastORs)
674 fClusterizer->SetCaloCalibPedestal(fPedestalData);
675 fClusterizer->SetJustClusters(kTRUE);
676 fClusterizer->SetDigitsArr(fDigitsArr);
677 fClusterizer->SetOutput(0);
678 fClusterArr = const_cast<TObjArray *>(fClusterizer->GetRecPoints());
679}