AliPhysics  bba8f44 (bba8f44)
AliJetTriggerSelectionTask.cxx
Go to the documentation of this file.
1 // $Id$
2 //
3 // Jet trigger selection task.
4 //
5 // Author: S.Aiola
6 
7 #include <TLorentzVector.h>
8 #include <TMath.h>
9 #include <TF1.h>
10 
11 #include "AliVEvent.h"
12 #include "AliVCluster.h"
13 #include "AliEmcalJet.h"
14 #include "AliLog.h"
15 #include "AliVVZERO.h"
16 #include "AliESDUtils.h"
17 
19 
21 
22 //________________________________________________________________________
25  fEnergyThreshold(0),
26  fMaxDistance2(0.0225),
27  fTriggerBits(AliVEvent::kEMCEJE),
28  fTaskSettingsOk(kFALSE),
29  fNTriggers(0),
30  fVZERO(0),
31  fV0ATotMult(0),
32  fV0CTotMult(0)
33 {
34  // Default constructor.
35 
36  for (Int_t i = 0; i < 999; i++) {
37  fTrigPos[i][0] = -999;
38  fTrigPos[i][1] = -999;
39  }
40 }
41 
42 //________________________________________________________________________
44  AliAnalysisTaskEmcalJet(name, kFALSE),
45  fEnergyThreshold(0),
46  fMaxDistance2(0.0225),
47  fTriggerBits(AliVEvent::kEMCEJE),
48  fTaskSettingsOk(kFALSE),
49  fNTriggers(0),
50  fVZERO(0),
51  fV0ATotMult(0),
52  fV0CTotMult(0)
53 {
54  // Standard constructor.
55 
56  for (Int_t i = 0; i < 999; i++) {
57  fTrigPos[i][0] = -999;
58  fTrigPos[i][1] = -999;
59  }
60 }
61 
62 //________________________________________________________________________
64 {
65  // Initialize the task.
66 
68 
69  fTaskSettingsOk = kTRUE;
70 
71  fVZERO = InputEvent()->GetVZEROData();
72  if (!fVZERO) {
73  AliError(Form("%s: AliVVZERO not available, task will not be executed!",GetName()));
74  fTaskSettingsOk = kFALSE;
75  }
76 
77  if (GetClusterArray() == 0) {
78  AliError(Form("%s: No cluster collection provided, task will not be executed!",GetName()));
79  fTaskSettingsOk = kFALSE;
80  }
81 
82  if (GetJetArray() == 0) {
83  AliError(Form("%s: No jet collection provided, task will not be executed!",GetName()));
84  fTaskSettingsOk = kFALSE;
85  }
86 
87  if (!fEnergyThreshold) {
88  AliError(Form("%s: No threshold function provided, task will not be executed!",GetName()));
89  fTaskSettingsOk = kFALSE;
90  }
91 }
92 
93 //________________________________________________________________________
95 {
96  // Retrieve event objects.
97 
99  return kFALSE;
100 
101  if (fVZERO) {
102  fV0ATotMult = fVZERO->GetMTotV0A();
103  fV0CTotMult = fVZERO->GetMTotV0C();
104  }
105 
106  return kTRUE;
107 }
108 
109 //________________________________________________________________________
111 {
112  // Run the analysis.
113 
114  if (!fTaskSettingsOk) return kFALSE;
115 
116  FindTriggers();
117  SelectJets();
118 
119  return kTRUE;
120 }
121 
122 //________________________________________________________________________
124 {
125  fNTriggers = 0;
126 
127  Int_t nclusters = GetNClusters();
128 
130 
131  for (Int_t i = 0; i < nclusters; i++) {
132  if (fNTriggers >= 999) {
133  AliError("More than 999 triggers found!");
134  break;
135  }
136 
137  AliVCluster *cluster = GetAcceptClusterFromArray(i);
138  if (!cluster)
139  continue;
140 
141  //Printf("Cluster energy=%.3f, th=%.3f",cluster->E(), th);
142 
143  if (cluster->E() > th) {
144  TLorentzVector vect;
145  cluster->GetMomentum(vect,fVertex);
146  fTrigPos[fNTriggers][0] = vect.Eta();
147  fTrigPos[fNTriggers][1] = vect.Phi();
148  fNTriggers++;
149  }
150  }
151 
152  AliDebug(2,Form("%s: %d triggers found among %d candidates (cent=%.1f, mult=%.1f, th=%.2f)!",GetName(),fNTriggers,nclusters,fCent,fV0ATotMult+fV0CTotMult,th));
153 }
154 
155 //________________________________________________________________________
157 {
158  for (Int_t c = 0; c < fJetCollArray.GetEntriesFast(); c++) {
159 
160  Int_t njets = GetNJets(c);
161 
162  for (Int_t i = 0; i < njets; i++) {
164  if (IsTriggerJet(jet)) jet->AddTrigger(fTriggerBits);
165  }
166  }
167 }
168 
169 //________________________________________________________________________
171 {
172  if (!jet) return kFALSE;
173 
174  for (Int_t i = 0; i < fNTriggers; i++) {
175  Double_t deta = jet->Eta() - fTrigPos[i][0];
176  Double_t dphi = jet->Phi() - fTrigPos[i][1];
177 
178  Double_t d2 = deta * deta + dphi * dphi;
179 
180  if (d2 < fMaxDistance2)
181  return kTRUE;
182  }
183 
184  return kFALSE;
185 }
AliVVZERO * fVZERO
(eta,phi) trigger positions in the current event
void ExecOnce()
Perform steps needed to initialize the analysis.
Double_t fTrigPos[999][2]
number of triggers in the current event
double Double_t
Definition: External.C:58
Bool_t Run()
Run function. This is the core function of the analysis and contains the user code. Therefore users have to implement this function.
Double_t Eta() const
Definition: AliEmcalJet.h:121
Int_t GetNJets(Int_t i=0) const
Double_t Phi() const
Definition: AliEmcalJet.h:117
TCanvas * c
Definition: TestFitELoss.C:172
TClonesArray * GetJetArray(Int_t i=0) const
int Int_t
Definition: External.C:63
Int_t fNTriggers
if false, don&#39;t execute task
Bool_t RetrieveEventObjects()
Retrieve common objects from event.
Double_t fCent
!event centrality
Int_t GetNClusters(Int_t i=0) const
Get number of clusters in the cluster container attached to this task with index i.
AliEmcalJet * GetAcceptJetFromArray(Int_t j, Int_t c=0) const
TObjArray fJetCollArray
jet collection array
Double_t fV0ATotMult
Event V0 object.
Double_t fVertex[3]
!event vertex
TClonesArray * GetClusterArray(Int_t i=0) const
Get TClonesArray with EMCAL clusters.
Base task in the EMCAL jet framework.
Represent a jet reconstructed using the EMCal jet framework.
Definition: AliEmcalJet.h:51
bool Bool_t
Definition: External.C:53
void AddTrigger(UInt_t trigger)
Definition: AliEmcalJet.h:319
AliVCluster * GetAcceptClusterFromArray(Int_t cl, Int_t c=0) const
Get cluster cl if accepted from container c If particle not accepted return 0.
Double_t fV0CTotMult
Event V0A total multiplicity.