CbmRoot
Loading...
Searching...
No Matches
PairAnalysisCutGroup.cxx
Go to the documentation of this file.
1
2// //
3// Authors:
4// * Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
5// Julian Book <Julian.Book@cern.ch>
6//
7//
8// //
9// Allow to define groups of cut conditions which are tested with //
10// an OR condition between groups and an AND within groups //
11// //
13
15
17
19
20 PairAnalysisCutGroup::PairAnalysisCutGroup(Bool_t compOperator /*=kCompOR*/)
21 : AnalysisCuts()
22 , fCutGroupList(0x0)
23 , fCompOperator(compOperator)
24{
25 //
26 // Default constructor
27 //
28}
29
30//_____________________________________________________________________
31PairAnalysisCutGroup::PairAnalysisCutGroup(const char* name, const char* title, Bool_t compOperator /*=kCompOR*/)
32 : AnalysisCuts(name, title)
33 , fCutGroupList(0x0)
34 , fCompOperator(compOperator)
35{
36 //
37 // Named Constructor
38 //
39}
40
41//_____________________________________________________________________
43{
44 //
45 //Default Destructor
46 //
47}
48
49//_____________________________________________________________________
51{
52 // Loop over all cuts and call Init
53 TIter next(&fCutGroupList);
54 while (AnalysisCuts* thisCut = (AnalysisCuts*) next())
55 thisCut->Init();
56}
57
58//________________________________________________________________________
59Bool_t PairAnalysisCutGroup::IsSelected(Double_t* const values)
60{
61 //
62 // Make cut decision
63 //
64
65 //Different init for and/or makes code shorter
66 Bool_t selectionResult = fCompOperator;
67
68 TIter listIterator(&fCutGroupList);
69 while (AnalysisCuts* thisCut = (AnalysisCuts*) listIterator()) {
70 if (fCompOperator == static_cast<Bool_t>(ETruthValues::kCompOR)) {
71 selectionResult = (selectionResult || thisCut->IsSelected(values));
72 }
73 else { //kCompAND
74 selectionResult = (selectionResult && thisCut->IsSelected(values));
76 }
77 }
78 return selectionResult;
79}
80
81//_____________________________________________________________________
83{
84 //
85 // Selection-finder handling different comparison operations
86 //
87
88 if (!track) return kFALSE;
89
90 //Fill values
91 Double_t* values = PairAnalysisVarManager::GetData();
93 PairAnalysisVarManager::Fill(track, values);
94
96 return (IsSelected(values));
97}
98
99//_____________________________________________________________________
100
102{
103 //
104 // Add a defined cut to the list
105 //
106
107 fCutGroupList.Add(fCut);
108}
109
110//_____________________________________________________________________
112{
113 //
114 // Switch between AND/OR
115 //
116
117 fCompOperator = compOperator;
118}
119
120//________________________________________________________________________
121void PairAnalysisCutGroup::Print(const Option_t* /*option*/) const
122{
123 //
124 // Print cuts and the range
125 //
126
127 printf("*****************************************************************\n");
128 printf("cut group '%s'\n", GetTitle());
129 if (fCompOperator == static_cast<Bool_t>(ETruthValues::kCompAND)) { printf("Cut are compared with AND \n"); }
130 else {
131 printf("Cut are compared with OR \n");
132 }
133 TIter listIterator(&fCutGroupList);
134 while (AnalysisCuts* thisCut = (AnalysisCuts*) listIterator()) {
135 thisCut->Print();
136 }
137 printf("*****************************************************************\n");
138}
ClassImp(PairAnalysisCutGroup) PairAnalysisCutGroup
void AddCut(AnalysisCuts *fCut)
void SetCompOperator(Bool_t compOperator)
virtual Bool_t IsSelected(Double_t *const values)
PairAnalysisCutGroup(Bool_t compOperator=static_cast< Bool_t >(ETruthValues::kCompOR))
virtual void Print(const Option_t *option="") const
static void Fill(const TObject *particle, Double_t *const values)