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 edm::Run &iRun)
 
void book (const std::string dirname, const std::map< unsigned int, std::string > &labels)
 
void book (const std::string dirname)
 
 DigiInvestigatorHistogramMaker (edm::ConsumesCollector &&iC)
 
 DigiInvestigatorHistogramMaker (const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC)
 
void fill (const edm::Event &iEvent, const std::map< unsigned int, int > &ndigi)
 
 ~DigiInvestigatorHistogramMaker ()
 

Private Attributes

std::map< unsigned int, int > _binmax
 
RunHistogramManager _fhm
 
const bool _fillHisto
 
std::string _hitname
 
std::map< unsigned int,
std::string > 
_labels
 
const int _nbins
 
std::map< unsigned int, TH1F * > _nmult
 
std::map< unsigned int,
TProfile ** > 
_nmultvsbxfill
 
std::map< unsigned int,
TProfile ** > 
_nmultvsbxrun
 
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 18 of file DigiInvestigatorHistogramMaker.h.

Constructor & Destructor Documentation

DigiInvestigatorHistogramMaker::DigiInvestigatorHistogramMaker ( edm::ConsumesCollector &&  iC)

Definition at line 13 of file DigiInvestigatorHistogramMaker.cc.

13  :
14  _hitname(), _nbins(500), m_maxLS(100), m_LSfrac(4), _scalefact(), _runHisto(true), _fillHisto(false), _binmax(), _labels(), _rhm(iC), _fhm(iC,true), _nmultvsorbrun(),
std::map< unsigned int, TProfile ** > _nmultvsbxrun
std::map< unsigned int, TH1F * > _nmult
std::map< unsigned int, std::string > _labels
std::map< unsigned int, TProfile ** > _nmultvsbxfill
std::map< unsigned int, TProfile ** > _nmultvsorbrun
DigiInvestigatorHistogramMaker::DigiInvestigatorHistogramMaker ( const edm::ParameterSet iConfig,
edm::ConsumesCollector &&  iC 
)

Definition at line 17 of file DigiInvestigatorHistogramMaker.cc.

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

17  :
18  _hitname(iConfig.getUntrackedParameter<std::string>("hitName","digi")),
19  _nbins(iConfig.getUntrackedParameter<int>("numberOfBins",500)),
20  m_maxLS(iConfig.getUntrackedParameter<unsigned int>("maxLSBeforeRebin",100)),
21  m_LSfrac(iConfig.getUntrackedParameter<unsigned int>("startingLSFraction",4)),
22  _scalefact(iConfig.getUntrackedParameter<int>("scaleFactor",5)),
23  _runHisto(iConfig.getUntrackedParameter<bool>("runHisto",true)),
24  _fillHisto(iConfig.getUntrackedParameter<bool>("fillHisto",false)),
26 {
27 
28  std::vector<edm::ParameterSet>
29  wantedsubds(iConfig.getUntrackedParameter<std::vector<edm::ParameterSet> >("wantedSubDets",std::vector<edm::ParameterSet>()));
30 
31  for(std::vector<edm::ParameterSet>::iterator ps=wantedsubds.begin();ps!=wantedsubds.end();++ps) {
32  _labels[ps->getParameter<unsigned int>("detSelection")] = ps->getParameter<std::string>("detLabel");
33  _binmax[ps->getParameter<unsigned int>("detSelection")] = ps->getParameter<int>("binMax");
34  }
35 
36 
37 }
T getUntrackedParameter(std::string const &, T const &) const
std::map< unsigned int, TProfile ** > _nmultvsbxrun
std::map< unsigned int, TH1F * > _nmult
std::map< unsigned int, std::string > _labels
std::map< unsigned int, TProfile ** > _nmultvsbxfill
std::map< unsigned int, TFileDirectory * > _subdirs
std::map< unsigned int, TProfile ** > _nmultvsorbrun
DigiInvestigatorHistogramMaker::~DigiInvestigatorHistogramMaker ( )

Definition at line 40 of file DigiInvestigatorHistogramMaker.cc.

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

40  {
41 
42  for(std::map<unsigned int,std::string>::const_iterator lab=_labels.begin();lab!=_labels.end();lab++) {
43 
44  const unsigned int i = lab->first; const std::string slab = lab->second;
45 
46  delete _subdirs[i];
47  }
48 
49 }
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 edm::Run iRun)

Definition at line 123 of file DigiInvestigatorHistogramMaker.cc.

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

Referenced by MultiplicityInvestigator::beginRun().

123  {
124 
125  // char runname[100];
126  // sprintf(runname,"run_%d",nrun);
127 
129 
130  // currdir = &(*tfserv);
131  // _rhm.beginRun(nrun,*currdir);
132 
133  _rhm.beginRun(iRun,tfserv->tFileDirectory());
134  _fhm.beginRun(iRun,tfserv->tFileDirectory());
135 
136 
137  for(std::map<unsigned int,std::string>::const_iterator lab=_labels.begin();lab!=_labels.end();++lab) {
138 
139  const int i = lab->first; const std::string slab = lab->second;
140 
141  // char name[200];
142  // char title[500];
143 
144  // TFileDirectory subd =_subdirs[i]->mkdir(runname);
145 
146  // sprintf(name,"n%sdigivsorbrun",slab.c_str());
147  // sprintf(title,"%s %s mean multiplicity vs orbit",slab.c_str(),_hitname.c_str());
148  // _nmultvsorbrun[i] = subd.make<TProfile>(name,title,_norbbin,0.5,11223*_norbbin+0.5);
149  if(_runHisto) {
150  if(*_nmultvsorbrun[i]) {
151  (*_nmultvsorbrun[i])->GetXaxis()->SetTitle("time [orbit#]"); (*_nmultvsorbrun[i])->GetYaxis()->SetTitle("Hits");
152  (*_nmultvsorbrun[i])->SetCanExtend(TH1::kXaxis);
153  }
154  if(*_nmultvsbxrun[i]) {
155  (*_nmultvsbxrun[i])->GetXaxis()->SetTitle("BX#"); (*_nmultvsbxrun[i])->GetYaxis()->SetTitle("Mean Number of Hits");
156  }
157  }
158  if(_fillHisto) {
159  if(*_nmultvsbxfill[i]) {
160  (*_nmultvsbxfill[i])->GetXaxis()->SetTitle("BX#"); (*_nmultvsbxfill[i])->GetYaxis()->SetTitle("Mean Number of Hits");
161  }
162  }
163  }
164 
165 
166 }
int i
Definition: DBlmapReader.cc:9
std::map< unsigned int, TProfile ** > _nmultvsbxrun
std::map< unsigned int, std::string > _labels
TFileDirectory & tFileDirectory()
Definition: TFileService.h:42
std::map< unsigned int, TProfile ** > _nmultvsbxfill
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 53 of file DigiInvestigatorHistogramMaker.cc.

References _labels, and HLT_FULL_cff::labels.

Referenced by MultiplicityInvestigator::MultiplicityInvestigator().

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

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

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

Definition at line 168 of file DigiInvestigatorHistogramMaker.cc.

References _fillHisto, _labels, _nmult, _nmultvsbxfill, _nmultvsbxrun, _nmultvsorbrun, _runHisto, edm::EventBase::bunchCrossing(), HcalObjRepresent::Fill(), i, and edm::EventBase::orbitNumber().

Referenced by MultiplicityInvestigator::analyze().

168  {
169 
170  for(std::map<unsigned int,int>::const_iterator digi=ndigi.begin();digi!=ndigi.end();digi++) {
171 
172  if(_labels.find(digi->first) != _labels.end()) {
173 
174  const unsigned int i=digi->first;
175 
176  _nmult[i]->Fill(digi->second);
177  if(_runHisto) {
178  if(_nmultvsorbrun[i] && *_nmultvsorbrun[i]) (*_nmultvsorbrun[i])->Fill(iEvent.orbitNumber(),digi->second);
179  if(_nmultvsbxrun[i] && *_nmultvsbxrun[i]) (*_nmultvsbxrun[i])->Fill(iEvent.bunchCrossing()%3564,digi->second);
180  }
181  if(_fillHisto) {
182  if(_nmultvsbxfill[i] && *_nmultvsbxfill[i]) (*_nmultvsbxfill[i])->Fill(iEvent.bunchCrossing()%3564,digi->second);
183  }
184  }
185 
186  }
187 }
int i
Definition: DBlmapReader.cc:9
std::map< unsigned int, TProfile ** > _nmultvsbxrun
std::map< unsigned int, TH1F * > _nmult
int bunchCrossing() const
Definition: EventBase.h:64
std::map< unsigned int, std::string > _labels
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
int orbitNumber() const
Definition: EventBase.h:65
std::map< unsigned int, TProfile ** > _nmultvsbxfill
std::map< unsigned int, TProfile ** > _nmultvsorbrun

Member Data Documentation

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

Definition at line 40 of file DigiInvestigatorHistogramMaker.h.

Referenced by book(), and DigiInvestigatorHistogramMaker().

RunHistogramManager DigiInvestigatorHistogramMaker::_fhm
private

Definition at line 45 of file DigiInvestigatorHistogramMaker.h.

Referenced by beginRun(), and book().

const bool DigiInvestigatorHistogramMaker::_fillHisto
private

Definition at line 39 of file DigiInvestigatorHistogramMaker.h.

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

std::string DigiInvestigatorHistogramMaker::_hitname
private

Definition at line 33 of file DigiInvestigatorHistogramMaker.h.

Referenced by book().

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

Definition at line 34 of file DigiInvestigatorHistogramMaker.h.

Referenced by book().

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

Definition at line 49 of file DigiInvestigatorHistogramMaker.h.

Referenced by book(), and fill().

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

Definition at line 48 of file DigiInvestigatorHistogramMaker.h.

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

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

Definition at line 47 of file DigiInvestigatorHistogramMaker.h.

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

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

Definition at line 46 of file DigiInvestigatorHistogramMaker.h.

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

RunHistogramManager DigiInvestigatorHistogramMaker::_rhm
private

Definition at line 44 of file DigiInvestigatorHistogramMaker.h.

Referenced by beginRun(), and book().

const bool DigiInvestigatorHistogramMaker::_runHisto
private

Definition at line 38 of file DigiInvestigatorHistogramMaker.h.

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

int DigiInvestigatorHistogramMaker::_scalefact
private

Definition at line 37 of file DigiInvestigatorHistogramMaker.h.

Referenced by book().

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

Definition at line 50 of file DigiInvestigatorHistogramMaker.h.

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

const unsigned int DigiInvestigatorHistogramMaker::m_LSfrac
private

Definition at line 36 of file DigiInvestigatorHistogramMaker.h.

Referenced by book().

const unsigned int DigiInvestigatorHistogramMaker::m_maxLS
private

Definition at line 35 of file DigiInvestigatorHistogramMaker.h.

Referenced by book().