CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
DigiInvestigatorHistogramMaker Class Reference

#include <DigiInvestigatorHistogramMaker.h>

Public Member Functions

void beginRun (const unsigned int nrun)
 
void book (const std::string dirname, const std::map< unsigned int, std::string > &labels)
 
void book (const std::string dirname)
 
 DigiInvestigatorHistogramMaker ()
 
 DigiInvestigatorHistogramMaker (const edm::ParameterSet &iConfig)
 
void fill (const unsigned int orbit, const std::map< unsigned int, int > &ndigi)
 
 ~DigiInvestigatorHistogramMaker ()
 

Private Attributes

std::map< unsigned int, int > _binmax
 
std::string _hitname
 
std::map< unsigned int,
std::string > 
_labels
 
const int _nbins
 
std::map< unsigned int, TH1F * > _nmult
 
std::map< unsigned int,
TProfile ** > 
_nmultvsorbrun
 
const int _norbbin
 
RunHistogramManager _rhm
 
const bool _runHisto
 
int _scalefact
 
std::map< unsigned int,
TFileDirectory * > 
_subdirs
 

Detailed Description

Definition at line 15 of file DigiInvestigatorHistogramMaker.h.

Constructor & Destructor Documentation

DigiInvestigatorHistogramMaker::DigiInvestigatorHistogramMaker ( )
DigiInvestigatorHistogramMaker::DigiInvestigatorHistogramMaker ( const edm::ParameterSet iConfig)

Definition at line 15 of file DigiInvestigatorHistogramMaker.cc.

References _binmax, _labels, and edm::ParameterSet::getUntrackedParameter().

15  :
16  _hitname(iConfig.getUntrackedParameter<std::string>("hitName","digi")),
17  _nbins(iConfig.getUntrackedParameter<int>("numberOfBins",500)),
18  _norbbin(iConfig.getUntrackedParameter<int>("orbitNbin",3600)),
19  _scalefact(iConfig.getUntrackedParameter<int>("scaleFactor",5)),
20  _runHisto(iConfig.getUntrackedParameter<bool>("runHisto",true)),
22 {
23 
24  std::vector<edm::ParameterSet>
25  wantedsubds(iConfig.getUntrackedParameter<std::vector<edm::ParameterSet> >("wantedSubDets",std::vector<edm::ParameterSet>()));
26 
27  for(std::vector<edm::ParameterSet>::iterator ps=wantedsubds.begin();ps!=wantedsubds.end();++ps) {
28  _labels[ps->getParameter<unsigned int>("detSelection")] = ps->getParameter<std::string>("detLabel");
29  _binmax[ps->getParameter<unsigned int>("detSelection")] = ps->getParameter<int>("binMax");
30  }
31 
32 
33 }
T getUntrackedParameter(std::string const &, T const &) const
std::map< unsigned int, TH1F * > _nmult
std::map< unsigned int, std::string > _labels
std::map< unsigned int, TFileDirectory * > _subdirs
std::map< unsigned int, TProfile ** > _nmultvsorbrun
DigiInvestigatorHistogramMaker::~DigiInvestigatorHistogramMaker ( )

Definition at line 36 of file DigiInvestigatorHistogramMaker.cc.

References _labels, _subdirs, and i.

36  {
37 
38  for(std::map<unsigned int,std::string>::const_iterator lab=_labels.begin();lab!=_labels.end();lab++) {
39 
40  const unsigned int i = lab->first; const std::string slab = lab->second;
41 
42  delete _subdirs[i];
43  }
44 
45 }
int i
Definition: DBlmapReader.cc:9
std::map< unsigned int, std::string > _labels
std::map< unsigned int, TFileDirectory * > _subdirs

Member Function Documentation

void DigiInvestigatorHistogramMaker::beginRun ( const unsigned int  nrun)

Definition at line 110 of file DigiInvestigatorHistogramMaker.cc.

References _labels, _nmultvsorbrun, _rhm, _runHisto, RunHistogramManager::beginRun(), and i.

Referenced by MultiplicityInvestigator::beginRun().

110  {
111 
112  // char runname[100];
113  // sprintf(runname,"run_%d",nrun);
114 
116 
117  // currdir = &(*tfserv);
118  // _rhm.beginRun(nrun,*currdir);
119 
120  _rhm.beginRun(nrun,*tfserv);
121 
122 
123  for(std::map<unsigned int,std::string>::const_iterator lab=_labels.begin();lab!=_labels.end();++lab) {
124 
125  const int i = lab->first; const std::string slab = lab->second;
126 
127  // char name[200];
128  // char title[500];
129 
130  // TFileDirectory subd =_subdirs[i]->mkdir(runname);
131 
132  // sprintf(name,"n%sdigivsorbrun",slab.c_str());
133  // sprintf(title,"%s %s mean multiplicity vs orbit",slab.c_str(),_hitname.c_str());
134  // _nmultvsorbrun[i] = subd.make<TProfile>(name,title,_norbbin,0.5,11223*_norbbin+0.5);
135  if(_runHisto) {
136  (*_nmultvsorbrun[i])->GetXaxis()->SetTitle("time [orbit#]"); (*_nmultvsorbrun[i])->GetYaxis()->SetTitle("Hits");
137  (*_nmultvsorbrun[i])->SetBit(TH1::kCanRebin);
138  }
139  }
140 
141 
142 }
int i
Definition: DBlmapReader.cc:9
std::map< unsigned int, std::string > _labels
void beginRun(const edm::Run &iRun)
std::map< unsigned int, TProfile ** > _nmultvsorbrun
void DigiInvestigatorHistogramMaker::book ( const std::string  dirname,
const std::map< unsigned int, std::string > &  labels 
)

Definition at line 49 of file DigiInvestigatorHistogramMaker.cc.

References _labels, and reco_calib_source_client_cfg::labels.

Referenced by MultiplicityInvestigator::MultiplicityInvestigator().

49  {
50 
51  _labels = labels;
52  book(dirname);
53 
54 }
void book(const std::string dirname, const std::map< unsigned int, std::string > &labels)
std::map< unsigned int, std::string > _labels
void DigiInvestigatorHistogramMaker::book ( const std::string  dirname)

Definition at line 56 of file DigiInvestigatorHistogramMaker.cc.

References _binmax, _hitname, _labels, _nbins, _nmult, _nmultvsorbrun, _norbbin, _rhm, _runHisto, _scalefact, _subdirs, i, RunHistogramManager::makeTProfile(), TFileDirectory::mkdir(), mergeVDriftHistosByStation::name, SiStripTKNumbers::nstrips(), and indexGen::title.

56  {
57 
59  TFileDirectory subev = tfserv->mkdir(dirname);
60 
61  SiStripTKNumbers trnumb;
62 
63  edm::LogInfo("NumberOfBins") << "Number of Bins: " << _nbins;
64  edm::LogInfo("NumberOfOrbitBins") << "Number of Orbit Bins: " << _norbbin;
65  edm::LogInfo("ScaleFactors") << "x-axis range scale factor: " << _scalefact;
66  edm::LogInfo("BinMaxValue") << "Setting bin max values";
67 
68  for(std::map<unsigned int,std::string>::const_iterator lab=_labels.begin();lab!=_labels.end();lab++) {
69 
70  const unsigned int i = lab->first; const std::string slab = lab->second;
71 
72  if(_binmax.find(i)==_binmax.end()) {
73  edm::LogVerbatim("NotConfiguredBinMax") << "Bin max for " << lab->second
74  << " not configured: " << trnumb.nstrips(i) << " used";
75  _binmax[i] = trnumb.nstrips(i);
76  }
77 
78  edm::LogVerbatim("BinMaxValue") << "Bin max for " << lab->second << " is " << _binmax[i];
79 
80  }
81 
82  for(std::map<unsigned int,std::string>::const_iterator lab=_labels.begin();lab!=_labels.end();++lab) {
83 
84  const int i = lab->first; const std::string slab = lab->second;
85 
86  char name[200];
87  char title[500];
88 
89  _subdirs[i] = new TFileDirectory(subev.mkdir(slab.c_str()));
90 
91  if(_subdirs[i]) {
92  sprintf(name,"n%sdigi",slab.c_str());
93  sprintf(title,"%s %s multiplicity",slab.c_str(),_hitname.c_str());
94  _nmult[i] = _subdirs[i]->make<TH1F>(name,title,_nbins,0.,_binmax[i]/(_scalefact*_nbins)*_nbins);
95  _nmult[i]->GetXaxis()->SetTitle("Number of Hits"); _nmult[i]->GetYaxis()->SetTitle("Events");
96 
97  if(_runHisto) {
98  sprintf(name,"n%sdigivsorbrun",slab.c_str());
99  sprintf(title,"%s %s mean multiplicity vs orbit",slab.c_str(),_hitname.c_str());
100  _nmultvsorbrun[i] = _rhm.makeTProfile(name,title,_norbbin,0.5,11223*_norbbin+0.5);
101  }
102 
103  }
104 
105  }
106 
107 
108 }
int i
Definition: DBlmapReader.cc:9
std::map< unsigned int, TH1F * > _nmult
std::map< unsigned int, std::string > _labels
int nstrips(const SiStripDetId &detid) const
TProfile ** makeTProfile(const char *name, const char *title, const unsigned int nbinx, const double xmin, const double xmax)
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
std::map< unsigned int, TFileDirectory * > _subdirs
std::map< unsigned int, TProfile ** > _nmultvsorbrun
void DigiInvestigatorHistogramMaker::fill ( const unsigned int  orbit,
const std::map< unsigned int, int > &  ndigi 
)

Definition at line 144 of file DigiInvestigatorHistogramMaker.cc.

References _labels, _nmult, _nmultvsorbrun, _runHisto, HcalObjRepresent::Fill(), and i.

Referenced by MultiplicityInvestigator::analyze().

144  {
145 
146  for(std::map<unsigned int,int>::const_iterator digi=ndigi.begin();digi!=ndigi.end();digi++) {
147 
148  if(_labels.find(digi->first) != _labels.end()) {
149 
150  const unsigned int i=digi->first;
151 
152  _nmult[i]->Fill(digi->second);
153  if(_runHisto) {
154  if(_nmultvsorbrun[i] && *_nmultvsorbrun[i]) (*_nmultvsorbrun[i])->Fill(orbit,digi->second);
155  }
156  }
157 
158  }
159 }
int i
Definition: DBlmapReader.cc:9
std::map< unsigned int, TH1F * > _nmult
std::map< unsigned int, std::string > _labels
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
std::map< unsigned int, TProfile ** > _nmultvsorbrun

Member Data Documentation

std::map<unsigned int,int> DigiInvestigatorHistogramMaker::_binmax
private

Definition at line 35 of file DigiInvestigatorHistogramMaker.h.

Referenced by book(), and DigiInvestigatorHistogramMaker().

std::string DigiInvestigatorHistogramMaker::_hitname
private

Definition at line 30 of file DigiInvestigatorHistogramMaker.h.

Referenced by book().

std::map<unsigned int, std::string> DigiInvestigatorHistogramMaker::_labels
private
const int DigiInvestigatorHistogramMaker::_nbins
private

Definition at line 31 of file DigiInvestigatorHistogramMaker.h.

Referenced by book().

std::map<unsigned int,TH1F*> DigiInvestigatorHistogramMaker::_nmult
private

Definition at line 41 of file DigiInvestigatorHistogramMaker.h.

Referenced by book(), and fill().

std::map<unsigned int,TProfile**> DigiInvestigatorHistogramMaker::_nmultvsorbrun
private

Definition at line 40 of file DigiInvestigatorHistogramMaker.h.

Referenced by beginRun(), book(), and fill().

const int DigiInvestigatorHistogramMaker::_norbbin
private

Definition at line 32 of file DigiInvestigatorHistogramMaker.h.

Referenced by book().

RunHistogramManager DigiInvestigatorHistogramMaker::_rhm
private

Definition at line 39 of file DigiInvestigatorHistogramMaker.h.

Referenced by beginRun(), and book().

const bool DigiInvestigatorHistogramMaker::_runHisto
private

Definition at line 34 of file DigiInvestigatorHistogramMaker.h.

Referenced by beginRun(), book(), and fill().

int DigiInvestigatorHistogramMaker::_scalefact
private

Definition at line 33 of file DigiInvestigatorHistogramMaker.h.

Referenced by book().

std::map<unsigned int,TFileDirectory*> DigiInvestigatorHistogramMaker::_subdirs
private

Definition at line 42 of file DigiInvestigatorHistogramMaker.h.

Referenced by book(), and ~DigiInvestigatorHistogramMaker().