CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
FitSlicesYTool Class Reference

#include <FitSlicesYTool.h>

Public Types

typedef dqm::harvesting::MonitorElement MonitorElement
 

Public Member Functions

 FitSlicesYTool (MonitorElement *)
 
void getFittedMean (MonitorElement *)
 Fill the ME with the mean value of the gaussian fit in each slice. More...
 
void getFittedMeanWithError (MonitorElement *)
 Fill the ME with the mean value (with error) of the gaussian fit in each slice. More...
 
void getFittedSigma (MonitorElement *)
 Fill the ME with the sigma value of the gaussian fit in each slice. More...
 
void getFittedSigmaWithError (MonitorElement *)
 Fill the ME with the sigma value (with error) of the gaussian fit in each slice. More...
 
 ~FitSlicesYTool ()
 Constructor: needs a TH2F. More...
 

Private Attributes

TH1 * h0
 
TH1 * h1
 
TH1 * h2
 
TH1 * h3
 

Detailed Description

Class to fill Monitor Elements using the ROOT FitSlicesY tool

Author
cerati

Definition at line 15 of file FitSlicesYTool.h.

Member Typedef Documentation

Definition at line 17 of file FitSlicesYTool.h.

Constructor & Destructor Documentation

FitSlicesYTool::FitSlicesYTool ( MonitorElement me)

Definition at line 8 of file FitSlicesYTool.cc.

References dqm::legacy::MonitorElement::getTH2F(), h, and Skims_PA_cff::name.

8  {
9  const bool oldAddDir = TH1::AddDirectoryStatus();
10  TH1::AddDirectory(true);
11  // ... create your hists
12  TH2F* h = me->getTH2F();
13  h->FitSlicesY(nullptr, 0, -1, 0, "QNR SERIAL");
14  string name(h->GetName());
15  h0 = (TH1*)gDirectory->Get((name + "_0").c_str());
16  h1 = (TH1*)gDirectory->Get((name + "_1").c_str());
17  h2 = (TH1*)gDirectory->Get((name + "_2").c_str());
18  h3 = (TH1*)gDirectory->Get((name + "_chi2").c_str());
19  TH1::AddDirectory(oldAddDir);
20 }
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
virtual TH2F * getTH2F() const
FitSlicesYTool::~FitSlicesYTool ( )

Constructor: needs a TH2F.

Destructor

Definition at line 30 of file FitSlicesYTool.cc.

30  {
31  delete h0;
32  delete h1;
33  delete h2;
34  delete h3;
35 }

Member Function Documentation

void FitSlicesYTool::getFittedMean ( MonitorElement me)

Fill the ME with the mean value of the gaussian fit in each slice.

Definition at line 36 of file FitSlicesYTool.cc.

References newFWLiteAna::bin, Exception, and hlt_dqm_clientPB-live_cfg::me.

36  {
37  if (!(h1 && me))
38  throw cms::Exception("FitSlicesYTool") << "Pointer =0 : h1=" << h1 << " me=" << me;
39  if (h1->GetNbinsX() == me->getNbinsX()) {
40  for (int bin = 0; bin != h1->GetNbinsX(); bin++) {
41  me->setBinContent(bin + 1, h1->GetBinContent(bin + 1));
42  // me->setBinEntries(bin+1, 1.);
43  }
44  } else {
45  throw cms::Exception("FitSlicesYTool") << "Different number of bins!";
46  }
47 }
void FitSlicesYTool::getFittedMeanWithError ( MonitorElement me)

Fill the ME with the mean value (with error) of the gaussian fit in each slice.

Definition at line 60 of file FitSlicesYTool.cc.

References newFWLiteAna::bin, Exception, and hlt_dqm_clientPB-live_cfg::me.

Referenced by DQMGenericClient::computeResolution().

60  {
61  if (!(h1 && me))
62  throw cms::Exception("FitSlicesYTool") << "Pointer =0 : h1=" << h1 << " me=" << me;
63  if (h1->GetNbinsX() == me->getNbinsX()) {
64  for (int bin = 0; bin != h1->GetNbinsX(); bin++) {
65  me->setBinContent(bin + 1, h1->GetBinContent(bin + 1));
66  // me->setBinEntries(bin+1, 1.);
67  me->setBinError(bin + 1, h1->GetBinError(bin + 1));
68  }
69  } else {
70  throw cms::Exception("FitSlicesYTool") << "Different number of bins!";
71  }
72 }
void FitSlicesYTool::getFittedSigma ( MonitorElement me)

Fill the ME with the sigma value of the gaussian fit in each slice.

Definition at line 48 of file FitSlicesYTool.cc.

References newFWLiteAna::bin, Exception, and hlt_dqm_clientPB-live_cfg::me.

48  {
49  if (!(h2 && me))
50  throw cms::Exception("FitSlicesYTool") << "Pointer =0 : h1=" << h1 << " me=" << me;
51  if (h2->GetNbinsX() == me->getNbinsX()) {
52  for (int bin = 0; bin != h2->GetNbinsX(); bin++) {
53  me->setBinContent(bin + 1, h2->GetBinContent(bin + 1));
54  // me->setBinEntries(bin+1, 1.);
55  }
56  } else {
57  throw cms::Exception("FitSlicesYTool") << "Different number of bins!";
58  }
59 }
void FitSlicesYTool::getFittedSigmaWithError ( MonitorElement me)

Fill the ME with the sigma value (with error) of the gaussian fit in each slice.

Definition at line 73 of file FitSlicesYTool.cc.

References newFWLiteAna::bin, Exception, and hlt_dqm_clientPB-live_cfg::me.

Referenced by DQMGenericClient::computeResolution().

73  {
74  if (!(h2 && me))
75  throw cms::Exception("FitSlicesYTool") << "Pointer =0 : h1=" << h1 << " me=" << me;
76  if (h2->GetNbinsX() == me->getNbinsX()) {
77  for (int bin = 0; bin != h2->GetNbinsX(); bin++) {
78  me->setBinContent(bin + 1, h2->GetBinContent(bin + 1));
79  // me->setBinEntries(bin+1, 1.);
80  me->setBinError(bin + 1, h2->GetBinError(bin + 1));
81  }
82  } else {
83  throw cms::Exception("FitSlicesYTool") << "Different number of bins!";
84  }
85 }

Member Data Documentation

TH1* FitSlicesYTool::h0
private

Definition at line 33 of file FitSlicesYTool.h.

TH1* FitSlicesYTool::h1
private
TH1* FitSlicesYTool::h2
private
TH1* FitSlicesYTool::h3
private

Definition at line 36 of file FitSlicesYTool.h.