CMS 3D CMS Logo

DiMuonMassBiasClient.h
Go to the documentation of this file.
1 #ifndef DQMOffline_Alignment_DiMuonMassBiasClient_h
2 #define DQMOffline_Alignment_DiMuonMassBiasClient_h
3 // -*- C++ -*-
4 //
5 // Package: DQMOffline/Alignment
6 // Class : DiMuonMassBiasClient
7 //
8 // DQM class to plot di-muon mass bias in different kinematics bins
9 
10 // system includes
11 #include <string>
12 
13 // user includes
23 
24 namespace diMuonMassBias {
25 
26  struct fitOutputs {
27  public:
28  fitOutputs(const Measurement1D& bias, const Measurement1D& width) : m_bias(bias), m_width(width) {}
29 
30  // getters
31  const Measurement1D getBias() { return m_bias; }
32  const Measurement1D getWidth() { return m_width; }
33  const bool isInvalid() {
34  return (m_bias.value() == 0.f && m_bias.error() == 0.f && m_width.value() == 0.f && m_width.error() == 0.f);
35  }
36 
37  private:
40  };
41 
42  // helper functions to fill arrays from vectors
43  inline void fillArrayF(float* x, const edm::ParameterSet& cfg, const char* name) {
44  auto v = cfg.getParameter<std::vector<double>>(name);
45  assert(v.size() == 3);
46  std::copy(std::begin(v), std::end(v), x);
47  }
48 
49  inline void fillArrayI(int* x, const edm::ParameterSet& cfg, const char* name) {
50  auto v = cfg.getParameter<std::vector<int>>(name);
51  assert(v.size() == 3);
52  std::copy(std::begin(v), std::end(v), x);
53  }
54 
55  static constexpr int minimumHits = 10;
56 
57 } // namespace diMuonMassBias
58 
60 public:
63 
65  ~DiMuonMassBiasClient() override;
66 
67  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
68 
69 protected:
71  void beginJob(void) override;
72 
74  void beginRun(edm::Run const& run, edm::EventSetup const& eSetup) override;
75 
77  void dqmEndJob(DQMStore::IBooker& ibooker_, DQMStore::IGetter& igetter_) override;
78 
79 private:
81  void bookMEs(DQMStore::IBooker& ibooker);
82  void getMEsToHarvest(DQMStore::IGetter& igetter);
83  diMuonMassBias::fitOutputs fitLineShape(TH1* hist, const bool& fitBackground = false) const;
84  void fitAndFillProfile(std::pair<std::string, MonitorElement*> toHarvest, DQMStore::IBooker& iBooker);
85  void fitAndFillHisto(std::pair<std::string, MonitorElement*> toHarvest, DQMStore::IBooker& iBooker);
86 
87  // data members
89  const bool useTH1s_;
90  const bool fitBackground_;
91  const bool useRooCBShape_;
92  const bool useRooCMSShape_;
93  const bool debugMode_;
94 
95  float meanConfig_[3]; /* parmaeters for the fit: mean */
96  float widthConfig_[3]; /* parameters for the fit: width */
97  float sigmaConfig_[3]; /* parameters for the fit: sigma */
98 
99  // list of histograms to harvest
100  std::vector<std::string> MEtoHarvest_;
101 
102  // the histograms to be filled
103  std::map<std::string, MonitorElement*> meanHistos_;
104  std::map<std::string, MonitorElement*> widthHistos_;
105 
106  // the profiles to be filled
107  std::map<std::string, MonitorElement*> meanProfiles_;
108  std::map<std::string, MonitorElement*> widthProfiles_;
109 
110  // the histograms than need to be fit and displays
111  std::map<std::string, MonitorElement*> harvestTargets_;
112 };
113 #endif
void getMEsToHarvest(DQMStore::IGetter &igetter)
std::map< std::string, MonitorElement * > widthHistos_
diMuonMassBias::fitOutputs fitLineShape(TH1 *hist, const bool &fitBackground=false) const
~DiMuonMassBiasClient() override
Destructor.
const std::string TopFolder_
void beginRun(edm::Run const &run, edm::EventSetup const &eSetup) override
BeginRun.
assert(be >=bs)
std::map< std::string, MonitorElement * > harvestTargets_
std::map< std::string, MonitorElement * > meanProfiles_
std::map< std::string, MonitorElement * > widthProfiles_
const Measurement1D getWidth()
const Measurement1D getBias()
std::vector< std::string > MEtoHarvest_
void fillArrayI(int *x, const edm::ParameterSet &cfg, const char *name)
void dqmEndJob(DQMStore::IBooker &ibooker_, DQMStore::IGetter &igetter_) override
EndJob.
void beginJob(void) override
BeginJob.
void fitAndFillProfile(std::pair< std::string, MonitorElement *> toHarvest, DQMStore::IBooker &iBooker)
fitOutputs(const Measurement1D &bias, const Measurement1D &width)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
static constexpr int minimumHits
DiMuonMassBiasClient(const edm::ParameterSet &ps)
Constructor.
double value() const
Definition: Measurement1D.h:25
std::map< std::string, MonitorElement * > meanHistos_
void bookMEs(DQMStore::IBooker &ibooker)
book MEs
double error() const
Definition: Measurement1D.h:27
float x
void fitAndFillHisto(std::pair< std::string, MonitorElement *> toHarvest, DQMStore::IBooker &iBooker)
void fillArrayF(float *x, const edm::ParameterSet &cfg, const char *name)
Definition: Run.h:45