]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/RESONANCES/AliRsnMiniOutput.h
Merge branch 'master' into TPCdev
[u/mrichter/AliRoot.git] / PWGLF / RESONANCES / AliRsnMiniOutput.h
1 #ifndef ALIRSNMINIOUTPUT_H
2 #define ALIRSNMINIOUTPUT_H
3
4 //
5 // Mini-Output
6 // All the definitions needed for building a RSN histogram
7 // including:
8 // -- properties of resonance (mass, PDG code if needed)
9 // -- properties of daughters (assigned mass, charges)
10 // -- definition of output histogram
11 //
12
13 #include "AliRsnEvent.h"
14 #include "AliRsnDaughter.h"
15 #include "AliRsnMiniParticle.h"
16
17 class THnSparse;
18 class TList;
19 class TH1;
20
21 class TList;
22 class TClonesArray;
23 class AliRsnMiniAxis;
24 class AliRsnMiniPair;
25 class AliRsnMiniEvent;
26
27 typedef AliRsnDaughter::ESpecies RSNPID;
28
29 class AliRsnMiniOutput : public TNamed {
30 public:
31
32    enum EOutputType {
33       kHistogram,
34       kHistogramSparse,
35       kTypes
36    };
37
38    enum EComputation {
39       kEventOnly,
40       kTrackPair,
41       kTrackPairMix,
42       kTrackPairRotated1,
43       kTrackPairRotated2,
44       kTruePair,
45       kMother,
46       kComputations
47    };
48
49    AliRsnMiniOutput();
50    AliRsnMiniOutput(const char *name, EOutputType type, EComputation src = kTrackPair);
51    AliRsnMiniOutput(const char *name, const char *outType, const char *compType);
52    AliRsnMiniOutput(const AliRsnMiniOutput &copy);
53    AliRsnMiniOutput &operator=(const AliRsnMiniOutput &copy);
54
55    Bool_t          IsEventOnly()        const {return (fComputation == kEventOnly);}
56    Bool_t          IsTrackPair()        const {return (fComputation == kTrackPair);}
57    Bool_t          IsTrackPairMix()     const {return (fComputation == kTrackPairMix);}
58    Bool_t          IsTruePair()         const {return (fComputation == kTruePair);}
59    Bool_t          IsMother()           const {return (fComputation == kMother);}
60    Bool_t          IsDefined()          const {return (IsEventOnly() || IsTrackPair() || IsTrackPairMix() || IsTruePair() || IsMother());}
61    Bool_t          IsLikeSign()         const {return (fCharge[0] == fCharge[1]);}
62    Bool_t          IsSameCut()          const {return (fCutID[0] == fCutID[1]);}
63    Bool_t          IsSameDaughter()     const {return (fDaughter[0] == fDaughter[1]);}
64    //Bool_t          IsSymmetric()        const {return (IsLikeSign() && IsSameCut());}
65    Bool_t          IsSymmetric()        const {return (IsLikeSign() && IsSameDaughter());}
66
67    EOutputType     GetOutputType()      const {return fOutputType;}
68    EComputation    GetComputation()     const {return fComputation;}
69    Int_t           GetCutID(Int_t i)    const {if (i <= 0) return fCutID [0]; else return fCutID [1];}
70    RSNPID          GetDaughter(Int_t i) const {if (i <= 0) return fDaughter[0]; else return fDaughter[1];}
71    Double_t        GetMass(Int_t i)     const {return AliRsnDaughter::SpeciesMass(GetDaughter(i));}
72    Int_t           GetPDG(Int_t i)      const {return AliRsnDaughter::SpeciesPDG(GetDaughter(i));}
73    Int_t           GetCharge(Int_t i)   const {if (i <= 0) return fCharge[0]; else return fCharge[1];}
74    Int_t           GetMotherPDG()       const {return fMotherPDG;}
75    Double_t        GetMotherMass()      const {return fMotherMass;}
76    Bool_t          GetFillHistogramOnlyInRange() { return fCheckHistRange; }
77    Short_t         GetMaxNSisters()           {return fMaxNSisters;}
78
79    void            SetOutputType(EOutputType type)    {fOutputType = type;}
80    void            SetComputation(EComputation src)   {fComputation = src;}
81    void            SetCutID(Int_t i, Int_t   value)   {if (i <= 0) fCutID [0] = value; else fCutID [1] = value;}
82    void            SetDaughter(Int_t i, RSNPID value) {if (i <= 0) fDaughter[0] = value; else fDaughter[1] = value;}
83    void            SetCharge(Int_t i, Char_t  value)  {if (i <= 0) fCharge[0] = value; else fCharge[1] = value;}
84    void            SetMotherPDG(Int_t pdg)            {fMotherPDG = pdg;}
85    void            SetMotherMass(Double_t mass)       {fMotherMass = mass;}
86    void            SetPairCuts(AliRsnCutSet *set)     {fPairCuts = set;}
87    void            SetFillHistogramOnlyInRange(Bool_t fillInRangeOnly) { fCheckHistRange = fillInRangeOnly; }
88    void            SetMaxNSisters(Short_t n)          {fMaxNSisters = n;}
89    void            SetCheckMomentumConservation(Bool_t checkP) {fCheckP = checkP;}
90    void            SetCheckFeedDown(Bool_t checkFeedDown)      {fCheckFeedDown = checkFeedDown;}
91    void            SetDselection(UShort_t originDselection);
92    void            SetRejectCandidateIfNotFromQuark(Bool_t opt){fRejectIfNoQuark=opt;}
93
94    void            AddAxis(Int_t id, Int_t nbins, Double_t min, Double_t max);
95    void            AddAxis(Int_t id, Double_t min, Double_t max, Double_t step);
96    void            AddAxis(Int_t id, Int_t nbins, Double_t *values);
97    AliRsnMiniAxis *GetAxis(Int_t i)  {if (i >= 0 && i < fAxes.GetEntries()) return (AliRsnMiniAxis *)fAxes[i]; return 0x0;}
98    Double_t       *GetAllComputed()  {return fComputed.GetArray();}
99
100    AliRsnMiniPair &Pair() {return fPair;}
101    Bool_t          Init(const char *prefix, TList *list);
102    Bool_t          FillMother(const AliRsnMiniPair *pair, AliRsnMiniEvent *event, TClonesArray *valueList);
103    Bool_t          FillEvent(AliRsnMiniEvent *event, TClonesArray *valueList);
104    Int_t           FillPair(AliRsnMiniEvent *event1, AliRsnMiniEvent *event2, TClonesArray *valueList, Bool_t refFirst = kTRUE);
105
106 private:
107
108    void   CreateHistogram(const char *name);
109    void   CreateHistogramSparse(const char *name);
110    void   ComputeValues(AliRsnMiniEvent *event, TClonesArray *valueList);
111    void   FillHistogram();
112
113    EOutputType      fOutputType;       //  type of output
114    EComputation     fComputation;      //  type of computation
115    Int_t            fCutID[2];         //  ID of cut set used to select tracks
116    RSNPID           fDaughter[2];      //  species of daughters
117    Char_t           fCharge[2];        //  required track charge
118    Int_t            fMotherPDG;        //  PDG code of resonance
119    Double_t         fMotherMass;       //  nominal resonance mass
120    AliRsnCutSet    *fPairCuts;         //  cuts on the pair
121
122    Int_t            fOutputID;         //  index of output object in container list
123    TClonesArray     fAxes;             //  definitions for the axes of each value
124    TArrayD          fComputed;         //! temporary container for all computed values
125    AliRsnMiniPair   fPair;             //! minipair for computations
126    TList           *fList;             //! pointer to the TList containing the output
127    TArrayI          fSel1;             //! list of selected particles for definition 1
128    TArrayI          fSel2;             //! list of selected particles for definition 2
129    Short_t          fMaxNSisters;      // maximum number of allowed mother's daughter
130    Bool_t           fCheckP;           // flag to set in order to check the momentum conservation for daughters
131    Bool_t           fCheckFeedDown;    // flag to set in order to check the particle feed down (specific for D meson analysis)
132    UShort_t         fOriginDselection; // flag to select D0 origins. 0 Only from charm 1 only from beauty 2 both from charm and beauty (specific for D meson analysis)
133    Bool_t           fKeepDfromB;       // flag for the feed down from b quark decay (specific for D meson analysis)                       
134    Bool_t           fKeepDfromBOnly;   // flag to keep only the charm particles that comes from beauty decays (specific for D meson analysis)
135    Bool_t           fRejectIfNoQuark;  // flag to remove events not generated with PYTHIA
136    Bool_t           fCheckHistRange;   //  check if values is in histogram range
137
138    ClassDef(AliRsnMiniOutput, 4)  // AliRsnMiniOutput class
139 };
140
141 #endif