AliPhysics  b6a3523 (b6a3523)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnalysisTaskEmcalEmbeddingHelper.h
Go to the documentation of this file.
1 #ifndef ALIANALYSISTASKEMCALEMBEDDINGHELPER_H
2 #define ALIANALYSISTASKEMCALEMBEDDINGHELPER_H
3 
16 /* Copyright(c) 1998-2016, ALICE Experiment at CERN, All rights reserved. *
17  * See cxx source for full Copyright notice */
18 
19 class TString;
20 class TChain;
21 class TFile;
22 class AliVEvent;
23 class AliVHeader;
24 class AliGenPythiaEventHeader;
25 class AliEmcalList;
26 
27 #include <iosfwd>
28 #include <vector>
29 #include <string>
30 
31 #include <AliAnalysisTaskSE.h>
32 #include "THistManager.h"
33 
68  public:
69 
71  AliAnalysisTaskEmcalEmbeddingHelper(const char *name) ;
73 
74  void UserExec(Option_t *option) ;
76  void Terminate(Option_t *option) ;
77 
79 
80  AliVEvent* GetExternalEvent() const { return fExternalEvent ; }
81 
86  bool Initialize();
87 
88  // Get
89  Int_t GetPtHardBin() const { return fPtHardBin; }
90  Int_t GetAnchorRun() const { return fAnchorRun; }
91  TString GetTreeName() const { return fTreeName; }
94  TString GetFilePattern() const { return fFilePattern; }
98  bool GetCreateHistos() const { return fCreateHisto; }
99 
100  // Set
102  void SetPtHardBin(Int_t n) { fPtHardBin = n; }
106  void SetAnchorRun(Int_t r) { fAnchorRun = r; }
108  void SetESD(const char * treeName = "esdTree") { fTreeName = treeName; }
110  void SetAOD(const char * treeName = "aodTree") { fTreeName = treeName; }
119  void SetFilePattern(const char * pattern) { fFilePattern = pattern; }
130  void SetCreateHistos(bool b) { fCreateHisto = b; }
131  /* @} */
132 
137  UInt_t GetTriggerMask() const { return fTriggerMask; }
138  Double_t GetZVertexCut() const { return fZVertexCut; }
140 
141  void SetTriggerMask(UInt_t triggerMask) { fTriggerMask = triggerMask; }
142  void SetZVertexCut(Double_t zVertex) { fZVertexCut = zVertex; }
143  void SetMaxVertexDistance(Double_t distance) { fMaxVertexDist = distance; }
144  /* @} */
145 
150  AliVHeader * GetEventHeader() const { return fExternalHeader; }
151  AliGenPythiaEventHeader * GetPythiaHeader() const { return fPythiaHeader; }
152  double GetPythiaXSection() const { return fPythiaXSection; }
153  double GetPythiaTrials() const { return fPythiaTrials; }
154  double GetPythiaPtHard() const { return fPythiaPtHard; }
155  /* @} */
156 
161  // AddTask
163 
164  // Printing
165  friend std::ostream & operator<<(std::ostream &in, const AliAnalysisTaskEmcalEmbeddingHelper &myTask);
166  void Print(Option_t* opt = "") const;
167  std::ostream & Print(std::ostream &in) const;
168  std::string toString(bool includeFileList = false) const;
169  /* @} */
170 
171  protected:
172  bool GetFilenames() ;
173  std::string GenerateUniqueFileListFilename();
175  void SetupEmbedding() ;
177  Bool_t GetNextEntry() ;
181  Bool_t InitEvent() ;
182  void InitTree() ;
183 
187 
192 
199  bool fCreateHisto ;
200 
205  std::vector <std::string> fFilenames ;
206  TFile *fExternalFile ;
216  AliVEvent *fExternalEvent ;
217  AliVHeader *fExternalHeader ;
218  AliGenPythiaEventHeader *fPythiaHeader ;
219 
220  double fPythiaTrials ;
221  double fPythiaXSection ;
222  double fPythiaPtHard ;
223 
225 
226  private:
229 
233 };
234 #endif
Bool_t fRandomEventNumberAccess
If true, it will start embedding from a random entry in the file rather than from the first...
Double_t fZVertexCut
Z vertex cut on embedded event.
const char * filename
Definition: TestFCM.C:1
void SetESD(const char *treeName="esdTree")
Set to embed from ESD.
double Double_t
Definition: External.C:58
double fPythiaXSection
! Pythia cross section for the current event (extracted from the pythia header)
Int_t fPtHardBin
ptHard bin for the given pythia production
void SetAnchorRun(Int_t r)
Sets the anchor run which will be added into the file pattern. Can also be omitted and set directly i...
Int_t fLowerEntry
! First entry of the current tree to be used for embedding
Int_t fAnchorRun
Anchor run for the given pythia production.
TString fFileListFilename
Name of the file list containing paths to files to embed.
Bool_t fRandomFileAccess
If true, it will start embedding from a random file in the input files list.
Int_t fCurrentEntry
! Current entry in the current tree
TFile * fExternalFile
! External file used for embedding
Int_t fNPtHardBins
Total number of pt hard bins.
TChain * fChain
! External TChain (tree) containing the events available for embedding
bool fInitializedConfiguration
Notes if the configuration has been initialized.
double fPythiaTrials
! Number of pythia trials for the current event (extracted from the pythia header) ...
AliVHeader * fExternalHeader
! Header of the current external event
void SetFilePattern(const char *pattern)
Sets the file pattern to select AliEn files. This pattern is used as input to the alien_find command...
AliGenPythiaEventHeader * fPythiaHeader
! Pythia header of the current external event
TString fInputFilename
Filename of input root files.
friend std::ostream & operator<<(std::ostream &in, const AliAnalysisTaskEmcalEmbeddingHelper &myTask)
Int_t fMaxNumberOfFiles
! Max number of files that are in the TChain
int Int_t
Definition: External.C:63
unsigned int UInt_t
Definition: External.C:33
bool fInitializedEmbedding
! Notes where the TChain has been initialized for embedding
std::string toString(bool includeFileList=false) const
Implementation of task to embed external events.
Double_t fMaxVertexDist
Max distance between Z vertex of internal and embedded event.
AliVEvent * fExternalEvent
! Current external event available for embedding
void SetRandomFileAccess(Bool_t b)
Randomly select the first file to embed from the file list. Continues sequentially afterwards...
TString fTreeName
Name of the ESD/AOD tree where the events are to be found.
void SetNPtHardBins(Int_t n)
Set the number of pt hard bins in the production to properly format the histograms.
Int_t fOffset
! Offset from fLowerEntry where the loop over the tree should start
bool fCreateHisto
If true, create QA histograms.
Enhanced TList-derived class that implements correct merging for pt_hard binned production.
Definition: AliEmcalList.h:25
bool fWrappedAroundTree
! Notes whether we have wrapped around the tree, which is important if the offset into the tree is no...
double fPythiaPtHard
! Pt hard of the current event (extracted from the pythia header)
void SetFileListFilename(const char *filename)
Set the path to a file containing the list of files to embed.
AliGenPythiaEventHeader * GetPythiaHeader() const
static AliAnalysisTaskEmcalEmbeddingHelper * AddTaskEmcalEmbeddingHelper()
void SetPtHardBin(Int_t n)
Set the pt hard bin which will be added into the file pattern. Can also be omitted and set directly i...
THistManager fHistManager
! Manages access to all histograms
bool fInitializedNewFile
! Notes where the entry indices have been initialized for a new tree in the chain ...
static AliAnalysisTaskEmcalEmbeddingHelper * fgInstance
! Global instance of this class
Container class for histograms.
Definition: THistManager.h:99
AliAnalysisTaskEmcalEmbeddingHelper & operator=(const AliAnalysisTaskEmcalEmbeddingHelper &)
void SetCreateHistos(bool b)
Create QA histograms. These are necessary for proper scaling, so be careful disabling them! ...
const char Option_t
Definition: External.C:48
AliEmcalList * fOutput
! List which owns the output histograms to be saved
bool Bool_t
Definition: External.C:53
void SetStartingFileIndex(Int_t n)
Select the file ID to start embedding from.
void SetAOD(const char *treeName="aodTree")
Set to embed from AOD.
Int_t fUpperEntry
! Last entry of the current tree to be used for embedding
Int_t fFilenameIndex
Index of vector containing paths to files to embed.
std::vector< std::string > fFilenames
Paths to the files to embed.
TString fFilePattern
File pattern to select AliEn files using alien_find.
Int_t fFileNumber
! File number corresponding to the current tree
static const AliAnalysisTaskEmcalEmbeddingHelper * GetInstance()