More mods to suit ROOT head
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnAnalysis.h
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  * See cxx source for full Copyright notice                               *
4  **************************************************************************/
5
6 //-------------------------------------------------------------------------
7 //                      Class AliRsnAnalysis
8 //             Reconstruction and analysis of K* Rsn
9 // ........................................
10 // ........................................
11 // ........................................
12 // ........................................
13 // 
14 // author: A. Pulvirenti             (email: alberto.pulvirenti@ct.infn.it)
15 //-------------------------------------------------------------------------
16
17 #ifndef AliRsnANALYSIS_H
18 #define AliRsnANALYSIS_H
19
20 #include <Htypes.h>
21 #include <TNamed.h>
22
23 #include "AliPID.h"
24
25 class TH1D;
26 class TObjArray;
27 class AliRsnEvent;
28 class AliRsnDaughter;
29 class AliRsnDaughterCut;
30
31 class AliRsnAnalysis : public TObject
32 {
33 public:
34
35                  AliRsnAnalysis();
36                          AliRsnAnalysis(const AliRsnAnalysis &copy) : TObject(copy) { }
37                          AliRsnAnalysis& operator=(const AliRsnAnalysis & /*copy*/) { return (*this); }
38         virtual ~AliRsnAnalysis() {Clear();}
39         
40         void     AddCutPair(AliRsnDaughterCut *cut);
41         void     AddCutSingle(AliPID::EParticleType type, AliRsnDaughterCut *cut);
42         void     AddMixPairDef(AliPID::EParticleType p1, Char_t s1, AliPID::EParticleType p2, Char_t s2);
43         void     AddPairDef(AliPID::EParticleType p1, Char_t s1, AliPID::EParticleType p2, Char_t s2, Bool_t onlyTrue = kFALSE);
44         void     Clear(Option_t *option = "");  
45         Stat_t   EventMix(Int_t nmix = 5, Int_t multDiffMax = 10, Double_t vzDiffMax = 0.01, Bool_t compareTotalMult = kFALSE);
46         Stat_t   Process();
47         void     SetBins(Int_t nbins, Double_t min, Double_t max) {fNBins=nbins;fHistoMin=min;fHistoMax=max;}
48         void     SetEventsTree(TTree *tree)                       {fEventsTree = tree;}
49         void     SetRejectFakes(Bool_t doit=kTRUE)                {fRejectFakes = doit;}                
50         void     SetTrueMotherPDG(Int_t pdg)                      {fTrueMotherPDG = pdg;}
51         void     WriteHistograms() const;
52         
53 private:
54
55         class AliPairDef : public TNamed
56         {
57         public:
58         
59                 AliPairDef(AliPID::EParticleType p1, Char_t s1, AliPID::EParticleType p2, Char_t s2, Int_t pdg, Bool_t onlyTrue = kFALSE);
60                                    
61                 virtual ~AliPairDef()                 { }
62                 
63                 Char_t                 GetSign1() const {return fSign1;}
64                 Char_t                 GetSign2() const {return fSign2;}
65                 Bool_t                 GetOnlyTrue() const {return fOnlyTrue;}
66                 AliPID::EParticleType  GetParticle1() const {return fParticle1;}
67                 AliPID::EParticleType  GetParticle2() const {return fParticle2;}
68                 Double_t               GetMass1() const {return fMass1;}
69                 Double_t               GetMass2() const {return fMass2;}
70                                 
71             void SetSign1(Char_t value)                 {fSign1 = value;}
72                 void SetSign2(Char_t value)                 {fSign2 = value;}
73                 void SetOnlyTrue(Bool_t value = kTRUE)      {fOnlyTrue = value;}
74                 void SetTrueMotherPDG(Int_t pdg)            {fTrueMotherPDG = pdg;}
75                 void SetParticle1(AliPID::EParticleType p)  {fParticle1 = p;}
76                 void SetParticle2(AliPID::EParticleType p)  {fParticle2 = p;}
77                 
78                 Text_t* ParticleName(AliPID::EParticleType part) const;
79                 
80         private:
81         
82                 Bool_t                 fOnlyTrue;          // flag to be used for spectra of true pairs
83                 Int_t                  fTrueMotherPDG; // PDG code of true mother (if requested)
84                 
85                 Double_t               fMass1;     // info
86                 Char_t                 fSign1;     // about
87                 AliPID::EParticleType  fParticle1; // particle 1
88         
89                 Double_t               fMass2;     // info
90                 Char_t                 fSign2;     // about
91                 AliPID::EParticleType  fParticle2; // particle 2
92         };
93         
94         Stat_t     Compute(AliPairDef *pd, TH1D* &h, AliRsnEvent *ev1, AliRsnEvent *ev2);
95         Bool_t     SingleCutCheck(Int_t itype, AliRsnDaughter *track) const;
96         Bool_t     PairCutCheck(AliRsnDaughter *track1, AliRsnDaughter *track2) const;
97         
98         Bool_t     fRejectFakes;             // reject particles labeled as fake
99         
100         Int_t      fNBins;                   // number of histogram bins
101         Double_t   fHistoMin;                // minimum of the histograms
102         Double_t   fHistoMax;                // maximum of the histograms
103         
104         Int_t      fTrueMotherPDG;           // PDG code of true mother (used to create 'true' histos)
105         
106         TObjArray *fMixPairDefs;             //  list of pair definitions for histograms (event mixing)
107         TObjArray *fMixHistograms;           //! list of invmass histograms created (event mixing)
108         
109         TObjArray *fPairDefs;                //  list of pair definitions for histograms
110         TObjArray *fHistograms;              //! list of invmass histograms created
111
112         TObjArray *fCuts[AliPID::kSPECIES];  //! list of single particle cuts for each particle type
113         TObjArray *fPairCuts;                //! list of pair cuts
114         TTree     *fEventsTree;              //! TTree of events (can not be created here, must be passed)
115         
116         // Rsn analysis implementation
117         ClassDef(AliRsnAnalysis,1)
118 };
119
120 #endif