CMS 3D CMS Logo

PhotonDataCertification.cc
Go to the documentation of this file.
1 #include <iostream>
2 
5 #include "RooGlobalFunc.h"
6 #include "RooRealVar.h"
7 #include "RooDataSet.h"
8 #include "RooBreitWigner.h"
9 #include "RooDataHist.h"
10 #include "RooFitResult.h"
11 
14 //
15 // Original Author: Louis James Antonelli
16 // Created: Thu Jan 22 13:42:28CET 2009
17 //
18 
19 using namespace std;
20 
22 
23 {
24  parameters_ = pset;
25  verbose_ = parameters_.getParameter<bool>("verbose");
26 
27  if (verbose_)
28  cout << ">>> Constructor (PhotonDataCertification) <<<" << endl;
29 }
30 
32 
33 // ------------ method called right after a run ends ------------
35  using namespace RooFit;
36  if (verbose_)
37  std::cout << ">>> endJob (PhotonDataCertification) <<<" << std::endl;
38 
39  //booking histograms according to naming conventions
40  ibooker.setCurrentFolder("Egamma/EventInfo/");
41  reportSummary_ = ibooker.bookFloat("reportSummary");
42  reportSummaryMap_ = ibooker.book2D("reportSummaryMap", "reportSummaryMap", 3, 0, 3, 1, 0, 1);
43 
44  TH2F* reportSummaryMapTH2 = reportSummaryMap_->getTH2F();
45  reportSummaryMapTH2->GetXaxis()->SetBinLabel(1, "EB");
46  reportSummaryMapTH2->GetXaxis()->SetBinLabel(2, "EE");
47  reportSummaryMapTH2->GetXaxis()->SetBinLabel(3, "Total");
48  reportSummaryMapTH2->GetYaxis()->SetBinLabel(1, "InvMassTest");
49 
50  float EBResult = invMassZtest(
51  "Egamma/stdPhotonAnalyzer/InvMass/h_02_invMassIsoPhotonsEBarrel", "invMassIsolatedPhotonsEB", igetter);
52 
53  float EEResult = invMassZtest(
54  "Egamma/stdPhotonAnalyzer/InvMass/h_03_invMassIsoPhotonsEEndcap", "invMassIsolatedPhotonsEE", igetter);
55 
56  float AllResult = invMassZtest(
57  "Egamma/stdPhotonAnalyzer/InvMass/h_01_invMassAllIsolatedPhotons", "invMassAllIsolatedPhotons", igetter);
58 
59  if (verbose_) {
60  std::cout << "EBResult: " << EBResult << std::endl;
61  std::cout << "EEResult: " << EEResult << std::endl;
62  std::cout << "AllResult: " << AllResult << std::endl;
63  }
64 
65  reportSummaryMapTH2->SetBinContent(1, 1, EBResult);
66  reportSummaryMapTH2->SetBinContent(2, 1, EEResult);
67  reportSummaryMapTH2->SetBinContent(3, 1, AllResult);
68  reportSummary_->Fill(AllResult);
69 }
70 
72  float ZMass = 91.2;
73  float ZWidth = 2.5;
74  MonitorElement* TestElem = nullptr;
75  TestElem = igetter.get(path);
76  if (TestElem == nullptr)
77  return 0;
78  TH1F* TestHist = TestElem->getTH1F();
79  if (TestHist == nullptr)
80  return 0;
81  RooMsgService::instance().setGlobalKillBelow(RooFit::WARNING);
82  RooRealVar mass("mass", "Mass_{2#gamma}", 0, 200, "GeV");
83  RooRealVar mRes("M_{Z}", "Z Mass", ZMass, 70, 110);
84  RooRealVar gamma("#Gamma", "#Gamma", ZWidth, 0, 10.0);
85  RooBreitWigner BreitWigner("BreitWigner", "Breit-Wigner", mass, mRes, gamma);
86  RooDataHist test(name, name, mass, TestHist);
87 
88  BreitWigner.fitTo(test, RooFit::Range(80, 100), RooFit::PrintLevel(-1000));
89 
90  if (std::abs(mRes.getValV() - ZMass) < ZWidth) {
91  return 1.0;
92  } else if (std::abs(mRes.getValV() - ZMass) < gamma.getValV()) {
93  return 0.9;
94  } else {
95  return 0.0;
96  }
97 }
dqm::implementation::IBooker::bookFloat
MonitorElement * bookFloat(TString const &name, FUNC onbooking=NOOP())
Definition: DQMStore.h:80
PhotonDataCertification::invMassZtest
float invMassZtest(std::string path, TString name, DQMStore::IGetter &)
Definition: PhotonDataCertification.cc:71
Range
PixelRecoRange< float > Range
Definition: PixelTripletHLTGenerator.cc:31
PhotonDataCertification::PhotonDataCertification
PhotonDataCertification(const edm::ParameterSet &pset)
Definition: PhotonDataCertification.cc:21
gather_cfg.cout
cout
Definition: gather_cfg.py:144
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
CustomPhysics_cfi.gamma
gamma
Definition: CustomPhysics_cfi.py:17
dqm::legacy::MonitorElement
Definition: MonitorElement.h:462
dqm::legacy::MonitorElement::getTH1F
virtual TH1F * getTH1F() const
Definition: MonitorElement.h:479
test
Definition: SmallWORMDict.h:13
ctpps_dqm_sourceclient-live_cfg.test
test
Definition: ctpps_dqm_sourceclient-live_cfg.py:7
Run.h
edm::ParameterSet
Definition: ParameterSet.h:47
remoteMonitoring_LED_IterMethod_cfg.WARNING
WARNING
Definition: remoteMonitoring_LED_IterMethod_cfg.py:426
instance
static PFTauRenderPlugin instance
Definition: PFTauRenderPlugin.cc:70
std
Definition: JetResolutionObject.h:76
PhotonDataCertification.h
dqm::implementation::IGetter
Definition: DQMStore.h:484
dqm::implementation::IBooker::book2D
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:177
EgHLTOffHistBins_cfi.mass
mass
Definition: EgHLTOffHistBins_cfi.py:34
dqm::implementation::IGetter::get
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:673
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
dqm::implementation::IBooker
Definition: DQMStore.h:43
PhotonDataCertification::dqmEndJob
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
Definition: PhotonDataCertification.cc:34
castor_dqm_sourceclient_file_cfg.path
path
Definition: castor_dqm_sourceclient_file_cfg.py:37
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
PhotonDataCertification::~PhotonDataCertification
~PhotonDataCertification() override
Definition: PhotonDataCertification.cc:31
ExhumeParameters_cfi.ZMass
ZMass
Definition: ExhumeParameters_cfi.py:20
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
dqm::legacy::MonitorElement::getTH2F
virtual TH2F * getTH2F() const
Definition: MonitorElement.h:491