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