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
 
RunHistogramManager _rhm
 
const bool _runHisto
 
int _scalefact
 
std::map< unsigned int,
TFileDirectory * > 
_subdirs
 
const unsigned int m_LSfrac
 
const unsigned int m_maxLS
 

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, edm::ParameterSet::getUntrackedParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

15  :
16  _hitname(iConfig.getUntrackedParameter<std::string>("hitName","digi")),
17  _nbins(iConfig.getUntrackedParameter<int>("numberOfBins",500)),
18  m_maxLS(iConfig.getUntrackedParameter<unsigned int>("maxLSBeforeRebin",100)),
19  m_LSfrac(iConfig.getUntrackedParameter<unsigned int>("startingLSFraction",4)),
20  _scalefact(iConfig.getUntrackedParameter<int>("scaleFactor",5)),
21  _runHisto(iConfig.getUntrackedParameter<bool>("runHisto",true)),
23 {
24 
25  std::vector<edm::ParameterSet>
26  wantedsubds(iConfig.getUntrackedParameter<std::vector<edm::ParameterSet> >("wantedSubDets",std::vector<edm::ParameterSet>()));
27 
28  for(std::vector<edm::ParameterSet>::iterator ps=wantedsubds.begin();ps!=wantedsubds.end();++ps) {
29  _labels[ps->getParameter<unsigned int>("detSelection")] = ps->getParameter<std::string>("detLabel");
30  _binmax[ps->getParameter<unsigned int>("detSelection")] = ps->getParameter<int>("binMax");
31  }
32 
33 
34 }
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 37 of file DigiInvestigatorHistogramMaker.cc.

References _labels, _subdirs, i, and AlCaHLTBitMon_QueryRunRegistry::string.

37  {
38 
39  for(std::map<unsigned int,std::string>::const_iterator lab=_labels.begin();lab!=_labels.end();lab++) {
40 
41  const unsigned int i = lab->first; const std::string slab = lab->second;
42 
43  delete _subdirs[i];
44  }
45 
46 }
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 112 of file DigiInvestigatorHistogramMaker.cc.

References _labels, _nmultvsorbrun, _rhm, _runHisto, RunHistogramManager::beginRun(), i, AlCaHLTBitMon_QueryRunRegistry::string, and TFileService::tFileDirectory().

Referenced by MultiplicityInvestigator::beginRun().

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

References _labels, and tablePrinter::labels.

Referenced by MultiplicityInvestigator::MultiplicityInvestigator().

50  {
51 
52  _labels = labels;
53  book(dirname);
54 
55 }
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 57 of file DigiInvestigatorHistogramMaker.cc.

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

57  {
58 
60  TFileDirectory subev = tfserv->mkdir(dirname);
61 
62  SiStripTKNumbers trnumb;
63 
64  edm::LogInfo("NumberOfBins") << "Number of Bins: " << _nbins;
65  edm::LogInfo("NumberOfMaxLS") << "Max number of LS before rebinning: " << m_maxLS;
66  edm::LogInfo("StartingLSFrac") << "Fraction of LS in one bin before rebinning: " << m_LSfrac;
67  edm::LogInfo("ScaleFactors") << "x-axis range scale factor: " << _scalefact;
68  edm::LogInfo("BinMaxValue") << "Setting bin max values";
69 
70  for(std::map<unsigned int,std::string>::const_iterator lab=_labels.begin();lab!=_labels.end();lab++) {
71 
72  const unsigned int i = lab->first; const std::string slab = lab->second;
73 
74  if(_binmax.find(i)==_binmax.end()) {
75  edm::LogVerbatim("NotConfiguredBinMax") << "Bin max for " << lab->second
76  << " not configured: " << trnumb.nstrips(i) << " used";
77  _binmax[i] = trnumb.nstrips(i);
78  }
79 
80  edm::LogVerbatim("BinMaxValue") << "Bin max for " << lab->second << " is " << _binmax[i];
81 
82  }
83 
84  for(std::map<unsigned int,std::string>::const_iterator lab=_labels.begin();lab!=_labels.end();++lab) {
85 
86  const int i = lab->first; const std::string slab = lab->second;
87 
88  char name[200];
89  char title[500];
90 
91  _subdirs[i] = new TFileDirectory(subev.mkdir(slab.c_str()));
92 
93  if(_subdirs[i]) {
94  sprintf(name,"n%sdigi",slab.c_str());
95  sprintf(title,"%s %s multiplicity",slab.c_str(),_hitname.c_str());
96  _nmult[i] = _subdirs[i]->make<TH1F>(name,title,_nbins,0.,(1+_binmax[i]/(_scalefact*_nbins))*_nbins);
97  _nmult[i]->GetXaxis()->SetTitle("Number of Hits"); _nmult[i]->GetYaxis()->SetTitle("Events");
98 
99  if(_runHisto) {
100  sprintf(name,"n%sdigivsorbrun",slab.c_str());
101  sprintf(title,"%s %s mean multiplicity vs orbit",slab.c_str(),_hitname.c_str());
102  _nmultvsorbrun[i] = _rhm.makeTProfile(name,title,m_LSfrac*m_maxLS,0,m_maxLS*262144);
103  }
104 
105  }
106 
107  }
108 
109 
110 }
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
Definition: TFileService.h:69
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 145 of file DigiInvestigatorHistogramMaker.cc.

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

Referenced by MultiplicityInvestigator::analyze().

145  {
146 
147  for(std::map<unsigned int,int>::const_iterator digi=ndigi.begin();digi!=ndigi.end();digi++) {
148 
149  if(_labels.find(digi->first) != _labels.end()) {
150 
151  const unsigned int i=digi->first;
152 
153  _nmult[i]->Fill(digi->second);
154  if(_runHisto) {
155  if(_nmultvsorbrun[i] && *_nmultvsorbrun[i]) (*_nmultvsorbrun[i])->Fill(orbit,digi->second);
156  }
157  }
158 
159  }
160 }
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 36 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 42 of file DigiInvestigatorHistogramMaker.h.

Referenced by book(), and fill().

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

Definition at line 41 of file DigiInvestigatorHistogramMaker.h.

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

RunHistogramManager DigiInvestigatorHistogramMaker::_rhm
private

Definition at line 40 of file DigiInvestigatorHistogramMaker.h.

Referenced by beginRun(), and book().

const bool DigiInvestigatorHistogramMaker::_runHisto
private

Definition at line 35 of file DigiInvestigatorHistogramMaker.h.

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

int DigiInvestigatorHistogramMaker::_scalefact
private

Definition at line 34 of file DigiInvestigatorHistogramMaker.h.

Referenced by book().

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

Definition at line 43 of file DigiInvestigatorHistogramMaker.h.

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

const unsigned int DigiInvestigatorHistogramMaker::m_LSfrac
private

Definition at line 33 of file DigiInvestigatorHistogramMaker.h.

Referenced by book().

const unsigned int DigiInvestigatorHistogramMaker::m_maxLS
private

Definition at line 32 of file DigiInvestigatorHistogramMaker.h.

Referenced by book().