CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
PixelVTXMonitor Class Reference

#include <PixelVTXMonitor.h>

Inheritance diagram for PixelVTXMonitor:
edm::EDAnalyzer

Classes

struct  PixelMEs
 

Public Member Functions

 PixelVTXMonitor (const edm::ParameterSet &)
 
 ~PixelVTXMonitor ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

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)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

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_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 

Detailed Description

Definition at line 29 of file PixelVTXMonitor.h.

Constructor & Destructor Documentation

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

Definition at line 29 of file PixelVTXMonitor.cc.

References folderName_, edm::ParameterSet::getParameter(), hltInputTag_, minVtxDoF_, moduleName_, parameters_, pixelClusterInputTag_, and pixelVertexInputTag_.

29  : parameters_(ps) {
30 
31 
32  moduleName_ = parameters_.getParameter<std::string>("ModuleName");
33  folderName_ = parameters_.getParameter<std::string>("FolderName");
37  minVtxDoF_ = parameters_.getParameter<double>("MinVtxDoF");
38 }
T getParameter(std::string const &) const
edm::ParameterSet parameters_
edm::InputTag pixelClusterInputTag_
edm::InputTag pixelVertexInputTag_
std::string folderName_
edm::InputTag hltInputTag_
std::string moduleName_
PixelVTXMonitor::~PixelVTXMonitor ( )

Definition at line 40 of file PixelVTXMonitor.cc.

40  {
41 
42 }

Member Function Documentation

void PixelVTXMonitor::analyze ( edm::Event const &  iEvent,
edm::EventSetup const &  iSetup 
)
protectedvirtual

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_, scaleCards::path, pixelClusterInputTag_, pixelVertexInputTag_, PixelVertexes_cfi::pixelVertices, SiPixelClusterizer_cfi::siPixelClusters, findQualityFiles::size, HLTConfigProvider::triggerIndex(), and patRefSel_triggerSelection_cff::triggerResults.

121  {
122  if (!histoMap_.size()) return;
123 
124  //Access Pixel Clusters
126  iEvent.getByLabel(pixelClusterInputTag_, siPixelClusters);
127 
128  if(!siPixelClusters.isValid()) {
129  edm::LogError("PixelVTXMonotor") << "Could not find Cluster Collection " << pixelClusterInputTag_;
130  return;
131  }
132  unsigned nClusters = siPixelClusters->size();
133 
134 
135  //Access Pixel Verteces
137  iEvent.getByLabel(pixelVertexInputTag_,pixelVertices);
138  if (!pixelVertices.isValid()) {
139  edm::LogError("PixelVTXMonotor") << "Could not find Vertex Collection " << pixelVertexInputTag_;
140  return;
141  }
142 
143  int nVtx = 0;
144  for (reco::VertexCollection::const_iterator ivtx = pixelVertices->begin();
145  ivtx != pixelVertices->end(); ++ivtx) {
146  if (minVtxDoF_ == -1) nVtx++;
147  else {
148  if ((ivtx->isValid() == true) &&
149  (ivtx->isFake() == false) &&
150  (ivtx->ndof() >= minVtxDoF_) &&
151  (ivtx->tracksSize() != 0)) nVtx++;
152  }
153  }
154  // Access Trigger Results
156  iEvent.getByLabel(hltInputTag_, triggerResults);
157  if (!triggerResults.isValid()) return;
158 
159  for (std::map<std::string,PixelMEs>::iterator it = histoMap_.begin();
160  it != histoMap_.end(); ++it) {
161  std::string path = it->first;
162  MonitorElement* me_clus = it->second.clusME;
163  MonitorElement* me_vtx = it->second.vtxME;
164  unsigned int index = hltConfig_.triggerIndex(path);
165  if ( index < triggerResults->size() && triggerResults->accept(index)) {
166  if (me_vtx) me_vtx->Fill(nVtx);
167  if (me_clus) me_clus->Fill(nClusters);
168  }
169  }
170 }
void Fill(long long x)
unsigned int triggerIndex(const std::string &triggerName) const
slot position of trigger path in trigger table (0 to size-1)
list path
Definition: scaleCards.py:51
HLTConfigProvider hltConfig_
edm::InputTag pixelClusterInputTag_
int iEvent
Definition: GenABIO.cc:243
std::map< std::string, PixelMEs > histoMap_
bool isValid() const
Definition: HandleBase.h:76
edm::InputTag pixelVertexInputTag_
edm::InputTag hltInputTag_
tuple size
Write out results.
void PixelVTXMonitor::beginJob ( void  )
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 100 of file PixelVTXMonitor.cc.

References dbe_, and cppFunctionSkipper::operator.

void PixelVTXMonitor::beginRun ( edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 105 of file PixelVTXMonitor.cc.

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

105  {
106  bool changed = true;
107  if (hltConfig_.init(iRun, iSetup, hltInputTag_.process(), changed)) {
108  // if init returns TRUE, initialisation has succeeded!
109  edm::LogInfo("PixelVTXMonitor") << "HLT config with process name "
110  << hltInputTag_.process() << " successfully extracted";
111  } else {
112  // if init returns FALSE, initialisation has NOT succeeded, which indicates a problem
113  // with the file and/or code and needs to be investigated!
114  edm::LogError("PixelVTXMonotor") << "Error! HLT config extraction with process name "
115  <<hltInputTag_.process() << " failed";
116  // In this case, all access methods will return empty values!
117  }
118  bookHistograms();
119 
120 }
HLTConfigProvider hltConfig_
edm::InputTag hltInputTag_
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
std::string const & process() const
Definition: InputTag.h:29
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().

44  {
45  std::vector<std::string> hltPathsOfInterest = parameters_.getParameter<std::vector<std::string> > ("HLTPathsOfInterest");
46  if (hltPathsOfInterest.size() == 0) return;
47 
48  const std::vector<std::string>& pathList = hltConfig_.triggerNames();
49  std::vector<std::string> selectedPaths;
50  for (std::vector<std::string>::const_iterator it = pathList.begin();
51  it != pathList.end(); ++it) {
52  int nmatch = 0;
53  for (std::vector<std::string>::const_iterator kt = hltPathsOfInterest.begin();
54  kt != hltPathsOfInterest.end(); ++kt) {
55  nmatch += TPRegexp(*kt).Match(*it);
56  }
57  if (!nmatch) continue;
58  else selectedPaths.push_back(*it);
59  }
60 
61  edm::ParameterSet ClusHistoPar = parameters_.getParameter<edm::ParameterSet>("TH1ClusPar");
62  edm::ParameterSet VtxHistoPar = parameters_.getParameter<edm::ParameterSet>("TH1VtxPar");
63 
64 
65  std::string currentFolder = moduleName_ + "/" + folderName_ ;
66  dbe_->setCurrentFolder(currentFolder.c_str());
67 
68  PixelMEs local_MEs;
69  for (std::vector<std::string> ::iterator it = selectedPaths.begin();
70  it != selectedPaths.end(); it++) {
71  std::string tag = (*it) ;
72  std::map<std::string, PixelMEs>::iterator iPos = histoMap_.find(tag);
73  if (iPos == histoMap_.end()) {
74 
75  std::string hname, htitle;
76 
77  hname = "nPxlClus_";
78  hname += tag;
79  htitle= "# of Pixel Clusters (";
80  htitle += tag +")";
81  local_MEs.clusME= dbe_->book1D(hname, htitle,
82  ClusHistoPar.getParameter<int32_t>("Xbins"),
83  ClusHistoPar.getParameter<double>("Xmin"),
84  ClusHistoPar.getParameter<double>("Xmax"));
85 
86  hname = "nPxlVtx_";
87  hname += tag;
88  htitle= "# of Pixel Vertices (";
89  htitle += tag +")";
90  local_MEs.vtxME= dbe_->book1D(hname, htitle,
91  VtxHistoPar.getParameter<int32_t>("Xbins"),
92  VtxHistoPar.getParameter<double>("Xmin"),
93  VtxHistoPar.getParameter<double>("Xmax"));
94 
95  histoMap_.insert(std::make_pair(tag, local_MEs));
96  }
97  }
98 }
T getParameter(std::string const &) const
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:717
edm::ParameterSet parameters_
const std::vector< std::string > & triggerNames() const
names of trigger paths
HLTConfigProvider hltConfig_
std::map< std::string, PixelMEs > histoMap_
std::string folderName_
std::string moduleName_
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
void PixelVTXMonitor::endJob ( void  )
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 178 of file PixelVTXMonitor.cc.

178  {
179 
180 }
void PixelVTXMonitor::endRun ( edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 173 of file PixelVTXMonitor.cc.

173  {
174 
175 }

Member Data Documentation

DQMStore* PixelVTXMonitor::dbe_
private

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().

HLTConfigProvider PixelVTXMonitor::hltConfig_
private

Definition at line 56 of file PixelVTXMonitor.h.

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

edm::InputTag PixelVTXMonitor::hltInputTag_
private

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().

edm::ParameterSet PixelVTXMonitor::parameters_
private
edm::InputTag PixelVTXMonitor::pixelClusterInputTag_
private

Definition at line 50 of file PixelVTXMonitor.h.

Referenced by analyze(), and PixelVTXMonitor().

edm::InputTag PixelVTXMonitor::pixelVertexInputTag_
private

Definition at line 51 of file PixelVTXMonitor.h.

Referenced by analyze(), and PixelVTXMonitor().