#include <DQM/TrigXMonitorClient/interface/HLTScalersClient.h>
Public Member Functions | |
void | analyze (const edm::Event &e, const edm::EventSetup &c) |
void | beginJob (const edm::EventSetup &c) |
BeginJob. | |
void | beginRun (const edm::Run &run, const edm::EventSetup &c) |
BeginRun. | |
void | endLuminosityBlock (const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c) |
End LumiBlock DQM Client Diagnostic should be performed here. | |
void | endRun (const edm::Run &run, const edm::EventSetup &c) |
EndRun. | |
HLTScalersClient (const edm::ParameterSet &ps) | |
Constructors. | |
virtual | ~HLTScalersClient () |
Destructor. | |
Private Attributes | |
int | currentLumiBlockNumber_ |
MonitorElement * | currentRate_ |
int | currentRun_ |
DQMStore * | dbe_ |
bool | first_ |
MonitorElement * | hltCurrentRate_ [MAX_PATHS] |
int | nev_ |
int | nLumi_ |
MonitorElement * | rateHistories_ [MAX_PATHS] |
unsigned long int | scalerCounters_ [MAX_PATHS] |
Definition at line 38 of file HLTScalersClient.h.
HLTScalersClient::HLTScalersClient | ( | const edm::ParameterSet & | ps | ) |
Constructors.
Definition at line 59 of file HLTScalersClient.cc.
References DQMStore::book1D(), currentRate_, dbe_, hltCurrentRate_, i, k, kNumHistos, kPerHisto, LogDebug, MAX_LUMI_SEG, MAX_PATHS, name, rateHistories_, scalerCounters_, DQMStore::setCurrentFolder(), and UL.
00059 : 00060 dbe_(0), 00061 nLumi_(0), 00062 currentRate_(0), 00063 currentLumiBlockNumber_(0), 00064 first_(true) 00065 { 00066 LogDebug("Status") << "constructor" ; 00067 // get back-end interface 00068 dbe_ = edm::Service<DQMStore>().operator->(); 00069 assert(dbe_ != 0); // blammo! 00070 dbe_->setCurrentFolder("HLT/HLTScalers_EvF"); 00071 00072 currentRate_ = dbe_->book1D("cur_rate", 00073 "current lumi section rate per path", 00074 MAX_PATHS, -0.5, MAX_PATHS-0.5); 00075 00076 for (int i = 0; i < MAX_PATHS; ++i ) { 00077 scalerCounters_[i] = 0UL; 00078 rateHistories_[i] = 0; // not really needed but ... 00079 char name[256]; snprintf(name, 256, "rate_p%03d", i); 00080 LogDebug("Parameter") << "name " << i << " is " << name ; 00081 rateHistories_[i] = dbe_->book1D(name, name, MAX_LUMI_SEG, 00082 -0.5, MAX_LUMI_SEG-0.5); 00083 } 00084 00085 // split hlt scalers up into groups of 20, assuming total of 200 paths 00086 char metitle[40]; //histo name 00087 char mename[40]; //ME name 00088 for( int k = 0; k < kNumHistos; k++ ) { 00089 int npath_low = kPerHisto*k; 00090 int npath_high = kPerHisto*(k+1)-1; 00091 snprintf(mename, 40, "hltScalers_%0d", k); 00092 snprintf(metitle, 40, "HLT scalers - Paths %d to %d", npath_low, 00093 npath_high); 00094 hltCurrentRate_[k]= dbe_->book1D(mename, metitle, kPerHisto, 00095 -0.5 + npath_low, npath_high+0.5); 00096 } 00097 }
virtual HLTScalersClient::~HLTScalersClient | ( | ) | [inline, virtual] |
void HLTScalersClient::analyze | ( | const edm::Event & | e, | |
const edm::EventSetup & | c | |||
) | [virtual] |
void HLTScalersClient::beginJob | ( | const edm::EventSetup & | c | ) | [virtual] |
BeginJob.
Reimplemented from edm::EDAnalyzer.
Definition at line 101 of file HLTScalersClient.cc.
References dbe_, LogDebug, and DQMStore::setCurrentFolder().
00102 { 00103 LogDebug("Status") << "beingJob" ; 00104 if (dbe_) { 00105 dbe_->setCurrentFolder("HLT/HLTScalers_EvF"); 00106 } 00107 }
void HLTScalersClient::beginRun | ( | const edm::Run & | run, | |
const edm::EventSetup & | c | |||
) | [virtual] |
void HLTScalersClient::endLuminosityBlock | ( | const edm::LuminosityBlock & | lumiSeg, | |
const edm::EventSetup & | c | |||
) | [virtual] |
End LumiBlock DQM Client Diagnostic should be performed here.
End LumiBlock DQM Client Diagnostic should be performed here.
Reimplemented from edm::EDAnalyzer.
Definition at line 123 of file HLTScalersClient.cc.
References currentLumiBlockNumber_, currentRate_, dbe_, first_, DQMStore::get(), MonitorElement::getBinContent(), MonitorElement::getIntValue(), MonitorElement::getNbinsX(), MonitorElement::getStringValue(), hltCurrentRate_, i, edm::LuminosityBlock::id(), kPerHisto, LogDebug, MAX_LUMI_SEG, MAX_PATHS, name, nLumi_, rateHistories_, scalerCounters_, SECS_PER_LUMI_SECTION, MonitorElement::setBinContent(), MonitorElement::setBinLabel(), and MonitorElement::setTitle().
00125 { 00126 nLumi_ = lumiSeg.id().luminosityBlock(); 00127 00128 MonitorElement *scalers = dbe_->get("HLT/HLTScalers_EvF/hltScalers"); 00129 if ( scalers == 0 ) { 00130 LogInfo("Status") << "cannot get hlt scalers histogram, bailing out."; 00131 return; 00132 } 00133 00134 00135 int npaths = scalers->getNbinsX(); 00136 if ( npaths > MAX_PATHS ) npaths = MAX_PATHS; // HARD CODE FOR NOW 00137 LogDebug("Status") << "I see " << npaths << " paths. "; 00138 00139 // set the bin labels on the first go-through 00140 if ( first_) { 00141 for ( int i = 0; i < npaths; ++i ) { 00142 int whichHisto = i/kPerHisto; 00143 int whichBin = i%kPerHisto + 1; 00144 char pname[256]; 00145 snprintf(pname, 256, "HLT/HLTScalers_EvF/path%03d", i); 00146 MonitorElement *name = dbe_->get(pname); 00147 std::string sname; 00148 if ( name ) { 00149 sname = std::string (name->getStringValue()); 00150 } 00151 else { 00152 sname = std::string("unknown"); 00153 } 00154 hltCurrentRate_[whichHisto]->setBinLabel(whichBin, sname.c_str()); 00155 snprintf(pname, 256, "Rate - path %s (Path # %03d)", sname.c_str(), i); 00156 rateHistories_[i]->setTitle(pname); 00157 } 00158 first_ = false; 00159 } 00160 00161 MonitorElement *nLumi = dbe_->get("HLT/HLTScalers_EvF/nLumiBlock"); 00162 int testval = (nLumi!=0?nLumi->getIntValue():-1); 00163 LogDebug("Parameter") << "Lumi Block from DQM: " 00164 << testval 00165 << ", local is " << nLumi_; 00166 int nL = (nLumi!=0?nLumi->getIntValue():nLumi_); 00167 if ( nL > MAX_LUMI_SEG ) { 00168 LogDebug("Status") << "Too many Lumi segments, " 00169 << nL << " is greater than MAX_LUMI_SEG," 00170 << " wrapping to " 00171 << (nL%MAX_LUMI_SEG); 00172 //nL = MAX_LUMI_SEG; 00173 nL = nL%MAX_LUMI_SEG; 00174 } 00175 float delta_t = (nL - currentLumiBlockNumber_)*SECS_PER_LUMI_SECTION; 00176 if ( delta_t < 0 ) { 00177 LogDebug("Status") << " time is negative ... " << delta_t; 00178 delta_t = -delta_t; 00179 } 00180 else if ( nL == currentLumiBlockNumber_ ) { // divide-by-zero 00181 LogInfo("Status") << "divide by zero: same lumi section 2x " << nL; 00182 return; 00183 } 00184 // fill in the rates 00185 for ( int i = 1; i <= npaths; ++i ) { // bins start at 1 00186 float current_count = scalers->getBinContent(i); 00187 float rate = (current_count-scalerCounters_[i-1])/delta_t; 00188 if ( rate > 1E-3 ) { 00189 LogDebug("Parameter") << "rate path " << i << " is " << rate; 00190 } 00191 currentRate_->setBinContent(i, rate); 00192 hltCurrentRate_[i/kPerHisto]->setBinContent(i%kPerHisto+1, rate); 00193 //currentRate_->setBinError(i, error); 00194 scalerCounters_[i-1] = ulong(current_count); 00195 rateHistories_[i-1]->setBinContent(nL, rate); 00196 } 00197 currentLumiBlockNumber_ = nL; 00198 00199 }
void HLTScalersClient::endRun | ( | const edm::Run & | run, | |
const edm::EventSetup & | c | |||
) | [virtual] |
int HLTScalersClient::currentLumiBlockNumber_ [private] |
MonitorElement* HLTScalersClient::currentRate_ [private] |
Definition at line 78 of file HLTScalersClient.h.
Referenced by endLuminosityBlock(), and HLTScalersClient().
int HLTScalersClient::currentRun_ [private] |
Definition at line 75 of file HLTScalersClient.h.
DQMStore* HLTScalersClient::dbe_ [private] |
Definition at line 71 of file HLTScalersClient.h.
Referenced by beginJob(), endLuminosityBlock(), and HLTScalersClient().
bool HLTScalersClient::first_ [private] |
MonitorElement* HLTScalersClient::hltCurrentRate_[MAX_PATHS] [private] |
Definition at line 82 of file HLTScalersClient.h.
Referenced by endLuminosityBlock(), and HLTScalersClient().
int HLTScalersClient::nev_ [private] |
Definition at line 73 of file HLTScalersClient.h.
int HLTScalersClient::nLumi_ [private] |
MonitorElement* HLTScalersClient::rateHistories_[MAX_PATHS] [private] |
Definition at line 80 of file HLTScalersClient.h.
Referenced by endLuminosityBlock(), and HLTScalersClient().
unsigned long int HLTScalersClient::scalerCounters_[MAX_PATHS] [private] |
Definition at line 77 of file HLTScalersClient.h.
Referenced by endLuminosityBlock(), and HLTScalersClient().