AliPhysics  5eaf189 (5eaf189)
AddTaskCaloFilter.C
Go to the documentation of this file.
1 
13 // Set includes for compilation
14 
15 #if !defined(__CINT__) || defined(__MAKECINT__)
16 
17 #include <TString.h>
18 #include <TROOT.h>
19 
21 #include "AliAnalysisManager.h"
22 #include "AliInputEventHandler.h"
23 #include "AliEMCALRecoUtils.h"
24 
25 #endif
26 
42 ( const Bool_t bias = kTRUE
43  , const Bool_t mc = kFALSE
44  , const Float_t minE = 6.
45  , const Int_t minN = 3
46  , const Float_t vz = 10.
47  , const Int_t opt = 0
48  //AliAnalysisTaskCaloFilter::kBoth,kPHOS, kEMCAL or kBoth
49  , const Bool_t correct = kFALSE
50  , const Bool_t fillTrack = kFALSE
51  , const Bool_t fillAOD = kTRUE)
52 {
53 
54  // Get the pointer to the existing analysis manager via the static access method.
55  //==============================================================================
56  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
57  if (!mgr)
58  {
59  ::Error("AddTaskCaloFilter", "No analysis manager to connect to.");
60  return NULL;
61  }
62 
63  // Check the analysis type using the event handlers connected to the analysis manager.
64  //==============================================================================
65  if (!mgr->GetInputEventHandler())
66  {
67  ::Error("AddTaskCaloFilter", "This task requires an input event handler");
68  return NULL;
69  }
70 
71  // Set the output AOD handler
72  //
73  printf("AddTaskCaloFilter --- Init output handler ---\n");
74 
75  AliAODHandler* aodoutHandler = new AliAODHandler();
76  aodoutHandler->SetOutputFileName("AliAOD.EMCAL.root");
77  //aodoutHandler->SetCreateNonStandardAOD();
78  mgr->SetOutputEventHandler(aodoutHandler);
79 
80  // Configure the task
81  //
82  printf("AddTaskCaloFilter --- Init task ---\n");
83 
84  AliAnalysisTaskCaloFilter * filter = new AliAnalysisTaskCaloFilter("CaloFilter");
85 
86  //filter->SetDebugLevel(2);
87 
88  filter->SetCaloFilter(opt); //kPHOS, kEMCAL or kBoth
89 
90  filter->SetVzCut(vz);
91 
92  if(mc)
93  {
94  filter->SetEventSelection(1,0,0); // Select events depending on EMCAL, PHOS and tracks criteria
95  filter->SwitchOnAcceptAllMBEvent();
96 
97  filter->SwitchOnFillMCParticles();
98 
99  filter->SetEMCALEnergyCut(minE);
100  filter->SetEMCALNcellsCut(minN);
101 
102  filter->SetPHOSEnergyCut(minE);
103  filter->SetPHOSNcellsCut(minN);
104 
105  filter->SetTrackPtCut(minE);
106  printf("AddTaskCaloFilter --- Select MC events with bias in EMCal ---\n");
107  }
108  else if(bias) // select events with significant signal in EMCAL or TPC or PHOS
109  {
110  filter->SetEventSelection(1,0,0); // Select events depending on EMCAL, PHOS and tracks criteria
111  filter->SwitchOnAcceptAllMBEvent();
112 
113  filter->SetEMCALEnergyCut(minE);
114  filter->SetEMCALNcellsCut(minN);
115 
116  filter->SetPHOSEnergyCut(minE);
117  filter->SetPHOSNcellsCut(minN);
118 
119  filter->SetTrackPtCut(minE);
120 
121  //filter->SetMBTriggerMask(AliVEvent::kAnyINT);
122  filter->SetMBTriggerMask(AliVEvent::kINT7); // not working for all productions
123 
124  filter->SelectCollisionCandidates(AliVEvent::kAny) ;
125 
126  printf("AddTaskCaloFilter --- Select events with bias in EMCal ---\n");
127  }
128  else // Do not bias the signal in EMCAL, select MB events
129  {
130 
131  filter->SetEventSelection(0,0,0);
132  filter->SwitchOnAcceptAllMBEvent();
133 
134  filter->SetEMCALEnergyCut(-1);
135  filter->SetEMCALNcellsCut(0);
136 
137  filter->SetPHOSEnergyCut(-1);
138  filter->SetPHOSNcellsCut(0);
139 
140  filter->SetTrackPtCut(-1);
141 
142  filter->SelectCollisionCandidates(AliVEvent::kINT7);// | AliVEvent::kCentral | AliVEvent::kSemiCentral ) ;
143 
144  printf("AddTaskCaloFilter --- Select INT7 events ---\n");
145  }
146 
147  // Activate the cluster corrections (calibration, bad map...)
148  //
149  if(correct) filter->SwitchOnClusterCorrection();
150  else filter->SwitchOffClusterCorrection();
151 
152  // Exoticity cut settings
153  //
154  AliEMCALRecoUtils * reco = filter->GetEMCALRecoUtils();
156  reco->SetExoticCellFractionCut(0.97);
158 
159  // Track storing
160  //
161  if(fillTrack) { filter->SwitchOnFillTracks() ; filter->SwitchOnFillHybridTracks() ; }
162  else { filter->SwitchOffFillTracks() ; filter->SwitchOffFillHybridTracks() ; }
163 
164  // Other options to store in event
165  //
166  filter->SwitchOffFillv0s() ; // Put ON if you know what you do.
167 
168  filter->SwitchOnFillVZERO(); // Be able to recalculate centrality and event plane
169  // afterwards even it is stored in header
170 
171  // AOD output storing
172  //
173  if(fillAOD) filter->SwitchOnFillAODFile();
174  else filter->SwitchOffFillAODFile();
175 
176  // Pass the task to the manager, print first set parameters
177  filter->PrintInfo();
178 
179  mgr->AddTask(filter);
180 
181  // Create containers for input/output
182  //
183  printf("AddTaskCaloFilter --- Created input/output containers ---\n");
184 
185  AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
186  AliAnalysisDataContainer *coutput1 = mgr->GetCommonOutputContainer();
187 
188  printf("AddTaskCaloFilter --- Created containers, add them ---\n");
189 
190  mgr->ConnectInput (filter, 0, cinput1 );
191  mgr->ConnectOutput (filter, 0, coutput1 );
192 
193  printf("AddTaskCaloFilter --- End ---\n");
194 
195  return filter;
196 
197 }
198 
void SetEventSelection(Bool_t emcal, Bool_t phos, Bool_t track)
AliEMCALRecoUtils * GetEMCALRecoUtils() const
Some utilities for cluster and cell treatment.
int Int_t
Definition: External.C:63
AliAnalysisTaskCaloFilter * AddTaskCaloFilter(const Bool_t bias=kTRUE, const Bool_t mc=kFALSE, const Float_t minE=6., const Int_t minN=3, const Float_t vz=10., const Int_t opt=0, const Bool_t correct=kFALSE, const Bool_t fillTrack=kFALSE, const Bool_t fillAOD=kTRUE)
float Float_t
Definition: External.C:68
Filter Calorimeter ESDs into AODs.
void SwitchOnRejectExoticCluster()
void SetExoticCellMinAmplitudeCut(Float_t ma)
void SetExoticCellFractionCut(Float_t f)
bool Bool_t
Definition: External.C:53