CMS 3D CMS Logo

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

Private Attributes

const bool m_2dhisto
 
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
 
std::map< unsigned int, TProfile2D * > m_nmultvsmcnvtxprof2d
 
const int m_ootBX
 
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > m_pileupcollectionToken
 
const int m_scalefact
 
std::map< unsigned int, TFileDirectory * > m_subdirs
 
bool m_useVisibleVertices
 

Detailed Description

Definition at line 20 of file DigiPileupCorrHistogramMaker.h.

Constructor & Destructor Documentation

DigiPileupCorrHistogramMaker::DigiPileupCorrHistogramMaker ( edm::ConsumesCollector &&  iC)

Definition at line 16 of file DigiPileupCorrHistogramMaker.cc.

16  :
17  m_pileupcollectionToken(iC.consumes<std::vector<PileupSummaryInfo> >(edm::InputTag("addPileupInfo"))), m_useVisibleVertices(false), m_hitname(), m_nbins(500), m_scalefact(), m_binmax(), m_labels(),
19  m_2dhisto(), m_ootBX(-1) { }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
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, TProfile2D * > m_nmultvsmcnvtxprof2d
std::map< unsigned int, TProfile * > m_nmultvsmclumiprof
std::map< unsigned int, TProfile * > m_nmultvsmcnvtxprof
std::map< unsigned int, TH2F * > m_nmultvsmclumi
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > m_pileupcollectionToken
std::map< unsigned int, TFileDirectory * > m_subdirs
DigiPileupCorrHistogramMaker::DigiPileupCorrHistogramMaker ( const edm::ParameterSet iConfig,
edm::ConsumesCollector &&  iC 
)

Definition at line 21 of file DigiPileupCorrHistogramMaker.cc.

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

21  :
22  m_pileupcollectionToken(iC.consumes<std::vector<PileupSummaryInfo> >(iConfig.getParameter<edm::InputTag>("pileupSummaryCollection"))),
23  m_useVisibleVertices(iConfig.getParameter<bool>("useVisibleVertices")),
24  m_hitname(iConfig.getUntrackedParameter<std::string>("hitName","digi")),
25  m_nbins(iConfig.getUntrackedParameter<int>("numberOfBins",500)),
26  m_scalefact(iConfig.getUntrackedParameter<int>("scaleFactor",5)),
28  m_2dhisto(iConfig.getUntrackedParameter<bool>("wanted2DHisto",false)),
29  m_ootBX(iConfig.getUntrackedParameter<int>("ootBX",-1))
30 {
31 
32  std::vector<edm::ParameterSet>
33  wantedsubds(iConfig.getUntrackedParameter<std::vector<edm::ParameterSet> >("wantedSubDets",std::vector<edm::ParameterSet>()));
34 
35  for(std::vector<edm::ParameterSet>::iterator ps=wantedsubds.begin();ps!=wantedsubds.end();++ps) {
36  m_labels[ps->getParameter<unsigned int>("detSelection")] = ps->getParameter<std::string>("detLabel");
37  m_binmax[ps->getParameter<unsigned int>("detSelection")] = ps->getParameter<int>("binMax");
38  }
39 
40 
41 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
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, TProfile2D * > m_nmultvsmcnvtxprof2d
std::map< unsigned int, TProfile * > m_nmultvsmclumiprof
std::map< unsigned int, TProfile * > m_nmultvsmcnvtxprof
std::map< unsigned int, TH2F * > m_nmultvsmclumi
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > m_pileupcollectionToken
std::map< unsigned int, TFileDirectory * > m_subdirs
DigiPileupCorrHistogramMaker::~DigiPileupCorrHistogramMaker ( )

Definition at line 44 of file DigiPileupCorrHistogramMaker.cc.

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

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

Member Function Documentation

void DigiPileupCorrHistogramMaker::beginRun ( const unsigned int  nrun)

Definition at line 128 of file DigiPileupCorrHistogramMaker.cc.

128  {
129 
130 
131 }
void DigiPileupCorrHistogramMaker::book ( const std::string  dirname,
const std::map< unsigned int, std::string > &  labels 
)

Definition at line 57 of file DigiPileupCorrHistogramMaker.cc.

References tablePrinter::labels, and m_labels.

Referenced by MultiplicityInvestigator::MultiplicityInvestigator().

57  {
58 
59  m_labels = labels;
60  book(dirname);
61 
62 }
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 64 of file DigiPileupCorrHistogramMaker.cc.

References mps_fire::i, m_2dhisto, m_binmax, m_hitname, m_labels, m_nbins, m_nmultvsmclumi, m_nmultvsmclumiprof, m_nmultvsmcnvtx, m_nmultvsmcnvtxprof, m_nmultvsmcnvtxprof2d, m_scalefact, m_subdirs, TFileService::mkdir(), TFileDirectory::mkdir(), dataset::name, SiStripTKNumbers::nstrips(), AlCaHLTBitMon_QueryRunRegistry::string, and fftjetcommon_cfi::title.

64  {
65 
67  TFileDirectory subev = tfserv->mkdir(dirname);
68 
69  SiStripTKNumbers trnumb;
70 
71  edm::LogInfo("NumberOfBins") << "Number of Bins: " << m_nbins;
72  edm::LogInfo("ScaleFactors") << "y-axis range scale factor: " << m_scalefact;
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 
77  const unsigned int i = lab->first; const std::string slab = lab->second;
78 
79  if(m_binmax.find(i)==m_binmax.end()) {
80  edm::LogVerbatim("NotConfiguredBinMax") << "Bin max for " << lab->second
81  << " 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 
89  for(std::map<unsigned int,std::string>::const_iterator lab=m_labels.begin();lab!=m_labels.end();++lab) {
90 
91  const int i = lab->first; const std::string slab = lab->second;
92 
93  char name[200];
94  char title[500];
95 
96  m_subdirs[i] = new TFileDirectory(subev.mkdir(slab));
97 
98  if(m_subdirs[i]) {
99  sprintf(name,"n%sdigivsmclumi",slab.c_str());
100  sprintf(title,"%s %s multiplicity ave pileup interactions",slab.c_str(),m_hitname.c_str());
101  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);
102  m_nmultvsmclumi[i]->GetXaxis()->SetTitle("Average Pileup Interactions"); m_nmultvsmclumi[i]->GetYaxis()->SetTitle("Number of Hits");
103  sprintf(name,"n%sdigivsmclumiprof",slab.c_str());
104  m_nmultvsmclumiprof[i] = m_subdirs[i]->make<TProfile>(name,title,200,0.,50.);
105  m_nmultvsmclumiprof[i]->GetXaxis()->SetTitle("Average Pileup Interactions"); m_nmultvsmclumiprof[i]->GetYaxis()->SetTitle("Number of Hits");
106 
107  sprintf(name,"n%sdigivsmcnvtx",slab.c_str());
108  sprintf(title,"%s %s multiplicity vs pileup interactions",slab.c_str(),m_hitname.c_str());
109  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);
110  m_nmultvsmcnvtx[i]->GetXaxis()->SetTitle("Pileup Interactions"); m_nmultvsmcnvtx[i]->GetYaxis()->SetTitle("Number of Hits");
111  sprintf(name,"n%sdigivsmcnvtxprof",slab.c_str());
112  m_nmultvsmcnvtxprof[i] = m_subdirs[i]->make<TProfile>(name,title,60,-0.5,59.5);
113  m_nmultvsmcnvtxprof[i]->GetXaxis()->SetTitle("Pileup Interactions"); m_nmultvsmcnvtxprof[i]->GetYaxis()->SetTitle("Number of Hits");
114  if(m_2dhisto) {
115  sprintf(name,"n%sdigivsmcnvtxprof2d",slab.c_str());
116  m_nmultvsmcnvtxprof2d[i] = m_subdirs[i]->make<TProfile2D>(name,title,60,-0.5,59.5,60,-0.5,59.5);
117  m_nmultvsmcnvtxprof2d[i]->GetXaxis()->SetTitle("Pileup Interactions");
118  m_nmultvsmcnvtxprof2d[i]->GetYaxis()->SetTitle("Pileup Interactions OOT");
119  m_nmultvsmcnvtxprof2d[i]->GetZaxis()->SetTitle("Number of Hits");
120  }
121  }
122 
123  }
124 
125 
126 }
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, TProfile2D * > m_nmultvsmcnvtxprof2d
std::map< unsigned int, TProfile * > m_nmultvsmclumiprof
std::map< unsigned int, TProfile * > m_nmultvsmcnvtxprof
int nstrips(const DetId &detid) const
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 133 of file DigiPileupCorrHistogramMaker.cc.

References edm::Event::getByToken(), mps_fire::i, m_2dhisto, m_labels, m_nmultvsmclumi, m_nmultvsmclumiprof, m_nmultvsmcnvtx, m_nmultvsmcnvtxprof, m_nmultvsmcnvtxprof2d, m_ootBX, m_pileupcollectionToken, and m_useVisibleVertices.

Referenced by MultiplicityInvestigator::analyze().

133  {
134 
136  iEvent.getByToken(m_pileupcollectionToken,pileupinfos);
137 
138  // look for the intime PileupSummaryInfo
139 
140  std::vector<PileupSummaryInfo>::const_iterator pileupinfoInTime = pileupinfos->end();
141  std::vector<PileupSummaryInfo>::const_iterator pileupinfoMinusOne = pileupinfos->end();
142 
143  for(std::vector<PileupSummaryInfo>::const_iterator pileupinfo = pileupinfos->begin(); pileupinfo != pileupinfos->end() ; ++pileupinfo) {
144 
145  if(pileupinfo->getBunchCrossing()==0) pileupinfoInTime = pileupinfo;
146  if(pileupinfo->getBunchCrossing()==m_ootBX) pileupinfoMinusOne = pileupinfo;
147 
148  }
149 
150  if(pileupinfoInTime == pileupinfos->end()) {
151 
152  edm::LogError("NoInTimePileUpInfo") << "Cannot find the in-time pileup info ";
153 
154  }
155  else {
156 
157  int npileup = pileupinfoInTime->getPU_NumInteractions();
158 
159  if(m_useVisibleVertices) npileup = pileupinfoInTime->getPU_zpositions().size();
160 
161  for(std::map<unsigned int,int>::const_iterator digi=ndigi.begin();digi!=ndigi.end();digi++) {
162  if(m_labels.find(digi->first) != m_labels.end()) {
163  const unsigned int i=digi->first;
164  m_nmultvsmcnvtx[i]->Fill(npileup,digi->second);
165  m_nmultvsmcnvtxprof[i]->Fill(npileup,digi->second);
166  m_nmultvsmclumi[i]->Fill(pileupinfoInTime->getTrueNumInteractions(),digi->second);
167  m_nmultvsmclumiprof[i]->Fill(pileupinfoInTime->getTrueNumInteractions(),digi->second);
168  if(m_2dhisto) {
169  if(pileupinfoMinusOne != pileupinfos->end()) {
170  int npileupminusone = pileupinfoMinusOne->getPU_NumInteractions();
171  if(m_useVisibleVertices) npileupminusone = pileupinfoMinusOne->getPU_zpositions().size();
172  m_nmultvsmcnvtxprof2d[i]->Fill(npileup,npileupminusone,digi->second);
173  }
174  }
175  }
176  }
177  }
178 }
std::map< unsigned int, std::string > m_labels
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
std::map< unsigned int, TH2F * > m_nmultvsmcnvtx
std::map< unsigned int, TProfile2D * > m_nmultvsmcnvtxprof2d
std::map< unsigned int, TProfile * > m_nmultvsmclumiprof
std::map< unsigned int, TProfile * > m_nmultvsmcnvtxprof
std::map< unsigned int, TH2F * > m_nmultvsmclumi
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > m_pileupcollectionToken

Member Data Documentation

const bool DigiPileupCorrHistogramMaker::m_2dhisto
private

Definition at line 50 of file DigiPileupCorrHistogramMaker.h.

Referenced by book(), and fill().

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

Definition at line 40 of file DigiPileupCorrHistogramMaker.h.

Referenced by book(), and DigiPileupCorrHistogramMaker().

std::string DigiPileupCorrHistogramMaker::m_hitname
private

Definition at line 37 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 38 of file DigiPileupCorrHistogramMaker.h.

Referenced by book().

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

Definition at line 43 of file DigiPileupCorrHistogramMaker.h.

Referenced by book(), and fill().

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

Definition at line 44 of file DigiPileupCorrHistogramMaker.h.

Referenced by book(), and fill().

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

Definition at line 45 of file DigiPileupCorrHistogramMaker.h.

Referenced by book(), and fill().

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

Definition at line 46 of file DigiPileupCorrHistogramMaker.h.

Referenced by book(), and fill().

std::map<unsigned int,TProfile2D*> DigiPileupCorrHistogramMaker::m_nmultvsmcnvtxprof2d
private

Definition at line 47 of file DigiPileupCorrHistogramMaker.h.

Referenced by book(), and fill().

const int DigiPileupCorrHistogramMaker::m_ootBX
private

Definition at line 51 of file DigiPileupCorrHistogramMaker.h.

Referenced by fill().

edm::EDGetTokenT<std::vector<PileupSummaryInfo> > DigiPileupCorrHistogramMaker::m_pileupcollectionToken
private

Definition at line 35 of file DigiPileupCorrHistogramMaker.h.

Referenced by fill().

const int DigiPileupCorrHistogramMaker::m_scalefact
private

Definition at line 39 of file DigiPileupCorrHistogramMaker.h.

Referenced by book().

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

Definition at line 48 of file DigiPileupCorrHistogramMaker.h.

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

bool DigiPileupCorrHistogramMaker::m_useVisibleVertices
private

Definition at line 36 of file DigiPileupCorrHistogramMaker.h.

Referenced by fill().