]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG/Tools/AliAnalysisHelperJetTasks.h
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWG / Tools / AliAnalysisHelperJetTasks.h
1 //
2 // Helper Class that contains a lot of 
3 // usefull static functions jet matchin pythia access etc.
4 //
5 #ifndef  ALIANALYSISHELPERJETTASKS_H
6 #define  ALIANALYSISHELPERJETTASKS_H
7 #include "TObject.h"
8
9 class AliMCEvent;
10 class AliAODJet;
11 class AliVEvent;
12 class TString;
13 class TArrayI;
14 class TArrayF;
15 class AliGenPythiaEventHeader;
16 class TVector3;
17 class AliGenEventHeader;
18
19 class AliAnalysisHelperJetTasks : public TObject {
20  public:
21   AliAnalysisHelperJetTasks() : TObject() {;}
22   virtual ~AliAnalysisHelperJetTasks(){;}
23
24
25   enum {kMaxJets = 6}; //  needed for array size not to fragemnt memory on the heap by many new/delete 
26
27
28   enum { kNone = 1<<0,
29          kBunchBunch = 1<<1,
30          kBunchEmpty = 1<<2,
31          kEmptyEmpty= 1<<3,
32          kV0A=1<<4,
33          kV0C=1<<5,
34          kNoV0BG=1<<6,
35          kSPDFO=1<<7,
36          kPhysicsSelection = 1<<8, 
37          kVertexIn = 1<<9, 
38          kIsCosmic = 1<<10, 
39          kIsPileUp = 1<<11,
40          kIsMCND=1<<12,
41          kIsMCDD=1<<13,
42          kIsMCSD=1<<14,
43          kTotalSelections = (1<<15) - 1};
44
45   enum Trigger {kAcceptAll = 0,kMB1,kMB2,kMB3,kSPDGFO,kTrigger}; // 
46   // same as in PWG0Helper
47   enum MCProcessType { kInvalidProcess = -1, kND = 0x1, kDD = 0x2, kSD = 0x4, kOnePart = 0x8 };
48
49   static AliGenPythiaEventHeader*  GetPythiaEventHeader(const AliMCEvent *mcEvent);
50   static void PrintStack(AliMCEvent *mcEvent,Int_t iFirst = 0,Int_t iLast = 0,Int_t iMaxPrint = 10);
51   static void GetClosestJets(const AliAODJet *genJets,
52                              const Int_t &kGenJets,
53                              const AliAODJet *recJets,
54                              const Int_t &kRecJets,
55                              Int_t *iGenIndex,
56                              Int_t *iRecIndex,
57                              Int_t iDebug = 0, Float_t maxDist = 0.3);
58
59   static void GetClosestJets(const TList *genJetsList,const Int_t &kGenJets,
60                              const TList *recJetsList,const Int_t &kRecJets,
61                              TArrayI &iGenIndex,TArrayI &iRecIndex,
62                              Int_t iDebug = 0,Float_t maxDist = 0.3);
63                                  
64   static void GetJetMatching(const TList *genJetsList, const Int_t &kGenJets,
65                              const TList *recJetsList, const Int_t &kRecJets,
66                              TArrayI &iMatchIndex, TArrayF &fPtFraction,
67                              Int_t iDebug = 0, Float_t maxDist = 0.3, Int_t mode=1);
68                                                          
69   static Double_t GetFractionOfJet(const AliAODJet *recJet,const AliAODJet *genJet,Int_t mode=1);
70
71
72   static void MergeOutputDirs(const char* cFiles,const char* cPattern,const char *cOutFile,Bool_t bUpdate = false); // merges all directories containing the pattern
73
74   static void MergeOutput(const char* cFiles,const char* cDir = "",const char *cList = "",const char* cOutFile ="allpt.root",Bool_t bUpdate = false); // Merges the files in the input text file  needs the two histograms fh1PtHard_Trials, fh1Xsec and the name of the input list
75   static Bool_t PythiaInfoFromFile(const char* currFile,Float_t &fXsec,Float_t &fTrials);// get the cross section and the trails either from pyxsec.root or from pysec_hists.root
76   static Bool_t PrintDirectorySize(const char* currFile,Int_t iDetail = -1); // print the size of the output on a given file
77   static Bool_t GetEventShapes(TVector3 &n01,const TVector3 * pTrack, Int_t nTracks, Double_t * eventShapes);
78
79   static MCProcessType GetPythiaEventProcessType(AliGenEventHeader* aHeader, Bool_t adebug = kFALSE);
80   static MCProcessType GetDPMjetEventProcessType(AliGenEventHeader* aHeader, Bool_t adebug = kFALSE);
81   static Int_t GetLastProcessType() { return fgLastProcessType; }
82
83   static Bool_t Selected(Bool_t bSet = kFALSE,Bool_t bNew = kTRUE); // static function to store the state of selection from service task
84   static Double_t ReactionPlane(Bool_t bSet = kFALSE,Double_t fNew = 0); 
85   static Int_t GetPhiBin(Double_t phi,Int_t fNRPbins);
86
87   static Bool_t IsPileUp(); // Wrapper for SelectInfo with PileUp
88   static Bool_t IsCosmic(); // Wrapper for SelectInfo with cosmic
89   static Bool_t TestSelectInfo(UInt_t iMask); // Wrapper for testing the SelectInfo bitmask
90   static Bool_t TestEventClass(Int_t iClass); // Wrapper for testing the SelectInfo bitmask
91
92   static UInt_t SelectInfo(Bool_t bSet = kFALSE,UInt_t iNew = 0); // static function to store the state bitmask of the selection from service task
93   static Int_t  EventClass(Bool_t bSet = kFALSE,Int_t iNew = 0); // static function to store the event class of the selection from service task
94   
95   // these methods have been essentially copied from PWG0/AliTriggerAnalysis and expanded to use with AOD
96   static Bool_t IsTriggerFired(const AliVEvent* aEsd, Trigger trigger);
97
98   private:
99   
100   static Int_t fgLastProcessType;    // stores the raw value of the last process type extracted
101  
102   ClassDef(AliAnalysisHelperJetTasks, 7) 
103 };
104
105 #endif // ALIANALYSISHELPERJETTASKS_H