CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
virtual void endJob ()
 
 GenericBenchmarkAnalyzer (const edm::ParameterSet &)
 
virtual ~GenericBenchmarkAnalyzer ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 
- 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=NULL, 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 ()
 

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
 
bool onlyTwoJets_
 
std::string outputFile_
 
bool plotAgainstRecoQuantities_
 
double recPt_cut
 
bool startFromGen_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
CurrentProcessingContext const * currentContext () const
 
- 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)
 
- Protected Attributes inherited from GenericBenchmark
PFBenchmarkAlgoalgo_
 
DQMStoredbe_
 

Detailed Description

Definition at line 16 of file GenericBenchmarkAnalyzer.h.

Constructor & Destructor Documentation

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

Definition at line 38 of file GenericBenchmarkAnalyzer.cc.

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

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

Definition at line 65 of file GenericBenchmarkAnalyzer.cc.

65 { }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 86 of file GenericBenchmarkAnalyzer.cc.

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

88 {
89 
90  // Typedefs to use views
91  typedef edm::View<reco::Candidate> candidateCollection ;
92  typedef edm::View<reco::Candidate> candidateCollection ;
93 
94  const candidateCollection *truth_candidates;
95  const candidateCollection *reco_candidates;
96 
97  // ==========================================================
98  // Retrieve!
99  // ==========================================================
100 
101  {
102  // Get Truth Candidates (GenCandidates, GenJets, etc.)
103  Handle<candidateCollection> truth_hnd;
104  bool isGen = iEvent.getByLabel(inputTruthLabel_, truth_hnd);
105  if ( !isGen ) {
106  std::cout << "Warning : no Gen jets in input !" << std::endl;
107  return;
108  }
109 
110  truth_candidates = truth_hnd.product();
111 
112  // Get Reco Candidates (PFlow, CaloJet, etc.)
114  bool isReco = iEvent.getByLabel(inputRecoLabel_, reco_hnd);
115  if ( !isReco ) {
116  std::cout << "Warning : no Reco jets in input !" << std::endl;
117  return;
118  }
119  reco_candidates = reco_hnd.product();
120 
121  // no longer needed with template-ized Benchmark
122  //const PFCandidateCollection *pf_candidates = reco_hnd.product();
123  //static CandidateCollection reco_storage = algo_->makeCandidateCollection(pf_candidates);
124  //reco_candidates = &reco_storage;
125 
126  }
127  if (!truth_candidates || !reco_candidates) {
128 
129  edm::LogInfo("OutputInfo") << " failed to retrieve data required by ParticleFlow Task";
130  edm::LogInfo("OutputInfo") << " ParticleFlow Task cannot continue...!";
131  return;
132 
133  }
134 
135  // ==========================================================
136  // Analyze!
137  // ==========================================================
138 
139  fill(reco_candidates,truth_candidates,
142 }
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 getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
T const * product() const
Definition: Handle.h:74
tuple cout
Definition: gather_cfg.py:121
void GenericBenchmarkAnalyzer::beginJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 68 of file GenericBenchmarkAnalyzer.cc.

References benchmarkLabel_, dbe_, cppFunctionSkipper::operator, getHLTPrescaleColumns::path, DQMStore::setCurrentFolder(), and HcalObjRepresent::setup().

69 {
70 
71  // get ahold of back-end interface
73 
74  if (dbe_) {
75  //dbe_->setVerbose(1);
76  string path = "PFTask/Benchmarks/" + benchmarkLabel_ + "/";
77  if (plotAgainstRecoQuantities_) path += "Reco"; else path += "Gen";
78  dbe_->setCurrentFolder(path.c_str());
80 
81  }
82 
83 }
void setup(DQMStore *DQM=NULL, bool PlotAgainstReco_=true, float minDeltaEt=-100., float maxDeltaEt=50., float minDeltaPhi=-0.5, float maxDeltaPhi=0.5, bool doMetPlots=false)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:434
void GenericBenchmarkAnalyzer::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 144 of file GenericBenchmarkAnalyzer.cc.

References dbe_, and DQMStore::save().

145 {
146 
147  // Store the DAQ Histograms
148  if (outputFile_.size() != 0)
150 }
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
Definition: DQMStore.cc:2118

Member Data Documentation

std::string GenericBenchmarkAnalyzer::benchmarkLabel_
private

Definition at line 32 of file GenericBenchmarkAnalyzer.h.

double GenericBenchmarkAnalyzer::deltaR_cut
private

Definition at line 39 of file GenericBenchmarkAnalyzer.h.

bool GenericBenchmarkAnalyzer::doMetPlots_
private

Definition at line 44 of file GenericBenchmarkAnalyzer.h.

edm::InputTag GenericBenchmarkAnalyzer::inputRecoLabel_
private

Definition at line 31 of file GenericBenchmarkAnalyzer.h.

edm::InputTag GenericBenchmarkAnalyzer::inputTruthLabel_
private

Definition at line 30 of file GenericBenchmarkAnalyzer.h.

float GenericBenchmarkAnalyzer::maxDeltaEt_
private

Definition at line 41 of file GenericBenchmarkAnalyzer.h.

float GenericBenchmarkAnalyzer::maxDeltaPhi_
private

Definition at line 43 of file GenericBenchmarkAnalyzer.h.

double GenericBenchmarkAnalyzer::maxEta_cut
private

Definition at line 38 of file GenericBenchmarkAnalyzer.h.

float GenericBenchmarkAnalyzer::minDeltaEt_
private

Definition at line 40 of file GenericBenchmarkAnalyzer.h.

float GenericBenchmarkAnalyzer::minDeltaPhi_
private

Definition at line 42 of file GenericBenchmarkAnalyzer.h.

double GenericBenchmarkAnalyzer::minEta_cut
private

Definition at line 37 of file GenericBenchmarkAnalyzer.h.

bool GenericBenchmarkAnalyzer::onlyTwoJets_
private

Definition at line 35 of file GenericBenchmarkAnalyzer.h.

std::string GenericBenchmarkAnalyzer::outputFile_
private

Definition at line 29 of file GenericBenchmarkAnalyzer.h.

bool GenericBenchmarkAnalyzer::plotAgainstRecoQuantities_
private

Definition at line 34 of file GenericBenchmarkAnalyzer.h.

double GenericBenchmarkAnalyzer::recPt_cut
private

Definition at line 36 of file GenericBenchmarkAnalyzer.h.

bool GenericBenchmarkAnalyzer::startFromGen_
private

Definition at line 33 of file GenericBenchmarkAnalyzer.h.