Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
om::FEBRatesByDiblock Class Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-12-03/OnlineMonitoring/producer/FEBRatesByDiblock.h"

Inheritance diagram for om::FEBRatesByDiblock:
om::SummarySubscriber

Public Types

enum  _which { kEvent = 0x01, kDataBlock = 0x02, kMicroSlice = 0x04, kNanoSlice = 0x08 }
 Which summaries does a class want to subscribe to? More...
 

Public Member Functions

 FEBRatesByDiblock ()
 
 ~FEBRatesByDiblock ()
 
virtual void GetNanoSliceSummary (const RawEventSummary &r, const DataBlockSummary &dbs, const MicroSliceSummary &mss, const NanoSliceSummary &nss)
 Interface to the nanoslice summary. More...
 
virtual void GetRawEventSummary (const RawEventSummary &res)
 Interface to the event summary. More...
 
virtual void GetDataBlockSummary (const RawEventSummary &res, const DataBlockSummary &dbs)
 Interface to the data block summary. More...
 
virtual void GetMicroSliceSummary (const RawEventSummary &res, const DataBlockSummary &dbs, const MicroSliceSummary &mss)
 Interface to the microslice summary. More...
 

Private Member Functions

void UpdateRatePlots ()
 

Private Attributes

daqchannelmap::HardwareDisplayfHwMap
 
TH2F * fFEBRatesDB [numDB]
 
TH2F * fFEBHitsDB [numDB]
 
TH2F * fDCMRates
 
TH2F * fDCMHits
 
TH2F * fEmptyDCMs
 
TH1F * fLiveTime
 
TH1F * fHitMapEvtCount
 
TH1F * fRecordedTime
 
std::vector< unsigned intfDCMs
 
time_t fLastTime
 
unsigned int fDCMpDB
 

Detailed Description

Definition at line 21 of file FEBRatesByDiblock.h.

Member Enumeration Documentation

Which summaries does a class want to subscribe to?

Enumerator
kEvent 
kDataBlock 
kMicroSlice 
kNanoSlice 

Definition at line 20 of file SummarySubscriber.h.

Constructor & Destructor Documentation

FEBRatesByDiblock::FEBRatesByDiblock ( )

Definition at line 16 of file FEBRatesByDiblock.cxx.

References fDCMHits, fDCMpDB, fDCMRates, fDCMs, fEmptyDCMs, fFEBHitsDB, fFEBRatesDB, fHitMapEvtCount, fHwMap, fLastTime, fLiveTime, daqchannelmap::HardwareDisplay::fNdcmSide, daqchannelmap::HardwareDisplay::fNdcmTop, daqchannelmap::HardwareDisplay::fNdiblocks, fRecordedTime, om::HistoSet::GetTH1F(), om::HistoSet::GetTH2F(), make_syst_table_plots::h, MECModelEnuComparisons::i, om::Settings::Instance(), om::HistoSet::Instance(), numDB, and daqchannelmap::HardwareDisplay::SetupDet().

16  :
19 {
22 
24 
25  for(unsigned int i = 0; i < numDB; ++i) {
26  fFEBRatesDB[i] = 0;
27  fFEBHitsDB[i] = 0;
28  }
29 
30  fRecordedTime = h.GetTH1F("RecordedTime");
31  fHitMapEvtCount = h.GetTH1F("HitMapEvtCount");
32  fDCMRates = h.GetTH2F("DCMRatesVsHour");
33  fDCMHits = h.GetTH2F("DCMHitsVsHour");
34  fEmptyDCMs = h.GetTH2F("EmptyDCMsVsHour");
35  fLiveTime = h.GetTH1F("LiveTimeVsHour");
36 
37  fDCMs.clear();
38  fDCMs.resize(fDCMpDB*(fHwMap->fNdiblocks)+1);
39 
40  fLastTime = time(0);
41 }
TH1F * GetTH1F(const char *nm)
Definition: HistoSet.cxx:68
unsigned int fNdcmSide
Number of DMC&#39;s per diblock on side of detector.
::xsd::cxx::tree::time< char, simple_type > time
Definition: Database.h:194
static const unsigned int numDB
unsigned int fNdiblocks
Number of diblocks in detector.
std::vector< unsigned int > fDCMs
TH2F * GetTH2F(const char *nm)
Definition: HistoSet.cxx:89
unsigned int fNdcmTop
Number of DMC&#39;s per diblock on top of detector.
daqchannelmap::HardwareDisplay * fHwMap
static HistoSet & Instance()
Definition: HistoSet.cxx:24
static Settings & Instance()
Definition: Settings.cxx:12
FEBRatesByDiblock::~FEBRatesByDiblock ( )

Definition at line 45 of file FEBRatesByDiblock.cxx.

References fHwMap.

45  {
46  if(fHwMap) {delete fHwMap; fHwMap = 0;}
47 }
daqchannelmap::HardwareDisplay * fHwMap

Member Function Documentation

virtual void om::SummarySubscriber::GetDataBlockSummary ( const RawEventSummary res,
const DataBlockSummary dbs 
)
inlinevirtualinherited

Interface to the data block summary.

Reimplemented in om::DataBlockErrors.

Definition at line 35 of file SummarySubscriber.h.

36  { abort(); }
virtual void om::SummarySubscriber::GetMicroSliceSummary ( const RawEventSummary res,
const DataBlockSummary dbs,
const MicroSliceSummary mss 
)
inlinevirtualinherited

Interface to the microslice summary.

Reimplemented in om::MicroErrors.

Definition at line 39 of file SummarySubscriber.h.

41  { abort(); }
void FEBRatesByDiblock::GetNanoSliceSummary ( const RawEventSummary res,
const DataBlockSummary dbs,
const MicroSliceSummary mss,
const NanoSliceSummary nss 
)
virtual

Interface to the nanoslice summary.

Reimplemented from om::SummarySubscriber.

Definition at line 51 of file FEBRatesByDiblock.cxx.

References E, om::MicroSliceSummary::fDCM, fDCMHits, fDCMpDB, fDCMs, om::MicroSliceSummary::fDiblock, fEmptyDCMs, om::RawEventSummary::fEvent, om::NanoSliceSummary::fFEB, fFEBHitsDB, fFEBRatesDB, fHitMapEvtCount, om::RawEventSummary::fHour, fHwMap, fLastTime, fLiveTime, stan::math::floor(), daqchannelmap::HardwareDisplay::fNdiblocks, om::RawEventSummary::fRange, fRecordedTime, om::RawEventSummary::fRun, om::HistoSet::GetTH2F(), make_syst_table_plots::h, MECModelEnuComparisons::i, om::HistoSet::Instance(), fillBadChanDBTables::lastRun, produceInfoGainMatrix::nEvents, PandAna.Demos.demo1::range, febshutoff_auto::start, confusionMatrixTree::t, and UpdateRatePlots().

55 {
57 
58  static unsigned int lastRun=0, lastEvent=0;
59  static const double secPerRange = 5E-7; // fRange is in units of 500nsec
60 
61  // Don't do the standard histogram filling if this is the VERY start of
62  // OnMon running.
63  static bool start = true;
64 
65  if((lastRun!=r.fRun || lastEvent!=r.fEvent) && !start) {
66 
67  double recordedSec = (fRecordedTime->Integral())*secPerRange;
68  double nEvents = fHitMapEvtCount->Integral();
69 
70  // Update empty DCMs plot and reset the list of DCMs
71  for(unsigned int i = 1; i <= fDCMpDB*(fHwMap->fNdiblocks); ++i)
72  if(fDCMs[i] == 0) fEmptyDCMs->Fill(r.fHour,i);
73 
74  fDCMs.clear();
75  fDCMs.resize(fDCMpDB*(fHwMap->fNdiblocks)+1);
76 
77 
78 
79  // Get the current UNIX time in seconds
80  time_t t = time(0);
81 
82  // only update the rate plots every 120 seconds
83  if((int)nEvents%1000 == 0 && recordedSec != 0.0){
84  fLastTime = t;
85  this->UpdateRatePlots();
86  }
87 
88  double range = (double)r.fRange;
89 
90  // Adjust the range due to the fact that we always get any micro blocks
91  // that touch the edge of the trigger range.
92  range = 100.0*floor(range/100.0)+100.0;
93 
94  fLiveTime->Fill(r.fHour,range);
95 
96  }
97 
98  lastRun = r.fRun;
99  lastEvent = r.fEvent;
100  start = false;
101 
102  if(fFEBHitsDB[mss.fDiblock] == 0) {
103  char histoname[64];
104  sprintf(histoname,"FEBHitsVsHourDB_%.2u",mss.fDiblock);
105  fFEBHitsDB[mss.fDiblock] = h.GetTH2F(histoname);
106  }
107 
108  if(fFEBRatesDB[mss.fDiblock] == 0) {
109  char histoname[64];
110  sprintf(histoname,"FEBRatesVsHourDB_%.2u",mss.fDiblock);
111  fFEBRatesDB[mss.fDiblock] = h.GetTH2F(histoname);
112  }
113 
114  // Fill the FEB hit plot
115  fFEBHitsDB[mss.fDiblock]->Fill(r.fHour,(mss.fDCM-1)*64+nss.fFEB);
116 
117  // Fill the DCM hit plot
118  fDCMHits->Fill(r.fHour,(mss.fDiblock-1)*fDCMpDB+mss.fDCM);
119 
120  // Record if this DCM has reported yet or not
121  fDCMs[(mss.fDiblock-1)*fDCMpDB+mss.fDCM] = 1;
122 
123 }
unsigned int fDCM
DCM ID.
unsigned int fDiblock
Diblock ID.
::xsd::cxx::tree::time< char, simple_type > time
Definition: Database.h:194
unsigned int fNdiblocks
Number of diblocks in detector.
std::vector< unsigned int > fDCMs
Float_t E
Definition: plot.C:20
TH2F * GetTH2F(const char *nm)
Definition: HistoSet.cxx:89
daqchannelmap::HardwareDisplay * fHwMap
fvar< T > floor(const fvar< T > &x)
Definition: floor.hpp:11
TRandom3 r(0)
unsigned int fFEB
FEB number of nanoslice (aka "hit")
static HistoSet & Instance()
Definition: HistoSet.cxx:24
virtual void om::SummarySubscriber::GetRawEventSummary ( const RawEventSummary res)
inlinevirtualinherited

Interface to the event summary.

Reimplemented in om::TriggerPlots, om::RawEventErrors, and om::HitCounts.

Definition at line 32 of file SummarySubscriber.h.

32 { abort(); };
void FEBRatesByDiblock::UpdateRatePlots ( )
private

Definition at line 127 of file FEBRatesByDiblock.cxx.

References febshutoff_auto::db, E, fDCMHits, fDCMRates, fFEBHitsDB, fFEBRatesDB, fLiveTime, MECModelEnuComparisons::i, calib::j, and numDB.

Referenced by GetNanoSliceSummary().

127  {
128 
129  static const double secPerRange = 5E-7; // fRange is in units of 500nsec
130 
131  //
132  // Compute FEB rates
133  //
134  for(unsigned int db = 0; db < numDB; ++db) {
135 
136  if(fFEBHitsDB[db] == 0) continue;
137 
138  unsigned int nx = fFEBHitsDB[db]->GetNbinsX();
139  unsigned int ny = fFEBHitsDB[db]->GetNbinsY();
140 
141  for(unsigned int i = 1; i <= nx; ++i) {
142 
143  unsigned int tbin = fLiveTime->GetBin(i);
144  double time = (fLiveTime->GetBinContent(tbin))*secPerRange;
145 
146  if(time == 0.0) continue;
147 
148  for(unsigned int j = 1; j <= ny; ++j) {
149 
150  unsigned int hbin = fFEBHitsDB[db]->GetBin(i,j);
151  double content = fFEBHitsDB[db]->GetBinContent(hbin);
152 
153  fFEBRatesDB[db]->SetBinContent(hbin,content/time);
154 
155  } // end loop over j
156  } // end loop over i
157 
158  } // end loop over db
159 
160 
161 
162  //
163  // Compute DCM rates
164  //
165  unsigned int nx = fDCMHits->GetNbinsX();
166  unsigned int ny = fDCMHits->GetNbinsY();
167 
168  for(unsigned int i = 1; i <= nx; ++i) {
169 
170  unsigned int tbin = fLiveTime->GetBin(i);
171  double time = (fLiveTime->GetBinContent(tbin))*secPerRange;
172 
173  if(time == 0.0) continue;
174 
175  for(unsigned int j = 1; j <= ny; ++j) {
176 
177  unsigned int hbin = fDCMHits->GetBin(i,j);
178  double content = fDCMHits->GetBinContent(hbin);
179 
180  fDCMRates->SetBinContent(hbin,content/time);
181 
182  } // end loop over j
183  } // end loop over i
184 
185 }
static const unsigned int numDB
Float_t E
Definition: plot.C:20
const double j
Definition: BetheBloch.cxx:29

Member Data Documentation

TH2F* om::FEBRatesByDiblock::fDCMHits
private

Definition at line 37 of file FEBRatesByDiblock.h.

Referenced by FEBRatesByDiblock(), GetNanoSliceSummary(), and UpdateRatePlots().

unsigned int om::FEBRatesByDiblock::fDCMpDB
private

Definition at line 46 of file FEBRatesByDiblock.h.

Referenced by FEBRatesByDiblock(), and GetNanoSliceSummary().

TH2F* om::FEBRatesByDiblock::fDCMRates
private

Definition at line 36 of file FEBRatesByDiblock.h.

Referenced by FEBRatesByDiblock(), and UpdateRatePlots().

std::vector<unsigned int> om::FEBRatesByDiblock::fDCMs
private

Definition at line 43 of file FEBRatesByDiblock.h.

Referenced by FEBRatesByDiblock(), and GetNanoSliceSummary().

TH2F* om::FEBRatesByDiblock::fEmptyDCMs
private

Definition at line 38 of file FEBRatesByDiblock.h.

Referenced by FEBRatesByDiblock(), and GetNanoSliceSummary().

TH2F* om::FEBRatesByDiblock::fFEBHitsDB[numDB]
private

Definition at line 35 of file FEBRatesByDiblock.h.

Referenced by FEBRatesByDiblock(), GetNanoSliceSummary(), and UpdateRatePlots().

TH2F* om::FEBRatesByDiblock::fFEBRatesDB[numDB]
private

Definition at line 34 of file FEBRatesByDiblock.h.

Referenced by FEBRatesByDiblock(), GetNanoSliceSummary(), and UpdateRatePlots().

TH1F* om::FEBRatesByDiblock::fHitMapEvtCount
private

Definition at line 40 of file FEBRatesByDiblock.h.

Referenced by FEBRatesByDiblock(), and GetNanoSliceSummary().

daqchannelmap::HardwareDisplay* om::FEBRatesByDiblock::fHwMap
private

Definition at line 32 of file FEBRatesByDiblock.h.

Referenced by FEBRatesByDiblock(), GetNanoSliceSummary(), and ~FEBRatesByDiblock().

time_t om::FEBRatesByDiblock::fLastTime
private

Definition at line 45 of file FEBRatesByDiblock.h.

Referenced by FEBRatesByDiblock(), and GetNanoSliceSummary().

TH1F* om::FEBRatesByDiblock::fLiveTime
private

Definition at line 39 of file FEBRatesByDiblock.h.

Referenced by FEBRatesByDiblock(), GetNanoSliceSummary(), and UpdateRatePlots().

TH1F* om::FEBRatesByDiblock::fRecordedTime
private

Definition at line 41 of file FEBRatesByDiblock.h.

Referenced by FEBRatesByDiblock(), and GetNanoSliceSummary().


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