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 Member Functions | Private Attributes
ElectronPATIdMVAProducer Class Reference
Inheritance diagram for ElectronPATIdMVAProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

 ElectronPATIdMVAProducer (const edm::ParameterSet &)
 
virtual ~ElectronPATIdMVAProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Member Functions

virtual void produce (edm::Event &, const edm::EventSetup &)
 

Private Attributes

double _Rho
 
edm::InputTag electronTag_
 
edm::InputTag eventrho
 
string method_
 
EGammaMvaEleEstimatormvaID_
 
vector< string > mvaWeightFiles_
 
bool verbose_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Definition at line 26 of file ElectronPATIdMVAProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 58 of file ElectronPATIdMVAProducer.cc.

References edm::FileInPath::fullPath(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), compare_using_db::ifile, and EGammaMvaEleEstimator::kTrigNoIP.

58  {
59  verbose_ = iConfig.getUntrackedParameter<bool>("verbose", false);
60  electronTag_ = iConfig.getParameter<edm::InputTag>("electronTag");
61  method_ = iConfig.getParameter<string>("method");
62  std::vector<string> fpMvaWeightFiles = iConfig.getParameter<std::vector<std::string> >("mvaWeightFile");
63  eventrho = iConfig.getParameter<edm::InputTag>("Rho");
64 
65  produces<edm::ValueMap<float> >();
66 
68 
70 
71 
73 
74 
75 
76  bool manualCat_ = true;
77 
78  string path_mvaWeightFileEleID;
79  for(unsigned ifile=0 ; ifile < fpMvaWeightFiles.size() ; ++ifile) {
80  path_mvaWeightFileEleID = edm::FileInPath ( fpMvaWeightFiles[ifile].c_str() ).fullPath();
81  mvaWeightFiles_.push_back(path_mvaWeightFileEleID);
82  }
83 
84  mvaID_->initialize(method_, type_, manualCat_, mvaWeightFiles_);
85 
86 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
EGammaMvaEleEstimator * mvaID_
std::string fullPath() const
Definition: FileInPath.cc:171
ElectronPATIdMVAProducer::~ElectronPATIdMVAProducer ( )
virtual

Definition at line 89 of file ElectronPATIdMVAProducer.cc.

90 {
91 
92  // do anything here that needs to be done at desctruction time
93  // (e.g. close files, deallocate resources etc.)
94 
95 }

Member Function Documentation

void ElectronPATIdMVAProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDProducer.

Definition at line 103 of file ElectronPATIdMVAProducer.cc.

References edm::helper::Filler< Map >::fill(), edm::Event::getByLabel(), edm::helper::Filler< Map >::insert(), dbtoconf::out, edm::Event::put(), and makeHLTPrescaleTable::values.

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

103  {
104  using namespace edm;
105 
106  std::auto_ptr<edm::ValueMap<float> > out(new edm::ValueMap<float>() );
107 
108 
109 
110 
111 
112 
113 
114  Handle<pat::ElectronCollection> egCollection;
115  iEvent.getByLabel(electronTag_,egCollection);
116  const pat::ElectronCollection egCandidates = (*egCollection.product());
117 
118  _Rho=0;
119  edm::Handle<double> rhoPtr;
120  //const edm::InputTag eventrho("kt6PFJets", "rho");
121  iEvent.getByLabel(eventrho,rhoPtr);
122  _Rho=*rhoPtr;
123 
124  std::vector<float> values;
125  values.reserve(egCollection->size());
126 
127  for ( pat::ElectronCollection::const_iterator egIter = egCandidates.begin(); egIter != egCandidates.end(); ++egIter) {
128 
129  double mvaVal = -999999;
130 
131 
132 
133 
134  mvaVal = mvaID_->mvaValue( *egIter, _Rho, verbose_);
135 
136 
137  values.push_back( mvaVal );
138  }
139 
141  filler.insert(egCollection, values.begin(), values.end() );
142  filler.fill();
143 
144  iEvent.put(out);
145 
146 
147 }
std::vector< Electron > ElectronCollection
Definition: Electron.h:37
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
Double_t mvaValue(const reco::GsfElectron &ele, const reco::Vertex &vertex, const TransientTrackBuilder &transientTrackBuilder, EcalClusterLazyTools myEcalCluster, bool printDebug=kFALSE)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
tuple out
Definition: dbtoconf.py:99
EGammaMvaEleEstimator * mvaID_

Member Data Documentation

double ElectronPATIdMVAProducer::_Rho
private

Definition at line 37 of file ElectronPATIdMVAProducer.cc.

edm::InputTag ElectronPATIdMVAProducer::electronTag_
private

Definition at line 36 of file ElectronPATIdMVAProducer.cc.

edm::InputTag ElectronPATIdMVAProducer::eventrho
private

Definition at line 38 of file ElectronPATIdMVAProducer.cc.

string ElectronPATIdMVAProducer::method_
private

Definition at line 39 of file ElectronPATIdMVAProducer.cc.

EGammaMvaEleEstimator* ElectronPATIdMVAProducer::mvaID_
private

Definition at line 43 of file ElectronPATIdMVAProducer.cc.

vector<string> ElectronPATIdMVAProducer::mvaWeightFiles_
private

Definition at line 40 of file ElectronPATIdMVAProducer.cc.

bool ElectronPATIdMVAProducer::verbose_
private

Definition at line 35 of file ElectronPATIdMVAProducer.cc.