CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
DigiLumiCorrHistogramMaker Class Reference

#include <DigiLumiCorrHistogramMaker.h>

Public Member Functions

void beginRun (const edm::Run &iRun)
 
void book (const std::string dirname, const std::map< unsigned int, std::string > &labels, edm::ConsumesCollector &&iC)
 
void book (const std::string dirname, edm::ConsumesCollector &&iC)
 
void book (const std::string dirname, edm::ConsumesCollector &iC)
 
 DigiLumiCorrHistogramMaker (const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC)
 
 DigiLumiCorrHistogramMaker (edm::ConsumesCollector &&iC)
 
void fill (const edm::Event &iEvent, const std::map< unsigned int, int > &ndigi)
 
 ~DigiLumiCorrHistogramMaker ()
 

Private Attributes

std::map< unsigned int, int > m_binmax
 
std::map< unsigned int, RunHistogramManager * > m_fhm
 
std::string m_hitname
 
std::map< unsigned int, std::string > m_labels
 
edm::EDGetTokenT< LumiDetailsm_lumiProducerToken
 
const double m_maxlumi
 
const int m_nbins
 
std::map< unsigned int, TH2F * > m_nmultvslumi
 
std::map< unsigned int, TProfile * > m_nmultvslumiprof
 
std::map< unsigned int, TProfile2D ** > m_nmultvslumivsbxprofrun
 
bool m_runHisto
 
const int m_scalefact
 
std::map< unsigned int, TFileDirectory * > m_subdirs
 

Detailed Description

Definition at line 21 of file DigiLumiCorrHistogramMaker.h.

Constructor & Destructor Documentation

◆ DigiLumiCorrHistogramMaker() [1/2]

DigiLumiCorrHistogramMaker::DigiLumiCorrHistogramMaker ( edm::ConsumesCollector &&  iC)

Definition at line 14 of file DigiLumiCorrHistogramMaker.cc.

16  m_fhm(),
17  m_runHisto(false),
18  m_hitname(),
19  m_nbins(500),
20  m_scalefact(),
21  m_maxlumi(10.),
22  m_binmax(),
23  m_labels(),
24  m_nmultvslumi(),
26  m_subdirs() {}

◆ DigiLumiCorrHistogramMaker() [2/2]

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

Definition at line 28 of file DigiLumiCorrHistogramMaker.cc.

30  m_fhm(),
31  m_runHisto(iConfig.getUntrackedParameter<bool>("runHisto", false)),
32  m_hitname(iConfig.getUntrackedParameter<std::string>("hitName", "digi")),
33  m_nbins(iConfig.getUntrackedParameter<int>("numberOfBins", 500)),
34  m_scalefact(iConfig.getUntrackedParameter<int>("scaleFactor", 5)),
35  m_maxlumi(iConfig.getUntrackedParameter<double>("maxLumi", 10.)),
36  m_labels(),
37  m_nmultvslumi(),
39  m_subdirs() {
40  std::vector<edm::ParameterSet> wantedsubds(iConfig.getUntrackedParameter<std::vector<edm::ParameterSet> >(
41  "wantedSubDets", std::vector<edm::ParameterSet>()));
42 
43  for (std::vector<edm::ParameterSet>::iterator ps = wantedsubds.begin(); ps != wantedsubds.end(); ++ps) {
44  m_labels[ps->getParameter<unsigned int>("detSelection")] = ps->getParameter<std::string>("detLabel");
45  m_binmax[ps->getParameter<unsigned int>("detSelection")] = ps->getParameter<int>("binMax");
46  }
47 }

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

◆ ~DigiLumiCorrHistogramMaker()

DigiLumiCorrHistogramMaker::~DigiLumiCorrHistogramMaker ( )

Definition at line 49 of file DigiLumiCorrHistogramMaker.cc.

49  {
50  for (std::map<unsigned int, std::string>::const_iterator lab = m_labels.begin(); lab != m_labels.end(); lab++) {
51  const unsigned int i = lab->first;
52  const std::string slab = lab->second;
53 
54  delete m_subdirs[i];
55  delete m_fhm[i];
56  }
57 }

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

Member Function Documentation

◆ beginRun()

void DigiLumiCorrHistogramMaker::beginRun ( const edm::Run iRun)

Definition at line 122 of file DigiLumiCorrHistogramMaker.cc.

122  {
124 
125  for (std::map<unsigned int, std::string>::const_iterator lab = m_labels.begin(); lab != m_labels.end(); ++lab) {
126  const int i = lab->first;
127  const std::string slab = lab->second;
128  m_fhm[i]->beginRun(iRun, *m_subdirs[i]);
129  if (m_runHisto) {
130  (*m_nmultvslumivsbxprofrun[i])->GetXaxis()->SetTitle("BX");
131  (*m_nmultvslumivsbxprofrun[i])->GetYaxis()->SetTitle("BX lumi [10^{30}cm^{-2}s^{-1}]");
132  }
133  }
134 }

References mps_fire::i, m_fhm, m_labels, m_nmultvslumivsbxprofrun, m_runHisto, m_subdirs, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by MultiplicityInvestigator::beginRun().

◆ book() [1/3]

void DigiLumiCorrHistogramMaker::book ( const std::string  dirname,
const std::map< unsigned int, std::string > &  labels,
edm::ConsumesCollector &&  iC 
)

◆ book() [2/3]

void DigiLumiCorrHistogramMaker::book ( const std::string  dirname,
edm::ConsumesCollector &&  iC 
)
inline

Definition at line 29 of file DigiLumiCorrHistogramMaker.h.

29 { book(dirname, iC); }

References book(), and BTVHLTOfflineSource_cfi::dirname.

Referenced by book().

◆ book() [3/3]

void DigiLumiCorrHistogramMaker::book ( const std::string  dirname,
edm::ConsumesCollector iC 
)

Definition at line 66 of file DigiLumiCorrHistogramMaker.cc.

66  {
68  TFileDirectory subev = tfserv->mkdir(dirname);
69 
70  SiStripTKNumbers trnumb;
71 
72  edm::LogInfo("NumberOfBins") << "Number of Bins: " << m_nbins;
73  edm::LogInfo("ScaleFactors") << "y-axis range scale factor: " << m_scalefact;
74  edm::LogInfo("MaxLumi") << "max lumi value: " << m_maxlumi;
75  edm::LogInfo("BinMaxValue") << "Setting bin max values";
76 
77  for (std::map<unsigned int, std::string>::const_iterator lab = m_labels.begin(); lab != m_labels.end(); lab++) {
78  const unsigned int i = lab->first;
79  const std::string slab = lab->second;
80 
81  if (m_binmax.find(i) == m_binmax.end()) {
82  edm::LogVerbatim("NotConfiguredBinMax")
83  << "Bin max for " << lab->second << " not configured: " << trnumb.nstrips(i) << " used";
84  m_binmax[i] = trnumb.nstrips(i);
85  }
86 
87  edm::LogVerbatim("BinMaxValue") << "Bin max for " << lab->second << " is " << m_binmax[i];
88  }
89 
90  for (std::map<unsigned int, std::string>::const_iterator lab = m_labels.begin(); lab != m_labels.end(); ++lab) {
91  const int i = lab->first;
92  const std::string slab = lab->second;
93 
94  char name[200];
95  char title[500];
96 
97  m_subdirs[i] = new TFileDirectory(subev.mkdir(slab));
98  m_fhm[i] = new RunHistogramManager(iC, true);
99 
100  if (m_subdirs[i]) {
101  sprintf(name, "n%sdigivslumi", slab.c_str());
102  sprintf(title, "%s %s multiplicity vs BX lumi", slab.c_str(), m_hitname.c_str());
103  m_nmultvslumi[i] = m_subdirs[i]->make<TH2F>(
104  name, title, 250, 0., m_maxlumi, m_nbins, 0., (1 + m_binmax[i] / (m_scalefact * m_nbins)) * m_nbins);
105  m_nmultvslumi[i]->GetXaxis()->SetTitle("BX lumi [10^{30}cm^{-2}s^{-1}]");
106  m_nmultvslumi[i]->GetYaxis()->SetTitle("Number of Hits");
107  sprintf(name, "n%sdigivslumiprof", slab.c_str());
108  m_nmultvslumiprof[i] = m_subdirs[i]->make<TProfile>(name, title, 250, 0., m_maxlumi);
109  m_nmultvslumiprof[i]->GetXaxis()->SetTitle("BX lumi [10^{30}cm^{-2}s^{-1}]");
110  m_nmultvslumiprof[i]->GetYaxis()->SetTitle("Number of Hits");
111 
112  if (m_runHisto) {
113  edm::LogInfo("RunHistos") << "Pseudo-booking run histos " << slab.c_str();
114  sprintf(name, "n%sdigivslumivsbxprofrun", slab.c_str());
115  sprintf(title, "%s %s multiplicity vs BX lumi vs BX", slab.c_str(), m_hitname.c_str());
116  m_nmultvslumivsbxprofrun[i] = m_fhm[i]->makeTProfile2D(name, title, 3564, -0.5, 3563.5, 250, 0., m_maxlumi);
117  }
118  }
119  }
120 }

References BTVHLTOfflineSource_cfi::dirname, mps_fire::i, m_binmax, m_fhm, m_hitname, m_labels, m_maxlumi, m_nbins, m_nmultvslumi, m_nmultvslumiprof, m_nmultvslumivsbxprofrun, m_runHisto, m_scalefact, m_subdirs, TFileDirectory::mkdir(), TFileService::mkdir(), Skims_PA_cff::name, SiStripTKNumbers::nstrips(), AlCaHLTBitMon_QueryRunRegistry::string, and runGCPTkAlMap::title.

◆ fill()

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

Definition at line 136 of file DigiLumiCorrHistogramMaker.cc.

136  {
138  iEvent.getLuminosityBlock().getByToken(m_lumiProducerToken, ld);
139 
140  if (ld.isValid()) {
141  if (ld->isValid()) {
142  float bxlumi = ld->lumiValue(LumiDetails::kOCC1, iEvent.bunchCrossing()) * 6.37;
143 
144  for (std::map<unsigned int, int>::const_iterator digi = ndigi.begin(); digi != ndigi.end(); digi++) {
145  if (m_labels.find(digi->first) != m_labels.end()) {
146  const unsigned int i = digi->first;
147  m_nmultvslumi[i]->Fill(bxlumi, digi->second);
148  m_nmultvslumiprof[i]->Fill(bxlumi, digi->second);
149 
151  (*m_nmultvslumivsbxprofrun[i])->Fill(iEvent.bunchCrossing() % 3564, bxlumi, digi->second);
152  }
153  }
154  }
155  }
156 }

References HcalObjRepresent::Fill(), mps_fire::i, iEvent, LumiDetails::isValid(), edm::HandleBase::isValid(), LumiDetails::kOCC1, LumiDetails::lumiValue(), m_labels, m_lumiProducerToken, m_nmultvslumi, m_nmultvslumiprof, and m_nmultvslumivsbxprofrun.

Referenced by MultiplicityInvestigator::analyze().

Member Data Documentation

◆ m_binmax

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

Definition at line 42 of file DigiLumiCorrHistogramMaker.h.

Referenced by book(), and DigiLumiCorrHistogramMaker().

◆ m_fhm

std::map<unsigned int, RunHistogramManager*> DigiLumiCorrHistogramMaker::m_fhm
private

Definition at line 36 of file DigiLumiCorrHistogramMaker.h.

Referenced by beginRun(), book(), and ~DigiLumiCorrHistogramMaker().

◆ m_hitname

std::string DigiLumiCorrHistogramMaker::m_hitname
private

Definition at line 38 of file DigiLumiCorrHistogramMaker.h.

Referenced by book().

◆ m_labels

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

◆ m_lumiProducerToken

edm::EDGetTokenT<LumiDetails> DigiLumiCorrHistogramMaker::m_lumiProducerToken
private

Definition at line 35 of file DigiLumiCorrHistogramMaker.h.

Referenced by fill().

◆ m_maxlumi

const double DigiLumiCorrHistogramMaker::m_maxlumi
private

Definition at line 41 of file DigiLumiCorrHistogramMaker.h.

Referenced by book().

◆ m_nbins

const int DigiLumiCorrHistogramMaker::m_nbins
private

Definition at line 39 of file DigiLumiCorrHistogramMaker.h.

Referenced by book().

◆ m_nmultvslumi

std::map<unsigned int, TH2F*> DigiLumiCorrHistogramMaker::m_nmultvslumi
private

Definition at line 45 of file DigiLumiCorrHistogramMaker.h.

Referenced by book(), and fill().

◆ m_nmultvslumiprof

std::map<unsigned int, TProfile*> DigiLumiCorrHistogramMaker::m_nmultvslumiprof
private

Definition at line 46 of file DigiLumiCorrHistogramMaker.h.

Referenced by book(), and fill().

◆ m_nmultvslumivsbxprofrun

std::map<unsigned int, TProfile2D**> DigiLumiCorrHistogramMaker::m_nmultvslumivsbxprofrun
private

Definition at line 47 of file DigiLumiCorrHistogramMaker.h.

Referenced by beginRun(), book(), and fill().

◆ m_runHisto

bool DigiLumiCorrHistogramMaker::m_runHisto
private

Definition at line 37 of file DigiLumiCorrHistogramMaker.h.

Referenced by beginRun(), and book().

◆ m_scalefact

const int DigiLumiCorrHistogramMaker::m_scalefact
private

Definition at line 40 of file DigiLumiCorrHistogramMaker.h.

Referenced by book().

◆ m_subdirs

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

Definition at line 48 of file DigiLumiCorrHistogramMaker.h.

Referenced by beginRun(), book(), and ~DigiLumiCorrHistogramMaker().

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
DigiLumiCorrHistogramMaker::m_fhm
std::map< unsigned int, RunHistogramManager * > m_fhm
Definition: DigiLumiCorrHistogramMaker.h:36
DigiLumiCorrHistogramMaker::m_nmultvslumi
std::map< unsigned int, TH2F * > m_nmultvslumi
Definition: DigiLumiCorrHistogramMaker.h:45
DigiLumiCorrHistogramMaker::book
void book(const std::string dirname, const std::map< unsigned int, std::string > &labels, edm::ConsumesCollector &&iC)
Definition: DigiLumiCorrHistogramMaker.cc:59
DigiLumiCorrHistogramMaker::m_binmax
std::map< unsigned int, int > m_binmax
Definition: DigiLumiCorrHistogramMaker.h:42
LumiDetails
Definition: LumiDetails.h:20
LumiDetails::kOCC1
Definition: LumiDetails.h:26
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
TFileDirectory
Definition: TFileDirectory.h:24
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::Handle
Definition: AssociativeIterator.h:50
BTVHLTOfflineSource_cfi.dirname
dirname
Definition: BTVHLTOfflineSource_cfi.py:7
LumiDetails::isValid
bool isValid() const
Definition: LumiDetails.cc:44
RunHistogramManager
Definition: RunHistogramManager.h:210
DigiLumiCorrHistogramMaker::m_runHisto
bool m_runHisto
Definition: DigiLumiCorrHistogramMaker.h:37
LumiDetails::lumiValue
float lumiValue(AlgoType algo, unsigned int bx) const
Definition: LumiDetails.cc:72
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:55
DigiLumiCorrHistogramMaker::m_scalefact
const int m_scalefact
Definition: DigiLumiCorrHistogramMaker.h:40
DigiLumiCorrHistogramMaker::m_lumiProducerToken
edm::EDGetTokenT< LumiDetails > m_lumiProducerToken
Definition: DigiLumiCorrHistogramMaker.h:35
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::InLumi
Definition: BranchType.h:11
edm::Service< TFileService >
iEvent
int iEvent
Definition: GenABIO.cc:224
DigiLumiCorrHistogramMaker::m_hitname
std::string m_hitname
Definition: DigiLumiCorrHistogramMaker.h:38
DigiLumiCorrHistogramMaker::m_maxlumi
const double m_maxlumi
Definition: DigiLumiCorrHistogramMaker.h:41
DigiLumiCorrHistogramMaker::m_nmultvslumiprof
std::map< unsigned int, TProfile * > m_nmultvslumiprof
Definition: DigiLumiCorrHistogramMaker.h:46
DigiLumiCorrHistogramMaker::m_nmultvslumivsbxprofrun
std::map< unsigned int, TProfile2D ** > m_nmultvslumivsbxprofrun
Definition: DigiLumiCorrHistogramMaker.h:47
DigiLumiCorrHistogramMaker::m_subdirs
std::map< unsigned int, TFileDirectory * > m_subdirs
Definition: DigiLumiCorrHistogramMaker.h:48
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HcalObjRepresent::Fill
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
Definition: HcalObjRepresent.h:1053
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
DigiLumiCorrHistogramMaker::m_labels
std::map< unsigned int, std::string > m_labels
Definition: DigiLumiCorrHistogramMaker.h:43
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::InputTag
Definition: InputTag.h:15
DigiLumiCorrHistogramMaker::m_nbins
const int m_nbins
Definition: DigiLumiCorrHistogramMaker.h:39
SiStripTKNumbers
Definition: SiStripTKNumbers.h:8