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
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)
 
void book (const std::string dirname)
 
 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 18 of file DigiVertexCorrHistogramMaker.h.

Constructor & Destructor Documentation

DigiVertexCorrHistogramMaker::DigiVertexCorrHistogramMaker ( )

Definition at line 14 of file DigiVertexCorrHistogramMaker.cc.

14  :
15  m_fhm(),
16  m_runHisto(false),
std::map< unsigned int, TProfile2D ** > m_nmultvsnvtxvsbxprofrun
std::map< unsigned int, std::string > m_labels
std::map< unsigned int, int > m_binmax
std::map< unsigned int, RunHistogramManager * > m_fhm
std::map< unsigned int, TFileDirectory * > m_subdirs
std::map< unsigned int, TProfile * > m_nmultvsnvtxprof
std::map< unsigned int, TH2F * > m_nmultvsnvtx
DigiVertexCorrHistogramMaker::DigiVertexCorrHistogramMaker ( const edm::ParameterSet iConfig)

Definition at line 19 of file DigiVertexCorrHistogramMaker.cc.

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

19  :
20  m_fhm(),
21  m_runHisto(iConfig.getUntrackedParameter<bool>("runHisto",false)),
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)),
25  m_maxnvtx(iConfig.getUntrackedParameter<int>("maxNvtx",60)),
27 {
28 
29  std::vector<edm::ParameterSet>
30  wantedsubds(iConfig.getUntrackedParameter<std::vector<edm::ParameterSet> >("wantedSubDets",std::vector<edm::ParameterSet>()));
31 
32  for(std::vector<edm::ParameterSet>::iterator ps=wantedsubds.begin();ps!=wantedsubds.end();++ps) {
33  m_labels[ps->getParameter<unsigned int>("detSelection")] = ps->getParameter<std::string>("detLabel");
34  m_binmax[ps->getParameter<unsigned int>("detSelection")] = ps->getParameter<int>("binMax");
35  }
36 
37 
38 }
T getUntrackedParameter(std::string const &, T const &) const
std::map< unsigned int, std::string > m_labels
std::map< unsigned int, int > m_binmax
std::map< unsigned int, RunHistogramManager * > m_fhm
std::map< unsigned int, TFileDirectory * > m_subdirs
std::map< unsigned int, TProfile * > m_nmultvsnvtxprof
std::map< unsigned int, TH2F * > m_nmultvsnvtx
DigiVertexCorrHistogramMaker::~DigiVertexCorrHistogramMaker ( )

Definition at line 41 of file DigiVertexCorrHistogramMaker.cc.

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

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

Member Function Documentation

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

Definition at line 121 of file DigiVertexCorrHistogramMaker.cc.

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

Referenced by MultiplicityInvestigator::beginRun().

121  {
122 
124 
125 
126  for(std::map<unsigned int,std::string>::const_iterator lab=m_labels.begin();lab!=m_labels.end();++lab) {
127  const int i = lab->first; const std::string slab = lab->second;
128  m_fhm[i]->beginRun(iRun,*m_subdirs[i]);
129  if(m_runHisto) {
130  (*m_nmultvsnvtxvsbxprofrun[i])->GetXaxis()->SetTitle("BX"); (*m_nmultvsnvtxvsbxprofrun[i])->GetYaxis()->SetTitle("Nvertices");
131  }
132  }
133 
134 }
int i
Definition: DBlmapReader.cc:9
std::map< unsigned int, TProfile2D ** > m_nmultvsnvtxvsbxprofrun
std::map< unsigned int, std::string > m_labels
std::map< unsigned int, RunHistogramManager * > m_fhm
std::map< unsigned int, TFileDirectory * > m_subdirs
void DigiVertexCorrHistogramMaker::book ( const std::string  dirname,
const std::map< unsigned int, std::string > &  labels 
)

Definition at line 55 of file DigiVertexCorrHistogramMaker.cc.

References tablePrinter::labels, and m_labels.

Referenced by MultiplicityInvestigator::MultiplicityInvestigator().

55  {
56 
57  m_labels = labels;
58  book(dirname);
59 
60 }
std::map< unsigned int, std::string > m_labels
void book(const std::string dirname, const std::map< unsigned int, std::string > &labels)
void DigiVertexCorrHistogramMaker::book ( const std::string  dirname)

Definition at line 62 of file DigiVertexCorrHistogramMaker.cc.

References 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(), mergeVDriftHistosByStation::name, SiStripTKNumbers::nstrips(), AlCaHLTBitMon_QueryRunRegistry::string, and indexGen::title.

62  {
63 
65  TFileDirectory subev = tfserv->mkdir(dirname);
66 
67  SiStripTKNumbers trnumb;
68 
69  edm::LogInfo("NumberOfBins") << "Number of Bins: " << m_nbins;
70  edm::LogInfo("ScaleFactors") << "y-axis range scale factor: " << m_scalefact;
71  edm::LogInfo("MaxNvtx") << "maximum number of vertices: " << m_maxnvtx;
72  edm::LogInfo("BinMaxValue") << "Setting bin max values";
73 
74  for(std::map<unsigned int,std::string>::const_iterator lab=m_labels.begin();lab!=m_labels.end();lab++) {
75 
76  const unsigned int i = lab->first; const std::string slab = lab->second;
77 
78  if(m_binmax.find(i)==m_binmax.end()) {
79  edm::LogVerbatim("NotConfiguredBinMax") << "Bin max for " << lab->second
80  << " not configured: " << trnumb.nstrips(i) << " used";
81  m_binmax[i] = trnumb.nstrips(i);
82  }
83 
84  edm::LogVerbatim("BinMaxValue") << "Bin max for " << lab->second << " is " << m_binmax[i];
85 
86  }
87 
88  for(std::map<unsigned int,std::string>::const_iterator lab=m_labels.begin();lab!=m_labels.end();++lab) {
89 
90  const int i = lab->first; 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.c_str()));
96  m_fhm[i] = new RunHistogramManager(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,title,m_maxnvtx,-0.5,m_maxnvtx-0.5,m_nbins,0.,(1+m_binmax[i]/(m_scalefact*m_nbins))*m_nbins);
102  m_nmultvsnvtx[i]->GetXaxis()->SetTitle("Number of Vertices"); m_nmultvsnvtx[i]->GetYaxis()->SetTitle("Number of Hits");
103  sprintf(name,"n%sdigivsnvtxprof",slab.c_str());
104  m_nmultvsnvtxprof[i] = m_subdirs[i]->make<TProfile>(name,title,m_maxnvtx,-0.5,m_maxnvtx-0.5);
105  m_nmultvsnvtxprof[i]->GetXaxis()->SetTitle("Number of Vertices"); m_nmultvsnvtxprof[i]->GetYaxis()->SetTitle("Number of Hits");
106 
107  if(m_runHisto) {
108  edm::LogInfo("RunHistos") << "Pseudo-booking run histos " << slab.c_str();
109  sprintf(name,"n%sdigivsnvtxvsbxprofrun",slab.c_str());
110  sprintf(title,"%s %s multiplicity vs Nvtx vs BX",slab.c_str(),m_hitname.c_str());
111  m_nmultvsnvtxvsbxprofrun[i] = m_fhm[i]->makeTProfile2D(name,title,3564,-0.5,3563.5,m_maxnvtx,-0.5,m_maxnvtx-0.5);
112  }
113 
114  }
115 
116  }
117 
118 
119 }
int i
Definition: DBlmapReader.cc:9
std::map< unsigned int, TProfile2D ** > m_nmultvsnvtxvsbxprofrun
std::map< unsigned int, std::string > m_labels
std::map< unsigned int, int > m_binmax
int nstrips(const SiStripDetId &detid) const
std::map< unsigned int, RunHistogramManager * > m_fhm
std::map< unsigned int, TFileDirectory * > m_subdirs
std::map< unsigned int, TProfile * > m_nmultvsnvtxprof
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, TH2F * > m_nmultvsnvtx
void DigiVertexCorrHistogramMaker::fill ( const edm::Event iEvent,
const unsigned int  nvtx,
const std::map< unsigned int, int > &  ndigi 
)

Definition at line 136 of file DigiVertexCorrHistogramMaker.cc.

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

Referenced by MultiplicityInvestigator::analyze().

136  {
137 
138 
140 
141 
142  for(std::map<unsigned int,int>::const_iterator digi=ndigi.begin();digi!=ndigi.end();digi++) {
143 
144  if(m_labels.find(digi->first) != m_labels.end()) {
145 
146  const unsigned int i=digi->first;
147  m_nmultvsnvtx[i]->Fill(nvtx,digi->second);
148  m_nmultvsnvtxprof[i]->Fill(nvtx,digi->second);
149 
150  if(m_nmultvsnvtxvsbxprofrun[i] && *m_nmultvsnvtxvsbxprofrun[i]) (*m_nmultvsnvtxvsbxprofrun[i])->Fill(iEvent.bunchCrossing(),nvtx,digi->second);
151 
152  }
153 
154  }
155 }
int i
Definition: DBlmapReader.cc:9
std::map< unsigned int, TProfile2D ** > m_nmultvsnvtxvsbxprofrun
std::map< unsigned int, std::string > m_labels
int bunchCrossing() const
Definition: EventBase.h:62
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
std::map< unsigned int, TProfile * > m_nmultvsnvtxprof
std::map< unsigned int, TH2F * > m_nmultvsnvtx

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().