00001
00002 #include "StHbtMaker/Infrastructure/StHbtCutMonitorHandler.h"
00003 #include "StHbtMaker/Infrastructure/StHbtTypes.hh"
00004
00005 #ifdef __ROOT__
00006 ClassImp(StHbtCutMonitorHandler)
00007 #endif
00008
00009 StHbtCutMonitorHandler::StHbtCutMonitorHandler() {
00010 cout << " *** StHbtCutMonitorHandler::StHbtCutMonitorHandler() " << endl;
00011 mCollectionsEmpty = 0;
00012 mPassColl = new StHbtCutMonitorCollection();
00013 mFailColl = new StHbtCutMonitorCollection();
00014 }
00015
00016 StHbtCutMonitorHandler::~StHbtCutMonitorHandler() {
00017 delete mPassColl;
00018 delete mFailColl;
00019 }
00020
00021 void StHbtCutMonitorHandler::FillCutMonitor(const StHbtEvent* event, bool pass) {
00022 if (mCollectionsEmpty) return;
00023 StHbtCutMonitorIterator iter;
00024 StHbtCutMonitor* CM;
00025 if ( pass) {
00026 for (iter=mPassColl->begin(); iter!=mPassColl->end(); iter++){
00027 CM = *iter;
00028 CM->Fill(event);
00029 }
00030 } else {
00031 for (iter=mFailColl->begin(); iter!=mFailColl->end(); iter++){
00032 CM = *iter;
00033 CM->Fill(event);
00034 }
00035 }
00036 }
00037
00038 void StHbtCutMonitorHandler::FillCutMonitor(const StHbtTrack* track, bool pass) {
00039 if (mCollectionsEmpty) return;
00040 StHbtCutMonitorIterator iter;
00041 StHbtCutMonitor* CM;
00042 if ( pass) {
00043 for (iter=mPassColl->begin(); iter!=mPassColl->end(); iter++){
00044 CM = *iter;
00045 CM->Fill(track);
00046 }
00047 } else {
00048 for (iter=mFailColl->begin(); iter!=mFailColl->end(); iter++){
00049 CM = *iter;
00050 CM->Fill(track);
00051 }
00052 }
00053 }
00054
00055 void StHbtCutMonitorHandler::FillCutMonitor(const StHbtV0* v0, bool pass) {
00056 if (mCollectionsEmpty) return;
00057 StHbtCutMonitorIterator iter;
00058 StHbtCutMonitor* CM;
00059 if ( pass) {
00060 for (iter=mPassColl->begin(); iter!=mPassColl->end(); iter++){
00061 CM = *iter;
00062 CM->Fill(v0);
00063 }
00064 } else {
00065 for (iter=mFailColl->begin(); iter!=mFailColl->end(); iter++){
00066 CM = *iter;
00067 CM->Fill(v0);
00068 }
00069 }
00070 }
00071
00072 void StHbtCutMonitorHandler::FillCutMonitor(const StHbtKink* kink, bool pass) {
00073 if (mCollectionsEmpty) return;
00074 StHbtCutMonitorIterator iter;
00075 StHbtCutMonitor* CM;
00076 if ( pass) {
00077 for (iter=mPassColl->begin(); iter!=mPassColl->end(); iter++){
00078 CM = *iter;
00079 CM->Fill(kink);
00080 }
00081 } else {
00082 for (iter=mFailColl->begin(); iter!=mFailColl->end(); iter++){
00083 CM = *iter;
00084 CM->Fill(kink);
00085 }
00086 }
00087 }
00088
00089 void StHbtCutMonitorHandler::FillCutMonitor(const StHbtPair* pair, bool pass) {
00090 if (mCollectionsEmpty) return;
00091 StHbtCutMonitorIterator iter;
00092 StHbtCutMonitor* CM;
00093 if ( pass) {
00094 for (iter=mPassColl->begin(); iter!=mPassColl->end(); iter++){
00095 CM = *iter;
00096 CM->Fill(pair);
00097 }
00098 } else {
00099 for (iter=mFailColl->begin(); iter!=mFailColl->end(); iter++){
00100 CM = *iter;
00101 CM->Fill(pair);
00102 }
00103 }
00104 }
00105
00106 void StHbtCutMonitorHandler::FillCutMonitor(const StHbtParticleCollection* partColl) {
00107 if (mCollectionsEmpty) return;
00108 StHbtCutMonitorIterator iter;
00109 StHbtCutMonitor* CM;
00110
00111 for (iter=mPassColl->begin(); iter!=mPassColl->end(); iter++){
00112 CM = *iter;
00113 CM->Fill(partColl);
00114 }
00115 }
00116
00117 void StHbtCutMonitorHandler::FillCutMonitor(const StHbtEvent* event,const StHbtParticleCollection* partColl) {
00118
00119 cout<<"In StHbtCutMonitorHandler::FillCutMonitor(const StHbtEvent* event, StHbtPicoEvent* picoEvent)"<<endl;
00120 if (mCollectionsEmpty) return;
00121 StHbtCutMonitorIterator iter;
00122 StHbtCutMonitor* CM;
00123
00124 for (iter=mPassColl->begin(); iter!=mPassColl->end(); iter++){
00125 CM = *iter;
00126 CM->Fill(event,partColl);
00127 }
00128 }
00129
00130 void StHbtCutMonitorHandler::Finish() {
00131 StHbtCutMonitorIterator iter;
00132 for (iter=mPassColl->begin(); iter!=mPassColl->end(); iter++){
00133 (*iter)->Finish();
00134 }
00135 for (iter=mFailColl->begin(); iter!=mFailColl->end(); iter++){
00136 (*iter)->Finish();
00137 }
00138 }
00139
00140 void StHbtCutMonitorHandler::AddCutMonitor(StHbtCutMonitor* cutMoni1, StHbtCutMonitor* cutMoni2) {
00141 mPassColl->push_back(cutMoni1);
00142 mFailColl->push_back(cutMoni2);
00143 mCollectionsEmpty=false;
00144 }
00145
00146 void StHbtCutMonitorHandler::AddCutMonitor(StHbtCutMonitor* cutMoni) {
00147 cout << " make a copy of the cutmonitor and push both into the collections " << endl;
00148 cout << " not yet implemented" << endl;
00149 mPassColl->push_back(cutMoni);
00150 cout << " only pass collection pushed" << endl;
00151 mCollectionsEmpty=false;
00152 }
00153
00154 void StHbtCutMonitorHandler::AddCutMonitorPass(StHbtCutMonitor* cutMoni) {
00155 mPassColl->push_back(cutMoni);
00156 mCollectionsEmpty=false;
00157 }
00158
00159 void StHbtCutMonitorHandler::AddCutMonitorFail(StHbtCutMonitor* cutMoni) {
00160 mFailColl->push_back(cutMoni);
00161 mCollectionsEmpty=false;
00162 }
00163
00164 StHbtCutMonitor* StHbtCutMonitorHandler::PassMonitor(int n) {
00165 StHbtCutMonitorIterator iter = mPassColl->begin();
00166 if ( (int)mPassColl->size() <= n ) return NULL;
00167 for ( int i=0; i<n; i++)
00168 iter++;
00169 return *iter;
00170 }
00171
00172 StHbtCutMonitor* StHbtCutMonitorHandler::FailMonitor(int n) {
00173 StHbtCutMonitorIterator iter = mFailColl->begin();
00174 if ( (int)mFailColl->size() <= n ) return NULL;
00175 for ( int i=0; i<n; i++)
00176 iter++;
00177 return *iter;
00178 }
00179
00180
00181
00182
00183