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

Constructor & Destructor Documentation

◆ DigiPileupCorrHistogramMaker() [1/2]

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

Definition at line 15 of file DigiPileupCorrHistogramMaker.cc.

16  : m_pileupcollectionToken(iC.consumes<std::vector<PileupSummaryInfo> >(edm::InputTag("addPileupInfo"))),
17  m_useVisibleVertices(false),
18  m_hitname(),
19  m_nbins(500),
20  m_scalefact(),
21  m_binmax(),
22  m_labels(),
28  m_subdirs(),
29  m_2dhisto(),
30  m_ootBX(-1) {}

◆ DigiPileupCorrHistogramMaker() [2/2]

DigiPileupCorrHistogramMaker::DigiPileupCorrHistogramMaker ( const edm::ParameterSet iConfig,
edm::ConsumesCollector &&  iC 
)

Definition at line 32 of file DigiPileupCorrHistogramMaker.cc.

35  iC.consumes<std::vector<PileupSummaryInfo> >(iConfig.getParameter<edm::InputTag>("pileupSummaryCollection"))),
36  m_useVisibleVertices(iConfig.getParameter<bool>("useVisibleVertices")),
37  m_hitname(iConfig.getUntrackedParameter<std::string>("hitName", "digi")),
38  m_nbins(iConfig.getUntrackedParameter<int>("numberOfBins", 500)),
39  m_scalefact(iConfig.getUntrackedParameter<int>("scaleFactor", 5)),
40  m_labels(),
46  m_subdirs(),
47  m_2dhisto(iConfig.getUntrackedParameter<bool>("wanted2DHisto", false)),
48  m_ootBX(iConfig.getUntrackedParameter<int>("ootBX", -1)) {
49  std::vector<edm::ParameterSet> wantedsubds(iConfig.getUntrackedParameter<std::vector<edm::ParameterSet> >(
50  "wantedSubDets", std::vector<edm::ParameterSet>()));
51 
52  for (std::vector<edm::ParameterSet>::iterator ps = wantedsubds.begin(); ps != wantedsubds.end(); ++ps) {
53  m_labels[ps->getParameter<unsigned int>("detSelection")] = ps->getParameter<std::string>("detLabel");
54  m_binmax[ps->getParameter<unsigned int>("detSelection")] = ps->getParameter<int>("binMax");
55  }
56 }

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

◆ ~DigiPileupCorrHistogramMaker()

DigiPileupCorrHistogramMaker::~DigiPileupCorrHistogramMaker ( )

Definition at line 58 of file DigiPileupCorrHistogramMaker.cc.

58  {
59  for (std::map<unsigned int, std::string>::const_iterator lab = m_labels.begin(); lab != m_labels.end(); lab++) {
60  const unsigned int i = lab->first;
61  const std::string slab = lab->second;
62 
63  delete m_subdirs[i];
64  }
65 }

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

Member Function Documentation

◆ beginRun()

void DigiPileupCorrHistogramMaker::beginRun ( const unsigned int  nrun)

Definition at line 137 of file DigiPileupCorrHistogramMaker.cc.

137 {}

◆ book() [1/2]

void DigiPileupCorrHistogramMaker::book ( const std::string  dirname)

Definition at line 72 of file DigiPileupCorrHistogramMaker.cc.

72  {
74  TFileDirectory subev = tfserv->mkdir(dirname);
75 
76  SiStripTKNumbers trnumb;
77 
78  edm::LogInfo("NumberOfBins") << "Number of Bins: " << m_nbins;
79  edm::LogInfo("ScaleFactors") << "y-axis range scale factor: " << m_scalefact;
80  edm::LogInfo("BinMaxValue") << "Setting bin max values";
81 
82  for (std::map<unsigned int, std::string>::const_iterator lab = m_labels.begin(); lab != m_labels.end(); lab++) {
83  const unsigned int i = lab->first;
84  const std::string slab = lab->second;
85 
86  if (m_binmax.find(i) == m_binmax.end()) {
87  edm::LogVerbatim("NotConfiguredBinMax")
88  << "Bin max for " << lab->second << " not configured: " << trnumb.nstrips(i) << " used";
89  m_binmax[i] = trnumb.nstrips(i);
90  }
91 
92  edm::LogVerbatim("BinMaxValue") << "Bin max for " << lab->second << " is " << m_binmax[i];
93  }
94 
95  for (std::map<unsigned int, std::string>::const_iterator lab = m_labels.begin(); lab != m_labels.end(); ++lab) {
96  const int i = lab->first;
97  const std::string slab = lab->second;
98 
99  char name[200];
100  char title[500];
101 
102  m_subdirs[i] = new TFileDirectory(subev.mkdir(slab));
103 
104  if (m_subdirs[i]) {
105  sprintf(name, "n%sdigivsmclumi", slab.c_str());
106  sprintf(title, "%s %s multiplicity ave pileup interactions", slab.c_str(), m_hitname.c_str());
107  m_nmultvsmclumi[i] = m_subdirs[i]->make<TH2F>(
108  name, title, 200, 0., 50., m_nbins, 0., m_binmax[i] / (m_scalefact * m_nbins) * m_nbins);
109  m_nmultvsmclumi[i]->GetXaxis()->SetTitle("Average Pileup Interactions");
110  m_nmultvsmclumi[i]->GetYaxis()->SetTitle("Number of Hits");
111  sprintf(name, "n%sdigivsmclumiprof", slab.c_str());
112  m_nmultvsmclumiprof[i] = m_subdirs[i]->make<TProfile>(name, title, 200, 0., 50.);
113  m_nmultvsmclumiprof[i]->GetXaxis()->SetTitle("Average Pileup Interactions");
114  m_nmultvsmclumiprof[i]->GetYaxis()->SetTitle("Number of Hits");
115 
116  sprintf(name, "n%sdigivsmcnvtx", slab.c_str());
117  sprintf(title, "%s %s multiplicity vs pileup interactions", slab.c_str(), m_hitname.c_str());
118  m_nmultvsmcnvtx[i] = m_subdirs[i]->make<TH2F>(
119  name, title, 60, -0.5, 59.5, m_nbins, 0., m_binmax[i] / (m_scalefact * m_nbins) * m_nbins);
120  m_nmultvsmcnvtx[i]->GetXaxis()->SetTitle("Pileup Interactions");
121  m_nmultvsmcnvtx[i]->GetYaxis()->SetTitle("Number of Hits");
122  sprintf(name, "n%sdigivsmcnvtxprof", slab.c_str());
123  m_nmultvsmcnvtxprof[i] = m_subdirs[i]->make<TProfile>(name, title, 60, -0.5, 59.5);
124  m_nmultvsmcnvtxprof[i]->GetXaxis()->SetTitle("Pileup Interactions");
125  m_nmultvsmcnvtxprof[i]->GetYaxis()->SetTitle("Number of Hits");
126  if (m_2dhisto) {
127  sprintf(name, "n%sdigivsmcnvtxprof2d", slab.c_str());
128  m_nmultvsmcnvtxprof2d[i] = m_subdirs[i]->make<TProfile2D>(name, title, 60, -0.5, 59.5, 60, -0.5, 59.5);
129  m_nmultvsmcnvtxprof2d[i]->GetXaxis()->SetTitle("Pileup Interactions");
130  m_nmultvsmcnvtxprof2d[i]->GetYaxis()->SetTitle("Pileup Interactions OOT");
131  m_nmultvsmcnvtxprof2d[i]->GetZaxis()->SetTitle("Number of Hits");
132  }
133  }
134  }
135 }

References BTVHLTOfflineSource_cfi::dirname, 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, TFileDirectory::mkdir(), TFileService::mkdir(), Skims_PA_cff::name, SiStripTKNumbers::nstrips(), AlCaHLTBitMon_QueryRunRegistry::string, and runGCPTkAlMap::title.

◆ book() [2/2]

void DigiPileupCorrHistogramMaker::book ( const std::string  dirname,
const std::map< unsigned int, std::string > &  labels 
)

◆ fill()

void DigiPileupCorrHistogramMaker::fill ( const edm::Event iEvent,
const std::map< unsigned int, int > &  ndigi 
)

Definition at line 139 of file DigiPileupCorrHistogramMaker.cc.

139  {
141  iEvent.getByToken(m_pileupcollectionToken, pileupinfos);
142 
143  // look for the intime PileupSummaryInfo
144 
145  std::vector<PileupSummaryInfo>::const_iterator pileupinfoInTime = pileupinfos->end();
146  std::vector<PileupSummaryInfo>::const_iterator pileupinfoMinusOne = pileupinfos->end();
147 
148  for (std::vector<PileupSummaryInfo>::const_iterator pileupinfo = pileupinfos->begin();
149  pileupinfo != pileupinfos->end();
150  ++pileupinfo) {
151  if (pileupinfo->getBunchCrossing() == 0)
152  pileupinfoInTime = pileupinfo;
153  if (pileupinfo->getBunchCrossing() == m_ootBX)
154  pileupinfoMinusOne = pileupinfo;
155  }
156 
157  if (pileupinfoInTime == pileupinfos->end()) {
158  edm::LogError("NoInTimePileUpInfo") << "Cannot find the in-time pileup info ";
159 
160  } else {
161  int npileup = pileupinfoInTime->getPU_NumInteractions();
162 
164  npileup = pileupinfoInTime->getPU_zpositions().size();
165 
166  for (std::map<unsigned int, int>::const_iterator digi = ndigi.begin(); digi != ndigi.end(); digi++) {
167  if (m_labels.find(digi->first) != m_labels.end()) {
168  const unsigned int i = digi->first;
169  m_nmultvsmcnvtx[i]->Fill(npileup, digi->second);
170  m_nmultvsmcnvtxprof[i]->Fill(npileup, digi->second);
171  m_nmultvsmclumi[i]->Fill(pileupinfoInTime->getTrueNumInteractions(), digi->second);
172  m_nmultvsmclumiprof[i]->Fill(pileupinfoInTime->getTrueNumInteractions(), digi->second);
173  if (m_2dhisto) {
174  if (pileupinfoMinusOne != pileupinfos->end()) {
175  int npileupminusone = pileupinfoMinusOne->getPU_NumInteractions();
177  npileupminusone = pileupinfoMinusOne->getPU_zpositions().size();
178  m_nmultvsmcnvtxprof2d[i]->Fill(npileup, npileupminusone, digi->second);
179  }
180  }
181  }
182  }
183  }
184 }

References mps_fire::i, iEvent, 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().

Member Data Documentation

◆ m_2dhisto

const bool DigiPileupCorrHistogramMaker::m_2dhisto
private

Definition at line 47 of file DigiPileupCorrHistogramMaker.h.

Referenced by book(), and fill().

◆ m_binmax

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

Definition at line 37 of file DigiPileupCorrHistogramMaker.h.

Referenced by book(), and DigiPileupCorrHistogramMaker().

◆ m_hitname

std::string DigiPileupCorrHistogramMaker::m_hitname
private

Definition at line 34 of file DigiPileupCorrHistogramMaker.h.

Referenced by book().

◆ m_labels

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

◆ m_nbins

const int DigiPileupCorrHistogramMaker::m_nbins
private

Definition at line 35 of file DigiPileupCorrHistogramMaker.h.

Referenced by book().

◆ m_nmultvsmclumi

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

Definition at line 40 of file DigiPileupCorrHistogramMaker.h.

Referenced by book(), and fill().

◆ m_nmultvsmclumiprof

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

Definition at line 41 of file DigiPileupCorrHistogramMaker.h.

Referenced by book(), and fill().

◆ m_nmultvsmcnvtx

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

Definition at line 42 of file DigiPileupCorrHistogramMaker.h.

Referenced by book(), and fill().

◆ m_nmultvsmcnvtxprof

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

Definition at line 43 of file DigiPileupCorrHistogramMaker.h.

Referenced by book(), and fill().

◆ m_nmultvsmcnvtxprof2d

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

Definition at line 44 of file DigiPileupCorrHistogramMaker.h.

Referenced by book(), and fill().

◆ m_ootBX

const int DigiPileupCorrHistogramMaker::m_ootBX
private

Definition at line 48 of file DigiPileupCorrHistogramMaker.h.

Referenced by fill().

◆ m_pileupcollectionToken

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

Definition at line 32 of file DigiPileupCorrHistogramMaker.h.

Referenced by fill().

◆ m_scalefact

const int DigiPileupCorrHistogramMaker::m_scalefact
private

Definition at line 36 of file DigiPileupCorrHistogramMaker.h.

Referenced by book().

◆ m_subdirs

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

Definition at line 45 of file DigiPileupCorrHistogramMaker.h.

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

◆ m_useVisibleVertices

bool DigiPileupCorrHistogramMaker::m_useVisibleVertices
private

Definition at line 33 of file DigiPileupCorrHistogramMaker.h.

Referenced by fill().

SummaryClient_cfi.labels
labels
Definition: SummaryClient_cfi.py:61
TFileDirectory::mkdir
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
Definition: TFileDirectory.cc:112
runGCPTkAlMap.title
string title
Definition: runGCPTkAlMap.py:94
mps_fire.i
i
Definition: mps_fire.py:428
DigiPileupCorrHistogramMaker::m_2dhisto
const bool m_2dhisto
Definition: DigiPileupCorrHistogramMaker.h:47
DigiPileupCorrHistogramMaker::m_hitname
std::string m_hitname
Definition: DigiPileupCorrHistogramMaker.h:34
DigiPileupCorrHistogramMaker::m_nbins
const int m_nbins
Definition: DigiPileupCorrHistogramMaker.h:35
DigiPileupCorrHistogramMaker::m_nmultvsmcnvtxprof
std::map< unsigned int, TProfile * > m_nmultvsmcnvtxprof
Definition: DigiPileupCorrHistogramMaker.h:43
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
DigiPileupCorrHistogramMaker::m_nmultvsmclumiprof
std::map< unsigned int, TProfile * > m_nmultvsmclumiprof
Definition: DigiPileupCorrHistogramMaker.h:41
TFileDirectory
Definition: TFileDirectory.h:24
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::Handle
Definition: AssociativeIterator.h:50
DigiPileupCorrHistogramMaker::m_labels
std::map< unsigned int, std::string > m_labels
Definition: DigiPileupCorrHistogramMaker.h:38
BTVHLTOfflineSource_cfi.dirname
dirname
Definition: BTVHLTOfflineSource_cfi.py:7
DigiPileupCorrHistogramMaker::m_binmax
std::map< unsigned int, int > m_binmax
Definition: DigiPileupCorrHistogramMaker.h:37
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:55
DigiPileupCorrHistogramMaker::m_useVisibleVertices
bool m_useVisibleVertices
Definition: DigiPileupCorrHistogramMaker.h:33
TFileService::mkdir
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
Definition: TFileService.h:69
SiStripTKNumbers::nstrips
int nstrips(const DetId &detid) const
Definition: SiStripTKNumbers.cc:81
edm::Service< TFileService >
iEvent
int iEvent
Definition: GenABIO.cc:224
DigiPileupCorrHistogramMaker::m_pileupcollectionToken
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > m_pileupcollectionToken
Definition: DigiPileupCorrHistogramMaker.h:32
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
DigiPileupCorrHistogramMaker::m_scalefact
const int m_scalefact
Definition: DigiPileupCorrHistogramMaker.h:36
DigiPileupCorrHistogramMaker::m_subdirs
std::map< unsigned int, TFileDirectory * > m_subdirs
Definition: DigiPileupCorrHistogramMaker.h:45
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
DigiPileupCorrHistogramMaker::m_nmultvsmcnvtx
std::map< unsigned int, TH2F * > m_nmultvsmcnvtx
Definition: DigiPileupCorrHistogramMaker.h:42
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
DigiPileupCorrHistogramMaker::m_ootBX
const int m_ootBX
Definition: DigiPileupCorrHistogramMaker.h:48
DigiPileupCorrHistogramMaker::m_nmultvsmclumi
std::map< unsigned int, TH2F * > m_nmultvsmclumi
Definition: DigiPileupCorrHistogramMaker.h:40
DigiPileupCorrHistogramMaker::book
void book(const std::string dirname, const std::map< unsigned int, std::string > &labels)
Definition: DigiPileupCorrHistogramMaker.cc:67
edm::InputTag
Definition: InputTag.h:15
DigiPileupCorrHistogramMaker::m_nmultvsmcnvtxprof2d
std::map< unsigned int, TProfile2D * > m_nmultvsmcnvtxprof2d
Definition: DigiPileupCorrHistogramMaker.h:44
SiStripTKNumbers
Definition: SiStripTKNumbers.h:8