AliPhysics  095eea3 (095eea3)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnalysisTaskEmcalJetTree.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-2016, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: The ALICE Off-line Project. *
5  * Contributors are mentioned in the code where appropriate. *
6  * *
7  * Permission to use, copy, modify and distribute this software and its *
8  * documentation strictly for non-commercial purposes is hereby granted *
9  * without fee, provided that the above copyright notice appears in all *
10  * copies and that both the copyright notice and this permission notice *
11  * appear in the supporting documentation. The authors make no claims *
12  * about the suitability of this software for any purpose. It is *
13  * provided "as is" without express or implied warranty. *
14  **************************************************************************/
15 
16 #include "AliLog.h"
18 
19 #include "AliAnalysisManager.h"
20 #include "AliVEventHandler.h"
21 
22 // Definitions of class AliAnalysisTaskEmcalJetTreeBase::AliEmcalJetEventInfoSummaryPbPb
23 
27 
33  fCent(0),
34  fEP(0)
35 {
36  Set(cent, ep);
37 }
38 
41 {
42  fCent = 0;
43  fEP = 0;
44 }
45 
51 {
52  fCent = cent;
53  fEP = ep;
54 }
55 
56 // Definitions of class AliAnalysisTaskEmcalJetTreeBase::AliEmcalJetInfoSummaryPP
57 
61 
66  fPt(0),
67  fEta(0),
68  fPhi(0),
69  fNEF(0),
70  fLeadingPt(0),
71  fNConstituents(0)
72 {
73  Set(source);
74 }
75 
78 {
79  fPt = 0;
80  fEta = 0;
81  fPhi = 0;
82  fNEF = 0;
83  fLeadingPt = 0;
84  fNConstituents = 0;
85 }
86 
91 {
92  fPt = source.Pt();
93  fEta = source.Eta();
94  fPhi = source.Phi_0_2pi();
95  fNEF = source.fNEF;
96  fLeadingPt = source.fLeadingPt;
97  fNConstituents = Char_t(source.fNConstituents);
98 }
99 
100 // Definitions of class AliAnalysisTaskEmcalJetTreeBase::AliEmcalJetInfoSummaryPbPb
101 
105 
110  fPt(0),
111  fEta(0),
112  fPhi(0),
113  fNEF(0),
114  fLeadingPt(0),
115  fArea(0),
116  fNConstituents(0),
117  fCorrPt(0)
118 {
119  Set(source);
120 }
121 
124 {
125  fPt = 0;
126  fEta = 0;
127  fPhi = 0;
128  fNEF = 0;
129  fLeadingPt = 0;
130  fNConstituents = 0;
131  fArea = 0;
132  fNConstituents = 0;
133  fCorrPt = 0;
134 }
135 
140 {
141  fPt = source.Pt();
142  fEta = source.Eta();
143  fPhi = source.Phi_0_2pi();
144  fNEF = source.fNEF;
145  fLeadingPt = source.fLeadingPt;
146  fArea = source.fArea;
147  fNConstituents = Short_t(source.fNConstituents);
148  fCorrPt = source.fCorrPt;
149 }
150 
151 // Definitions of class AliAnalysisTaskEmcalJetTreeBase::AliEmcalJetInfoSummaryPPCharged
152 
156 
161  fPt(0),
162  fEta(0),
163  fPhi(0),
164  fLeadingPt(0),
165  fNConstituents(0)
166 {
167  Set(source);
168 }
169 
172 {
173  fPt = 0;
174  fEta = 0;
175  fPhi = 0;
176  fLeadingPt = 0;
177  fNConstituents = 0;
178 }
179 
184 {
185  fPt = source.Pt();
186  fEta = source.Eta();
187  fPhi = source.Phi_0_2pi();
188  fLeadingPt = source.fLeadingPt;
189  fNConstituents = Char_t(source.fNConstituents);
190 }
191 
192 // Definitions of class AliAnalysisTaskEmcalJetTreeBase::AliEmcalJetInfoSummaryPbPbCharged
193 
197 
202  fPt(0),
203  fEta(0),
204  fPhi(0),
205  fLeadingPt(0),
206  fArea(0),
207  fNConstituents(0),
208  fCorrPt(0)
209 {
210  Set(source);
211 }
212 
215 {
216  fPt = 0;
217  fEta = 0;
218  fPhi = 0;
219  fLeadingPt = 0;
220  fNConstituents = 0;
221  fArea = 0;
222  fNConstituents = 0;
223  fCorrPt = 0;
224 }
225 
230 {
231  fPt = source.Pt();
232  fEta = source.Eta();
233  fPhi = source.Phi_0_2pi();
234  fLeadingPt = source.fLeadingPt;
235  fArea = source.fArea;
236  fNConstituents = Short_t(source.fNConstituents);
237  fCorrPt = source.fCorrPt;
238 }
239 
240 // Definitions of class AliAnalysisTaskEmcalJetTreeBase::AliEmcalJetInfoSummaryEmbedding
241 
245 
250  fPt(0),
251  fEta(0),
252  fPhi(0),
253  fNEF(0),
254  fLeadingPt(0),
255  fArea(0),
256  fNConstituents(0),
257  fCorrPt(0),
258  fMCPt(0)
259 {
260  Set(source);
261 }
262 
265 {
266  fPt = 0;
267  fEta = 0;
268  fPhi = 0;
269  fNEF = 0;
270  fLeadingPt = 0;
271  fNConstituents = 0;
272  fArea = 0;
273  fNConstituents = 0;
274  fCorrPt = 0;
275  fMCPt = 0;
276 }
277 
282 {
283  fPt = source.Pt();
284  fEta = source.Eta();
285  fPhi = source.Phi_0_2pi();
286  fNEF = source.fNEF;
287  fLeadingPt = source.fLeadingPt;
288  fArea = source.fArea;
289  fNConstituents = Short_t(source.fNConstituents);
290  fCorrPt = source.fCorrPt;
291  fMCPt = source.fMCPt;
292 }
293 
294 // Definitions of class AliAnalysisTaskEmcalJetTreeBase
295 
299 
302  fTree(0)
303 {
304  DefineOutput(2, TTree::Class());
306 }
307 
314 {
315  switch (type) {
316  case kJetPP:
317  ::Info("AliAnalysisTaskEmcalJetTreeBase::CreateInstance", "Created an instance of AliAnalysisTaskEmcalJetTree<AliEmcalJetInfoSummaryPP>");
319  break;
320  case kJetPbPb:
321  ::Info("AliAnalysisTaskEmcalJetTreeBase::CreateInstance", "Created an instance of AliAnalysisTaskEmcalJetTree<AliEmcalJetInfoSummaryPbPb>");
323  break;
324  case kJetEmbedding:
325  ::Info("AliAnalysisTaskEmcalJetTreeBase::CreateInstance", "Created an instance of AliAnalysisTaskEmcalJetTree<AliEmcalJetInfoSummaryEmbedding>");
327  break;
328  case kJetPPCharged:
329  ::Info("AliAnalysisTaskEmcalJetTreeBase::CreateInstance", "Created an instance of AliAnalysisTaskEmcalJetTree<AliEmcalJetInfoSummaryPPCharged>");
331  break;
332  case kJetPbPbCharged:
333  ::Info("AliAnalysisTaskEmcalJetTreeBase::CreateInstance", "Created an instance of AliAnalysisTaskEmcalJetTree<AliEmcalJetInfoSummaryPbPbCharged>");
335  break;
336  default:
337  ::Error("AliAnalysisTaskEmcalJetTreeBase::CreateInstance", "Type %d not implemented!", type);
338  return 0;
339  }
340 }
341 
342 // Definitions of class AliAnalysisTaskEmcalJetTree
343 
347 
349 template <class T, class U>
352  fCurrentOutput(0),
353  fCurrentEvent(0)
354 {
355 }
356 
359 template <>
361  AliAnalysisTaskEmcalJetTreeBase("AliAnalysisTaskEmcalJetTree"),
362  fCurrentOutput(0),
363  fCurrentEvent(0)
364 {
365 }
366 
369 template <>
371  AliAnalysisTaskEmcalJetTreeBase("AliAnalysisTaskEmcalJetTree"),
372  fCurrentOutput(0),
373  fCurrentEvent(0)
374 {
375 }
376 
379 template <>
381  AliAnalysisTaskEmcalJetTreeBase("AliAnalysisTaskEmcalJetTree"),
382  fCurrentOutput(0),
383  fCurrentEvent(0)
384 {
385 }
386 
389 template <>
391  AliAnalysisTaskEmcalJetTreeBase("AliAnalysisTaskEmcalJetTree"),
392  fCurrentOutput(0),
393  fCurrentEvent(0)
394 {
395 }
396 
399 template <>
401  AliAnalysisTaskEmcalJetTreeBase("AliAnalysisTaskEmcalJetTree"),
402  fCurrentOutput(0),
403  fCurrentEvent(0)
404 {
405 }
406 
410 template <class T, class U>
413  fCurrentOutput(0),
414  fCurrentEvent(0)
415 {
416 }
417 
421 template <class T, class U>
423 {
424  typename std::map<std::string,std::vector<T> >::iterator it = (fCurrentOutput->insert(std::pair<std::string,std::vector<T> >(jets->GetName(), std::vector<T>()))).first;
425  fTree->Branch(jets->GetName(), &((*it).second));
426 }
427 
429 template <class T, class U>
431 {
432  fCurrentOutput = new std::map<std::string, std::vector<T> >();
433  fCurrentEvent = new U();
434  TString treeName = TString::Format("%s_jets", GetName());
435  fTree = new TTree(treeName, treeName);
436  fTree->Branch("Event", &fCurrentEvent);
437 
439 
440  PostData(2, fTree);
441 }
442 
446 template <class T, class U>
448 {
449  static typename std::map<std::string, std::vector<T> >::iterator it = fCurrentOutput->end();
450 
451  if (it == fCurrentOutput->end() || TString(jets->GetName()) != it->first) {
452  it = fCurrentOutput->find(jets->GetName());
453  if (it == fCurrentOutput->end()) return;
454  }
455 
456  it->second.push_back(T(jet));
457 }
458 
462 template <class T, class U>
464 {
465  typedef typename std::map<std::string, std::vector<T> >::iterator iterator_type;
466 
467  for (iterator_type it = fCurrentOutput->begin(); it != fCurrentOutput->end(); it++) {
468  it->second.clear();
469  }
470 
471  fCurrentEvent->Set(fCent, fEPV0);
472 
474  if (!r) return kFALSE;
475  fTree->Fill();
476  PostData(2, fTree);
477  return kTRUE;
478 }
479 
490 {
491  // Get the pointer to the existing analysis manager via the static access method
492  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
493  if (!mgr) {
494  ::Error("AddTaskEmcalJetTree", "No analysis manager to connect to.");
495  return NULL;
496  }
497 
498  // Check the analysis type using the event handlers connected to the analysis manager
499  AliVEventHandler* handler = mgr->GetInputEventHandler();
500  if (!handler) {
501  ::Error("AddTaskEmcalJetTree", "This task requires an input event handler");
502  return NULL;
503  }
504 
505  EDataType_t dataType = kUnknownDataType;
506 
507  if (handler->InheritsFrom("AliESDInputHandler")) {
508  dataType = kESD;
509  }
510  else if (handler->InheritsFrom("AliAODInputHandler")) {
511  dataType = kAOD;
512  }
513 
514  // Init the task and do settings
515 
516  if (ntracks == "usedefault") {
517  if (dataType == kESD) {
518  ntracks = "Tracks";
519  }
520  else if (dataType == kAOD) {
521  ntracks = "tracks";
522  }
523  else {
524  ntracks = "";
525  }
526  }
527 
528  if (nclusters == "usedefault") {
529  if (dataType == kESD) {
530  nclusters = "CaloClusters";
531  }
532  else if (dataType == kAOD) {
533  nclusters = "caloClusters";
534  }
535  else {
536  nclusters = "";
537  }
538  }
539 
540  TString name("AliAnalysisTaskEmcalJetTree");
541  if (strcmp(suffix,"")) {
542  name += "_";
543  name += suffix;
544  }
545 
547  jetTask->SetVzRange(-10,10);
548  jetTask->SetNeedEmcalGeom(kFALSE);
549 
550  AliParticleContainer *partCont = jetTask->AddParticleContainer(ntracks.Data());
551  if (partCont) partCont->SetParticlePtCut(trackPtCut);
552 
553  AliClusterContainer *clusterCont = jetTask->AddClusterContainer(nclusters.Data());
554  if (clusterCont) {
555  clusterCont->SetClusECut(0.);
556  clusterCont->SetClusPtCut(0.);
557  clusterCont->SetClusHadCorrEnergyCut(clusECut);
558  clusterCont->SetDefaultClusterEnergy(AliVCluster::kHadCorr);
559  }
560 
561  // Final settings, pass to manager and set the containers
562  mgr->AddTask(jetTask);
563 
564  // Create containers for input/output
565  AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer() ;
566  TString contname0(name);
567  contname0 += "_jets";
568  TString contname1(name);
569  contname1 += "_histos";
570  AliAnalysisDataContainer *coutput0 = mgr->CreateContainer(contname0.Data(),
571  TTree::Class(),AliAnalysisManager::kOutputContainer,
572  Form("%s", AliAnalysisManager::GetCommonFileName()));
573  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(contname1.Data(),
574  TList::Class(),AliAnalysisManager::kOutputContainer,
575  Form("%s", AliAnalysisManager::GetCommonFileName()));
576  mgr->ConnectInput (jetTask, 0, cinput1 );
577  mgr->ConnectOutput (jetTask, 1, coutput1 );
578  mgr->ConnectOutput (jetTask, 2, coutput0 );
579 
580  return jetTask;
581 }
582 
AliClusterContainer * AddClusterContainer(std::string branchName, std::string contName="")
void SetParticlePtCut(Double_t cut)
double Double_t
Definition: External.C:58
EDataType_t
Switch for the data type.
templateClassImp(AliTHnT) template< class TemplateArray
Class that encapsulates jets in a very compact structure (pp analysis)
void FillTTree(const AliEmcalJetInfo &jetInfo, const AliJetContainer *jets)
char Char_t
Definition: External.C:18
Class that encapsulates jets in a very compact structure (embedding analysis)
void UserCreateOutputObjects()
Overloads base class method. Creates output objects.
Class that encapsulates jets in a very compact structure (Pb-Pb analysis)
Container for particles within the EMCAL framework.
UShort_t T(UShort_t m, UShort_t t)
Definition: RingBits.C:60
AliAnalysisTaskEmcalJetTree()
Default constructor for ROOT I/O purposes.
Double_t Phi_0_2pi() const
void UserCreateOutputObjects()
Overloads base class method. Creates output objects.
Class that encapsulates event properties in a very compact structure (PbPb analysis) ...
Declaration of class AliAnalysisTaskEmcalJetTree.
Pure virtual base class for AliAnalysisTaskEmcalJetTree<T>
Implementation of a task to generate a tree with all jets.
short Short_t
Definition: External.C:23
AliParticleContainer * AddParticleContainer(std::string branchName, std::string contName="")
static AliAnalysisTaskEmcalJetTreeBase * CreateInstance(const char *name, EAnalisysType_t type=kJetPP)
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
Class that encapsulates jets in a very compact structure (pp analysis)
void SetVzRange(Double_t min, Double_t max)
void SetClusPtCut(Double_t cut)
bool Bool_t
Definition: External.C:53
Class that encapsulates jets in a very compact structure (Pb-Pb analysis)
void SetClusECut(Double_t cut)
void SetDefaultClusterEnergy(Int_t d)
Container structure for EMCAL clusters.
Double_t fCent
!event centrality
Container for jet within the EMCAL jet framework.
void AllocateTTree(const AliJetContainer *jets)
Implementation of a task to perform QA on jet spectra.
static AliAnalysisTaskEmcalJetTreeBase * AddTaskEmcalJetTree(TString ntracks="usedefault", TString nclusters="usedefault", Double_t trackPtCut=0.15, Double_t clusECut=0.30, EAnalisysType_t type=kJetPP, TString suffix="")
void SetClusHadCorrEnergyCut(Double_t cut)