CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
OccupancyPlotter Class Reference

#include <DQM/OccupancyPlotter/src/OccupancyPlotter.cc>

Inheritance diagram for OccupancyPlotter:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 OccupancyPlotter (const edm::ParameterSet &)
 
 ~OccupancyPlotter ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &) override
 
virtual void beginJob () override
 
virtual void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
virtual void beginRun (edm::Run const &, edm::EventSetup const &) override
 
bool checkDcsInfo (const edm::Event &jEvent)
 
void checkLumiInfo (const edm::Event &jEvent)
 
virtual void endJob () override
 
virtual void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
virtual void endRun (edm::Run const &, edm::EventSetup const &) override
 
virtual void fillHltMatrix (std::string, std::string, double, double, bool)
 
virtual void setupHltMatrix (std::string, int)
 

Private Attributes

float _instLumi
 
float _instLumi_err
 
float _pileup
 
edm::EDGetTokenT
< trigger::TriggerEvent
aodTriggerToken_
 
int cntBadHV
 
int cntevt
 
DQMStoredbe
 
bool dcs [25]
 
edm::EDGetTokenT
< DcsStatusCollection
dcsStatusToken_
 
bool debugPrint
 
TH1F * hist_LumivsLS
 
TH1F * hist_PUvsLS
 
HLTConfigProvider hltConfig_
 
edm::EDGetTokenT
< LumiScalersCollection
lumiScalersToken_
 
bool outputPrint
 
vector< vector< string > > PDsVectorPathsVector
 
std::string plotDirectoryName
 
bool thisiLumiValue
 
edm::EDGetTokenT
< edm::TriggerResults
triggerResultsToken_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 57 of file OccupancyPlotter.cc.

Constructor & Destructor Documentation

OccupancyPlotter::OccupancyPlotter ( const edm::ParameterSet iConfig)
explicit

Definition at line 131 of file OccupancyPlotter.cc.

References gather_cfg::cout, edm::ParameterSet::getUntrackedParameter(), AlCaHLTBitMon_QueryRunRegistry::string, and triggerResultsToken_().

133 {
134  //now do what ever initialization is needed
135 
136  debugPrint = false;
137  outputPrint = false;
138  thisiLumiValue = false;
139  cntevt=0;
140  cntBadHV=0;
141  if (debugPrint) std::cout << "Inside Constructor" << std::endl;
142 
143  plotDirectoryName = iConfig.getUntrackedParameter<std::string>("dirname", "HLT/Test");
144 
145  if (debugPrint) std::cout << "Got plot dirname = " << plotDirectoryName << std::endl;
146 
147  //set Token(-s)
148  triggerResultsToken_ = consumes<edm::TriggerResults>(InputTag("TriggerResults","", "HLT"));
149  aodTriggerToken_ = consumes<trigger::TriggerEvent>(InputTag("hltTriggerSummaryAOD", "", "HLT"));
150  dcsStatusToken_ = consumes<DcsStatusCollection>(std::string("hltScalersRawToDigi"));
151  lumiScalersToken_ = consumes<LumiScalersCollection>(InputTag("hltScalersRawToDigi","",""));
152 }
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< DcsStatusCollection > dcsStatusToken_
std::string plotDirectoryName
edm::EDGetTokenT< trigger::TriggerEvent > aodTriggerToken_
edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken_
edm::EDGetTokenT< LumiScalersCollection > lumiScalersToken_
tuple cout
Definition: gather_cfg.py:121
OccupancyPlotter::~OccupancyPlotter ( )

Definition at line 155 of file OccupancyPlotter.cc.

156 {
157 
158  // do anything here that needs to be done at desctruction time
159  // (e.g. close files, deallocate resources etc.)
160 
161 }

Member Function Documentation

void OccupancyPlotter::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDAnalyzer.

Definition at line 170 of file OccupancyPlotter.cc.

References gather_cfg::cout, makeLayoutFileForGui::datasetNames, trigger::TriggerObject::eta(), edm::Event::getByToken(), cmsHarvester::index, relativeConstraints::keys, edm::EventBase::luminosityBlock(), EgammaValidation_cff::pathName, trigger::TriggerObject::phi(), trigger::TriggerObject::pt(), findQualityFiles::size, AlCaHLTBitMon_QueryRunRegistry::string, edm::triggerResults(), and triggerResultsToken_().

171 {
172  using namespace edm;
173  using std::string;
174  int lumisection = (int)iEvent.luminosityBlock();
175 
176  if (debugPrint) std::cout << "Inside analyze" << std::endl;
177  ++cntevt;
178  if (cntevt % 10000 == 0) std::cout << "[OccupancyPlotter::analyze] Received event " << cntevt << std::endl;
179  // === Check the HV and the lumi
180  bool highVoltageOK = checkDcsInfo ( iEvent );
181  if (!highVoltageOK) {
182  if (debugPrint) std::cout << "Skipping event: DCS problem\n";
183  ++cntBadHV;
184  return;
185  }
186  checkLumiInfo( iEvent);
187 
188  if (debugPrint) std::cout << "instantaneous luminosity=" << _instLumi << " ± " << _instLumi_err << std::endl;
189 
190  if (thisiLumiValue){
191  thisiLumiValue = false;
192  std::cout << "LS = " << lumisection << ", Lumi = " << _instLumi << " ± " << _instLumi_err << ", pileup = " << _pileup << std::endl;
193 
194  hist_LumivsLS = dbe->get("HLT/OccupancyPlots/HLT_LumivsLS")->getTH1F();
195  hist_LumivsLS->SetBinContent(lumisection+1,_instLumi);
196  hist_LumivsLS->SetBinError(lumisection+1,_instLumi_err);
197  //
198  hist_PUvsLS = dbe->get("HLT/OccupancyPlots/HLT_PUvsLS")->getTH1F();
199  hist_PUvsLS->SetBinContent(lumisection+1,_pileup);
200 
201  }
202 
203  // Access Trigger Results
206 
207  if (!triggerResults.isValid()) {
208  if (debugPrint) std::cout << "Trigger results not valid" << std::endl;
209  return; }
210 
211  if (debugPrint) std::cout << "Found triggerResults" << std::endl;
212 
213  edm::Handle<trigger::TriggerEvent> aodTriggerEvent;
214  iEvent.getByToken(aodTriggerToken_, aodTriggerEvent);
215 
216  if ( !aodTriggerEvent.isValid() ) {
217  if (debugPrint) std::cout << "No AOD trigger summary found! Returning...";
218  return;
219  }
220 
221  const TriggerObjectCollection objects = aodTriggerEvent->getObjects();
222 
223 
224  vector<string> datasetNames = hltConfig_.streamContent("A");
225 // Loop over PDs
226  for (unsigned int iPD = 0; iPD < datasetNames.size(); iPD++) {
227 
228  // if (datasetNames[iPD] != "SingleMu" && datasetNames[iPD] != "SingleElectron" && datasetNames[iPD] != "Jet") continue;
229 
230  unsigned int keyTracker[1000]; // Array to eliminate double counts by tracking what Keys have already been fired
231  for(unsigned int irreproduceableIterator = 0; irreproduceableIterator < 1000; irreproduceableIterator++) {
232  keyTracker[irreproduceableIterator] = 1001;
233  }
234 // Loop over Paths in each PD
235  for (unsigned int iPath = 0; iPath < PDsVectorPathsVector[iPD].size(); iPath++) { //Andrew - where does PDsVectorPathsVector get defined?
236 
238 
239  if (debugPrint) std::cout << "Looking at path " << pathName << std::endl;
240 
241  unsigned int index = hltConfig_.triggerIndex(pathName);
242 
243  if (debugPrint) std::cout << "Index = " << index << " triggerResults->size() = " << triggerResults->size() << std::endl;
244 
245  if (index < triggerResults->size()) {
246  if(triggerResults->accept(index)) {
247 
248  if (debugPrint) std::cout << "We fired path " << pathName << std::endl;
249 
250  // look up module labels for this path
251 
252  vector<std::string> modulesThisPath = hltConfig_.moduleLabels(pathName);
253 
254  if (debugPrint) std::cout << "Looping over module labels " << std::endl;
255 
256  // Loop backward through module names
257  for ( int iModule = (modulesThisPath.size()-1); iModule >= 0; iModule--) {
258 
259  if (debugPrint) std::cout << "Module name is " << modulesThisPath[iModule] << std::endl;
260 
261  // check to see if you have savetags information
262  if (hltConfig_.saveTags(modulesThisPath[iModule])) {
263 
264  if (debugPrint) std::cout << "For path " << pathName << " this module " << modulesThisPath[iModule] <<" is a saveTags module of type " << hltConfig_.moduleType(modulesThisPath[iModule]) << std::endl;
265 
266  if (hltConfig_.moduleType(modulesThisPath[iModule]) == "HLTLevel1GTSeed") break;
267 
268  InputTag moduleWhoseResultsWeWant(modulesThisPath[iModule], "", "HLT");
269 
270  unsigned int indexOfModuleInAodTriggerEvent = aodTriggerEvent->filterIndex(moduleWhoseResultsWeWant);
271 
272  if ( indexOfModuleInAodTriggerEvent < aodTriggerEvent->sizeFilters() ) {
273  const Keys &keys = aodTriggerEvent->filterKeys( indexOfModuleInAodTriggerEvent );
274  if (debugPrint) std::cout << "Got Keys for index " << indexOfModuleInAodTriggerEvent <<", size of keys is " << keys.size() << std::endl;
275 
276  for ( size_t iKey = 0; iKey < keys.size(); iKey++ ) {
277  TriggerObject foundObject = objects[keys[iKey]];
278  bool first_count = false;
279 
280  if(keyTracker[iKey] != iKey) first_count = true;
281 
282  if (debugPrint || outputPrint) std::cout << "This object has (pt, eta, phi) = "
283  << std::setw(10) << foundObject.pt()
284  << ", " << std::setw(10) << foundObject.eta()
285  << ", " << std::setw(10) << foundObject.phi()
286  << " for path = " << std::setw(20) << pathName
287  << " module " << std::setw(40) << modulesThisPath[iModule]
288  << " iKey " << iKey << std::endl;
289 
290  fillHltMatrix(datasetNames[iPD],pathName,foundObject.eta(),foundObject.phi(),first_count);
291 
292  keyTracker[iKey] = iKey;
293 
294 
295  }// end for each key
296  }// end if filter in aodTriggerEvent
297 
298 
299  // OK, we found the last module. No need to look at the others.
300  // get out of the loop
301 
302  break;
303  }// end if saveTags
304  }//end Loop backward through module names
305  }// end if(triggerResults->accept(index))
306  }// end if (index < triggerResults->size())
307  }// end Loop over Paths in each PD
308  }//end Loop over PDs
309 
310 
311 
312 
313 }
bool saveTags(const std::string &module) const
Is module an L3 filter (ie, tracked saveTags=true)
const std::string moduleType(const std::string &module) const
C++ class name of module.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
float phi() const
Definition: TriggerObject.h:58
edm::LuminosityBlockNumber_t luminosityBlock() const
Definition: EventBase.h:59
float eta() const
Definition: TriggerObject.h:57
bool checkDcsInfo(const edm::Event &jEvent)
edm::EDGetTokenT< trigger::TriggerEvent > aodTriggerToken_
virtual void fillHltMatrix(std::string, std::string, double, double, bool)
unsigned int triggerIndex(const std::string &triggerName) const
slot position of trigger path in trigger table (0 to size-1)
Single trigger physics object (e.g., an isolated muon)
Definition: TriggerObject.h:22
const std::vector< std::string > & streamContent(unsigned int stream) const
names of datasets in stream with index i
static std::string const triggerResults
Definition: EdmProvDump.cc:41
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1708
const std::vector< std::string > & moduleLabels(unsigned int trigger) const
label(s) of module(s) on a trigger path
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:81
vector< vector< string > > PDsVectorPathsVector
std::vector< size_type > Keys
TH1F * getTH1F(void) const
edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken_
tuple cout
Definition: gather_cfg.py:121
HLTConfigProvider hltConfig_
tuple size
Write out results.
void checkLumiInfo(const edm::Event &jEvent)
void OccupancyPlotter::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 318 of file OccupancyPlotter.cc.

References gather_cfg::cout, and cppFunctionSkipper::operator.

319 {
320 
321  if (debugPrint) std::cout << "Inside begin job" << std::endl;
322 
324 
325  if (dbe) {
326 
328 
329  }
330 
331 }
std::string plotDirectoryName
tuple cout
Definition: gather_cfg.py:121
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:667
void OccupancyPlotter::beginLuminosityBlock ( edm::LuminosityBlock const &  lb,
edm::EventSetup const &   
)
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 623 of file OccupancyPlotter.cc.

References gather_cfg::cout, and edm::LuminosityBlockBase::luminosityBlock().

624 {
625  unsigned int thisLumiSection = 0;
626  thisLumiSection = lb.luminosityBlock();
627  std::cout << "[OccupancyPlotter::beginLuminosityBlock] New luminosity block: " << thisLumiSection << std::endl;
628  thisiLumiValue=true; // add the instantaneous luminosity of the first event to the LS-Lumi plot
629 }
tuple cout
Definition: gather_cfg.py:121
void OccupancyPlotter::beginRun ( edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
)
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 341 of file OccupancyPlotter.cc.

References gather_cfg::cout, makeLayoutFileForGui::datasetNames, and i.

342 {
343 
344  if (debugPrint) std::cout << "Inside beginRun" << std::endl;
345 
346  bool changed = true;
347  if (hltConfig_.init(iRun, iSetup, "HLT", changed)) {
348  if(debugPrint)
349  if(debugPrint) std::cout << "HLT config with process name "
350  << "HLT" << " successfully extracted" << std::endl;
351  } else {
352  if (debugPrint)
353  if (debugPrint) std::cout << "Warning, didn't find process HLT" << std::endl;
354  }
355 
356  vector<string> datasetNames = hltConfig_.streamContent("A");
357  for (unsigned int i=0;i<datasetNames.size();i++) {
358 
359  if (debugPrint) std::cout << "This is dataset " << datasetNames[i] <<std::endl;
360 
361  vector<string> datasetPaths = hltConfig_.datasetContent(datasetNames[i]);
362 
363  if (debugPrint) std::cout << "datasetPaths.size() = " << datasetPaths.size() << std::endl;
364 
365  PDsVectorPathsVector.push_back(datasetPaths);
366 
367  if (debugPrint) std::cout <<"Found PD: " << datasetNames[i] << std::endl;
368  setupHltMatrix(datasetNames[i],i);
369  int maxLumisection=1000;
370  dbe->setCurrentFolder("HLT/OccupancyPlots/");
371  hist_LumivsLS = new TH1F("HLT_LumivsLS", "; Lumisection; Instantaneous Luminosity (cm^{-2} s^{-1})",maxLumisection,0,maxLumisection);
372  dbe->book1D("HLT_LumivsLS", hist_LumivsLS);
373  hist_PUvsLS = new TH1F("HLT_PUvsLS", "; Lumisection; Pileup",maxLumisection,0,maxLumisection);
374  dbe->book1D("HLT_PUvsLS", hist_PUvsLS);
375 
376  }// end of loop over dataset names
377 
378 }// end of beginRun
int i
Definition: DBlmapReader.cc:9
virtual void setupHltMatrix(std::string, int)
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:954
const std::vector< std::string > & streamContent(unsigned int stream) const
names of datasets in stream with index i
const std::vector< std::string > & datasetContent(unsigned int dataset) const
names of trigger paths in dataset with index i
vector< vector< string > > PDsVectorPathsVector
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
tuple cout
Definition: gather_cfg.py:121
HLTConfigProvider hltConfig_
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:667
bool OccupancyPlotter::checkDcsInfo ( const edm::Event jEvent)
private

Definition at line 516 of file OccupancyPlotter.cc.

References DcsStatus::BPIX, gather_cfg::cout, DcsStatus::CSCm, DcsStatus::CSCp, DcsStatus::DT0, DcsStatus::DTm, DcsStatus::DTp, DcsStatus::EBm, DcsStatus::EBp, DcsStatus::EEm, DcsStatus::EEp, DcsStatus::ESm, DcsStatus::ESp, DcsStatus::FPIX, edm::Event::getByToken(), DcsStatus::HBHEa, DcsStatus::HBHEb, DcsStatus::HBHEc, DcsStatus::HF, i, edm::HandleBase::isValid(), DcsStatus::RPC, DcsStatus::TECm, DcsStatus::TECp, DcsStatus::TIBTID, and DcsStatus::TOB.

516  {
517 
518  //Copy of code from DQMServices/Components/src/DQMDcsInfo.cc
519 
521  if (! jEvent.getByToken(dcsStatusToken_, dcsStatus))
522  {
523  std::cout << "[OccupancyPlotter::checkDcsInfo] Could not get scalersRawToDigi by label\n" ;
524  for (int i=0;i<24;i++) dcs[i]=false;
525  return false;
526  }//if (debugPrint)
527 
528  if ( ! dcsStatus.isValid() )
529  {
530  std::cout << "[OccupancyPlotter::checkDcsInfo] scalersRawToDigi not valid\n" ;
531  for (int i=0;i<24;i++) dcs[i]=false; // info not available: set to false
532  return false;
533  }
534 
535  // initialize all to "true"
536  for (int i=0; i<24; i++) dcs[i]=true;
537 
538  for (DcsStatusCollection::const_iterator dcsStatusItr = dcsStatus->begin();
539  dcsStatusItr != dcsStatus->end(); ++dcsStatusItr)
540  {
541 
542  if (debugPrint) std::cout << (*dcsStatusItr) << std::endl;
543 
544  if (!dcsStatusItr->ready(DcsStatus::CSCp)) dcs[0]=false;
545  if (!dcsStatusItr->ready(DcsStatus::CSCm)) dcs[1]=false;
546  if (!dcsStatusItr->ready(DcsStatus::DT0)) dcs[2]=false;
547  if (!dcsStatusItr->ready(DcsStatus::DTp)) dcs[3]=false;
548  if (!dcsStatusItr->ready(DcsStatus::DTm)) dcs[4]=false;
549  if (!dcsStatusItr->ready(DcsStatus::EBp)) dcs[5]=false;
550  if (!dcsStatusItr->ready(DcsStatus::EBm)) dcs[6]=false;
551  if (!dcsStatusItr->ready(DcsStatus::EEp)) dcs[7]=false;
552  if (!dcsStatusItr->ready(DcsStatus::EEm)) dcs[8]=false;
553  if (!dcsStatusItr->ready(DcsStatus::ESp)) dcs[9]=false;
554  if (!dcsStatusItr->ready(DcsStatus::ESm)) dcs[10]=false;
555  if (!dcsStatusItr->ready(DcsStatus::HBHEa)) dcs[11]=false;
556  if (!dcsStatusItr->ready(DcsStatus::HBHEb)) dcs[12]=false;
557  if (!dcsStatusItr->ready(DcsStatus::HBHEc)) dcs[13]=false;
558  if (!dcsStatusItr->ready(DcsStatus::HF)) dcs[14]=false;
559 // if (!dcsStatusItr->ready(DcsStatus::HO)) dcs[15]=false; // ignore HO
560  if (!dcsStatusItr->ready(DcsStatus::BPIX)) dcs[16]=false;
561  if (!dcsStatusItr->ready(DcsStatus::FPIX)) dcs[17]=false;
562  if (!dcsStatusItr->ready(DcsStatus::RPC)) dcs[18]=false;
563  if (!dcsStatusItr->ready(DcsStatus::TIBTID)) dcs[19]=false;
564  if (!dcsStatusItr->ready(DcsStatus::TOB)) dcs[20]=false;
565  if (!dcsStatusItr->ready(DcsStatus::TECp)) dcs[21]=false;
566  if (!dcsStatusItr->ready(DcsStatus::TECm)) dcs[22]=false;
567 // if (!dcsStatusItr->ready(DcsStatus::CASTOR)) dcs[23]=false;
568  }
569 
570 
571  // now we should add some logic that tests the HV status
572  bool decision = true;
573  for (int i=0; i<24; i++) decision=decision && dcs[i];
574  if (debugPrint) {
575  std::cout << "[OccupancyPlotter::checkDcsInfo] DCS Status:";
576  for (int i=0; i<24; i++) std::cout << dcs[i] << "-";
577  std::cout << "; Decision: " << decision << std::endl;
578  }
579  //std::cout << "; Decision: " << decision << std::endl;
580  return decision;
581 
582 }
int i
Definition: DBlmapReader.cc:9
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
edm::EDGetTokenT< DcsStatusCollection > dcsStatusToken_
bool isValid() const
Definition: HandleBase.h:76
tuple cout
Definition: gather_cfg.py:121
void OccupancyPlotter::checkLumiInfo ( const edm::Event jEvent)
private

Definition at line 584 of file OccupancyPlotter.cc.

References gather_cfg::cout, edm::Event::getByToken(), and edm::HandleBase::isValid().

584  {
585 
586  if (debugPrint) std::cout << "Inside method check lumi info" << std::endl;
587 
589  bool lumiHandleOK = jEvent.getByToken(lumiScalersToken_, lumiScalers);
590 
591  if (!lumiHandleOK || !lumiScalers.isValid()){
592  if (debugPrint) std::cout << "scalers not valid" << std::endl;
593  return;
594  }
595 
596  if (lumiScalers->size() == 0) {
597  if (debugPrint) std::cout << "scalers has size < 0" << std::endl;
598  return;
599  }
600 
601  LumiScalersCollection::const_iterator it3 = lumiScalers->begin();
602  //unsigned int lumisection = it3->sectionNumber();
603 
604  _instLumi = it3->instantLumi();
605  _instLumi_err = it3->instantLumiErr();
606  _pileup = it3->pileup();
607 
608  if (debugPrint) std::cout << "Instanteous Lumi is " << _instLumi << std::endl;
609  if (debugPrint) std::cout << "Instanteous Lumi Error is " << _instLumi_err << std::endl;
610  if (debugPrint) std::cout << "Lumi Fill is " <<it3->lumiFill() << std::endl;
611  if (debugPrint) std::cout << "Lumi Fill is " <<it3->lumiRun() << std::endl;
612  if (debugPrint) std::cout << "Live Lumi Fill is " <<it3->liveLumiFill() << std::endl;
613  if (debugPrint) std::cout << "Live Lumi Run is " <<it3->liveLumiRun() << std::endl;
614  if (debugPrint) std::cout << "Pileup? = " << _pileup << std::endl;
615 
616  return;
617 
618 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
bool isValid() const
Definition: HandleBase.h:76
edm::EDGetTokenT< LumiScalersCollection > lumiScalersToken_
tuple cout
Definition: gather_cfg.py:121
void OccupancyPlotter::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 335 of file OccupancyPlotter.cc.

336 {
337 }
void OccupancyPlotter::endLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
)
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 633 of file OccupancyPlotter.cc.

634 {
635 }
void OccupancyPlotter::endRun ( edm::Run const &  ,
edm::EventSetup const &   
)
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 381 of file OccupancyPlotter.cc.

References gather_cfg::cout.

382 {
383  std::cout << "[OccupancyPlotter::endRun] Total events received=" << cntevt << ", events with HV problem=" << cntBadHV << std::endl;
384 }
tuple cout
Definition: gather_cfg.py:121
void OccupancyPlotter::fillHltMatrix ( std::string  label,
std::string  path,
double  Eta,
double  Phi,
bool  first_count 
)
privatevirtual

Definition at line 457 of file OccupancyPlotter.cc.

References gather_cfg::cout, MonitorElement::getTH1F(), MonitorElement::getTH2F(), and AlCaHLTBitMon_QueryRunRegistry::string.

457  {
458 
459  if (debugPrint) std::cout << "Inside fillHltMatrix( " << label << " , " << path << " ) " << std::endl;
460 
461  std::string fullPathToME;
462  std::string fullPathToME1dEta;
463  std::string fullPathToME1dPhi;
464  std::string fullPathToME1dEtaPath;
465  std::string fullPathToME1dPhiPath;
466 
467  fullPathToME = "HLT/OccupancyPlots/HLT_"+label+"_EtaVsPhi";
468  fullPathToME1dEta = "HLT/OccupancyPlots/HLT_"+label+"_1dEta";
469  fullPathToME1dPhi = "HLT/OccupancyPlots/HLT_"+label+"_1dPhi";
470 
471 if (label != "SingleMu" && label != "SingleElectron" && label != "Jet") {
472  fullPathToME = "HLT/OccupancyPlots/"+label+"/HLT_"+label+"_EtaVsPhi";
473  fullPathToME1dEta = "HLT/OccupancyPlots/"+label+"/HLT_"+label+"_1dEta";
474  fullPathToME1dPhi = "HLT/OccupancyPlots/"+label+"/HLT_"+label+"_1dPhi";
475  }
476 
477  fullPathToME1dEtaPath = "HLT/OccupancyPlots/"+label+"/Paths/HLT_"+path+"_1dEta";
478  fullPathToME1dPhiPath = "HLT/OccupancyPlots/"+label+"/Paths/HLT_"+path+"_1dPhi";
479 
480  if (debugPrint) std::cout << "fullPathToME = " << std::endl;
481 
482  MonitorElement * ME_2d = dbe->get(fullPathToME);
483  MonitorElement * ME_1dEta = dbe->get(fullPathToME1dEta);
484  MonitorElement * ME_1dPhi = dbe->get(fullPathToME1dPhi);
485  MonitorElement * ME_1dEtaPath = dbe->get(fullPathToME1dEtaPath);
486  MonitorElement * ME_1dPhiPath = dbe->get(fullPathToME1dPhiPath);
487 
488  if (debugPrint) std::cout << "MonitorElement * " << std::endl;
489 
490  TH2F * hist_2d = ME_2d->getTH2F();
491  TH1F * hist_1dEta = ME_1dEta->getTH1F();
492  TH1F * hist_1dPhi = ME_1dPhi->getTH1F();
493  TH1F * hist_1dEtaPath = ME_1dEtaPath->getTH1F();
494  TH1F * hist_1dPhiPath = ME_1dPhiPath->getTH1F();
495 
496  if (debugPrint) std::cout << "TH2F *" << std::endl;
497 
498  //int i=2;
499  //if (Eta>1.305 && Eta<1.872) i=0;
500  //if (Eta<-1.305 && Eta>-1.872) i=0;
501  //for (int ii=i; ii<3; ++ii) hist_2d->Fill(Eta,Phi); //Scales narrow bins in Barrel/Endcap border region
502 
503  if(first_count) {
504  hist_1dEta->Fill(Eta);
505  hist_1dPhi->Fill(Phi);
506  hist_2d->Fill(Eta,Phi); }
507  hist_1dEtaPath->Fill(Eta);
508  hist_1dPhiPath->Fill(Phi);
509 
510  if (debugPrint) std::cout << "hist->Fill" << std::endl;
511 
512 } //End fillHltMatrix
tuple path
else: Piece not in the list, fine.
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1708
TH1F * getTH1F(void) const
tuple cout
Definition: gather_cfg.py:121
TH2F * getTH2F(void) const
void OccupancyPlotter::setupHltMatrix ( std::string  label,
int  iPD 
)
privatevirtual

Definition at line 386 of file OccupancyPlotter.cc.

References gather_cfg::cout, Gflash::EtaMax, EgammaValidation_cff::pathName, Pi, and AlCaHLTBitMon_QueryRunRegistry::string.

386  {
387 
388 std::string h_name;
389 std::string h_title;
390 std::string h_name_1dEta;
391 std::string h_name_1dPhi;
392 std::string h_title_1dEta;
393 std::string h_title_1dPhi;
394 std::string h_name_1dEtaPath;
395 std::string h_name_1dPhiPath;
396 std::string h_title_1dEtaPath;
397 std::string h_title_1dPhiPath;
399 std::string PD_Folder;
400 std::string Path_Folder;
401 
402 PD_Folder = TString("HLT/OccupancyPlots");
403 if (label != "SingleMu" && label != "SingleElectron" && label != "Jet") PD_Folder = TString("HLT/OccupancyPlots/"+label);
404 
405 dbe->setCurrentFolder(PD_Folder.c_str());
406 
407 h_name = "HLT_"+label+"_EtaVsPhi";
408 h_title = "HLT_"+label+"_EtaVsPhi; eta; phi";
409 h_name_1dEta = "HLT_"+label+"_1dEta";
410 h_name_1dPhi = "HLT_"+label+"_1dPhi";
411 h_title_1dEta = label+" Occupancy Vs Eta";
412 h_title_1dPhi = label+" Occupancy Vs Phi";
413 //Int_t numBinsEta = 12;
414 //Int_t numBinsPhi = 8;
415 Int_t numBinsEta = 30;
416 Int_t numBinsPhi = 34;
417 Int_t numBinsEtaFine = 60;
418 Int_t numBinsPhiFine = 66;
419 Double_t EtaMax = 2.610;
420 Double_t PhiMax = 17.0*TMath::Pi()/16.0;
421 Double_t PhiMaxFine = 33.0*TMath::Pi()/32.0;
422 
423  //Double_t eta_bins[] = {-2.610,-2.349,-2.088,-1.827,-1.740,-1.653,-1.566,-1.479,-1.392,-1.305,-1.044,-0.783,-0.522,-0.261,0,0.261,0.522,0.783,1.044,1.305,1.392,1.479,1.566,1.653,1.740,1.827,2.088,2.349,2.610}; //Has narrower bins in Barrel/Endcap border region
424 //Double_t eta_bins[] = {-2.610,-2.175,-1.740,-1.305,-0.870,-0.435,0,0.435,0.870,1.305,1.740,2.175,2.610};
425 //Double_t phi_bins[] = {-TMath::Pi(),-3*TMath::Pi()/4,-TMath::Pi()/2,-TMath::Pi()/4,0,TMath::Pi()/4,TMath::Pi()/2,3*TMath::Pi()/4,TMath::Pi()};
426 
427  TH2F * hist_EtaVsPhi = new TH2F(h_name.c_str(),h_title.c_str(),numBinsEta,-EtaMax,EtaMax,numBinsPhi,-PhiMax,PhiMax);
428  TH1F * hist_1dEta = new TH1F(h_name_1dEta.c_str(),h_title_1dEta.c_str(),numBinsEtaFine,-EtaMax,EtaMax);
429  TH1F * hist_1dPhi = new TH1F(h_name_1dPhi.c_str(),h_title_1dPhi.c_str(),numBinsPhiFine,-PhiMaxFine,PhiMaxFine);
430 
431  hist_EtaVsPhi->SetMinimum(0);
432  hist_1dEta->SetMinimum(0);
433  hist_1dPhi->SetMinimum(0);
434 
435 dbe->book2D(h_name.c_str(),hist_EtaVsPhi);
436 dbe->book1D(h_name_1dEta.c_str(),hist_1dEta);
437 dbe->book1D(h_name_1dPhi.c_str(),hist_1dPhi);
438 
439  for (unsigned int iPath = 0; iPath < PDsVectorPathsVector[iPD].size(); iPath++) {
440  pathName = PDsVectorPathsVector[iPD][iPath];
441  h_name_1dEtaPath = "HLT_"+pathName+"_1dEta";
442  h_name_1dPhiPath = "HLT_"+pathName+"_1dPhi";
443  h_title_1dEtaPath = pathName+" Occupancy Vs Eta";
444  h_title_1dPhiPath = pathName+"Occupancy Vs Phi";
445  Path_Folder = TString("HLT/OccupancyPlots/"+label+"/Paths");
446  dbe->setCurrentFolder(Path_Folder.c_str());
447 
448  dbe->book1D(h_name_1dEtaPath.c_str(),h_title_1dEtaPath.c_str(),numBinsEtaFine,-EtaMax,EtaMax);
449  dbe->book1D(h_name_1dPhiPath.c_str(),h_title_1dPhiPath.c_str(),numBinsPhiFine,-PhiMaxFine,PhiMaxFine);
450 
451  if (debugPrint) std::cout << "book1D for " << pathName << std::endl;
452  }
453 
454  if (debugPrint) std::cout << "Success setupHltMatrix( " << label << " , " << iPD << " )" << std::cout;
455 } //End setupHltMatrix
const double Pi
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:954
const double EtaMax[kNumberCalorimeter]
vector< vector< string > > PDsVectorPathsVector
tuple cout
Definition: gather_cfg.py:121
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:1082
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:667

Member Data Documentation

float OccupancyPlotter::_instLumi
private

Definition at line 97 of file OccupancyPlotter.cc.

float OccupancyPlotter::_instLumi_err
private

Definition at line 98 of file OccupancyPlotter.cc.

float OccupancyPlotter::_pileup
private

Definition at line 99 of file OccupancyPlotter.cc.

edm::EDGetTokenT<trigger::TriggerEvent> OccupancyPlotter::aodTriggerToken_
private

Definition at line 115 of file OccupancyPlotter.cc.

int OccupancyPlotter::cntBadHV
private

Definition at line 107 of file OccupancyPlotter.cc.

int OccupancyPlotter::cntevt
private

Definition at line 106 of file OccupancyPlotter.cc.

DQMStore* OccupancyPlotter::dbe
private

Definition at line 90 of file OccupancyPlotter.cc.

bool OccupancyPlotter::dcs[25]
private

Definition at line 102 of file OccupancyPlotter.cc.

edm::EDGetTokenT<DcsStatusCollection> OccupancyPlotter::dcsStatusToken_
private

Definition at line 116 of file OccupancyPlotter.cc.

bool OccupancyPlotter::debugPrint
private

Definition at line 85 of file OccupancyPlotter.cc.

TH1F* OccupancyPlotter::hist_LumivsLS
private

Definition at line 110 of file OccupancyPlotter.cc.

TH1F* OccupancyPlotter::hist_PUvsLS
private

Definition at line 111 of file OccupancyPlotter.cc.

HLTConfigProvider OccupancyPlotter::hltConfig_
private

Definition at line 92 of file OccupancyPlotter.cc.

edm::EDGetTokenT<LumiScalersCollection> OccupancyPlotter::lumiScalersToken_
private

Definition at line 117 of file OccupancyPlotter.cc.

bool OccupancyPlotter::outputPrint
private

Definition at line 86 of file OccupancyPlotter.cc.

vector< vector<string> > OccupancyPlotter::PDsVectorPathsVector
private

Definition at line 94 of file OccupancyPlotter.cc.

std::string OccupancyPlotter::plotDirectoryName
private

Definition at line 88 of file OccupancyPlotter.cc.

bool OccupancyPlotter::thisiLumiValue
private

Definition at line 103 of file OccupancyPlotter.cc.

edm::EDGetTokenT<edm::TriggerResults> OccupancyPlotter::triggerResultsToken_
private

Definition at line 114 of file OccupancyPlotter.cc.