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
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)
 
void book (const std::string dirname)
 
 DigiLumiCorrHistogramMaker ()
 
 DigiLumiCorrHistogramMaker (const edm::ParameterSet &iConfig)
 
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
 
const edm::InputTag m_lumiProducer
 
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 20 of file DigiLumiCorrHistogramMaker.h.

Constructor & Destructor Documentation

DigiLumiCorrHistogramMaker::DigiLumiCorrHistogramMaker ( )

Definition at line 16 of file DigiLumiCorrHistogramMaker.cc.

16  :
17  m_lumiProducer("lumiProducer"), m_fhm(), m_runHisto(false),
std::map< unsigned int, TFileDirectory * > m_subdirs
std::map< unsigned int, RunHistogramManager * > m_fhm
std::map< unsigned int, int > m_binmax
std::map< unsigned int, std::string > m_labels
std::map< unsigned int, TProfile * > m_nmultvslumiprof
std::map< unsigned int, TH2F * > m_nmultvslumi
DigiLumiCorrHistogramMaker::DigiLumiCorrHistogramMaker ( const edm::ParameterSet iConfig)

Definition at line 20 of file DigiLumiCorrHistogramMaker.cc.

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

20  :
21  m_lumiProducer(iConfig.getParameter<edm::InputTag>("lumiProducer")),
22  m_fhm(),
23  m_runHisto(iConfig.getUntrackedParameter<bool>("runHisto",false)),
24  m_hitname(iConfig.getUntrackedParameter<std::string>("hitName","digi")),
25  m_nbins(iConfig.getUntrackedParameter<int>("numberOfBins",500)),
26  m_scalefact(iConfig.getUntrackedParameter<int>("scaleFactor",5)),
27  m_maxlumi(iConfig.getUntrackedParameter<double>("maxLumi",10.)),
29 {
30 
31  std::vector<edm::ParameterSet>
32  wantedsubds(iConfig.getUntrackedParameter<std::vector<edm::ParameterSet> >("wantedSubDets",std::vector<edm::ParameterSet>()));
33 
34  for(std::vector<edm::ParameterSet>::iterator ps=wantedsubds.begin();ps!=wantedsubds.end();++ps) {
35  m_labels[ps->getParameter<unsigned int>("detSelection")] = ps->getParameter<std::string>("detLabel");
36  m_binmax[ps->getParameter<unsigned int>("detSelection")] = ps->getParameter<int>("binMax");
37  }
38 
39 
40 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::map< unsigned int, TFileDirectory * > m_subdirs
std::map< unsigned int, RunHistogramManager * > m_fhm
std::map< unsigned int, int > m_binmax
std::map< unsigned int, std::string > m_labels
std::map< unsigned int, TProfile * > m_nmultvslumiprof
std::map< unsigned int, TH2F * > m_nmultvslumi
DigiLumiCorrHistogramMaker::~DigiLumiCorrHistogramMaker ( )

Definition at line 43 of file DigiLumiCorrHistogramMaker.cc.

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

43  {
44 
45  for(std::map<unsigned int,std::string>::const_iterator lab=m_labels.begin();lab!=m_labels.end();lab++) {
46 
47  const unsigned int i = lab->first; const std::string slab = lab->second;
48 
49  delete m_subdirs[i];
50  delete m_fhm[i];
51  }
52 
53 }
int i
Definition: DBlmapReader.cc:9
std::map< unsigned int, TFileDirectory * > m_subdirs
std::map< unsigned int, RunHistogramManager * > m_fhm
std::map< unsigned int, std::string > m_labels

Member Function Documentation

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

Definition at line 122 of file DigiLumiCorrHistogramMaker.cc.

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

Referenced by MultiplicityInvestigator::beginRun().

122  {
123 
125 
126 
127  for(std::map<unsigned int,std::string>::const_iterator lab=m_labels.begin();lab!=m_labels.end();++lab) {
128  const int i = lab->first; const std::string slab = lab->second;
129  m_fhm[i]->beginRun(iRun,*m_subdirs[i]);
130  if(m_runHisto) {
131  (*m_nmultvslumivsbxprofrun[i])->GetXaxis()->SetTitle("BX");
132  (*m_nmultvslumivsbxprofrun[i])->GetYaxis()->SetTitle("BX lumi [10^{30}cm^{-2}s^{-1}]");
133  }
134  }
135 
136 
137 }
int i
Definition: DBlmapReader.cc:9
std::map< unsigned int, TFileDirectory * > m_subdirs
std::map< unsigned int, RunHistogramManager * > m_fhm
std::map< unsigned int, std::string > m_labels
std::map< unsigned int, TProfile2D ** > m_nmultvslumivsbxprofrun
void DigiLumiCorrHistogramMaker::book ( const std::string  dirname,
const std::map< unsigned int, std::string > &  labels 
)

Definition at line 57 of file DigiLumiCorrHistogramMaker.cc.

References tablePrinter::labels, and m_labels.

Referenced by MultiplicityInvestigator::MultiplicityInvestigator().

57  {
58 
59  m_labels = labels;
60  book(dirname);
61 
62 }
std::map< unsigned int, std::string > m_labels
void book(const std::string dirname, const std::map< unsigned int, std::string > &labels)
void DigiLumiCorrHistogramMaker::book ( const std::string  dirname)

Definition at line 64 of file DigiLumiCorrHistogramMaker.cc.

References 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(), mergeVDriftHistosByStation::name, SiStripTKNumbers::nstrips(), AlCaHLTBitMon_QueryRunRegistry::string, and indexGen::title.

64  {
65 
67  TFileDirectory subev = tfserv->mkdir(dirname);
68 
69  SiStripTKNumbers trnumb;
70 
71  edm::LogInfo("NumberOfBins") << "Number of Bins: " << m_nbins;
72  edm::LogInfo("ScaleFactors") << "y-axis range scale factor: " << m_scalefact;
73  edm::LogInfo("MaxLumi") << "max lumi value: " << m_maxlumi;
74  edm::LogInfo("BinMaxValue") << "Setting bin max values";
75 
76  for(std::map<unsigned int,std::string>::const_iterator lab=m_labels.begin();lab!=m_labels.end();lab++) {
77 
78  const unsigned int i = lab->first; const std::string slab = lab->second;
79 
80  if(m_binmax.find(i)==m_binmax.end()) {
81  edm::LogVerbatim("NotConfiguredBinMax") << "Bin max for " << lab->second
82  << " not configured: " << trnumb.nstrips(i) << " used";
83  m_binmax[i] = trnumb.nstrips(i);
84  }
85 
86  edm::LogVerbatim("BinMaxValue") << "Bin max for " << lab->second << " is " << m_binmax[i];
87 
88  }
89 
90  for(std::map<unsigned int,std::string>::const_iterator lab=m_labels.begin();lab!=m_labels.end();++lab) {
91 
92  const int i = lab->first; 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.c_str()));
98  m_fhm[i] = new RunHistogramManager(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());
104  m_nmultvslumi[i]->GetXaxis()->SetTitle("BX lumi [10^{30}cm^{-2}s^{-1}]"); m_nmultvslumi[i]->GetYaxis()->SetTitle("Number of Hits");
105  sprintf(name,"n%sdigivslumiprof",slab.c_str());
106  m_nmultvslumiprof[i] = m_subdirs[i]->make<TProfile>(name,title,250,0.,m_maxlumi);
107  m_nmultvslumiprof[i]->GetXaxis()->SetTitle("BX lumi [10^{30}cm^{-2}s^{-1}]"); m_nmultvslumiprof[i]->GetYaxis()->SetTitle("Number of Hits");
108 
109  if(m_runHisto) {
110  edm::LogInfo("RunHistos") << "Pseudo-booking run histos " << slab.c_str();
111  sprintf(name,"n%sdigivslumivsbxprofrun",slab.c_str());
112  sprintf(title,"%s %s multiplicity vs BX lumi vs BX",slab.c_str(),m_hitname.c_str());
113  m_nmultvslumivsbxprofrun[i] = m_fhm[i]->makeTProfile2D(name,title,3564,-0.5,3563.5,250,0.,m_maxlumi);
114  }
115  }
116 
117  }
118 
119 
120 }
int i
Definition: DBlmapReader.cc:9
std::map< unsigned int, TFileDirectory * > m_subdirs
std::map< unsigned int, RunHistogramManager * > m_fhm
std::map< unsigned int, int > m_binmax
std::map< unsigned int, std::string > m_labels
int nstrips(const SiStripDetId &detid) const
std::map< unsigned int, TProfile2D ** > m_nmultvslumivsbxprofrun
std::map< unsigned int, TProfile * > m_nmultvslumiprof
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
Definition: TFileService.h:69
std::map< unsigned int, TH2F * > m_nmultvslumi
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
void DigiLumiCorrHistogramMaker::fill ( const edm::Event iEvent,
const std::map< unsigned int, int > &  ndigi 
)

Definition at line 139 of file DigiLumiCorrHistogramMaker.cc.

References edm::EventBase::bunchCrossing(), HcalObjRepresent::Fill(), edm::LuminosityBlock::getByLabel(), edm::Event::getLuminosityBlock(), i, edm::HandleBase::isValid(), LumiDetails::kOCC1, m_labels, m_lumiProducer, m_nmultvslumi, m_nmultvslumiprof, and m_nmultvslumivsbxprofrun.

Referenced by MultiplicityInvestigator::analyze().

139  {
140 
143 
144  if(ld.isValid()) {
145  if(ld->isValid()) {
146  float bxlumi = ld->lumiValue(LumiDetails::kOCC1,iEvent.bunchCrossing())*6.37;
147 
148  for(std::map<unsigned int,int>::const_iterator digi=ndigi.begin();digi!=ndigi.end();digi++) {
149  if(m_labels.find(digi->first) != m_labels.end()) {
150  const unsigned int i=digi->first;
151  m_nmultvslumi[i]->Fill(bxlumi,digi->second);
152  m_nmultvslumiprof[i]->Fill(bxlumi,digi->second);
153 
154  if(m_nmultvslumivsbxprofrun[i] && *m_nmultvslumivsbxprofrun[i]) (*m_nmultvslumivsbxprofrun[i])->Fill(iEvent.bunchCrossing(),bxlumi,digi->second);
155 
156  }
157  }
158  }
159  }
160 }
int i
Definition: DBlmapReader.cc:9
std::map< unsigned int, std::string > m_labels
int bunchCrossing() const
Definition: EventBase.h:62
bool getByLabel(std::string const &label, Handle< PROD > &result) const
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
std::map< unsigned int, TProfile2D ** > m_nmultvslumivsbxprofrun
std::map< unsigned int, TProfile * > m_nmultvslumiprof
LuminosityBlock const & getLuminosityBlock() const
Definition: Event.h:80
bool isValid() const
Definition: HandleBase.h:76
std::map< unsigned int, TH2F * > m_nmultvslumi

Member Data Documentation

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

Definition at line 42 of file DigiLumiCorrHistogramMaker.h.

Referenced by book(), and DigiLumiCorrHistogramMaker().

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

Definition at line 36 of file DigiLumiCorrHistogramMaker.h.

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

std::string DigiLumiCorrHistogramMaker::m_hitname
private

Definition at line 38 of file DigiLumiCorrHistogramMaker.h.

Referenced by book().

std::map<unsigned int, std::string> DigiLumiCorrHistogramMaker::m_labels
private
const edm::InputTag DigiLumiCorrHistogramMaker::m_lumiProducer
private

Definition at line 35 of file DigiLumiCorrHistogramMaker.h.

Referenced by fill().

const double DigiLumiCorrHistogramMaker::m_maxlumi
private

Definition at line 41 of file DigiLumiCorrHistogramMaker.h.

Referenced by book().

const int DigiLumiCorrHistogramMaker::m_nbins
private

Definition at line 39 of file DigiLumiCorrHistogramMaker.h.

Referenced by book().

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

Definition at line 45 of file DigiLumiCorrHistogramMaker.h.

Referenced by book(), and fill().

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

Definition at line 46 of file DigiLumiCorrHistogramMaker.h.

Referenced by book(), and fill().

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

Definition at line 47 of file DigiLumiCorrHistogramMaker.h.

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

bool DigiLumiCorrHistogramMaker::m_runHisto
private

Definition at line 37 of file DigiLumiCorrHistogramMaker.h.

Referenced by beginRun(), and book().

const int DigiLumiCorrHistogramMaker::m_scalefact
private

Definition at line 40 of file DigiLumiCorrHistogramMaker.h.

Referenced by book().

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

Definition at line 48 of file DigiLumiCorrHistogramMaker.h.

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