CMS 3D CMS Logo

DQMLumiMonitor.cc
Go to the documentation of this file.
1 /*
2  * \file DQMLumiMonitor.cc
3  * \author S. Dutta
4  * Last Update:
5  *
6  * Description: Pixel Luminosity Monitoring
7  *
8 */
18 #include "TPRegexp.h"
19 
20 // -----------------------------
21 // constructors and destructor
22 // -----------------------------
23 
24 DQMLumiMonitor::DQMLumiMonitor(const edm::ParameterSet& ps) : parameters_(ps) {
28  consumes<edmNew::DetSetVector<SiPixelCluster> >(parameters_.getParameter<edm::InputTag>("PixelClusterInputTag"));
29  lumiRecordName_ = consumes<LumiSummary, edm::InLumi>(parameters_.getParameter<std::string>("LumiRecordName"));
30 
31  nClusME_ = nullptr;
32  nClusVsLSME_ = nullptr;
33  intLumiVsLSME_ = nullptr;
34  corrIntLumiAndClusVsLSME_ = nullptr;
35 }
36 
38 
40  edm::ParameterSet ClusHistoPar = parameters_.getParameter<edm::ParameterSet>("TH1ClusPar");
41  edm::ParameterSet LumiHistoPar = parameters_.getParameter<edm::ParameterSet>("TH1LumiPar");
42  edm::ParameterSet LumiSecHistoPar = parameters_.getParameter<edm::ParameterSet>("TH1LSPar");
43 
44  std::string currentFolder = moduleName_ + "/" + folderName_;
45  dbe_->setCurrentFolder(currentFolder);
46 
47  if (nClusME_ == nullptr)
48  nClusME_ = dbe_->book1D("nPlxClus",
49  " Number of Pixel Clusters ",
50  ClusHistoPar.getParameter<int32_t>("Xbins"),
51  ClusHistoPar.getParameter<double>("Xmin"),
52  ClusHistoPar.getParameter<double>("Xmax"));
53  else
54  nClusME_->Reset();
55  if (nClusVsLSME_ == nullptr)
56  nClusVsLSME_ = dbe_->bookProfile("nClusVsLS",
57  " Number of Pixel Cluster Vs LS number",
58  LumiSecHistoPar.getParameter<int32_t>("Xbins"),
59  LumiSecHistoPar.getParameter<double>("Xmin"),
60  LumiSecHistoPar.getParameter<double>("Xmax"),
61  0.0,
62  0.0,
63  "");
64  else
66  if (intLumiVsLSME_ == nullptr)
67  intLumiVsLSME_ = dbe_->bookProfile("intLumiVsLS",
68  " Integrated Luminosity Vs LS number",
69  LumiSecHistoPar.getParameter<int32_t>("Xbins"),
70  LumiSecHistoPar.getParameter<double>("Xmin"),
71  LumiSecHistoPar.getParameter<double>("Xmax"),
72  0.0,
73  0.0,
74  "");
75  else
77 
78  if (corrIntLumiAndClusVsLSME_ == nullptr)
79  corrIntLumiAndClusVsLSME_ = dbe_->bookProfile2D("corrIntLumiAndClusVsLS",
80  " Correlation of nCluster and Integrated Luminosity Vs LS number",
81  LumiSecHistoPar.getParameter<int32_t>("Xbins"),
82  LumiSecHistoPar.getParameter<double>("Xmin"),
83  LumiSecHistoPar.getParameter<double>("Xmax"),
84  LumiHistoPar.getParameter<int32_t>("Xbins"),
85  LumiHistoPar.getParameter<double>("Xmin"),
86  LumiHistoPar.getParameter<double>("Xmax"),
87  0.0,
88  0.0);
89  else
91 }
93  dbe_ = edm::Service<DQMStore>().operator->();
94  intLumi_ = -1.0;
95  nLumi_ = -1;
96 }
97 
98 void DQMLumiMonitor::beginRun(edm::Run const& iRun, edm::EventSetup const& iSetup) { bookHistograms(); }
100  //Access Pixel Clusters
103 
104  if (!siPixelClusters.isValid()) {
105  edm::LogError("PixelLumiMonotor") << "Could not find Cluster Collection ";
106  return;
107  }
108  unsigned int nClusterPix = (*siPixelClusters).dataSize();
109  nClusME_->Fill(nClusterPix);
110  if (nLumi_ != -1)
111  nClusVsLSME_->Fill(nLumi_, nClusterPix);
112  if (intLumi_ != -1 || nLumi_ != -1)
114 }
115 
117  edm::LogInfo("PixelLumiMonotor") << " Run Number " << lumiBlock.run() << " Lumi Section Numnber "
118  << lumiBlock.luminosityBlock();
119 
120  nLumi_ = lumiBlock.luminosityBlock();
121 
122  // Access Lumi Summary
123  edm::Handle<LumiSummary> lumiSummary_;
124  lumiBlock.getByToken(lumiRecordName_, lumiSummary_);
125  if (lumiSummary_->isValid()) {
126  intLumi_ = lumiSummary_->intgDelLumi();
127  edm::LogInfo("PixelLumiMonotor") << " Luminosity in this Lumi Section " << intLumi_;
129  } else {
130  edm::LogError("PixelLumiMonotor") << "No valid data found!";
131  }
132  /*
133  // Access Lumi Details
134  Handle<LumiDetails> lumiDetails;
135  lumiBlock.getByLabel("expressLumiProducer", lumiDetails);
136  if(lumiDetails->isValid()){
137  std::cout<<"valid detail"<<std::endl;
138  }else{
139  std::cout << "no valid lumi detail data" <<std::endl;
140  } */
141 }
142 
143 void DQMLumiMonitor::endRun(edm::Run const& iRun, edm::EventSetup const& iSetup) {}
144 
145 // Define this as a plug-in
DQMLumiMonitor::moduleName_
std::string moduleName_
Definition: DQMLumiMonitor.h:49
LumiSummary::intgDelLumi
float intgDelLumi() const
Definition: LumiSummary.cc:16
Handle.h
DQMLumiMonitor::dbe_
DQMStore * dbe_
Definition: DQMLumiMonitor.h:54
MessageLogger.h
DQMLumiMonitor::pixelClusterInputTag_
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelClusterInputTag_
Definition: DQMLumiMonitor.h:51
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
edm::Run
Definition: Run.h:45
LuminosityBlock.h
dqm::implementation::IBooker::bookProfile2D
MonitorElement * bookProfile2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, double lowZ, double highZ, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:399
SiPixelCluster.h
DQMLumiMonitor::~DQMLumiMonitor
~DQMLumiMonitor() override
DQMLumiMonitor::nClusME_
MonitorElement * nClusME_
Definition: DQMLumiMonitor.h:56
DQMLumiMonitor::bookHistograms
void bookHistograms()
Definition: DQMLumiMonitor.cc:39
edm::LuminosityBlockBase::run
RunNumber_t run() const
Definition: LuminosityBlockBase.h:42
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::Handle
Definition: AssociativeIterator.h:50
LumiSummary::isValid
bool isValid() const
Definition: LumiSummary.cc:50
MakerMacros.h
edm::LuminosityBlock::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: LuminosityBlock.h:319
HIInitialJetCoreClusterSplitting_cff.siPixelClusters
siPixelClusters
Definition: HIInitialJetCoreClusterSplitting_cff.py:23
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Service.h
edm::LuminosityBlockBase::luminosityBlock
LuminosityBlockNumber_t luminosityBlock() const
Definition: LuminosityBlockBase.h:40
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
dqm::impl::MonitorElement::Reset
virtual void Reset()
Remove all data from the ME, keept the empty histogram with all its settings.
Definition: MonitorElement.cc:354
DQMLumiMonitor::DQMLumiMonitor
DQMLumiMonitor(const edm::ParameterSet &)
Definition: DQMLumiMonitor.cc:24
dqm::implementation::IBooker::bookProfile
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:322
DQMLumiMonitor::analyze
void analyze(edm::Event const &iEvent, edm::EventSetup const &iSetup) override
Definition: DQMLumiMonitor.cc:99
DQMLumiMonitor::intLumi_
float intLumi_
Definition: DQMLumiMonitor.h:61
dqm::implementation::DQMStore::setCurrentFolder
void setCurrentFolder(std::string const &fullpath) override
Definition: DQMStore.h:569
DQMLumiMonitor::beginRun
void beginRun(edm::Run const &iRun, edm::EventSetup const &iSetup) override
Definition: DQMLumiMonitor.cc:98
DQMLumiMonitor::parameters_
edm::ParameterSet parameters_
Definition: DQMLumiMonitor.h:47
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
DQMLumiMonitor::intLumiVsLSME_
MonitorElement * intLumiVsLSME_
Definition: DQMLumiMonitor.h:57
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
LumiDetails.h
DQMLumiMonitor
Definition: DQMLumiMonitor.h:30
edm::Service
Definition: Service.h:30
iEvent
int iEvent
Definition: GenABIO.cc:224
DQMLumiMonitor::nLumi_
int nLumi_
Definition: DQMLumiMonitor.h:62
edm::EventSetup
Definition: EventSetup.h:57
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
DQMLumiMonitor::lumiRecordName_
edm::EDGetTokenT< LumiSummary > lumiRecordName_
Definition: DQMLumiMonitor.h:52
DQMLumiMonitor::corrIntLumiAndClusVsLSME_
MonitorElement * corrIntLumiAndClusVsLSME_
Definition: DQMLumiMonitor.h:59
DQMLumiMonitor::endLuminosityBlock
void endLuminosityBlock(edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &eSetup) override
Definition: DQMLumiMonitor.cc:116
DQMLumiMonitor::endRun
void endRun(edm::Run const &iRun, edm::EventSetup const &iSetup) override
Definition: DQMLumiMonitor.cc:143
LumiSummary.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
DQMLumiMonitor::folderName_
std::string folderName_
Definition: DQMLumiMonitor.h:50
DQMLumiMonitor::beginJob
void beginJob() override
Definition: DQMLumiMonitor.cc:92
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
DQMLumiMonitor::nClusVsLSME_
MonitorElement * nClusVsLSME_
Definition: DQMLumiMonitor.h:58
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
DQMLumiMonitor.h