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 
85  // data members
87  const bool fitBackground_;
88  const bool useRooCBShape_;
89  const bool useRooCMSShape_;
90  const bool debugMode_;
91 
92  float meanConfig_[3]; /* parmaeters for the fit: mean */
93  float widthConfig_[3]; /* parameters for the fit: width */
94  float sigmaConfig_[3]; /* parameters for the fit: sigma */
95 
96  // list of histograms to harvest
97  std::vector<std::string> MEtoHarvest_;
98 
99  // the histograms to be filled
100  std::map<std::string, MonitorElement*> meanProfiles_;
101  std::map<std::string, MonitorElement*> widthProfiles_;
102 
103  // the histograms than need to be fit and displays
104  std::map<std::string, MonitorElement*> harvestTargets_;
105 };
106 #endif
void getMEsToHarvest(DQMStore::IGetter &igetter)
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.
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
void bookMEs(DQMStore::IBooker &ibooker)
book MEs
double error() const
Definition: Measurement1D.h:27
float x
void fillArrayF(float *x, const edm::ParameterSet &cfg, const char *name)
Definition: Run.h:45