AliPhysics  7273240 (7273240)
 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::AliEmcalJetInfoSummaryPP
20 
24 
29  fPt(0),
30  fEta(0),
31  fPhi(0),
32  fNEF(0),
33  fZLeading(0),
34  fNConstituents(0)
35 {
36  Set(source);
37 }
38 
41 {
42  fPt = 0;
43  fEta = 0;
44  fPhi = 0;
45  fNEF = 0;
46  fZLeading = 0;
47  fNConstituents = 0;
48 }
49 
54 {
55  fPt = source.Pt();
56  fEta = source.Eta();
57  fPhi = source.Phi_0_2pi();
58  fNEF = source.fNEF;
59  fZLeading = source.fZ;
60  fNConstituents = Char_t(source.fNConstituents);
61 }
62 
63 // Definitions of class AliAnalysisTaskEmcalJetTreeBase::AliEmcalJetInfoSummaryPbPb
64 
68 
73  fPt(0),
74  fEta(0),
75  fPhi(0),
76  fNEF(0),
77  fZLeading(0),
78  fCent(0),
79  fEP(0),
80  fArea(0),
81  fNConstituents(0),
82  fCorrPt(0)
83 {
84  Set(source);
85 }
86 
89 {
90  fPt = 0;
91  fEta = 0;
92  fPhi = 0;
93  fNEF = 0;
94  fZLeading = 0;
95  fNConstituents = 0;
96  fCent = 0;
97  fEP = 0;
98  fArea = 0;
99  fNConstituents = 0;
100  fCorrPt = 0;
101 }
102 
107 {
108  fPt = source.Pt();
109  fEta = source.Eta();
110  fPhi = source.Phi_0_2pi();
111  fNEF = source.fNEF;
112  fZLeading = source.fZ;
113  fCent = Char_t(source.fCent);
114  fEP = source.fEP;
115  fArea = source.fArea;
116  fNConstituents = Short_t(source.fNConstituents);
117  fCorrPt = source.fCorrPt;
118 }
119 
120 // Definitions of class AliAnalysisTaskEmcalJetTreeBase::AliEmcalJetInfoSummaryPbPb
121 
125 
130  fPt(0),
131  fEta(0),
132  fPhi(0),
133  fNEF(0),
134  fZLeading(0),
135  fCent(0),
136  fEP(0),
137  fArea(0),
138  fNConstituents(0),
139  fCorrPt(0),
140  fMCPt(0)
141 {
142  Set(source);
143 }
144 
147 {
148  fPt = 0;
149  fEta = 0;
150  fPhi = 0;
151  fNEF = 0;
152  fZLeading = 0;
153  fNConstituents = 0;
154  fCent = 0;
155  fEP = 0;
156  fArea = 0;
157  fNConstituents = 0;
158  fCorrPt = 0;
159  fMCPt = 0;
160 }
161 
166 {
167  fPt = source.Pt();
168  fEta = source.Eta();
169  fPhi = source.Phi_0_2pi();
170  fNEF = source.fNEF;
171  fZLeading = source.fZ;
172  fCent = Char_t(source.fCent);
173  fEP = source.fEP;
174  fArea = source.fArea;
175  fNConstituents = Short_t(source.fNConstituents);
176  fCorrPt = source.fCorrPt;
177  fMCPt = source.fMCPt;
178 }
179 
180 // Definitions of class AliAnalysisTaskEmcalJetTreeBase
181 
185 
188  fTree(0)
189 {
190  DefineOutput(2, TTree::Class());
192 }
193 
200 {
201  switch (type) {
202  case kJetPP:
203  ::Info("AliAnalysisTaskEmcalJetTreeBase::CreateInstance", "Created an instance of AliAnalysisTaskEmcalJetTree<AliEmcalJetInfoSummaryPP>");
205  break;
206  case kJetPbPb:
207  ::Info("AliAnalysisTaskEmcalJetTreeBase::CreateInstance", "Created an instance of AliAnalysisTaskEmcalJetTree<AliEmcalJetInfoSummaryPbPb>");
209  break;
210  case kJetEmbedding:
211  ::Info("AliAnalysisTaskEmcalJetTreeBase::CreateInstance", "Created an instance of AliAnalysisTaskEmcalJetTree<AliEmcalJetInfoSummaryEmbedding>");
213  break;
214  default:
215  ::Error("AliAnalysisTaskEmcalJetTreeBase::CreateInstance", "Type %d not implemented!", type);
216  return 0;
217  }
218 }
219 
220 // Definitions of class AliAnalysisTaskEmcalJetTree
221 
225 
227 template <class T>
230  fCurrentOutput(0)
231 {
232 }
233 
236 template <>
238  AliAnalysisTaskEmcalJetTreeBase("AliAnalysisTaskEmcalJetTree"),
239  fCurrentOutput(0)
240 {
241 }
242 
245 template <>
247  AliAnalysisTaskEmcalJetTreeBase("AliAnalysisTaskEmcalJetTree"),
248  fCurrentOutput(0)
249 {
250 }
251 
254 template <>
256  AliAnalysisTaskEmcalJetTreeBase("AliAnalysisTaskEmcalJetTree"),
257  fCurrentOutput(0)
258 {
259 }
260 
264 template <class T>
267  fCurrentOutput(0)
268 {
269 }
270 
274 template <class T>
276 {
277  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;
278  fTree->Branch(jets->GetName(), &((*it).second));
279 }
280 
282 template <class T>
284 {
285  fCurrentOutput = new std::map<std::string, std::vector<T> >();
286  TString treeName = TString::Format("%s_jets", GetName());
287  fTree = new TTree(treeName, treeName);
288 
290 
291  PostData(2, fTree);
292 }
293 
297 template <class T>
299 {
300  static typename std::map<std::string, std::vector<T> >::iterator it = fCurrentOutput->end();
301 
302  if (it == fCurrentOutput->end() || TString(jets->GetName()) != it->first) {
303  it = fCurrentOutput->find(jets->GetName());
304  if (it == fCurrentOutput->end()) return;
305  }
306 
307  it->second.push_back(T(jet));
308 }
309 
313 template <class T>
315 {
316  typedef typename std::map<std::string, std::vector<T> >::iterator iterator_type;
317 
318  for (iterator_type it = fCurrentOutput->begin(); it != fCurrentOutput->end(); it++) {
319  it->second.clear();
320  }
321 
323  if (!r) return kFALSE;
324  fTree->Fill();
325  PostData(2, fTree);
326  return kTRUE;
327 }
templateClassImp(AliTHnT) template< class TemplateArray
char Char_t
Definition: External.C:18
Class that encapsulates jets in a very compact structure (embedding analysis)
AliAnalysisTaskEmcalJetTree()
Default constructor for ROOT I/O purposes.
void UserCreateOutputObjects()
Overloads base class method. Creates output objects.
UShort_t T(UShort_t m, UShort_t t)
Definition: RingBits.C:60
void UserCreateOutputObjects()
Overloads base class method. Creates output objects.
Double_t Phi_0_2pi() const
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
void FillTTree(const AliEmcalJetInfo &jetInfo, const AliJetContainer *jets)
static AliAnalysisTaskEmcalJetTreeBase * CreateInstance(const char *name, EAnalisysType_t type=kJetPP)
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
Class that encapsulates jets in a very compact structure (pp analysis)
bool Bool_t
Definition: External.C:53
Class that encapsulates jets in a very compact structure (Pb-Pb analysis)
void AllocateTTree(const AliJetContainer *jets)
Double_t fCent
!event centrality
Container for jet within the EMCAL jet framework.
Implementation of a task to perform QA on jet spectra.