CMS 3D CMS Logo

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

#include <DiMuonMassBiasClient.h>

Inheritance diagram for DiMuonMassBiasClient:
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

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

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- 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

void beginJob (void) override
 BeginJob. More...
 
void beginRun (edm::Run const &run, edm::EventSetup const &eSetup) override
 BeginRun. More...
 
void dqmEndJob (DQMStore::IBooker &ibooker_, DQMStore::IGetter &igetter_) override
 EndJob. 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 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)
 

Private Member Functions

void bookMEs (DQMStore::IBooker &ibooker)
 book MEs More...
 
diMuonMassBias::fitOutputs fitVoigt (TH1 *hist, const bool &fitBackground=false) const
 
void getMEsToHarvest (DQMStore::IGetter &igetter)
 

Private Attributes

const bool debugMode_
 
const bool fitBackground_
 
std::map< std::string, MonitorElement * > harvestTargets_
 
float meanConfig_ [3]
 
std::map< std::string, MonitorElement * > meanProfiles_
 
std::vector< std::string > MEtoHarvest_
 
float sigmaConfig_ [3]
 
const std::string TopFolder_
 
float widthConfig_ [3]
 
std::map< std::string, MonitorElement * > widthProfiles_
 

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
 
- 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 56 of file DiMuonMassBiasClient.h.

Constructor & Destructor Documentation

◆ DiMuonMassBiasClient()

DiMuonMassBiasClient::DiMuonMassBiasClient ( const edm::ParameterSet ps)

Constructor.

Definition at line 18 of file DiMuonMassBiasClient.cc.

References debugMode_, diMuonMassBias::fillArrayF(), DiMuonMassBiasClient_cfi::fit_par, edm::ParameterSet::getParameter(), meanConfig_, sigmaConfig_, and widthConfig_.

19  : TopFolder_(iConfig.getParameter<std::string>("FolderName")),
20  fitBackground_(iConfig.getParameter<bool>("fitBackground")),
21  debugMode_(iConfig.getParameter<bool>("debugMode")),
22  MEtoHarvest_(iConfig.getParameter<std::vector<std::string>>("MEtoHarvest"))
23 //-----------------------------------------------------------------------------------
24 {
25  edm::LogInfo("DiMuonMassBiasClient") << "DiMuonMassBiasClient::Constructing DiMuonMassBiasClient ";
26 
27  // fill the parameters for the fit
28  edm::ParameterSet fit_par = iConfig.getParameter<edm::ParameterSet>("fit_par");
32 
33  if (debugMode_) {
34  edm::LogPrint("DiMuonMassBiasClient")
35  << "mean: " << meanConfig_[0] << " (" << meanConfig_[1] << "," << meanConfig_[2] << ") " << std::endl;
36  edm::LogPrint("DiMuonMassBiasClient")
37  << "width: " << widthConfig_[0] << " (" << widthConfig_[1] << "," << widthConfig_[2] << ")" << std::endl;
38  edm::LogPrint("DiMuonMassBiasClient")
39  << "sigma: " << sigmaConfig_[0] << " (" << sigmaConfig_[1] << "," << sigmaConfig_[2] << ")" << std::endl;
40  }
41 }
const std::string TopFolder_
std::vector< std::string > MEtoHarvest_
Log< level::Warning, true > LogPrint
Log< level::Info, false > LogInfo
void fillArrayF(float *x, const edm::ParameterSet &cfg, const char *name)

◆ ~DiMuonMassBiasClient()

DiMuonMassBiasClient::~DiMuonMassBiasClient ( )
override

Destructor.

Definition at line 44 of file DiMuonMassBiasClient.cc.

46 {
47  edm::LogInfo("DiMuonMassBiasClient") << "DiMuonMassBiasClient::Deleting DiMuonMassBiasClient ";
48 }
Log< level::Info, false > LogInfo

Member Function Documentation

◆ beginJob()

void DiMuonMassBiasClient::beginJob ( void  )
overrideprotectedvirtual

BeginJob.

Reimplemented from edm::one::EDProducerBase.

Definition at line 51 of file DiMuonMassBiasClient.cc.

53 {
54  edm::LogInfo("DiMuonMassBiasClient") << "DiMuonMassBiasClient::beginJob done";
55 }
Log< level::Info, false > LogInfo

◆ beginRun()

void DiMuonMassBiasClient::beginRun ( edm::Run const &  run,
edm::EventSetup const &  eSetup 
)
overrideprotected

BeginRun.

Definition at line 58 of file DiMuonMassBiasClient.cc.

60 {
61  edm::LogInfo("DiMuonMassBiasClient") << "DiMuonMassBiasClient:: Begining of Run";
62 }
Log< level::Info, false > LogInfo

◆ bookMEs()

void DiMuonMassBiasClient::bookMEs ( DQMStore::IBooker ibooker)
private

book MEs

Definition at line 65 of file DiMuonMassBiasClient.cc.

References dqm::implementation::IBooker::book1D(), harvestTargets_, crabWrapper::key, meanProfiles_, LaserClient_cfi::nbins, dqm::implementation::NavigatorBase::setCurrentFolder(), runGCPTkAlMap::title, TopFolder_, widthProfiles_, TrackerOfflineValidation_Dqm_cff::xmax, TrackerOfflineValidation_Dqm_cff::xmin, compareTotals::xtitle, and compareTotals::ytitle.

Referenced by dqmEndJob().

67 {
68  iBooker.setCurrentFolder(TopFolder_ + "/DiMuonMassBiasMonitor/MassBias/Profiles");
69  for (const auto& [key, ME] : harvestTargets_) {
70  if (ME == nullptr) {
71  edm::LogError("DiMuonMassBiasClient") << "could not find MonitorElement for key: " << key << std::endl;
72  continue;
73  }
74 
75  const auto& title = ME->getTitle();
76  const auto& xtitle = ME->getAxisTitle(1);
77  const auto& ytitle = ME->getAxisTitle(2);
78  const auto& nbins = ME->getNbinsX();
79  const auto& xmin = ME->getAxisMin(1);
80  const auto& xmax = ME->getAxisMax(1);
81  MonitorElement* meanToBook =
82  iBooker.book1D(("Mean" + key), (title + ";" + xtitle + ";" + ytitle), nbins, xmin, xmax);
83  meanProfiles_.insert({key, meanToBook});
84 
85  MonitorElement* sigmaToBook =
86  iBooker.book1D(("Sigma" + key), (title + ";" + xtitle + ";" + "#sigma of " + ytitle), nbins, xmin, xmax);
87  widthProfiles_.insert({key, sigmaToBook});
88  }
89 }
const std::string TopFolder_
Log< level::Error, false > LogError
std::map< std::string, MonitorElement * > harvestTargets_
std::map< std::string, MonitorElement * > meanProfiles_
std::map< std::string, MonitorElement * > widthProfiles_
Definition: ME.h:11

◆ dqmEndJob()

void DiMuonMassBiasClient::dqmEndJob ( DQMStore::IBooker ibooker_,
DQMStore::IGetter igetter_ 
)
overrideprotectedvirtual

EndJob.

Implements DQMEDHarvester.

Definition at line 111 of file DiMuonMassBiasClient.cc.

References newFWLiteAna::bin, bookMEs(), debugMode_, Measurement1D::error(), fitVoigt(), getMEsToHarvest(), harvestTargets_, crabWrapper::key, meanProfiles_, bookConverter::results, Measurement1D::value(), ApeEstimator_cff::width, and widthProfiles_.

113 {
114  edm::LogInfo("DiMuonMassBiasClient") << "DiMuonMassBiasClient::endLuminosityBlock";
115 
116  getMEsToHarvest(igetter);
117  bookMEs(ibooker);
118 
119  for (const auto& [key, ME] : harvestTargets_) {
120  if (debugMode_)
121  edm::LogPrint("DiMuonMassBiasClient") << "dealing with key: " << key << std::endl;
122  TH2F* bareHisto = ME->getTH2F();
123  for (int bin = 1; bin <= ME->getNbinsX(); bin++) {
124  if (debugMode_)
125  edm::LogPrint("DiMuonMassBiasClient") << "dealing with bin: " << bin << std::endl;
126  TH1D* Proj = bareHisto->ProjectionY(Form("%s_proj_%i", key.c_str(), bin), bin, bin);
128 
129  // fill the mean profiles
130  const Measurement1D& bias = results.getBias();
131  meanProfiles_[key]->setBinContent(bin, bias.value());
132  meanProfiles_[key]->setBinError(bin, bias.error());
133 
134  // fill the width profiles
135  const Measurement1D& width = results.getWidth();
136  widthProfiles_[key]->setBinContent(bin, width.value());
137  widthProfiles_[key]->setBinError(bin, width.error());
138  }
139  }
140 }
void getMEsToHarvest(DQMStore::IGetter &igetter)
std::map< std::string, MonitorElement * > harvestTargets_
std::map< std::string, MonitorElement * > meanProfiles_
std::map< std::string, MonitorElement * > widthProfiles_
Definition: ME.h:11
Log< level::Warning, true > LogPrint
Log< level::Info, false > LogInfo
double value() const
Definition: Measurement1D.h:25
void bookMEs(DQMStore::IBooker &ibooker)
book MEs
double error() const
Definition: Measurement1D.h:27
diMuonMassBias::fitOutputs fitVoigt(TH1 *hist, const bool &fitBackground=false) const

◆ fillDescriptions()

void DiMuonMassBiasClient::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 225 of file DiMuonMassBiasClient.cc.

References edm::ConfigurationDescriptions::addWithDefaultLabel(), submitPVResolutionJobs::desc, DiMuonMassBiasClient_cfi::fit_par, SiStripPI::max, and AlCaHLTBitMon_QueryRunRegistry::string.

227 {
229  desc.add<std::string>("FolderName", "DiMuonMassBiasMonitor");
230  desc.add<bool>("fitBackground", false);
231  desc.add<bool>("debugMode", false);
232 
234  fit_par.add<std::vector<double>>("mean_par",
237  std::numeric_limits<float>::max()}); // par = mean
238 
239  fit_par.add<std::vector<double>>("width_par",
242  std::numeric_limits<float>::max()}); // par = width
243 
244  fit_par.add<std::vector<double>>("sigma_par",
247  std::numeric_limits<float>::max()}); // par = sigma
248 
249  desc.add<edm::ParameterSetDescription>("fit_par", fit_par);
250 
251  desc.add<std::vector<std::string>>("MEtoHarvest",
252  {"DiMuMassVsMuMuPhi",
253  "DiMuMassVsMuMuEta",
254  "DiMuMassVsMuPlusPhi",
255  "DiMuMassVsMuPlusEta",
256  "DiMuMassVsMuMinusPhi",
257  "DiMuMassVsMuMinusEta",
258  "DiMuMassVsMuMuDeltaEta",
259  "DiMuMassVsCosThetaCS"});
260  descriptions.addWithDefaultLabel(desc);
261 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)

◆ fitVoigt()

diMuonMassBias::fitOutputs DiMuonMassBiasClient::fitVoigt ( TH1 *  hist,
const bool &  fitBackground = false 
) const
private

Definition at line 143 of file DiMuonMassBiasClient.cc.

References b, alignmentValidation::c1, gpuVertexFinder::hist, instance, SiStripPI::mean, diMuonMassBias::minimumHits, alignCSCRings::s, ApeEstimator_cff::width, TrackerOfflineValidation_Dqm_cff::xmax, and TrackerOfflineValidation_Dqm_cff::xmin.

Referenced by dqmEndJob().

145 {
146  if (hist->GetEntries() < diMuonMassBias::minimumHits) {
147  edm::LogWarning("DiMuonMassBiasClient") << " Input histogram:" << hist->GetName() << " has not enough entries ("
148  << hist->GetEntries() << ") for a meaningful Voigtian fit!\n"
149  << "Skipping!";
150 
151  return diMuonMassBias::fitOutputs(Measurement1D(0., 0.), Measurement1D(0., 0.));
152  }
153 
154  TCanvas* c1 = new TCanvas();
155  if (debugMode_) {
156  c1->Clear();
157  c1->SetLeftMargin(0.15);
158  c1->SetRightMargin(0.10);
159  }
160 
161  // silence messages
162  RooMsgService::instance().setGlobalKillBelow(RooFit::FATAL);
163 
164  Double_t xmin = hist->GetXaxis()->GetXmin();
165  Double_t xmax = hist->GetXaxis()->GetXmax();
166 
167  if (debugMode_) {
168  edm::LogPrint("DiMuonMassBiasClient") << "fitting range: (" << xmin << "-" << xmax << ")" << std::endl;
169  }
170 
171  RooRealVar InvMass("InvMass", "di-muon mass M(#mu^{+}#mu^{-}) [GeV]", xmin, xmax);
172  RooPlot* frame = InvMass.frame();
173  RooDataHist datahist("datahist", "datahist", InvMass, RooFit::Import(*hist));
174  datahist.plotOn(frame);
175 
176  RooRealVar mean("#mu", "mean", meanConfig_[0], meanConfig_[1], meanConfig_[2]); //90.0, 60.0, 120.0 (for Z)
177  RooRealVar width("width", "width", widthConfig_[0], widthConfig_[1], widthConfig_[2]); // 5.0, 0.0, 120.0 (for Z)
178  RooRealVar sigma("#sigma", "sigma", sigmaConfig_[0], sigmaConfig_[1], sigmaConfig_[2]); // 5.0, 0.0, 120.0 (for Z)
179  RooVoigtian voigt("voigt", "voigt", InvMass, mean, width, sigma);
180 
181  RooRealVar lambda("#lambda", "slope", -0.01, -100., 1.);
182  RooExponential expo("expo", "expo", InvMass, lambda);
183 
184  RooRealVar b("N_{b}", "Number of background events", 0, hist->GetEntries() / 10.);
185  RooRealVar s("N_{s}", "Number of signal events", 0, hist->GetEntries());
186 
187  RooAddPdf fullModel("fullModel", "Signal + Background Model", RooArgList(voigt, expo), RooArgList(s, b));
188  if (fitBackground_) {
189  fullModel.fitTo(datahist, RooFit::PrintLevel(-1), RooFit::Save(), RooFit::Range(xmin, xmax));
190  fullModel.plotOn(frame, RooFit::LineColor(kRed));
191  fullModel.plotOn(frame, RooFit::Components(expo), RooFit::LineStyle(kDashed)); //Other option
192  fullModel.paramOn(frame, RooFit::Layout(0.65, 0.90, 0.90));
193  } else {
194  voigt.fitTo(datahist, RooFit::PrintLevel(-1), RooFit::Save(), RooFit::Range(xmin, xmax));
195  voigt.plotOn(frame, RooFit::LineColor(kRed)); //this will show fit overlay on canvas
196  voigt.paramOn(frame, RooFit::Layout(0.65, 0.90, 0.90)); //this will display the fit parameters on canvas
197  }
198 
199  // Redraw data on top and print / store everything
200  datahist.plotOn(frame);
201  frame->GetYaxis()->SetTitle("n. of events");
202  TString histName = hist->GetName();
203  frame->SetName("frame" + histName);
204  frame->SetTitle(hist->GetTitle());
205  frame->Draw();
206 
207  if (debugMode_) {
208  c1->Print("fit_debug" + histName + ".pdf");
209  }
210  delete c1;
211 
212  float mass_mean = mean.getVal();
213  float mass_sigma = sigma.getVal();
214 
215  float mass_mean_err = mean.getError();
216  float mass_sigma_err = sigma.getError();
217 
218  Measurement1D resultM(mass_mean, mass_mean_err);
219  Measurement1D resultW(mass_sigma, mass_sigma_err);
220 
221  return diMuonMassBias::fitOutputs(resultM, resultW);
222 }
static PFTauRenderPlugin instance
PixelRecoRange< float > Range
Log< level::Warning, true > LogPrint
__shared__ Hist hist
double b
Definition: hdecay.h:118
static constexpr int minimumHits
Log< level::Warning, false > LogWarning

◆ getMEsToHarvest()

void DiMuonMassBiasClient::getMEsToHarvest ( DQMStore::IGetter igetter)
private

Definition at line 92 of file DiMuonMassBiasClient.cc.

References dqm::implementation::IGetter::get(), harvestTargets_, MEtoHarvest_, AlCaHLTBitMon_QueryRunRegistry::string, and TopFolder_.

Referenced by dqmEndJob().

94 {
95  std::string inFolder = TopFolder_ + "/DiMuonMassBiasMonitor/MassBias/";
96 
97  //loop on the list of histograms to harvest
98  for (const auto& hname : MEtoHarvest_) {
99  MonitorElement* toHarvest = iGetter.get(inFolder + hname);
100 
101  if (toHarvest == nullptr) {
102  edm::LogError("DiMuonMassBiasClient") << "could not find input MonitorElement: " << inFolder + hname << std::endl;
103  continue;
104  }
105 
106  harvestTargets_.insert({hname, toHarvest});
107  }
108 }
const std::string TopFolder_
Log< level::Error, false > LogError
std::map< std::string, MonitorElement * > harvestTargets_
std::vector< std::string > MEtoHarvest_

Member Data Documentation

◆ debugMode_

const bool DiMuonMassBiasClient::debugMode_
private

Definition at line 85 of file DiMuonMassBiasClient.h.

Referenced by DiMuonMassBiasClient(), and dqmEndJob().

◆ fitBackground_

const bool DiMuonMassBiasClient::fitBackground_
private

Definition at line 84 of file DiMuonMassBiasClient.h.

◆ harvestTargets_

std::map<std::string, MonitorElement*> DiMuonMassBiasClient::harvestTargets_
private

Definition at line 99 of file DiMuonMassBiasClient.h.

Referenced by bookMEs(), dqmEndJob(), and getMEsToHarvest().

◆ meanConfig_

float DiMuonMassBiasClient::meanConfig_[3]
private

Definition at line 87 of file DiMuonMassBiasClient.h.

Referenced by DiMuonMassBiasClient().

◆ meanProfiles_

std::map<std::string, MonitorElement*> DiMuonMassBiasClient::meanProfiles_
private

Definition at line 95 of file DiMuonMassBiasClient.h.

Referenced by bookMEs(), and dqmEndJob().

◆ MEtoHarvest_

std::vector<std::string> DiMuonMassBiasClient::MEtoHarvest_
private

Definition at line 92 of file DiMuonMassBiasClient.h.

Referenced by getMEsToHarvest().

◆ sigmaConfig_

float DiMuonMassBiasClient::sigmaConfig_[3]
private

Definition at line 89 of file DiMuonMassBiasClient.h.

Referenced by DiMuonMassBiasClient().

◆ TopFolder_

const std::string DiMuonMassBiasClient::TopFolder_
private

Definition at line 83 of file DiMuonMassBiasClient.h.

Referenced by bookMEs(), and getMEsToHarvest().

◆ widthConfig_

float DiMuonMassBiasClient::widthConfig_[3]
private

Definition at line 88 of file DiMuonMassBiasClient.h.

Referenced by DiMuonMassBiasClient().

◆ widthProfiles_

std::map<std::string, MonitorElement*> DiMuonMassBiasClient::widthProfiles_
private

Definition at line 96 of file DiMuonMassBiasClient.h.

Referenced by bookMEs(), and dqmEndJob().