CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes

DQMLumiMonitor Class Reference

#include <DQMLumiMonitor.h>

Inheritance diagram for DQMLumiMonitor:
edm::EDAnalyzer

List of all members.

Public Member Functions

 DQMLumiMonitor (const edm::ParameterSet &)
 ~DQMLumiMonitor ()

Protected Member Functions

void analyze (edm::Event const &iEvent, edm::EventSetup const &iSetup)
void beginJob ()
void beginRun (edm::Run const &iRun, edm::EventSetup const &iSetup)
void endJob ()
void endLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &eSetup)
void endRun (edm::Run const &iRun, edm::EventSetup const &iSetup)

Private Member Functions

void bookHistograms ()

Private Attributes

MonitorElementcorrIntLumiAndClusVsLSME_
DQMStoredbe_
std::string folderName_
float intLumi_
MonitorElementintLumiVsLSME_
std::string lumiRecordName_
unsigned long long m_cacheID_
std::string moduleName_
MonitorElementnClusME_
MonitorElementnClusVsLSME_
int nLumi_
edm::ParameterSet parameters_
edm::InputTag pixelClusterInputTag_

Detailed Description

Definition at line 29 of file DQMLumiMonitor.h.


Constructor & Destructor Documentation

DQMLumiMonitor::DQMLumiMonitor ( const edm::ParameterSet ps)
DQMLumiMonitor::~DQMLumiMonitor ( )

Definition at line 43 of file DQMLumiMonitor.cc.

                                {

}

Member Function Documentation

void DQMLumiMonitor::analyze ( edm::Event const &  iEvent,
edm::EventSetup const &  iSetup 
) [protected, virtual]

Implements edm::EDAnalyzer.

Definition at line 94 of file DQMLumiMonitor.cc.

References corrIntLumiAndClusVsLSME_, MonitorElement::Fill(), edm::Event::getByLabel(), intLumi_, edm::HandleBase::isValid(), nClusME_, nClusVsLSME_, nLumi_, pixelClusterInputTag_, and SiPixelClusterizer_cfi::siPixelClusters.

                                                                                 {

  //Access Pixel Clusters
  edm::Handle< edmNew::DetSetVector<SiPixelCluster> > siPixelClusters;
  //  edm::Handle< SiPixelClusterCollectionNew > siPixelClusters;
  iEvent.getByLabel(pixelClusterInputTag_, siPixelClusters);
  
  if(!siPixelClusters.isValid()) {
    edm::LogError("PixelLumiMonotor") << "Could not find Cluster Collection " << pixelClusterInputTag_;
    return;
  }
  unsigned int nClusterPix   = (*siPixelClusters).dataSize(); 
  nClusME_->Fill(nClusterPix);
  if (nLumi_ != -1) nClusVsLSME_->Fill(nLumi_, nClusterPix);
  if (intLumi_ != -1 || nLumi_ != -1) corrIntLumiAndClusVsLSME_->Fill(nLumi_, intLumi_, nClusterPix);
}
void DQMLumiMonitor::beginJob ( void  ) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 84 of file DQMLumiMonitor.cc.

References dbe_, intLumi_, nLumi_, and cmsCodeRules::cppFunctionSkipper::operator.

                              {
  dbe_ = edm::Service<DQMStore>().operator->();
  intLumi_  = -1.0; 
  nLumi_ = -1;
}
void DQMLumiMonitor::beginRun ( edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 90 of file DQMLumiMonitor.cc.

References bookHistograms().

void DQMLumiMonitor::bookHistograms ( ) [private]

Definition at line 47 of file DQMLumiMonitor.cc.

References DQMStore::book1D(), DQMStore::bookProfile(), DQMStore::bookProfile2D(), corrIntLumiAndClusVsLSME_, dbe_, folderName_, edm::ParameterSet::getParameter(), intLumiVsLSME_, moduleName_, nClusME_, nClusVsLSME_, parameters_, MonitorElement::Reset(), and DQMStore::setCurrentFolder().

Referenced by beginRun().

                                    {
    
  edm::ParameterSet ClusHistoPar =  parameters_.getParameter<edm::ParameterSet>("TH1ClusPar");
  edm::ParameterSet LumiHistoPar =  parameters_.getParameter<edm::ParameterSet>("TH1LumiPar");
  edm::ParameterSet LumiSecHistoPar =  parameters_.getParameter<edm::ParameterSet>("TH1LSPar");

  std::string currentFolder = moduleName_ + "/" + folderName_ ;
  dbe_->setCurrentFolder(currentFolder.c_str());

  if (nClusME_ == 0) nClusME_ = dbe_->book1D("nPlxClus", " Number of Pixel Clusters ",
                                             ClusHistoPar.getParameter<int32_t>("Xbins"),
                                             ClusHistoPar.getParameter<double>("Xmin"),
                                             ClusHistoPar.getParameter<double>("Xmax"));
  else nClusME_->Reset();
  if (nClusVsLSME_ == 0) nClusVsLSME_ = dbe_->bookProfile("nClusVsLS", " Number of Pixel Cluster Vs LS number",
                                                              LumiSecHistoPar.getParameter<int32_t>("Xbins"),
                                                              LumiSecHistoPar.getParameter<double>("Xmin"),
                                                              LumiSecHistoPar.getParameter<double>("Xmax"),
                                                          0.0, 0.0, "");
  else nClusVsLSME_->Reset();
  if (intLumiVsLSME_ == 0) intLumiVsLSME_ = dbe_->bookProfile("intLumiVsLS", " Integrated Luminosity Vs LS number",
                                                              LumiSecHistoPar.getParameter<int32_t>("Xbins"),
                                                              LumiSecHistoPar.getParameter<double>("Xmin"),
                                                              LumiSecHistoPar.getParameter<double>("Xmax"),
                                                              0.0, 0.0, "");
  else intLumiVsLSME_->Reset();

  if (corrIntLumiAndClusVsLSME_== 0) corrIntLumiAndClusVsLSME_ = dbe_->bookProfile2D("corrIntLumiAndClusVsLS", " Correlation of nCluster and Integrated Luminosity Vs LS number",
                                                                                     LumiSecHistoPar.getParameter<int32_t>("Xbins"),
                                                                                     LumiSecHistoPar.getParameter<double>("Xmin"),
                                                                                     LumiSecHistoPar.getParameter<double>("Xmax"),
                                                                                     LumiHistoPar.getParameter<int32_t>("Xbins"),
                                                                                     LumiHistoPar.getParameter<double>("Xmin"),
                                                                                     LumiHistoPar.getParameter<double>("Xmax"),
                                                                                     0.0, 0.0);
  else corrIntLumiAndClusVsLSME_->Reset();
}
void DQMLumiMonitor::endJob ( void  ) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 141 of file DQMLumiMonitor.cc.

                            {

}
void DQMLumiMonitor::endLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  eSetup 
) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 111 of file DQMLumiMonitor.cc.

References gather_cfg::cout, MonitorElement::Fill(), edm::eventsetup::heterocontainer::HCTypeTag::findType(), edm::EventSetup::getData(), DIPLumiSummary::intgDelLumiByLS(), intLumi_, intLumiVsLSME_, DIPLumiSummary::isNull(), edm::ESHandleBase::isValid(), edm::LuminosityBlockBase::luminosityBlock(), lumiRecordName_, nLumi_, edm::ESHandle< T >::product(), edm::LuminosityBlockBase::run(), and edm::eventsetup::EventSetupRecordKey::type().

                                                                                                       {
  std::cout <<" Run Number "<<lumiBlock.run() <<" Lumi Section Numnber "<< lumiBlock.luminosityBlock()<<std::endl;
  nLumi_ = lumiBlock.luminosityBlock();
  edm::eventsetup::EventSetupRecordKey recordKey(edm::eventsetup::EventSetupRecordKey::TypeTag::findType(lumiRecordName_));
  
  if( recordKey.type() == edm::eventsetup::EventSetupRecordKey::TypeTag()) {
    std::cout <<"Record \"DIPLuminosityRcd"<<"\" does not exist "<<std::endl;
    return;
  }
  edm::ESHandle<DIPLumiSummary> datahandle;
  eSetup.getData(datahandle);
  if(datahandle.isValid()){
    const DIPLumiSummary* dipLumiSummary_=datahandle.product();
    if (!dipLumiSummary_->isNull()) {
      intLumi_ = dipLumiSummary_->intgDelLumiByLS();
      edm::LogInfo("PixelLumiMonotor") <<" Luminosity in this Lumi Section " << intLumi_ ;
      intLumiVsLSME_->Fill(nLumi_, intLumi_);
    }else{  
      edm::LogError("PixelLumiMonotor") << "Empty data found !";
    } 
  } else {
    edm::LogError("PixelLumiMonotor") << "No valid data found!";
  }
}
void DQMLumiMonitor::endRun ( edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 136 of file DQMLumiMonitor.cc.

                                                                           {

}

Member Data Documentation

Definition at line 59 of file DQMLumiMonitor.h.

Referenced by analyze(), bookHistograms(), and DQMLumiMonitor().

Definition at line 54 of file DQMLumiMonitor.h.

Referenced by beginJob(), and bookHistograms().

std::string DQMLumiMonitor::folderName_ [private]

Definition at line 50 of file DQMLumiMonitor.h.

Referenced by bookHistograms(), and DQMLumiMonitor().

float DQMLumiMonitor::intLumi_ [private]

Definition at line 61 of file DQMLumiMonitor.h.

Referenced by analyze(), beginJob(), and endLuminosityBlock().

Definition at line 57 of file DQMLumiMonitor.h.

Referenced by bookHistograms(), DQMLumiMonitor(), and endLuminosityBlock().

std::string DQMLumiMonitor::lumiRecordName_ [private]

Definition at line 52 of file DQMLumiMonitor.h.

Referenced by DQMLumiMonitor(), and endLuminosityBlock().

unsigned long long DQMLumiMonitor::m_cacheID_ [private]

Definition at line 63 of file DQMLumiMonitor.h.

std::string DQMLumiMonitor::moduleName_ [private]

Definition at line 49 of file DQMLumiMonitor.h.

Referenced by bookHistograms(), and DQMLumiMonitor().

Definition at line 56 of file DQMLumiMonitor.h.

Referenced by analyze(), bookHistograms(), and DQMLumiMonitor().

Definition at line 58 of file DQMLumiMonitor.h.

Referenced by analyze(), bookHistograms(), and DQMLumiMonitor().

int DQMLumiMonitor::nLumi_ [private]

Definition at line 62 of file DQMLumiMonitor.h.

Referenced by analyze(), beginJob(), and endLuminosityBlock().

Definition at line 47 of file DQMLumiMonitor.h.

Referenced by bookHistograms(), and DQMLumiMonitor().

Definition at line 51 of file DQMLumiMonitor.h.

Referenced by analyze(), and DQMLumiMonitor().