AliPhysics  ec7afe5 (ec7afe5)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AddTaskCaloFilter.C
Go to the documentation of this file.
1 
22  const Bool_t mc = kFALSE,
23  const Float_t minE = 6,
24  const Float_t minN = 3,
25  const Float_t vz = 10.,
26  const Int_t opt = AliAnalysisTaskCaloFilter::kBoth, //kPHOS, kEMCAL or kBoth
27  const Bool_t correct = kFALSE,
28  const Bool_t fillTrack = kTRUE,
29  const Bool_t fillAOD = kTRUE)
30 {
31 
32  // Get the pointer to the existing analysis manager via the static access method.
33  //==============================================================================
34  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
35  if (!mgr)
36  {
37  ::Error("AddTaskCaloFilter", "No analysis manager to connect to.");
38  return NULL;
39  }
40 
41  // Check the analysis type using the event handlers connected to the analysis manager.
42  //==============================================================================
43  if (!mgr->GetInputEventHandler())
44  {
45  ::Error("AddTaskCaloFilter", "This task requires an input event handler");
46  return NULL;
47  }
48 
49  AliAnalysisTaskCaloFilter * filter = new AliAnalysisTaskCaloFilter("CaloFilter");
50 
51  //filter->SetDebugLevel(2);
52 
53  filter->SetCaloFilter(opt); //kPHOS, kEMCAL or kBoth
54 
55  filter->SetVzCut(vz);
56 
57  if(mc)
58  {
59  filter->SetEventSelection(1,0,0); // Select events depending on EMCAL, PHOS and tracks criteria
60  filter->SwitchOnAcceptAllMBEvent();
61 
62  filter->SwitchOnFillMCParticles();
63 
64  filter->SetEMCALEnergyCut(minE);
65  filter->SetEMCALNcellsCut(minN);
66 
67  filter->SetPHOSEnergyCut(minE);
68  filter->SetPHOSNcellsCut(minN);
69 
70  filter->SetTrackPtCut(minE);
71  }
72  else if(bias) // select events with significant signal in EMCAL or TPC or PHOS
73  {
74  filter->SetEventSelection(1,0,0); // Select events depending on EMCAL, PHOS and tracks criteria
75  filter->SwitchOnAcceptAllMBEvent();
76 
77  filter->SetEMCALEnergyCut(minE);
78  filter->SetEMCALNcellsCut(minN);
79 
80  filter->SetPHOSEnergyCut(minE);
81  filter->SetPHOSNcellsCut(minN);
82 
83  filter->SetTrackPtCut(minE);
84 
85  //filter->SetMBTriggerMask(AliVEvent::kAnyINT);
86  filter->SetMBTriggerMask(AliVEvent::kMB); // not working for all productions
87 
88  filter->SelectCollisionCandidates(AliVEvent::kAny) ;
89 
90  printf("--- Select events with 1 cluster with at least %2.2f GeV and N = %d ---\n",minE,minN);
91  }
92  else // Do not bias the signal in EMCAL, select MB events
93  {
94 
95  filter->SetEventSelection(0,0,0);
96  filter->SwitchOnAcceptAllMBEvent();
97 
98  filter->SetEMCALEnergyCut(-1);
99  filter->SetEMCALNcellsCut(0);
100 
101  filter->SetPHOSEnergyCut(-1);
102  filter->SetPHOSNcellsCut(0);
103 
104  filter->SetTrackPtCut(-1);
105 
106  filter->SelectCollisionCandidates(AliVEvent::kMB);// | AliVEvent::kCentral | AliVEvent::kSemiCentral ) ;
107 
108  printf("--- Select Min Bias events ---\n");
109  }
110 
111 
112  // filter->SelectCollisionCandidates(AliVEvent::kAny) ;
113 
114  if(correct) filter->SwitchOnClusterCorrection();
115  else filter->SwitchOffClusterCorrection();
116 
117  AliEMCALRecoUtils * reco = filter->GetEMCALRecoUtils();
118  reco->SwitchOnRejectExoticCluster() ;
119  reco->SetExoticCellFractionCut(0.97);
120  reco->SetExoticCellMinAmplitudeCut(4.);
121 
122  if(fillTrack) { filter->SwitchOnFillTracks() ; filter->SwitchOnFillHybridTracks() ; }
123  else { filter->SwitchOffFillTracks() ; filter->SwitchOffFillHybridTracks() ; }
124 
125  filter->SwitchOffFillv0s() ; // Put ON if you know what you do.
126 
127  filter->SwitchOnFillVZERO(); // Be able to recalculate centrality and event plane afterwards even it is stored in header
128 
129  if(fillAOD) filter->SwitchOnFillAODFile();
130  else filter->SwitchOffFillAODFile();
131 
132  filter->PrintInfo();
133 
134  mgr->AddTask(filter);
135 
136  // Create containers for input/output
137  AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
138  AliAnalysisDataContainer *coutput1 = mgr->GetCommonOutputContainer();
139 
140  mgr->ConnectInput (filter, 0, cinput1);
141  mgr->ConnectOutput (filter, 0, coutput1 );
142 
143  return filter;
144 
145 }
void SetEventSelection(Bool_t emcal, Bool_t phos, Bool_t track)
AliEMCALRecoUtils * GetEMCALRecoUtils() const
int Int_t
Definition: External.C:63
float Float_t
Definition: External.C:68
Filter Calorimeter ESDs into AODs.
AliAnalysisTaskCaloFilter * AddTaskCaloFilter(const Bool_t bias=kTRUE, const Bool_t mc=kFALSE, const Float_t minE=6, const Float_t minN=3, const Float_t vz=10., const Int_t opt=AliAnalysisTaskCaloFilter::kBoth, const Bool_t correct=kFALSE, const Bool_t fillTrack=kTRUE, const Bool_t fillAOD=kTRUE)
bool Bool_t
Definition: External.C:53