test
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
DigiVtxPosCorrHistogramMaker Class Reference

#include <DigiVtxPosCorrHistogramMaker.h>

Public Member Functions

void beginRun (const unsigned int nrun)
 
void book (const std::string dirname, const std::map< unsigned int, std::string > &labels)
 
void book (const std::string dirname)
 
 DigiVtxPosCorrHistogramMaker (edm::ConsumesCollector &&iC)
 
 DigiVtxPosCorrHistogramMaker (const edm::ParameterSet &iConfig, 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::HepMCProduct
m_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 19 of file DigiVtxPosCorrHistogramMaker.h.

Constructor & Destructor Documentation

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

Definition at line 16 of file DigiVtxPosCorrHistogramMaker.cc.

16  :
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::map< unsigned int, TFileDirectory * > m_subdirs
edm::EDGetTokenT< edm::HepMCProduct > m_mcvtxcollectionToken
std::map< unsigned int, int > m_binmax
std::map< unsigned int, TH2F * > m_nmultvsvtxpos
std::map< unsigned int, std::string > m_labels
std::map< unsigned int, TProfile * > m_nmultvsvtxposprof
DigiVtxPosCorrHistogramMaker::DigiVtxPosCorrHistogramMaker ( const edm::ParameterSet iConfig,
edm::ConsumesCollector &&  iC 
)

Definition at line 20 of file DigiVtxPosCorrHistogramMaker.cc.

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

20  :
22  m_hitname(iConfig.getUntrackedParameter<std::string>("hitName","digi")),
23  m_nbins(iConfig.getUntrackedParameter<int>("numberOfBins",500)),
24  m_scalefact(iConfig.getUntrackedParameter<int>("scaleFactor",5)),
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  m_labels[ps->getParameter<unsigned int>("detSelection")] = ps->getParameter<std::string>("detLabel");
33  m_binmax[ps->getParameter<unsigned int>("detSelection")] = ps->getParameter<int>("binMax");
34  }
35 
36 
37 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::map< unsigned int, TFileDirectory * > m_subdirs
edm::EDGetTokenT< edm::HepMCProduct > m_mcvtxcollectionToken
std::map< unsigned int, int > m_binmax
std::map< unsigned int, TH2F * > m_nmultvsvtxpos
std::map< unsigned int, std::string > m_labels
std::map< unsigned int, TProfile * > m_nmultvsvtxposprof
DigiVtxPosCorrHistogramMaker::~DigiVtxPosCorrHistogramMaker ( )

Definition at line 40 of file DigiVtxPosCorrHistogramMaker.cc.

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

40  {
41 
42  for(std::map<unsigned int,std::string>::const_iterator lab=m_labels.begin();lab!=m_labels.end();lab++) {
43 
44  const unsigned int i = lab->first; const std::string slab = lab->second;
45 
46  delete m_subdirs[i];
47  }
48 
49 }
int i
Definition: DBlmapReader.cc:9
std::map< unsigned int, TFileDirectory * > m_subdirs
std::map< unsigned int, std::string > m_labels

Member Function Documentation

void DigiVtxPosCorrHistogramMaker::beginRun ( const unsigned int  nrun)

Definition at line 110 of file DigiVtxPosCorrHistogramMaker.cc.

110  {
111 
112 
113 }
void DigiVtxPosCorrHistogramMaker::book ( const std::string  dirname,
const std::map< unsigned int, std::string > &  labels 
)

Definition at line 53 of file DigiVtxPosCorrHistogramMaker.cc.

References HLT_25ns10e33_v2_cff::labels, and m_labels.

Referenced by MultiplicityInvestigator::MultiplicityInvestigator().

53  {
54 
55  m_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 > m_labels
void DigiVtxPosCorrHistogramMaker::book ( const std::string  dirname)

Definition at line 60 of file DigiVtxPosCorrHistogramMaker.cc.

References i, m_binmax, m_hitname, m_labels, m_nbins, m_nmultvsvtxpos, m_nmultvsvtxposprof, m_scalefact, m_subdirs, TFileService::mkdir(), TFileDirectory::mkdir(), mergeVDriftHistosByStation::name, SiStripTKNumbers::nstrips(), AlCaHLTBitMon_QueryRunRegistry::string, and indexGen::title.

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

Definition at line 115 of file DigiVtxPosCorrHistogramMaker.cc.

References edm::Event::getByToken(), i, edm::HandleBase::isValid(), m_labels, m_mcvtxcollectionToken, m_nmultvsvtxpos, and m_nmultvsvtxposprof.

Referenced by MultiplicityInvestigator::analyze().

115  {
116 
117  // main interaction part
118 
120  iEvent.getByToken(m_mcvtxcollectionToken, EvtHandle ) ;
121 
122  if(EvtHandle.isValid()) {
123 
124  const HepMC::GenEvent* Evt = EvtHandle->GetEvent();
125 
126  // get the first vertex
127 
128  if(Evt->vertices_begin() != Evt->vertices_end()) {
129 
130  double vtxz = (*Evt->vertices_begin())->point3d().z()/10.;
131 
132  for(std::map<unsigned int,int>::const_iterator digi=ndigi.begin();digi!=ndigi.end();digi++) {
133  if(m_labels.find(digi->first) != m_labels.end()) {
134  const unsigned int i=digi->first;
135  m_nmultvsvtxpos[i]->Fill(vtxz,digi->second);
136  m_nmultvsvtxposprof[i]->Fill(vtxz,digi->second);
137  }
138  }
139  }
140  }
141 }
int i
Definition: DBlmapReader.cc:9
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
edm::EDGetTokenT< edm::HepMCProduct > m_mcvtxcollectionToken
std::map< unsigned int, TH2F * > m_nmultvsvtxpos
bool isValid() const
Definition: HandleBase.h:75
std::map< unsigned int, std::string > m_labels
std::map< unsigned int, TProfile * > m_nmultvsvtxposprof

Member Data Documentation

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

Definition at line 38 of file DigiVtxPosCorrHistogramMaker.h.

Referenced by book(), and DigiVtxPosCorrHistogramMaker().

std::string DigiVtxPosCorrHistogramMaker::m_hitname
private

Definition at line 35 of file DigiVtxPosCorrHistogramMaker.h.

Referenced by book().

std::map<unsigned int, std::string> DigiVtxPosCorrHistogramMaker::m_labels
private
edm::EDGetTokenT<edm::HepMCProduct> DigiVtxPosCorrHistogramMaker::m_mcvtxcollectionToken
private

Definition at line 34 of file DigiVtxPosCorrHistogramMaker.h.

Referenced by fill().

const int DigiVtxPosCorrHistogramMaker::m_nbins
private

Definition at line 36 of file DigiVtxPosCorrHistogramMaker.h.

Referenced by book().

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

Definition at line 41 of file DigiVtxPosCorrHistogramMaker.h.

Referenced by book(), and fill().

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

Definition at line 42 of file DigiVtxPosCorrHistogramMaker.h.

Referenced by book(), and fill().

const int DigiVtxPosCorrHistogramMaker::m_scalefact
private

Definition at line 37 of file DigiVtxPosCorrHistogramMaker.h.

Referenced by book().

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

Definition at line 43 of file DigiVtxPosCorrHistogramMaker.h.

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