CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Attributes
GenericBenchmarkAnalyzer Class Reference
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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
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
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 
- Protected Attributes inherited from GenericBenchmark
PFBenchmarkAlgoalgo_
 
DQMStoredbe_
 

Detailed Description

Definition at line 32 of file GenericBenchmarkAnalyzer.cc.

Constructor & Destructor Documentation

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

Definition at line 70 of file GenericBenchmarkAnalyzer.cc.

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

70  {
71  inputTruthLabel_ = iConfig.getParameter<edm::InputTag>("InputTruthLabel");
72  inputRecoLabel_ = iConfig.getParameter<edm::InputTag>("InputRecoLabel");
73  outputFile_ = iConfig.getUntrackedParameter<std::string>("OutputFile");
74  benchmarkLabel_ = iConfig.getParameter<std::string>("BenchmarkLabel");
75  startFromGen_ = iConfig.getParameter<bool>("StartFromGen");
76  plotAgainstRecoQuantities_ = iConfig.getParameter<bool>("PlotAgainstRecoQuantities");
77  onlyTwoJets_ = iConfig.getParameter<bool>("OnlyTwoJets");
78  recPt_cut = iConfig.getParameter<double>("recPt");
79  minEta_cut = iConfig.getParameter<double>("minEta");
80  maxEta_cut = iConfig.getParameter<double>("maxEta");
81  deltaR_cut = iConfig.getParameter<double>("deltaRMax");
82 
83  minDeltaEt_ = iConfig.getParameter<double>("minDeltaEt");
84  maxDeltaEt_ = iConfig.getParameter<double>("maxDeltaEt");
85  minDeltaPhi_ = iConfig.getParameter<double>("minDeltaPhi");
86  maxDeltaPhi_ = iConfig.getParameter<double>("maxDeltaPhi");
87  doMetPlots_ = iConfig.getParameter<bool>("doMetPlots");
88 
89  if (!outputFile_.empty())
90  edm::LogInfo("OutputInfo") << " ParticleFLow Task histograms will be saved to '" << outputFile_.c_str() << "'";
91  else
92  edm::LogInfo("OutputInfo") << " ParticleFlow Task histograms will NOT be saved";
93 
94  myTruth_ = consumes<edm::View<reco::Candidate>>(inputTruthLabel_);
95  myReco_ = consumes<edm::View<reco::Candidate>>(inputRecoLabel_);
96 }
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< edm::View< reco::Candidate > > myTruth_
Log< level::Info, false > LogInfo
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< edm::View< reco::Candidate > > myReco_
GenericBenchmarkAnalyzer::~GenericBenchmarkAnalyzer ( )
override

Definition at line 98 of file GenericBenchmarkAnalyzer.cc.

98 {}

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 117 of file GenericBenchmarkAnalyzer.cc.

References gather_cfg::cout, PVValHelper::fill(), edm::Event::getByToken(), and edm::Handle< T >::product().

117  {
118  // Typedefs to use views
119  typedef edm::View<reco::Candidate> candidateCollection;
120  typedef edm::View<reco::Candidate> candidateCollection;
121 
122  const candidateCollection *truth_candidates;
123  const candidateCollection *reco_candidates;
124 
125  // ==========================================================
126  // Retrieve!
127  // ==========================================================
128 
129  {
130  // Get Truth Candidates (GenCandidates, GenJets, etc.)
131  Handle<candidateCollection> truth_hnd;
132  bool isGen = iEvent.getByToken(myTruth_, truth_hnd);
133 
134  if (!isGen) {
135  std::cout << "Warning : no Gen jets in input !" << std::endl;
136  return;
137  }
138 
139  truth_candidates = truth_hnd.product();
140 
141  // Get Reco Candidates (PFlow, CaloJet, etc.)
143  bool isReco = iEvent.getByToken(myReco_, reco_hnd);
144  if (!isReco) {
145  std::cout << "Warning : no Reco jets in input !" << std::endl;
146  return;
147  }
148  reco_candidates = reco_hnd.product();
149 
150  // no longer needed with template-ized Benchmark
151  // const PFCandidateCollection *pf_candidates = reco_hnd.product();
152  // static CandidateCollection reco_storage =
153  // algo_->makeCandidateCollection(pf_candidates); reco_candidates =
154  // &reco_storage;
155  }
156  if (!truth_candidates || !reco_candidates) {
157  edm::LogInfo("OutputInfo") << " failed to retrieve data required by ParticleFlow Task";
158  edm::LogInfo("OutputInfo") << " ParticleFlow Task cannot continue...!";
159  return;
160  }
161 
162  // ==========================================================
163  // Analyze!
164  // ==========================================================
165 
166  fill(reco_candidates,
167  truth_candidates,
170  onlyTwoJets_,
171  recPt_cut,
172  minEta_cut,
173  maxEta_cut,
174  deltaR_cut);
175 }
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.)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
edm::EDGetTokenT< edm::View< reco::Candidate > > myTruth_
Log< level::Info, false > LogInfo
T const * product() const
Definition: Handle.h:70
edm::EDGetTokenT< edm::View< reco::Candidate > > myReco_
tuple cout
Definition: gather_cfg.py:144
void GenericBenchmarkAnalyzer::beginJob ( void  )
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 100 of file GenericBenchmarkAnalyzer.cc.

References benchmarkLabel_, dbe_, Utilities::operator, fed_dqm_sourceclient-live_cfg::path, GeneralSetup::setup(), and AlCaHLTBitMon_QueryRunRegistry::string.

100  {
101  // get ahold of back-end interface
103 
104  if (dbe_) {
105  // dbe_->setVerbose(1);
106  // string path = "PFTask/Benchmarks/" + benchmarkLabel_ + "/";
107  std::string path = "ParticleFlow/" + benchmarkLabel_ + "/";
109  path += "Reco";
110  else
111  path += "Gen";
112  dbe_->setCurrentFolder(path);
114  }
115 }
void setCurrentFolder(std::string const &fullpath) override
Definition: DQMStore.h:569
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 GenericBenchmarkAnalyzer::endJob ( void  )
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 177 of file GenericBenchmarkAnalyzer.cc.

References dbe_.

177  {
178  // Store the DAQ Histograms
179  if (!outputFile_.empty())
181 }
DQM_DEPRECATED void save(std::string const &filename, std::string const &path="")
Definition: DQMStore.cc:784

Member Data Documentation

std::string GenericBenchmarkAnalyzer::benchmarkLabel_
private

Definition at line 48 of file GenericBenchmarkAnalyzer.cc.

double GenericBenchmarkAnalyzer::deltaR_cut
private

Definition at line 55 of file GenericBenchmarkAnalyzer.cc.

bool GenericBenchmarkAnalyzer::doMetPlots_
private

Definition at line 60 of file GenericBenchmarkAnalyzer.cc.

edm::InputTag GenericBenchmarkAnalyzer::inputRecoLabel_
private

Definition at line 47 of file GenericBenchmarkAnalyzer.cc.

edm::InputTag GenericBenchmarkAnalyzer::inputTruthLabel_
private

Definition at line 46 of file GenericBenchmarkAnalyzer.cc.

float GenericBenchmarkAnalyzer::maxDeltaEt_
private

Definition at line 57 of file GenericBenchmarkAnalyzer.cc.

float GenericBenchmarkAnalyzer::maxDeltaPhi_
private

Definition at line 59 of file GenericBenchmarkAnalyzer.cc.

double GenericBenchmarkAnalyzer::maxEta_cut
private

Definition at line 54 of file GenericBenchmarkAnalyzer.cc.

float GenericBenchmarkAnalyzer::minDeltaEt_
private

Definition at line 56 of file GenericBenchmarkAnalyzer.cc.

float GenericBenchmarkAnalyzer::minDeltaPhi_
private

Definition at line 58 of file GenericBenchmarkAnalyzer.cc.

double GenericBenchmarkAnalyzer::minEta_cut
private

Definition at line 53 of file GenericBenchmarkAnalyzer.cc.

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

Definition at line 45 of file GenericBenchmarkAnalyzer.cc.

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

Definition at line 44 of file GenericBenchmarkAnalyzer.cc.

bool GenericBenchmarkAnalyzer::onlyTwoJets_
private

Definition at line 51 of file GenericBenchmarkAnalyzer.cc.

std::string GenericBenchmarkAnalyzer::outputFile_
private

Definition at line 43 of file GenericBenchmarkAnalyzer.cc.

bool GenericBenchmarkAnalyzer::plotAgainstRecoQuantities_
private

Definition at line 50 of file GenericBenchmarkAnalyzer.cc.

double GenericBenchmarkAnalyzer::recPt_cut
private

Definition at line 52 of file GenericBenchmarkAnalyzer.cc.

bool GenericBenchmarkAnalyzer::startFromGen_
private

Definition at line 49 of file GenericBenchmarkAnalyzer.cc.