]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/AliRsnMonitor.cxx
Add new version of macros for RSN analysis
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnMonitor.cxx
1 //
2 // *** Class AliRsnMonitor ***
3 //
4 // "Core" method for defining the work on a pari of particles.
5 // For one analysis, one must setup one of this for each pair he wants to analyze,
6 // adding to it all analysis which he desires to do.
7 // Here he defines the cuts, and the particle types and charges, and can add
8 // functions which do different operations on the same pair, and some binning
9 // with respect to some kinematic variables (eta, momentum)
10 //
11 // authors: A. Pulvirenti (email: alberto.pulvirenti@ct.infn.it)
12 //          M. Vala (email: martin.vala@cern.ch)
13 //
14
15 #include "AliLog.h"
16
17 #include "AliRsnTarget.h"
18 #include "AliRsnEvent.h"
19 #include "AliRsnValue.h"
20
21 #include "AliRsnMonitor.h"
22
23 ClassImp(AliRsnMonitor)
24
25 //_____________________________________________________________________________
26 AliRsnMonitor::AliRsnMonitor(const char *name, AliRsnDaughterDef *def) :
27    TNamed(name, ""),
28    fOnlyTrue(kFALSE),
29    fCount(0),
30    fDaughterDef(def),
31    fCuts(Form("cuts_%s", name), AliRsnTarget::kDaughter),
32    fDaughter(0)
33 {
34 //
35 // Default constructor
36 //
37 }
38
39 //_____________________________________________________________________________
40 AliRsnMonitor::AliRsnMonitor(const AliRsnMonitor& copy) :
41    TNamed(copy),
42    fOnlyTrue(copy.fOnlyTrue),
43    fCount(copy.fCount),
44    fDaughterDef(copy.fDaughterDef),
45    fCuts(copy.fCuts),
46    fDaughter(copy.fDaughter)
47 {
48 //
49 // Default constructor
50 //
51 }
52
53 //_____________________________________________________________________________
54 AliRsnMonitor& AliRsnMonitor::operator=(const AliRsnMonitor& copy)
55 {
56    fOnlyTrue = copy.fOnlyTrue;
57    fCount = copy.fCount;
58    fCuts = copy.fCuts;
59    fDaughter = copy.fDaughter;
60    fDaughterDef = copy.fDaughterDef;
61
62    return (*this);
63 }
64
65 //_____________________________________________________________________________
66 AliRsnMonitor::~AliRsnMonitor()
67 {
68 //
69 // Destructor
70 //
71 }
72
73 //_____________________________________________________________________________
74 void AliRsnMonitor::Print(Option_t* /*option*/) const
75 {
76 //
77 // Prints info about pair
78 //
79 }
80
81 //_____________________________________________________________________________
82 Bool_t AliRsnMonitor::Fill(AliRsnDaughter *daughter)
83 {
84 //
85 // Sets the two passed daughters to the AliRsnMother data member of this object
86 // which is used to perform all computations to fill the value list.
87 // This operation is done successfully only when the first passed object matches
88 // the required object type (track/V0) and the required charge for first element in pair def,
89 // and the second passed object does the same w.r. to the second element in pair def.
90 // Moreover, all cuts are checked and the operation fails if a cut check is unsuccessful.
91 // Finally, if a true pair is required, this is checked at the end.
92 //
93
94    AliDebug(AliLog::kDebug + 2, "<-");
95    
96    // check match with prototype
97    // include check on true PID if required
98    if (!fDaughterDef->MatchesDaughter(daughter, fOnlyTrue)) return kFALSE;
99    
100    // if matching is successful
101    // update track data member and assigh default mass
102    fDaughter = daughter;
103    fDaughter->SetMass(fDaughterDef->GetMass());
104
105    // check the cuts
106    if (!fCuts.IsSelected(daughter)) return kFALSE;
107    
108    // if track is accepted increment counter   
109    ++fCount;
110
111    return kTRUE;
112 }
113
114 //_____________________________________________________________________________
115 void AliRsnMonitor::Compute()
116 {
117 //
118 // Virtual method to compute pair quantities of interest
119 //
120
121    AliWarning("Implement this method in derived classes");
122 }
123
124 //_____________________________________________________________________________
125 void AliRsnMonitor::Init(const char* /*prefix*/, TList* /*list*/)
126 {
127 //
128 // Virtual method to compute pair quantities of interest
129 //
130
131    AliWarning("Implement this method in derived classes");
132 }