CMS 3D CMS Logo

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

PixelVTXMonitor Class Reference

#include <PixelVTXMonitor.h>

Inheritance diagram for PixelVTXMonitor:
edm::EDAnalyzer

List of all members.

Classes

struct  PixelMEs

Public Member Functions

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

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 endRun (edm::Run const &iRun, edm::EventSetup const &iSetup)

Private Member Functions

void bookHistograms ()

Private Attributes

DQMStoredbe_
std::string folderName_
std::map< std::string, PixelMEshistoMap_
HLTConfigProvider hltConfig_
edm::InputTag hltInputTag_
float minVtxDoF_
std::string moduleName_
edm::ParameterSet parameters_
edm::InputTag pixelClusterInputTag_
edm::InputTag pixelVertexInputTag_

Detailed Description

Definition at line 29 of file PixelVTXMonitor.h.


Constructor & Destructor Documentation

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

Definition at line 40 of file PixelVTXMonitor.cc.

                                  {

}

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 121 of file PixelVTXMonitor.cc.

References MonitorElement::Fill(), edm::Event::getByLabel(), histoMap_, hltConfig_, hltInputTag_, getHLTprescales::index, edm::HandleBase::isValid(), minVtxDoF_, getHLTPrescaleColumns::path, pixelClusterInputTag_, pixelVertexInputTag_, PixelVertexes_cfi::pixelVertices, SiPixelClusterizer_cfi::siPixelClusters, findQualityFiles::size, HLTConfigProvider::triggerIndex(), and patRefSel_triggerSelection_cff::triggerResults.

                                                                                  {
  if (!histoMap_.size()) return;

  //Access Pixel Clusters
  edm::Handle< SiPixelClusterCollectionNew > siPixelClusters;
  iEvent.getByLabel(pixelClusterInputTag_, siPixelClusters);
  
  if(!siPixelClusters.isValid()) {
    edm::LogError("PixelVTXMonotor") << "Could not find Cluster Collection " << pixelClusterInputTag_;
    return;
  }
  unsigned nClusters = siPixelClusters->size();
  

  //Access Pixel Verteces
  edm::Handle<reco::VertexCollection> pixelVertices;
  iEvent.getByLabel(pixelVertexInputTag_,pixelVertices);
  if (!pixelVertices.isValid()) {
    edm::LogError("PixelVTXMonotor") << "Could not find Vertex Collection " << pixelVertexInputTag_;
    return;
  }

  int nVtx = 0;
  for (reco::VertexCollection::const_iterator ivtx = pixelVertices->begin(); 
       ivtx != pixelVertices->end(); ++ivtx) {
    if (minVtxDoF_ == -1) nVtx++;
    else {
      if ((ivtx->isValid() == true) &&
          (ivtx->isFake() == false) &&
          (ivtx->ndof() >= minVtxDoF_) &&
          (ivtx->tracksSize() != 0)) nVtx++;
    }
  }
  // Access Trigger Results
  edm::Handle<edm::TriggerResults> triggerResults;
  iEvent.getByLabel(hltInputTag_, triggerResults);
  if (!triggerResults.isValid()) return;

  for (std::map<std::string,PixelMEs>::iterator it = histoMap_.begin();
       it != histoMap_.end(); ++it) {
    std::string path = it->first; 
    MonitorElement* me_clus  = it->second.clusME;
    MonitorElement* me_vtx  = it->second.vtxME;
    unsigned int index = hltConfig_.triggerIndex(path);
    if ( index < triggerResults->size() && triggerResults->accept(index)) {
      if (me_vtx) me_vtx->Fill(nVtx);
      if (me_clus) me_clus->Fill(nClusters);
    } 
  } 
}
void PixelVTXMonitor::beginJob ( void  ) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 100 of file PixelVTXMonitor.cc.

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

void PixelVTXMonitor::beginRun ( edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 105 of file PixelVTXMonitor.cc.

References bookHistograms(), hltConfig_, hltInputTag_, HLTConfigProvider::init(), and edm::InputTag::process().

                                                                              {
  bool changed = true;
  if (hltConfig_.init(iRun, iSetup, hltInputTag_.process(), changed)) {
    // if init returns TRUE, initialisation has succeeded!
    edm::LogInfo("PixelVTXMonitor") << "HLT config with process name " 
                                     << hltInputTag_.process() << " successfully extracted";
  }  else {
    // if init returns FALSE, initialisation has NOT succeeded, which indicates a problem
    // with the file and/or code and needs to be investigated!
    edm::LogError("PixelVTXMonotor") << "Error! HLT config extraction with process name " 
                                  <<hltInputTag_.process() << " failed";
    // In this case, all access methods will return empty values!
  }
  bookHistograms();

}
void PixelVTXMonitor::bookHistograms ( ) [private]

Definition at line 44 of file PixelVTXMonitor.cc.

References DQMStore::book1D(), PixelVTXMonitor::PixelMEs::clusME, dbe_, folderName_, edm::ParameterSet::getParameter(), histoMap_, hltConfig_, moduleName_, parameters_, DQMStore::setCurrentFolder(), GlobalPosition_Frontier_DevDB_cff::tag, HLTConfigProvider::triggerNames(), and PixelVTXMonitor::PixelMEs::vtxME.

Referenced by beginRun().

                                     {
  std::vector<std::string> hltPathsOfInterest = parameters_.getParameter<std::vector<std::string> > ("HLTPathsOfInterest");
  if (hltPathsOfInterest.size()  == 0) return;

  const std::vector<std::string>& pathList = hltConfig_.triggerNames();
  std::vector<std::string> selectedPaths;
  for (std::vector<std::string>::const_iterator it = pathList.begin();
       it != pathList.end(); ++it) {
    int nmatch = 0;
    for (std::vector<std::string>::const_iterator kt = hltPathsOfInterest.begin();
         kt != hltPathsOfInterest.end(); ++kt) {
      nmatch += TPRegexp(*kt).Match(*it);
    }
    if (!nmatch) continue;
    else selectedPaths.push_back(*it);     
  }
    
  edm::ParameterSet ClusHistoPar =  parameters_.getParameter<edm::ParameterSet>("TH1ClusPar");
  edm::ParameterSet VtxHistoPar  =  parameters_.getParameter<edm::ParameterSet>("TH1VtxPar");


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

  PixelMEs local_MEs;
  for (std::vector<std::string> ::iterator it = selectedPaths.begin();
       it != selectedPaths.end(); it++) {
    std::string tag = (*it) ;
    std::map<std::string, PixelMEs>::iterator iPos = histoMap_.find(tag); 
    if (iPos == histoMap_.end()) {
      
      std::string hname, htitle;

      hname  = "nPxlClus_";
      hname += tag;
      htitle= "# of Pixel Clusters (";
      htitle += tag +")";
      local_MEs.clusME= dbe_->book1D(hname, htitle, 
        ClusHistoPar.getParameter<int32_t>("Xbins"),
        ClusHistoPar.getParameter<double>("Xmin"),
        ClusHistoPar.getParameter<double>("Xmax"));

      hname = "nPxlVtx_";
      hname += tag;
      htitle= "# of Pixel Vertices (";
      htitle += tag +")";
      local_MEs.vtxME= dbe_->book1D(hname, htitle,
         VtxHistoPar.getParameter<int32_t>("Xbins"),
         VtxHistoPar.getParameter<double>("Xmin"),
         VtxHistoPar.getParameter<double>("Xmax"));

      histoMap_.insert(std::make_pair(tag, local_MEs)); 
    } 
  }
}
void PixelVTXMonitor::endJob ( void  ) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 178 of file PixelVTXMonitor.cc.

                             {

}
void PixelVTXMonitor::endRun ( edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 173 of file PixelVTXMonitor.cc.

                                                                            {

}

Member Data Documentation

Definition at line 55 of file PixelVTXMonitor.h.

Referenced by beginJob(), and bookHistograms().

std::string PixelVTXMonitor::folderName_ [private]

Definition at line 49 of file PixelVTXMonitor.h.

Referenced by bookHistograms(), and PixelVTXMonitor().

std::map<std::string, PixelMEs> PixelVTXMonitor::histoMap_ [private]

Definition at line 63 of file PixelVTXMonitor.h.

Referenced by analyze(), and bookHistograms().

Definition at line 56 of file PixelVTXMonitor.h.

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

Definition at line 52 of file PixelVTXMonitor.h.

Referenced by analyze(), beginRun(), and PixelVTXMonitor().

float PixelVTXMonitor::minVtxDoF_ [private]

Definition at line 53 of file PixelVTXMonitor.h.

Referenced by analyze(), and PixelVTXMonitor().

std::string PixelVTXMonitor::moduleName_ [private]

Definition at line 48 of file PixelVTXMonitor.h.

Referenced by bookHistograms(), and PixelVTXMonitor().

Definition at line 46 of file PixelVTXMonitor.h.

Referenced by bookHistograms(), and PixelVTXMonitor().

Definition at line 50 of file PixelVTXMonitor.h.

Referenced by analyze(), and PixelVTXMonitor().

Definition at line 51 of file PixelVTXMonitor.h.

Referenced by analyze(), and PixelVTXMonitor().