]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/RESONANCES/AliRsnCutManager.h
K0s code update (Matt Steinpreis)
[u/mrichter/AliRoot.git] / PWGLF / RESONANCES / AliRsnCutManager.h
1 //
2 // *** Class AliRsnCutManager ***
3 //
4 // This class is used both in normal analysis and efficiency computation
5 // as a collection of all cuts which could be needed in a single job.
6 // It allocates an AliRsnCutSet for each possible target:
7 //  - one with all cuts common to all tracks
8 //  - one with all cuts for first candidate daughter (definition #1 in pairDef)
9 //  - one with all cuts for second candidate daughter (definition #2 in pairDef)
10 //  - one with all cuts on the pair
11 // -----
12 // This object is used to define a step in efficiency CORRFW container
13 // and also is contained in all AliRsnPair objects to decide if two candidates
14 // can be accepted or not.
15 //
16 // authors: Martin Vala (martin.vala@cern.ch)
17 //          Alberto Pulvirenti (alberto.pulvirenti@cern.ch)
18 //
19
20 #ifndef ALIRSNCUTMANAGER_H
21 #define ALIRSNCUTMANAGER_H
22
23 #include <TNamed.h>
24
25 #include "AliRsnDaughter.h"
26 #include "AliRsnMother.h"
27 #include "AliRsnCutSet.h"
28
29 class AliRsnCut;
30
31 class AliRsnCutManager : public TNamed {
32 public:
33
34    AliRsnCutManager();
35    AliRsnCutManager(const char *name, const char *title = "");
36    AliRsnCutManager(const AliRsnCutManager &cut);
37    AliRsnCutManager &operator=(const AliRsnCutManager &cut);
38    ~AliRsnCutManager();
39
40    AliRsnCutSet  *GetCommonDaughterCuts() {return &fDaughterCutsCommon;}
41    AliRsnCutSet  *GetDaughter1Cuts()      {return &fDaughterCuts1;}
42    AliRsnCutSet  *GetDaughter2Cuts()      {return &fDaughterCuts2;}
43    AliRsnCutSet  *GetMotherCuts()         {return &fMotherCuts;}
44
45    Bool_t         IsSelected(TObject *object);
46    Bool_t         PassCommonDaughterCuts(AliRsnDaughter *daughter) {return fDaughterCutsCommon.IsSelected(daughter);}
47    Bool_t         PassDaughter1Cuts(AliRsnDaughter *daughter)      {return fDaughterCuts1.IsSelected(daughter);}
48    Bool_t         PassDaughter2Cuts(AliRsnDaughter *daughter)      {return fDaughterCuts2.IsSelected(daughter);}
49    Bool_t         PassMotherCuts(AliRsnMother *mother)             {return fMotherCuts.IsSelected(mother);}
50    Bool_t         PassSpecificDaughterCuts(Bool_t first, AliRsnDaughter *daughter)
51    {if (first) return PassDaughter1Cuts(daughter); else return PassDaughter2Cuts(daughter);}
52
53 private:
54
55    AliRsnCutSet  fDaughterCutsCommon; // single-track cuts common to both daughters
56    AliRsnCutSet  fDaughterCuts1;      // single-track cuts for only first daughter
57    AliRsnCutSet  fDaughterCuts2;      // single-track cuts for only second daughter
58    AliRsnCutSet  fMotherCuts;         // mother cuts (on relations between daughters)
59
60    ClassDef(AliRsnCutManager, 2)      // dictionary
61 };
62
63 inline Bool_t AliRsnCutManager::IsSelected(TObject *object)
64 {
65 //
66 // Check all selection cuts
67 //
68
69    if (object->InheritsFrom(AliRsnDaughter::Class())) {
70       return PassCommonDaughterCuts((AliRsnDaughter *)object);
71    } else if (object->InheritsFrom(AliRsnMother::Class())) {
72       AliRsnMother *mother = (AliRsnMother *)object;
73       if (!PassCommonDaughterCuts(mother->GetDaughter(0))) return kFALSE;
74       if (!PassCommonDaughterCuts(mother->GetDaughter(1))) return kFALSE;
75       if (!PassDaughter1Cuts(mother->GetDaughter(0))) return kFALSE;
76       if (!PassDaughter2Cuts(mother->GetDaughter(1))) return kFALSE;
77       if (!PassMotherCuts(mother)) return kFALSE;
78       return kTRUE;
79    } else {
80       AliError("AliRsnCutManager can check only daughters and mothers");
81       return kFALSE;
82    }
83 }
84
85 #endif