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