CMS 3D CMS Logo

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

#include <FitSlicesYTool.h>

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.

Constructor & Destructor Documentation

FitSlicesYTool::FitSlicesYTool ( MonitorElement me)

Definition at line 8 of file FitSlicesYTool.cc.

References MonitorElement::getTH2F(), h, and dataset::name.

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

Constructor: needs a TH2F.

Destructor

Definition at line 31 of file FitSlicesYTool.cc.

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

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 37 of file FitSlicesYTool.cc.

References stringResolutionProvider_cfi::bin, Exception, and MonitorElement::setBinContent().

37  {
38  if (!(h1&&me)) 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 setBinContent(int binx, double content)
set content of bin (1-D)
bin
set the eta bin as selection string.
void FitSlicesYTool::getFittedMeanWithError ( MonitorElement me)

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

Definition at line 59 of file FitSlicesYTool.cc.

References stringResolutionProvider_cfi::bin, Exception, and MonitorElement::setBinContent().

Referenced by DQMGenericClient::computeResolution().

59  {
60  if (!(h1&&me)) throw cms::Exception("FitSlicesYTool") << "Pointer =0 : h1=" << h1 << " me=" << me;
61  if (h1->GetNbinsX()==me->getNbinsX()){
62  for (int bin=0;bin!=h1->GetNbinsX();bin++){
63  me->setBinContent(bin+1,h1->GetBinContent(bin+1));
64 // me->setBinEntries(bin+1, 1.);
65  me->setBinError(bin+1,h1->GetBinError(bin+1));
66  }
67  } else {
68  throw cms::Exception("FitSlicesYTool") << "Different number of bins!";
69  }
70 }
void setBinContent(int binx, double content)
set content of bin (1-D)
bin
set the eta bin as selection string.
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 stringResolutionProvider_cfi::bin, Exception, and MonitorElement::setBinContent().

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

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

Definition at line 71 of file FitSlicesYTool.cc.

References stringResolutionProvider_cfi::bin, Exception, and MonitorElement::setBinContent().

Referenced by DQMGenericClient::computeResolution().

71  {
72  if (!(h2&&me)) throw cms::Exception("FitSlicesYTool") << "Pointer =0 : h1=" << h1 << " me=" << me;
73  if (h2->GetNbinsX()==me->getNbinsX()){
74  for (int bin=0;bin!=h2->GetNbinsX();bin++){
75  me->setBinContent(bin+1,h2->GetBinContent(bin+1));
76 // me->setBinEntries(bin+1, 1.);
77  me->setBinError(bin+1,h2->GetBinError(bin+1));
78  }
79  } else {
80  throw cms::Exception("FitSlicesYTool") << "Different number of bins!";
81  }
82 }
void setBinContent(int binx, double content)
set content of bin (1-D)
bin
set the eta bin as selection string.

Member Data Documentation

TH1* FitSlicesYTool::h0
private

Definition at line 31 of file FitSlicesYTool.h.

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

Definition at line 34 of file FitSlicesYTool.h.