#ifndef ALIMCANALYSISUTILS_H
#define ALIMCANALYSISUTILS_H
#include <TObject.h>
#include <TString.h>
#include <TLorentzVector.h>
class TList ;
class TVector3;
class AliCaloTrackReader ;
class AliStack ;
class AliMCAnalysisUtils : public TObject {
public:
AliMCAnalysisUtils() ;
virtual ~AliMCAnalysisUtils() ;
enum mcTypes { kMCPhoton, kMCPrompt, kMCFragmentation, kMCISR,
kMCPi0Decay, kMCEtaDecay, kMCOtherDecay,
kMCDecayPairLost, kMCDecayPairInCalo,
kMCDecayDalitz,kMCConversion, kMCElectron,
kMCEFromCFromB,kMCEFromC, kMCEFromB, kMCZDecay, kMCWDecay,
kMCMuon, kMCPion, kMCPi0, kMCKaon, kMCEta, kMCProton,
kMCAntiProton, kMCNeutron, kMCAntiNeutron,
kMCUnknown, kMCBadLabel } ;
Int_t CheckCommonAncestor(Int_t index1, Int_t index2, const AliCaloTrackReader* reader,
Int_t & ancPDG, Int_t & ancStatus, TLorentzVector & momentum, TVector3 & v) ;
Int_t CheckOrigin(Int_t label, const AliCaloTrackReader * reader, Int_t calorimeter) ;
Int_t CheckOrigin (const Int_t *label, Int_t nlabels, const AliCaloTrackReader * reader, Int_t calorimeter) ;
Int_t CheckOriginInStack(const Int_t *labels, Int_t nlabels, AliStack * stack , const TObjArray *arrayCluster) ;
Int_t CheckOriginInAOD (const Int_t *labels, Int_t nlabels, const TClonesArray* mcparticles, const TObjArray *arrayCluster) ;
void CheckOverlapped2GammaDecay(const Int_t *labels, Int_t nlabels, Int_t mesonIndex, AliStack * stack, Int_t & tag);
void CheckOverlapped2GammaDecay(const Int_t *labels, Int_t nlabels, Int_t mesonIndex, const TClonesArray* mcparticles, Int_t & tag);
void CheckLostDecayPair(const TObjArray *arrayCluster, Int_t iMom, Int_t iParent, AliStack* stack, Int_t & tag);
void CheckLostDecayPair(const TObjArray *arrayCluster, Int_t iMom, Int_t iParent, const TClonesArray* mcparticles, Int_t & tag);
TLorentzVector GetMother (Int_t label,const AliCaloTrackReader* reader, Bool_t & ok);
TLorentzVector GetMother (Int_t label,const AliCaloTrackReader* reader, Int_t & pdg, Int_t & status, Bool_t & ok);
TLorentzVector GetMother (Int_t label,const AliCaloTrackReader* reader, Int_t & pdg, Int_t & status, Bool_t & ok, Int_t & momLabel);
TLorentzVector GetGrandMother(Int_t label,const AliCaloTrackReader* reader,
Int_t & pdg, Int_t & status, Bool_t & ok, Int_t & grandMomLabel, Int_t & greatMomLabel);
TLorentzVector GetMotherWithPDG(Int_t label, Int_t pdg,const AliCaloTrackReader* reader, Bool_t & ok, Int_t & momLabel);
void GetMCDecayAsymmetryAngleForPDG(Int_t label, Int_t pdg,const AliCaloTrackReader* reader,
Float_t & asy, Float_t & angle, Bool_t & ok);
Int_t GetNDaughters(Int_t label,const AliCaloTrackReader* reader, Bool_t & ok);
TLorentzVector GetDaughter (Int_t daughter, Int_t label,const AliCaloTrackReader* reader,
Int_t & pdg, Int_t & status, Bool_t & ok, Int_t & daugLabel);
Int_t GetNOverlaps(const Int_t * label, UInt_t nlabels,
Int_t mctag, Int_t mesonLabel,
AliCaloTrackReader * reader,Int_t *overpdg);
void SetTagBit(Int_t &tag, UInt_t set) const {
tag |= (1<<set) ;
}
Bool_t CheckTagBit(Int_t tag, UInt_t test) const {
if (tag & (1<<test) ) return kTRUE ;
else return kFALSE ;
}
TList * GetJets(const AliCaloTrackReader * reader) ;
void SetDebug(Int_t deb) { fDebug=deb ; }
Int_t GetDebug() const { return fDebug ; }
enum generator {kPythia = 0, kHerwig = 1, kHijing = 2, kBoxLike = 3 } ;
void SetMCGenerator(Int_t mcgen) ;
void SetMCGenerator(TString mcgen) ;
Int_t GetMCGenerator() const { return fMCGenerator ; }
TString GetMCGeneratorString() const { return fMCGeneratorString ; }
void Print(const Option_t * opt) const;
void PrintMCTag(Int_t tag) const;
private:
Int_t fCurrentEvent;
Int_t fDebug;
TList * fJetsList;
Int_t fMCGenerator;
TString fMCGeneratorString;
TLorentzVector fDaughMom;
TLorentzVector fDaughMom2;
TLorentzVector fMotherMom;
TLorentzVector fGMotherMom;
AliMCAnalysisUtils & operator = (const AliMCAnalysisUtils & mcu) ;
AliMCAnalysisUtils( const AliMCAnalysisUtils & mcu) ;
ClassDef(AliMCAnalysisUtils,6)
} ;
#endif //ALIMCANALYSISUTILS_H