CMS 3D CMS Logo

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

#include <GenericBenchmarkAnalyzer.h>

Inheritance diagram for GenericBenchmarkAnalyzer:
edm::EDAnalyzer GenericBenchmark edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
void endJob () override
 
 GenericBenchmarkAnalyzer (const edm::ParameterSet &)
 
 ~GenericBenchmarkAnalyzer () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
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)
 
- Public Member Functions inherited from GenericBenchmark
template<typename C >
void fill (const C *RecoCollection, const C *GenCollection, bool startFromGen=false, bool PlotAgainstReco=true, bool onlyTwoJets=false, double recPt_cut=-1., double minEta_cut=-1., double maxEta_cut=-1., double deltaR_cut=-1.)
 
 GenericBenchmark ()
 
void setfile (TFile *file)
 
void setup (DQMStore *DQM=nullptr, bool PlotAgainstReco_=true, float minDeltaEt=-100., float maxDeltaEt=50., float minDeltaPhi=-0.5, float maxDeltaPhi=0.5, bool doMetPlots=false)
 
void write (std::string Filename)
 
virtual ~GenericBenchmark () noexcept(false)
 

Private Attributes

std::string benchmarkLabel_
 
double deltaR_cut
 
bool doMetPlots_
 
edm::InputTag inputRecoLabel_
 
edm::InputTag inputTruthLabel_
 
float maxDeltaEt_
 
float maxDeltaPhi_
 
double maxEta_cut
 
float minDeltaEt_
 
float minDeltaPhi_
 
double minEta_cut
 
edm::EDGetTokenT< edm::View< reco::Candidate > > myReco_
 
edm::EDGetTokenT< edm::View< reco::Candidate > > myTruth_
 
bool onlyTwoJets_
 
std::string outputFile_
 
bool plotAgainstRecoQuantities_
 
double recPt_cut
 
bool startFromGen_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Public Types inherited from GenericBenchmark
typedef dqm::legacy::DQMStore DQMStore
 
typedef dqm::legacy::MonitorElement MonitorElement
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
- Protected Attributes inherited from GenericBenchmark
PFBenchmarkAlgoalgo_
 
DQMStoredbe_
 

Detailed Description

Definition at line 17 of file GenericBenchmarkAnalyzer.h.

Constructor & Destructor Documentation

◆ GenericBenchmarkAnalyzer()

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

Definition at line 37 of file GenericBenchmarkAnalyzer.cc.

37  {
38  inputTruthLabel_ = iConfig.getParameter<edm::InputTag>("InputTruthLabel");
39  inputRecoLabel_ = iConfig.getParameter<edm::InputTag>("InputRecoLabel");
40  outputFile_ = iConfig.getUntrackedParameter<std::string>("OutputFile");
41  benchmarkLabel_ = iConfig.getParameter<std::string>("BenchmarkLabel");
42  startFromGen_ = iConfig.getParameter<bool>("StartFromGen");
43  plotAgainstRecoQuantities_ = iConfig.getParameter<bool>("PlotAgainstRecoQuantities");
44  onlyTwoJets_ = iConfig.getParameter<bool>("OnlyTwoJets");
45  recPt_cut = iConfig.getParameter<double>("recPt");
46  minEta_cut = iConfig.getParameter<double>("minEta");
47  maxEta_cut = iConfig.getParameter<double>("maxEta");
48  deltaR_cut = iConfig.getParameter<double>("deltaRMax");
49 
50  minDeltaEt_ = iConfig.getParameter<double>("minDeltaEt");
51  maxDeltaEt_ = iConfig.getParameter<double>("maxDeltaEt");
52  minDeltaPhi_ = iConfig.getParameter<double>("minDeltaPhi");
53  maxDeltaPhi_ = iConfig.getParameter<double>("maxDeltaPhi");
54  doMetPlots_ = iConfig.getParameter<bool>("doMetPlots");
55 
56  if (!outputFile_.empty())
57  edm::LogInfo("OutputInfo") << " ParticleFLow Task histograms will be saved to '" << outputFile_.c_str() << "'";
58  else
59  edm::LogInfo("OutputInfo") << " ParticleFlow Task histograms will NOT be saved";
60 
61  myTruth_ = consumes<edm::View<reco::Candidate>>(inputTruthLabel_);
62  myReco_ = consumes<edm::View<reco::Candidate>>(inputRecoLabel_);
63 }

References benchmarkLabel_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

◆ ~GenericBenchmarkAnalyzer()

GenericBenchmarkAnalyzer::~GenericBenchmarkAnalyzer ( )
override

Definition at line 65 of file GenericBenchmarkAnalyzer.cc.

65 {}

Member Function Documentation

◆ analyze()

void GenericBenchmarkAnalyzer::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::EDAnalyzer.

Definition at line 84 of file GenericBenchmarkAnalyzer.cc.

84  {
85  // Typedefs to use views
86  typedef edm::View<reco::Candidate> candidateCollection;
87  typedef edm::View<reco::Candidate> candidateCollection;
88 
89  const candidateCollection *truth_candidates;
90  const candidateCollection *reco_candidates;
91 
92  // ==========================================================
93  // Retrieve!
94  // ==========================================================
95 
96  {
97  // Get Truth Candidates (GenCandidates, GenJets, etc.)
99  bool isGen = iEvent.getByToken(myTruth_, truth_hnd);
100 
101  if (!isGen) {
102  std::cout << "Warning : no Gen jets in input !" << std::endl;
103  return;
104  }
105 
106  truth_candidates = truth_hnd.product();
107 
108  // Get Reco Candidates (PFlow, CaloJet, etc.)
110  bool isReco = iEvent.getByToken(myReco_, reco_hnd);
111  if (!isReco) {
112  std::cout << "Warning : no Reco jets in input !" << std::endl;
113  return;
114  }
115  reco_candidates = reco_hnd.product();
116 
117  // no longer needed with template-ized Benchmark
118  // const PFCandidateCollection *pf_candidates = reco_hnd.product();
119  // static CandidateCollection reco_storage =
120  // algo_->makeCandidateCollection(pf_candidates); reco_candidates =
121  // &reco_storage;
122  }
123  if (!truth_candidates || !reco_candidates) {
124  edm::LogInfo("OutputInfo") << " failed to retrieve data required by ParticleFlow Task";
125  edm::LogInfo("OutputInfo") << " ParticleFlow Task cannot continue...!";
126  return;
127  }
128 
129  // ==========================================================
130  // Analyze!
131  // ==========================================================
132 
133  fill(reco_candidates,
134  truth_candidates,
137  onlyTwoJets_,
138  recPt_cut,
139  minEta_cut,
140  maxEta_cut,
141  deltaR_cut);
142 }

References gather_cfg::cout, ntuplemaker::fill, iEvent, TauSpinner_cfi::isReco, and edm::Handle< T >::product().

◆ beginJob()

void GenericBenchmarkAnalyzer::beginJob ( void  )
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 67 of file GenericBenchmarkAnalyzer.cc.

67  {
68  // get ahold of back-end interface
69  dbe_ = edm::Service<DQMStore>().operator->();
70 
71  if (dbe_) {
72  // dbe_->setVerbose(1);
73  // string path = "PFTask/Benchmarks/" + benchmarkLabel_ + "/";
74  std::string path = "ParticleFlow/" + benchmarkLabel_ + "/";
76  path += "Reco";
77  else
78  path += "Gen";
81  }
82 }

References benchmarkLabel_, dbe_, castor_dqm_sourceclient_file_cfg::path, dqm::implementation::DQMStore::setCurrentFolder(), singleTopDQM_cfi::setup, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ endJob()

void GenericBenchmarkAnalyzer::endJob ( void  )
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 144 of file GenericBenchmarkAnalyzer.cc.

144  {
145  // Store the DAQ Histograms
146  if (!outputFile_.empty())
148 }

References dbe_, and dqm::implementation::DQMStore::save().

Member Data Documentation

◆ benchmarkLabel_

std::string GenericBenchmarkAnalyzer::benchmarkLabel_
private

Definition at line 33 of file GenericBenchmarkAnalyzer.h.

◆ deltaR_cut

double GenericBenchmarkAnalyzer::deltaR_cut
private

Definition at line 40 of file GenericBenchmarkAnalyzer.h.

◆ doMetPlots_

bool GenericBenchmarkAnalyzer::doMetPlots_
private

Definition at line 45 of file GenericBenchmarkAnalyzer.h.

◆ inputRecoLabel_

edm::InputTag GenericBenchmarkAnalyzer::inputRecoLabel_
private

Definition at line 32 of file GenericBenchmarkAnalyzer.h.

◆ inputTruthLabel_

edm::InputTag GenericBenchmarkAnalyzer::inputTruthLabel_
private

Definition at line 31 of file GenericBenchmarkAnalyzer.h.

◆ maxDeltaEt_

float GenericBenchmarkAnalyzer::maxDeltaEt_
private

Definition at line 42 of file GenericBenchmarkAnalyzer.h.

◆ maxDeltaPhi_

float GenericBenchmarkAnalyzer::maxDeltaPhi_
private

Definition at line 44 of file GenericBenchmarkAnalyzer.h.

◆ maxEta_cut

double GenericBenchmarkAnalyzer::maxEta_cut
private

Definition at line 39 of file GenericBenchmarkAnalyzer.h.

◆ minDeltaEt_

float GenericBenchmarkAnalyzer::minDeltaEt_
private

Definition at line 41 of file GenericBenchmarkAnalyzer.h.

◆ minDeltaPhi_

float GenericBenchmarkAnalyzer::minDeltaPhi_
private

Definition at line 43 of file GenericBenchmarkAnalyzer.h.

◆ minEta_cut

double GenericBenchmarkAnalyzer::minEta_cut
private

Definition at line 38 of file GenericBenchmarkAnalyzer.h.

◆ myReco_

edm::EDGetTokenT<edm::View<reco::Candidate> > GenericBenchmarkAnalyzer::myReco_
private

Definition at line 30 of file GenericBenchmarkAnalyzer.h.

◆ myTruth_

edm::EDGetTokenT<edm::View<reco::Candidate> > GenericBenchmarkAnalyzer::myTruth_
private

Definition at line 29 of file GenericBenchmarkAnalyzer.h.

◆ onlyTwoJets_

bool GenericBenchmarkAnalyzer::onlyTwoJets_
private

Definition at line 36 of file GenericBenchmarkAnalyzer.h.

◆ outputFile_

std::string GenericBenchmarkAnalyzer::outputFile_
private

Definition at line 28 of file GenericBenchmarkAnalyzer.h.

◆ plotAgainstRecoQuantities_

bool GenericBenchmarkAnalyzer::plotAgainstRecoQuantities_
private

Definition at line 35 of file GenericBenchmarkAnalyzer.h.

◆ recPt_cut

double GenericBenchmarkAnalyzer::recPt_cut
private

Definition at line 37 of file GenericBenchmarkAnalyzer.h.

◆ startFromGen_

bool GenericBenchmarkAnalyzer::startFromGen_
private

Definition at line 34 of file GenericBenchmarkAnalyzer.h.

GenericBenchmarkAnalyzer::minEta_cut
double minEta_cut
Definition: GenericBenchmarkAnalyzer.h:38
edm::Handle::product
T const * product() const
Definition: Handle.h:70
gather_cfg.cout
cout
Definition: gather_cfg.py:144
GenericBenchmarkAnalyzer::maxDeltaEt_
float maxDeltaEt_
Definition: GenericBenchmarkAnalyzer.h:42
GenericBenchmarkAnalyzer::startFromGen_
bool startFromGen_
Definition: GenericBenchmarkAnalyzer.h:34
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::Handle
Definition: AssociativeIterator.h:50
GenericBenchmarkAnalyzer::recPt_cut
double recPt_cut
Definition: GenericBenchmarkAnalyzer.h:37
GenericBenchmarkAnalyzer::maxDeltaPhi_
float maxDeltaPhi_
Definition: GenericBenchmarkAnalyzer.h:44
GenericBenchmarkAnalyzer::benchmarkLabel_
std::string benchmarkLabel_
Definition: GenericBenchmarkAnalyzer.h:33
GenericBenchmarkAnalyzer::myReco_
edm::EDGetTokenT< edm::View< reco::Candidate > > myReco_
Definition: GenericBenchmarkAnalyzer.h:30
GenericBenchmark::fill
void fill(const C *RecoCollection, const C *GenCollection, bool startFromGen=false, bool PlotAgainstReco=true, bool onlyTwoJets=false, double recPt_cut=-1., double minEta_cut=-1., double maxEta_cut=-1., double deltaR_cut=-1.)
Definition: GenericBenchmark.h:129
GenericBenchmarkAnalyzer::inputTruthLabel_
edm::InputTag inputTruthLabel_
Definition: GenericBenchmarkAnalyzer.h:31
GenericBenchmarkAnalyzer::minDeltaPhi_
float minDeltaPhi_
Definition: GenericBenchmarkAnalyzer.h:43
GenericBenchmark::setup
void setup(DQMStore *DQM=nullptr, bool PlotAgainstReco_=true, float minDeltaEt=-100., float maxDeltaEt=50., float minDeltaPhi=-0.5, float maxDeltaPhi=0.5, bool doMetPlots=false)
Definition: GenericBenchmark.cc:37
dqm::implementation::DQMStore::setCurrentFolder
void setCurrentFolder(std::string const &fullpath) override
Definition: DQMStore.h:569
dqm::implementation::DQMStore::save
DQM_DEPRECATED void save(std::string const &filename, std::string const &path="")
Definition: DQMStore.cc:761
GenericBenchmarkAnalyzer::maxEta_cut
double maxEta_cut
Definition: GenericBenchmarkAnalyzer.h:39
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::View
Definition: CaloClusterFwd.h:14
GenericBenchmarkAnalyzer::deltaR_cut
double deltaR_cut
Definition: GenericBenchmarkAnalyzer.h:40
GenericBenchmarkAnalyzer::outputFile_
std::string outputFile_
Definition: GenericBenchmarkAnalyzer.h:28
edm::Service
Definition: Service.h:30
iEvent
int iEvent
Definition: GenABIO.cc:224
GenericBenchmarkAnalyzer::doMetPlots_
bool doMetPlots_
Definition: GenericBenchmarkAnalyzer.h:45
GenericBenchmark::dbe_
DQMStore * dbe_
Definition: GenericBenchmark.h:124
GenericBenchmarkAnalyzer::onlyTwoJets_
bool onlyTwoJets_
Definition: GenericBenchmarkAnalyzer.h:36
GenericBenchmarkAnalyzer::myTruth_
edm::EDGetTokenT< edm::View< reco::Candidate > > myTruth_
Definition: GenericBenchmarkAnalyzer.h:29
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
GenericBenchmarkAnalyzer::inputRecoLabel_
edm::InputTag inputRecoLabel_
Definition: GenericBenchmarkAnalyzer.h:32
castor_dqm_sourceclient_file_cfg.path
path
Definition: castor_dqm_sourceclient_file_cfg.py:37
TauSpinner_cfi.isReco
isReco
Definition: TauSpinner_cfi.py:4
edm::Log
Definition: MessageLogger.h:70
edm::InputTag
Definition: InputTag.h:15
GenericBenchmarkAnalyzer::minDeltaEt_
float minDeltaEt_
Definition: GenericBenchmarkAnalyzer.h:41
GenericBenchmarkAnalyzer::plotAgainstRecoQuantities_
bool plotAgainstRecoQuantities_
Definition: GenericBenchmarkAnalyzer.h:35