AliPhysics  8bb951a (8bb951a)
 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 // Definitions of class AliAnalysisTaskEmcalJetTreeBase::AliEmcalJetInfoSummaryBase
20 
24 
29  fPt(0),
30  fEta(0),
31  fPhi(0),
32  fNEF(0),
33  fZLeading(0)
34 {
35  Set(source);
36 }
37 
40 {
41  fPt = 0;
42  fEta = 0;
43  fPhi = 0;
44  fNEF = 0;
45  fZLeading = 0;
46 }
47 
52 {
53  fPt = source.Pt();
54  fEta = source.Eta();
55  fPhi = source.Phi_0_2pi();
56  fNEF = source.fNEF;
57  fZLeading = source.fZ;
58 }
59 
60 // Definitions of class AliAnalysisTaskEmcalJetTreeBase::AliEmcalJetInfoSummaryPP
61 
65 
71  fNConstituents(0)
72 {
73  Set(source);
74 }
75 
78 {
80  fNConstituents = 0;
81 }
82 
87 {
89  fNConstituents = Char_t(source.fNConstituents);
90 }
91 
92 // Definitions of class AliAnalysisTaskEmcalJetTreeBase::AliEmcalJetInfoSummaryPbPb
93 
97 
103  fCent(0),
104  fEP(0),
105  fArea(0),
106  fNConstituents(0),
107  fCorrPt(0)
108 {
109  Set(source);
110 }
111 
114 {
116  fCent = 0;
117  fEP = 0;
118  fArea = 0;
119  fNConstituents = 0;
120  fCorrPt = 0;
121 }
122 
127 {
129  fCent = Char_t(source.fCent);
130  fEP = source.fEP;
131  fArea = source.fArea;
132  fNConstituents = Short_t(source.fNConstituents);
133  fCorrPt = source.fCorrPt;
134 }
135 
136 // Definitions of class AliAnalysisTaskEmcalJetTreeBase::AliEmcalJetInfoSummaryPbPb
137 
141 
147  fMCPt(0)
148 {
149  Set(source);
150 }
151 
154 {
156  fMCPt = 0;
157 }
158 
163 {
165  fMCPt = source.fMCPt;
166 }
167 
168 // Definitions of class AliAnalysisTaskEmcalJetTreeBase
169 
173 
176  fTree(0)
177 {
178  DefineOutput(2, TTree::Class());
180 }
181 
188 {
189  switch (type) {
190  case kJetPP:
191  ::Info("AliAnalysisTaskEmcalJetTreeBase::CreateInstance", "Created an instance of AliAnalysisTaskEmcalJetTree<AliEmcalJetInfoSummaryPP>");
193  break;
194  case kJetPbPb:
195  ::Info("AliAnalysisTaskEmcalJetTreeBase::CreateInstance", "Created an instance of AliAnalysisTaskEmcalJetTree<AliEmcalJetInfoSummaryPbPb>");
197  break;
198  case kJetEmbedding:
199  ::Info("AliAnalysisTaskEmcalJetTreeBase::CreateInstance", "Created an instance of AliAnalysisTaskEmcalJetTree<AliEmcalJetInfoSummaryEmbedding>");
201  break;
202  default:
203  ::Error("AliAnalysisTaskEmcalJetTreeBase::CreateInstance", "Type %d not implemented!", type);
204  return 0;
205  }
206 }
207 
208 // Definitions of class AliAnalysisTaskEmcalJetTree
209 
211 templateClassImp(AliAnalysisTaskEmcalJetTree)
213 
215 template <class T>
218  fCurrentOutput(0)
219 {
220 }
221 
224 template <>
226  AliAnalysisTaskEmcalJetTreeBase("AliAnalysisTaskEmcalJetTree"),
227  fCurrentOutput(0)
228 {
229 }
230 
233 template <>
235  AliAnalysisTaskEmcalJetTreeBase("AliAnalysisTaskEmcalJetTree"),
236  fCurrentOutput(0)
237 {
238 }
239 
242 template <>
244  AliAnalysisTaskEmcalJetTreeBase("AliAnalysisTaskEmcalJetTree"),
245  fCurrentOutput(0)
246 {
247 }
248 
252 template <class T>
255  fCurrentOutput(0)
256 {
257 }
258 
262 template <class T>
264 {
265  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;
266  fTree->Branch(jets->GetName(), &((*it).second));
267 }
268 
270 template <class T>
272 {
273  fCurrentOutput = new std::map<std::string, std::vector<T> >();
274  TString treeName = TString::Format("%s_jets", GetName());
275  fTree = new TTree(treeName, treeName);
276 
278 
279  PostData(2, fTree);
280 }
281 
285 template <class T>
287 {
288  static typename std::map<std::string, std::vector<T> >::iterator it = fCurrentOutput->end();
289 
290  if (it == fCurrentOutput->end() || TString(jets->GetName()) != it->first) {
291  it = fCurrentOutput->find(jets->GetName());
292  if (it == fCurrentOutput->end()) return;
293  }
294 
295  it->second.push_back(T(jet));
296 }
297 
301 template <class T>
303 {
304  typedef typename std::map<std::string, std::vector<T> >::iterator iterator_type;
305 
306  for (iterator_type it = fCurrentOutput->begin(); it != fCurrentOutput->end(); it++) {
307  it->second.clear();
308  }
309 
311  if (!r) return kFALSE;
312  fTree->Fill();
313  PostData(2, fTree);
314  return kTRUE;
315 }
ClassImp(AliAnalysisTaskTriggerRates) AliAnalysisTaskTriggerRates
Class that encapsulates jets in a very compact structure (embedding analysis)
Class that encapsulates jets in a very compact structure.
AliAnalysisTaskEmcalJetTree()
Default constructor for ROOT I/O purposes.
void UserCreateOutputObjects()
Overloads base class method. Creates output objects.
void UserCreateOutputObjects()
Overloads base class method. Creates output objects.
Declaration of class AliAnalysisTaskEmcalJetTree.
Double_t fCent
!event centrality
Pure virtual base class for AliAnalysisTaskEmcalJetTree<T>
Implementation of a task to generate a tree with all jets.
void FillTTree(const AliEmcalJetInfo &jetInfo, const AliJetContainer *jets)
const char * GetName() const
static AliAnalysisTaskEmcalJetTreeBase * CreateInstance(const char *name, EAnalisysType_t type=kJetPP)
Class that encapsulates jets in a very compact structure (pp analysis)
Class that encapsulates jets in a very compact structure (Pb-Pb analysis)
Double32_t fPt
Transverse momentum of the jet in GeV/c.
void AllocateTTree(const AliJetContainer *jets)
Implementation of a task to perform QA on jet spectra.