CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 // $Id: HcalTB02Histo.cc,v 1.3 2008/07/24 15:19:16 sunanda Exp $
12 //
13 
14 // system include files
15 #include <iostream>
16 #include <cmath>
17 
18 // user include files
23 
24 //
25 // constructors and destructor
27  rt_tbTimes(0), rt_TransProf(0) {
28 
29  verbose = ps.getUntrackedParameter<bool>("Verbose", false);
30  edm::LogInfo("HcalTBSim") << "HcalTB02Histo:: initialised with o/p file "
31  << fileName << " verbosity " << verbose;
32 
33  // Book histograms
35 
36  if ( !tfile.isAvailable() )
37  throw cms::Exception("BadConfig") << "TFileService unavailable: "
38  << "please add it to config file";
39 
40  char title[80];
41  for (int ilayer=0; ilayer<19; ilayer++) {
42  sprintf(title, "Scint. Energy in Layer %d ", ilayer);
43  TH1D *h = tfile->make<TH1D>(title, title, 500, 0., 1.5);
44  rt_histoProf.push_back(h);
45  edm::LogInfo("HcalTBSim") << "HcalTB02Histo:: Initialise Histo " <<title;
46  }
47  sprintf(title, "All Hit Time slices");
48  rt_tbTimes = tfile->make<TH1D>(title, title, 100, 0., 100.);
49  edm::LogInfo("HcalTBSim") << "HcalTB02Histo:: Initialise Histo " << title;
50  sprintf(title, "Transv. Shower Profile");
51  rt_TransProf = tfile->make<TH2D>(title, title, 100, 0., 1., 1000, 0., 0.5);
52  edm::LogInfo("HcalTBSim") << "HcalTB02Histo:: Initialise Histo " << title;
53 }
54 
56  edm::LogInfo("HcalTBSim") << " Deleting HcalTB02Histo";
57 }
58 
59 //
60 // member functions
61 //
62 
64 
65  LogDebug("HcalTBSim") << "HcalTB02Histo::Fill Time histo with " << v;
66  if (rt_tbTimes) {
67  rt_tbTimes->Fill(v);
68  }
69 }
70 
71 void HcalTB02Histo::fillTransProf(float u, float v) {
72 
73  LogDebug("HcalTBSim") << "HcalTB02Histo:::Fill Shower Transv. Profile histo"
74  << " with " << u << " and " << v;
75  if (rt_TransProf) {
76  rt_TransProf->Fill(u,v);
77  }
78 }
79 
80 void HcalTB02Histo::fillProfile(int ilayer, float value) {
81 
82  if (ilayer < (int)(rt_histoProf.size())) {
83  rt_histoProf[ilayer]->Fill(value);
84  LogDebug("HcalTBSim") << "HcalTB02Histo::Fill profile " << ilayer
85  << " with " << value;
86  }
87 }
88 
89 float HcalTB02Histo::getMean(int ilayer) {
90 
91  if (ilayer < (int)(rt_histoProf.size())) {
92  return rt_histoProf[ilayer]->GetMean();
93  } else {
94  return 0;
95  }
96 }
97 
98 float HcalTB02Histo::getRMS(int ilayer) {
99 
100  if (ilayer < (int)(rt_histoProf.size())) {
101  return rt_histoProf[ilayer]->GetRMS();
102  } else {
103  return 0;
104  }
105 }
#define LogDebug(id)
T getUntrackedParameter(std::string const &, T const &) const
void fillTransProf(float u, float v)
std::vector< TH1D * > rt_histoProf
Definition: HcalTB02Histo.h:54
void fillAllTime(float v)
bool isAvailable() const
Definition: Service.h:47
HcalTB02Histo(const edm::ParameterSet &ps)
float getMean(int ilayer)
TH2D * rt_TransProf
Definition: HcalTB02Histo.h:53
void fillProfile(int ilayer, float value)
TH1D * rt_tbTimes
Definition: HcalTB02Histo.h:52
T * make() const
make new ROOT object
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
virtual ~HcalTB02Histo()
std::string fileName
Definition: HcalTB02Histo.h:49
float getRMS(int ilayer)
mathSSE::Vec4< T > v