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, 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 22 of file DigiLumiCorrHistogramMaker.h.

Constructor & Destructor Documentation

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

Definition at line 15 of file DigiLumiCorrHistogramMaker.cc.

15  :
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
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
edm::EDGetTokenT< LumiDetails > m_lumiProducerToken
DigiLumiCorrHistogramMaker::DigiLumiCorrHistogramMaker ( const edm::ParameterSet iConfig,
edm::ConsumesCollector &&  iC 
)

Definition at line 19 of file DigiLumiCorrHistogramMaker.cc.

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

19  :
21  m_fhm(),
22  m_runHisto(iConfig.getUntrackedParameter<bool>("runHisto",false)),
23  m_hitname(iConfig.getUntrackedParameter<std::string>("hitName","digi")),
24  m_nbins(iConfig.getUntrackedParameter<int>("numberOfBins",500)),
25  m_scalefact(iConfig.getUntrackedParameter<int>("scaleFactor",5)),
26  m_maxlumi(iConfig.getUntrackedParameter<double>("maxLumi",10.)),
28 {
29 
30  std::vector<edm::ParameterSet>
31  wantedsubds(iConfig.getUntrackedParameter<std::vector<edm::ParameterSet> >("wantedSubDets",std::vector<edm::ParameterSet>()));
32 
33  for(std::vector<edm::ParameterSet>::iterator ps=wantedsubds.begin();ps!=wantedsubds.end();++ps) {
34  m_labels[ps->getParameter<unsigned int>("detSelection")] = ps->getParameter<std::string>("detLabel");
35  m_binmax[ps->getParameter<unsigned int>("detSelection")] = ps->getParameter<int>("binMax");
36  }
37 
38 
39 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
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
edm::EDGetTokenT< LumiDetails > m_lumiProducerToken
DigiLumiCorrHistogramMaker::~DigiLumiCorrHistogramMaker ( )

Definition at line 42 of file DigiLumiCorrHistogramMaker.cc.

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

42  {
43 
44  for(std::map<unsigned int,std::string>::const_iterator lab=m_labels.begin();lab!=m_labels.end();lab++) {
45 
46  const unsigned int i = lab->first; const std::string slab = lab->second;
47 
48  delete m_subdirs[i];
49  delete m_fhm[i];
50  }
51 
52 }
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 121 of file DigiLumiCorrHistogramMaker.cc.

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

Referenced by MultiplicityInvestigator::beginRun().

121  {
122 
124 
125 
126  for(std::map<unsigned int,std::string>::const_iterator lab=m_labels.begin();lab!=m_labels.end();++lab) {
127  const int i = lab->first; 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 
135 
136 }
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,
edm::ConsumesCollector &&  iC 
)

Definition at line 56 of file DigiLumiCorrHistogramMaker.cc.

References HLT_25ns14e33_v1_cff::labels, and m_labels.

Referenced by MultiplicityInvestigator::MultiplicityInvestigator().

56  {
57 
58  m_labels = labels;
59  book(dirname, iC);
60 
61 }
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
void DigiLumiCorrHistogramMaker::book ( const std::string  dirname,
edm::ConsumesCollector &&  iC 
)
inline

Definition at line 31 of file DigiLumiCorrHistogramMaker.h.

References book().

Referenced by book().

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

Definition at line 63 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.

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

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

Referenced by MultiplicityInvestigator::analyze().

138  {
139 
142 
143  if(ld.isValid()) {
144  if(ld->isValid()) {
145  float bxlumi = ld->lumiValue(LumiDetails::kOCC1,iEvent.bunchCrossing())*6.37;
146 
147  for(std::map<unsigned int,int>::const_iterator digi=ndigi.begin();digi!=ndigi.end();digi++) {
148  if(m_labels.find(digi->first) != m_labels.end()) {
149  const unsigned int i=digi->first;
150  m_nmultvslumi[i]->Fill(bxlumi,digi->second);
151  m_nmultvslumiprof[i]->Fill(bxlumi,digi->second);
152 
153  if(m_nmultvslumivsbxprofrun[i] && *m_nmultvslumivsbxprofrun[i]) (*m_nmultvslumivsbxprofrun[i])->Fill(iEvent.bunchCrossing()%3564,bxlumi,digi->second);
154 
155  }
156  }
157  }
158  }
159 }
int i
Definition: DBlmapReader.cc:9
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::map< unsigned int, std::string > m_labels
int bunchCrossing() const
Definition: EventBase.h:66
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:84
bool isValid() const
Definition: HandleBase.h:75
std::map< unsigned int, TH2F * > m_nmultvslumi
edm::EDGetTokenT< LumiDetails > m_lumiProducerToken

Member Data Documentation

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

Definition at line 45 of file DigiLumiCorrHistogramMaker.h.

Referenced by book(), and DigiLumiCorrHistogramMaker().

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

Definition at line 39 of file DigiLumiCorrHistogramMaker.h.

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

std::string DigiLumiCorrHistogramMaker::m_hitname
private

Definition at line 41 of file DigiLumiCorrHistogramMaker.h.

Referenced by book().

std::map<unsigned int, std::string> DigiLumiCorrHistogramMaker::m_labels
private
edm::EDGetTokenT<LumiDetails> DigiLumiCorrHistogramMaker::m_lumiProducerToken
private

Definition at line 38 of file DigiLumiCorrHistogramMaker.h.

Referenced by fill().

const double DigiLumiCorrHistogramMaker::m_maxlumi
private

Definition at line 44 of file DigiLumiCorrHistogramMaker.h.

Referenced by book().

const int DigiLumiCorrHistogramMaker::m_nbins
private

Definition at line 42 of file DigiLumiCorrHistogramMaker.h.

Referenced by book().

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

Definition at line 48 of file DigiLumiCorrHistogramMaker.h.

Referenced by book(), and fill().

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

Definition at line 49 of file DigiLumiCorrHistogramMaker.h.

Referenced by book(), and fill().

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

Definition at line 50 of file DigiLumiCorrHistogramMaker.h.

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

bool DigiLumiCorrHistogramMaker::m_runHisto
private

Definition at line 40 of file DigiLumiCorrHistogramMaker.h.

Referenced by beginRun(), and book().

const int DigiLumiCorrHistogramMaker::m_scalefact
private

Definition at line 43 of file DigiLumiCorrHistogramMaker.h.

Referenced by book().

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

Definition at line 51 of file DigiLumiCorrHistogramMaker.h.

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