CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
HLTVertexPerformanceAnalyzer Class Reference

#include <HLTVertexPerformanceAnalyzer.h>

Inheritance diagram for HLTVertexPerformanceAnalyzer:
DQMEDAnalyzer edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks, edm::Accumulator > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void dqmBeginRun (const edm::Run &iRun, const edm::EventSetup &iSetup) override
 
 HLTVertexPerformanceAnalyzer (const edm::ParameterSet &)
 
 ~HLTVertexPerformanceAnalyzer () override
 
- Public Member Functions inherited from DQMEDAnalyzer
void accumulate (edm::Event const &event, edm::EventSetup const &setup) final
 
virtual void analyze (edm::Event const &, edm::EventSetup const &)
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual void dqmBeginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
virtual void dqmEndLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void dqmEndRun (edm::Run const &, edm::EventSetup const &)
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void endLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &, edm::EventSetup const &) final
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks, edm::Accumulator >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 

Private Attributes

std::vector< bool > _isfoundHLTs
 
std::vector< std::string > folders
 
std::vector< std::map< std::string, MonitorElement * > > H1_
 
HLTConfigProvider hltConfigProvider_
 
std::vector< int > hltPathIndexs_
 
std::vector< std::string > hltPathNames_
 
edm::EDGetTokenT< edm::TriggerResultshlTriggerResults_
 
std::string hlTriggerResults_Label
 
edm::EDConsumerBase::Labels label
 
std::string mainFolder_
 
edm::EDGetTokenT< std::vector< SimVertex > > simVertexCollection_
 
bool triggerConfChanged_
 
std::vector< edm::EDGetTokenT< reco::VertexCollection > > VertexCollection_
 
std::vector< std::string > VertexCollection_Label
 

Additional Inherited Members

- Public Types inherited from DQMEDAnalyzer
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
ProducesCollector producesCollector ()
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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)
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Code used to produce DQM validation plots for b-tag at HLT. It plots the distribution of recoVertex.z() - simVertex.z() of the primary vertex.

Definition at line 33 of file HLTVertexPerformanceAnalyzer.h.

Constructor & Destructor Documentation

HLTVertexPerformanceAnalyzer::HLTVertexPerformanceAnalyzer ( const edm::ParameterSet iConfig)
explicit

Definition at line 6 of file HLTVertexPerformanceAnalyzer.cc.

References edm::ParameterSet::getParameter(), mps_fire::i, label, edm::EDConsumerBase::labelsForToken(), AlCaHLTBitMon_QueryRunRegistry::string, GlobalPosition_Frontier_DevDB_cff::tag, and edm::vector_transform().

6  {
7  mainFolder_ = iConfig.getParameter<std::string>("mainFolder");
8  hlTriggerResults_ = consumes<TriggerResults>(iConfig.getParameter<InputTag>("TriggerResults"));
10  edm::vector_transform(iConfig.getParameter<std::vector<edm::InputTag>>("Vertex"),
11  [this](edm::InputTag const &tag) { return mayConsume<reco::VertexCollection>(tag); });
12  hltPathNames_ = iConfig.getParameter<std::vector<std::string>>("HLTPathNames");
13  simVertexCollection_ = consumes<std::vector<SimVertex>>(iConfig.getParameter<edm::InputTag>("SimVertexCollection"));
14 
15  EDConsumerBase::labelsForToken(hlTriggerResults_, label);
17 
18  for (unsigned int i = 0; i < VertexCollection_.size(); i++) {
19  EDConsumerBase::labelsForToken(VertexCollection_[i], label);
21  }
22 }
T getParameter(std::string const &) const
edm::EDGetTokenT< std::vector< SimVertex > > simVertexCollection_
edm::EDGetTokenT< edm::TriggerResults > hlTriggerResults_
char const * module
Definition: ProductLabels.h:5
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
Definition: transform.h:11
std::vector< std::string > VertexCollection_Label
std::vector< std::string > hltPathNames_
std::vector< edm::EDGetTokenT< reco::VertexCollection > > VertexCollection_
HLTVertexPerformanceAnalyzer::~HLTVertexPerformanceAnalyzer ( )
override

Definition at line 24 of file HLTVertexPerformanceAnalyzer.cc.

24 {}

Member Function Documentation

void HLTVertexPerformanceAnalyzer::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 56 of file HLTVertexPerformanceAnalyzer.cc.

References edm::HLTGlobalStatus::accept(), coll, edm::Event::getByToken(), edm::HandleBase::isValid(), seedmultiplicitymonitor_newtracking_cfi::maxValue, CoreSimVertex::position(), edm::Handle< T >::product(), caloTruthProducer_cfi::simVertexCollection, and edm::triggerResults().

56  {
57  bool trigRes = false;
58  using namespace edm;
59 
60  // get triggerResults
61  Handle<TriggerResults> TriggerResulsHandler;
62  if (hlTriggerResults_Label.empty() || hlTriggerResults_Label == "NULL") {
63  edm::LogInfo("NoTriggerResults") << "TriggerResults ==> Empty";
64  return;
65  }
66  iEvent.getByToken(hlTriggerResults_, TriggerResulsHandler);
67  if (TriggerResulsHandler.isValid())
68  trigRes = true;
69  if (!trigRes) {
70  edm::LogInfo("NoTriggerResults") << "TriggerResults ==> not readable";
71  return;
72  }
73  const TriggerResults &triggerResults = *(TriggerResulsHandler.product());
74 
75  // get simVertex
76  float simPV = 0;
77 
79  iEvent.getByToken(simVertexCollection_, simVertexCollection);
80  if (!simVertexCollection.isValid()) {
81  edm::LogInfo("NoSimVertex") << "SimVertex collection is invalid";
82  return;
83  }
84  if (simVertexCollection->empty()) {
85  edm::LogInfo("NoSimVertex") << "SimVertex collection is empty";
86  return;
87  }
88  const SimVertex simPVh = *(simVertexCollection->begin());
89  simPV = simPVh.position().z();
90 
91  // fill the DQM plot
92  Handle<VertexCollection> VertexHandler;
93  for (unsigned int ind = 0; ind < hltPathNames_.size(); ind++) {
94  for (unsigned int coll = 0; coll < VertexCollection_.size(); coll++) {
95  bool VertexOK = false;
96  if (!_isfoundHLTs[ind])
97  continue; // if the hltPath is not in the event, skip the event
98  if (!triggerResults.accept(hltPathIndexs_[ind]))
99  continue; // if the hltPath was not accepted skip the event
100 
101  // get the recoVertex
102  if (!VertexCollection_Label.at(coll).empty() && VertexCollection_Label.at(coll) != "NULL") {
103  iEvent.getByToken(VertexCollection_.at(coll), VertexHandler);
104  if (VertexHandler.isValid() > 0)
105  VertexOK = true;
106  }
107 
108  if (VertexOK) {
109  // calculate the variable (RecoVertex - SimVertex)
110  float value = VertexHandler->begin()->z() - simPV;
111 
112  // if value is over/under flow, assign the extreme value
113  float maxValue = H1_.at(ind)["Vertex_" + VertexCollection_Label.at(coll)]->getTH1F()->GetXaxis()->GetXmax();
114  if (value > maxValue)
115  value = maxValue - 0.0001;
116  if (value < -maxValue)
117  value = -maxValue + 0.0001;
118  // fill the histo
119  H1_.at(ind)["Vertex_" + VertexCollection_Label.at(coll)]->Fill(value);
120  }
121  } // for on VertexCollection_
122  } // for on hltPathNames_
123 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
edm::EDGetTokenT< std::vector< SimVertex > > simVertexCollection_
std::vector< std::map< std::string, MonitorElement * > > H1_
bool accept() const
Has at least one path accepted the event?
edm::EDGetTokenT< edm::TriggerResults > hlTriggerResults_
const math::XYZTLorentzVectorD & position() const
Definition: CoreSimVertex.h:21
Definition: value.py:1
static std::string const triggerResults
Definition: EdmProvDump.cc:45
bool isValid() const
Definition: HandleBase.h:70
JetCorrectorParametersCollection coll
Definition: classes.h:10
T const * product() const
Definition: Handle.h:69
std::vector< std::string > VertexCollection_Label
std::vector< std::string > hltPathNames_
std::vector< edm::EDGetTokenT< reco::VertexCollection > > VertexCollection_
HLT enums.
void HLTVertexPerformanceAnalyzer::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
)
overrideprivatevirtual

Implements DQMEDAnalyzer.

Definition at line 125 of file HLTVertexPerformanceAnalyzer.cc.

References dqm::dqmstoreimpl::DQMStore::IBooker::book1D(), coll, DEFINE_FWK_MODULE, hlt_dqm_sourceclient-live_cfg::dqmFolder, seedmultiplicitymonitor_newtracking_cfi::maxValue, dqm::impl::MonitorElement::setAxisTitle(), dqm::dqmstoreimpl::DQMStore::IBooker::setCurrentFolder(), and AlCaHLTBitMon_QueryRunRegistry::string.

127  {
128  // book the DQM plots
129  using namespace std;
131  for (unsigned int ind = 0; ind < hltPathNames_.size(); ind++) {
132  dqmFolder = Form("%s/Vertex/%s", mainFolder_.c_str(), hltPathNames_[ind].c_str());
133  H1_.push_back(std::map<std::string, MonitorElement *>());
134  ibooker.setCurrentFolder(dqmFolder);
135  for (unsigned int coll = 0; coll < VertexCollection_.size(); coll++) {
136  float maxValue = 0.02;
137  if (VertexCollection_Label.at(coll) == ("hltFastPrimaryVertex"))
138  maxValue = 2.; // for the hltFastPrimaryVertex use a larger scale (res ~ 1 cm)
139  float vertexU = maxValue;
140  float vertexL = -maxValue;
141  int vertexBins = 100;
142  if (!VertexCollection_Label.at(coll).empty() && VertexCollection_Label.at(coll) != "NULL") {
143  H1_.back()["Vertex_" + VertexCollection_Label.at(coll)] =
144  ibooker.book1D("Vertex_" + VertexCollection_Label.at(coll),
145  VertexCollection_Label.at(coll).c_str(),
146  vertexBins,
147  vertexL,
148  vertexU);
149  H1_.back()["Vertex_" + VertexCollection_Label.at(coll)]->setAxisTitle("vertex error (cm)", 1);
150  }
151  }
152  }
153 }
std::vector< std::map< std::string, MonitorElement * > > H1_
JetCorrectorParametersCollection coll
Definition: classes.h:10
std::vector< std::string > VertexCollection_Label
std::vector< std::string > hltPathNames_
std::vector< edm::EDGetTokenT< reco::VertexCollection > > VertexCollection_
void HLTVertexPerformanceAnalyzer::dqmBeginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
override

Definition at line 26 of file HLTVertexPerformanceAnalyzer.cc.

References newFWLiteAna::found, createfilelist::int, label, and edm::EDConsumerBase::labelsForToken().

26  {
27  triggerConfChanged_ = true;
28  EDConsumerBase::labelsForToken(hlTriggerResults_, label);
29 
31  const std::vector<std::string> &allHltPathNames = hltConfigProvider_.triggerNames();
32 
33  // fill hltPathIndexs_ with the trigger number of each hltPathNames_
34  for (size_t trgs = 0; trgs < hltPathNames_.size(); trgs++) {
35  unsigned int found = 1;
36  int it_mem = -1;
37  for (size_t it = 0; it < allHltPathNames.size(); ++it) {
38  found = allHltPathNames.at(it).find(hltPathNames_[trgs]);
39  if (found == 0) {
40  it_mem = (int)it;
41  }
42  } // for allallHltPathNames
43  hltPathIndexs_.push_back(it_mem);
44  } // for hltPathNames_
45 
46  // fill _isfoundHLTs for each hltPathNames_
47  for (size_t trgs = 0; trgs < hltPathNames_.size(); trgs++) {
48  if (hltPathIndexs_[trgs] < 0) {
49  _isfoundHLTs.push_back(false);
50  } else {
51  _isfoundHLTs.push_back(true);
52  }
53  }
54 }
const std::vector< std::string > & triggerNames() const
names of trigger paths
edm::EDGetTokenT< edm::TriggerResults > hlTriggerResults_
char const * process
Definition: ProductLabels.h:7
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
std::vector< std::string > hltPathNames_

Member Data Documentation

std::vector<bool> HLTVertexPerformanceAnalyzer::_isfoundHLTs
private

Definition at line 55 of file HLTVertexPerformanceAnalyzer.h.

std::vector<std::string> HLTVertexPerformanceAnalyzer::folders
private

Definition at line 56 of file HLTVertexPerformanceAnalyzer.h.

std::vector<std::map<std::string, MonitorElement *> > HLTVertexPerformanceAnalyzer::H1_
private

Definition at line 57 of file HLTVertexPerformanceAnalyzer.h.

HLTConfigProvider HLTVertexPerformanceAnalyzer::hltConfigProvider_
private

Definition at line 48 of file HLTVertexPerformanceAnalyzer.h.

std::vector<int> HLTVertexPerformanceAnalyzer::hltPathIndexs_
private

Definition at line 52 of file HLTVertexPerformanceAnalyzer.h.

std::vector<std::string> HLTVertexPerformanceAnalyzer::hltPathNames_
private

Definition at line 47 of file HLTVertexPerformanceAnalyzer.h.

edm::EDGetTokenT<edm::TriggerResults> HLTVertexPerformanceAnalyzer::hlTriggerResults_
private

Definition at line 45 of file HLTVertexPerformanceAnalyzer.h.

std::string HLTVertexPerformanceAnalyzer::hlTriggerResults_Label
private

Definition at line 61 of file HLTVertexPerformanceAnalyzer.h.

edm::EDConsumerBase::Labels HLTVertexPerformanceAnalyzer::label
private
std::string HLTVertexPerformanceAnalyzer::mainFolder_
private

Definition at line 44 of file HLTVertexPerformanceAnalyzer.h.

edm::EDGetTokenT<std::vector<SimVertex> > HLTVertexPerformanceAnalyzer::simVertexCollection_
private

Definition at line 46 of file HLTVertexPerformanceAnalyzer.h.

bool HLTVertexPerformanceAnalyzer::triggerConfChanged_
private

Definition at line 49 of file HLTVertexPerformanceAnalyzer.h.

std::vector<edm::EDGetTokenT<reco::VertexCollection> > HLTVertexPerformanceAnalyzer::VertexCollection_
private

Definition at line 51 of file HLTVertexPerformanceAnalyzer.h.

std::vector<std::string> HLTVertexPerformanceAnalyzer::VertexCollection_Label
private

Definition at line 60 of file HLTVertexPerformanceAnalyzer.h.