Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
om::WatchListManager Class Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-11-30/OnlineMonitoring/producer/WatchListManager.h"

Public Member Functions

void Add (int db, int dcm, int feb, int pix)
 
void Remove (int db, int dcm, int feb, int pix)
 
void GetList (std::vector< int > &db, std::vector< int > &dcm, std::vector< int > &feb, std::vector< int > &pix)
 
void FillPlots (int db, int dcm, int feb, int pix, double time, unsigned int adc)
 
void EndSubrunCleanUp ()
 

Static Public Member Functions

static WatchListManagerInstance ()
 

Private Member Functions

 WatchListManager ()
 
 ~WatchListManager ()
 

Private Attributes

struct WatchList fCurrentWL
 
std::vector< TH2F * > fWLTQ
 
std::vector< TH1F * > fWLT
 
std::vector< TH1F * > fWLQ
 

Detailed Description

Definition at line 28 of file WatchListManager.h.

Constructor & Destructor Documentation

WatchListManager::WatchListManager ( )
private

Definition at line 20 of file WatchListManager.cxx.

20  :
21  fCurrentWL()
22 { }
struct WatchList fCurrentWL
WatchListManager::~WatchListManager ( )
private

Definition at line 26 of file WatchListManager.cxx.

27 { }

Member Function Documentation

void WatchListManager::Add ( int  db,
int  dcm,
int  feb,
int  pix 
)

\ todo: send some kind of message to the viewer that the max WL

Definition at line 31 of file WatchListManager.cxx.

References om::WatchList::fActive, fCurrentWL, om::WatchList::fDB, om::WatchList::fDCM, om::WatchList::fFEB, om::WatchList::fPIX, fWLQ, fWLT, fWLTQ, om::HistoSet::GetTH1F(), om::HistoSet::GetTH2F(), make_syst_table_plots::h, MECModelEnuComparisons::i, om::HistoSet::Instance(), NMAX_WATCHLIST, and APDHVSetting::temp.

Referenced by om::OnMonProdIPC::AddToWatchList().

32 {
33 
34  ///\ todo: send some kind of message to the viewer that the max WL
35  // size has been exceeded???
36  if(fCurrentWL.fDB.size() >= NMAX_WATCHLIST) return;
37 
38  // test to see if item is already on the list
39  bool IsOnList = false;
40  unsigned int id;
41  for(unsigned int i = 0; i < fCurrentWL.fDB.size(); ++i) {
42  if(db == fCurrentWL.fDB[i] && dcm == fCurrentWL.fDCM[i] &&
43  feb == fCurrentWL.fFEB[i] && pix == fCurrentWL.fPIX[i]) {
44  IsOnList = true;
45  id = i;
46  break;
47  }
48  }
49 
50  if(IsOnList && fCurrentWL.fActive[id] == 1) return;
51  if(IsOnList && fCurrentWL.fActive[id] == 0)
52  fCurrentWL.fActive[id] = 1;
53  if(!IsOnList) {
54  // book the new histograms
56 
57  TGString WLlabel;
58  if(db < 0) WLlabel += "XX";
59  else {
60  char temp[64];
61  sprintf(temp, "%.2u", db);
62  WLlabel += temp;
63  }
64  WLlabel += "-";
65  if(dcm < 0) WLlabel += "XX";
66  else {
67  char temp[64];
68  sprintf(temp, "%.2u", dcm);
69  WLlabel += temp;
70  }
71  WLlabel += "-";
72  if(feb < 0) WLlabel += "XX";
73  else {
74  char temp[64];
75  sprintf(temp, "%.2u", feb);
76  WLlabel += temp;
77  }
78  WLlabel += "-";
79  if(pix < 0) WLlabel += "XX";
80  else {
81  char temp[64];
82  sprintf(temp, "%.2u", pix);
83  WLlabel += temp;
84  }
85 
86  TGString WLTQname = "WLTQPlot_";
87  TGString WLTname = "WLTPlot_";
88  TGString WLQname = "WLQPlot_";
89 
90  WLTQname += WLlabel;
91  fWLTQ.push_back(h.GetTH2F(WLTQname));
92 
93  WLTname += WLlabel;
94  fWLT.push_back(h.GetTH1F(WLTname));
95 
96  WLQname += WLlabel;
97  fWLQ.push_back(h.GetTH1F(WLQname));
98 
99  // add to list
100  fCurrentWL.fDB .push_back(db);
101  fCurrentWL.fDCM.push_back(dcm);
102  fCurrentWL.fFEB.push_back(feb);
103  fCurrentWL.fPIX.push_back(pix);
104  fCurrentWL.fActive.push_back(1);
105  }
106 
107 }
::xsd::cxx::tree::id< char, ncname > id
Definition: Database.h:165
std::vector< int > fDCM
TH1F * GetTH1F(const char *nm)
Definition: HistoSet.cxx:68
static const unsigned int NMAX_WATCHLIST
std::vector< TH1F * > fWLQ
std::vector< TH1F * > fWLT
TH2F * GetTH2F(const char *nm)
Definition: HistoSet.cxx:89
std::vector< int > fPIX
std::vector< int > fDB
std::vector< int > fActive
static HistoSet & Instance()
Definition: HistoSet.cxx:24
std::vector< TH2F * > fWLTQ
std::vector< int > fFEB
struct WatchList fCurrentWL
void WatchListManager::EndSubrunCleanUp ( )

Definition at line 173 of file WatchListManager.cxx.

References om::HistoSet::DeleteTH1F(), om::HistoSet::DeleteTH2F(), om::WatchList::fActive, fCurrentWL, om::WatchList::fDB, om::WatchList::fDCM, om::WatchList::fFEB, om::WatchList::fPIX, fWLQ, fWLT, fWLTQ, make_syst_table_plots::h, MECModelEnuComparisons::i, om::HistoSet::Instance(), and gen_flatrecord::size.

Referenced by om::OnMonProd::NewSubrunNumber().

174 {
175  // Clean up watchlist items marked as inactive and delete the associated
176  // histograms.
178 
179  std::vector< unsigned int > remove;
180 
181  for(unsigned int i = 0; i < fCurrentWL.fDB.size(); ++i) {
182  if(fCurrentWL.fActive[i] == 0) remove.push_back(i);
183  }
184 
185  for(unsigned int i = remove.size(); i > 0; i--) {
186  fCurrentWL.fDB .erase(fCurrentWL.fDB .begin()+remove[i-1]);
187  fCurrentWL.fDCM.erase(fCurrentWL.fDCM.begin()+remove[i-1]);
188  fCurrentWL.fFEB.erase(fCurrentWL.fFEB.begin()+remove[i-1]);
189  fCurrentWL.fPIX.erase(fCurrentWL.fPIX.begin()+remove[i-1]);
190  fCurrentWL.fActive.erase(fCurrentWL.fActive.begin()+remove[i-1]);
191 
192  h.DeleteTH2F(fWLTQ[remove[i-1]]);
193  fWLTQ.erase(fWLTQ.begin()+remove[i-1]);
194 
195  h.DeleteTH1F(fWLT[remove[i-1]]);
196  fWLT.erase(fWLT.begin()+remove[i-1]);
197 
198  h.DeleteTH1F(fWLQ[remove[i-1]]);
199  fWLQ.erase(fWLQ.begin()+remove[i-1]);
200  }
201 
202 }
std::vector< int > fDCM
std::vector< TH1F * > fWLQ
std::vector< TH1F * > fWLT
void DeleteTH1F(TH1F *h)
Definition: HistoSet.cxx:556
std::vector< int > fPIX
std::vector< int > fDB
void DeleteTH2F(TH2F *h)
Definition: HistoSet.cxx:575
std::vector< int > fActive
static HistoSet & Instance()
Definition: HistoSet.cxx:24
std::vector< TH2F * > fWLTQ
std::vector< int > fFEB
struct WatchList fCurrentWL
void WatchListManager::FillPlots ( int  db,
int  dcm,
int  feb,
int  pix,
double  time,
unsigned int  adc 
)

Definition at line 150 of file WatchListManager.cxx.

References om::WatchList::fActive, fCurrentWL, om::WatchList::fDB, om::WatchList::fDCM, om::WatchList::fFEB, om::WatchList::fPIX, fWLQ, fWLT, fWLTQ, and MECModelEnuComparisons::i.

Referenced by om::WLPlots::GetNanoSliceSummary().

152 {
153 
154  for(unsigned int i = 0; i < fCurrentWL.fDB.size(); ++i) {
155  if(fCurrentWL.fActive[i] == 1) {
156  if((db == fCurrentWL.fDB[i] || fCurrentWL.fDB[i] == -1) &&
157  (dcm == fCurrentWL.fDCM[i] || fCurrentWL.fDCM[i] == -1) &&
158  (feb == fCurrentWL.fFEB[i] || fCurrentWL.fFEB[i] == -1) &&
159  (pix == fCurrentWL.fPIX[i] || fCurrentWL.fPIX[i] == -1)) {
160 
161  fWLTQ[i]->Fill(time, adc);
162  fWLT [i]->Fill(time);
163  fWLQ [i]->Fill(adc);
164 
165  } // end if match to CurrentWL
166  } // end if fActive == 1
167  } // end loop over i
168 
169 }
std::vector< int > fDCM
std::vector< TH1F * > fWLQ
std::vector< TH1F * > fWLT
std::vector< int > fPIX
std::vector< int > fDB
std::vector< int > fActive
std::vector< TH2F * > fWLTQ
std::vector< int > fFEB
struct WatchList fCurrentWL
void WatchListManager::GetList ( std::vector< int > &  db,
std::vector< int > &  dcm,
std::vector< int > &  feb,
std::vector< int > &  pix 
)

Definition at line 133 of file WatchListManager.cxx.

References om::WatchList::fActive, fCurrentWL, om::WatchList::fDB, om::WatchList::fDCM, om::WatchList::fFEB, om::WatchList::fPIX, and MECModelEnuComparisons::i.

Referenced by om::OnMonProdIPC::CurrentWatchList().

137 {
138  for(unsigned int i = 0; i < fCurrentWL.fDB.size(); ++i) {
139  if(fCurrentWL.fActive[i] == 1) {
140  db .push_back(fCurrentWL.fDB [i]);
141  dcm.push_back(fCurrentWL.fDCM[i]);
142  feb.push_back(fCurrentWL.fFEB[i]);
143  pix.push_back(fCurrentWL.fPIX[i]);
144  }
145  }
146 }
std::vector< int > fDCM
std::vector< int > fPIX
std::vector< int > fDB
std::vector< int > fActive
std::vector< int > fFEB
struct WatchList fCurrentWL
WatchListManager & WatchListManager::Instance ( )
static
void WatchListManager::Remove ( int  db,
int  dcm,
int  feb,
int  pix 
)

Definition at line 111 of file WatchListManager.cxx.

References om::WatchList::fActive, fCurrentWL, om::WatchList::fDB, om::WatchList::fDCM, om::WatchList::fFEB, om::WatchList::fPIX, and MECModelEnuComparisons::i.

Referenced by om::OnMonProdIPC::RemoveFromWatchList().

112 {
113  // find location of item on the list
114  bool IsOnList = false;
115  unsigned int id;
116  for(unsigned int i = 0; i < fCurrentWL.fDB.size(); ++i) {
117  if(db == fCurrentWL.fDB[i] && dcm == fCurrentWL.fDCM[i] &&
118  feb == fCurrentWL.fFEB[i] && pix == fCurrentWL.fPIX[i]) {
119  IsOnList = true;
120  id = i;
121  break;
122  }
123  }
124 
125  if(IsOnList && fCurrentWL.fActive[id] == 0) return;
126  if(IsOnList && fCurrentWL.fActive[id] == 1)
127  fCurrentWL.fActive[id] = 0;
128 
129 }
::xsd::cxx::tree::id< char, ncname > id
Definition: Database.h:165
std::vector< int > fDCM
std::vector< int > fPIX
std::vector< int > fDB
std::vector< int > fActive
std::vector< int > fFEB
struct WatchList fCurrentWL

Member Data Documentation

struct WatchList om::WatchListManager::fCurrentWL
private

Definition at line 47 of file WatchListManager.h.

Referenced by Add(), EndSubrunCleanUp(), FillPlots(), GetList(), and Remove().

std::vector< TH1F* > om::WatchListManager::fWLQ
private

Definition at line 52 of file WatchListManager.h.

Referenced by Add(), EndSubrunCleanUp(), and FillPlots().

std::vector< TH1F* > om::WatchListManager::fWLT
private

Definition at line 51 of file WatchListManager.h.

Referenced by Add(), EndSubrunCleanUp(), and FillPlots().

std::vector< TH2F* > om::WatchListManager::fWLTQ
private

Definition at line 50 of file WatchListManager.h.

Referenced by Add(), EndSubrunCleanUp(), and FillPlots().


The documentation for this class was generated from the following files: