SimG4CMS
HcalTestBeam
plugins
HcalTB06Histo.cc
Go to the documentation of this file.
1
// -*- C++ -*-
2
//
3
// Package: HcalTestBeam
4
// Class : HcalTB06Histo
5
//
6
// Implementation:
7
// <Notes on implementation>
8
//
9
// Original Author:
10
// Created: Tue Oct 10 10:14:34 CEST 2006
11
//
12
13
// system include files
14
#include <iostream>
15
#include <cmath>
16
17
// user include files
18
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
19
#include "
FWCore/ServiceRegistry/interface/Service.h
"
20
#include "
CommonTools/UtilAlgos/interface/TFileService.h
"
21
22
#include "
HcalTB06Histo.h
"
23
24
//
25
// constructors and destructor
26
HcalTB06Histo::HcalTB06Histo
(
const
edm::ParameterSet
& ps) {
27
verbose_
= ps.
getUntrackedParameter
<
bool
>(
"Verbose"
,
false
);
28
double
em1 = ps.
getUntrackedParameter
<
double
>(
"ETtotMax"
, 400.);
29
double
em2 = ps.
getUntrackedParameter
<
double
>(
"EHCalMax"
, 4.0);
30
mkTree_
= ps.
getUntrackedParameter
<
bool
>(
"MakeTree"
,
false
);
31
eBeam_
= 50.;
32
mip_
= ps.
getParameter
<
double
>(
"MIP"
);
33
edm::LogInfo
(
"HcalTBSim"
) <<
"Verbose :"
<<
verbose_
<<
" MakeTree: "
<<
mkTree_
<<
" EMax: "
<< em1 <<
":"
<< em2
34
<<
" MIP "
<<
mip_
;
35
36
// Book histograms
37
edm::Service<TFileService>
tfile
;
38
39
if
(!
tfile
.isAvailable())
40
throw
cms::Exception
(
"BadConfig"
) <<
"TFileService unavailable: "
41
<<
"please add it to config file"
;
42
iniE
=
tfile
->make<TH1D>(
"iniE"
,
"Incident Energy (GeV)"
, 4000, 0., em1);
43
iEta
=
tfile
->make<TH1D>(
"iEta"
,
"Eta at incidence "
, 300, 0., 3.);
44
iPhi
=
tfile
->make<TH1D>(
"iPhi"
,
"Phi at incidence "
, 300, -1., 1.);
45
edepS
=
tfile
->make<TH1D>(
"edepS"
,
"Energy deposit == Total"
, 4000, 0., em1);
46
edecS
=
tfile
->make<TH1D>(
"edecS"
,
"Energy deposit == ECal "
, 300, -2., 28.);
47
edhcS
=
tfile
->make<TH1D>(
"edhcS"
,
"Energy deposit == HCal "
, 4000, 0., em2);
48
edepN
=
tfile
->make<TH1D>(
"edepN"
,
"Etot/Ebeam "
, 200, -2.5, 2.5);
49
edecN
=
tfile
->make<TH1D>(
"edecN"
,
"Eecal/Ebeam "
, 200, -2.5, 2.5);
50
edhcN
=
tfile
->make<TH1D>(
"edhcN"
,
"Ehcal/Ebeam "
, 200, -2.5, 2.5);
51
emhcN
=
tfile
->make<TH1D>(
"emhcN"
,
"Ehcal/Ebeam MIP in Ecal"
, 200, -2.5, 2.5);
52
edehS
=
tfile
->make<TH2D>(
"edehS"
,
"Hcal vs Ecal"
, 100, 0., em1, 100, 0., em2);
53
54
if
(
mkTree_
) {
55
tree_
=
tfile
->make<TTree>(
"TB06Sim"
,
"TB06Sim"
);
56
tree_
->Branch(
"eBeam_"
, &
eBeam_
,
"eBeam_/D"
);
57
tree_
->Branch(
"etaBeam_"
, &
etaBeam_
,
"etaBeam_/D"
);
58
tree_
->Branch(
"phiBeam_"
, &
phiBeam_
,
"phiBeam_/D"
);
59
tree_
->Branch(
"edepEC_"
, &
edepEC_
,
"edepEC_/D"
);
60
tree_
->Branch(
"edepHB_"
, &
edepHB_
,
"edepHB_/D"
);
61
tree_
->Branch(
"edepHO_"
, &
edepHO_
,
"edepHO_/D"
);
62
tree_
->Branch(
"noiseEC_"
, &
noiseEC_
,
"noiseEC_/D"
);
63
tree_
->Branch(
"noiseHB_"
, &
noiseHB_
,
"noiseHB_/D"
);
64
tree_
->Branch(
"noiseHO_"
, &
noiseHO_
,
"noiseHO_/D"
);
65
tree_
->Branch(
"edepS1_"
, &
edepS1_
,
"edepS1_/D"
);
66
tree_
->Branch(
"edepS2_"
, &
edepS2_
,
"edepS2_/D"
);
67
tree_
->Branch(
"edepS3_"
, &
edepS3_
,
"edepS3_/D"
);
68
tree_
->Branch(
"edepS4_"
, &
edepS4_
,
"edepS4_/D"
);
69
tree_
->Branch(
"edepVC_"
, &
edepVC_
,
"edepVC_/D"
);
70
tree_
->Branch(
"edepS7_"
, &
edepS7_
,
"edepS7_/D"
);
71
tree_
->Branch(
"edepS8_"
, &
edepS8_
,
"edepS8_/D"
);
72
}
73
}
74
75
HcalTB06Histo::~HcalTB06Histo
() {}
76
77
//
78
// member functions
79
//
80
81
void
HcalTB06Histo::fillPrimary
(
double
energy
,
double
eta
,
double
phi
) {
82
if
(
verbose_
)
83
edm::LogInfo
(
"HcalTBSim"
) <<
"HcalTB06Histo::fillPrimary: Energy "
<<
energy
<<
" Eta "
<<
eta
<<
" Phi "
<<
phi
;
84
eBeam_
=
energy
;
85
etaBeam_
=
eta
;
86
phiBeam_
=
phi
;
87
iniE
->Fill(
energy
);
88
iEta
->Fill(
eta
);
89
iPhi
->Fill(
phi
);
90
}
91
92
void
HcalTB06Histo::fillEdep
(
double
etots,
double
eecals,
double
ehcals) {
93
if
(
verbose_
)
94
edm::LogInfo
(
"HcalTBSim"
) <<
"HcalTB06Histo:::fillEdep: Simulated Total "
<< etots <<
" ECal "
<< eecals <<
" HCal "
95
<< ehcals;
96
edepS
->Fill(etots);
97
edecS
->Fill(eecals);
98
edhcS
->Fill(ehcals);
99
edepN
->Fill(etots /
eBeam_
);
100
edecN
->Fill(eecals /
eBeam_
);
101
edhcN
->Fill(ehcals /
eBeam_
);
102
if
(eecals <=
mip_
) {
103
emhcN
->Fill(etots /
eBeam_
);
104
}
105
edehS
->Fill(eecals, ehcals);
106
}
107
108
void
HcalTB06Histo::fillTree
(std::vector<double>& ecalo, std::vector<double>& etrig) {
109
if
(
mkTree_
) {
110
edepEC_
= ecalo[0];
111
noiseEC_
= ecalo[1];
112
edepHB_
= ecalo[2];
113
noiseHB_
= ecalo[3];
114
edepHO_
= ecalo[4];
115
noiseHO_
= ecalo[5];
116
edepS1_
= etrig[0];
117
edepS2_
= etrig[1];
118
edepS3_
= etrig[2];
119
edepS4_
= etrig[3];
120
edepVC_
= etrig[4];
121
edepS7_
= etrig[5];
122
edepS8_
= etrig[6];
123
tree_
->Fill();
124
if
(
verbose_
)
125
edm::LogInfo
(
"HcalTBSim"
) <<
"HcalTB06Histo:::fillTree: Energies "
<<
edepEC_
<<
":"
<<
noiseEC_
<<
":"
<<
edepHB_
126
<<
":"
<<
noiseHB_
<<
":"
<<
edepHO_
<<
":"
<<
noiseHO_
<<
" Trigger counters "
127
<<
edepS1_
<<
":"
<<
edepS2_
<<
":"
<<
edepS3_
<<
":"
<<
edepS4_
<<
":"
<<
edepVC_
128
<<
":"
<<
edepS7_
<<
":"
<<
edepS8_
;
129
}
130
}
HcalTB06Histo::~HcalTB06Histo
virtual ~HcalTB06Histo()
Definition:
HcalTB06Histo.cc:75
HcalTB06Histo::edepHB_
double edepHB_
Definition:
HcalTB06Histo.h:52
MessageLogger.h
HcalTB06Histo::iPhi
TH1D * iPhi
Definition:
HcalTB06Histo.h:46
HcalTB06Histo::eBeam_
double eBeam_
Definition:
HcalTB06Histo.h:51
HcalTB06Histo::iniE
TH1D * iniE
Definition:
HcalTB06Histo.h:46
HcalTB06Histo::edepVC_
double edepVC_
Definition:
HcalTB06Histo.h:54
HcalTB06Histo::edepS
TH1D * edepS
Definition:
HcalTB06Histo.h:47
edm::LogInfo
Definition:
MessageLogger.h:254
HcalTB06Histo::edecS
TH1D * edecS
Definition:
HcalTB06Histo.h:47
HcalTB06Histo::noiseHO_
double noiseHO_
Definition:
HcalTB06Histo.h:53
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
HcalTB06Histo::fillTree
void fillTree(std::vector< double > &ecalo, std::vector< double > &etrig)
Definition:
HcalTB06Histo.cc:108
HcalTB06Histo::iEta
TH1D * iEta
Definition:
HcalTB06Histo.h:46
HcalTB06Histo.h
HcalTB06Histo::edepS1_
double edepS1_
Definition:
HcalTB06Histo.h:54
HcalTB06Histo::edhcS
TH1D * edhcS
Definition:
HcalTB06Histo.h:47
Service.h
PVValHelper::eta
Definition:
PVValidationHelpers.h:69
tfile
Definition:
tfile.py:1
HcalTB06Histo::verbose_
bool verbose_
Definition:
HcalTB06Histo.h:44
HcalTB06Histo::edepN
TH1D * edepN
Definition:
HcalTB06Histo.h:48
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition:
HCALHighEnergyHPDFilter_cfi.py:5
HcalTB06Histo::emhcN
TH1D * emhcN
Definition:
HcalTB06Histo.h:48
TFileService.h
HcalTB06Histo::fillPrimary
void fillPrimary(double energy, double eta, double phi)
Definition:
HcalTB06Histo.cc:81
HcalTB06Histo::edecN
TH1D * edecN
Definition:
HcalTB06Histo.h:48
edm::ParameterSet
Definition:
ParameterSet.h:36
HcalTB06Histo::edehS
TH2D * edehS
Definition:
HcalTB06Histo.h:49
PVValHelper::phi
Definition:
PVValidationHelpers.h:68
HcalTB06Histo::etaBeam_
double etaBeam_
Definition:
HcalTB06Histo.h:51
edm::Service< TFileService >
HcalTB06Histo::edepHO_
double edepHO_
Definition:
HcalTB06Histo.h:52
HcalTB06Histo::edepS7_
double edepS7_
Definition:
HcalTB06Histo.h:54
compare.tfile
tfile
Definition:
compare.py:325
DDAxes::phi
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
HcalTB06Histo::edepS8_
double edepS8_
Definition:
HcalTB06Histo.h:54
HcalTB06Histo::edepS2_
double edepS2_
Definition:
HcalTB06Histo.h:54
HcalTB06Histo::edhcN
TH1D * edhcN
Definition:
HcalTB06Histo.h:48
HcalTB06Histo::HcalTB06Histo
HcalTB06Histo(const edm::ParameterSet &ps)
Definition:
HcalTB06Histo.cc:26
HcalTB06Histo::tree_
TTree * tree_
Definition:
HcalTB06Histo.h:50
HcalTB06Histo::edepS3_
double edepS3_
Definition:
HcalTB06Histo.h:54
HcalTB06Histo::edepEC_
double edepEC_
Definition:
HcalTB06Histo.h:52
HcalTB06Histo::edepS4_
double edepS4_
Definition:
HcalTB06Histo.h:54
cms::Exception
Definition:
Exception.h:70
HcalTB06Histo::noiseEC_
double noiseEC_
Definition:
HcalTB06Histo.h:53
HcalTB06Histo::phiBeam_
double phiBeam_
Definition:
HcalTB06Histo.h:51
HcalTB06Histo::noiseHB_
double noiseHB_
Definition:
HcalTB06Histo.h:53
HcalTB06Histo::fillEdep
void fillEdep(double etots, double eecals, double ehcals)
Definition:
HcalTB06Histo.cc:92
HcalTB06Histo::mip_
double mip_
Definition:
HcalTB06Histo.h:55
HcalTB06Histo::mkTree_
bool mkTree_
Definition:
HcalTB06Histo.h:44
Generated for CMSSW Reference Manual by
1.8.16