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;
85  void fitAndFillProfile(std::pair<std::string, MonitorElement*> toHarvest, DQMStore::IBooker& iBooker);
86  void fitAndFillHisto(std::pair<std::string, MonitorElement*> toHarvest, DQMStore::IBooker& iBooker);
87 
88  // data members
90  const bool useTH1s_;
91  const bool useBWtimesCB_;
92  const bool fitBackground_;
93  const bool useRooCBShape_;
94  const bool useRooCMSShape_;
95  const bool debugMode_;
96 
97  float meanConfig_[3]; /* parmaeters for the fit: mean */
98  float widthConfig_[3]; /* parameters for the fit: width */
99  float sigmaConfig_[3]; /* parameters for the fit: sigma */
100 
101  // list of histograms to harvest
102  std::vector<std::string> MEtoHarvest_;
103 
104  // the histograms to be filled
105  std::map<std::string, MonitorElement*> meanHistos_;
106  std::map<std::string, MonitorElement*> widthHistos_;
107 
108  // the profiles to be filled
109  std::map<std::string, MonitorElement*> meanProfiles_;
110  std::map<std::string, MonitorElement*> widthProfiles_;
111 
112  // the histograms than need to be fit and displays
113  std::map<std::string, MonitorElement*> harvestTargets_;
114 };
115 #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()
diMuonMassBias::fitOutputs fitBWTimesCB(TH1 *hist) const
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