CMS 3D CMS Logo

HcalTB04Histo.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: HcalTestBeam
4 // Class : HcalTB04Histo
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author:
10 // Created: Tue May 16 10:14:34 CEST 2006
11 //
12 
13 // system include files
14 #include <iostream>
15 #include <cmath>
16 
17 // user include files
21 #include "HcalTB04Histo.h"
22 
23 //
24 // constructors and destructor
26  : iniE(nullptr),
27  iEta(nullptr),
28  iPhi(nullptr),
29  edepS(nullptr),
30  edecS(nullptr),
31  edhcS(nullptr),
32  edepQ(nullptr),
33  edecQ(nullptr),
34  edhcQ(nullptr),
35  edehS(nullptr),
36  edehQ(nullptr),
37  latse(nullptr),
38  latqe(nullptr),
39  latsf(nullptr),
40  latqf(nullptr),
41  lngs(nullptr),
42  lngq(nullptr) {
43  verbose = ps.getUntrackedParameter<bool>("Verbose", false);
44  double em1 = ps.getUntrackedParameter<double>("ETtotMax", 400.);
45  double em2 = ps.getUntrackedParameter<double>("EHCalMax", 4.0);
46 
47  // Book histograms
49 
50  if (!tfile.isAvailable())
51  throw cms::Exception("BadConfig") << "TFileService unavailable: "
52  << "please add it to config file";
53  iniE = tfile->make<TH1D>("iniE", "Incident Energy (GeV)", 4000, 0., em1);
54  iEta = tfile->make<TH1D>("iEta", "Eta at incidence ", 300, 0., 3.);
55  iPhi = tfile->make<TH1D>("iPhi", "Phi at incidence ", 300, -1., 1.);
56  edepS = tfile->make<TH1D>("edepS", "Energy deposit == Total (Simhit)", 4000, 0., em1);
57  edecS = tfile->make<TH1D>("edecS", "Energy deposit == ECal (Simhit)", 4000, 0., em1);
58  edhcS = tfile->make<TH1D>("edhcS", "Energy deposit == HCal (Simhit)", 4000, 0., em2);
59  edepQ = tfile->make<TH1D>("edepQ", "Energy deposit == Total (QIE)", 4000, 0., em1);
60  edecQ = tfile->make<TH1D>("edecQ", "Energy deposit == ECal (QIE)", 4000, 0., em1);
61  edhcQ = tfile->make<TH1D>("edhcQ", "Energy deposit == HCal (QIE)", 4000, 0., em2);
62  edehS = tfile->make<TH2D>("edehS", "Hcal vs Ecal (Simhit)", 100, 0., em1, 100, 0., em2);
63  edehQ = tfile->make<TH2D>("edehQ", "Hcal vs Ecal (QIE)", 100, 0., em1, 100, 0., em2);
64  latse = tfile->make<TProfile>("latse", "Lat Prof (Eta Sim)", 10, 0., 10.);
65  latqe = tfile->make<TProfile>("latqe", "Lat Prof (Eta QIE)", 10, 0., 10.);
66  latsf = tfile->make<TProfile>("latsf", "Lat Prof (Phi Sim)", 10, 0., 10.);
67  latqf = tfile->make<TProfile>("latqf", "Lat Prof (Phi QIE)", 10, 0., 10.);
68  lngs = tfile->make<TProfile>("lngs", "Long. Prof (Sim)", 20, 0., 20.);
69  lngq = tfile->make<TProfile>("lngq", "Long. Prof (QIE)", 20, 0., 20.);
70 }
71 
73 
74 //
75 // member functions
76 //
77 
78 void HcalTB04Histo::fillPrimary(double energy, double eta, double phi) {
79  LogDebug("HcalTBSim") << "HcalTB04Histo::fillPrimary: Energy " << energy << " Eta " << eta << " Phi " << phi;
80  iniE->Fill(energy);
81  iEta->Fill(eta);
82  iPhi->Fill(phi);
83 }
84 
85 void HcalTB04Histo::fillEdep(double etots, double eecals, double ehcals, double etotq, double eecalq, double ehcalq) {
86  LogDebug("HcalTBSim") << "HcalTB04Histo:::fillEdep: Simulated Total " << etots << " ECal " << eecals << " HCal "
87  << ehcals << " Digitised Total " << etotq << " ECal " << eecalq << " HCal " << ehcalq;
88  edepS->Fill(etots);
89  edecS->Fill(eecals);
90  edhcS->Fill(ehcals);
91  edepQ->Fill(etotq);
92  edecQ->Fill(eecalq);
93  edhcQ->Fill(ehcalq);
94  edehS->Fill(eecals, ehcals);
95  edehQ->Fill(eecalq, ehcalq);
96 }
97 
98 void HcalTB04Histo::fillTrnsProf(const std::vector<double>& es1,
99  const std::vector<double>& eq1,
100  const std::vector<double>& es2,
101  const std::vector<double>& eq2) {
102  unsigned int n1 = std::min(es1.size(), eq1.size());
103  unsigned int n2 = std::min(es2.size(), eq2.size());
104  unsigned int n = std::min(n1, n2);
105  for (unsigned int i = 0; i < n; i++)
106  LogDebug("HcalTBSim") << "HcalTB04Histo::fillTrnsProf [" << i << "] SimEta " << es1[i] << " DigEta " << eq1[i]
107  << " SimPhi " << es2[i] << " DigPhi " << eq2[i];
108  for (unsigned int i = 0; i < (es1.size()); i++) {
109  double tow = i + 0.5;
110  latse->Fill(tow, es1[i]);
111  }
112  for (unsigned int i = 0; i < (eq1.size()); i++) {
113  double tow = i + 0.5;
114  latqe->Fill(tow, eq1[i]);
115  }
116  for (unsigned int i = 0; i < (es2.size()); i++) {
117  double tow = i + 0.5;
118  latsf->Fill(tow, es2[i]);
119  }
120  for (unsigned int i = 0; i < (eq2.size()); i++) {
121  double tow = i + 0.5;
122  latqf->Fill(tow, eq2[i]);
123  }
124 }
125 
126 void HcalTB04Histo::fillLongProf(const std::vector<double>& es, const std::vector<double>& eq) {
127  unsigned int n = std::min(es.size(), eq.size());
128  for (unsigned int i = 0; i < n; i++)
129  LogDebug("HcalTBSim") << "HcalTB04Histo::fillLongProf [" << i << "] Sim " << es[i] << " Dig " << eq[i];
130  for (unsigned int i = 0; i < (es.size()); i++) {
131  double lay = i + 0.5;
132  lngs->Fill(lay, es[i]);
133  }
134  for (unsigned int i = 0; i < (eq.size()); i++) {
135  double lay = i + 0.5;
136  lngq->Fill(lay, eq[i]);
137  }
138 }
HcalTB04Histo::lngq
TProfile * lngq
Definition: HcalTB04Histo.h:54
HcalTB04Histo::edecQ
TH1D * edecQ
Definition: HcalTB04Histo.h:52
mps_fire.i
i
Definition: mps_fire.py:428
MessageLogger.h
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
HcalTB04Histo::verbose
bool verbose
Definition: HcalTB04Histo.h:48
min
T min(T a, T b)
Definition: MathUtil.h:58
HcalTB04Histo::fillTrnsProf
void fillTrnsProf(const std::vector< double > &es1, const std::vector< double > &eq1, const std::vector< double > &es2, const std::vector< double > &eq2)
Definition: HcalTB04Histo.cc:98
HcalTB04Histo::edecS
TH1D * edecS
Definition: HcalTB04Histo.h:52
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
HcalTB04Histo::edhcS
TH1D * edhcS
Definition: HcalTB04Histo.h:52
HcalTB04Histo::~HcalTB04Histo
virtual ~HcalTB04Histo()
Definition: HcalTB04Histo.cc:72
HcalTB04Histo::latqe
TProfile * latqe
Definition: HcalTB04Histo.h:54
HcalTB04Histo.h
HcalTB04Histo::iEta
TH1D * iEta
Definition: HcalTB04Histo.h:51
HcalTB04Histo::fillPrimary
void fillPrimary(double energy, double eta, double phi)
Definition: HcalTB04Histo.cc:78
Service.h
PVValHelper::eta
Definition: PVValidationHelpers.h:69
tfile
Definition: tfile.py:1
HcalTB04Histo::lngs
TProfile * lngs
Definition: HcalTB04Histo.h:54
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
HcalTB04Histo::edehQ
TH2D * edehQ
Definition: HcalTB04Histo.h:53
HcalTB04Histo::edepS
TH1D * edepS
Definition: HcalTB04Histo.h:52
HcalTB04Histo::HcalTB04Histo
HcalTB04Histo(const edm::ParameterSet &ps)
Definition: HcalTB04Histo.cc:25
TFileService.h
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
edm::ParameterSet
Definition: ParameterSet.h:47
PVValHelper::phi
Definition: PVValidationHelpers.h:68
edm::Service< TFileService >
HcalTB04Histo::iPhi
TH1D * iPhi
Definition: HcalTB04Histo.h:51
HcalTB04Histo::latse
TProfile * latse
Definition: HcalTB04Histo.h:54
HcalTB04Histo::fillEdep
void fillEdep(double etots, double eecals, double ehcals, double etotq, double eecalq, double ehcalq)
Definition: HcalTB04Histo.cc:85
compare.tfile
tfile
Definition: compare.py:325
HcalTB04Histo::edhcQ
TH1D * edhcQ
Definition: HcalTB04Histo.h:52
DDAxes::phi
HcalTB04Histo::latsf
TProfile * latsf
Definition: HcalTB04Histo.h:54
HcalTB04Histo::iniE
TH1D * iniE
Definition: HcalTB04Histo.h:51
L1TowerCalibrationProducer_cfi.iEta
iEta
Definition: L1TowerCalibrationProducer_cfi.py:60
HcalTB04Histo::latqf
TProfile * latqf
Definition: HcalTB04Histo.h:54
HcalTB04Histo::edepQ
TH1D * edepQ
Definition: HcalTB04Histo.h:52
cms::Exception
Definition: Exception.h:70
HcalTB04Histo::edehS
TH2D * edehS
Definition: HcalTB04Histo.h:53
HcalTB04Histo::fillLongProf
void fillLongProf(const std::vector< double > &es, const std::vector< double > &eq)
Definition: HcalTB04Histo.cc:126