CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DQMDcsInfo.cc
Go to the documentation of this file.
1 /*
2  * \file DQMDcsInfo.cc
3  * \author A.Meyer - DESY
4  * Last Update:
5  *
6  */
7 
8 #include "DQMDcsInfo.h"
13 
14 // Framework
15 
17 {
18 
19  parameters_ = ps;
20 
21  subsystemname_ = parameters_.getUntrackedParameter<std::string>("subSystemFolder", "Info") ;
22  dcsinfofolder_ = parameters_.getUntrackedParameter<std::string>("dcsInfoFolder", "DcsInfo") ;
23  gtCollection_ = consumes<L1GlobalTriggerReadoutRecord>(parameters_.getUntrackedParameter<std::string>("gtCollection","gtDigis"));
24  dcsStatusCollection_ = consumes<DcsStatusCollection>(parameters_.getUntrackedParameter<std::string>("dcsStatusCollection","scalersRawToDigi"));
25 
26  // initialize
27  for (int i=0;i<25;i++) dcs[i]=true;
28 }
29 
31 }
32 
34  edm::Run const & /* iRun */,
35  edm::EventSetup const & /* iSetup */) {
36 
37  // Fetch GlobalTag information and fill the string/ME.
38  ibooker.cd();
39  ibooker.setCurrentFolder(subsystemname_ +"/CMSSWInfo/");
40  const edm::ParameterSet &globalTagPSet = edm::getProcessParameterSet()
41  .getParameterSet("PoolDBESSource@GlobalTag");
42 
43  ibooker.bookString("globalTag_Step1", globalTagPSet.getParameter<std::string>("globaltag"));
44 
45  ibooker.cd();
47 
48  DCSbyLS_ = ibooker.book1D("DCSbyLS","DCS",25,0.,25.);
50 
51  // initialize
52  for (int i=0;i<25;i++) dcs[i]=true;
53 }
54 
56 
57  makeDcsInfo(e);
58  makeGtInfo(e);
59 
60  return;
61 }
62 
63 void
65 {
66  // int nlumi = l.id().luminosityBlock();
67 
68  // fill dcs vs lumi
69  /* set those bins 0 for which bits are ON
70  needed for merge off lumi histograms across files */
71  for (int i=0;i<25;i++)
72  {
73  if (dcs[i])
74  DCSbyLS_->setBinContent(i+1,0.);
75  else
76  DCSbyLS_->setBinContent(i+1,1.);
77 
78  dcs[i]=true;
79  }
80 
81  return;
82 }
83 
84 void
86 {
87 
89  if ( ! e.getByToken(dcsStatusCollection_, dcsStatus) )
90  {
91  for (int i=0;i<24;i++) dcs[i]=false;
92  return;
93  }
94 
95  if ( ! dcsStatus.isValid() )
96  {
97  edm::LogWarning("DQMDcsInfo") << "scalersRawToDigi not found" ;
98  for (int i=0;i<24;i++) dcs[i]=false; // info not available: set to false
99  return;
100  }
101 
102  for (DcsStatusCollection::const_iterator dcsStatusItr = dcsStatus->begin();
103  dcsStatusItr != dcsStatus->end(); ++dcsStatusItr)
104  {
105  if (!dcsStatusItr->ready(DcsStatus::CSCp)) dcs[0]=false;
106  if (!dcsStatusItr->ready(DcsStatus::CSCm)) dcs[1]=false;
107  if (!dcsStatusItr->ready(DcsStatus::DT0)) dcs[2]=false;
108  if (!dcsStatusItr->ready(DcsStatus::DTp)) dcs[3]=false;
109  if (!dcsStatusItr->ready(DcsStatus::DTm)) dcs[4]=false;
110  if (!dcsStatusItr->ready(DcsStatus::EBp)) dcs[5]=false;
111  if (!dcsStatusItr->ready(DcsStatus::EBm)) dcs[6]=false;
112  if (!dcsStatusItr->ready(DcsStatus::EEp)) dcs[7]=false;
113  if (!dcsStatusItr->ready(DcsStatus::EEm)) dcs[8]=false;
114  if (!dcsStatusItr->ready(DcsStatus::ESp)) dcs[9]=false;
115  if (!dcsStatusItr->ready(DcsStatus::ESm)) dcs[10]=false;
116  if (!dcsStatusItr->ready(DcsStatus::HBHEa)) dcs[11]=false;
117  if (!dcsStatusItr->ready(DcsStatus::HBHEb)) dcs[12]=false;
118  if (!dcsStatusItr->ready(DcsStatus::HBHEc)) dcs[13]=false;
119  if (!dcsStatusItr->ready(DcsStatus::HF)) dcs[14]=false;
120  if (!dcsStatusItr->ready(DcsStatus::HO)) dcs[15]=false;
121  if (!dcsStatusItr->ready(DcsStatus::BPIX)) dcs[16]=false;
122  if (!dcsStatusItr->ready(DcsStatus::FPIX)) dcs[17]=false;
123  if (!dcsStatusItr->ready(DcsStatus::RPC)) dcs[18]=false;
124  if (!dcsStatusItr->ready(DcsStatus::TIBTID)) dcs[19]=false;
125  if (!dcsStatusItr->ready(DcsStatus::TOB)) dcs[20]=false;
126  if (!dcsStatusItr->ready(DcsStatus::TECp)) dcs[21]=false;
127  if (!dcsStatusItr->ready(DcsStatus::TECm)) dcs[22]=false;
128  if (!dcsStatusItr->ready(DcsStatus::CASTOR)) dcs[23]=false;
129  }
130 
131  return ;
132 }
133 
134 void
136 {
137 
139  if ( ! e.getByToken(gtCollection_, gtrr_handle) )
140  {
141  dcs[24]=false; // info not available: set to false
142  return;
143  }
144 
145  if ( ! gtrr_handle.isValid() )
146  {
147  edm::LogWarning("DQMDcsInfo") << " gtDigis not found" ;
148  dcs[24]=false; // info not available: set to false
149  return;
150  }
151 
152  L1GlobalTriggerReadoutRecord const* gtrr = gtrr_handle.product();
153  L1GtFdlWord fdlWord ;
154  if (gtrr)
155  fdlWord = gtrr->gtFdlWord();
156  else
157  {
158  edm::LogWarning ("DQMDcsInfo") << " phys decl. bit not accessible !!!";
159  dcs[24]=false; // info not available: set to false
160  return;
161  }
162 
163  if (fdlWord.physicsDeclared() !=1) dcs[24]=false;
164 
165  return;
166 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
void setBinContent(int binx, double content)
set content of bin (1-D)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
void cd(void)
Definition: DQMStore.cc:266
MonitorElement * bookString(Args &&...args)
Definition: DQMStore.h:97
void analyze(const edm::Event &e, const edm::EventSetup &c)
Analyze.
Definition: DQMDcsInfo.cc:55
return((rh^lh)&mask)
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
void endLuminosityBlock(const edm::LuminosityBlock &l, const edm::EventSetup &c)
Definition: DQMDcsInfo.cc:64
bool isValid() const
Definition: HandleBase.h:75
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > gtCollection_
Definition: DQMDcsInfo.h:51
edm::ParameterSet parameters_
Definition: DQMDcsInfo.h:48
bool dcs[25]
Definition: DQMDcsInfo.h:54
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
T const * product() const
Definition: Handle.h:81
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: DQMDcsInfo.cc:33
virtual ~DQMDcsInfo()
Destructor.
Definition: DQMDcsInfo.cc:30
const L1GtFdlWord gtFdlWord(int bxInEventValue) const
get / set FDL word (record) in the GT readout record
ParameterSet const & getProcessParameterSet()
Definition: Registry.cc:85
ParameterSet const & getParameterSet(std::string const &) const
std::string dcsinfofolder_
Definition: DQMDcsInfo.h:50
const cms_uint16_t physicsDeclared() const
get/set &quot;physics declared&quot; bit
Definition: L1GtFdlWord.h:227
void makeDcsInfo(const edm::Event &e)
Definition: DQMDcsInfo.cc:85
std::string subsystemname_
Definition: DQMDcsInfo.h:49
DQMDcsInfo(const edm::ParameterSet &ps)
Constructor.
Definition: DQMDcsInfo.cc:16
MonitorElement * DCSbyLS_
Definition: DQMDcsInfo.h:56
void setLumiFlag(void)
this ME is meant to be stored for each luminosity section
edm::EDGetTokenT< DcsStatusCollection > dcsStatusCollection_
Definition: DQMDcsInfo.h:52
void makeGtInfo(const edm::Event &e)
Definition: DQMDcsInfo.cc:135
Definition: Run.h:41