11 #include "TProfile2D.h" 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(),
18 m_nmultvsmclumi(), m_nmultvsmclumiprof(), m_nmultvsmcnvtx(), m_nmultvsmcnvtxprof(), m_nmultvsmcnvtxprof2d(), m_subdirs(),
19 m_2dhisto(), m_ootBX(-1) { }
25 m_nbins(iConfig.getUntrackedParameter<
int>(
"numberOfBins",500)),
29 m_ootBX(iConfig.getUntrackedParameter<
int>(
"ootBX",-1))
32 std::vector<edm::ParameterSet>
33 wantedsubds(iConfig.
getUntrackedParameter<std::vector<edm::ParameterSet> >(
"wantedSubDets",std::vector<edm::ParameterSet>()));
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");
46 for(std::map<unsigned int,std::string>::const_iterator lab=
m_labels.begin();lab!=
m_labels.end();lab++) {
48 const unsigned int i = lab->first;
const std::string slab = lab->second;
75 for(std::map<unsigned int,std::string>::const_iterator lab=
m_labels.begin();lab!=
m_labels.end();lab++) {
77 const unsigned int i = lab->first;
const std::string slab = lab->second;
81 <<
" not configured: " << trnumb.
nstrips(i) <<
" used";
89 for(std::map<unsigned int,std::string>::const_iterator lab=
m_labels.begin();lab!=
m_labels.end();++lab) {
91 const int i = lab->first;
const std::string slab = lab->second;
99 sprintf(name,
"n%sdigivsmclumi",slab.c_str());
100 sprintf(title,
"%s %s multiplicity ave pileup interactions",slab.c_str(),
m_hitname.c_str());
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());
105 m_nmultvsmclumiprof[
i]->GetXaxis()->SetTitle(
"Average Pileup Interactions"); m_nmultvsmclumiprof[
i]->GetYaxis()->SetTitle(
"Number of Hits");
107 sprintf(name,
"n%sdigivsmcnvtx",slab.c_str());
108 sprintf(title,
"%s %s multiplicity vs pileup interactions",slab.c_str(),
m_hitname.c_str());
110 m_nmultvsmcnvtx[
i]->GetXaxis()->SetTitle(
"Pileup Interactions"); m_nmultvsmcnvtx[
i]->GetYaxis()->SetTitle(
"Number of Hits");
111 sprintf(name,
"n%sdigivsmcnvtxprof",slab.c_str());
113 m_nmultvsmcnvtxprof[
i]->GetXaxis()->SetTitle(
"Pileup Interactions"); m_nmultvsmcnvtxprof[
i]->GetYaxis()->SetTitle(
"Number of Hits");
115 sprintf(name,
"n%sdigivsmcnvtxprof2d",slab.c_str());
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");
140 std::vector<PileupSummaryInfo>::const_iterator pileupinfoInTime = pileupinfos->end();
141 std::vector<PileupSummaryInfo>::const_iterator pileupinfoMinusOne = pileupinfos->end();
143 for(std::vector<PileupSummaryInfo>::const_iterator pileupinfo = pileupinfos->begin(); pileupinfo != pileupinfos->end() ; ++pileupinfo) {
145 if(pileupinfo->getBunchCrossing()==0) pileupinfoInTime = pileupinfo;
146 if(pileupinfo->getBunchCrossing()==
m_ootBX) pileupinfoMinusOne = pileupinfo;
150 if(pileupinfoInTime == pileupinfos->end()) {
152 edm::LogError(
"NoInTimePileUpInfo") <<
"Cannot find the in-time pileup info ";
157 int npileup = pileupinfoInTime->getPU_NumInteractions();
161 for(std::map<unsigned int,int>::const_iterator digi=ndigi.begin();digi!=ndigi.end();digi++) {
163 const unsigned int i=digi->first;
166 m_nmultvsmclumi[
i]->Fill(pileupinfoInTime->getTrueNumInteractions(),digi->second);
169 if(pileupinfoMinusOne != pileupinfos->end()) {
170 int npileupminusone = pileupinfoMinusOne->getPU_NumInteractions();
std::map< unsigned int, std::string > m_labels
T getUntrackedParameter(std::string const &, T const &) const
void fill(const edm::Event &iEvent, const std::map< unsigned int, int > &ndigi)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::map< unsigned int, int > m_binmax
void beginRun(const unsigned int nrun)
std::map< unsigned int, TH2F * > m_nmultvsmcnvtx
std::map< unsigned int, TProfile2D * > m_nmultvsmcnvtxprof2d
std::map< unsigned int, TProfile * > m_nmultvsmclumiprof
DigiPileupCorrHistogramMaker(edm::ConsumesCollector &&iC)
std::map< unsigned int, TProfile * > m_nmultvsmcnvtxprof
int nstrips(const DetId &detid) const
bool m_useVisibleVertices
std::map< unsigned int, TH2F * > m_nmultvsmclumi
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > m_pileupcollectionToken
std::map< unsigned int, TFileDirectory * > m_subdirs
~DigiPileupCorrHistogramMaker()
void book(const std::string dirname, const std::map< unsigned int, std::string > &labels)