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