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 /* $Id: AliAnalysisTaskCaloFilter.cxx $ */
18 //////////////////////////////////////////////////////////
19 // Filter the ESDCaloClusters and ESDCaloCells of EMCAL,
20 // PHOS or both, creating the corresponing AODCaloClusters
22 // Keep also the AODHeader information and the vertex.
23 // Needed for calorimeter calibration.
24 // Copy of AliAnalysisTaskESDfilter.
25 // Author: Gustavo Conesa Balbastre (INFN - Frascati)
26 //////////////////////////////////////////////////////////
29 #include "TGeoManager.h"
33 #include "TInterpreter.h"
36 #include "AliESDEvent.h"
37 #include "AliAODEvent.h"
39 #include "AliVCluster.h"
40 #include "AliVCaloCells.h"
41 #include "AliVEventHandler.h"
42 #include "AliAnalysisManager.h"
43 #include "AliInputEventHandler.h"
44 #include "AliESDtrackCuts.h"
45 #include "AliTriggerAnalysis.h"
48 #include "AliEMCALRecoUtils.h"
49 #include "AliEMCALGeometry.h"
51 #include "AliAnalysisTaskCaloFilter.h"
53 ClassImp(AliAnalysisTaskCaloFilter)
55 ////////////////////////////////////////////////////////////////////////
57 AliAnalysisTaskCaloFilter::AliAnalysisTaskCaloFilter():
58 AliAnalysisTaskSE("CaloFilterTask"), //fCuts(0x0),
59 fCaloFilter(0), fCorrect(kFALSE),
60 fEMCALGeo(0x0),fEMCALGeoName("EMCAL_FIRSTYEARV1"),
61 fEMCALRecoUtils(new AliEMCALRecoUtils),
62 fESDtrackCuts(0), fTriggerAnalysis (new AliTriggerAnalysis), fTrackMultEtaCut(0.8),
63 fLoadEMCALMatrices(kFALSE), //fLoadPHOSMatrices(kFALSE),
64 fGeoMatrixSet(kFALSE), fEventNtuple(0),fConfigName(""),fFillAODFile(kTRUE)
66 // Default constructor
67 fESDtrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010();
68 for(Int_t i = 0; i < 10; i++) fEMCALMatrix[i] = 0 ;
69 //for(Int_t i = 0; i < 5 ; i++) fPHOSMatrix[i] = 0 ;
71 DefineOutput(1, TNtuple::Class());
75 //__________________________________________________
76 AliAnalysisTaskCaloFilter::AliAnalysisTaskCaloFilter(const char* name):
77 AliAnalysisTaskSE(name), //fCuts(0x0),
78 fCaloFilter(0), fCorrect(kFALSE),
79 fEMCALGeo(0x0),fEMCALGeoName("EMCAL_FIRSTYEARV1"),
80 fEMCALRecoUtils(new AliEMCALRecoUtils),
81 fESDtrackCuts(0), fTriggerAnalysis (new AliTriggerAnalysis), fTrackMultEtaCut(0.8),
82 fLoadEMCALMatrices(kFALSE), //fLoadPHOSMatrices(kFALSE),
83 fGeoMatrixSet(kFALSE), fEventNtuple(0),fConfigName(""),fFillAODFile(kTRUE)
86 fESDtrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010();
87 for(Int_t i = 0; i < 10; i++) fEMCALMatrix[i] = 0 ;
88 //for(Int_t i = 0; i < 5 ; i++) fPHOSMatrix[i] = 0 ;
90 DefineOutput(1, TNtuple::Class());
94 //__________________________________________________
95 AliAnalysisTaskCaloFilter::~AliAnalysisTaskCaloFilter()
99 if(fEMCALGeo) delete fEMCALGeo;
100 if(fEMCALRecoUtils) delete fEMCALRecoUtils;
101 if(fESDtrackCuts) delete fESDtrackCuts;
102 if(fTriggerAnalysis) delete fTriggerAnalysis;
104 if(fEventNtuple) delete fEventNtuple;
108 //-------------------------------------------------------------------
109 void AliAnalysisTaskCaloFilter::Init()
111 //Init analysis with configuration macro if available
113 if(gROOT->LoadMacro(fConfigName) >=0){
114 printf("Configure analysis with %s\n",fConfigName.Data());
115 AliAnalysisTaskCaloFilter *filter = (AliAnalysisTaskCaloFilter*)gInterpreter->ProcessLine("ConfigCaloFilter()");
116 fEMCALGeoName = filter->fEMCALGeoName;
117 fLoadEMCALMatrices = filter->fLoadEMCALMatrices;
118 fFillAODFile = filter->fFillAODFile;
119 fEMCALRecoUtils = filter->fEMCALRecoUtils;
120 fConfigName = filter->fConfigName;
121 fCaloFilter = filter->fCaloFilter;
122 fCorrect = filter->fCorrect;
123 fTrackMultEtaCut = filter->fTrackMultEtaCut;
124 fESDtrackCuts = filter->fESDtrackCuts;
125 for(Int_t i = 0; i < 10; i++) fEMCALMatrix[i] = filter->fEMCALMatrix[i] ;
129 //__________________________________________________
130 void AliAnalysisTaskCaloFilter::UserCreateOutputObjects()
134 fEMCALGeo = AliEMCALGeometry::GetInstance(fEMCALGeoName) ;
138 fEventNtuple = new TNtuple("EventSelection","EventSelection", "bPileup:bGoodVertex:bV0AND:trackMult");
140 PostData(1, fEventNtuple);
144 //__________________________________________________
145 void AliAnalysisTaskCaloFilter::UserExec(Option_t */*option*/)
147 // Execute analysis for current event
148 // Copy input ESD or AOD header, vertex, CaloClusters and CaloCells to output AOD
151 printf("CaloFilter: Analysing event # %d\n", (Int_t)Entry());
153 AliVEvent* event = InputEvent();
155 printf("AliAnalysisTaskCaloFilter::UserExec - This event does not contain Input?");
159 //Magic line to write events to file
160 AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()->SetFillAOD(fFillAODFile);
162 // cast event, depending on input we will have to use one or the other type of event
163 AliAODEvent* aodevent = dynamic_cast<AliAODEvent*> (event);
164 AliESDEvent* esdevent = dynamic_cast<AliESDEvent*> (event);
166 //-------------------------------------------
167 //Event selection parameters
168 //-------------------------------------------
169 //Is it a pileup event?
170 Bool_t bPileup = event->IsPileupFromSPD(3, 0.8, 3., 2., 5.); //Default values, if not it does not compile
171 //Bool_t bPileup = event->IsPileupFromSPD();
172 //if(bPileup) return kFALSE;
174 Bool_t bV0AND = kFALSE;
175 Bool_t bGoodVertex = kFALSE;
177 //Get track multiplicity
178 Int_t nTracks = InputEvent()->GetNumberOfTracks() ;
179 for (Int_t itrack = 0; itrack < nTracks; itrack++) {////////////// track loop
180 AliVTrack * track = (AliVTrack*)InputEvent()->GetTrack(itrack) ; // retrieve track from esd
181 if(!fESDtrackCuts->AcceptTrack((AliESDtrack*)track)) continue;
182 //Count the tracks in eta < 0.8
183 if(TMath::Abs(track->Eta())< fTrackMultEtaCut) trackMult++;
186 bV0AND = fTriggerAnalysis->IsOfflineTriggerFired(esdevent, AliTriggerAnalysis::kV0AND);
187 //if(!bV0AND) return kFALSE;
188 //Well reconstructed vertex
189 bGoodVertex = CheckForPrimaryVertex();
190 //if(!bGoodVertex) return kFALSE;
195 printf("AliAnalysisTaskCaloFilter::UserExec() - PileUp %d, Good Vertex %d, v0AND %d, Track Mult in |eta| < %2.1f = %d\n",
196 bPileup,bGoodVertex,bV0AND, fTrackMultEtaCut, trackMult);
198 //Put bools with event selection parameters in a TNtuple
199 //Int_t eventSelection[] = {bPileup,bGoodVertex,bV0AND,trackMult};
200 fEventNtuple->Fill(bPileup,bGoodVertex,bV0AND,trackMult);
202 //--------------------------------------------------------------------
203 //Set in AOD General Event Parameters, vertex, runnumber, trigger, etc
204 //-------------------------------------------------------------------
206 // set arrays and pointers
210 for (Int_t i = 0; i < 6; i++) covVtx[i] = 0.;
212 AliAODHeader* header = AODEvent()->GetHeader();
214 header->SetRunNumber(event->GetRunNumber());
217 TTree* tree = fInputHandler->GetTree();
219 TFile* file = tree->GetCurrentFile();
220 if (file) header->SetESDFileName(file->GetName());
223 else if (aodevent) header->SetESDFileName(aodevent->GetHeader()->GetESDFileName());
225 header->SetBunchCrossNumber(event->GetBunchCrossNumber());
226 header->SetOrbitNumber(event->GetOrbitNumber());
227 header->SetPeriodNumber(event->GetPeriodNumber());
228 header->SetEventType(event->GetEventType());
231 if(event->GetCentrality()){
232 header->SetCentrality(new AliCentrality(*(event->GetCentrality())));
235 header->SetCentrality(0);
239 header->SetOfflineTrigger(fInputHandler->IsEventSelected()); // propagate the decision of the physics selection
240 if (esdevent) header->SetFiredTriggerClasses(esdevent->GetFiredTriggerClasses());
241 else if (aodevent) header->SetFiredTriggerClasses(aodevent->GetFiredTriggerClasses());
242 header->SetTriggerMask(event->GetTriggerMask());
243 header->SetTriggerCluster(event->GetTriggerCluster());
245 header->SetL0TriggerInputs(esdevent->GetHeader()->GetL0TriggerInputs());
246 header->SetL1TriggerInputs(esdevent->GetHeader()->GetL1TriggerInputs());
247 header->SetL2TriggerInputs(esdevent->GetHeader()->GetL2TriggerInputs());
250 header->SetL0TriggerInputs(aodevent->GetHeader()->GetL0TriggerInputs());
251 header->SetL1TriggerInputs(aodevent->GetHeader()->GetL1TriggerInputs());
252 header->SetL2TriggerInputs(aodevent->GetHeader()->GetL2TriggerInputs());
255 header->SetMagneticField(event->GetMagneticField());
256 //header->SetMuonMagFieldScale(esdevent->GetCurrentDip()/6000.);
258 header->SetZDCN1Energy(event->GetZDCN1Energy());
259 header->SetZDCP1Energy(event->GetZDCP1Energy());
260 header->SetZDCN2Energy(event->GetZDCN2Energy());
261 header->SetZDCP2Energy(event->GetZDCP2Energy());
262 header->SetZDCEMEnergy(event->GetZDCEMEnergy(0),event->GetZDCEMEnergy(1));
264 Float_t diamxy[2]={event->GetDiamondX(),event->GetDiamondY()};
266 event->GetDiamondCovXY(diamcov);
267 header->SetDiamond(diamxy,diamcov);
268 if (esdevent) header->SetDiamondZ(esdevent->GetDiamondZ(),esdevent->GetSigma2DiamondZ());
269 else if (aodevent) header->SetDiamondZ(aodevent->GetDiamondZ(),aodevent->GetSigma2DiamondZ());
273 Int_t nVertices = 1 ;/* = prim. vtx*/;
274 Int_t nCaloClus = event->GetNumberOfCaloClusters();
276 AODEvent()->ResetStd(0, nVertices, 0, 0, 0, nCaloClus, 0, 0);
278 // Access to the AOD container of vertices
279 TClonesArray &vertices = *(AODEvent()->GetVertices());
282 // Add primary vertex. The primary tracks will be defined
283 // after the loops on the composite objects (V0, cascades, kinks)
284 event->GetPrimaryVertex()->GetXYZ(pos);
287 esdevent->GetPrimaryVertex()->GetCovMatrix(covVtx);
288 chi = esdevent->GetPrimaryVertex()->GetChi2toNDF();
291 aodevent->GetPrimaryVertex()->GetCovMatrix(covVtx);
292 chi = aodevent->GetPrimaryVertex()->GetChi2perNDF();//Different from ESD?
295 AliAODVertex * primary = new(vertices[jVertices++])
296 AliAODVertex(pos, covVtx, chi, NULL, -1, AliAODVertex::kPrimary);
297 primary->SetName(event->GetPrimaryVertex()->GetName());
298 primary->SetTitle(event->GetPrimaryVertex()->GetTitle());
300 // Access to the AOD container of clusters
301 TClonesArray &caloClusters = *(AODEvent()->GetCaloClusters());
304 //-------------------------------------------
305 //Do Corrections in EMCAL
306 //-------------------------------------------
307 //If EMCAL, and requested, correct energy, position ...
308 //Need to do this in a separate loop before filling the ESDs because of the track matching recalculations
309 if(fCorrect && (fCaloFilter==kEMCAL || fCaloFilter==kBoth) ) {
312 if(fLoadEMCALMatrices){
313 printf("AliAnalysisTaskCaloFilter::UserExec() - Load user defined EMCAL geometry matrices\n");
314 for(Int_t mod=0; mod < (fEMCALGeo->GetEMCGeometry())->GetNumberOfSuperModules(); mod++){
315 if(fEMCALMatrix[mod]){
317 fEMCALMatrix[mod]->Print();
318 fEMCALGeo->SetMisalMatrix(fEMCALMatrix[mod],mod) ;
323 else if(!gGeoManager){
324 printf("AliAnalysisTaskCaloFilter::UserExec() - Get geo matrices from data\n");
325 //Still not implemented in AOD, just a workaround to be able to work at least with ESDs
326 if(!strcmp(event->GetName(),"AliAODEvent")) {
328 printf("AliAnalysisTaskCaloFilter Use ideal geometry, values geometry matrix not kept in AODs.\n");
331 if(DebugLevel() > 1) printf("AliAnalysisTaskCaloFilter Load Misaligned matrices. \n");
332 AliESDEvent* esd = dynamic_cast<AliESDEvent*>(event) ;
334 printf("AliAnalysisTaskCaloFilter::UserExec() - This event does not contain ESDs?");
337 for(Int_t mod=0; mod < (fEMCALGeo->GetEMCGeometry())->GetNumberOfSuperModules(); mod++){
338 //if(DebugLevel() > 1)
339 esd->GetEMCALMatrix(mod)->Print();
340 if(esd->GetEMCALMatrix(mod)) fEMCALGeo->SetMisalMatrix(esd->GetEMCALMatrix(mod),mod) ;
344 }//Load matrices from Data
346 //Recover time dependent corrections, put then in recalibration histograms. Do it once
347 fEMCALRecoUtils->SetTimeDependentCorrections(InputEvent()->GetRunNumber());
353 for (Int_t iClust=0; iClust<nCaloClus; ++iClust) {
355 AliVCluster * cluster = event->GetCaloCluster(iClust);
356 if(cluster->IsPHOS()) continue ;
358 Float_t position[]={0,0,0};
360 printf("Check cluster %d for bad channels and close to border\n",cluster->GetID());
361 if(fEMCALRecoUtils->ClusterContainsBadChannel(fEMCALGeo,cluster->GetCellsAbsId(), cluster->GetNCells())) continue;
362 // if(!fEMCALRecoUtils->CheckCellFiducialRegion(fEMCALGeo, cluster, event->GetEMCALCells())) {
363 // printf("Finally reject\n");
368 printf("Filter, before : i %d, E %f, dispersion %f, m02 %f, m20 %f, distToBad %f\n",iClust,cluster->E(),
369 cluster->GetDispersion(),cluster->GetM02(),cluster->GetM20(), cluster->GetDistanceToBadChannel());
370 cluster->GetPosition(position);
371 printf("Filter, before : i %d, x %f, y %f, z %f\n",cluster->GetID(), position[0], position[1], position[2]);
374 //Recalculate distance to bad channels, if new list of bad channels provided
375 fEMCALRecoUtils->RecalculateClusterDistanceToBadChannel(fEMCALGeo, event->GetEMCALCells(), cluster);
377 if(fEMCALRecoUtils->IsRecalibrationOn()) {
378 fEMCALRecoUtils->RecalibrateClusterEnergy(fEMCALGeo, cluster, event->GetEMCALCells());
379 fEMCALRecoUtils->RecalculateClusterShowerShapeParameters(fEMCALGeo, event->GetEMCALCells(),cluster);
380 fEMCALRecoUtils->RecalculateClusterPID(cluster);
383 fEMCALRecoUtils->RecalculateClusterPosition(fEMCALGeo, event->GetEMCALCells(),cluster);
387 printf("Filter, after : i %d, E %f, dispersion %f, m02 %f, m20 %f, distToBad %f\n",cluster->GetID(),cluster->E(),
388 cluster->GetDispersion(),cluster->GetM02(),cluster->GetM20(), cluster->GetDistanceToBadChannel());
389 cluster->GetPosition(position);
390 printf("Filter, after : i %d, x %f, y %f, z %f\n",cluster->GetID(), position[0], position[1], position[2]);
393 cluster->SetE(fEMCALRecoUtils->CorrectClusterEnergyLinearity(cluster));
396 //Recalculate track-matching
397 fEMCALRecoUtils->FindMatches(event,0,fEMCALGeo);
399 } // corrections in EMCAL
401 //-------------------------------------------
402 // Now loop on clusters to fill AODs
403 //-------------------------------------------
404 for (Int_t iClust=0; iClust<nCaloClus; ++iClust) {
406 AliVCluster * cluster = event->GetCaloCluster(iClust);
408 //Check which calorimeter information we want to keep.
410 if(fCaloFilter!=kBoth){
411 if (fCaloFilter==kPHOS && cluster->IsEMCAL()) continue ;
412 else if(fCaloFilter==kEMCAL && cluster->IsPHOS()) continue ;
415 //Temporary trick, FIXME
416 Float_t dR = cluster->GetTrackDx();
417 Float_t dZ = cluster->GetTrackDz();
419 printf("Original residuals : dZ %f, dR %f\n ",dZ, dR);
420 //--------------------------------------------------------------
421 //If EMCAL and corrections done, get the new matching parameters, do not copy noisy clusters
422 if(cluster->IsEMCAL() && fCorrect && esdevent){
424 printf("Check cluster %d for bad channels and close to border\n",cluster->GetID());
425 if(fEMCALRecoUtils->ClusterContainsBadChannel(fEMCALGeo,cluster->GetCellsAbsId(), cluster->GetNCells())) continue;
427 // if(!fEMCALRecoUtils->CheckCellFiducialRegion(fEMCALGeo, cluster, event->GetEMCALCells())) {
428 // printf("Finally reject\n");
432 if(fEMCALRecoUtils->IsRejectExoticCluster() && fEMCALRecoUtils->IsExoticCluster(cluster)) continue;
434 fEMCALRecoUtils->GetMatchedResiduals(cluster->GetID(),dR,dZ);
435 cluster->SetTrackDistance(dR,dZ);
438 if(DebugLevel() > 2){
439 if(cluster->IsEMCAL()) printf("EMCAL Track-Cluster Residuals : dZ %f, dR %f\n ",dZ, dR);
440 if(cluster->IsPHOS()) printf("PHOS Track-Cluster Residuals : dZ %f, dR %f\n ",dZ, dR);
443 //--------------------------------------------------------------
447 Int_t id = cluster->GetID();
448 Float_t energy = cluster->E();
449 cluster->GetPosition(posF);
451 AliAODCaloCluster *caloCluster = new(caloClusters[jClusters++])
452 AliAODCaloCluster(id,
453 cluster->GetNLabels(),
454 cluster->GetLabels(),
460 caloCluster->SetChi2(dZ);//Temporary trick, FIXME
461 caloCluster->SetCaloCluster(cluster->GetDistanceToBadChannel(),
462 cluster->GetDispersion(),
463 cluster->GetM20(), cluster->GetM02(),
464 dR, //Temporary trick, FIXME
465 cluster->GetNExMax(),cluster->GetTOF()) ;
467 caloCluster->SetPIDFromESD(cluster->GetPID());
468 caloCluster->SetNCells(cluster->GetNCells());
469 caloCluster->SetCellsAbsId(cluster->GetCellsAbsId());
470 caloCluster->SetCellsAmplitudeFraction(cluster->GetCellsAmplitudeFraction());
474 printf("Filter, aod : i %d, E %f, dispersion %f, m02 %f, m20 %f\n",caloCluster->GetID(),caloCluster->E(),
475 caloCluster->GetDispersion(),caloCluster->GetM02(),caloCluster->GetM20());
476 caloCluster->GetPosition(posF);
477 printf("Filter, aod : i %d, x %f, y %f, z %f\n",caloCluster->GetID(), posF[0], posF[1], posF[2]);
480 //Matched tracks, just to know if there was any match, the track pointer is useless.
481 //Temporary trick, FIXME
483 if(TMath::Abs(dR) < 990 && TMath::Abs(dZ) < 990) { //Default value in PHOS 999, in EMCAL 1024, why?
485 printf("*** Cluster Track-Matched *** dR %f, dZ %f\n",caloCluster->GetEmcCpvDistance(),caloCluster->Chi2());
486 caloCluster->AddTrackMatched(0x0);
487 }// fill the array with one entry to signal a possible match
488 //TArrayI* matchedT = ((AliESDCaloCluster*)cluster)->GetTracksMatched();
489 //if (InputEvent()->GetNumberOfTracks() > 0 && matchedT && cluster->GetTrackMatchedIndex() >= 0) {
490 // for (Int_t im = 0; im < matchedT->GetSize(); im++) {
491 // Int_t iESDtrack = matchedT->At(im);;
492 // if ((AliVTrack*)InputEvent()->GetTrack(iESDtrack) != 0) {
493 // caloCluster->AddTrackMatched((AliVTrack*)InputEvent()->GetTrack(iESDtrack));
496 //}// There is at least a match with a track
499 caloClusters.Expand(jClusters); // resize TObjArray to 'remove' slots for pseudo clusters
500 // end of loop on calo clusters
502 // fill EMCAL cell info
503 if ((fCaloFilter==kBoth || fCaloFilter==kEMCAL) && event->GetEMCALCells()) { // protection against missing ESD information
504 AliVCaloCells &eventEMcells = *(event->GetEMCALCells());
505 Int_t nEMcell = eventEMcells.GetNumberOfCells() ;
507 AliAODCaloCells &aodEMcells = *(AODEvent()->GetEMCALCells());
508 aodEMcells.CreateContainer(nEMcell);
509 aodEMcells.SetType(AliVCaloCells::kEMCALCell);
510 Double_t calibFactor = 1.;
511 for (Int_t iCell = 0; iCell < nEMcell; iCell++) {
512 Int_t imod = -1, iphi =-1, ieta=-1,iTower = -1, iIphi = -1, iIeta = -1;
513 fEMCALGeo->GetCellIndex(eventEMcells.GetCellNumber(iCell),imod,iTower,iIphi,iIeta);
514 fEMCALGeo->GetCellPhiEtaIndexInSModule(imod,iTower,iIphi, iIeta,iphi,ieta);
516 if(fCorrect && fEMCALRecoUtils->IsRecalibrationOn()){
517 calibFactor = fEMCALRecoUtils->GetEMCALChannelRecalibrationFactor(imod,ieta,iphi);
520 if(!fEMCALRecoUtils->GetEMCALChannelStatus(imod, ieta, iphi)){ //Channel is not declared as bad
521 aodEMcells.SetCell(iCell,eventEMcells.GetCellNumber(iCell),eventEMcells.GetAmplitude(iCell)*calibFactor);
522 //printf("GOOD channel\n");
525 aodEMcells.SetCell(iCell,eventEMcells.GetCellNumber(iCell),0);
526 //printf("BAD channel\n");
532 // fill PHOS cell info
533 if ((fCaloFilter==kBoth || fCaloFilter==kPHOS) && event->GetPHOSCells()) { // protection against missing ESD information
534 AliVCaloCells &eventPHcells = *(event->GetPHOSCells());
535 Int_t nPHcell = eventPHcells.GetNumberOfCells() ;
537 AliAODCaloCells &aodPHcells = *(AODEvent()->GetPHOSCells());
538 aodPHcells.CreateContainer(nPHcell);
539 aodPHcells.SetType(AliVCaloCells::kPHOSCell);
540 for (Int_t iCell = 0; iCell < nPHcell; iCell++) {
541 aodPHcells.SetCell(iCell,eventPHcells.GetCellNumber(iCell),eventPHcells.GetAmplitude(iCell));
546 PostData(1, fEventNtuple);
551 //____________________________________________________________________________
552 Bool_t AliAnalysisTaskCaloFilter::CheckForPrimaryVertex(){
553 //Check if the vertex was well reconstructed, copy from V0Reader of conversion group
554 //It only works for ESDs
556 AliESDEvent * event = dynamic_cast<AliESDEvent*> (InputEvent());
557 if(!event) return kFALSE;
559 if(event->GetPrimaryVertexTracks()->GetNContributors() > 0) {
563 if(event->GetPrimaryVertexTracks()->GetNContributors() < 1) {
565 if(event->GetPrimaryVertexSPD()->GetNContributors() > 0) {
566 //cout<<"spd vertex type::"<< fESDEvent->GetPrimaryVertex()->GetName() << endl;
570 if(event->GetPrimaryVertexSPD()->GetNContributors() < 1) {
571 // cout<<"bad vertex type::"<< fESDEvent->GetPrimaryVertex()->GetName() << endl;
580 //_____________________________________________________
581 void AliAnalysisTaskCaloFilter::PrintInfo(){
585 printf("TASK: AnalysisCaloFilter \n");
586 printf("\t Not only filter, correct Clusters? %d\n",fCorrect);
587 printf("\t Calorimeter Filtering Option ? %d\n",fCaloFilter);
588 //printf("\t Use handmade geo matrices? EMCAL %d, PHOS %d\n",fLoadEMCALMatrices, fLoadPHOSMatrices);
589 printf("\t Use handmade geo matrices? EMCAL %d, PHOS 0\n",fLoadEMCALMatrices);
592 //_____________________________________________________
593 //void AliAnalysisTaskCaloFilter::LocalInit()
595 // // Local Initialization
597 // // Create cuts/param objects and publish to slot
598 // const Int_t buffersize = 255;
599 // char onePar[buffersize] ;
600 // fCuts = new TList();
602 // snprintf(onePar,buffersize, "Calorimeter Filtering Option %d", fCaloFilter) ;
603 // fCuts->Add(new TObjString(onePar));
604 // snprintf(onePar,buffersize, "Not only filter but correct? %d cells;", fCorrect) ;
605 // fCuts->Add(new TObjString(onePar));
608 // PostData(2, fCuts);
613 //__________________________________________________
614 void AliAnalysisTaskCaloFilter::Terminate(Option_t */*option*/)
616 // Terminate analysis
618 if (fDebug > 1) printf("AnalysisCaloFilter: Terminate() \n");