CMS 3D CMS Logo

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

#include <DTBlockedROChannelsTest.h>

Inheritance diagram for DTBlockedROChannelsTest:
edm::EDAnalyzer edm::EDConsumerBase

Classes

class  DTRobBinsMap
 

Public Member Functions

 DTBlockedROChannelsTest (const edm::ParameterSet &ps)
 Constructor. More...
 
 ~DTBlockedROChannelsTest ()
 Destructor. More...
 
- 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 ()
 

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)
 Analyze. More...
 
void beginJob ()
 BeginJob. More...
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &context)
 
void beginRun (const edm::Run &run, const edm::EventSetup &c)
 BeginRun. More...
 
void endJob ()
 Endjob. More...
 
void endLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &c)
 DQM Client Diagnostic in online mode. More...
 
void endRun (edm::Run const &run, edm::EventSetup const &eSetup)
 DQM Client Diagnostic in offline mode. More...
 
void performClientDiagnostic ()
 DQM Client operations. More...
 
- 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)
 

Private Member Functions

int readOutToGeometry (int dduId, int rosNumber, int &wheel, int &sector)
 

Private Attributes

std::map< DTChamberId,
DTRobBinsMap
chamberMap
 
DQMStoredbe
 
DTTimeEvolutionHistohSystFractionVsLS
 
edm::ESHandle< DTReadOutMappingmapping
 
int nevents
 
int neventsPrev
 
unsigned int nLumiSegs
 
int nupdates
 
bool offlineMode
 
int prescaleFactor
 
unsigned int prevNLumiSegs
 
double prevTotalPerc
 
std::map< int, double > resultsPerLumi
 
int run
 
MonitorElementsummaryHisto
 
std::map< int, MonitorElement * > wheelHitos
 

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 &)
 

Detailed Description

Definition at line 24 of file DTBlockedROChannelsTest.h.

Constructor & Destructor Documentation

DTBlockedROChannelsTest::DTBlockedROChannelsTest ( const edm::ParameterSet ps)

Constructor.

Definition at line 28 of file DTBlockedROChannelsTest.cc.

References edm::ParameterSet::getUntrackedParameter(), LogTrace, offlineMode, and prescaleFactor.

28  : nevents(0),
29  neventsPrev(0),
30  prevNLumiSegs(0),
31  prevTotalPerc(0),
33 {
34  LogTrace("DTDQM|DTRawToDigi|DTMonitorClient|DTBlockedROChannelsTest")
35  << "[DTBlockedROChannelsTest]: Constructor";
36 
37  // prescale on the # of LS to update the test
38  prescaleFactor = ps.getUntrackedParameter<int>("diagnosticPrescale", 1);
39 
40  offlineMode = ps.getUntrackedParameter<bool>("offlineMode", true);
41 }
T getUntrackedParameter(std::string const &, T const &) const
DTTimeEvolutionHisto * hSystFractionVsLS
#define LogTrace(id)
DTBlockedROChannelsTest::~DTBlockedROChannelsTest ( )

Destructor.

Definition at line 45 of file DTBlockedROChannelsTest.cc.

References LogTrace, and nupdates.

45  {
46  LogTrace("DTDQM|DTRawToDigi|DTMonitorClient|DTBlockedROChannelsTest")
47  << "DataIntegrityTest: analyzed " << nupdates << " updates";
48 }
#define LogTrace(id)

Member Function Documentation

void DTBlockedROChannelsTest::analyze ( const edm::Event e,
const edm::EventSetup c 
)
protectedvirtual

Analyze.

Implements edm::EDAnalyzer.

Definition at line 145 of file DTBlockedROChannelsTest.cc.

References LogTrace, and nevents.

145  {
146  // count the analyzed events
147  nevents++;
148  if(nevents%1000 == 0)
149  LogTrace("DTDQM|DTRawToDigi|DTMonitorClient|DTBlockedROChannelsTest")
150  << "[DTBlockedROChannelsTest]: "<<nevents<<" events";
151 }
#define LogTrace(id)
void DTBlockedROChannelsTest::beginJob ( void  )
protectedvirtual

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 53 of file DTBlockedROChannelsTest.cc.

References DQMStore::book2D(), dbe, hSystFractionVsLS, LogTrace, nupdates, offlineMode, cppFunctionSkipper::operator, run, MonitorElement::setAxisTitle(), DQMStore::setCurrentFolder(), summaryHisto, and wheelHitos.

53  {
54  LogTrace("DTDQM|DTRawToDigi|DTMonitorClient|DTBlockedROChannelsTest")
55  << "[DTBlockedROChannelsTest]: BeginJob";
56 
57  nupdates = 0;
58  run=0;
59 
61 
62  // book the summary histogram
63  dbe->setCurrentFolder("DT/00-ROChannels");
64  summaryHisto = dbe->book2D("ROChannelSummary","Summary Blocked RO Channels",12,1,13,5,-2,3);
65  summaryHisto->setAxisTitle("Sector",1);
66  summaryHisto->setAxisTitle("Wheel",2);
67 
68  for(int wheel = -2; wheel != 3; ++wheel) {
69  stringstream namestream; namestream << "ROChannelSummary_W" << wheel;
70  stringstream titlestream; titlestream << "Blocked RO Channels (Wh " << wheel << ")";
71  wheelHitos[wheel] = dbe->book2D(namestream.str().c_str(),titlestream.str().c_str(),12,1,13,4,1,5);
72  wheelHitos[wheel]->setAxisTitle("Sector",1);
73  wheelHitos[wheel]->setBinLabel(1,"MB1",2);
74  wheelHitos[wheel]->setBinLabel(2,"MB2",2);
75  wheelHitos[wheel]->setBinLabel(3,"MB3",2);
76  wheelHitos[wheel]->setBinLabel(4,"MB4",2);
77  }
78 
79  if(!offlineMode) {
80  hSystFractionVsLS = new DTTimeEvolutionHisto(dbe, "EnabledROChannelsVsLS", "% RO channels",
81  500, 5, true, 3);
82  }
83 
84 }
DTTimeEvolutionHisto * hSystFractionVsLS
std::map< int, MonitorElement * > wheelHitos
#define LogTrace(id)
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 setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:667
void DTBlockedROChannelsTest::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  context 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 126 of file DTBlockedROChannelsTest.cc.

References LogTrace, nevents, edm::LuminosityBlockBase::run(), and run.

127  {
128  LogTrace("DTDQM|DTRawToDigi|DTMonitorClient|DTBlockedROChannelsTest")
129  <<"[DTBlockedROChannelsTest]: Begin of LS transition";
130 
131  // Get the run number
132  run = lumiSeg.run();
133  nevents = 0;
134 
135  // // loop over all chambers and read the values at the beginning of the LS
136  // for(map<DTChamberId, DTRobBinsMap>::iterator chAndRobs = chamberMap.begin();
137  // chAndRobs != chamberMap.end(); ++chAndRobs) {
138  // (*chAndRobs).second.readNewValues();
139  // }
140 
141 }
#define LogTrace(id)
void DTBlockedROChannelsTest::beginRun ( const edm::Run run,
const edm::EventSetup c 
)
protectedvirtual

BeginRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 89 of file DTBlockedROChannelsTest.cc.

References chamberMap, dbe, edm::EventSetup::get(), LogTrace, mapping, FEDNumbering::MAXDTFEDID, FEDNumbering::MINDTFEDID, and relativeConstraints::station.

89  {
90  // get the RO mapping
91  context.get<DTReadOutMappingRcd>().get(mapping);
92 
93  // fill the map of the robs per chamber
94  for(int dduId = FEDNumbering::MINDTFEDID; dduId<=FEDNumbering::MAXDTFEDID; ++dduId) { //loop over DDUs
95  for(int ros = 1; ros != 13; ++ros) { // loop over ROSs
96  for(int rob = 1; rob != 26; ++rob) { // loop over ROBs
97  int wheel = 0;
98  int station = 0;
99  int sector = 0;
100  int dummy = 0;
101  if(!mapping->readOutToGeometry(dduId,ros,rob-1,0,2,wheel,station,sector,dummy,dummy,dummy) ||
102  !mapping->readOutToGeometry(dduId,ros,rob-1,0,16,wheel,station,sector,dummy,dummy,dummy)) {
103  DTChamberId chId(wheel, station, sector);
104  if(chamberMap.find(chId) == chamberMap.end()) {
105  chamberMap[chId] = DTRobBinsMap(dduId, ros, dbe);
106  chamberMap[chId].addRobBin(rob);
107  }
108  chamberMap[chId].addRobBin(rob);
109  } else {
110  LogTrace("DTDQM|DTRawToDigi|DTMonitorClient|DTBlockedROChannelsTest")
111  << "[DTRobBinsMap] FED: " << dduId << " ROS " << ros << " ROB: " << rob-1
112  << " not in the mapping!" << endl;
113  }
114  }
115  }
116  }
117  // loop over all chambers and remove the init flag
118  for(map<DTChamberId, DTRobBinsMap>::iterator chAndRobs = chamberMap.begin();
119  chAndRobs != chamberMap.end(); ++chAndRobs) {
120  chAndRobs->second.init(false);
121  }
122 }
std::map< DTChamberId, DTRobBinsMap > chamberMap
edm::ESHandle< DTReadOutMapping > mapping
#define LogTrace(id)
void DTBlockedROChannelsTest::endJob ( void  )
protectedvirtual

Endjob.

Reimplemented from edm::EDAnalyzer.

Definition at line 255 of file DTBlockedROChannelsTest.cc.

References LogTrace.

255  {
256  LogTrace("DTDQM|DTRawToDigi|DTMonitorClient|DTBlockedROChannelsTest")
257  <<"[DTBlockedROChannelsTest] endjob called!";
258 }
#define LogTrace(id)
void DTBlockedROChannelsTest::endLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  c 
)
protectedvirtual

DQM Client Diagnostic in online mode.

Reimplemented from edm::EDAnalyzer.

Definition at line 155 of file DTBlockedROChannelsTest.cc.

References edm::LuminosityBlockBase::id(), LogTrace, edm::LuminosityBlockID::luminosityBlock(), nLumiSegs, nupdates, offlineMode, performClientDiagnostic(), and prescaleFactor.

155  {
156 
157  // counts number of lumiSegs
158  nLumiSegs = lumiSeg.id().luminosityBlock();
159 
160  // prescale factor
161  if (nLumiSegs%prescaleFactor != 0 || offlineMode) return;
162 
163  LogTrace("DTDQM|DTRawToDigi|DTMonitorClient|DTBlockedROChannelsTest")
164  <<"[DTBlockedROChannelsTest]: End of LS " << nLumiSegs << ". Client called in online mode, performing client operations";
166 
167  // counts number of updats
168  nupdates++;
169 
170 }
#define LogTrace(id)
void performClientDiagnostic()
DQM Client operations.
void DTBlockedROChannelsTest::endRun ( edm::Run const &  run,
edm::EventSetup const &  eSetup 
)
protectedvirtual

DQM Client Diagnostic in offline mode.

Reimplemented from edm::EDAnalyzer.

Definition at line 263 of file DTBlockedROChannelsTest.cc.

References LogTrace, offlineMode, and performClientDiagnostic().

263  {
264 
265  if (offlineMode) {
266  LogTrace("DTDQM|DTRawToDigi|DTMonitorClient|DTBlockedROChannelsTest")
267  <<"[DTBlockedROChannelsTest] endRun called. Client called in offline mode, performing operations.";
269  }
270  // commented out since trend plots need to be updated in by lumi certification
271  // if(offlineMode) {
272  // // fill a trend plot based on the results stored in the map
273  // float fBin = resultsPerLumi.begin()->first;
274  // float lBin = resultsPerLumi.rbegin()->first;
275  // dbe->setCurrentFolder("DT/00-ROChannels");
276 
277  // // MonitorElement* hSystFractionVsLS = dbe->book1D("EnabledROChannelsVsLS", "% RO channels vs LS", nBins,fBin,lBin);
278  // hSystFractionVsLS = new DTTimeEvolutionHisto(dbe, "EnabledROChannelsVsLS", "% RO channels",
279  // (int)lBin-(int)fBin, fBin, 1, false, 2);
280 
281  // for(map<int, double>::const_iterator bin = resultsPerLumi.begin();
282  // bin != resultsPerLumi.end(); ++bin) {
283  // hSystFractionVsLS->setTimeSlotValue((*bin).second, (*bin).first);
284  // }
285  // }
286 }
#define LogTrace(id)
void performClientDiagnostic()
DQM Client operations.
void DTBlockedROChannelsTest::performClientDiagnostic ( )
protected

DQM Client operations.

Definition at line 173 of file DTBlockedROChannelsTest.cc.

References DTTimeEvolutionHisto::accumulateValueTimeSlot(), chamberMap, dbe, MonitorElement::Fill(), DQMStore::get(), MonitorElement::getIntValue(), hSystFractionVsLS, nevents, neventsPrev, nLumiSegs, offlineMode, prevTotalPerc, MonitorElement::Reset(), pileupReCalc_HLTpaths::scale, DTChamberId::sector(), DTChamberId::station(), summaryHisto, DTTimeEvolutionHisto::updateTimeSlot(), DTChamberId::wheel(), and wheelHitos.

Referenced by endLuminosityBlock(), and endRun().

173  {
174 
175  // skip empty LSs
176 
177  if(nevents == 0) { // hack to work also in offline DQM
178  MonitorElement *procEvt = dbe->get("DT/EventInfo/processedEvents");
179  if(procEvt != 0) {
180  int procEvents = procEvt->getIntValue();
181  nevents = procEvents - neventsPrev;
182  neventsPrev = procEvents;
183  }
184  }
185 
186  double totalPerc = prevTotalPerc;
187  // check again!
188  if(nevents != 0) { // skip the computation if no events in the last LS
189 
190  // reset the histos
191  summaryHisto->Reset();
192  for(int wheel = -2; wheel != 3; ++wheel) {
193  wheelHitos[wheel]->Reset();
194  }
195 
196  totalPerc = 0.;
197 
198  // loop over all chambers and fill the wheel plots
199  for(map<DTChamberId, DTRobBinsMap>::iterator chAndRobs = chamberMap.begin();
200  chAndRobs != chamberMap.end(); ++chAndRobs) {
201  DTChamberId chId = (*chAndRobs).first;
202  double scale = 1.;
203  int sectorForPlot = chId.sector();
204  if(sectorForPlot == 13 || (sectorForPlot == 4 && chId.station() ==4)) {
205  sectorForPlot = 4;
206  scale = 0.5;
207  } else if(sectorForPlot == 14 || (sectorForPlot == 10 && chId.station() ==4)) {
208  sectorForPlot = 10;
209  scale = 0.5;
210  }
211 
212  // NOTE: can be called only ONCE per event per each chamber
213  double chPercent = (*chAndRobs).second.getChamberPercentage();
214  wheelHitos[chId.wheel()]->Fill(sectorForPlot, chId.station(),
215  scale*chPercent);
216  totalPerc += chPercent*scale*1./240.; // CB has to be 240 as double stations are taken into account by scale factor
217  // if(chPercent != 1.) {
218  // cout << "Ch: " << (*chAndRobs).first << endl;
219  // cout << " perc: " << chPercent << endl;
220  // }
221  // Fill the summary
222  summaryHisto->Fill(sectorForPlot, chId.wheel(), 0.25*scale*chPercent);
223  }
224  }
225 
226  // commented out since trend plots need to be updated in by lumi certification
227  // // this part is executed even if no events were processed in order to include the last LS
228  // if(offlineMode) { // save the results in a map and draw them in the end-run
229  // if(resultsPerLumi.size() == 0) { // the first 2 LS are analyzed together
230  // // cout << "LS: " << nLumiSegs << " total %: " << totalPerc << endl;
231  // resultsPerLumi[nLumiSegs] = totalPerc;
232  // } else {
233  // // cout << "LS: " << nLumiSegs << " total %: " << prevTotalPerc << endl;
234  // resultsPerLumi[nLumiSegs] = prevTotalPerc;
235  // }
236  // prevTotalPerc = totalPerc;
237  // prevNLumiSegs = nLumiSegs;
238 
239  // } else { // directly fill the histo
240  // hSystFractionVsLS->accumulateValueTimeSlot(totalPerc);
241  // hSystFractionVsLS->updateTimeSlot(nLumiSegs, nevents);
242  // prevTotalPerc = totalPerc;
243  // }
244 
245  if(!offlineMode) { // fill trend histo only in online
248  prevTotalPerc = totalPerc;
249  }
250 
251 }
DTTimeEvolutionHisto * hSystFractionVsLS
void accumulateValueTimeSlot(float value)
std::map< DTChamberId, DTRobBinsMap > chamberMap
void Fill(long long x)
std::map< int, MonitorElement * > wheelHitos
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
int64_t getIntValue(void) const
void updateTimeSlot(int ls, int nEventsInLS)
int sector() const
Definition: DTChamberId.h:61
int station() const
Return the station number.
Definition: DTChamberId.h:51
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:45
void Reset(void)
reset ME (ie. contents, errors, etc)
int DTBlockedROChannelsTest::readOutToGeometry ( int  dduId,
int  rosNumber,
int &  wheel,
int &  sector 
)
private

Definition at line 290 of file DTBlockedROChannelsTest.cc.

References mapping.

290  {
291 
292  int dummy;
293  return mapping->readOutToGeometry(dduId,ros,2,2,2,wheel,dummy,sector,dummy,dummy,dummy);
294 
295 }
edm::ESHandle< DTReadOutMapping > mapping

Member Data Documentation

std::map<DTChamberId, DTRobBinsMap> DTBlockedROChannelsTest::chamberMap
private

Definition at line 131 of file DTBlockedROChannelsTest.h.

Referenced by beginRun(), and performClientDiagnostic().

DQMStore* DTBlockedROChannelsTest::dbe
private
DTTimeEvolutionHisto* DTBlockedROChannelsTest::hSystFractionVsLS
private

Definition at line 90 of file DTBlockedROChannelsTest.h.

Referenced by beginJob(), and performClientDiagnostic().

edm::ESHandle<DTReadOutMapping> DTBlockedROChannelsTest::mapping
private

Definition at line 80 of file DTBlockedROChannelsTest.h.

Referenced by beginRun(), and readOutToGeometry().

int DTBlockedROChannelsTest::nevents
private
int DTBlockedROChannelsTest::neventsPrev
private

Definition at line 71 of file DTBlockedROChannelsTest.h.

Referenced by performClientDiagnostic().

unsigned int DTBlockedROChannelsTest::nLumiSegs
private

Definition at line 72 of file DTBlockedROChannelsTest.h.

Referenced by endLuminosityBlock(), and performClientDiagnostic().

int DTBlockedROChannelsTest::nupdates
private
bool DTBlockedROChannelsTest::offlineMode
private
int DTBlockedROChannelsTest::prescaleFactor
private

Definition at line 68 of file DTBlockedROChannelsTest.h.

Referenced by DTBlockedROChannelsTest(), and endLuminosityBlock().

unsigned int DTBlockedROChannelsTest::prevNLumiSegs
private

Definition at line 73 of file DTBlockedROChannelsTest.h.

double DTBlockedROChannelsTest::prevTotalPerc
private

Definition at line 74 of file DTBlockedROChannelsTest.h.

Referenced by performClientDiagnostic().

std::map<int, double> DTBlockedROChannelsTest::resultsPerLumi
private

Definition at line 89 of file DTBlockedROChannelsTest.h.

int DTBlockedROChannelsTest::run
private
MonitorElement* DTBlockedROChannelsTest::summaryHisto
private

Definition at line 85 of file DTBlockedROChannelsTest.h.

Referenced by beginJob(), and performClientDiagnostic().

std::map<int, MonitorElement*> DTBlockedROChannelsTest::wheelHitos
private

Definition at line 84 of file DTBlockedROChannelsTest.h.

Referenced by beginJob(), and performClientDiagnostic().