CMS 3D CMS Logo

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

#include <DigiVtxPosCorrHistogramMaker.h>

Public Member Functions

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

Private Attributes

std::map< unsigned int, int > m_binmax
 
std::string m_hitname
 
std::map< unsigned int, std::string > m_labels
 
edm::EDGetTokenT< edm::HepMCProductm_mcvtxcollectionToken
 
const int m_nbins
 
std::map< unsigned int, TH2F * > m_nmultvsvtxpos
 
std::map< unsigned int, TProfile * > m_nmultvsvtxposprof
 
const int m_scalefact
 
std::map< unsigned int, TFileDirectory * > m_subdirs
 

Detailed Description

Definition at line 18 of file DigiVtxPosCorrHistogramMaker.h.

Constructor & Destructor Documentation

◆ DigiVtxPosCorrHistogramMaker() [1/2]

DigiVtxPosCorrHistogramMaker::DigiVtxPosCorrHistogramMaker ( edm::ConsumesCollector &&  iC)

Definition at line 15 of file DigiVtxPosCorrHistogramMaker.cc.

17  m_hitname(),
18  m_nbins(500),
19  m_scalefact(),
20  m_binmax(),
21  m_labels(),
24  m_subdirs() {}

◆ DigiVtxPosCorrHistogramMaker() [2/2]

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

Definition at line 26 of file DigiVtxPosCorrHistogramMaker.cc.

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

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

◆ ~DigiVtxPosCorrHistogramMaker()

DigiVtxPosCorrHistogramMaker::~DigiVtxPosCorrHistogramMaker ( )

Definition at line 45 of file DigiVtxPosCorrHistogramMaker.cc.

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

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

Member Function Documentation

◆ beginRun()

void DigiVtxPosCorrHistogramMaker::beginRun ( const unsigned int  nrun)

Definition at line 106 of file DigiVtxPosCorrHistogramMaker.cc.

106 {}

◆ book() [1/2]

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

Definition at line 59 of file DigiVtxPosCorrHistogramMaker.cc.

59  {
61  TFileDirectory subev = tfserv->mkdir(dirname);
62 
63  SiStripTKNumbers trnumb;
64 
65  edm::LogInfo("NumberOfBins") << "Number of Bins: " << m_nbins;
66  edm::LogInfo("ScaleFactors") << "y-axis range scale factor: " << m_scalefact;
67  edm::LogInfo("BinMaxValue") << "Setting bin max values";
68 
69  for (std::map<unsigned int, std::string>::const_iterator lab = m_labels.begin(); lab != m_labels.end(); lab++) {
70  const unsigned int i = lab->first;
71  const std::string slab = lab->second;
72 
73  if (m_binmax.find(i) == m_binmax.end()) {
74  edm::LogVerbatim("NotConfiguredBinMax")
75  << "Bin max for " << lab->second << " not configured: " << trnumb.nstrips(i) << " used";
76  m_binmax[i] = trnumb.nstrips(i);
77  }
78 
79  edm::LogVerbatim("BinMaxValue") << "Bin max for " << lab->second << " is " << m_binmax[i];
80  }
81 
82  for (std::map<unsigned int, std::string>::const_iterator lab = m_labels.begin(); lab != m_labels.end(); ++lab) {
83  const int i = lab->first;
84  const std::string slab = lab->second;
85 
86  char name[200];
87  char title[500];
88 
89  m_subdirs[i] = new TFileDirectory(subev.mkdir(slab));
90 
91  if (m_subdirs[i]) {
92  sprintf(name, "n%sdigivsvtxpos", slab.c_str());
93  sprintf(title, "%s %s multiplicity vx MC vertex z position", slab.c_str(), m_hitname.c_str());
94  m_nmultvsvtxpos[i] = m_subdirs[i]->make<TH2F>(
95  name, title, 200, -20., 20., m_nbins, 0., m_binmax[i] / (m_scalefact * m_nbins) * m_nbins);
96  m_nmultvsvtxpos[i]->GetXaxis()->SetTitle("MC vertex z position (cm)");
97  m_nmultvsvtxpos[i]->GetYaxis()->SetTitle("Number of Hits");
98  sprintf(name, "n%sdigivsvtxposprof", slab.c_str());
99  m_nmultvsvtxposprof[i] = m_subdirs[i]->make<TProfile>(name, title, 200, -20., 20.);
100  m_nmultvsvtxposprof[i]->GetXaxis()->SetTitle("MC vertex z position (cm)");
101  m_nmultvsvtxposprof[i]->GetYaxis()->SetTitle("Number of Hits");
102  }
103  }
104 }

References BTVHLTOfflineSource_cfi::dirname, mps_fire::i, m_binmax, m_hitname, m_labels, m_nbins, m_nmultvsvtxpos, m_nmultvsvtxposprof, m_scalefact, m_subdirs, TFileDirectory::mkdir(), TFileService::mkdir(), Skims_PA_cff::name, SiStripTKNumbers::nstrips(), AlCaHLTBitMon_QueryRunRegistry::string, and overlapproblemtsosanalyzer_cfi::title.

◆ book() [2/2]

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

◆ fill()

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

Definition at line 108 of file DigiVtxPosCorrHistogramMaker.cc.

108  {
109  // main interaction part
110 
112  iEvent.getByToken(m_mcvtxcollectionToken, EvtHandle);
113 
114  if (EvtHandle.isValid()) {
115  const HepMC::GenEvent* Evt = EvtHandle->GetEvent();
116 
117  // get the first vertex
118 
119  if (Evt->vertices_begin() != Evt->vertices_end()) {
120  double vtxz = (*Evt->vertices_begin())->point3d().z() / 10.;
121 
122  for (std::map<unsigned int, int>::const_iterator digi = ndigi.begin(); digi != ndigi.end(); digi++) {
123  if (m_labels.find(digi->first) != m_labels.end()) {
124  const unsigned int i = digi->first;
125  m_nmultvsvtxpos[i]->Fill(vtxz, digi->second);
126  m_nmultvsvtxposprof[i]->Fill(vtxz, digi->second);
127  }
128  }
129  }
130  }
131 }

References edm::HepMCProduct::GetEvent(), mps_fire::i, iEvent, edm::HandleBase::isValid(), m_labels, m_mcvtxcollectionToken, m_nmultvsvtxpos, and m_nmultvsvtxposprof.

Referenced by MultiplicityInvestigator::analyze().

Member Data Documentation

◆ m_binmax

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

Definition at line 35 of file DigiVtxPosCorrHistogramMaker.h.

Referenced by book(), and DigiVtxPosCorrHistogramMaker().

◆ m_hitname

std::string DigiVtxPosCorrHistogramMaker::m_hitname
private

Definition at line 32 of file DigiVtxPosCorrHistogramMaker.h.

Referenced by book().

◆ m_labels

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

◆ m_mcvtxcollectionToken

edm::EDGetTokenT<edm::HepMCProduct> DigiVtxPosCorrHistogramMaker::m_mcvtxcollectionToken
private

Definition at line 31 of file DigiVtxPosCorrHistogramMaker.h.

Referenced by fill().

◆ m_nbins

const int DigiVtxPosCorrHistogramMaker::m_nbins
private

Definition at line 33 of file DigiVtxPosCorrHistogramMaker.h.

Referenced by book().

◆ m_nmultvsvtxpos

std::map<unsigned int, TH2F*> DigiVtxPosCorrHistogramMaker::m_nmultvsvtxpos
private

Definition at line 38 of file DigiVtxPosCorrHistogramMaker.h.

Referenced by book(), and fill().

◆ m_nmultvsvtxposprof

std::map<unsigned int, TProfile*> DigiVtxPosCorrHistogramMaker::m_nmultvsvtxposprof
private

Definition at line 39 of file DigiVtxPosCorrHistogramMaker.h.

Referenced by book(), and fill().

◆ m_scalefact

const int DigiVtxPosCorrHistogramMaker::m_scalefact
private

Definition at line 34 of file DigiVtxPosCorrHistogramMaker.h.

Referenced by book().

◆ m_subdirs

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

Definition at line 40 of file DigiVtxPosCorrHistogramMaker.h.

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

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
mps_fire.i
i
Definition: mps_fire.py:355
DigiVtxPosCorrHistogramMaker::m_binmax
std::map< unsigned int, int > m_binmax
Definition: DigiVtxPosCorrHistogramMaker.h:35
edm::LogInfo
Definition: MessageLogger.h:254
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
TFileDirectory
Definition: TFileDirectory.h:24
DigiVtxPosCorrHistogramMaker::m_nbins
const int m_nbins
Definition: DigiVtxPosCorrHistogramMaker.h:33
edm::Handle< edm::HepMCProduct >
HepMC::GenEvent
Definition: hepmc_rootio.cc:9
BTVHLTOfflineSource_cfi.dirname
dirname
Definition: BTVHLTOfflineSource_cfi.py:7
DigiVtxPosCorrHistogramMaker::m_nmultvsvtxposprof
std::map< unsigned int, TProfile * > m_nmultvsvtxposprof
Definition: DigiVtxPosCorrHistogramMaker.h:39
DigiVtxPosCorrHistogramMaker::m_labels
std::map< unsigned int, std::string > m_labels
Definition: DigiVtxPosCorrHistogramMaker.h:36
DigiVtxPosCorrHistogramMaker::m_scalefact
const int m_scalefact
Definition: DigiVtxPosCorrHistogramMaker.h:34
DigiVtxPosCorrHistogramMaker::book
void book(const std::string dirname, const std::map< unsigned int, std::string > &labels)
Definition: DigiVtxPosCorrHistogramMaker.cc:54
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:49
DigiVtxPosCorrHistogramMaker::m_subdirs
std::map< unsigned int, TFileDirectory * > m_subdirs
Definition: DigiVtxPosCorrHistogramMaker.h:40
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
SiStripTKNumbers::nstrips
int nstrips(const DetId &detid) const
Definition: SiStripTKNumbers.cc:81
edm::Service< TFileService >
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::LogVerbatim
Definition: MessageLogger.h:297
edm::HepMCProduct::GetEvent
const HepMC::GenEvent * GetEvent() const
Definition: HepMCProduct.h:34
DigiVtxPosCorrHistogramMaker::m_mcvtxcollectionToken
edm::EDGetTokenT< edm::HepMCProduct > m_mcvtxcollectionToken
Definition: DigiVtxPosCorrHistogramMaker.h:31
DigiVtxPosCorrHistogramMaker::m_hitname
std::string m_hitname
Definition: DigiVtxPosCorrHistogramMaker.h:32
overlapproblemtsosanalyzer_cfi.title
title
Definition: overlapproblemtsosanalyzer_cfi.py:7
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
edm::HepMCProduct
Definition: HepMCProduct.h:18
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
DigiVtxPosCorrHistogramMaker::m_nmultvsvtxpos
std::map< unsigned int, TH2F * > m_nmultvsvtxpos
Definition: DigiVtxPosCorrHistogramMaker.h:38
edm::InputTag
Definition: InputTag.h:15
SiStripTKNumbers
Definition: SiStripTKNumbers.h:8