CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 }
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
102  iEvent.getByToken(pixelClusterInputTag_, siPixelClusters);
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
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
edm::EDGetTokenT< LumiSummary > lumiRecordName_
MonitorElement * corrIntLumiAndClusVsLSME_
void endRun(edm::Run const &iRun, edm::EventSetup const &iSetup) override
edm::ParameterSet parameters_
void analyze(edm::Event const &iEvent, edm::EventSetup const &iSetup) override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
DQMStore * dbe_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelClusterInputTag_
void setCurrentFolder(std::string const &fullpath) override
Definition: DQMStore.h:569
Log< level::Error, false > LogError
LuminosityBlockNumber_t luminosityBlock() const
void Fill(long long x)
virtual void Reset()
Remove all data from the ME, keept the empty histogram with all its settings.
void endLuminosityBlock(edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &eSetup) override
int iEvent
Definition: GenABIO.cc:224
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
RunNumber_t run() const
void beginRun(edm::Run const &iRun, edm::EventSetup const &iSetup) override
bool isValid() const
Definition: HandleBase.h:70
MonitorElement * nClusVsLSME_
Log< level::Info, false > LogInfo
DQMLumiMonitor(const edm::ParameterSet &)
std::string moduleName_
~DQMLumiMonitor() override
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
void beginJob() override
MonitorElement * nClusME_
std::string folderName_
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
MonitorElement * intLumiVsLSME_
Definition: Run.h:45