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 edm::EDConsumerBase

Classes

struct  PixelMEs
 

Public Member Functions

 PixelVTXMonitor (const edm::ParameterSet &)
 
 ~PixelVTXMonitor ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Private Member Functions

void bookHistograms ()
 

Private Attributes

DQMStoredbe_
 
std::string folderName_
 
std::map< std::string, PixelMEshistoMap_
 
HLTConfigProvider hltConfig_
 
edm::InputTag hltInputTag_
 
edm::EDGetTokenT
< edm::TriggerResults
hltInputTagToken_
 
float minVtxDoF_
 
std::string moduleName_
 
edm::ParameterSet parameters_
 
edm::InputTag pixelClusterInputTag_
 
edm::EDGetTokenT
< SiPixelClusterCollectionNew
pixelClusterInputTagToken_
 
edm::InputTag pixelVertexInputTag_
 
edm::EDGetTokenT
< reco::VertexCollection
pixelVertexInputTagToken_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- 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 31 of file PixelVTXMonitor.h.

Constructor & Destructor Documentation

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

Definition at line 23 of file PixelVTXMonitor.cc.

References folderName_, edm::ParameterSet::getParameter(), hltInputTag_, hltInputTagToken_, minVtxDoF_, moduleName_, parameters_, pixelClusterInputTag_, pixelClusterInputTagToken_, pixelVertexInputTag_, pixelVertexInputTagToken_, and AlCaHLTBitMon_QueryRunRegistry::string.

23  : parameters_(ps) {
24 
25 
28  pixelClusterInputTagToken_= consumes<SiPixelClusterCollectionNew>(
29  parameters_.getParameter<edm::InputTag>("PixelClusterInputTag"));
30  pixelVertexInputTagToken_ = consumes<reco::VertexCollection>(
31  parameters_.getParameter<edm::InputTag>("PixelVertexInputTag"));
32  hltInputTagToken_ = consumes<edm::TriggerResults>(
33  parameters_.getParameter<edm::InputTag>("HLTInputTag"));
37  minVtxDoF_ = parameters_.getParameter<double>("MinVtxDoF");
38 }
edm::EDGetTokenT< reco::VertexCollection > pixelVertexInputTagToken_
T getParameter(std::string const &) const
edm::EDGetTokenT< edm::TriggerResults > hltInputTagToken_
edm::ParameterSet parameters_
edm::InputTag pixelClusterInputTag_
edm::InputTag pixelVertexInputTag_
std::string folderName_
edm::InputTag hltInputTag_
edm::EDGetTokenT< SiPixelClusterCollectionNew > pixelClusterInputTagToken_
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::getByToken(), histoMap_, hltConfig_, hltInputTagToken_, cmsHarvester::index, edm::HandleBase::isValid(), minVtxDoF_, cmsHarvester::path, pixelClusterInputTag_, pixelClusterInputTagToken_, pixelVertexInputTag_, pixelVertexInputTagToken_, PixelVertexes_cfi::pixelVertices, SiPixelClusterizer_cfi::siPixelClusters, findQualityFiles::size, AlCaHLTBitMon_QueryRunRegistry::string, HLTConfigProvider::triggerIndex(), and triggerResults.

121  {
122  if (!histoMap_.size()) return;
123 
124  //Access Pixel Clusters
126  iEvent.getByToken(pixelClusterInputTagToken_, 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.getByToken(pixelVertexInputTagToken_,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.getByToken(hltInputTagToken_, 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 }
edm::EDGetTokenT< reco::VertexCollection > pixelVertexInputTagToken_
edm::EDGetTokenT< edm::TriggerResults > hltInputTagToken_
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)
HLTConfigProvider hltConfig_
edm::InputTag pixelClusterInputTag_
int iEvent
Definition: GenABIO.cc:230
tuple path
else: Piece not in the list, fine.
std::map< std::string, PixelMEs > histoMap_
static std::string const triggerResults
Definition: EdmProvDump.cc:40
bool isValid() const
Definition: HandleBase.h:75
edm::InputTag pixelVertexInputTag_
edm::EDGetTokenT< SiPixelClusterCollectionNew > pixelClusterInputTagToken_
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.

100  {
102 
103 }
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:46
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(), AlCaHLTBitMon_QueryRunRegistry::string, 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:1006
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:719
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 60 of file PixelVTXMonitor.h.

Referenced by beginJob(), and bookHistograms().

std::string PixelVTXMonitor::folderName_
private

Definition at line 51 of file PixelVTXMonitor.h.

Referenced by bookHistograms(), and PixelVTXMonitor().

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

Definition at line 68 of file PixelVTXMonitor.h.

Referenced by analyze(), and bookHistograms().

HLTConfigProvider PixelVTXMonitor::hltConfig_
private

Definition at line 61 of file PixelVTXMonitor.h.

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

edm::InputTag PixelVTXMonitor::hltInputTag_
private

Definition at line 57 of file PixelVTXMonitor.h.

Referenced by beginRun(), and PixelVTXMonitor().

edm::EDGetTokenT<edm::TriggerResults> PixelVTXMonitor::hltInputTagToken_
private

Definition at line 54 of file PixelVTXMonitor.h.

Referenced by analyze(), and PixelVTXMonitor().

float PixelVTXMonitor::minVtxDoF_
private

Definition at line 58 of file PixelVTXMonitor.h.

Referenced by analyze(), and PixelVTXMonitor().

std::string PixelVTXMonitor::moduleName_
private

Definition at line 50 of file PixelVTXMonitor.h.

Referenced by bookHistograms(), and PixelVTXMonitor().

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

Definition at line 55 of file PixelVTXMonitor.h.

Referenced by analyze(), and PixelVTXMonitor().

edm::EDGetTokenT<SiPixelClusterCollectionNew> PixelVTXMonitor::pixelClusterInputTagToken_
private

Definition at line 52 of file PixelVTXMonitor.h.

Referenced by analyze(), and PixelVTXMonitor().

edm::InputTag PixelVTXMonitor::pixelVertexInputTag_
private

Definition at line 56 of file PixelVTXMonitor.h.

Referenced by analyze(), and PixelVTXMonitor().

edm::EDGetTokenT<reco::VertexCollection> PixelVTXMonitor::pixelVertexInputTagToken_
private

Definition at line 53 of file PixelVTXMonitor.h.

Referenced by analyze(), and PixelVTXMonitor().