1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 //////////////////////////////////////////////////////////
17 // Filter the ESDCaloClusters and ESDCaloCells of EMCAL,
18 // PHOS or both, creating the corresponing AODCaloClusters
20 // Keep also the AODHeader information and the vertex.
21 // Needed for calorimeter calibration.
22 // Copy of AliAnalysisTaskESDfilter.
23 // Author: Gustavo Conesa Balbastre (INFN - Frascati)
24 //////////////////////////////////////////////////////////
27 #include "TGeoManager.h"
31 #include "TInterpreter.h"
34 #include "AliESDEvent.h"
35 #include "AliAODEvent.h"
37 #include "AliVCluster.h"
38 #include "AliVCaloCells.h"
39 #include "AliVEventHandler.h"
40 #include "AliAnalysisManager.h"
41 #include "AliInputEventHandler.h"
42 #include "AliESDtrackCuts.h"
43 #include "AliTriggerAnalysis.h"
46 #include "AliEMCALRecoUtils.h"
47 #include "AliEMCALGeometry.h"
49 #include "AliAnalysisTaskCaloFilter.h"
51 ClassImp(AliAnalysisTaskCaloFilter)
53 ////////////////////////////////////////////////////////////////////////
55 AliAnalysisTaskCaloFilter::AliAnalysisTaskCaloFilter():
56 AliAnalysisTaskSE("CaloFilterTask"), //fCuts(0x0),
57 fCaloFilter(0), fCorrect(kFALSE),
58 fEMCALGeo(0x0),fEMCALGeoName("EMCAL_FIRSTYEARV1"),
59 fEMCALRecoUtils(new AliEMCALRecoUtils),
60 fESDtrackCuts(0), fTriggerAnalysis (new AliTriggerAnalysis), fTrackMultEtaCut(0.8),
61 fLoadEMCALMatrices(kFALSE), //fLoadPHOSMatrices(kFALSE),
62 fGeoMatrixSet(kFALSE), fEventNtuple(0),fConfigName(""),fFillAODFile(kTRUE)
64 // Default constructor
65 fESDtrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010();
66 for(Int_t i = 0; i < 12; i++) fEMCALMatrix[i] = 0 ;
67 //for(Int_t i = 0; i < 5 ; i++) fPHOSMatrix[i] = 0 ;
69 DefineOutput(1, TNtuple::Class());
73 //__________________________________________________
74 AliAnalysisTaskCaloFilter::AliAnalysisTaskCaloFilter(const char* name):
75 AliAnalysisTaskSE(name), //fCuts(0x0),
76 fCaloFilter(0), fCorrect(kFALSE),
77 fEMCALGeo(0x0),fEMCALGeoName("EMCAL_FIRSTYEARV1"),
78 fEMCALRecoUtils(new AliEMCALRecoUtils),
79 fESDtrackCuts(0), fTriggerAnalysis (new AliTriggerAnalysis), fTrackMultEtaCut(0.8),
80 fLoadEMCALMatrices(kFALSE), //fLoadPHOSMatrices(kFALSE),
81 fGeoMatrixSet(kFALSE), fEventNtuple(0),fConfigName(""),fFillAODFile(kTRUE)
84 fESDtrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010();
85 for(Int_t i = 0; i < 12; i++) fEMCALMatrix[i] = 0 ;
86 //for(Int_t i = 0; i < 5 ; i++) fPHOSMatrix[i] = 0 ;
88 DefineOutput(1, TNtuple::Class());
92 //__________________________________________________
93 AliAnalysisTaskCaloFilter::~AliAnalysisTaskCaloFilter()
97 if(fEMCALGeo) delete fEMCALGeo;
98 if(fEMCALRecoUtils) delete fEMCALRecoUtils;
99 if(fESDtrackCuts) delete fESDtrackCuts;
100 if(fTriggerAnalysis) delete fTriggerAnalysis;
102 if(fEventNtuple) delete fEventNtuple;
106 //-------------------------------------------------------------------
107 void AliAnalysisTaskCaloFilter::Init()
109 //Init analysis with configuration macro if available
111 if(gROOT->LoadMacro(fConfigName) >=0){
112 printf("Configure analysis with %s\n",fConfigName.Data());
113 AliAnalysisTaskCaloFilter *filter = (AliAnalysisTaskCaloFilter*)gInterpreter->ProcessLine("ConfigCaloFilter()");
114 fEMCALGeoName = filter->fEMCALGeoName;
115 fLoadEMCALMatrices = filter->fLoadEMCALMatrices;
116 fFillAODFile = filter->fFillAODFile;
117 fEMCALRecoUtils = filter->fEMCALRecoUtils;
118 fConfigName = filter->fConfigName;
119 fCaloFilter = filter->fCaloFilter;
120 fCorrect = filter->fCorrect;
121 fTrackMultEtaCut = filter->fTrackMultEtaCut;
122 fESDtrackCuts = filter->fESDtrackCuts;
123 for(Int_t i = 0; i < 12; i++) fEMCALMatrix[i] = filter->fEMCALMatrix[i] ;
127 //__________________________________________________
128 void AliAnalysisTaskCaloFilter::UserCreateOutputObjects()
132 fEMCALGeo = AliEMCALGeometry::GetInstance(fEMCALGeoName) ;
136 fEventNtuple = new TNtuple("EventSelection","EventSelection", "bPileup:bGoodVertex:bV0AND:trackMult");
138 PostData(1, fEventNtuple);
142 //__________________________________________________
143 void AliAnalysisTaskCaloFilter::UserExec(Option_t */*option*/)
145 // Execute analysis for current event
146 // Copy input ESD or AOD header, vertex, CaloClusters and CaloCells to output AOD
149 printf("CaloFilter: Analysing event # %d\n", (Int_t)Entry());
151 AliVEvent* event = InputEvent();
153 printf("AliAnalysisTaskCaloFilter::UserExec - This event does not contain Input?");
157 //Magic line to write events to file
158 AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()->SetFillAOD(fFillAODFile);
160 // cast event, depending on input we will have to use one or the other type of event
161 AliAODEvent* aodevent = dynamic_cast<AliAODEvent*> (event);
162 AliESDEvent* esdevent = dynamic_cast<AliESDEvent*> (event);
164 //-------------------------------------------
165 //Event selection parameters
166 //-------------------------------------------
167 //Is it a pileup event?
168 Bool_t bPileup = event->IsPileupFromSPD(3, 0.8, 3., 2., 5.); //Default values, if not it does not compile
169 //Bool_t bPileup = event->IsPileupFromSPD();
170 //if(bPileup) return kFALSE;
172 Bool_t bV0AND = kFALSE;
173 Bool_t bGoodVertex = kFALSE;
175 //Get track multiplicity
176 Int_t nTracks = InputEvent()->GetNumberOfTracks() ;
177 for (Int_t itrack = 0; itrack < nTracks; itrack++) {////////////// track loop
178 AliVTrack * track = (AliVTrack*)InputEvent()->GetTrack(itrack) ; // retrieve track from esd
179 if(!fESDtrackCuts->AcceptTrack((AliESDtrack*)track)) continue;
180 //Count the tracks in eta < 0.8
181 if(TMath::Abs(track->Eta())< fTrackMultEtaCut) trackMult++;
184 bV0AND = fTriggerAnalysis->IsOfflineTriggerFired(esdevent, AliTriggerAnalysis::kV0AND);
185 //if(!bV0AND) return kFALSE;
186 //Well reconstructed vertex
187 bGoodVertex = CheckForPrimaryVertex();
188 //if(!bGoodVertex) return kFALSE;
193 printf("AliAnalysisTaskCaloFilter::UserExec() - PileUp %d, Good Vertex %d, v0AND %d, Track Mult in |eta| < %2.1f = %d\n",
194 bPileup,bGoodVertex,bV0AND, fTrackMultEtaCut, trackMult);
196 //Put bools with event selection parameters in a TNtuple
197 //Int_t eventSelection[] = {bPileup,bGoodVertex,bV0AND,trackMult};
198 fEventNtuple->Fill(bPileup,bGoodVertex,bV0AND,trackMult);
200 //--------------------------------------------------------------------
201 //Set in AOD General Event Parameters, vertex, runnumber, trigger, etc
202 //-------------------------------------------------------------------
204 // set arrays and pointers
208 for (Int_t i = 0; i < 6; i++) covVtx[i] = 0.;
210 AliAODHeader* header = AODEvent()->GetHeader();
212 header->SetRunNumber(event->GetRunNumber());
215 TTree* tree = fInputHandler->GetTree();
217 TFile* file = tree->GetCurrentFile();
218 if (file) header->SetESDFileName(file->GetName());
221 else if (aodevent) header->SetESDFileName(aodevent->GetHeader()->GetESDFileName());
223 header->SetBunchCrossNumber(event->GetBunchCrossNumber());
224 header->SetOrbitNumber(event->GetOrbitNumber());
225 header->SetPeriodNumber(event->GetPeriodNumber());
226 header->SetEventType(event->GetEventType());
229 if(event->GetCentrality()){
230 header->SetCentrality(new AliCentrality(*(event->GetCentrality())));
233 header->SetCentrality(0);
237 header->SetOfflineTrigger(fInputHandler->IsEventSelected()); // propagate the decision of the physics selection
238 if (esdevent) header->SetFiredTriggerClasses(esdevent->GetFiredTriggerClasses());
239 else if (aodevent) header->SetFiredTriggerClasses(aodevent->GetFiredTriggerClasses());
240 header->SetTriggerMask(event->GetTriggerMask());
241 header->SetTriggerCluster(event->GetTriggerCluster());
243 header->SetL0TriggerInputs(esdevent->GetHeader()->GetL0TriggerInputs());
244 header->SetL1TriggerInputs(esdevent->GetHeader()->GetL1TriggerInputs());
245 header->SetL2TriggerInputs(esdevent->GetHeader()->GetL2TriggerInputs());
248 header->SetL0TriggerInputs(aodevent->GetHeader()->GetL0TriggerInputs());
249 header->SetL1TriggerInputs(aodevent->GetHeader()->GetL1TriggerInputs());
250 header->SetL2TriggerInputs(aodevent->GetHeader()->GetL2TriggerInputs());
253 header->SetMagneticField(event->GetMagneticField());
254 //header->SetMuonMagFieldScale(esdevent->GetCurrentDip()/6000.);
256 header->SetZDCN1Energy(event->GetZDCN1Energy());
257 header->SetZDCP1Energy(event->GetZDCP1Energy());
258 header->SetZDCN2Energy(event->GetZDCN2Energy());
259 header->SetZDCP2Energy(event->GetZDCP2Energy());
260 header->SetZDCEMEnergy(event->GetZDCEMEnergy(0),event->GetZDCEMEnergy(1));
262 Float_t diamxy[2]={event->GetDiamondX(),event->GetDiamondY()};
264 event->GetDiamondCovXY(diamcov);
265 header->SetDiamond(diamxy,diamcov);
266 if (esdevent) header->SetDiamondZ(esdevent->GetDiamondZ(),esdevent->GetSigma2DiamondZ());
267 else if (aodevent) header->SetDiamondZ(aodevent->GetDiamondZ(),aodevent->GetSigma2DiamondZ());
271 Int_t nVertices = 1 ;/* = prim. vtx*/;
272 Int_t nCaloClus = event->GetNumberOfCaloClusters();
274 AODEvent()->ResetStd(0, nVertices, 0, 0, 0, nCaloClus, 0, 0);
276 // Access to the AOD container of vertices
277 TClonesArray &vertices = *(AODEvent()->GetVertices());
280 // Add primary vertex. The primary tracks will be defined
281 // after the loops on the composite objects (V0, cascades, kinks)
282 event->GetPrimaryVertex()->GetXYZ(pos);
285 esdevent->GetPrimaryVertex()->GetCovMatrix(covVtx);
286 chi = esdevent->GetPrimaryVertex()->GetChi2toNDF();
289 aodevent->GetPrimaryVertex()->GetCovMatrix(covVtx);
290 chi = aodevent->GetPrimaryVertex()->GetChi2perNDF();//Different from ESD?
293 AliAODVertex * primary = new(vertices[jVertices++])
294 AliAODVertex(pos, covVtx, chi, NULL, -1, AliAODVertex::kPrimary);
295 primary->SetName(event->GetPrimaryVertex()->GetName());
296 primary->SetTitle(event->GetPrimaryVertex()->GetTitle());
298 // Access to the AOD container of clusters
299 TClonesArray &caloClusters = *(AODEvent()->GetCaloClusters());
302 //-------------------------------------------
303 //Do Corrections in EMCAL
304 //-------------------------------------------
305 //If EMCAL, and requested, correct energy, position ...
306 //Need to do this in a separate loop before filling the ESDs because of the track matching recalculations
307 if(fCorrect && (fCaloFilter==kEMCAL || fCaloFilter==kBoth) ) {
310 if(fLoadEMCALMatrices){
311 printf("AliAnalysisTaskCaloFilter::UserExec() - Load user defined EMCAL geometry matrices\n");
312 for(Int_t mod=0; mod < (fEMCALGeo->GetEMCGeometry())->GetNumberOfSuperModules(); mod++){
313 if(fEMCALMatrix[mod]){
315 fEMCALMatrix[mod]->Print();
316 fEMCALGeo->SetMisalMatrix(fEMCALMatrix[mod],mod) ;
321 else if(!gGeoManager){
322 printf("AliAnalysisTaskCaloFilter::UserExec() - Get geo matrices from data\n");
323 //Still not implemented in AOD, just a workaround to be able to work at least with ESDs
324 if(!strcmp(event->GetName(),"AliAODEvent")) {
326 printf("AliAnalysisTaskCaloFilter Use ideal geometry, values geometry matrix not kept in AODs.\n");
329 if(DebugLevel() > 1) printf("AliAnalysisTaskCaloFilter Load Misaligned matrices. \n");
330 AliESDEvent* esd = dynamic_cast<AliESDEvent*>(event) ;
332 printf("AliAnalysisTaskCaloFilter::UserExec() - This event does not contain ESDs?");
335 for(Int_t mod=0; mod < (fEMCALGeo->GetEMCGeometry())->GetNumberOfSuperModules(); mod++){
336 //if(DebugLevel() > 1)
337 esd->GetEMCALMatrix(mod)->Print();
338 if(esd->GetEMCALMatrix(mod)) fEMCALGeo->SetMisalMatrix(esd->GetEMCALMatrix(mod),mod) ;
342 }//Load matrices from Data
344 //Recover time dependent corrections, put then in recalibration histograms. Do it once
345 fEMCALRecoUtils->SetRunDependentCorrections(InputEvent()->GetRunNumber());
351 for (Int_t iClust=0; iClust<nCaloClus; ++iClust) {
353 AliVCluster * cluster = event->GetCaloCluster(iClust);
354 if(cluster->IsPHOS()) continue ;
356 Float_t position[]={0,0,0};
358 printf("Check cluster %d for bad channels and close to border\n",cluster->GetID());
359 if(fEMCALRecoUtils->ClusterContainsBadChannel(fEMCALGeo,cluster->GetCellsAbsId(), cluster->GetNCells())) continue;
360 // if(!fEMCALRecoUtils->CheckCellFiducialRegion(fEMCALGeo, cluster, event->GetEMCALCells())) {
361 // printf("Finally reject\n");
366 printf("Filter, before : i %d, E %f, dispersion %f, m02 %f, m20 %f, distToBad %f\n",iClust,cluster->E(),
367 cluster->GetDispersion(),cluster->GetM02(),cluster->GetM20(), cluster->GetDistanceToBadChannel());
368 cluster->GetPosition(position);
369 printf("Filter, before : i %d, x %f, y %f, z %f\n",cluster->GetID(), position[0], position[1], position[2]);
372 //Recalculate distance to bad channels, if new list of bad channels provided
373 fEMCALRecoUtils->RecalculateClusterDistanceToBadChannel(fEMCALGeo, event->GetEMCALCells(), cluster);
375 if(fEMCALRecoUtils->IsRecalibrationOn()) {
376 fEMCALRecoUtils->RecalibrateClusterEnergy(fEMCALGeo, cluster, event->GetEMCALCells());
377 fEMCALRecoUtils->RecalculateClusterShowerShapeParameters(fEMCALGeo, event->GetEMCALCells(),cluster);
378 fEMCALRecoUtils->RecalculateClusterPID(cluster);
381 fEMCALRecoUtils->RecalculateClusterPosition(fEMCALGeo, event->GetEMCALCells(),cluster);
385 printf("Filter, after : i %d, E %f, dispersion %f, m02 %f, m20 %f, distToBad %f\n",cluster->GetID(),cluster->E(),
386 cluster->GetDispersion(),cluster->GetM02(),cluster->GetM20(), cluster->GetDistanceToBadChannel());
387 cluster->GetPosition(position);
388 printf("Filter, after : i %d, x %f, y %f, z %f\n",cluster->GetID(), position[0], position[1], position[2]);
391 cluster->SetE(fEMCALRecoUtils->CorrectClusterEnergyLinearity(cluster));
394 //Recalculate track-matching
395 fEMCALRecoUtils->FindMatches(event,0,fEMCALGeo);
397 } // corrections in EMCAL
399 //-------------------------------------------
400 // Now loop on clusters to fill AODs
401 //-------------------------------------------
402 for (Int_t iClust=0; iClust<nCaloClus; ++iClust) {
404 AliVCluster * cluster = event->GetCaloCluster(iClust);
406 //Check which calorimeter information we want to keep.
408 if(fCaloFilter!=kBoth){
409 if (fCaloFilter==kPHOS && cluster->IsEMCAL()) continue ;
410 else if(fCaloFilter==kEMCAL && cluster->IsPHOS()) continue ;
413 //Temporary trick, FIXME
414 Float_t dR = cluster->GetTrackDx();
415 Float_t dZ = cluster->GetTrackDz();
417 printf("Original residuals : dZ %f, dR %f\n ",dZ, dR);
418 //--------------------------------------------------------------
419 //If EMCAL and corrections done, get the new matching parameters, do not copy noisy clusters
420 if(cluster->IsEMCAL() && fCorrect && esdevent){
422 printf("Check cluster %d for bad channels and close to border\n",cluster->GetID());
423 if(fEMCALRecoUtils->ClusterContainsBadChannel(fEMCALGeo,cluster->GetCellsAbsId(), cluster->GetNCells())) continue;
425 // if(!fEMCALRecoUtils->CheckCellFiducialRegion(fEMCALGeo, cluster, event->GetEMCALCells())) {
426 // printf("Finally reject\n");
430 if(fEMCALRecoUtils->IsExoticCluster(cluster, InputEvent()->GetEMCALCells(),InputEvent()->GetBunchCrossNumber())) continue;
432 fEMCALRecoUtils->GetMatchedResiduals(cluster->GetID(),dR,dZ);
433 cluster->SetTrackDistance(dR,dZ);
436 if(DebugLevel() > 2){
437 if(cluster->IsEMCAL()) printf("EMCAL Track-Cluster Residuals : dZ %f, dR %f\n ",dZ, dR);
438 if(cluster->IsPHOS()) printf("PHOS Track-Cluster Residuals : dZ %f, dR %f\n ",dZ, dR);
441 //--------------------------------------------------------------
445 Int_t id = cluster->GetID();
446 Float_t energy = cluster->E();
447 cluster->GetPosition(posF);
449 AliAODCaloCluster *caloCluster = new(caloClusters[jClusters++])
450 AliAODCaloCluster(id,
451 cluster->GetNLabels(),
452 cluster->GetLabels(),
458 caloCluster->SetChi2(dZ);//Temporary trick, FIXME
459 caloCluster->SetCaloCluster(cluster->GetDistanceToBadChannel(),
460 cluster->GetDispersion(),
461 cluster->GetM20(), cluster->GetM02(),
462 dR, //Temporary trick, FIXME
463 cluster->GetNExMax(),cluster->GetTOF()) ;
465 caloCluster->SetPIDFromESD(cluster->GetPID());
466 caloCluster->SetNCells(cluster->GetNCells());
467 caloCluster->SetCellsAbsId(cluster->GetCellsAbsId());
468 caloCluster->SetCellsAmplitudeFraction(cluster->GetCellsAmplitudeFraction());
472 printf("Filter, aod : i %d, E %f, dispersion %f, m02 %f, m20 %f\n",caloCluster->GetID(),caloCluster->E(),
473 caloCluster->GetDispersion(),caloCluster->GetM02(),caloCluster->GetM20());
474 caloCluster->GetPosition(posF);
475 printf("Filter, aod : i %d, x %f, y %f, z %f\n",caloCluster->GetID(), posF[0], posF[1], posF[2]);
478 //Matched tracks, just to know if there was any match, the track pointer is useless.
479 //Temporary trick, FIXME
481 if(TMath::Abs(dR) < 990 && TMath::Abs(dZ) < 990) { //Default value in PHOS 999, in EMCAL 1024, why?
483 printf("*** Cluster Track-Matched *** dR %f, dZ %f\n",caloCluster->GetEmcCpvDistance(),caloCluster->Chi2());
484 caloCluster->AddTrackMatched(new AliAODTrack);
485 }// fill the array with one entry to signal a possible match
486 //TArrayI* matchedT = ((AliESDCaloCluster*)cluster)->GetTracksMatched();
487 //if (InputEvent()->GetNumberOfTracks() > 0 && matchedT && cluster->GetTrackMatchedIndex() >= 0) {
488 // for (Int_t im = 0; im < matchedT->GetSize(); im++) {
489 // Int_t iESDtrack = matchedT->At(im);;
490 // if ((AliVTrack*)InputEvent()->GetTrack(iESDtrack) != 0) {
491 // caloCluster->AddTrackMatched((AliVTrack*)InputEvent()->GetTrack(iESDtrack));
494 //}// There is at least a match with a track
497 caloClusters.Expand(jClusters); // resize TObjArray to 'remove' slots for pseudo clusters
498 // end of loop on calo clusters
500 // fill EMCAL cell info
501 if ((fCaloFilter==kBoth || fCaloFilter==kEMCAL) && event->GetEMCALCells()) { // protection against missing ESD information
502 AliVCaloCells &eventEMcells = *(event->GetEMCALCells());
503 Int_t nEMcell = eventEMcells.GetNumberOfCells() ;
505 AliAODCaloCells &aodEMcells = *(AODEvent()->GetEMCALCells());
506 aodEMcells.CreateContainer(nEMcell);
507 aodEMcells.SetType(AliVCaloCells::kEMCALCell);
508 Double_t calibFactor = 1.;
509 for (Int_t iCell = 0; iCell < nEMcell; iCell++) {
510 Int_t imod = -1, iphi =-1, ieta=-1,iTower = -1, iIphi = -1, iIeta = -1;
511 fEMCALGeo->GetCellIndex(eventEMcells.GetCellNumber(iCell),imod,iTower,iIphi,iIeta);
512 fEMCALGeo->GetCellPhiEtaIndexInSModule(imod,iTower,iIphi, iIeta,iphi,ieta);
514 if(fCorrect && fEMCALRecoUtils->IsRecalibrationOn()){
515 calibFactor = fEMCALRecoUtils->GetEMCALChannelRecalibrationFactor(imod,ieta,iphi);
518 if(!fEMCALRecoUtils->GetEMCALChannelStatus(imod, ieta, iphi)){ //Channel is not declared as bad
519 aodEMcells.SetCell(iCell,eventEMcells.GetCellNumber(iCell),eventEMcells.GetAmplitude(iCell)*calibFactor);
520 //printf("GOOD channel\n");
523 aodEMcells.SetCell(iCell,eventEMcells.GetCellNumber(iCell),0);
524 //printf("BAD channel\n");
530 // fill PHOS cell info
531 if ((fCaloFilter==kBoth || fCaloFilter==kPHOS) && event->GetPHOSCells()) { // protection against missing ESD information
532 AliVCaloCells &eventPHcells = *(event->GetPHOSCells());
533 Int_t nPHcell = eventPHcells.GetNumberOfCells() ;
535 AliAODCaloCells &aodPHcells = *(AODEvent()->GetPHOSCells());
536 aodPHcells.CreateContainer(nPHcell);
537 aodPHcells.SetType(AliVCaloCells::kPHOSCell);
538 for (Int_t iCell = 0; iCell < nPHcell; iCell++) {
539 aodPHcells.SetCell(iCell,eventPHcells.GetCellNumber(iCell),eventPHcells.GetAmplitude(iCell));
544 PostData(1, fEventNtuple);
549 //____________________________________________________________________________
550 Bool_t AliAnalysisTaskCaloFilter::CheckForPrimaryVertex(){
551 //Check if the vertex was well reconstructed, copy from V0Reader of conversion group
552 //It only works for ESDs
554 AliESDEvent * event = dynamic_cast<AliESDEvent*> (InputEvent());
555 if(!event) return kFALSE;
557 if(event->GetPrimaryVertexTracks()->GetNContributors() > 0) {
561 if(event->GetPrimaryVertexTracks()->GetNContributors() < 1) {
563 if(event->GetPrimaryVertexSPD()->GetNContributors() > 0) {
564 //cout<<"spd vertex type::"<< fESDEvent->GetPrimaryVertex()->GetName() << endl;
568 if(event->GetPrimaryVertexSPD()->GetNContributors() < 1) {
569 // cout<<"bad vertex type::"<< fESDEvent->GetPrimaryVertex()->GetName() << endl;
578 //_____________________________________________________
579 void AliAnalysisTaskCaloFilter::PrintInfo(){
583 printf("TASK: AnalysisCaloFilter \n");
584 printf("\t Not only filter, correct Clusters? %d\n",fCorrect);
585 printf("\t Calorimeter Filtering Option ? %d\n",fCaloFilter);
586 //printf("\t Use handmade geo matrices? EMCAL %d, PHOS %d\n",fLoadEMCALMatrices, fLoadPHOSMatrices);
587 printf("\t Use handmade geo matrices? EMCAL %d, PHOS 0\n",fLoadEMCALMatrices);
590 //_____________________________________________________
591 //void AliAnalysisTaskCaloFilter::LocalInit()
593 // // Local Initialization
595 // // Create cuts/param objects and publish to slot
596 // const Int_t buffersize = 255;
597 // char onePar[buffersize] ;
598 // fCuts = new TList();
600 // snprintf(onePar,buffersize, "Calorimeter Filtering Option %d", fCaloFilter) ;
601 // fCuts->Add(new TObjString(onePar));
602 // snprintf(onePar,buffersize, "Not only filter but correct? %d cells;", fCorrect) ;
603 // fCuts->Add(new TObjString(onePar));
606 // PostData(2, fCuts);
611 //__________________________________________________
612 void AliAnalysisTaskCaloFilter::Terminate(Option_t */*option*/)
614 // Terminate analysis
616 if (fDebug > 1) printf("AnalysisCaloFilter: Terminate() \n");