AliPhysics  ff07904 (ff07904)
AliAnalysisTaskConvJet.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 <TClonesArray.h>
17 #include <TH1F.h>
18 #include <TH2F.h>
19 #include <TList.h>
20 
21 #include <AliAnalysisManager.h>
22 #include <AliVEventHandler.h>
23 #include <AliVCluster.h>
24 #include <AliVParticle.h>
25 #include <AliLog.h>
26 
27 #include "AliTLorentzVector.h"
28 #include "AliEmcalJet.h"
29 #include "AliRhoParameter.h"
30 #include "AliJetContainer.h"
31 #include "AliParticleContainer.h"
32 #include "AliClusterContainer.h"
33 
34 #include "AliAnalysisTaskConvJet.h"
35 
37 ClassImp(AliAnalysisTaskConvJet);
39 
40 
43  fNJets(0),
44  fVectorJetPt(0),
45  fVectorJetEta(0),
46  fVectorJetPhi(0),
47  fVectorJetR(0)
48 {
49 }
50 
52  AliAnalysisTaskEmcalJet(name, kTRUE),
53  fNJets(0),
54  fVectorJetPt(0),
55  fVectorJetEta(0),
56  fVectorJetPhi(0),
57  fVectorJetR(0)
58 {
60 }
61 
62 
64 {
65 }
66 
72 {
74 
75  PostData(1, fOutput); // Post data for ALL output slots > 0 here.
76 }
77 
85 {
86  DoJetLoop();
87 
88  return kTRUE;
89 }
90 
96 {
97  AliJetContainer* jetCont = 0;
98  TIter next(&fJetCollArray);
99  while ((jetCont = static_cast<AliJetContainer*>(next()))) {
100  UInt_t count = 0;
101  fNJets = 0 ;
102  fVectorJetPt.clear();
103  fVectorJetEta.clear();
104  fVectorJetPhi.clear();
105  fVectorJetR.clear();
106  for(auto jet : jetCont->accepted()) {
107  if (!jet) continue;
108  count++;
109  fVectorJetPt.push_back(jet->Pt());
110  fVectorJetEta.push_back(jet->Eta());
111  fVectorJetPhi.push_back(jet->Phi());
112  fVectorJetR.push_back(jet->Area());
113  }
114  fNJets = count ;
115  }
116 }
117 
123 {
125 }
126 
135 {
136  return kTRUE;
137 }
138 
143 {
144 }
145 
152  const char *ntracks,
153  const char *nclusters,
154  const char* ncells,
155  const char *suffix)
156 {
157  // Get the pointer to the existing analysis manager via the static access method.
158  //==============================================================================
159  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
160  if (!mgr)
161  {
162  ::Error("AddTask_GammaConvJet", "No analysis manager to connect to.");
163  return 0;
164  }
165 
166  // Check the analysis type using the event handlers connected to the analysis manager.
167  //==============================================================================
168  AliVEventHandler* handler = mgr->GetInputEventHandler();
169  if (!handler)
170  {
171  ::Error("AddTask_GammaConvJet", "This task requires an input event handler");
172  return 0;
173  }
174 
175  enum EDataType_t {
176  kUnknown,
177  kESD,
178  kAOD
179  };
180 
181  EDataType_t dataType = kUnknown;
182 
183  if (handler->InheritsFrom("AliESDInputHandler")) {
184  dataType = kESD;
185  }
186  else if (handler->InheritsFrom("AliAODInputHandler")) {
187  dataType = kAOD;
188  }
189 
190  //-------------------------------------------------------
191  // Init the task and do settings
192  //-------------------------------------------------------
193 
194  TString trackName(ntracks);
195  TString clusName(nclusters);
196  TString cellName(ncells);
197 
198  if (trackName == "usedefault") {
199  if (dataType == kESD) {
200  trackName = "Tracks";
201  }
202  else if (dataType == kAOD) {
203  trackName = "tracks";
204  }
205  else {
206  trackName = "";
207  }
208  }
209 
210  if (clusName == "usedefault") {
211  if (dataType == kESD) {
212  clusName = "CaloClusters";
213  }
214  else if (dataType == kAOD) {
215  clusName = "caloClusters";
216  }
217  else {
218  clusName = "";
219  }
220  }
221 
222  if (cellName == "usedefault") {
223  if (dataType == kESD) {
224  cellName = "EMCALCells";
225  }
226  else if (dataType == kAOD) {
227  cellName = "emcalCells";
228  }
229  else {
230  cellName = "";
231  }
232  }
233 
234  TString name("AliAnalysisTaskConvJet");
235 
236  AliAnalysisTaskConvJet* sampleTask = new AliAnalysisTaskConvJet(name);
237  sampleTask->SetCaloCellsName(cellName);
238  sampleTask->SetVzRange(-10,10);
239 
240  if (trackName == "mcparticles") {
241  sampleTask->AddMCParticleContainer(trackName);
242  }
243  else if (trackName == "tracks" || trackName == "Tracks") {
244  sampleTask->AddTrackContainer(trackName);
245  }
246  else if (!trackName.IsNull()) {
247  sampleTask->AddParticleContainer(trackName);
248  }
249  sampleTask->AddClusterContainer(clusName);
250 
251  sampleTask->GetClusterContainer(0)->SetClusECut(0.);
252  sampleTask->GetClusterContainer(0)->SetClusPtCut(0.);
254  sampleTask->GetClusterContainer(0)->SetClusHadCorrEnergyCut(0.30);
255  sampleTask->GetClusterContainer(0)->SetDefaultClusterEnergy(AliVCluster::kHadCorr);
256  sampleTask->GetParticleContainer(0)->SetParticlePtCut(0.15);
257  sampleTask->GetParticleContainer(0)->SetParticleEtaLimits(-0.8,0.8);
258  sampleTask->GetTrackContainer(0)->SetParticlePtCut(0.15);
259  sampleTask->GetTrackContainer(0)->SetParticleEtaLimits(-0.8,0.8);
260  sampleTask->GetTrackContainer(0)->SetFilterHybridTracks(kTRUE);
261 
262  //-------------------------------------------------------
263  // Final settings, pass to manager and set the containers
264  //-------------------------------------------------------
265 
266  mgr->AddTask(sampleTask);
267 
268  // Create containers for input/output
269  AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer() ;
270  TString contname(name);
271  contname += "_histos";
272  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(contname.Data(),
273  TList::Class(),AliAnalysisManager::kOutputContainer,
274  Form("%s", AliAnalysisManager::GetCommonFileName()));
275  mgr->ConnectInput (sampleTask, 0, cinput1 );
276  mgr->ConnectOutput (sampleTask, 1, coutput1 );
277 
278  return sampleTask;
279 }
void SetParticlePtCut(Double_t cut)
std::vector< Double_t > fVectorJetPhi
std::vector< Double_t > fVectorJetR
Declaration of class AliTLorentzVector.
void SetVzRange(Double_t min, Double_t max)
AliClusterContainer * AddClusterContainer(const char *n)
Create new cluster container and attach it to the task.
AliParticleContainer * GetParticleContainer(Int_t i=0) const
Get particle container attached to this task.
std::vector< Double_t > fVectorJetPt
unsigned int UInt_t
Definition: External.C:33
void SetClusNonLinCorrEnergyCut(Double_t cut)
void SetFilterHybridTracks(Bool_t f)
AliParticleContainer * AddParticleContainer(const char *n)
Create new particle container and attach it to the task.
AliClusterContainer * GetClusterContainer(Int_t i=0) const
Get cluster container attached to this task.
AliMCParticleContainer * AddMCParticleContainer(const char *n)
Create new container for MC particles and attach it to the task.
TObjArray fJetCollArray
jet collection array
void SetParticleEtaLimits(Double_t min, Double_t max)
AliEmcalList * fOutput
!output list
std::vector< Double_t > fVectorJetEta
AliTrackContainer * AddTrackContainer(const char *n)
Create new track container and attach it to the task.
AliTrackContainer * GetTrackContainer(Int_t i=0) const
void SetMakeGeneralHistograms(Bool_t g)
static AliAnalysisTaskConvJet * AddTask_GammaConvJet(const char *ntracks="usedefault", const char *nclusters="usedefault", const char *ncells="usedefault", const char *suffix="")
Base task in the EMCAL jet framework.
const char Option_t
Definition: External.C:48
void SetClusPtCut(Double_t cut)
void UserCreateOutputObjects()
Main initialization function on the worker.
const AliJetIterableContainer accepted() const
bool Bool_t
Definition: External.C:53
EDataType_t
Switch for the data type.
void SetCaloCellsName(const char *n)
void SetClusECut(Double_t cut)
void SetDefaultClusterEnergy(Int_t d)
Implementation of a sample jet analysis task.
void Terminate(Option_t *option)
Container for jet within the EMCAL jet framework.
void SetClusHadCorrEnergyCut(Double_t cut)