CMS 3D CMS Logo

HcalTB02Histo.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: HcalTestBeam
4 // Class : HcalTB02Histo
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author:
10 // Created: Sun May 21 10:14:34 CEST 2006
11 //
12 
13 // system include files
14 #include <iostream>
15 #include <cmath>
16 
17 // user include files
21 #include "HcalTB02Histo.h"
22 
23 //
24 // constructors and destructor
25 HcalTB02Histo::HcalTB02Histo(const edm::ParameterSet& ps) : rt_tbTimes(nullptr), rt_TransProf(nullptr) {
26  verbose = ps.getUntrackedParameter<bool>("Verbose", false);
27  edm::LogInfo("HcalTBSim") << "HcalTB02Histo:: initialised with o/p file " << fileName << " verbosity " << verbose;
28 
29  // Book histograms
31 
32  if (!tfile.isAvailable())
33  throw cms::Exception("BadConfig") << "TFileService unavailable: "
34  << "please add it to config file";
35 
36  char title[80];
37  for (int ilayer = 0; ilayer < 19; ilayer++) {
38  sprintf(title, "Scint. Energy in Layer %d ", ilayer);
39  TH1D* h = tfile->make<TH1D>(title, title, 500, 0., 1.5);
40  rt_histoProf.push_back(h);
41  edm::LogInfo("HcalTBSim") << "HcalTB02Histo:: Initialise Histo " << title;
42  }
43  sprintf(title, "All Hit Time slices");
44  rt_tbTimes = tfile->make<TH1D>(title, title, 100, 0., 100.);
45  edm::LogInfo("HcalTBSim") << "HcalTB02Histo:: Initialise Histo " << title;
46  sprintf(title, "Transv. Shower Profile");
47  rt_TransProf = tfile->make<TH2D>(title, title, 100, 0., 1., 1000, 0., 0.5);
48  edm::LogInfo("HcalTBSim") << "HcalTB02Histo:: Initialise Histo " << title;
49 }
50 
51 HcalTB02Histo::~HcalTB02Histo() { edm::LogInfo("HcalTBSim") << " Deleting HcalTB02Histo"; }
52 
53 //
54 // member functions
55 //
56 
58  LogDebug("HcalTBSim") << "HcalTB02Histo::Fill Time histo with " << v;
59  if (rt_tbTimes) {
60  rt_tbTimes->Fill(v);
61  }
62 }
63 
64 void HcalTB02Histo::fillTransProf(float u, float v) {
65  LogDebug("HcalTBSim") << "HcalTB02Histo:::Fill Shower Transv. Profile histo"
66  << " with " << u << " and " << v;
67  if (rt_TransProf) {
68  rt_TransProf->Fill(u, v);
69  }
70 }
71 
72 void HcalTB02Histo::fillProfile(int ilayer, float value) {
73  if (ilayer < (int)(rt_histoProf.size())) {
74  rt_histoProf[ilayer]->Fill(value);
75  LogDebug("HcalTBSim") << "HcalTB02Histo::Fill profile " << ilayer << " with " << value;
76  }
77 }
78 
79 float HcalTB02Histo::getMean(int ilayer) {
80  if (ilayer < (int)(rt_histoProf.size())) {
81  return rt_histoProf[ilayer]->GetMean();
82  } else {
83  return 0;
84  }
85 }
86 
87 float HcalTB02Histo::getRMS(int ilayer) {
88  if (ilayer < (int)(rt_histoProf.size())) {
89  return rt_histoProf[ilayer]->GetRMS();
90  } else {
91  return 0;
92  }
93 }
MessageLogger.h
HcalTB02Histo::fileName
std::string fileName
Definition: HcalTB02Histo.h:45
edm::LogInfo
Definition: MessageLogger.h:254
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
findQualityFiles.v
v
Definition: findQualityFiles.py:179
HcalTB02Histo::verbose
bool verbose
Definition: HcalTB02Histo.h:46
HcalTB02Histo::rt_histoProf
std::vector< TH1D * > rt_histoProf
Definition: HcalTB02Histo.h:50
HcalTB02Histo::rt_tbTimes
TH1D * rt_tbTimes
Definition: HcalTB02Histo.h:48
HcalTB02Histo::~HcalTB02Histo
virtual ~HcalTB02Histo()
Definition: HcalTB02Histo.cc:51
HcalTB02Histo::fillProfile
void fillProfile(int ilayer, float value)
Definition: HcalTB02Histo.cc:72
HcalTB02Histo.h
Service.h
HcalTB02Histo::getMean
float getMean(int ilayer)
Definition: HcalTB02Histo.cc:79
tfile
Definition: tfile.py:1
h
TFileService.h
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
edm::ParameterSet
Definition: ParameterSet.h:36
edm::Service< TFileService >
value
Definition: value.py:1
compare.tfile
tfile
Definition: compare.py:325
overlapproblemtsosanalyzer_cfi.title
title
Definition: overlapproblemtsosanalyzer_cfi.py:7
HcalTB02Histo::getRMS
float getRMS(int ilayer)
Definition: HcalTB02Histo.cc:87
relativeConstraints.value
value
Definition: relativeConstraints.py:53
HcalTB02Histo::fillAllTime
void fillAllTime(float v)
Definition: HcalTB02Histo.cc:57
HcalTB02Histo::fillTransProf
void fillTransProf(float u, float v)
Definition: HcalTB02Histo.cc:64
cms::Exception
Definition: Exception.h:70
HcalTB02Histo::HcalTB02Histo
HcalTB02Histo(const edm::ParameterSet &ps)
Definition: HcalTB02Histo.cc:25
HcalTB02Histo::rt_TransProf
TH2D * rt_TransProf
Definition: HcalTB02Histo.h:49