CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
OffsetDQMPostProcessor Class Reference
Inheritance diagram for OffsetDQMPostProcessor:
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

 OffsetDQMPostProcessor (const edm::ParameterSet &)
 
 ~OffsetDQMPostProcessor () override
 
- 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 dqmEndLuminosityBlock (DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
 
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
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > 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
 
bool registeredToConsumeMany (TypeID const &, 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::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void dqmEndJob (DQMStore::IBooker &, DQMStore::IGetter &) override
 

Private Attributes

bool debug = false
 
int muHigh
 
int npvHigh
 
std::string offsetDir
 
std::string offsetPlotBaseName
 
float offsetR
 
std::vector< std::string > offsetVariableTypes
 
std::vector< std::string > pftypes
 

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 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 ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
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)
 
- 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 23 of file OffsetDQMPostProcessor.cc.

Constructor & Destructor Documentation

◆ OffsetDQMPostProcessor()

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

Definition at line 45 of file OffsetDQMPostProcessor.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), muHigh, npvHigh, offsetDir, offsetPlotBaseName, offsetR, offsetVariableTypes, pftypes, and AlCaHLTBitMon_QueryRunRegistry::string.

45  {
46  offsetPlotBaseName = iConfig.getParameter<std::string>("offsetPlotBaseName");
47  offsetDir = iConfig.getParameter<std::string>("offsetDir");
48  offsetVariableTypes = iConfig.getParameter<std::vector<std::string> >("offsetVariableTypes");
49  offsetR = iConfig.getUntrackedParameter<double>("offsetR");
50  pftypes = iConfig.getParameter<std::vector<std::string> >("pftypes");
51  muHigh = iConfig.getUntrackedParameter<int>("muHigh");
52  npvHigh = iConfig.getUntrackedParameter<int>("npvHigh");
53 };
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
T getUntrackedParameter(std::string const &, T const &) const
std::vector< std::string > offsetVariableTypes
std::vector< std::string > pftypes

◆ ~OffsetDQMPostProcessor()

OffsetDQMPostProcessor::~OffsetDQMPostProcessor ( )
override

Definition at line 55 of file OffsetDQMPostProcessor.cc.

55 {}

Member Function Documentation

◆ dqmEndJob()

void OffsetDQMPostProcessor::dqmEndJob ( DQMStore::IBooker ibook_,
DQMStore::IGetter iget_ 
)
overrideprivatevirtual

Implements DQMEDHarvester.

Definition at line 58 of file OffsetDQMPostProcessor.cc.

References dqm::implementation::IBooker::book1D(), dqm::implementation::IBooker::bookFloat(), debug, dqm::impl::MonitorElement::Fill(), spr::find(), dqm::implementation::IGetter::get(), dqm::impl::MonitorElement::getMean(), dqm::implementation::IGetter::getMEs(), dqm::legacy::MonitorElement::getTH1F(), dqm::legacy::MonitorElement::getTProfile(), mps_fire::i, createfilelist::int, dqmiolumiharvest::j, muHigh, npvHigh, offsetDir, offsetPlotBaseName, offsetR, offsetVariableTypes, pftypes, funct::pow(), alignCSCRings::s, dqm::implementation::NavigatorBase::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, cond::impl::to_string(), and LaserClient_cfi::xaxis.

58  {
60 
61  std::string stitle;
62  std::vector<MonitorElement*> vME;
63  std::vector<std::string> MEStrings = iget_.getMEs();
64  std::for_each(MEStrings.begin(), MEStrings.end(), [&](auto& s) { s.insert(0, offsetDir); });
65 
66  // temporary ME and root objects
67  MonitorElement* mtmp;
68  TProfile* hproftmp;
69  TH1F* htmp;
70  TH1F* hscaled;
71 
72  //
73  // Offset plots vs eta
74  //
75  for (std::vector<std::string>::const_iterator i = offsetVariableTypes.begin(); i != offsetVariableTypes.end(); ++i) {
76  //
77  // getting the average value for Npv and mu
78  //
79  stitle = offsetDir + (*i);
80  std::vector<std::string>::const_iterator it = std::find(MEStrings.begin(), MEStrings.end(), stitle);
81  if (it == MEStrings.end())
82  continue;
83  mtmp = iget_.get(stitle);
84  float avg = mtmp->getMean();
85  int iavg = int(avg + 0.5); // integer version for identifying correcping ME, in order to get the rounding correctly
86 
87  if (avg < 1.)
88  avg = 1.; // protection against this value going too low
89 
90  if (iavg < 0)
91  iavg = 0; // checking lower bound (avoid division by zero)
92  if (*i == "npv" && iavg >= npvHigh)
93  iavg = npvHigh - 1; // checking upper bound
94  else if (*i == "mu" && iavg >= muHigh)
95  iavg = muHigh - 1; //
96 
97  //
98  // storing the value
99  //
100  stitle = (*i) + "_mean";
101  MonitorElement* MEmean = ibook_.bookFloat(stitle);
102  MEmean->Fill(avg);
103  vME.push_back(MEmean);
104 
105  //
106  // for each pf types
107  //
108  for (std::vector<std::string>::const_iterator j = pftypes.begin(); j != pftypes.end(); ++j) {
109  // accessing profiles
110  std::string str_base = *i + std::to_string(iavg);
111  if ((*i) == "npv")
112  stitle = offsetDir + "npvPlots/" + str_base + "/" + offsetPlotBaseName + "_" + str_base + "_" + (*j);
113  else if ((*i) == "mu")
114  stitle = offsetDir + "muPlots/" + str_base + "/" + offsetPlotBaseName + "_" + str_base + "_" + (*j);
115  else
116  return;
117 
118  // making scaled plot and ME
119  mtmp = iget_.get(stitle);
120  hproftmp = (TProfile*)mtmp->getTProfile();
121  htmp = (TH1F*)hproftmp->ProjectionX();
122  TAxis* xaxis = (TAxis*)htmp->GetXaxis();
123  stitle = offsetPlotBaseName + "_" + str_base + "_" + *j;
124  hscaled = new TH1F(stitle.c_str(), stitle.c_str(), xaxis->GetNbins(), xaxis->GetXbins()->GetArray());
125 
126  htmp->Scale(pow(offsetR, 2) / 2. / float(avg)); // pi*R^2 / (deltaEta*2pi) / <mu or NPV>
127  for (int ibin = 1; ibin <= hscaled->GetNbinsX(); ibin++) { // 1/deltaEta part
128  hscaled->SetBinContent(ibin, htmp->GetBinContent(ibin) / htmp->GetBinWidth(ibin));
129  hscaled->SetBinError(ibin, htmp->GetBinError(ibin) / htmp->GetBinWidth(ibin));
130  }
131 
132  // storing new ME
133  stitle = offsetPlotBaseName + "_" + *i + "_" + *j;
134  mtmp = ibook_.book1D(stitle.c_str(), hscaled);
135  vME.push_back(mtmp);
136  }
137  }
138 
139  //
140  // Checks
141  //
142  if (debug) {
143  for (std::vector<MonitorElement*>::const_iterator i = vME.begin(); i != vME.end(); ++i)
144  (*i)->getTH1F()->Print();
145  }
146 }
MonitorElement * bookFloat(TString const &name, FUNC onbooking=NOOP())
Definition: DQMStore.h:80
virtual TProfile * getTProfile() const
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
virtual std::vector< std::string > getMEs() const
Definition: DQMStore.cc:759
std::string to_string(const V &value)
Definition: OMSAccess.h:71
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
void Fill(long long x)
std::vector< std::string > offsetVariableTypes
std::vector< std::string > pftypes
virtual TH1F * getTH1F() const
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:712
virtual double getMean(int axis=1) const
get mean value of histogram along x, y or z axis (axis=1, 2, 3 respectively)
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

Member Data Documentation

◆ debug

bool OffsetDQMPostProcessor::debug = false
private

Definition at line 39 of file OffsetDQMPostProcessor.cc.

Referenced by dqmEndJob().

◆ muHigh

int OffsetDQMPostProcessor::muHigh
private

Definition at line 36 of file OffsetDQMPostProcessor.cc.

Referenced by dqmEndJob(), and OffsetDQMPostProcessor().

◆ npvHigh

int OffsetDQMPostProcessor::npvHigh
private

Definition at line 37 of file OffsetDQMPostProcessor.cc.

Referenced by dqmEndJob(), and OffsetDQMPostProcessor().

◆ offsetDir

std::string OffsetDQMPostProcessor::offsetDir
private

Definition at line 32 of file OffsetDQMPostProcessor.cc.

Referenced by dqmEndJob(), and OffsetDQMPostProcessor().

◆ offsetPlotBaseName

std::string OffsetDQMPostProcessor::offsetPlotBaseName
private

Definition at line 31 of file OffsetDQMPostProcessor.cc.

Referenced by dqmEndJob(), and OffsetDQMPostProcessor().

◆ offsetR

float OffsetDQMPostProcessor::offsetR
private

Definition at line 33 of file OffsetDQMPostProcessor.cc.

Referenced by dqmEndJob(), and OffsetDQMPostProcessor().

◆ offsetVariableTypes

std::vector<std::string> OffsetDQMPostProcessor::offsetVariableTypes
private

Definition at line 35 of file OffsetDQMPostProcessor.cc.

Referenced by dqmEndJob(), and OffsetDQMPostProcessor().

◆ pftypes

std::vector<std::string> OffsetDQMPostProcessor::pftypes
private

Definition at line 34 of file OffsetDQMPostProcessor.cc.

Referenced by dqmEndJob(), and OffsetDQMPostProcessor().