CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
DigiVertexCorrHistogramMaker Class Reference

#include <DigiVertexCorrHistogramMaker.h>

Public Member Functions

void beginRun (const edm::Run &iRun)
 
void book (const std::string dirname, const std::map< unsigned int, std::string > &labels, edm::ConsumesCollector &&iC)
 
void book (const std::string dirname, edm::ConsumesCollector &&iC)
 
void book (const std::string dirname, edm::ConsumesCollector &iC)
 
 DigiVertexCorrHistogramMaker ()
 
 DigiVertexCorrHistogramMaker (const edm::ParameterSet &iConfig)
 
void fill (const edm::Event &iEvent, const unsigned int nvtx, const std::map< unsigned int, int > &ndigi)
 
 ~DigiVertexCorrHistogramMaker ()
 

Private Attributes

std::map< unsigned int, int > m_binmax
 
std::map< unsigned int, RunHistogramManager * > m_fhm
 
std::string m_hitname
 
std::map< unsigned int, std::string > m_labels
 
const int m_maxnvtx
 
const int m_nbins
 
std::map< unsigned int, TH2F * > m_nmultvsnvtx
 
std::map< unsigned int, TProfile * > m_nmultvsnvtxprof
 
std::map< unsigned int, TProfile2D ** > m_nmultvsnvtxvsbxprofrun
 
bool m_runHisto
 
const int m_scalefact
 
std::map< unsigned int, TFileDirectory * > m_subdirs
 

Detailed Description

Definition at line 19 of file DigiVertexCorrHistogramMaker.h.

Constructor & Destructor Documentation

◆ DigiVertexCorrHistogramMaker() [1/2]

DigiVertexCorrHistogramMaker::DigiVertexCorrHistogramMaker ( )

Definition at line 13 of file DigiVertexCorrHistogramMaker.cc.

14  : m_fhm(),
15  m_runHisto(false),
16  m_hitname(),
17  m_nbins(500),
18  m_scalefact(),
19  m_maxnvtx(60),
20  m_binmax(),
21  m_labels(),
22  m_nmultvsnvtx(),
25  m_subdirs() {}

◆ DigiVertexCorrHistogramMaker() [2/2]

DigiVertexCorrHistogramMaker::DigiVertexCorrHistogramMaker ( const edm::ParameterSet iConfig)

Definition at line 27 of file DigiVertexCorrHistogramMaker.cc.

28  : m_fhm(),
29  m_runHisto(iConfig.getUntrackedParameter<bool>("runHisto", false)),
30  m_hitname(iConfig.getUntrackedParameter<std::string>("hitName", "digi")),
31  m_nbins(iConfig.getUntrackedParameter<int>("numberOfBins", 500)),
32  m_scalefact(iConfig.getUntrackedParameter<int>("scaleFactor", 5)),
33  m_maxnvtx(iConfig.getUntrackedParameter<int>("maxNvtx", 60)),
34  m_labels(),
35  m_nmultvsnvtx(),
37  m_subdirs() {
38  std::vector<edm::ParameterSet> wantedsubds(iConfig.getUntrackedParameter<std::vector<edm::ParameterSet> >(
39  "wantedSubDets", std::vector<edm::ParameterSet>()));
40 
41  for (std::vector<edm::ParameterSet>::iterator ps = wantedsubds.begin(); ps != wantedsubds.end(); ++ps) {
42  m_labels[ps->getParameter<unsigned int>("detSelection")] = ps->getParameter<std::string>("detLabel");
43  m_binmax[ps->getParameter<unsigned int>("detSelection")] = ps->getParameter<int>("binMax");
44  }
45 }

References edm::ParameterSet::getUntrackedParameter(), m_binmax, m_labels, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ ~DigiVertexCorrHistogramMaker()

DigiVertexCorrHistogramMaker::~DigiVertexCorrHistogramMaker ( )

Definition at line 47 of file DigiVertexCorrHistogramMaker.cc.

47  {
48  for (std::map<unsigned int, std::string>::const_iterator lab = m_labels.begin(); lab != m_labels.end(); lab++) {
49  const unsigned int i = lab->first;
50  const std::string slab = lab->second;
51 
52  delete m_subdirs[i];
53  delete m_fhm[i];
54  }
55 }

References mps_fire::i, m_fhm, m_labels, m_subdirs, and AlCaHLTBitMon_QueryRunRegistry::string.

Member Function Documentation

◆ beginRun()

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

Definition at line 127 of file DigiVertexCorrHistogramMaker.cc.

127  {
129 
130  for (std::map<unsigned int, std::string>::const_iterator lab = m_labels.begin(); lab != m_labels.end(); ++lab) {
131  const int i = lab->first;
132  const std::string slab = lab->second;
133  m_fhm[i]->beginRun(iRun, *m_subdirs[i]);
134  if (m_runHisto) {
135  (*m_nmultvsnvtxvsbxprofrun[i])->GetXaxis()->SetTitle("BX");
136  (*m_nmultvsnvtxvsbxprofrun[i])->GetYaxis()->SetTitle("Nvertices");
137  }
138  }
139 }

References mps_fire::i, m_fhm, m_labels, m_nmultvsnvtxvsbxprofrun, m_runHisto, m_subdirs, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by MultiplicityInvestigator::beginRun().

◆ book() [1/3]

void DigiVertexCorrHistogramMaker::book ( const std::string  dirname,
const std::map< unsigned int, std::string > &  labels,
edm::ConsumesCollector &&  iC 
)

◆ book() [2/3]

void DigiVertexCorrHistogramMaker::book ( const std::string  dirname,
edm::ConsumesCollector &&  iC 
)
inline

Definition at line 27 of file DigiVertexCorrHistogramMaker.h.

27 { book(dirname, iC); }

References book(), and BTVHLTOfflineSource_cfi::dirname.

Referenced by book().

◆ book() [3/3]

void DigiVertexCorrHistogramMaker::book ( const std::string  dirname,
edm::ConsumesCollector iC 
)

Definition at line 64 of file DigiVertexCorrHistogramMaker.cc.

64  {
66  TFileDirectory subev = tfserv->mkdir(dirname);
67 
68  SiStripTKNumbers trnumb;
69 
70  edm::LogInfo("NumberOfBins") << "Number of Bins: " << m_nbins;
71  edm::LogInfo("ScaleFactors") << "y-axis range scale factor: " << m_scalefact;
72  edm::LogInfo("MaxNvtx") << "maximum number of vertices: " << m_maxnvtx;
73  edm::LogInfo("BinMaxValue") << "Setting bin max values";
74 
75  for (std::map<unsigned int, std::string>::const_iterator lab = m_labels.begin(); lab != m_labels.end(); lab++) {
76  const unsigned int i = lab->first;
77  const std::string slab = lab->second;
78 
79  if (m_binmax.find(i) == m_binmax.end()) {
80  edm::LogVerbatim("NotConfiguredBinMax")
81  << "Bin max for " << lab->second << " not configured: " << trnumb.nstrips(i) << " used";
82  m_binmax[i] = trnumb.nstrips(i);
83  }
84 
85  edm::LogVerbatim("BinMaxValue") << "Bin max for " << lab->second << " is " << m_binmax[i];
86  }
87 
88  for (std::map<unsigned int, std::string>::const_iterator lab = m_labels.begin(); lab != m_labels.end(); ++lab) {
89  const int i = lab->first;
90  const std::string slab = lab->second;
91 
92  char name[200];
93  char title[500];
94 
95  m_subdirs[i] = new TFileDirectory(subev.mkdir(slab));
96  m_fhm[i] = new RunHistogramManager(iC, true);
97 
98  if (m_subdirs[i]) {
99  sprintf(name, "n%sdigivsnvtx", slab.c_str());
100  sprintf(title, "%s %s multiplicity vs Nvtx", slab.c_str(), m_hitname.c_str());
101  m_nmultvsnvtx[i] = m_subdirs[i]->make<TH2F>(name,
102  title,
103  m_maxnvtx,
104  -0.5,
105  m_maxnvtx - 0.5,
106  m_nbins,
107  0.,
108  (1 + m_binmax[i] / (m_scalefact * m_nbins)) * m_nbins);
109  m_nmultvsnvtx[i]->GetXaxis()->SetTitle("Number of Vertices");
110  m_nmultvsnvtx[i]->GetYaxis()->SetTitle("Number of Hits");
111  sprintf(name, "n%sdigivsnvtxprof", slab.c_str());
112  m_nmultvsnvtxprof[i] = m_subdirs[i]->make<TProfile>(name, title, m_maxnvtx, -0.5, m_maxnvtx - 0.5);
113  m_nmultvsnvtxprof[i]->GetXaxis()->SetTitle("Number of Vertices");
114  m_nmultvsnvtxprof[i]->GetYaxis()->SetTitle("Number of Hits");
115 
116  if (m_runHisto) {
117  edm::LogInfo("RunHistos") << "Pseudo-booking run histos " << slab.c_str();
118  sprintf(name, "n%sdigivsnvtxvsbxprofrun", slab.c_str());
119  sprintf(title, "%s %s multiplicity vs Nvtx vs BX", slab.c_str(), m_hitname.c_str());
121  m_fhm[i]->makeTProfile2D(name, title, 3564, -0.5, 3563.5, m_maxnvtx, -0.5, m_maxnvtx - 0.5);
122  }
123  }
124  }
125 }

References BTVHLTOfflineSource_cfi::dirname, mps_fire::i, m_binmax, m_fhm, m_hitname, m_labels, m_maxnvtx, m_nbins, m_nmultvsnvtx, m_nmultvsnvtxprof, m_nmultvsnvtxvsbxprofrun, m_runHisto, m_scalefact, m_subdirs, TFileDirectory::mkdir(), TFileService::mkdir(), Skims_PA_cff::name, SiStripTKNumbers::nstrips(), AlCaHLTBitMon_QueryRunRegistry::string, and overlapproblemtsosanalyzer_cfi::title.

◆ fill()

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

Definition at line 141 of file DigiVertexCorrHistogramMaker.cc.

143  {
145 
146  for (std::map<unsigned int, int>::const_iterator digi = ndigi.begin(); digi != ndigi.end(); digi++) {
147  if (m_labels.find(digi->first) != m_labels.end()) {
148  const unsigned int i = digi->first;
149  m_nmultvsnvtx[i]->Fill(nvtx, digi->second);
150  m_nmultvsnvtxprof[i]->Fill(nvtx, digi->second);
151 
153  (*m_nmultvsnvtxvsbxprofrun[i])->Fill(iEvent.bunchCrossing() % 3564, nvtx, digi->second);
154  }
155  }
156 }

References HcalObjRepresent::Fill(), mps_fire::i, iEvent, m_labels, m_nmultvsnvtx, m_nmultvsnvtxprof, and m_nmultvsnvtxvsbxprofrun.

Referenced by MultiplicityInvestigator::analyze().

Member Data Documentation

◆ m_binmax

std::map<unsigned int, int> DigiVertexCorrHistogramMaker::m_binmax
private

Definition at line 39 of file DigiVertexCorrHistogramMaker.h.

Referenced by book(), and DigiVertexCorrHistogramMaker().

◆ m_fhm

std::map<unsigned int, RunHistogramManager*> DigiVertexCorrHistogramMaker::m_fhm
private

Definition at line 33 of file DigiVertexCorrHistogramMaker.h.

Referenced by beginRun(), book(), and ~DigiVertexCorrHistogramMaker().

◆ m_hitname

std::string DigiVertexCorrHistogramMaker::m_hitname
private

Definition at line 35 of file DigiVertexCorrHistogramMaker.h.

Referenced by book().

◆ m_labels

std::map<unsigned int, std::string> DigiVertexCorrHistogramMaker::m_labels
private

◆ m_maxnvtx

const int DigiVertexCorrHistogramMaker::m_maxnvtx
private

Definition at line 38 of file DigiVertexCorrHistogramMaker.h.

Referenced by book().

◆ m_nbins

const int DigiVertexCorrHistogramMaker::m_nbins
private

Definition at line 36 of file DigiVertexCorrHistogramMaker.h.

Referenced by book().

◆ m_nmultvsnvtx

std::map<unsigned int, TH2F*> DigiVertexCorrHistogramMaker::m_nmultvsnvtx
private

Definition at line 42 of file DigiVertexCorrHistogramMaker.h.

Referenced by book(), and fill().

◆ m_nmultvsnvtxprof

std::map<unsigned int, TProfile*> DigiVertexCorrHistogramMaker::m_nmultvsnvtxprof
private

Definition at line 43 of file DigiVertexCorrHistogramMaker.h.

Referenced by book(), and fill().

◆ m_nmultvsnvtxvsbxprofrun

std::map<unsigned int, TProfile2D**> DigiVertexCorrHistogramMaker::m_nmultvsnvtxvsbxprofrun
private

Definition at line 44 of file DigiVertexCorrHistogramMaker.h.

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

◆ m_runHisto

bool DigiVertexCorrHistogramMaker::m_runHisto
private

Definition at line 34 of file DigiVertexCorrHistogramMaker.h.

Referenced by beginRun(), and book().

◆ m_scalefact

const int DigiVertexCorrHistogramMaker::m_scalefact
private

Definition at line 37 of file DigiVertexCorrHistogramMaker.h.

Referenced by book().

◆ m_subdirs

std::map<unsigned int, TFileDirectory*> DigiVertexCorrHistogramMaker::m_subdirs
private

Definition at line 45 of file DigiVertexCorrHistogramMaker.h.

Referenced by beginRun(), book(), and ~DigiVertexCorrHistogramMaker().

SummaryClient_cfi.labels
labels
Definition: SummaryClient_cfi.py:61
TFileDirectory::mkdir
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
Definition: TFileDirectory.cc:112
DigiVertexCorrHistogramMaker::book
void book(const std::string dirname, const std::map< unsigned int, std::string > &labels, edm::ConsumesCollector &&iC)
Definition: DigiVertexCorrHistogramMaker.cc:57
mps_fire.i
i
Definition: mps_fire.py:355
DigiVertexCorrHistogramMaker::m_labels
std::map< unsigned int, std::string > m_labels
Definition: DigiVertexCorrHistogramMaker.h:40
DigiVertexCorrHistogramMaker::m_nmultvsnvtxprof
std::map< unsigned int, TProfile * > m_nmultvsnvtxprof
Definition: DigiVertexCorrHistogramMaker.h:43
edm::LogInfo
Definition: MessageLogger.h:254
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
TFileDirectory
Definition: TFileDirectory.h:24
DigiVertexCorrHistogramMaker::m_nbins
const int m_nbins
Definition: DigiVertexCorrHistogramMaker.h:36
BTVHLTOfflineSource_cfi.dirname
dirname
Definition: BTVHLTOfflineSource_cfi.py:7
DigiVertexCorrHistogramMaker::m_hitname
std::string m_hitname
Definition: DigiVertexCorrHistogramMaker.h:35
DigiVertexCorrHistogramMaker::m_runHisto
bool m_runHisto
Definition: DigiVertexCorrHistogramMaker.h:34
RunHistogramManager
Definition: RunHistogramManager.h:210
DigiVertexCorrHistogramMaker::m_scalefact
const int m_scalefact
Definition: DigiVertexCorrHistogramMaker.h:37
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
DigiVertexCorrHistogramMaker::m_nmultvsnvtxvsbxprofrun
std::map< unsigned int, TProfile2D ** > m_nmultvsnvtxvsbxprofrun
Definition: DigiVertexCorrHistogramMaker.h:44
TFileService::mkdir
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
Definition: TFileService.h:69
SiStripTKNumbers::nstrips
int nstrips(const DetId &detid) const
Definition: SiStripTKNumbers.cc:81
DigiVertexCorrHistogramMaker::m_nmultvsnvtx
std::map< unsigned int, TH2F * > m_nmultvsnvtx
Definition: DigiVertexCorrHistogramMaker.h:42
edm::Service< TFileService >
iEvent
int iEvent
Definition: GenABIO.cc:224
DigiVertexCorrHistogramMaker::m_maxnvtx
const int m_maxnvtx
Definition: DigiVertexCorrHistogramMaker.h:38
edm::LogVerbatim
Definition: MessageLogger.h:297
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
DigiVertexCorrHistogramMaker::m_fhm
std::map< unsigned int, RunHistogramManager * > m_fhm
Definition: DigiVertexCorrHistogramMaker.h:33
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
DigiVertexCorrHistogramMaker::m_subdirs
std::map< unsigned int, TFileDirectory * > m_subdirs
Definition: DigiVertexCorrHistogramMaker.h:45
DigiVertexCorrHistogramMaker::m_binmax
std::map< unsigned int, int > m_binmax
Definition: DigiVertexCorrHistogramMaker.h:39
SiStripTKNumbers
Definition: SiStripTKNumbers.h:8