CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
DTOccupancyTest Class Reference

#include <DTOccupancyTest.h>

Inheritance diagram for DTOccupancyTest:
DQMEDHarvester edm::one::EDProducer< edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::EndProcessBlockProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns, edm::one::SharedResources, edm::Accumulator > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 DTOccupancyTest (const edm::ParameterSet &ps)
 Constructor. More...
 
 ~DTOccupancyTest () override
 Destructor. More...
 
- Public Member Functions inherited from DQMEDHarvester
void accumulate (edm::Event const &ev, edm::EventSetup const &es) final
 
void beginJob () override
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &) override
 
virtual void dqmAnalyze (DQMStore::IBooker &, DQMStore::IGetter &, edm::Event const &, edm::EventSetup const &)
 
 DQMEDHarvester (edm::ParameterSet const &iConfig)
 
 DQMEDHarvester ()
 
virtual void dqmEndRun (DQMStore::IBooker &, DQMStore::IGetter &, edm::Run const &, edm::EventSetup const &)
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void endLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &es) final
 
void endProcessBlockProduce (edm::ProcessBlock &) final
 
void endRun (edm::Run const &, edm::EventSetup const &) override
 
void endRunProduce (edm::Run &run, edm::EventSetup const &es) final
 
 ~DQMEDHarvester () override=default
 
- Public Member Functions inherited from edm::one::EDProducer< edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::EndProcessBlockProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns, edm::one::SharedResources, edm::Accumulator >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Protected Member Functions

void beginRun (edm::Run const &run, edm::EventSetup const &context) override
 BeginRun. More...
 
void dqmEndJob (DQMStore::IBooker &, DQMStore::IGetter &) override
 Endjob. More...
 
void dqmEndLuminosityBlock (DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &) override
 DQM Client Diagnostic. More...
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Private Member Functions

void bookHistos (DQMStore::IBooker &, const int wheelId, std::string folder, std::string histoTag)
 book the summary histograms More...
 
int getIntegral (TH2F *histo, int, int, int, int, bool)
 
std::string getMEName (std::string histoTag, const DTChamberId &chId)
 Get the ME name. More...
 
int runOccupancyTest (TH2F *histo, const DTChamberId &chId, float &chamberPercentage)
 
std::string topFolder () const
 

Private Attributes

bool bookingdone
 
MonitorElementglbSummaryHisto
 
int lsCounter
 
std::set< DTLayerIdmonitoredLayers
 
const DTGeometrymuonGeom
 
edm::ESGetToken< DTGeometry, MuonGeometryRecordmuonGeomToken_
 
std::string nameMonitoredHisto
 
int nChannelDead
 
int nChannelTotal
 
int nevents
 
int nMinEvts
 
int nMinEvtsPC
 
TNtuple * ntuple
 
int nZeroEvtsPC
 
TFile * rootFile
 
bool runOnAllHitsOccupancies
 
bool runOnInTimeOccupancies
 
bool runOnNoiseOccupancies
 
MonitorElementsummaryHisto
 
bool tpMode
 
std::map< int, MonitorElement * > wheelHistos
 
bool writeRootFile
 

Additional Inherited Members

- Public Types inherited from DQMEDHarvester
typedef dqm::harvesting::DQMStore DQMStore
 
typedef dqm::harvesting::MonitorElement MonitorElement
 
- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Attributes inherited from DQMEDHarvester
DQMStoredqmstore_
 
edm::GetterOfProducts< DQMTokenjobmegetter_
 
edm::EDPutTokenT< DQMTokenjobToken_
 
edm::GetterOfProducts< DQMTokenlumimegetter_
 
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::GetterOfProducts< DQMTokenrunmegetter_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Definition at line 34 of file DTOccupancyTest.h.

Constructor & Destructor Documentation

◆ DTOccupancyTest()

DTOccupancyTest::DTOccupancyTest ( const edm::ParameterSet ps)

Constructor.

Definition at line 25 of file DTOccupancyTest.cc.

References bookingdone, edm::ParameterSet::getUntrackedParameter(), lsCounter, nevents, nMinEvts, nMinEvtsPC, nZeroEvtsPC, rootFile, runOnAllHitsOccupancies, runOnInTimeOccupancies, runOnNoiseOccupancies, tpMode, and writeRootFile.

26  : muonGeomToken_(esConsumes<edm::Transition::BeginRun>()) {
27  LogVerbatim("DTDQM|DTMonitorClient|DTOccupancyTest") << "[DTOccupancyTest]: Constructor";
28 
29  // Get the DQM service
30 
31  lsCounter = 0;
32 
33  writeRootFile = ps.getUntrackedParameter<bool>("writeRootFile", false);
34  if (writeRootFile) {
35  rootFile = new TFile("DTOccupancyTest.root", "RECREATE");
36  ntuple = new TNtuple("OccupancyNtuple",
37  "OccupancyNtuple",
38  "ls:wh:st:se:lay1MeanCell:lay1RMS:lay2MeanCell:lay2RMS:lay3MeanCell:lay3RMS:lay4MeanCell:"
39  "lay4RMS:lay5MeanCell:lay5RMS:lay6MeanCell:lay6RMS:lay7MeanCell:lay7RMS:lay8MeanCell:lay8RMS:"
40  "lay9MeanCell:lay9RMS:lay10MeanCell:lay10RMS:lay11MeanCell:lay11RMS:lay12MeanCell:lay12RMS");
41  }
42 
43  // switch on the mode for running on test pulses (different top folder)
44  tpMode = ps.getUntrackedParameter<bool>("testPulseMode", false);
45 
46  runOnAllHitsOccupancies = ps.getUntrackedParameter<bool>("runOnAllHitsOccupancies", true);
47  runOnNoiseOccupancies = ps.getUntrackedParameter<bool>("runOnNoiseOccupancies", false);
48  runOnInTimeOccupancies = ps.getUntrackedParameter<bool>("runOnInTimeOccupancies", false);
49  nMinEvts = ps.getUntrackedParameter<int>("nEventsCert", 5000);
50  nMinEvtsPC = ps.getUntrackedParameter<int>("nEventsMinPC", 2200);
51  nZeroEvtsPC = ps.getUntrackedParameter<int>("nEventsZeroPC", 30);
52 
53  bookingdone = false;
54 
55  // Event counter
56  nevents = 0;
57 }
Log< level::Info, true > LogVerbatim
Definition: ntuple.py:1
T getUntrackedParameter(std::string const &, T const &) const
bool runOnAllHitsOccupancies
edm::ESGetToken< DTGeometry, MuonGeometryRecord > muonGeomToken_

◆ ~DTOccupancyTest()

DTOccupancyTest::~DTOccupancyTest ( )
override

Destructor.

Definition at line 59 of file DTOccupancyTest.cc.

59  {
60  LogVerbatim("DTDQM|DTMonitorClient|DTOccupancyTest") << " destructor called" << endl;
61 }
Log< level::Info, true > LogVerbatim

Member Function Documentation

◆ beginRun()

void DTOccupancyTest::beginRun ( edm::Run const &  run,
edm::EventSetup const &  context 
)
overrideprotected

BeginRun.

Definition at line 63 of file DTOccupancyTest.cc.

References visDQMUpload::context, muonGeom, and muonGeomToken_.

63  {
64  LogVerbatim("DTDQM|DTMonitorClient|DTOccupancyTest") << "[DTOccupancyTest]: BeginRun";
65 
66  // Get the geometry
67  muonGeom = &context.getData(muonGeomToken_);
68 }
Log< level::Info, true > LogVerbatim
const DTGeometry * muonGeom
edm::ESGetToken< DTGeometry, MuonGeometryRecord > muonGeomToken_

◆ bookHistos()

void DTOccupancyTest::bookHistos ( DQMStore::IBooker ,
const int  wheelId,
std::string  folder,
std::string  histoTag 
)
private

book the summary histograms

Definition at line 200 of file DTOccupancyTest.cc.

References dqm::implementation::IBooker::book2D(), printsummarytable::folder, HltBtagPostValidation_cff::histoName, dtResolutionTest_cfi::histoTag, dqm::implementation::NavigatorBase::setCurrentFolder(), topFolder(), tpMode, makeMuonMisalignmentScenario::wheel, and wheelHistos.

Referenced by dqmEndLuminosityBlock().

200  {
201  // Set the current folder
202  stringstream wheel;
203  wheel << wheelId;
204 
205  ibooker.setCurrentFolder(topFolder());
206 
207  // build the histo name
208  string histoName = histoTag + "_W" + wheel.str();
209 
210  LogVerbatim("DTDQM|DTMonitorClient|DTOccupancyTest")
211  << "[DTOccupancyTest]: booking wheel histo:" << histoName << " (tag " << histoTag
212  << ") in: " << topFolder() + "Wheel" + wheel.str() + "/" + folder << endl;
213 
214  string histoTitle = "Occupancy summary WHEEL: " + wheel.str();
215  if (tpMode) {
216  histoTitle = "TP Occupancy summary WHEEL: " + wheel.str();
217  }
218 
219  wheelHistos[wheelId] = ibooker.book2D(histoName, histoTitle, 12, 1, 13, 4, 1, 5);
220  wheelHistos[wheelId]->setBinLabel(1, "MB1", 2);
221  wheelHistos[wheelId]->setBinLabel(2, "MB2", 2);
222  wheelHistos[wheelId]->setBinLabel(3, "MB3", 2);
223  wheelHistos[wheelId]->setBinLabel(4, "MB4", 2);
224  wheelHistos[wheelId]->setAxisTitle("sector", 1);
225 }
Log< level::Info, true > LogVerbatim
std::string topFolder() const
std::map< int, MonitorElement * > wheelHistos

◆ dqmEndJob()

void DTOccupancyTest::dqmEndJob ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter 
)
overrideprotectedvirtual

Endjob.

Implements DQMEDHarvester.

Definition at line 189 of file DTOccupancyTest.cc.

References rootFile, and writeRootFile.

189  {
190  LogVerbatim("DTDQM|DTMonitorClient|DTOccupancyTest") << "[DTOccupancyTest] endjob called!";
191  if (writeRootFile) {
192  rootFile->cd();
193  ntuple->Write();
194  rootFile->Close();
195  }
196 }
Log< level::Info, true > LogVerbatim
Definition: ntuple.py:1

◆ dqmEndLuminosityBlock()

void DTOccupancyTest::dqmEndLuminosityBlock ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter,
edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  context 
)
overrideprotectedvirtual

DQM Client Diagnostic.

Reimplemented from DQMEDHarvester.

Definition at line 70 of file DTOccupancyTest.cc.

References dqm::implementation::IBooker::book2D(), bookHistos(), bookingdone, relativeConstraints::chamber, DTGeometry::chambers(), chambers, dqm::impl::MonitorElement::Fill(), dqm::implementation::IGetter::get(), dqm::impl::MonitorElement::getBinContent(), dqm::impl::MonitorElement::getFloatValue(), getMEName(), dqm::legacy::MonitorElement::getTH2F(), glbSummaryHisto, timingPdfMaker::histo, createfilelist::int, lsCounter, muonGeom, nameMonitoredHisto, nChannelDead, nChannelTotal, nMinEvts, dqm::impl::MonitorElement::Reset(), mps_fire::result, runOccupancyTest(), runOnAllHitsOccupancies, runOnInTimeOccupancies, runOnNoiseOccupancies, nano_mu_digi_cff::sector, DTChamberId::sector(), dqm::impl::MonitorElement::setAxisTitle(), dqm::impl::MonitorElement::setBinContent(), dqm::implementation::NavigatorBase::setCurrentFolder(), dqm::impl::MonitorElement::setEntries(), DTChamberId::station(), summaryHisto, runGCPTkAlMap::title, topFolder(), tpMode, DTChamberId::wheel(), wheelHistos, and writeRootFile.

73  {
74  if (!bookingdone) {
75  // Book the summary histos
76  // - one summary per wheel
77  for (int wh = -2; wh <= 2; ++wh) { // loop over wheels
78  bookHistos(ibooker, wh, string("Occupancies"), "OccupancySummary");
79  }
80 
81  ibooker.setCurrentFolder(topFolder());
82  string title = "Occupancy Summary";
83  if (tpMode) {
84  title = "Test Pulse Occupancy Summary";
85  }
86  // - global summary with alarms
87  summaryHisto = ibooker.book2D("OccupancySummary", title.c_str(), 12, 1, 13, 5, -2, 3);
88  summaryHisto->setAxisTitle("sector", 1);
89  summaryHisto->setAxisTitle("wheel", 2);
90 
91  // - global summary with percentages
92  glbSummaryHisto = ibooker.book2D("OccupancyGlbSummary", title.c_str(), 12, 1, 13, 5, -2, 3);
93  glbSummaryHisto->setAxisTitle("sector", 1);
94  glbSummaryHisto->setAxisTitle("wheel", 2);
95 
96  // assign the name of the input histogram
98  nameMonitoredHisto = "OccupancyAllHits_perCh";
99  } else if (runOnNoiseOccupancies) {
100  nameMonitoredHisto = "OccupancyNoise_perCh";
101  } else if (runOnInTimeOccupancies) {
102  nameMonitoredHisto = "OccupancyInTimeHits_perCh";
103  } else { // default is AllHits histo
104  nameMonitoredHisto = "OccupancyAllHits_perCh";
105  }
106  }
107  bookingdone = true;
108 
109  LogVerbatim("DTDQM|DTMonitorClient|DTOccupancyTest")
110  << "[DTOccupancyTest]: End of LS transition, performing the DQM client operation";
111  lsCounter++;
112 
113  // Reset the global summary
114  summaryHisto->Reset();
116 
117  nChannelTotal = 0;
118  nChannelDead = 0;
119 
120  // Get all the DT chambers
121  vector<const DTChamber*> chambers = muonGeom->chambers();
122 
123  for (vector<const DTChamber*>::const_iterator chamber = chambers.begin(); chamber != chambers.end();
124  ++chamber) { // Loop over all chambers
125  DTChamberId chId = (*chamber)->id();
126 
127  MonitorElement* chamberOccupancyHisto = igetter.get(getMEName(nameMonitoredHisto, chId));
128 
129  // Run the tests on the plot for the various granularities
130  if (chamberOccupancyHisto != nullptr) {
131  // Get the 2D histo
132  TH2F* histo = chamberOccupancyHisto->getTH2F();
133  float chamberPercentage = 1.;
134  int result = runOccupancyTest(histo, chId, chamberPercentage);
135  int sector = chId.sector();
136 
137  if (sector == 13) {
138  sector = 4;
139  float resultSect4 = wheelHistos[chId.wheel()]->getBinContent(sector, chId.station());
140  if (resultSect4 > result) {
141  result = (int)resultSect4;
142  }
143  } else if (sector == 14) {
144  sector = 10;
145  float resultSect10 = wheelHistos[chId.wheel()]->getBinContent(sector, chId.station());
146  if (resultSect10 > result) {
147  result = (int)resultSect10;
148  }
149  }
150 
151  // the 2 MB4 of Sect 4 and 10 count as half a chamber
152  if ((sector == 4 || sector == 10) && chId.station() == 4)
153  chamberPercentage = chamberPercentage / 2.;
154 
155  wheelHistos[chId.wheel()]->setBinContent(sector, chId.station(), result);
156  if (result > summaryHisto->getBinContent(sector, chId.wheel() + 3)) {
158  }
159  glbSummaryHisto->Fill(sector, chId.wheel(), chamberPercentage * 1. / 4.);
160  } else {
161  LogVerbatim("DTDQM|DTMonitorClient|DTOccupancyTest")
162  << "[DTOccupancyTest] ME: " << getMEName(nameMonitoredHisto, chId) << " not found!" << endl;
163  }
164  }
165 
166  string nEvtsName = "DT/EventInfo/Counters/nProcessedEventsDigi";
167 
168  MonitorElement* meProcEvts = igetter.get(nEvtsName);
169 
170  if (meProcEvts) {
171  int nProcEvts = meProcEvts->getFloatValue();
172  glbSummaryHisto->setEntries(nProcEvts < nMinEvts ? 10. : nProcEvts);
173  summaryHisto->setEntries(nProcEvts < nMinEvts ? 10. : nProcEvts);
174  } else {
177  LogVerbatim("DTDQM|DTMonitorClient|DTOccupancyTest")
178  << "[DTOccupancyTest] ME: " << nEvtsName << " not found!" << endl;
179  }
180 
181  // Fill the global summary
182  // Check for entire sectors off and report them on the global summary
183  //FIXME: TODO
184 
185  if (writeRootFile)
186  ntuple->AutoSave("SaveSelf");
187 }
Log< level::Info, true > LogVerbatim
int station() const
Return the station number.
Definition: DTChamberId.h:45
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
virtual void setEntries(double nentries)
set # of entries
int runOccupancyTest(TH2F *histo, const DTChamberId &chId, float &chamberPercentage)
MonitorElement * summaryHisto
std::string nameMonitoredHisto
std::string topFolder() const
Definition: ntuple.py:1
void Fill(long long x)
virtual TH2F * getTH2F() const
virtual void Reset()
Remove all data from the ME, keept the empty histogram with all its settings.
virtual double getFloatValue() const
void bookHistos(DQMStore::IBooker &, const int wheelId, std::string folder, std::string histoTag)
book the summary histograms
std::string getMEName(std::string histoTag, const DTChamberId &chId)
Get the ME name.
bool runOnAllHitsOccupancies
const DTGeometry * muonGeom
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:221
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:712
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:42
int sector() const
Definition: DTChamberId.h:52
const std::vector< const DTChamber * > & chambers() const
Return a vector of all Chamber.
Definition: DTGeometry.cc:84
std::map< int, MonitorElement * > wheelHistos
static char chambers[264][20]
Definition: ReadPGInfo.cc:243
MonitorElement * glbSummaryHisto
virtual double getBinContent(int binx) const
get content of bin (1-D)
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)

◆ getIntegral()

int DTOccupancyTest::getIntegral ( TH2F *  histo,
int  firstBinX,
int  lastBinX,
int  firstBinY,
int  lastBinY,
bool  doall 
)
private

Definition at line 247 of file DTOccupancyTest.cc.

References DTRecHitClients_cfi::doall, timingPdfMaker::histo, mps_fire::i, and dqmiolumiharvest::j.

247  {
248  int sum = 0;
249  for (Int_t i = firstBinX; i < lastBinX + 1; i++) {
250  for (Int_t j = firstBinY; j < lastBinY + 1; j++) {
251  if (histo->GetBinContent(i, j) > 0) {
252  if (!doall)
253  return 1;
254  sum += histo->GetBinContent(i, j);
255  }
256  }
257  }
258 
259  return sum;
260 }

◆ getMEName()

string DTOccupancyTest::getMEName ( std::string  histoTag,
const DTChamberId chId 
)
private

Get the ME name.

Definition at line 227 of file DTOccupancyTest.cc.

References printsummarytable::folder, dtChamberEfficiencyTest_cfi::folderRoot, HltBtagPostValidation_cff::histoName, dtResolutionTest_cfi::histoTag, nano_mu_digi_cff::sector, DTChamberId::sector(), DTChamberId::station(), relativeConstraints::station, topFolder(), DTChamberId::wheel(), and makeMuonMisalignmentScenario::wheel.

Referenced by dqmEndLuminosityBlock().

227  {
228  stringstream wheel;
229  wheel << chId.wheel();
230  stringstream station;
231  station << chId.station();
232  stringstream sector;
233  sector << chId.sector();
234 
235  string folderRoot = topFolder() + "Wheel" + wheel.str() + "/Sector" + sector.str() + "/Station" + station.str() + "/";
236 
237  string folder = "Occupancies/";
238 
239  // build the histo name
240  string histoName = histoTag + "_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str();
241 
242  string histoname = folderRoot + histoName;
243 
244  return histoname;
245 }
int station() const
Return the station number.
Definition: DTChamberId.h:45
std::string topFolder() const
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:42
int sector() const
Definition: DTChamberId.h:52

◆ runOccupancyTest()

int DTOccupancyTest::runOccupancyTest ( TH2F *  histo,
const DTChamberId chId,
float &  chamberPercentage 
)
private

Definition at line 270 of file DTOccupancyTest.cc.

References DTTopology::channels(), DTTopology::firstChannel(), nano_mu_digi_cff::float, timingPdfMaker::histo, DTGeometry::layer(), LogTrace, muonGeom, nChannelDead, nChannelTotal, nMinEvtsPC, nZeroEvtsPC, DTChamberId::sector(), DTLayer::specificTopology(), and DTChamberId::station().

Referenced by dqmEndLuminosityBlock().

270  {
271  int nBinsX = histo->GetNbinsX();
272 
273  LogTrace("DTDQM|DTMonitorClient|DTOccupancyTest") << "--- Occupancy test for chamber: " << chId << endl;
274 
275  int compDeadCell = 0;
276  int totCell = 0;
277  int totOccup = 0;
278 
279  for (int slay = 1; slay <= 3; ++slay) { // loop over SLs
280  int binYlow = ((slay - 1) * 4) + 1;
281 
282  if (chId.station() == 4 && slay == 2)
283  continue;
284  for (int lay = 1; lay <= 4; ++lay) { // loop over layers
285  DTLayerId layID(chId, slay, lay);
286  int firstWire = muonGeom->layer(layID)->specificTopology().firstChannel();
287  int nWires = muonGeom->layer(layID)->specificTopology().channels();
288  int binY = binYlow + (lay - 1);
289  int totalDeadCells = 0;
290  int nDeadCellsInARow = 1;
291  int nDeadCellsInARowMax = 0;
292  bool previousIsDead = false;
293 
294  totCell += nWires;
295 
296  for (int cell = firstWire; cell != (nWires + firstWire); ++cell) { // loop over cells
297  double cellOccup = histo->GetBinContent(cell, binY);
298  LogTrace("DTDQM|DTMonitorClient|DTOccupancyTest") << " cell occup: " << cellOccup;
299  totOccup += cellOccup;
300 
301  if (cellOccup == 0) {
302  totalDeadCells++;
303  if (previousIsDead) {
304  nDeadCellsInARow++;
305  } else {
306  if (nDeadCellsInARow > nDeadCellsInARowMax)
307  nDeadCellsInARowMax = nDeadCellsInARow;
308  nDeadCellsInARow = 1;
309  }
310  previousIsDead = true;
311  LogTrace("DTDQM|DTMonitorClient|DTOccupancyTest") << " below reference" << endl;
312  } else {
313  previousIsDead = false;
314  }
315  // // 3 cells not dead between a group of dead cells don't break the count
316  if (nDeadCellsInARow > nDeadCellsInARowMax)
317  nDeadCellsInARowMax = nDeadCellsInARow;
318  }
319  compDeadCell += totalDeadCells;
320  if (nDeadCellsInARowMax >= 7.) {
321  histo->SetBinContent(nBinsX + 1, binY, -1.);
322  }
323  }
324  }
325 
326  nChannelTotal += totCell;
327  nChannelDead += compDeadCell;
328  chamberPercentage = 1. - (float(compDeadCell) / totCell);
329 
330  int min_occup = nZeroEvtsPC * 20;
331  if (chId.station() == 3)
332  min_occup = nZeroEvtsPC * 3;
333  if (chId.station() == 2)
334  min_occup = nZeroEvtsPC * 8;
335  if ((chId.station() == 4) && (chId.sector() == 9))
336  min_occup = nZeroEvtsPC * 3;
337  if ((chId.station() == 4) && (chId.sector() == 10))
338  min_occup = nZeroEvtsPC * 3;
339  if ((chId.station() == 4) && (chId.sector() == 11))
340  min_occup = nZeroEvtsPC * 3;
341  if ((chId.station() == 4) && (chId.sector() == 14))
342  min_occup = nZeroEvtsPC * 3;
343 
344  if (totOccup < min_occup)
345  return 4;
346  if (totOccup < nMinEvtsPC)
347  chamberPercentage = 1.;
348 
349  if (chamberPercentage < 0.2)
350  return 4;
351  if (chamberPercentage < 0.5)
352  return 3;
353  if (chamberPercentage < 0.75)
354  return 2;
355  if (chamberPercentage < 0.9)
356  return 1;
357 
358  return 0;
359 }
int station() const
Return the station number.
Definition: DTChamberId.h:45
#define LogTrace(id)
int firstChannel() const
Returns the wire number of the first wire.
Definition: DTTopology.h:79
const DTTopology & specificTopology() const
Definition: DTLayer.cc:37
const DTGeometry * muonGeom
int sector() const
Definition: DTChamberId.h:52
int channels() const
Returns the number of wires in the layer.
Definition: DTTopology.h:76
const DTLayer * layer(const DTLayerId &id) const
Return a layer given its id.
Definition: DTGeometry.cc:96

◆ topFolder()

string DTOccupancyTest::topFolder ( ) const
private

Definition at line 361 of file DTOccupancyTest.cc.

References AlCaHLTBitMon_QueryRunRegistry::string, and tpMode.

Referenced by bookHistos(), dqmEndLuminosityBlock(), and getMEName().

361  {
362  if (tpMode)
363  return string("DT/10-TestPulses/");
364  return string("DT/01-Digi/");
365 }

Member Data Documentation

◆ bookingdone

bool DTOccupancyTest::bookingdone
private

Definition at line 97 of file DTOccupancyTest.h.

Referenced by dqmEndLuminosityBlock(), and DTOccupancyTest().

◆ glbSummaryHisto

MonitorElement* DTOccupancyTest::glbSummaryHisto
private

Definition at line 78 of file DTOccupancyTest.h.

Referenced by dqmEndLuminosityBlock().

◆ lsCounter

int DTOccupancyTest::lsCounter
private

Definition at line 82 of file DTOccupancyTest.h.

Referenced by dqmEndLuminosityBlock(), and DTOccupancyTest().

◆ monitoredLayers

std::set<DTLayerId> DTOccupancyTest::monitoredLayers
private

Definition at line 80 of file DTOccupancyTest.h.

◆ muonGeom

const DTGeometry* DTOccupancyTest::muonGeom
private

Definition at line 73 of file DTOccupancyTest.h.

Referenced by beginRun(), dqmEndLuminosityBlock(), and runOccupancyTest().

◆ muonGeomToken_

edm::ESGetToken<DTGeometry, MuonGeometryRecord> DTOccupancyTest::muonGeomToken_
private

Definition at line 72 of file DTOccupancyTest.h.

Referenced by beginRun().

◆ nameMonitoredHisto

std::string DTOccupancyTest::nameMonitoredHisto
private

Definition at line 95 of file DTOccupancyTest.h.

Referenced by dqmEndLuminosityBlock().

◆ nChannelDead

int DTOccupancyTest::nChannelDead
private

Definition at line 100 of file DTOccupancyTest.h.

Referenced by dqmEndLuminosityBlock(), and runOccupancyTest().

◆ nChannelTotal

int DTOccupancyTest::nChannelTotal
private

Definition at line 99 of file DTOccupancyTest.h.

Referenced by dqmEndLuminosityBlock(), and runOccupancyTest().

◆ nevents

int DTOccupancyTest::nevents
private

Definition at line 70 of file DTOccupancyTest.h.

Referenced by DTOccupancyTest().

◆ nMinEvts

int DTOccupancyTest::nMinEvts
private

Definition at line 83 of file DTOccupancyTest.h.

Referenced by dqmEndLuminosityBlock(), and DTOccupancyTest().

◆ nMinEvtsPC

int DTOccupancyTest::nMinEvtsPC
private

Definition at line 84 of file DTOccupancyTest.h.

Referenced by DTOccupancyTest(), and runOccupancyTest().

◆ ntuple

TNtuple* DTOccupancyTest::ntuple
private

◆ nZeroEvtsPC

int DTOccupancyTest::nZeroEvtsPC
private

Definition at line 85 of file DTOccupancyTest.h.

Referenced by DTOccupancyTest(), and runOccupancyTest().

◆ rootFile

TFile* DTOccupancyTest::rootFile
private

Definition at line 88 of file DTOccupancyTest.h.

Referenced by dqmEndJob(), and DTOccupancyTest().

◆ runOnAllHitsOccupancies

bool DTOccupancyTest::runOnAllHitsOccupancies
private

Definition at line 92 of file DTOccupancyTest.h.

Referenced by dqmEndLuminosityBlock(), and DTOccupancyTest().

◆ runOnInTimeOccupancies

bool DTOccupancyTest::runOnInTimeOccupancies
private

Definition at line 94 of file DTOccupancyTest.h.

Referenced by dqmEndLuminosityBlock(), and DTOccupancyTest().

◆ runOnNoiseOccupancies

bool DTOccupancyTest::runOnNoiseOccupancies
private

Definition at line 93 of file DTOccupancyTest.h.

Referenced by dqmEndLuminosityBlock(), and DTOccupancyTest().

◆ summaryHisto

MonitorElement* DTOccupancyTest::summaryHisto
private

Definition at line 77 of file DTOccupancyTest.h.

Referenced by dqmEndLuminosityBlock().

◆ tpMode

bool DTOccupancyTest::tpMode
private

Definition at line 90 of file DTOccupancyTest.h.

Referenced by bookHistos(), dqmEndLuminosityBlock(), DTOccupancyTest(), and topFolder().

◆ wheelHistos

std::map<int, MonitorElement *> DTOccupancyTest::wheelHistos
private

Definition at line 76 of file DTOccupancyTest.h.

Referenced by bookHistos(), and dqmEndLuminosityBlock().

◆ writeRootFile

bool DTOccupancyTest::writeRootFile
private

Definition at line 87 of file DTOccupancyTest.h.

Referenced by dqmEndJob(), dqmEndLuminosityBlock(), and DTOccupancyTest().