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::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > > edm::stream::EDAnalyzerBase edm::EDConsumerBase

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 beginRun (edm::Run const &, edm::EventSetup const &) final
 
void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
void endLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
void endRunSummary (edm::Run const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
uint32_t streamId () const
 
- Public Member Functions inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::stream::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDAnalyzerBase () 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
 
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)
 
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
 
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 edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDAnalyzerBase
typedef EDAnalyzerAdaptorBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static std::shared_ptr< dqmDetails::NoCacheglobalBeginLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *)
 
static std::shared_ptr< dqmDetails::NoCacheglobalBeginRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *)
 
static void globalEndLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *, dqmDetails::NoCache *)
 
static void globalEndRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *, dqmDetails::NoCache *)
 
- Static Public Member Functions inherited from edm::stream::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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)
 

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, diffTwoXMLs::label, edm::EDConsumerBase::labelsForToken(), GlobalPosition_Frontier_DevDB_cff::tag, and edm::vector_transform().

7 {
8  hlTriggerResults_ = consumes<TriggerResults>(iConfig.getParameter<InputTag> ("TriggerResults"));
9  VertexCollection_ = edm::vector_transform(iConfig.getParameter<std::vector<edm::InputTag> >( "Vertex" ), [this](edm::InputTag const & tag){return mayConsume< reco::VertexCollection>(tag);});
10  hltPathNames_ = iConfig.getParameter< std::vector<std::string> > ("HLTPathNames");
11  simVertexCollection_ = consumes<std::vector<SimVertex> >(iConfig.getParameter<edm::InputTag> ("SimVertexCollection"));
12 
13  EDConsumerBase::labelsForToken(hlTriggerResults_,label);
15 
16  for(unsigned int i=0; i<VertexCollection_.size() ; i++){
17  EDConsumerBase::labelsForToken(VertexCollection_[i],label);
19  }
20 }
T getParameter(std::string const &) const
edm::EDGetTokenT< std::vector< SimVertex > > simVertexCollection_
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
edm::EDGetTokenT< edm::TriggerResults > hlTriggerResults_
char const * module
Definition: ProductLabels.h:5
std::vector< std::string > VertexCollection_Label
std::vector< std::string > hltPathNames_
std::vector< edm::EDGetTokenT< reco::VertexCollection > > VertexCollection_
HLTVertexPerformanceAnalyzer::~HLTVertexPerformanceAnalyzer ( )
override

Definition at line 23 of file HLTVertexPerformanceAnalyzer.cc.

24 {
25 }

Member Function Documentation

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

Definition at line 62 of file HLTVertexPerformanceAnalyzer.cc.

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

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

Implements DQMEDAnalyzer.

Definition at line 119 of file HLTVertexPerformanceAnalyzer.cc.

References DQMStore::IBooker::book1D(), coll, DEFINE_FWK_MODULE, RecoTauDiscriminantConfiguration::maxValue, DQMStore::IBooker::setCurrentFolder(), and AlCaHLTBitMon_QueryRunRegistry::string.

120 {
121  //book the DQM plots
122  using namespace std;
123  std::string dqmFolder;
124  for (unsigned int ind=0; ind<hltPathNames_.size();ind++) {
125  dqmFolder = Form("HLT/BTag/Vertex/%s",hltPathNames_[ind].c_str());
126  H1_.push_back(std::map<std::string, MonitorElement *>());
127  ibooker.setCurrentFolder(dqmFolder);
128  for (unsigned int coll=0; coll<VertexCollection_.size();coll++) {
129  float maxValue = 0.02;
130  if(VertexCollection_Label.at(coll)==("hltFastPrimaryVertex")) maxValue = 2.; //for the hltFastPrimaryVertex use a larger scale (res ~ 1 cm)
131  float vertexU = maxValue;
132  float vertexL = -maxValue;
133  int vertexBins = 100;
134  if ( VertexCollection_Label.at(coll) != "" && VertexCollection_Label.at(coll) != "NULL" ) {
135  H1_.back()["Vertex_"+VertexCollection_Label.at(coll)] = ibooker.book1D("Vertex_"+VertexCollection_Label.at(coll), VertexCollection_Label.at(coll).c_str(), vertexBins, vertexL, vertexU );
136  H1_.back()["Vertex_"+VertexCollection_Label.at(coll)] -> setAxisTitle("vertex error (cm)",1);
137  }
138  }
139  }
140 }
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:118
JetCorrectorParametersCollection coll
Definition: classes.h:10
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:279
std::vector< std::string > VertexCollection_Label
std::vector< std::string > hltPathNames_
std::vector< edm::EDGetTokenT< reco::VertexCollection > > VertexCollection_
std::vector< std::map< std::string, MonitorElement * > > H1_
void HLTVertexPerformanceAnalyzer::dqmBeginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
override

Definition at line 28 of file HLTVertexPerformanceAnalyzer.cc.

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

28  {
29  triggerConfChanged_ = true;
30  EDConsumerBase::labelsForToken(hlTriggerResults_,label);
31 
33  const std::vector< std::string > & allHltPathNames = hltConfigProvider_.triggerNames();
34 
35  //fill hltPathIndexs_ with the trigger number of each hltPathNames_
36  for ( size_t trgs=0; trgs<hltPathNames_.size(); trgs++) {
37  unsigned int found = 1;
38  int it_mem = -1;
39  for (size_t it=0 ; it < allHltPathNames.size() ; ++it )
40  {
41  found = allHltPathNames.at(it).find(hltPathNames_[trgs]);
42  if ( found == 0 )
43  {
44  it_mem= (int) it;
45  }
46  }//for allallHltPathNames
47  hltPathIndexs_.push_back(it_mem);
48  }//for hltPathNames_
49 
50  //fill _isfoundHLTs for each hltPathNames_
51  for ( size_t trgs=0; trgs<hltPathNames_.size(); trgs++) {
52  if ( hltPathIndexs_[trgs] < 0 ) {
53  _isfoundHLTs.push_back(false);
54  }
55  else {
56  _isfoundHLTs.push_back(true);
57  }
58  }
59 }
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 54 of file HLTVertexPerformanceAnalyzer.h.

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

Definition at line 55 of file HLTVertexPerformanceAnalyzer.h.

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

Definition at line 56 of file HLTVertexPerformanceAnalyzer.h.

HLTConfigProvider HLTVertexPerformanceAnalyzer::hltConfigProvider_
private

Definition at line 47 of file HLTVertexPerformanceAnalyzer.h.

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

Definition at line 51 of file HLTVertexPerformanceAnalyzer.h.

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

Definition at line 46 of file HLTVertexPerformanceAnalyzer.h.

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

Definition at line 44 of file HLTVertexPerformanceAnalyzer.h.

std::string HLTVertexPerformanceAnalyzer::hlTriggerResults_Label
private

Definition at line 60 of file HLTVertexPerformanceAnalyzer.h.

edm::EDConsumerBase::Labels HLTVertexPerformanceAnalyzer::label
private
edm::EDGetTokenT<std::vector<SimVertex> > HLTVertexPerformanceAnalyzer::simVertexCollection_
private

Definition at line 45 of file HLTVertexPerformanceAnalyzer.h.

bool HLTVertexPerformanceAnalyzer::triggerConfChanged_
private

Definition at line 48 of file HLTVertexPerformanceAnalyzer.h.

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

Definition at line 50 of file HLTVertexPerformanceAnalyzer.h.

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

Definition at line 59 of file HLTVertexPerformanceAnalyzer.h.