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
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

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
 
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 19 of file DigiPileupCorrHistogramMaker.h.

Constructor & Destructor Documentation

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

Definition at line 15 of file DigiPileupCorrHistogramMaker.cc.

15  :
16  m_pileupcollectionToken(iC.consumes<std::vector<PileupSummaryInfo> >(edm::InputTag("addPileupInfo"))), m_useVisibleVertices(false), m_hitname(), m_nbins(500), m_scalefact(), m_binmax(), m_labels(),
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, 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 19 of file DigiPileupCorrHistogramMaker.cc.

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

19  :
20  m_pileupcollectionToken(iC.consumes<std::vector<PileupSummaryInfo> >(iConfig.getParameter<edm::InputTag>("pileupSummaryCollection"))),
21  m_useVisibleVertices(iConfig.getParameter<bool>("useVisibleVertices")),
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
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
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > m_pileupcollectionToken
std::map< unsigned int, TFileDirectory * > m_subdirs
DigiPileupCorrHistogramMaker::~DigiPileupCorrHistogramMaker ( )

Definition at line 40 of file DigiPileupCorrHistogramMaker.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 }
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 118 of file DigiPileupCorrHistogramMaker.cc.

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

Definition at line 53 of file DigiPileupCorrHistogramMaker.cc.

References tablePrinter::labels, and m_labels.

Referenced by MultiplicityInvestigator::MultiplicityInvestigator().

53  {
54 
55  m_labels = labels;
56  book(dirname);
57 
58 }
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 60 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.

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%sdigivsmclumi",slab.c_str());
96  sprintf(title,"%s %s multiplicity ave pileup interactions",slab.c_str(),m_hitname.c_str());
97  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);
98  m_nmultvsmclumi[i]->GetXaxis()->SetTitle("Average Pileup Interactions"); m_nmultvsmclumi[i]->GetYaxis()->SetTitle("Number of Hits");
99  sprintf(name,"n%sdigivsmclumiprof",slab.c_str());
100  m_nmultvsmclumiprof[i] = m_subdirs[i]->make<TProfile>(name,title,200,0.,50.);
101  m_nmultvsmclumiprof[i]->GetXaxis()->SetTitle("Average Pileup Interactions"); m_nmultvsmclumiprof[i]->GetYaxis()->SetTitle("Number of Hits");
102 
103  sprintf(name,"n%sdigivsmcnvtx",slab.c_str());
104  sprintf(title,"%s %s multiplicity vs pileup interactions",slab.c_str(),m_hitname.c_str());
105  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);
106  m_nmultvsmcnvtx[i]->GetXaxis()->SetTitle("Pileup Interactions"); m_nmultvsmcnvtx[i]->GetYaxis()->SetTitle("Number of Hits");
107  sprintf(name,"n%sdigivsmcnvtxprof",slab.c_str());
108  m_nmultvsmcnvtxprof[i] = m_subdirs[i]->make<TProfile>(name,title,60,-0.5,59.5);
109  m_nmultvsmcnvtxprof[i]->GetXaxis()->SetTitle("Pileup Interactions"); m_nmultvsmcnvtxprof[i]->GetYaxis()->SetTitle("Number of Hits");
110 
111  }
112 
113  }
114 
115 
116 }
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 123 of file DigiPileupCorrHistogramMaker.cc.

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

Referenced by MultiplicityInvestigator::analyze().

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

Member Data Documentation

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

Definition at line 39 of file DigiPileupCorrHistogramMaker.h.

Referenced by book(), and DigiPileupCorrHistogramMaker().

std::string DigiPileupCorrHistogramMaker::m_hitname
private

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

Referenced by book().

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

Definition at line 42 of file DigiPileupCorrHistogramMaker.h.

Referenced by book(), and fill().

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

Definition at line 43 of file DigiPileupCorrHistogramMaker.h.

Referenced by book(), and fill().

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

Definition at line 44 of file DigiPileupCorrHistogramMaker.h.

Referenced by book(), and fill().

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

Definition at line 45 of file DigiPileupCorrHistogramMaker.h.

Referenced by book(), and fill().

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

Definition at line 34 of file DigiPileupCorrHistogramMaker.h.

Referenced by fill().

const int DigiPileupCorrHistogramMaker::m_scalefact
private

Definition at line 38 of file DigiPileupCorrHistogramMaker.h.

Referenced by book().

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

Definition at line 46 of file DigiPileupCorrHistogramMaker.h.

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

bool DigiPileupCorrHistogramMaker::m_useVisibleVertices
private

Definition at line 35 of file DigiPileupCorrHistogramMaker.h.

Referenced by fill().