CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PSMonitor.cc
Go to the documentation of this file.
2 
4 
6 
7 
8 // -----------------------------
9 // constructors and destructor
10 // -----------------------------
11 
13  folderName_ ( iConfig.getParameter<std::string>("FolderName") )
14  , ugtBXToken_ ( consumes<GlobalAlgBlkBxCollection>(iConfig.getParameter<edm::InputTag>("ugtBXInputTag") ) )
15 {
16 
18  if ( edm::Service<edm::service::PrescaleService>().isAvailable() )
20 
21  psColumnIndexVsLS_ = nullptr;
22 
23  edm::ParameterSet histoPSet = iConfig.getParameter<edm::ParameterSet>("histoPSet");
24  edm::ParameterSet psColumnPSet = histoPSet.getParameter<edm::ParameterSet>("psColumnPSet");
25  edm::ParameterSet lsPSet = histoPSet.getParameter<edm::ParameterSet>("lsPSet");
26 
27  getHistoPSet(psColumnPSet, ps_binning_);
28  getHistoPSet(lsPSet, ls_binning_);
29 
30 }
31 
33 {
34  mebinning.nbins = pset.getParameter<int32_t>("nbins");
35  mebinning.xmin = 0.;
36  mebinning.xmax = double(pset.getParameter<int32_t>("nbins"));
37 }
38 
39 
41  edm::Run const & iRun,
42  edm::EventSetup const & iSetup)
43 {
44 
45  std::string histname, histtitle;
46 
47  std::string currentFolder = folderName_ ;
48  ibooker.setCurrentFolder(currentFolder.c_str());
49 
50  std::vector<std::string> psLabels = psService_->getLvl1Labels();
51  int nbins = ( psLabels.size() ? psLabels.size() : ps_binning_.nbins );
52  double xmin = ( psLabels.size() ? 0. : ps_binning_.xmin );
53  double xmax = ( psLabels.size() ? double(psLabels.size()) : ps_binning_.xmax );
54 
55  histname = "psColumnIndexVsLS"; histtitle = "PS column index vs LS";
56  psColumnIndexVsLS_ = ibooker.book2D(histname, histtitle,
58  nbins, xmin, xmax);
60  psColumnIndexVsLS_->setAxisTitle("PS column index",2);
61 
62  int ibin = 1;
63  for ( auto l : psLabels ) {
64  psColumnIndexVsLS_->setBinLabel(ibin,l.c_str(),2);
65  ibin++;
66  }
67 
68 }
69 
70 void PSMonitor::analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup) {
71 
72  int ls = iEvent.id().luminosityBlock();
73 
74  int psColumn = -1;
75 
77  iEvent.getByToken(ugtBXToken_, ugtBXhandle);
78  if (ugtBXhandle.isValid() and not ugtBXhandle->isEmpty(0))
79  psColumn = ugtBXhandle->at(0, 0).getPreScColumn();
80 
81  psColumnIndexVsLS_->Fill(ls, psColumn);
82 
83 }
84 
86 {
87  pset.add<int>( "nbins", value);
88 }
89 
91 {
93  desc.add<edm::InputTag>( "ugtBXInputTag", edm::InputTag("hltGtStage2Digis") );
94  desc.add<std::string> ( "FolderName", "HLT/PSMonitoring" );
95 
97 
98  edm::ParameterSetDescription psColumnPSet;
99  fillHistoPSetDescription(psColumnPSet,8);
100  histoPSet.add<edm::ParameterSetDescription>("psColumnPSet", psColumnPSet);
101 
103  fillHistoPSetDescription(lsPSet,2500);
104  histoPSet.add<edm::ParameterSetDescription>("lsPSet", lsPSet);
105 
106  desc.add<edm::ParameterSetDescription>("histoPSet",histoPSet);
107 
108  descriptions.add("psMonitoring", desc);
109 }
110 
111 // Define this as a plug-in
T getParameter(std::string const &) const
std::string folderName_
Definition: PSMonitor.h:62
edm::EDGetTokenT< GlobalAlgBlkBxCollection > ugtBXToken_
Definition: PSMonitor.h:64
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
def ls
Definition: eostools.py:348
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: PSMonitor.cc:90
LuminosityBlockNumber_t luminosityBlock() const
Definition: EventID.h:40
void Fill(long long x)
void getHistoPSet(edm::ParameterSet &pset, MEbinning &mebinning)
Definition: PSMonitor.cc:32
int iEvent
Definition: GenABIO.cc:230
MEbinning ps_binning_
Definition: PSMonitor.h:71
double xmin
Definition: LumiMonitor.h:30
MonitorElement * psColumnIndexVsLS_
Definition: PSMonitor.h:69
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: PSMonitor.cc:40
ParameterDescriptionBase * add(U const &iLabel, T const &value)
bool isValid() const
Definition: HandleBase.h:75
edm::service::PrescaleService * psService_
Prescale service.
Definition: PSMonitor.h:67
const VString_t & getLvl1Labels() const
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:276
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static void fillHistoPSetDescription(edm::ParameterSetDescription &pset, int value)
Definition: PSMonitor.cc:85
PSMonitor(const edm::ParameterSet &)
Definition: PSMonitor.cc:12
edm::EventID id() const
Definition: EventBase.h:59
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void analyze(edm::Event const &iEvent, edm::EventSetup const &iSetup)
Definition: PSMonitor.cc:70
Definition: Run.h:43
double xmax
Definition: LumiMonitor.h:31
MEbinning ls_binning_
Definition: PSMonitor.h:72