CMS 3D CMS Logo

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)
 
void book (const std::string dirname, const std::map< unsigned int, std::string > &labels)
 
 DigiInvestigatorHistogramMaker (const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC)
 
 DigiInvestigatorHistogramMaker (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() [1/2]

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

Definition at line 12 of file DigiInvestigatorHistogramMaker.cc.

13  : _hitname(),
14  _nbins(500),
15  m_maxLS(100),
16  m_LSfrac(4),
17  _scalefact(),
18  _runHisto(true),
19  _fillHisto(false),
20  _binmax(),
21  _labels(),
22  _rhm(iC),
23  _fhm(iC, true),
25  _nmultvsbxrun(),
27  _nmult() {}

◆ DigiInvestigatorHistogramMaker() [2/2]

DigiInvestigatorHistogramMaker::DigiInvestigatorHistogramMaker ( const edm::ParameterSet iConfig,
edm::ConsumesCollector &&  iC 
)

Definition at line 29 of file DigiInvestigatorHistogramMaker.cc.

31  : _hitname(iConfig.getUntrackedParameter<std::string>("hitName", "digi")),
32  _nbins(iConfig.getUntrackedParameter<int>("numberOfBins", 500)),
33  m_maxLS(iConfig.getUntrackedParameter<unsigned int>("maxLSBeforeRebin", 100)),
34  m_LSfrac(iConfig.getUntrackedParameter<unsigned int>("startingLSFraction", 4)),
35  _scalefact(iConfig.getUntrackedParameter<int>("scaleFactor", 5)),
36  _runHisto(iConfig.getUntrackedParameter<bool>("runHisto", true)),
37  _fillHisto(iConfig.getUntrackedParameter<bool>("fillHisto", false)),
38  _labels(),
39  _rhm(iC),
40  _fhm(iC, true),
42  _nmultvsbxrun(),
44  _nmult(),
45  _subdirs() {
46  std::vector<edm::ParameterSet> wantedsubds(iConfig.getUntrackedParameter<std::vector<edm::ParameterSet> >(
47  "wantedSubDets", std::vector<edm::ParameterSet>()));
48 
49  for (std::vector<edm::ParameterSet>::iterator ps = wantedsubds.begin(); ps != wantedsubds.end(); ++ps) {
50  _labels[ps->getParameter<unsigned int>("detSelection")] = ps->getParameter<std::string>("detLabel");
51  _binmax[ps->getParameter<unsigned int>("detSelection")] = ps->getParameter<int>("binMax");
52  }
53 }

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

◆ ~DigiInvestigatorHistogramMaker()

DigiInvestigatorHistogramMaker::~DigiInvestigatorHistogramMaker ( )

Definition at line 55 of file DigiInvestigatorHistogramMaker.cc.

55  {
56  for (std::map<unsigned int, std::string>::const_iterator lab = _labels.begin(); lab != _labels.end(); lab++) {
57  const unsigned int i = lab->first;
58  const std::string slab = lab->second;
59 
60  delete _subdirs[i];
61  }
62 }

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

Member Function Documentation

◆ beginRun()

void DigiInvestigatorHistogramMaker::beginRun ( const edm::Run iRun)

Definition at line 128 of file DigiInvestigatorHistogramMaker.cc.

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

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

Referenced by MultiplicityInvestigator::beginRun().

◆ book() [1/2]

void DigiInvestigatorHistogramMaker::book ( const std::string  dirname)

Definition at line 70 of file DigiInvestigatorHistogramMaker.cc.

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

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

◆ book() [2/2]

void DigiInvestigatorHistogramMaker::book ( const std::string  dirname,
const std::map< unsigned int, std::string > &  labels 
)

◆ fill()

void DigiInvestigatorHistogramMaker::fill ( const edm::Event iEvent,
const std::map< unsigned int, int > &  ndigi 
)

Definition at line 172 of file DigiInvestigatorHistogramMaker.cc.

172  {
173  for (std::map<unsigned int, int>::const_iterator digi = ndigi.begin(); digi != ndigi.end(); digi++) {
174  if (_labels.find(digi->first) != _labels.end()) {
175  const unsigned int i = digi->first;
176 
177  _nmult[i]->Fill(digi->second);
178  if (_runHisto) {
179  if (_nmultvsorbrun[i] && *_nmultvsorbrun[i])
180  (*_nmultvsorbrun[i])->Fill(iEvent.orbitNumber(), digi->second);
181  if (_nmultvsbxrun[i] && *_nmultvsbxrun[i])
182  (*_nmultvsbxrun[i])->Fill(iEvent.bunchCrossing() % 3564, digi->second);
183  }
184  if (_fillHisto) {
185  if (_nmultvsbxfill[i] && *_nmultvsbxfill[i])
186  (*_nmultvsbxfill[i])->Fill(iEvent.bunchCrossing() % 3564, digi->second);
187  }
188  }
189  }
190 }

References _fillHisto, _labels, _nmult, _nmultvsbxfill, _nmultvsbxrun, _nmultvsorbrun, _runHisto, HcalObjRepresent::Fill(), mps_fire::i, and iEvent.

Referenced by MultiplicityInvestigator::analyze().

Member Data Documentation

◆ _binmax

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

Definition at line 38 of file DigiInvestigatorHistogramMaker.h.

Referenced by book(), and DigiInvestigatorHistogramMaker().

◆ _fhm

RunHistogramManager DigiInvestigatorHistogramMaker::_fhm
private

Definition at line 42 of file DigiInvestigatorHistogramMaker.h.

Referenced by beginRun(), and book().

◆ _fillHisto

const bool DigiInvestigatorHistogramMaker::_fillHisto
private

Definition at line 37 of file DigiInvestigatorHistogramMaker.h.

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

◆ _hitname

std::string DigiInvestigatorHistogramMaker::_hitname
private

Definition at line 31 of file DigiInvestigatorHistogramMaker.h.

Referenced by book().

◆ _labels

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

◆ _nbins

const int DigiInvestigatorHistogramMaker::_nbins
private

Definition at line 32 of file DigiInvestigatorHistogramMaker.h.

Referenced by book().

◆ _nmult

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

Definition at line 46 of file DigiInvestigatorHistogramMaker.h.

Referenced by book(), and fill().

◆ _nmultvsbxfill

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

Definition at line 45 of file DigiInvestigatorHistogramMaker.h.

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

◆ _nmultvsbxrun

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

Definition at line 44 of file DigiInvestigatorHistogramMaker.h.

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

◆ _nmultvsorbrun

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

Definition at line 43 of file DigiInvestigatorHistogramMaker.h.

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

◆ _rhm

RunHistogramManager DigiInvestigatorHistogramMaker::_rhm
private

Definition at line 41 of file DigiInvestigatorHistogramMaker.h.

Referenced by beginRun(), and book().

◆ _runHisto

const bool DigiInvestigatorHistogramMaker::_runHisto
private

Definition at line 36 of file DigiInvestigatorHistogramMaker.h.

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

◆ _scalefact

int DigiInvestigatorHistogramMaker::_scalefact
private

Definition at line 35 of file DigiInvestigatorHistogramMaker.h.

Referenced by book().

◆ _subdirs

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

Definition at line 47 of file DigiInvestigatorHistogramMaker.h.

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

◆ m_LSfrac

const unsigned int DigiInvestigatorHistogramMaker::m_LSfrac
private

Definition at line 34 of file DigiInvestigatorHistogramMaker.h.

Referenced by book().

◆ m_maxLS

const unsigned int DigiInvestigatorHistogramMaker::m_maxLS
private

Definition at line 33 of file DigiInvestigatorHistogramMaker.h.

Referenced by book().

SummaryClient_cfi.labels
labels
Definition: SummaryClient_cfi.py:61
DigiInvestigatorHistogramMaker::_fhm
RunHistogramManager _fhm
Definition: DigiInvestigatorHistogramMaker.h:42
TFileDirectory::mkdir
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
Definition: TFileDirectory.cc:112
mps_fire.i
i
Definition: mps_fire.py:355
DigiInvestigatorHistogramMaker::_nmult
std::map< unsigned int, TH1F * > _nmult
Definition: DigiInvestigatorHistogramMaker.h:46
DigiInvestigatorHistogramMaker::_subdirs
std::map< unsigned int, TFileDirectory * > _subdirs
Definition: DigiInvestigatorHistogramMaker.h:47
DigiInvestigatorHistogramMaker::_nmultvsbxrun
std::map< unsigned int, TProfile ** > _nmultvsbxrun
Definition: DigiInvestigatorHistogramMaker.h:44
DigiInvestigatorHistogramMaker::m_maxLS
const unsigned int m_maxLS
Definition: DigiInvestigatorHistogramMaker.h:33
DigiInvestigatorHistogramMaker::_rhm
RunHistogramManager _rhm
Definition: DigiInvestigatorHistogramMaker.h:41
edm::LogInfo
Definition: MessageLogger.h:254
TFileService::tFileDirectory
TFileDirectory & tFileDirectory()
Definition: TFileService.h:42
DigiInvestigatorHistogramMaker::_fillHisto
const bool _fillHisto
Definition: DigiInvestigatorHistogramMaker.h:37
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
TFileDirectory
Definition: TFileDirectory.h:24
DigiInvestigatorHistogramMaker::_labels
std::map< unsigned int, std::string > _labels
Definition: DigiInvestigatorHistogramMaker.h:39
BTVHLTOfflineSource_cfi.dirname
dirname
Definition: BTVHLTOfflineSource_cfi.py:7
DigiInvestigatorHistogramMaker::_hitname
std::string _hitname
Definition: DigiInvestigatorHistogramMaker.h:31
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
TFileService::mkdir
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
Definition: TFileService.h:69
DigiInvestigatorHistogramMaker::_scalefact
int _scalefact
Definition: DigiInvestigatorHistogramMaker.h:35
SiStripTKNumbers::nstrips
int nstrips(const DetId &detid) const
Definition: SiStripTKNumbers.cc:81
RunHistogramManager::beginRun
void beginRun(const edm::Run &iRun)
Definition: RunHistogramManager.cc:101
edm::Service< TFileService >
iEvent
int iEvent
Definition: GenABIO.cc:224
DigiInvestigatorHistogramMaker::book
void book(const std::string dirname, const std::map< unsigned int, std::string > &labels)
Definition: DigiInvestigatorHistogramMaker.cc:64
edm::LogVerbatim
Definition: MessageLogger.h:297
DigiInvestigatorHistogramMaker::m_LSfrac
const unsigned int m_LSfrac
Definition: DigiInvestigatorHistogramMaker.h:34
HcalObjRepresent::Fill
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
Definition: HcalObjRepresent.h:1053
overlapproblemtsosanalyzer_cfi.title
title
Definition: overlapproblemtsosanalyzer_cfi.py:7
DigiInvestigatorHistogramMaker::_binmax
std::map< unsigned int, int > _binmax
Definition: DigiInvestigatorHistogramMaker.h:38
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
DigiInvestigatorHistogramMaker::_runHisto
const bool _runHisto
Definition: DigiInvestigatorHistogramMaker.h:36
DigiInvestigatorHistogramMaker::_nbins
const int _nbins
Definition: DigiInvestigatorHistogramMaker.h:32
DigiInvestigatorHistogramMaker::_nmultvsbxfill
std::map< unsigned int, TProfile ** > _nmultvsbxfill
Definition: DigiInvestigatorHistogramMaker.h:45
SiStripTKNumbers
Definition: SiStripTKNumbers.h:8
RunHistogramManager::makeTProfile
TProfile ** makeTProfile(const char *name, const char *title, const unsigned int nbinx, const double xmin, const double xmax)
Definition: RunHistogramManager.cc:52
DigiInvestigatorHistogramMaker::_nmultvsorbrun
std::map< unsigned int, TProfile ** > _nmultvsorbrun
Definition: DigiInvestigatorHistogramMaker.h:43