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::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() {}
std::map< unsigned int, std::string > m_labels
std::map< unsigned int, TProfile * > m_nmultvsnvtxprof
std::map< unsigned int, int > m_binmax
std::map< unsigned int, TH2F * > m_nmultvsnvtx
std::map< unsigned int, TFileDirectory * > m_subdirs
std::map< unsigned int, RunHistogramManager * > m_fhm
std::map< unsigned int, TProfile2D ** > m_nmultvsnvtxvsbxprofrun
DigiVertexCorrHistogramMaker::DigiVertexCorrHistogramMaker ( const edm::ParameterSet iConfig)

Definition at line 27 of file DigiVertexCorrHistogramMaker.cc.

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

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 }
T getUntrackedParameter(std::string const &, T const &) const
std::map< unsigned int, std::string > m_labels
std::map< unsigned int, TProfile * > m_nmultvsnvtxprof
std::map< unsigned int, int > m_binmax
std::map< unsigned int, TH2F * > m_nmultvsnvtx
std::map< unsigned int, TFileDirectory * > m_subdirs
std::map< unsigned int, RunHistogramManager * > m_fhm
DigiVertexCorrHistogramMaker::~DigiVertexCorrHistogramMaker ( )

Definition at line 47 of file DigiVertexCorrHistogramMaker.cc.

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

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 }
std::map< unsigned int, std::string > m_labels
std::map< unsigned int, TFileDirectory * > m_subdirs
std::map< unsigned int, RunHistogramManager * > m_fhm

Member Function Documentation

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

Definition at line 127 of file DigiVertexCorrHistogramMaker.cc.

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

Referenced by MultiplicityInvestigator::beginRun().

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 }
std::map< unsigned int, std::string > m_labels
std::map< unsigned int, TFileDirectory * > m_subdirs
std::map< unsigned int, RunHistogramManager * > m_fhm
std::map< unsigned int, TProfile2D ** > m_nmultvsnvtxvsbxprofrun
void DigiVertexCorrHistogramMaker::book ( const std::string  dirname,
const std::map< unsigned int, std::string > &  labels,
edm::ConsumesCollector &&  iC 
)

Definition at line 57 of file DigiVertexCorrHistogramMaker.cc.

References SummaryClient_cfi::labels, and m_labels.

Referenced by MultiplicityInvestigator::MultiplicityInvestigator().

59  {
60  m_labels = labels;
61  book(dirname, iC);
62 }
std::map< unsigned int, std::string > m_labels
void book(const std::string dirname, const std::map< unsigned int, std::string > &labels, edm::ConsumesCollector &&iC)
void DigiVertexCorrHistogramMaker::book ( const std::string  dirname,
edm::ConsumesCollector &&  iC 
)
inline

Definition at line 27 of file DigiVertexCorrHistogramMaker.h.

References book(), ntuplemaker::fill, iEvent, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by book().

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

Definition at line 64 of file DigiVertexCorrHistogramMaker.cc.

References 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.

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 }
std::map< unsigned int, std::string > m_labels
std::map< unsigned int, TProfile * > m_nmultvsnvtxprof
int nstrips(const DetId &detid) const
std::map< unsigned int, int > m_binmax
std::map< unsigned int, TH2F * > m_nmultvsnvtx
std::map< unsigned int, TFileDirectory * > m_subdirs
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, RunHistogramManager * > m_fhm
std::map< unsigned int, TProfile2D ** > m_nmultvsnvtxvsbxprofrun
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.

References edm::EventBase::bunchCrossing(), HcalObjRepresent::Fill(), mps_fire::i, m_labels, m_nmultvsnvtx, m_nmultvsnvtxprof, and m_nmultvsnvtxvsbxprofrun.

Referenced by MultiplicityInvestigator::analyze().

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 }
std::map< unsigned int, std::string > m_labels
int bunchCrossing() const
Definition: EventBase.h:64
std::map< unsigned int, TProfile * > m_nmultvsnvtxprof
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
std::map< unsigned int, TH2F * > m_nmultvsnvtx
std::map< unsigned int, TProfile2D ** > m_nmultvsnvtxvsbxprofrun

Member Data Documentation

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

Definition at line 39 of file DigiVertexCorrHistogramMaker.h.

Referenced by book(), and DigiVertexCorrHistogramMaker().

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

Definition at line 33 of file DigiVertexCorrHistogramMaker.h.

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

std::string DigiVertexCorrHistogramMaker::m_hitname
private

Definition at line 35 of file DigiVertexCorrHistogramMaker.h.

Referenced by book().

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

Definition at line 38 of file DigiVertexCorrHistogramMaker.h.

Referenced by book().

const int DigiVertexCorrHistogramMaker::m_nbins
private

Definition at line 36 of file DigiVertexCorrHistogramMaker.h.

Referenced by book().

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

Definition at line 42 of file DigiVertexCorrHistogramMaker.h.

Referenced by book(), and fill().

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

Definition at line 43 of file DigiVertexCorrHistogramMaker.h.

Referenced by book(), and fill().

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

Definition at line 44 of file DigiVertexCorrHistogramMaker.h.

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

bool DigiVertexCorrHistogramMaker::m_runHisto
private

Definition at line 34 of file DigiVertexCorrHistogramMaker.h.

Referenced by beginRun(), and book().

const int DigiVertexCorrHistogramMaker::m_scalefact
private

Definition at line 37 of file DigiVertexCorrHistogramMaker.h.

Referenced by book().

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

Definition at line 45 of file DigiVertexCorrHistogramMaker.h.

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