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 (edm::ConsumesCollector &&iC)
 
 DigiLumiCorrHistogramMaker (const edm::ParameterSet &iConfig, 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() {}
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::map< unsigned int, TProfile * > m_nmultvslumiprof
std::map< unsigned int, std::string > m_labels
std::map< unsigned int, TH2F * > m_nmultvslumi
std::map< unsigned int, RunHistogramManager * > m_fhm
std::map< unsigned int, TFileDirectory * > m_subdirs
edm::EDGetTokenT< LumiDetails > m_lumiProducerToken
std::map< unsigned int, int > m_binmax

◆ DigiLumiCorrHistogramMaker() [2/2]

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

Definition at line 28 of file DigiLumiCorrHistogramMaker.cc.

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

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 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::map< unsigned int, TProfile * > m_nmultvslumiprof
std::map< unsigned int, std::string > m_labels
T getUntrackedParameter(std::string const &, T const &) const
std::map< unsigned int, TH2F * > m_nmultvslumi
std::map< unsigned int, RunHistogramManager * > m_fhm
std::map< unsigned int, TFileDirectory * > m_subdirs
edm::EDGetTokenT< LumiDetails > m_lumiProducerToken
std::map< unsigned int, int > m_binmax

◆ ~DigiLumiCorrHistogramMaker()

DigiLumiCorrHistogramMaker::~DigiLumiCorrHistogramMaker ( )

Definition at line 49 of file DigiLumiCorrHistogramMaker.cc.

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

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 }
std::map< unsigned int, std::string > m_labels
std::map< unsigned int, RunHistogramManager * > m_fhm
std::map< unsigned int, TFileDirectory * > m_subdirs

Member Function Documentation

◆ beginRun()

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

Definition at line 122 of file DigiLumiCorrHistogramMaker.cc.

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

Referenced by MultiplicityInvestigator::beginRun().

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 }
std::map< unsigned int, std::string > m_labels
std::map< unsigned int, RunHistogramManager * > m_fhm
std::map< unsigned int, TFileDirectory * > m_subdirs
std::map< unsigned int, TProfile2D ** > m_nmultvslumivsbxprofrun

◆ book() [1/3]

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

Definition at line 59 of file DigiLumiCorrHistogramMaker.cc.

References BTVHLTOfflineSource_cfi::dirname, SummaryClient_cfi::labels, and m_labels.

Referenced by MultiplicityInvestigator::MultiplicityInvestigator().

61  {
62  m_labels = labels;
63  book(dirname, iC);
64 }
void book(const std::string dirname, const std::map< unsigned int, std::string > &labels, edm::ConsumesCollector &&iC)
std::map< unsigned int, std::string > m_labels

◆ book() [2/3]

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

Definition at line 29 of file DigiLumiCorrHistogramMaker.h.

References book(), and BTVHLTOfflineSource_cfi::dirname.

Referenced by book().

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

◆ book() [3/3]

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

Definition at line 66 of file DigiLumiCorrHistogramMaker.cc.

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.

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 }
Log< level::Info, true > LogVerbatim
int nstrips(const DetId &detid) const
std::map< unsigned int, TProfile * > m_nmultvslumiprof
std::map< unsigned int, std::string > m_labels
std::map< unsigned int, TH2F * > m_nmultvslumi
std::map< unsigned int, RunHistogramManager * > m_fhm
Log< level::Info, false > LogInfo
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
Definition: TFileService.h:69
std::map< unsigned int, TFileDirectory * > m_subdirs
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
std::map< unsigned int, int > m_binmax
std::map< unsigned int, TProfile2D ** > m_nmultvslumivsbxprofrun

◆ fill()

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

Definition at line 136 of file DigiLumiCorrHistogramMaker.cc.

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().

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 }
std::map< unsigned int, TProfile * > m_nmultvslumiprof
std::map< unsigned int, std::string > m_labels
int iEvent
Definition: GenABIO.cc:224
std::map< unsigned int, TH2F * > m_nmultvslumi
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
bool isValid() const
Definition: LumiDetails.cc:44
float lumiValue(AlgoType algo, unsigned int bx) const
Definition: LumiDetails.cc:72
bool isValid() const
Definition: HandleBase.h:70
edm::EDGetTokenT< LumiDetails > m_lumiProducerToken
std::map< unsigned int, TProfile2D ** > m_nmultvslumivsbxprofrun

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().