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::Accumulator, edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns, edm::one::SharedResources > 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 beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void beginRun (edm::Run const &, edm::EventSetup const &) override
 
 DQMEDHarvester ()
 
virtual void dqmEndLuminosityBlock (DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
 
void endJob () final
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void endLuminosityBlockProduce (edm::LuminosityBlock &, edm::EventSetup const &) final
 
void endRun (edm::Run const &, edm::EventSetup const &) override
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) override
 
 ~DQMEDHarvester () override=default
 
- Public Member Functions inherited from edm::one::EDProducer< edm::Accumulator, edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns, edm::one::SharedResources >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () 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
 
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)
 
 ~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
 
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::vector< ModuleDescription const * > &modules, 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
 
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
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
ProducesCollector producesCollector ()
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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)
 
- Protected Attributes inherited from DQMEDHarvester
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Definition at line 23 of file OffsetDQMPostProcessor.cc.

Constructor & Destructor Documentation

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
T getUntrackedParameter(std::string const &, T const &) const
std::vector< std::string > offsetVariableTypes
std::vector< std::string > pftypes
OffsetDQMPostProcessor::~OffsetDQMPostProcessor ( )
override

Definition at line 55 of file OffsetDQMPostProcessor.cc.

55 {}

Member Function Documentation

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

Implements DQMEDHarvester.

Definition at line 58 of file OffsetDQMPostProcessor.cc.

References dqm::dqmstoreimpl::DQMStore::IBooker::book1D(), dqm::dqmstoreimpl::DQMStore::IBooker::bookFloat(), debug, DEFINE_FWK_MODULE, dqm::impl::MonitorElement::Fill(), spr::find(), dqm::dqmstoreimpl::DQMStore::IGetter::get(), dqm::impl::MonitorElement::getMean(), dqm::dqmstoreimpl::DQMStore::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::dqmstoreimpl::DQMStore::IGetter::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, and LaserClient_cfi::xaxis.

58  {
59  iget_.setCurrentFolder(offsetDir);
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.c_str()); });
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 }
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
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30

Member Data Documentation

bool OffsetDQMPostProcessor::debug = false
private

Definition at line 39 of file OffsetDQMPostProcessor.cc.

Referenced by dqmEndJob().

int OffsetDQMPostProcessor::muHigh
private

Definition at line 36 of file OffsetDQMPostProcessor.cc.

Referenced by dqmEndJob(), and OffsetDQMPostProcessor().

int OffsetDQMPostProcessor::npvHigh
private

Definition at line 37 of file OffsetDQMPostProcessor.cc.

Referenced by dqmEndJob(), and OffsetDQMPostProcessor().

std::string OffsetDQMPostProcessor::offsetDir
private

Definition at line 32 of file OffsetDQMPostProcessor.cc.

Referenced by dqmEndJob(), and OffsetDQMPostProcessor().

std::string OffsetDQMPostProcessor::offsetPlotBaseName
private

Definition at line 31 of file OffsetDQMPostProcessor.cc.

Referenced by dqmEndJob(), and OffsetDQMPostProcessor().

float OffsetDQMPostProcessor::offsetR
private

Definition at line 33 of file OffsetDQMPostProcessor.cc.

Referenced by dqmEndJob(), and OffsetDQMPostProcessor().

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

Definition at line 35 of file OffsetDQMPostProcessor.cc.

Referenced by dqmEndJob(), and OffsetDQMPostProcessor().

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

Definition at line 34 of file OffsetDQMPostProcessor.cc.

Referenced by dqmEndJob(), and OffsetDQMPostProcessor().