]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG/CaloTrackCorrBase/AliMCAnalysisUtils.h
87e00edecb4e045d72e712d36e9856f0a25b6b7d
[u/mrichter/AliRoot.git] / PWG / CaloTrackCorrBase / AliMCAnalysisUtils.h
1 #ifndef ALIMCANALYSISUTILS_H
2 #define ALIMCANALYSISUTILS_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice     */
5
6 //_________________________________________________________________________
7 // Class for analysis utils for MC data
8 // stored in stack or event header.
9 // Contains:
10 //  - method to check the origin of a given track/cluster
11 //  - method to obtain the generated jets
12 //
13 //*-- Author: Gustavo Conesa (INFN-LNF)
14
15 // --- ROOT system ---
16 #include <TObject.h>
17 #include <TString.h> 
18 class TList ;
19 class TVector3;
20
21 //--- AliRoot system ---
22 class AliCaloTrackReader ;
23 class AliStack ;
24
25 class AliMCAnalysisUtils : public TObject {
26         
27  public: 
28   AliMCAnalysisUtils() ; // ctor
29   virtual ~AliMCAnalysisUtils() ;//virtual dtor
30     
31   //--------------------------------------
32   //Enum with tag for origin of particles
33   //--------------------------------------
34   
35   //"Mostly" photon parent types on line 1,
36   //                                                  
37   //then "mostly" electron parent types on line 3, (e.g. electrons can
38   //come from pi0 decay)                              
39   //then charged particles on line 4,                                                                                    
40   //followed by other and unknown on line 5                                                                              
41   enum mcTypes { kMCPhoton,     kMCPrompt,      kMCFragmentation, kMCISR,    
42                  kMCPi0Decay,   kMCEtaDecay,    kMCOtherDecay,    kMCConversion,
43                  kMCElectron,   kMCEFromCFromB, kMCEFromC,        kMCEFromB, kMCZDecay,   kMCWDecay,
44                  kMCMuon,       kMCPion,        kMCPi0,           kMCKaon,   kMCEta,      kMCProton,   
45                  kMCAntiProton, kMCNeutron,     kMCAntiNeutron,
46                  kMCOther,      kMCUnknown,     kMCBadLabel                                                                                         } ;
47   
48   //--------------------------------------
49   // Methods to check origin of clusters
50   //--------------------------------------
51   
52   Int_t   CheckCommonAncestor(const Int_t index1, const Int_t index2, const AliCaloTrackReader* reader, 
53                               Int_t & ancPDG, Int_t & ancStatus, TLorentzVector & momentum, TVector3 & v) ;
54   
55   Int_t   CheckOrigin(const Int_t label, const AliCaloTrackReader * reader) ;
56   
57   //Check the label of the most significant particle but do checks on the rest of the contributing labels
58   Int_t   CheckOrigin       (const Int_t *label,  const Int_t nlabels, const AliCaloTrackReader * reader) ;
59   Int_t   CheckOriginInStack(const Int_t *labels, const Int_t nlabels, AliStack * stack)                ; // ESD
60   Int_t   CheckOriginInAOD  (const Int_t *labels, const Int_t nlabels, const TClonesArray* mcparticles) ; // AOD
61   
62   void    CheckOverlapped2GammaDecay(const Int_t *labels, const Int_t nlabels, const Int_t mesonIndex, AliStack * stack, Int_t & tag); // ESD
63   void    CheckOverlapped2GammaDecay(const Int_t *labels, const Int_t nlabels, const Int_t mesonIndex, const TClonesArray* mcparticles, Int_t & tag); // AOD
64   
65   TLorentzVector GetMother     (const Int_t label,const AliCaloTrackReader* reader, Bool_t & ok);
66   TLorentzVector GetMother     (const Int_t label,const AliCaloTrackReader* reader, Int_t & pdg, Int_t & status, Bool_t & ok);
67   TLorentzVector GetMother     (const Int_t label,const AliCaloTrackReader* reader, Int_t & pdg, Int_t & status, Bool_t & ok, Int_t & momLabel);
68   TLorentzVector GetGrandMother(const Int_t label,const AliCaloTrackReader* reader,
69                                 Int_t & pdg, Int_t & status, Bool_t & ok, Int_t & grandMomLabel, Int_t & greatMomLabel);
70
71   TLorentzVector GetMotherWithPDG(const Int_t label, const Int_t pdg,const AliCaloTrackReader* reader, Bool_t & ok, Int_t & momLabel);
72   
73   void GetMCDecayAsymmetryAngleForPDG(const Int_t label, const Int_t pdg,const AliCaloTrackReader* reader,
74                                       Float_t & asy, Float_t & angle, Bool_t & ok);
75
76   Int_t          GetNDaughters(const Int_t label,const AliCaloTrackReader* reader, Bool_t & ok);
77   TLorentzVector GetDaughter  (const Int_t daughter, const Int_t label,const AliCaloTrackReader* reader,
78                                Int_t & pdg, Int_t & status, Bool_t & ok, Int_t & daugLabel);
79
80   Int_t          GetNOverlaps(const Int_t * label, const UInt_t nlabels,
81                               const Int_t mctag, const Int_t mesonLabel,
82                               AliCaloTrackReader * reader,Int_t *overpdg);
83   
84   //Check or set the bits produced in the above methods
85   void    SetTagBit(Int_t &tag, const UInt_t set) const {
86     // Set bit of type set (mcTypes) in tag
87     tag |= (1<<set) ; 
88   } 
89   
90   Bool_t  CheckTagBit(const Int_t tag, const UInt_t test) const {
91     // Check if in tag the bit test (mcTypes) is set.
92     if (tag & (1<<test) ) return  kTRUE ;    
93     else return kFALSE ;
94   }
95   
96   //--------------------------------------
97   // Other methods
98   //--------------------------------------
99     
100   // Method to recover MC jets stored in generator
101   TList * GetJets(const AliCaloTrackReader * reader) ;
102   
103   void    SetDebug(Int_t deb)           { fDebug=deb           ; }
104   Int_t   GetDebug()              const { return fDebug        ; }      
105   
106   void    SetMCGenerator(TString mcgen) { fMCGenerator = mcgen ; }
107   TString GetMCGenerator()        const { return fMCGenerator  ; }      
108   
109   void    Print(const Option_t * opt) const;
110   void    PrintMCTag(const Int_t tag) const;
111
112  private:
113   Int_t   fCurrentEvent;        // Current Event
114   Int_t   fDebug;               // Debug level
115   TList * fJetsList;            // List of jets
116   TString fMCGenerator;         // MC geneator used to generate data in simulation
117   
118   AliMCAnalysisUtils & operator = (const AliMCAnalysisUtils & mcu) ; // cpy assignment
119   AliMCAnalysisUtils(              const AliMCAnalysisUtils & mcu) ; // cpy ctor
120   
121   ClassDef(AliMCAnalysisUtils,5)
122
123 } ;
124
125 #endif //ALIMCANALYSISUTILS_H
126
127
128