![]() |
![]() |
#include <DQM/TrigXMonitorClient/interface/L1ScalersClient.h>
Definition at line 23 of file L1ScalersClient.h.
L1ScalersClient::L1ScalersClient | ( | const edm::ParameterSet & | ps | ) |
Constructors.
Definition at line 25 of file L1ScalersClient.cc.
References algoSelected_, DQMStore::book1D(), DQMStore::book2D(), bxSelected_, dbe_, folderName_, i, j, k, kNumAlgoHistos, kNumTTHistos, kPerHisto, l1AlgoCurrentRate_, l1AlgoCurrentRatePerAlgo_, l1AlgoRateHistories_, l1AlgoScalerCounters_, l1TechTrigCurrentRate_, l1TechTrigCurrentRatePerAlgo_, l1TechTrigRateHistories_, l1TechTrigScalerCounters_, LogDebug, MAX_ALGOS, MAX_LUMI_SEG, MAX_TT, name, numSelected_, params, selected_, MonitorElement::setBinLabel(), DQMStore::setCurrentFolder(), techSelected_, indexGen::title, totalAlgoRate_, totAlgoPrevCount, totalTtRate_, totTtPrevCount, and UL.
00025 : 00026 dbe_(0), 00027 nLumi_(0), 00028 l1AlgoCurrentRate_(0), 00029 l1TechTrigCurrentRate_(0), 00030 selected_(0), 00031 bxSelected_(0), 00032 algoSelected_(ps.getUntrackedParameter<std::vector<int> >("algoMonitorBits")), 00033 techSelected_(ps.getUntrackedParameter<std::vector<int> >("techMonitorBits")), 00034 folderName_(ps.getUntrackedParameter<std::string>("dqmFolder", "L1T/L1Scalers_EvF")), 00035 currentLumiBlockNumber_(0), 00036 first_algo(true), 00037 first_tt(true) 00038 { 00039 LogDebug("Status") << "constructor" ; 00040 // get back-end interface 00041 dbe_ = edm::Service<DQMStore>().operator->(); 00042 assert(dbe_ != 0); // blammo! 00043 dbe_->setCurrentFolder(folderName_); 00044 00045 l1AlgoCurrentRate_ = dbe_->book1D("algo_cur_rate", 00046 "current lumi section rate per Algo Bits", 00047 MAX_ALGOS, -0.5, MAX_ALGOS-0.5); 00048 00049 l1TechTrigCurrentRate_ = dbe_->book1D("tt_cur_rate", 00050 "current lumi section rate per Tech. Trig.s", 00051 MAX_TT, -0.5, MAX_TT-0.5); 00052 // ---------------------- 00053 numSelected_ = algoSelected_.size() + techSelected_.size(); 00054 selected_ = dbe_->book1D("l1BitsSel", "Selected L1 Algorithm" 00055 " and tech Bits", numSelected_, 00056 -0.5, numSelected_-0.5); 00057 bxSelected_ = dbe_->book2D("l1BitsBxSel", 00058 "Selected L1 Algorithm Bits vs Bx", 00059 3600, -0.5, 3599.5, 00060 numSelected_, -0.5, numSelected_-0.5); 00061 int j = 1; 00062 for ( unsigned int i = 0; i < algoSelected_.size(); ++i ) { 00063 char title[256]; 00064 snprintf(title, 256, "Algo %d", algoSelected_[i]); 00065 selected_->setBinLabel(j, title); 00066 bxSelected_->setBinLabel(j, title, 2); 00067 ++j; 00068 } 00069 for ( unsigned int i = 0; i < techSelected_.size(); ++i ) { 00070 char title[256]; 00071 snprintf(title, 256, "Tech %d", techSelected_[i]); 00072 selected_->setBinLabel(j, title); 00073 bxSelected_->setBinLabel(j, title, 2); 00074 ++j; 00075 } 00076 00077 00078 // book individual bit rates vs lumi for algo bits. 00079 totalAlgoRate_ = dbe_->book1D("totAlgoRate", "Total Algo Rate" , MAX_LUMI_SEG, 00080 -0.5, MAX_LUMI_SEG-0.5); 00081 totalTtRate_ = dbe_->book1D("totTtRate", "Total Tech. Trig Rate" , MAX_LUMI_SEG, 00082 -0.5, MAX_LUMI_SEG-0.5); 00083 00084 totAlgoPrevCount=0UL; 00085 totTtPrevCount=0UL; 00086 for (int i = 0; i < MAX_ALGOS; ++i ) { 00087 l1AlgoScalerCounters_[i] = 0UL; 00088 l1AlgoRateHistories_[i] = 0; // not really needed but ... 00089 char name[256]; snprintf(name, 256, "rate_algobit%03d", i); 00090 LogDebug("Parameter") << "name " << i << " is " << name ; 00091 l1AlgoRateHistories_[i] = dbe_->book1D(name, name, MAX_LUMI_SEG, 00092 -0.5, MAX_LUMI_SEG-0.5); 00093 } 00094 00095 // book individual bit rates vs lumi for technical trigger bits. 00096 for (int i = 0; i < MAX_TT; ++i ) { 00097 l1TechTrigScalerCounters_[i] = 0UL; 00098 l1TechTrigRateHistories_[i] = 0; // not really needed but ... 00099 char name[256]; snprintf(name, 256, "rate_ttbit%03d", i); 00100 LogDebug("Parameter") << "name " << i << " is " << name ; 00101 l1TechTrigRateHistories_[i] = dbe_->book1D(name, name, MAX_LUMI_SEG, 00102 -0.5, MAX_LUMI_SEG-0.5); 00103 } 00104 00105 // split l1 scalers up into groups of 20, assuming total of 140 bits 00106 char metitle1[40]; //histo name 00107 char mename1[40]; //ME name 00108 for( int k = 0; k < kNumAlgoHistos; k++ ) { 00109 int npath_low = kPerHisto*k; 00110 int npath_high = kPerHisto*(k+1)-1; 00111 snprintf(mename1, 40, "L1AlgoBits_%0d", k); 00112 snprintf(metitle1, 40, "L1 rates - Algo Bits %d to %d", npath_low, 00113 npath_high); 00114 l1AlgoCurrentRatePerAlgo_[k]= dbe_->book1D(mename1, metitle1, kPerHisto, 00115 -0.5 + npath_low, npath_high+0.5); 00116 } 00117 00118 // split l1 scalers up into groups of 20, assuming total of 80 technical bits 00119 char metitle2[40]; //histo name 00120 char mename2[40]; //ME name 00121 for( int k = 0; k < kNumTTHistos; k++ ) { 00122 int npath_low = kPerHisto*k; 00123 int npath_high = kPerHisto*(k+1)-1; 00124 snprintf(mename2, 40, "L1TechBits_%0d", k); 00125 snprintf(metitle2, 40, "L1 rates - Tech. Trig. Bits %d to %d", npath_low, 00126 npath_high); 00127 l1TechTrigCurrentRatePerAlgo_[k]= dbe_->book1D(mename2, metitle2, kPerHisto, 00128 -0.5 + npath_low, npath_high+0.5); 00129 } 00130 00131 std::ostringstream params; 00132 params << "Algo: "; 00133 for ( unsigned int i = 0; i < algoSelected_.size(); ++i ) { 00134 params << algoSelected_[i] << " "; 00135 } 00136 params << ", Tech: "; 00137 for ( unsigned int i = 0; i < techSelected_.size(); ++i ) { 00138 params << techSelected_[i] << " "; 00139 } 00140 LogDebug("Parameter") << "L1 bits to monitor are " << params.str(); 00141 }
virtual L1ScalersClient::~L1ScalersClient | ( | ) | [inline, virtual] |
void L1ScalersClient::analyze | ( | const edm::Event & | e, | |
const edm::EventSetup & | c | |||
) | [virtual] |
void L1ScalersClient::beginJob | ( | const edm::EventSetup & | c | ) | [virtual] |
BeginJob.
Reimplemented from edm::EDAnalyzer.
Definition at line 145 of file L1ScalersClient.cc.
References dbe_, folderName_, LogDebug, and DQMStore::setCurrentFolder().
00146 { 00147 LogDebug("Status") << "beingJob" ; 00148 if (dbe_) { 00149 dbe_->setCurrentFolder(folderName_); 00150 } 00151 }
void L1ScalersClient::beginRun | ( | const edm::Run & | run, | |
const edm::EventSetup & | c | |||
) | [virtual] |
void L1ScalersClient::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 167 of file L1ScalersClient.cc.
References algoSelected_, bxSelected_, currentLumiBlockNumber_, dbe_, find(), first_algo, first_tt, folderName_, DQMStore::get(), MonitorElement::getBinContent(), MonitorElement::getIntValue(), MonitorElement::getNbinsX(), i, edm::LuminosityBlock::id(), j, kPerHisto, l1AlgoCurrentRate_, l1AlgoCurrentRatePerAlgo_, l1AlgoRateHistories_, l1AlgoScalerCounters_, l1TechTrigCurrentRate_, l1TechTrigCurrentRatePerAlgo_, l1TechTrigRateHistories_, l1TechTrigScalerCounters_, LogDebug, MAX_ALGOS, MAX_LUMI_SEG, MAX_TT, nLumi_, SECS_PER_LUMI_SECTION, selected_, MonitorElement::setBinContent(), MonitorElement::setBinLabel(), MonitorElement::setTitle(), techSelected_, totalAlgoRate_, totAlgoPrevCount, totalTtRate_, and totTtPrevCount.
00169 { 00170 nLumi_ = lumiSeg.id().luminosityBlock(); 00171 00172 // get EvF data 00173 00174 MonitorElement *algoScalers = dbe_->get(folderName_+std::string("/l1AlgoBits")); 00175 MonitorElement *ttScalers = dbe_->get(folderName_+std::string("/l1TechAlgoBits")); 00176 00177 if ( algoScalers == 0 || ttScalers ==0) { 00178 LogInfo("Status") << "cannot get l1 scalers histogram, bailing out."; 00179 return; 00180 } 00181 00182 00183 int nalgobits = algoScalers->getNbinsX(); 00184 int nttbits = ttScalers->getNbinsX(); 00185 00186 if ( nalgobits > MAX_ALGOS ) nalgobits = MAX_ALGOS; // HARD CODE FOR NOW 00187 if ( nttbits > MAX_TT ) nttbits = MAX_TT; // HARD CODE FOR NOW 00188 00189 LogDebug("Status") << "I see " << nalgobits << " algo paths. "; 00190 LogDebug("Status") << "I see " << nttbits << " tt paths. "; 00191 00192 // set the bin labels on the first go-through 00193 if ( first_algo) { 00194 for ( int i = 0; i < nalgobits; ++i ) { 00195 int whichHisto = i/kPerHisto; 00196 int whichBin = i%kPerHisto + 1; 00197 char pname[256]; 00198 snprintf(pname, 256, "AlgoBit%03d", i); 00199 l1AlgoCurrentRatePerAlgo_[whichHisto]->setBinLabel(whichBin, pname); 00200 snprintf(pname, 256, "Rate - Algorithm Bit %03d", i); 00201 l1AlgoRateHistories_[i]->setTitle(pname); 00202 } 00203 first_algo = false; 00204 } 00205 00206 // set the bin labels on the first go-through 00207 if ( first_tt) { 00208 for ( int i = 0; i < nttbits; ++i ) { 00209 int whichHisto = i/kPerHisto; 00210 int whichBin = i%kPerHisto + 1; 00211 char pname[256]; 00212 snprintf(pname, 256, "TechBit%03d", i); 00213 l1TechTrigCurrentRatePerAlgo_[whichHisto]->setBinLabel(whichBin, pname); 00214 snprintf(pname, 256, "Rate - Technical Bit %03d", i); 00215 l1TechTrigRateHistories_[i]->setTitle(pname); 00216 } 00217 first_tt = false; 00218 } 00219 00220 MonitorElement *nLumi = dbe_->get(folderName_+std::string("nLumiBlock")); 00221 00222 int testval = (nLumi!=0?nLumi->getIntValue():-1); 00223 LogDebug("Parameter") << "Lumi Block from DQM: " 00224 << testval 00225 << ", local is " << nLumi_; 00226 00227 int nL = (nLumi!=0?nLumi->getIntValue():nLumi_); 00228 if ( nL > MAX_LUMI_SEG ) { 00229 LogDebug("Status") << "Too many Lumi segments, " 00230 << nL << " is greater than MAX_LUMI_SEG," 00231 << " wrapping to " 00232 << (nL%MAX_LUMI_SEG); 00233 nL = nL%MAX_LUMI_SEG; 00234 } 00235 float delta_t = (nL - currentLumiBlockNumber_)*SECS_PER_LUMI_SECTION; 00236 if ( delta_t < 0 ) { 00237 LogDebug("Status") << " time is negative ... " << delta_t; 00238 delta_t = -delta_t; 00239 } 00240 else if ( nL == currentLumiBlockNumber_ ) { // divide-by-zero 00241 LogInfo("Status") << "divide by zero: same lumi section 2x " << nL; 00242 return; 00243 } 00244 // selected --------------------- fill in the rates for th 00245 int currSlot = 1; // for selected bits histogram 00246 MonitorElement *algoBx = dbe_->get(folderName_+ 00247 std::string("/l1AlgoBits_Vs_Bx")); 00248 // selected --------------------- end 00249 for ( int i = 1; i <= nalgobits; ++i ) { // bins start at 1 00250 float current_count = algoScalers->getBinContent(i); 00251 // selected -------------------- start 00252 int bit = i -1; // 00253 if ( std::find(algoSelected_.begin(), algoSelected_.end(),bit) 00254 != algoSelected_.end() ) { 00255 selected_->setBinContent(currSlot, current_count); 00256 if ( algoBx ) { 00257 for ( int j = 1; j <= 3600; ++j ) { 00258 bxSelected_->setBinContent(j, currSlot, 00259 algoBx->getBinContent(j, i)); 00260 } 00261 } 00262 ++currSlot; 00263 } 00264 // selected -------------------- end 00265 float rate = (current_count-l1AlgoScalerCounters_[i-1])/delta_t; 00266 if ( rate > 1E-3 ) { 00267 LogDebug("Parameter") << "rate path " << i << " is " << rate; 00268 } 00269 l1AlgoCurrentRate_->setBinContent(i, rate); 00270 l1AlgoCurrentRatePerAlgo_[i/kPerHisto]->setBinContent(i%kPerHisto+1, rate); 00271 //currentRate_->setBinError(i, error); 00272 l1AlgoScalerCounters_[i-1] = ulong(current_count); 00273 l1AlgoRateHistories_[i-1]->setBinContent(nL, rate); 00274 } 00275 // selected ----------------- start 00276 MonitorElement *techBx = dbe_->get(folderName_+std::string("/l1TechAlgoBits_Vs_Bx")); 00277 // selected ----------------- end 00278 00279 for ( int i = 1; i <= nttbits; ++i ) { // bins start at 1 00280 float current_count = ttScalers->getBinContent(i); 00281 // selected -------------------- start 00282 int bit = i -1; // 00283 if ( std::find(techSelected_.begin(), techSelected_.end(),bit) 00284 != techSelected_.end() ) { 00285 selected_->setBinContent(currSlot, current_count); 00286 if ( techBx ) { 00287 for ( int j = 1; j <= 3600; ++j ) { 00288 bxSelected_->setBinContent(j, currSlot, 00289 techBx->getBinContent(j, i)); 00290 } 00291 } 00292 ++currSlot; 00293 } 00294 // selected -------------------- end 00295 float rate = (current_count-l1TechTrigScalerCounters_[i-1])/delta_t; 00296 if ( rate > 1E-3 ) { 00297 LogDebug("Parameter") << "rate path " << i << " is " << rate; 00298 } 00299 l1TechTrigCurrentRate_->setBinContent(i, rate); 00300 l1TechTrigCurrentRatePerAlgo_[i/kPerHisto]->setBinContent(i%kPerHisto+1, rate); 00301 //currentRate_->setBinError(i, error); 00302 l1TechTrigScalerCounters_[i-1] = ulong(current_count); 00303 l1TechTrigRateHistories_[i-1]->setBinContent(nL, rate); 00304 } 00305 00306 // compute total rate 00307 MonitorElement *l1AlgoCounter = dbe_->get(folderName_+std::string("/l1AlgoCounter")); 00308 MonitorElement *l1TtCounter = dbe_->get(folderName_+std::string("/l1TtCounter")); 00309 if ( l1AlgoCounter != 0 && l1TtCounter != 0 ) { 00310 float totAlgoCount = l1AlgoCounter->getIntValue(); 00311 float totTtCount = l1TtCounter->getIntValue(); 00312 float totAlgRate = (totAlgoCount - totAlgoPrevCount)/delta_t; 00313 float totTtRate = (totTtCount - totTtPrevCount)/delta_t; 00314 totalAlgoRate_->setBinContent(nL, totAlgRate); 00315 totAlgoPrevCount = totAlgoCount; 00316 totalTtRate_->setBinContent(nL, totTtRate); 00317 totTtPrevCount = totTtCount; 00318 } 00319 00320 00321 currentLumiBlockNumber_ = nL; 00322 00323 }
void L1ScalersClient::endRun | ( | const edm::Run & | run, | |
const edm::EventSetup & | c | |||
) | [virtual] |
std::vector<int> L1ScalersClient::algoSelected_ [private] |
Definition at line 80 of file L1ScalersClient.h.
Referenced by endLuminosityBlock(), and L1ScalersClient().
MonitorElement* L1ScalersClient::bxSelected_ [private] |
Definition at line 79 of file L1ScalersClient.h.
Referenced by endLuminosityBlock(), and L1ScalersClient().
int L1ScalersClient::currentLumiBlockNumber_ [private] |
int L1ScalersClient::currentRun_ [private] |
Definition at line 60 of file L1ScalersClient.h.
DQMStore* L1ScalersClient::dbe_ [private] |
Definition at line 56 of file L1ScalersClient.h.
Referenced by beginJob(), endLuminosityBlock(), and L1ScalersClient().
bool L1ScalersClient::first_algo [private] |
bool L1ScalersClient::first_tt [private] |
std::string L1ScalersClient::folderName_ [private] |
Definition at line 82 of file L1ScalersClient.h.
Referenced by beginJob(), endLuminosityBlock(), and L1ScalersClient().
Definition at line 66 of file L1ScalersClient.h.
Referenced by endLuminosityBlock(), and L1ScalersClient().
MonitorElement* L1ScalersClient::l1AlgoCurrentRatePerAlgo_[MAX_ALGOS] [private] |
Definition at line 68 of file L1ScalersClient.h.
Referenced by endLuminosityBlock(), and L1ScalersClient().
MonitorElement* L1ScalersClient::l1AlgoRateHistories_[MAX_ALGOS] [private] |
Definition at line 67 of file L1ScalersClient.h.
Referenced by endLuminosityBlock(), and L1ScalersClient().
unsigned long int L1ScalersClient::l1AlgoScalerCounters_[MAX_ALGOS] [private] |
Definition at line 65 of file L1ScalersClient.h.
Referenced by endLuminosityBlock(), and L1ScalersClient().
Definition at line 72 of file L1ScalersClient.h.
Referenced by endLuminosityBlock(), and L1ScalersClient().
MonitorElement* L1ScalersClient::l1TechTrigCurrentRatePerAlgo_[MAX_TT] [private] |
Definition at line 74 of file L1ScalersClient.h.
Referenced by endLuminosityBlock(), and L1ScalersClient().
MonitorElement* L1ScalersClient::l1TechTrigRateHistories_[MAX_TT] [private] |
Definition at line 73 of file L1ScalersClient.h.
Referenced by endLuminosityBlock(), and L1ScalersClient().
unsigned long int L1ScalersClient::l1TechTrigScalerCounters_[MAX_TT] [private] |
Definition at line 71 of file L1ScalersClient.h.
Referenced by endLuminosityBlock(), and L1ScalersClient().
int L1ScalersClient::nev_ [private] |
Definition at line 58 of file L1ScalersClient.h.
int L1ScalersClient::nLumi_ [private] |
int L1ScalersClient::numSelected_ [private] |
MonitorElement* L1ScalersClient::selected_ [private] |
Definition at line 78 of file L1ScalersClient.h.
Referenced by endLuminosityBlock(), and L1ScalersClient().
std::vector<int> L1ScalersClient::techSelected_ [private] |
Definition at line 81 of file L1ScalersClient.h.
Referenced by endLuminosityBlock(), and L1ScalersClient().
MonitorElement* L1ScalersClient::totalAlgoRate_ [private] |
Definition at line 69 of file L1ScalersClient.h.
Referenced by endLuminosityBlock(), and L1ScalersClient().
float L1ScalersClient::totAlgoPrevCount [private] |
Definition at line 62 of file L1ScalersClient.h.
Referenced by endLuminosityBlock(), and L1ScalersClient().
MonitorElement* L1ScalersClient::totalTtRate_ [private] |
Definition at line 75 of file L1ScalersClient.h.
Referenced by endLuminosityBlock(), and L1ScalersClient().
float L1ScalersClient::totTtPrevCount [private] |
Definition at line 63 of file L1ScalersClient.h.
Referenced by endLuminosityBlock(), and L1ScalersClient().