StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StHbtCutMonitorHandler.cxx
1 
2 #include "StHbtMaker/Infrastructure/StHbtCutMonitorHandler.h"
3 #include "StHbtMaker/Infrastructure/StHbtTypes.hh"
4 
5 #ifdef __ROOT__
7 #endif
8 // ---------------------------------------------------------------------------
9 StHbtCutMonitorHandler::StHbtCutMonitorHandler() {
10  cout << " *** StHbtCutMonitorHandler::StHbtCutMonitorHandler() " << endl;
11  mCollectionsEmpty = 0;
12  mPassColl = new StHbtCutMonitorCollection();
13  mFailColl = new StHbtCutMonitorCollection();
14 }
15 // ---------------------------------------------------------------------------
16 StHbtCutMonitorHandler::~StHbtCutMonitorHandler() {
17  delete mPassColl;
18  delete mFailColl;
19 }
20 // ---------------------------------------------------------------------------
21 void StHbtCutMonitorHandler::FillCutMonitor(const StHbtEvent* event, bool pass) {
22  if (mCollectionsEmpty) return;
23  StHbtCutMonitorIterator iter;
24  StHbtCutMonitor* CM;
25  if ( pass) {
26  for (iter=mPassColl->begin(); iter!=mPassColl->end(); iter++){
27  CM = *iter;
28  CM->Fill(event);
29  }
30  } else {
31  for (iter=mFailColl->begin(); iter!=mFailColl->end(); iter++){
32  CM = *iter;
33  CM->Fill(event);
34  }
35  }
36 }
37 // ---------------------------------------------------------------------------
38 void StHbtCutMonitorHandler::FillCutMonitor(const StHbtTrack* track, bool pass) {
39  if (mCollectionsEmpty) return;
40  StHbtCutMonitorIterator iter;
41  StHbtCutMonitor* CM;
42  if ( pass) {
43  for (iter=mPassColl->begin(); iter!=mPassColl->end(); iter++){
44  CM = *iter;
45  CM->Fill(track);
46  }
47  } else {
48  for (iter=mFailColl->begin(); iter!=mFailColl->end(); iter++){
49  CM = *iter;
50  CM->Fill(track);
51  }
52  }
53 }
54 // ---------------------------------------------------------------------------
55 void StHbtCutMonitorHandler::FillCutMonitor(const StHbtV0* v0, bool pass) {
56  if (mCollectionsEmpty) return;
57  StHbtCutMonitorIterator iter;
58  StHbtCutMonitor* CM;
59  if ( pass) {
60  for (iter=mPassColl->begin(); iter!=mPassColl->end(); iter++){
61  CM = *iter;
62  CM->Fill(v0);
63  }
64  } else {
65  for (iter=mFailColl->begin(); iter!=mFailColl->end(); iter++){
66  CM = *iter;
67  CM->Fill(v0);
68  }
69  }
70 }
71 // ---------------------------------------------------------------------------
72 void StHbtCutMonitorHandler::FillCutMonitor(const StHbtKink* kink, bool pass) {
73  if (mCollectionsEmpty) return;
74  StHbtCutMonitorIterator iter;
75  StHbtCutMonitor* CM;
76  if ( pass) {
77  for (iter=mPassColl->begin(); iter!=mPassColl->end(); iter++){
78  CM = *iter;
79  CM->Fill(kink);
80  }
81  } else {
82  for (iter=mFailColl->begin(); iter!=mFailColl->end(); iter++){
83  CM = *iter;
84  CM->Fill(kink);
85  }
86  }
87 }
88 // ---------------------------------Gael/12/04/02-----------------------------
89 void StHbtCutMonitorHandler::FillCutMonitor(const StHbtPair* pair, bool pass) {
90  if (mCollectionsEmpty) return;
91  StHbtCutMonitorIterator iter;
92  StHbtCutMonitor* CM;
93  if ( pass) {
94  for (iter=mPassColl->begin(); iter!=mPassColl->end(); iter++){
95  CM = *iter;
96  CM->Fill(pair);
97  }
98  } else {
99  for (iter=mFailColl->begin(); iter!=mFailColl->end(); iter++){
100  CM = *iter;
101  CM->Fill(pair);
102  }
103  }
104 }
105 // ---------------------------------Gael/19/06/02-----------------------------
106 void StHbtCutMonitorHandler::FillCutMonitor(const StHbtParticleCollection* partColl) {
107  if (mCollectionsEmpty) return;
108  StHbtCutMonitorIterator iter;
109  StHbtCutMonitor* CM;
110 
111  for (iter=mPassColl->begin(); iter!=mPassColl->end(); iter++){
112  CM = *iter;
113  CM->Fill(partColl);
114  }
115 }
116 // ------------------------------------Gael/19/06/02-------------------------
117 void StHbtCutMonitorHandler::FillCutMonitor(const StHbtEvent* event,const StHbtParticleCollection* partColl) {
118 
119  cout<<"In StHbtCutMonitorHandler::FillCutMonitor(const StHbtEvent* event, StHbtPicoEvent* picoEvent)"<<endl;
120  if (mCollectionsEmpty) return;
121  StHbtCutMonitorIterator iter;
122  StHbtCutMonitor* CM;
123 
124  for (iter=mPassColl->begin(); iter!=mPassColl->end(); iter++){
125  CM = *iter;
126  CM->Fill(event,partColl);
127  }
128 }
129 // ---------------------------------------------------------------------------
130 void StHbtCutMonitorHandler::Finish() {
131  StHbtCutMonitorIterator iter;
132  for (iter=mPassColl->begin(); iter!=mPassColl->end(); iter++){
133  (*iter)->Finish();
134  }
135  for (iter=mFailColl->begin(); iter!=mFailColl->end(); iter++){
136  (*iter)->Finish();
137  }
138 }
139 // ---------------------------------------------------------------------------
140 void StHbtCutMonitorHandler::AddCutMonitor(StHbtCutMonitor* cutMoni1, StHbtCutMonitor* cutMoni2) {
141  mPassColl->push_back(cutMoni1);
142  mFailColl->push_back(cutMoni2);
143  mCollectionsEmpty=false;
144 }
145 // ---------------------------------------------------------------------------
146 void StHbtCutMonitorHandler::AddCutMonitor(StHbtCutMonitor* cutMoni) {
147  cout << " make a copy of the cutmonitor and push both into the collections " << endl;
148  cout << " not yet implemented" << endl;
149  mPassColl->push_back(cutMoni);
150  cout << " only pass collection pushed" << endl;
151  mCollectionsEmpty=false;
152 }
153 // ---------------------------------------------------------------------------
154 void StHbtCutMonitorHandler::AddCutMonitorPass(StHbtCutMonitor* cutMoni) {
155  mPassColl->push_back(cutMoni);
156  mCollectionsEmpty=false;
157 }
158 // ---------------------------------------------------------------------------
159 void StHbtCutMonitorHandler::AddCutMonitorFail(StHbtCutMonitor* cutMoni) {
160  mFailColl->push_back(cutMoni);
161  mCollectionsEmpty=false;
162 }
163 // ---------------------------------------------------------------------------
164 StHbtCutMonitor* StHbtCutMonitorHandler::PassMonitor(int n) {
165  StHbtCutMonitorIterator iter = mPassColl->begin();
166  if ( (int)mPassColl->size() <= n ) return NULL;
167  for ( int i=0; i<n; i++)
168  iter++;
169  return *iter;
170 }
171 // ---------------------------------------------------------------------------
172 StHbtCutMonitor* StHbtCutMonitorHandler::FailMonitor(int n) {
173  StHbtCutMonitorIterator iter = mFailColl->begin();
174  if ( (int)mFailColl->size() <= n ) return NULL;
175  for ( int i=0; i<n; i++)
176  iter++;
177  return *iter;
178 }
179 
180 
181 
182 
183