AliPhysics  a3be53f (a3be53f)
AliAnalysisTaskConvJet.h
Go to the documentation of this file.
1 #ifndef AliAnalysisTaskConvJet_H
2 #define AliAnalysisTaskConvJet_H
3 
11 /* Copyright(c) 1998-2016, ALICE Experiment at CERN, All rights reserved. *
12  * See cxx source for full Copyright notice */
13 
14 using namespace std;
16 #include "THistManager.h"
17 
27  public:
28 
30  AliAnalysisTaskConvJet(const char *name, Int_t IsMC) ;
32  delete fJetNameArray;
33  delete fTrueJetNameArray;
34  delete fTrainconfigArray;
35  delete fTrueTrainconfigArray;
36  }
37 
38  void UserCreateOutputObjects() ;
39  void Terminate(Option_t *option) ;
40 
41  static AliAnalysisTaskConvJet* AddTask_GammaConvJet(
42  const char *ntracks = "usedefault",
43  const char *nclusters = "usedefault",
44  const char* ncells = "usedefault",
45  const char *suffix = "",
46  Int_t IsMC = 0,
47  Int_t NContainers = 0);
48 
49  void SetNumberOfContainers(Int_t NContainers){
50  if(fIsMC == 0){
51  fNJetContainers = NContainers;
52  fTrainconfigArray = new Int_t[fNJetContainers];
53  fJetNameArray = new TString[fNJetContainers];
54  }else{
55  fNJetContainers = NContainers/2;
56  fNTrueJetContainers = NContainers/2;
57  fTrainconfigArray = new Int_t[fNJetContainers];
58  fJetNameArray = new TString[fNJetContainers];
59  fTrueTrainconfigArray = new Int_t[fNTrueJetContainers];
60  fTrueJetNameArray = new TString[fNTrueJetContainers];
61  }
62  }
63 
64  void AddJetContainerwithTrainConfig(TString JetContainerName, Int_t Trainconfig, Double_t Radius){
65  TString Add = "_";
66  Add.Append(JetContainerName);
67  Add.Append("_pT1000");
68  Bool_t ContainerAlreadyAdded = kFALSE;
69  for(Int_t i = 0; i < fJetContainersAdded; i++){
70  if(Add == fJetNameArray[i]){
71  ContainerAlreadyAdded = kTRUE;
72  }
73  }
74  if(fJetContainersAdded < fNJetContainers){
75  if(!ContainerAlreadyAdded){
76  AddJetContainer(JetContainerName, AliEmcalJet::kTPCfid, Radius);
77  }
78  fJetNameArray[fJetContainersAdded] = Add;
79  fTrainconfigArray[fJetContainersAdded] = Trainconfig;
80  vector<Double_t> JetPt;
81  fListJetPt.push_back(JetPt);
82  vector<Double_t> JetPx;
83  fListJetPx.push_back(JetPx);
84  vector<Double_t> JetPy;
85  fListJetPy.push_back(JetPy);
86  vector<Double_t> JetPz;
87  fListJetPz.push_back(JetPz);
88  vector<Double_t> JetEta;
89  fListJetEta.push_back(JetEta);
90  vector<Double_t> JetPhi;
91  fListJetPhi.push_back(JetPhi);
92  vector<Double_t> JetArea;
93  fListJetArea.push_back(JetArea);
94  fListNJets.push_back(0);
95  fJetContainersAdded++;
96  }
97  }
98 
99  void AddTrueandRecJetContainerwithTrainConfig(TString RecJetContainerName, TString TrueJetContainerName, Int_t Trainconfig, Double_t Radius){
100  AliJetContainer* jetContRec;
101  AliJetContainer* jetContTrue;
102  TString AddRec = "_";
103  AddRec.Append(RecJetContainerName);
104  AddRec.Append("_pT1000");
105  TString AddTrue = "_";
106  AddTrue.Append(TrueJetContainerName);
107  AddTrue.Append("_pT1000");
108  Bool_t ContainerAlreadyAdded = kFALSE;
109  for(Int_t i = 0; i < fJetContainersAdded; i++){
110  if(AddRec == fJetNameArray[i]){
111  ContainerAlreadyAdded = kTRUE;
112  }
113  }
114  if(fJetContainersAdded < fNJetContainers){
115  if(!ContainerAlreadyAdded){
116  jetContRec = AddJetContainer(RecJetContainerName, AliEmcalJet::kTPCfid, Radius);
117  }
118  fJetNameArray[fJetContainersAdded] = AddRec;
119  fTrainconfigArray[fJetContainersAdded] = Trainconfig;
120  vector<Double_t> JetPt;
121  fListJetPt.push_back(JetPt);
122  vector<Double_t> JetPx;
123  fListJetPx.push_back(JetPx);
124  vector<Double_t> JetPy;
125  fListJetPy.push_back(JetPy);
126  vector<Double_t> JetPz;
127  fListJetPz.push_back(JetPz);
128  vector<Double_t> JetEta;
129  fListJetEta.push_back(JetEta);
130  vector<Double_t> JetPhi;
131  fListJetPhi.push_back(JetPhi);
132  vector<Double_t> JetArea;
133  fListJetArea.push_back(JetArea);
134  fListNJets.push_back(0);
135  fJetContainersAdded++;
136  }
137  if(fTrueJetContainersAdded < fNTrueJetContainers){
138  if(!ContainerAlreadyAdded){
139  AliParticleContainer *trackCont = AddParticleContainer("tracks");
140  AliClusterContainer *clusterCont = AddClusterContainer("caloClusters");
141  jetContRec->ConnectParticleContainer(trackCont);
142  jetContRec->ConnectClusterContainer(clusterCont);
143  jetContTrue = AddJetContainer(TrueJetContainerName, AliEmcalJet::kTPCfid, Radius);
144  jetContTrue->ConnectParticleContainer(trackCont);
145  jetContTrue->ConnectClusterContainer(clusterCont);
146  }
147  fTrueJetNameArray[fTrueJetContainersAdded] = AddTrue;
148  fTrueTrainconfigArray[fTrueJetContainersAdded] = Trainconfig;
149  vector<Double_t> JetPt;
150  fListTrueJetPt.push_back(JetPt);
151  vector<Double_t> JetPx;
152  fListTrueJetPx.push_back(JetPx);
153  vector<Double_t> JetPy;
154  fListTrueJetPy.push_back(JetPy);
155  vector<Double_t> JetPz;
156  fListTrueJetPz.push_back(JetPz);
157  vector<Double_t> JetEta;
158  fListTrueJetEta.push_back(JetEta);
159  vector<Double_t> JetPhi;
160  fListTrueJetPhi.push_back(JetPhi);
161  vector<Double_t> JetArea;
162  fListTrueJetArea.push_back(JetArea);
163  fListTrueNJets.push_back(0);
164  fTrueJetContainersAdded++;
165  }
166  }
167 
168  Double_t GetNJets(Int_t Trainconfig) {
169  Int_t NJets = 0;
170  for(Int_t i = 0; i < fNJetContainers; i++){
171  if(Trainconfig == fTrainconfigArray[i]){
172  NJets = fListNJets.at(i);
173  break;
174  }
175  }
176  return NJets;
177 }
178  vector<Double_t> GetVectorJetPt(Int_t Trainconfig){
179  vector<Double_t> VectorJetPt;
180  for(Int_t i = 0; i < fNJetContainers; i++){
181  if(Trainconfig == fTrainconfigArray[i]){
182  VectorJetPt = fListJetPt.at(i);
183  break;
184  }
185  }
186  return VectorJetPt;
187 }
188  vector<Double_t> GetVectorJetPx(Int_t Trainconfig){
189  vector<Double_t> VectorJetPx;
190  for(Int_t i = 0; i < fNJetContainers; i++){
191  if(Trainconfig == fTrainconfigArray[i]){
192  VectorJetPx = fListJetPx.at(i);
193  break;
194  }
195  }
196  return VectorJetPx;
197 }
198  vector<Double_t> GetVectorJetPy(Int_t Trainconfig){
199  vector<Double_t> VectorJetPy;
200  for(Int_t i = 0; i < fNJetContainers; i++){
201  if(Trainconfig == fTrainconfigArray[i]){
202  VectorJetPy = fListJetPy.at(i);
203  break;
204  }
205  }
206  return VectorJetPy;
207 }
208  vector<Double_t> GetVectorJetPz(Int_t Trainconfig){
209  vector<Double_t> VectorJetPz;
210  for(Int_t i = 0; i < fNJetContainers; i++){
211  if(Trainconfig == fTrainconfigArray[i]){
212  VectorJetPz = fListJetPz.at(i);
213  break;
214  }
215  }
216  return VectorJetPz;
217 }
218  vector<Double_t> GetVectorJetEta(Int_t Trainconfig){
219  vector<Double_t> VectorJetEta;
220  for(Int_t i = 0; i < fNJetContainers; i++){
221  if(Trainconfig == fTrainconfigArray[i]){
222  VectorJetEta = fListJetEta.at(i);
223  break;
224  }
225  }
226  return VectorJetEta;
227 }
228  vector<Double_t> GetVectorJetPhi(Int_t Trainconfig){
229  vector<Double_t> VectorJetPhi;
230  for(Int_t i = 0; i < fNJetContainers; i++){
231  if(Trainconfig == fTrainconfigArray[i]){
232  VectorJetPhi = fListJetPhi.at(i);
233  break;
234  }
235  }
236  return VectorJetPhi;
237 }
238  vector<Double_t> GetVectorJetArea(Int_t Trainconfig){
239  vector<Double_t> VectorJetArea;
240  for(Int_t i = 0; i < fNJetContainers; i++){
241  if(Trainconfig == fTrainconfigArray[i]){
242  VectorJetArea = fListJetArea.at(i);
243  break;
244  }
245  }
246  return VectorJetArea;
247 }
248 //------------------------------------------------------------------
249  Double_t GetTrueNJets(Int_t Trainconfig) {
250  Int_t NJets = 0;
251  for(Int_t i = 0; i < fNTrueJetContainers; i++){
252  if(Trainconfig == fTrueTrainconfigArray[i]){
253  NJets = fListTrueNJets.at(i);
254  break;
255  }
256  }
257  return NJets;
258 }
259  vector<Double_t> GetTrueVectorJetPt(Int_t Trainconfig){
260  vector<Double_t> VectorJetPt;
261  for(Int_t i = 0; i < fNTrueJetContainers; i++){
262  if(Trainconfig == fTrueTrainconfigArray[i]){
263  VectorJetPt = fListTrueJetPt.at(i);
264  break;
265  }
266  }
267  return VectorJetPt;
268 }
269  vector<Double_t> GetTrueVectorJetPx(Int_t Trainconfig){
270  vector<Double_t> VectorJetPx;
271  for(Int_t i = 0; i < fNTrueJetContainers; i++){
272  if(Trainconfig == fTrueTrainconfigArray[i]){
273  VectorJetPx = fListTrueJetPx.at(i);
274  break;
275  }
276  }
277  return VectorJetPx;
278 }
279  vector<Double_t> GetTrueVectorJetPy(Int_t Trainconfig){
280  vector<Double_t> VectorJetPy;
281  for(Int_t i = 0; i < fNTrueJetContainers; i++){
282  if(Trainconfig == fTrueTrainconfigArray[i]){
283  VectorJetPy = fListTrueJetPy.at(i);
284  break;
285  }
286  }
287  return VectorJetPy;
288 }
289  vector<Double_t> GetTrueVectorJetPz(Int_t Trainconfig){
290  vector<Double_t> VectorJetPz;
291  for(Int_t i = 0; i < fNTrueJetContainers; i++){
292  if(Trainconfig == fTrueTrainconfigArray[i]){
293  VectorJetPz = fListTrueJetPz.at(i);
294  break;
295  }
296  }
297  return VectorJetPz;
298 }
299  vector<Double_t> GetTrueVectorJetEta(Int_t Trainconfig){
300  vector<Double_t> VectorJetEta;
301  for(Int_t i = 0; i < fNTrueJetContainers; i++){
302  if(Trainconfig == fTrueTrainconfigArray[i]){
303  VectorJetEta = fListTrueJetEta.at(i);
304  break;
305  }
306  }
307  return VectorJetEta;
308 }
309  vector<Double_t> GetTrueVectorJetPhi(Int_t Trainconfig){
310  vector<Double_t> VectorJetPhi;
311  for(Int_t i = 0; i < fNTrueJetContainers; i++){
312  if(Trainconfig == fTrueTrainconfigArray[i]){
313  VectorJetPhi = fListTrueJetPhi.at(i);
314  break;
315  }
316  }
317  return VectorJetPhi;
318 }
319  vector<Double_t> GetTrueVectorJetArea(Int_t Trainconfig){
320  vector<Double_t> VectorJetArea;
321  for(Int_t i = 0; i < fNTrueJetContainers; i++){
322  if(Trainconfig == fTrueTrainconfigArray[i]){
323  VectorJetArea = fListTrueJetArea.at(i);
324  break;
325  }
326  }
327  return VectorJetArea;
328 }
329 //------------------------------------------------------------------
331  TString JetName;
332  for(Int_t i = 0; i < fNTrueJetContainers; i++){
333  if(Trainconfig == fTrainconfigArray[i]){
334  JetName = fJetNameArray[i];
335  break;
336  }
337  }
338  AliJetContainer* jetCont = 0;
339  TIter next(&fJetCollArray);
340  Double_t radius = -1;
341  while ((jetCont = static_cast<AliJetContainer*>(next()))) {
342  if(JetName == jetCont->GetTitle()){
343  radius = jetCont->GetJetRadius();
344  break;
345  }
346  }
347  return radius;
348  }
349 
350  protected:
351  void ExecOnce();
352  Bool_t FillHistograms();
353  Bool_t Run();
354  void DoJetLoop();
355 
356  Int_t fIsMC; // Boolean if running on MC
357  Int_t fNJetContainers; // Number of total data/rec jet containers desired to analyse
358  Int_t fNTrueJetContainers; // Number of total true jet containers desired to analyse
359  Int_t fJetContainersAdded; // Number of data/rec jet containers already added to the class
360  Int_t fTrueJetContainersAdded; // Number of true jet containers alreasy added to the class
365 
366  vector<Int_t> fListNJets; // vector of number of jets for each jet container
367  vector<vector<Double_t>> fListJetPt; // vector of vectors containg the jet pt for each jet container
368  vector<vector<Double_t>> fListJetPx; // vector of vectors containg the jet px for each jet container
369  vector<vector<Double_t>> fListJetPy; // vector of vectors containg the jet py for each jet container
370  vector<vector<Double_t>> fListJetPz; // vector of vectors containg the jet pz for each jet container
371  vector<vector<Double_t>> fListJetEta; // vector of vectors containg the jet eta for each jet container
372  vector<vector<Double_t>> fListJetPhi; // vector of vectors containg the jet phi for each jet container
373  vector<vector<Double_t>> fListJetArea; // vector of vectors containg the jet area for each jet container
374 
375  vector<Int_t> fListTrueNJets; // vector of number of true jets for each true jet container
376  vector<vector<Double_t>> fListTrueJetPt; // vector of vectors containg the jet pt for each true jet container
377  vector<vector<Double_t>> fListTrueJetPx; // vector of vectors containg the jet px for each true jet container
378  vector<vector<Double_t>> fListTrueJetPy; // vector of vectors containg the jet py for each true jet container
379  vector<vector<Double_t>> fListTrueJetPz; // vector of vectors containg the jet pz for each true jet container
380  vector<vector<Double_t>> fListTrueJetEta; // vector of vectors containg the jet eta for each true jet container
381  vector<vector<Double_t>> fListTrueJetPhi; // vector of vectors containg the jet phi for each true jet container
382  vector<vector<Double_t>> fListTrueJetArea; // vector of vectors containg the jet area for each true jet container
383 
384  private:
387 
389  ClassDef(AliAnalysisTaskConvJet, 8);
391 };
392 #endif
double Double_t
Definition: External.C:58
vector< Double_t > GetVectorJetArea(Int_t Trainconfig)
vector< vector< Double_t > > fListTrueJetPz
vector< Double_t > GetTrueVectorJetPz(Int_t Trainconfig)
vector< Double_t > GetVectorJetEta(Int_t Trainconfig)
vector< vector< Double_t > > fListTrueJetPhi
vector< Double_t > GetVectorJetPt(Int_t Trainconfig)
vector< vector< Double_t > > fListTrueJetEta
vector< Double_t > GetTrueVectorJetEta(Int_t Trainconfig)
vector< vector< Double_t > > fListJetArea
vector< Double_t > GetTrueVectorJetArea(Int_t Trainconfig)
vector< Double_t > GetTrueVectorJetPt(Int_t Trainconfig)
vector< vector< Double_t > > fListTrueJetPx
Container for particles within the EMCAL framework.
void AddTrueandRecJetContainerwithTrainConfig(TString RecJetContainerName, TString TrueJetContainerName, Int_t Trainconfig, Double_t Radius)
Double_t Get_Jet_Radius(Int_t Trainconfig)
Double_t GetTrueNJets(Int_t Trainconfig)
void AddJetContainerwithTrainConfig(TString JetContainerName, Int_t Trainconfig, Double_t Radius)
TPC fiducial acceptance (each eta edge narrowed by jet R)
Definition: AliEmcalJet.h:68
Int_t * fTrainconfigArray
Array containing all the names of the true jet containers.
vector< vector< Double_t > > fListJetPt
int Int_t
Definition: External.C:63
vector< vector< Double_t > > fListJetPz
vector< vector< Double_t > > fListJetPy
const char * GetTitle() const
vector< vector< Double_t > > fListTrueJetPy
vector< Double_t > GetTrueVectorJetPy(Int_t Trainconfig)
void SetNumberOfContainers(Int_t NContainers)
vector< vector< Double_t > > fListJetEta
vector< Double_t > GetVectorJetPy(Int_t Trainconfig)
void ConnectParticleContainer(AliParticleContainer *c)
vector< Double_t > GetVectorJetPhi(Int_t Trainconfig)
vector< Double_t > GetTrueVectorJetPx(Int_t Trainconfig)
Int_t * fTrueTrainconfigArray
Array of trainconfigs corresponsing to the data/rec jet containers.
vector< vector< Double_t > > fListJetPhi
vector< vector< Double_t > > fListTrueJetPt
Float_t GetJetRadius() const
vector< Double_t > GetTrueVectorJetPhi(Int_t Trainconfig)
Double_t GetNJets(Int_t Trainconfig)
Base task in the EMCAL jet framework.
vector< vector< Double_t > > fListJetPx
const char Option_t
Definition: External.C:48
vector< Double_t > GetVectorJetPz(Int_t Trainconfig)
bool Bool_t
Definition: External.C:53
vector< Double_t > GetVectorJetPx(Int_t Trainconfig)
Implementation of a sample jet analysis task.
void ConnectClusterContainer(AliClusterContainer *c)
Container structure for EMCAL clusters.
vector< vector< Double_t > > fListTrueJetArea
Container for jet within the EMCAL jet framework.
vector< Int_t > fListNJets
Array of trainconfigs corresponsing to the true jet containers.
TString * fTrueJetNameArray
Array containing all the names of the rec/data jet containers.