CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DQMLumiMonitor.cc
Go to the documentation of this file.
1 /*
2  * \file DQMLumiMonitor.cc
3  * \author S. Dutta
4  * Last Update:
5  * $Date: 2012/05/02 19:59:18 $
6  * $Revision: 1.6 $
7  * $Author: dutta $
8  *
9  * Description: Pixel Luminosity Monitoring
10  *
11 */
21 #include "TPRegexp.h"
22 
23 
24 // -----------------------------
25 // constructors and destructor
26 // -----------------------------
27 
28 DQMLumiMonitor::DQMLumiMonitor( const edm::ParameterSet& ps ) : parameters_(ps) {
29 
30 
31  moduleName_ = parameters_.getParameter<std::string>("ModuleName");
32  folderName_ = parameters_.getParameter<std::string>("FolderName");
34  lumiRecordName_ = parameters_.getParameter<std::string>("LumiRecordName");
35 
36  nClusME_ = 0;
37  nClusVsLSME_ = 0;
38  intLumiVsLSME_= 0;
40 }
41 
43 
44 }
45 
47 
48  edm::ParameterSet ClusHistoPar = parameters_.getParameter<edm::ParameterSet>("TH1ClusPar");
49  edm::ParameterSet LumiHistoPar = parameters_.getParameter<edm::ParameterSet>("TH1LumiPar");
50  edm::ParameterSet LumiSecHistoPar = parameters_.getParameter<edm::ParameterSet>("TH1LSPar");
51 
52  std::string currentFolder = moduleName_ + "/" + folderName_ ;
53  dbe_->setCurrentFolder(currentFolder.c_str());
54 
55  if (nClusME_ == 0) nClusME_ = dbe_->book1D("nPlxClus", " Number of Pixel Clusters ",
56  ClusHistoPar.getParameter<int32_t>("Xbins"),
57  ClusHistoPar.getParameter<double>("Xmin"),
58  ClusHistoPar.getParameter<double>("Xmax"));
59  else nClusME_->Reset();
60  if (nClusVsLSME_ == 0) nClusVsLSME_ = dbe_->bookProfile("nClusVsLS", " Number of Pixel Cluster Vs LS number",
61  LumiSecHistoPar.getParameter<int32_t>("Xbins"),
62  LumiSecHistoPar.getParameter<double>("Xmin"),
63  LumiSecHistoPar.getParameter<double>("Xmax"),
64  0.0, 0.0, "");
65  else nClusVsLSME_->Reset();
66  if (intLumiVsLSME_ == 0) intLumiVsLSME_ = dbe_->bookProfile("intLumiVsLS", " Integrated Luminosity Vs LS number",
67  LumiSecHistoPar.getParameter<int32_t>("Xbins"),
68  LumiSecHistoPar.getParameter<double>("Xmin"),
69  LumiSecHistoPar.getParameter<double>("Xmax"),
70  0.0, 0.0, "");
71  else intLumiVsLSME_->Reset();
72 
73  if (corrIntLumiAndClusVsLSME_== 0) corrIntLumiAndClusVsLSME_ = dbe_->bookProfile2D("corrIntLumiAndClusVsLS", " Correlation of nCluster and Integrated Luminosity Vs LS number",
74  LumiSecHistoPar.getParameter<int32_t>("Xbins"),
75  LumiSecHistoPar.getParameter<double>("Xmin"),
76  LumiSecHistoPar.getParameter<double>("Xmax"),
77  LumiHistoPar.getParameter<int32_t>("Xbins"),
78  LumiHistoPar.getParameter<double>("Xmin"),
79  LumiHistoPar.getParameter<double>("Xmax"),
80  0.0, 0.0);
82 }
85  intLumi_ = -1.0;
86  nLumi_ = -1;
87 }
88 
89 void DQMLumiMonitor::beginRun(edm::Run const& iRun, edm::EventSetup const& iSetup) {
91 
92 }
94 
95  //Access Pixel Clusters
97  // edm::Handle< SiPixelClusterCollectionNew > siPixelClusters;
98  iEvent.getByLabel(pixelClusterInputTag_, siPixelClusters);
99 
100  if(!siPixelClusters.isValid()) {
101  edm::LogError("PixelLumiMonotor") << "Could not find Cluster Collection " << pixelClusterInputTag_;
102  return;
103  }
104  unsigned int nClusterPix = (*siPixelClusters).dataSize();
105  nClusME_->Fill(nClusterPix);
106  if (nLumi_ != -1) nClusVsLSME_->Fill(nLumi_, nClusterPix);
107  if (intLumi_ != -1 || nLumi_ != -1) corrIntLumiAndClusVsLSME_->Fill(nLumi_, intLumi_, nClusterPix);
108 }
109 
111  edm::LogInfo("PixelLumiMonotor") <<" Run Number "<<lumiBlock.run() <<" Lumi Section Numnber "<< lumiBlock.luminosityBlock();
112 
113  nLumi_ = lumiBlock.luminosityBlock();
114 
115  // Access Lumi Summary
116  edm::Handle<LumiSummary> lumiSummary_;
117  lumiBlock.getByLabel(lumiRecordName_, lumiSummary_);
118  if(lumiSummary_->isValid()){
119  intLumi_ = lumiSummary_->intgDelLumi();
120  edm::LogInfo("PixelLumiMonotor") <<" Luminosity in this Lumi Section " << intLumi_ ;
122  } else {
123  edm::LogError("PixelLumiMonotor") << "No valid data found!";
124  }
125  /*
126  // Access Lumi Details
127  Handle<LumiDetails> lumiDetails;
128  lumiBlock.getByLabel("expressLumiProducer", lumiDetails);
129  if(lumiDetails->isValid()){
130  std::cout<<"valid detail"<<std::endl;
131  }else{
132  std::cout << "no valid lumi detail data" <<std::endl;
133  } */
134 
135 }
136 
137 void DQMLumiMonitor::endRun(edm::Run const& iRun, edm::EventSetup const& iSetup) {
138 
139 }
140 
141 
143 
144 }
145 // Define this as a plug-in
T getParameter(std::string const &) const
MonitorElement * corrIntLumiAndClusVsLSME_
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:717
edm::ParameterSet parameters_
DQMStore * dbe_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
void beginRun(edm::Run const &iRun, edm::EventSetup const &iSetup)
bool getByLabel(std::string const &label, Handle< PROD > &result) const
void Fill(long long x)
LuminosityBlockNumber_t luminosityBlock() const
int iEvent
Definition: GenABIO.cc:243
void endLuminosityBlock(edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &eSetup)
RunNumber_t run() const
MonitorElement * bookProfile(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const char *option="s")
Definition: DQMStore.cc:1031
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
MonitorElement * nClusVsLSME_
DQMLumiMonitor(const edm::ParameterSet &)
std::string moduleName_
MonitorElement * nClusME_
std::string folderName_
std::string lumiRecordName_
void endRun(edm::Run const &iRun, edm::EventSetup const &iSetup)
edm::InputTag pixelClusterInputTag_
void Reset(void)
reset ME (ie. contents, errors, etc)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
MonitorElement * intLumiVsLSME_
void analyze(edm::Event const &iEvent, edm::EventSetup const &iSetup)
Definition: Run.h:33
MonitorElement * bookProfile2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, int nchZ, double lowZ, double highZ, const char *option="s")
Definition: DQMStore.cc:1175