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
DigiPileupCorrHistogramMaker Class Reference

#include <DigiPileupCorrHistogramMaker.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)
 
 DigiPileupCorrHistogramMaker ()
 
 DigiPileupCorrHistogramMaker (const edm::ParameterSet &iConfig)
 
void fill (const edm::Event &iEvent, const std::map< unsigned int, int > &ndigi)
 
 ~DigiPileupCorrHistogramMaker ()
 

Private Attributes

std::map< unsigned int, int > m_binmax
 
std::string m_hitname
 
std::map< unsigned int,
std::string > 
m_labels
 
const int m_nbins
 
std::map< unsigned int, TH2F * > m_nmultvsmclumi
 
std::map< unsigned int,
TProfile * > 
m_nmultvsmclumiprof
 
std::map< unsigned int, TH2F * > m_nmultvsmcnvtx
 
std::map< unsigned int,
TProfile * > 
m_nmultvsmcnvtxprof
 
const edm::InputTag m_pileupcollection
 
const int m_scalefact
 
std::map< unsigned int,
TFileDirectory * > 
m_subdirs
 
bool m_useVisibleVertices
 

Detailed Description

Definition at line 17 of file DigiPileupCorrHistogramMaker.h.

Constructor & Destructor Documentation

DigiPileupCorrHistogramMaker::DigiPileupCorrHistogramMaker ( )

Definition at line 16 of file DigiPileupCorrHistogramMaker.cc.

16  :
17  m_pileupcollection("addPileupInfo"), m_useVisibleVertices(false), m_hitname(), m_nbins(500), m_scalefact(), m_binmax(), m_labels(),
std::map< unsigned int, std::string > m_labels
std::map< unsigned int, int > m_binmax
std::map< unsigned int, TH2F * > m_nmultvsmcnvtx
std::map< unsigned int, TProfile * > m_nmultvsmclumiprof
std::map< unsigned int, TProfile * > m_nmultvsmcnvtxprof
std::map< unsigned int, TH2F * > m_nmultvsmclumi
std::map< unsigned int, TFileDirectory * > m_subdirs
DigiPileupCorrHistogramMaker::DigiPileupCorrHistogramMaker ( const edm::ParameterSet iConfig)

Definition at line 20 of file DigiPileupCorrHistogramMaker.cc.

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

20  :
21  m_pileupcollection(iConfig.getParameter<edm::InputTag>("pileupSummaryCollection")),
22  m_useVisibleVertices(iConfig.getParameter<bool>("useVisibleVertices")),
23  m_hitname(iConfig.getUntrackedParameter<std::string>("hitName","digi")),
24  m_nbins(iConfig.getUntrackedParameter<int>("numberOfBins",500)),
25  m_scalefact(iConfig.getUntrackedParameter<int>("scaleFactor",5)),
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 getParameter(std::string const &) const
std::map< unsigned int, std::string > m_labels
T getUntrackedParameter(std::string const &, T const &) const
std::map< unsigned int, int > m_binmax
std::map< unsigned int, TH2F * > m_nmultvsmcnvtx
std::map< unsigned int, TProfile * > m_nmultvsmclumiprof
std::map< unsigned int, TProfile * > m_nmultvsmcnvtxprof
std::map< unsigned int, TH2F * > m_nmultvsmclumi
std::map< unsigned int, TFileDirectory * > m_subdirs
DigiPileupCorrHistogramMaker::~DigiPileupCorrHistogramMaker ( )

Definition at line 41 of file DigiPileupCorrHistogramMaker.cc.

References i, 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  }
49 
50 }
std::map< unsigned int, std::string > m_labels
int i
Definition: DBlmapReader.cc:9
std::map< unsigned int, TFileDirectory * > m_subdirs

Member Function Documentation

void DigiPileupCorrHistogramMaker::beginRun ( const unsigned int  nrun)

Definition at line 119 of file DigiPileupCorrHistogramMaker.cc.

119  {
120 
121 
122 }
void DigiPileupCorrHistogramMaker::book ( const std::string  dirname,
const std::map< unsigned int, std::string > &  labels 
)

Definition at line 54 of file DigiPileupCorrHistogramMaker.cc.

References tablePrinter::labels, and m_labels.

Referenced by MultiplicityInvestigator::MultiplicityInvestigator().

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

Definition at line 61 of file DigiPileupCorrHistogramMaker.cc.

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

61  {
62 
64  TFileDirectory subev = tfserv->mkdir(dirname);
65 
66  SiStripTKNumbers trnumb;
67 
68  edm::LogInfo("NumberOfBins") << "Number of Bins: " << m_nbins;
69  edm::LogInfo("ScaleFactors") << "y-axis range scale factor: " << m_scalefact;
70  edm::LogInfo("BinMaxValue") << "Setting bin max values";
71 
72  for(std::map<unsigned int,std::string>::const_iterator lab=m_labels.begin();lab!=m_labels.end();lab++) {
73 
74  const unsigned int i = lab->first; const std::string slab = lab->second;
75 
76  if(m_binmax.find(i)==m_binmax.end()) {
77  edm::LogVerbatim("NotConfiguredBinMax") << "Bin max for " << lab->second
78  << " not configured: " << trnumb.nstrips(i) << " used";
79  m_binmax[i] = trnumb.nstrips(i);
80  }
81 
82  edm::LogVerbatim("BinMaxValue") << "Bin max for " << lab->second << " is " << m_binmax[i];
83 
84  }
85 
86  for(std::map<unsigned int,std::string>::const_iterator lab=m_labels.begin();lab!=m_labels.end();++lab) {
87 
88  const int i = lab->first; const std::string slab = lab->second;
89 
90  char name[200];
91  char title[500];
92 
93  m_subdirs[i] = new TFileDirectory(subev.mkdir(slab.c_str()));
94 
95  if(m_subdirs[i]) {
96  sprintf(name,"n%sdigivsmclumi",slab.c_str());
97  sprintf(title,"%s %s multiplicity ave pileup interactions",slab.c_str(),m_hitname.c_str());
98  m_nmultvsmclumi[i] = m_subdirs[i]->make<TH2F>(name,title,200,0.,50.,m_nbins,0.,m_binmax[i]/(m_scalefact*m_nbins)*m_nbins);
99  m_nmultvsmclumi[i]->GetXaxis()->SetTitle("Average Pileup Interactions"); m_nmultvsmclumi[i]->GetYaxis()->SetTitle("Number of Hits");
100  sprintf(name,"n%sdigivsmclumiprof",slab.c_str());
101  m_nmultvsmclumiprof[i] = m_subdirs[i]->make<TProfile>(name,title,200,0.,50.);
102  m_nmultvsmclumiprof[i]->GetXaxis()->SetTitle("Average Pileup Interactions"); m_nmultvsmclumiprof[i]->GetYaxis()->SetTitle("Number of Hits");
103 
104  sprintf(name,"n%sdigivsmcnvtx",slab.c_str());
105  sprintf(title,"%s %s multiplicity vs pileup interactions",slab.c_str(),m_hitname.c_str());
106  m_nmultvsmcnvtx[i] = m_subdirs[i]->make<TH2F>(name,title,60,-0.5,59.5,m_nbins,0.,m_binmax[i]/(m_scalefact*m_nbins)*m_nbins);
107  m_nmultvsmcnvtx[i]->GetXaxis()->SetTitle("Pileup Interactions"); m_nmultvsmcnvtx[i]->GetYaxis()->SetTitle("Number of Hits");
108  sprintf(name,"n%sdigivsmcnvtxprof",slab.c_str());
109  m_nmultvsmcnvtxprof[i] = m_subdirs[i]->make<TProfile>(name,title,60,-0.5,59.5);
110  m_nmultvsmcnvtxprof[i]->GetXaxis()->SetTitle("Pileup Interactions"); m_nmultvsmcnvtxprof[i]->GetYaxis()->SetTitle("Number of Hits");
111 
112  }
113 
114  }
115 
116 
117 }
std::map< unsigned int, std::string > m_labels
int i
Definition: DBlmapReader.cc:9
std::map< unsigned int, int > m_binmax
std::map< unsigned int, TH2F * > m_nmultvsmcnvtx
std::map< unsigned int, TProfile * > m_nmultvsmclumiprof
int nstrips(const SiStripDetId &detid) const
std::map< unsigned int, TProfile * > m_nmultvsmcnvtxprof
std::map< unsigned int, TH2F * > m_nmultvsmclumi
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, TFileDirectory * > m_subdirs
void DigiPileupCorrHistogramMaker::fill ( const edm::Event iEvent,
const std::map< unsigned int, int > &  ndigi 
)

Definition at line 124 of file DigiPileupCorrHistogramMaker.cc.

References edm::Event::getByLabel(), i, m_labels, m_nmultvsmclumi, m_nmultvsmclumiprof, m_nmultvsmcnvtx, m_nmultvsmcnvtxprof, m_pileupcollection, and m_useVisibleVertices.

Referenced by MultiplicityInvestigator::analyze().

124  {
125 
127  iEvent.getByLabel(m_pileupcollection,pileupinfos);
128 
129  // look for the intime PileupSummaryInfo
130 
131  std::vector<PileupSummaryInfo>::const_iterator pileupinfo;
132 
133  for(pileupinfo = pileupinfos->begin(); pileupinfo != pileupinfos->end() ; ++pileupinfo) {
134 
135  if(pileupinfo->getBunchCrossing()==0) break;
136 
137  }
138 
139  if(pileupinfo->getBunchCrossing()!=0) {
140 
141  edm::LogError("NoInTimePileUpInfo") << "Cannot find the in-time pileup info " << pileupinfo->getBunchCrossing();
142 
143  }
144  else {
145 
146  int npileup = pileupinfo->getPU_NumInteractions();
147 
148  if(m_useVisibleVertices) npileup = pileupinfo->getPU_zpositions().size();
149 
150  for(std::map<unsigned int,int>::const_iterator digi=ndigi.begin();digi!=ndigi.end();digi++) {
151  if(m_labels.find(digi->first) != m_labels.end()) {
152  const unsigned int i=digi->first;
153  m_nmultvsmcnvtx[i]->Fill(npileup,digi->second);
154  m_nmultvsmcnvtxprof[i]->Fill(npileup,digi->second);
155  m_nmultvsmclumi[i]->Fill(pileupinfo->getTrueNumInteractions(),digi->second);
156  m_nmultvsmclumiprof[i]->Fill(pileupinfo->getTrueNumInteractions(),digi->second);
157  }
158  }
159  }
160 }
std::map< unsigned int, std::string > m_labels
int i
Definition: DBlmapReader.cc:9
std::map< unsigned int, TH2F * > m_nmultvsmcnvtx
std::map< unsigned int, TProfile * > m_nmultvsmclumiprof
std::map< unsigned int, TProfile * > m_nmultvsmcnvtxprof
std::map< unsigned int, TH2F * > m_nmultvsmclumi
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390

Member Data Documentation

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

Definition at line 37 of file DigiPileupCorrHistogramMaker.h.

Referenced by book(), and DigiPileupCorrHistogramMaker().

std::string DigiPileupCorrHistogramMaker::m_hitname
private

Definition at line 34 of file DigiPileupCorrHistogramMaker.h.

Referenced by book().

std::map<unsigned int, std::string> DigiPileupCorrHistogramMaker::m_labels
private
const int DigiPileupCorrHistogramMaker::m_nbins
private

Definition at line 35 of file DigiPileupCorrHistogramMaker.h.

Referenced by book().

std::map<unsigned int,TH2F*> DigiPileupCorrHistogramMaker::m_nmultvsmclumi
private

Definition at line 40 of file DigiPileupCorrHistogramMaker.h.

Referenced by book(), and fill().

std::map<unsigned int,TProfile*> DigiPileupCorrHistogramMaker::m_nmultvsmclumiprof
private

Definition at line 41 of file DigiPileupCorrHistogramMaker.h.

Referenced by book(), and fill().

std::map<unsigned int,TH2F*> DigiPileupCorrHistogramMaker::m_nmultvsmcnvtx
private

Definition at line 42 of file DigiPileupCorrHistogramMaker.h.

Referenced by book(), and fill().

std::map<unsigned int,TProfile*> DigiPileupCorrHistogramMaker::m_nmultvsmcnvtxprof
private

Definition at line 43 of file DigiPileupCorrHistogramMaker.h.

Referenced by book(), and fill().

const edm::InputTag DigiPileupCorrHistogramMaker::m_pileupcollection
private

Definition at line 32 of file DigiPileupCorrHistogramMaker.h.

Referenced by fill().

const int DigiPileupCorrHistogramMaker::m_scalefact
private

Definition at line 36 of file DigiPileupCorrHistogramMaker.h.

Referenced by book().

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

Definition at line 44 of file DigiPileupCorrHistogramMaker.h.

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

bool DigiPileupCorrHistogramMaker::m_useVisibleVertices
private

Definition at line 33 of file DigiPileupCorrHistogramMaker.h.

Referenced by fill().