CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PFIsolationFiller.cc
Go to the documentation of this file.
2 
8 
10 
11 #include <iostream>
12 #include <string>
13 
14 using namespace reco;
15 
17  {
18  previousGsfElectrons_ = consumes<reco::GsfElectronCollection>(cfg.getParameter<edm::InputTag>("previousGsfElectronsTag"));
19  outputCollectionLabel_ = cfg.getParameter<std::string>("outputCollectionLabel");
20  edm::ParameterSet pfIsoVals(cfg.getParameter<edm::ParameterSet> ("pfIsolationValues"));
21 
22  tokenElectronIsoVals_.push_back(consumes<edm::ValueMap<double> >(pfIsoVals.getParameter<edm::InputTag>("pfSumChargedHadronPt")));
23  tokenElectronIsoVals_.push_back(consumes<edm::ValueMap<double> >(pfIsoVals.getParameter<edm::InputTag>("pfSumPhotonEt")));
24  tokenElectronIsoVals_.push_back(consumes<edm::ValueMap<double> >(pfIsoVals.getParameter<edm::InputTag>("pfSumNeutralHadronEt")));
25  tokenElectronIsoVals_.push_back(consumes<edm::ValueMap<double> >(pfIsoVals.getParameter<edm::InputTag>("pfSumPUPt")));
26 // std::vector<std::string> isoNames = pfIsoVals.getParameterNamesForType<edm::InputTag>();
27 // for(const std::string& name : isoNames) {
28 // edm::InputTag tag =
29 // pfIsoVals.getParameter<edm::InputTag>(name);
30 // tokenElectronIsoVals_.push_back(consumes<edm::ValueMap<double> >(tag));
31 // }
32 
33  nDeps_ = tokenElectronIsoVals_.size();
34 
35  produces<reco::GsfElectronCollection> (outputCollectionLabel_);
36 }
37 
39  {}
40 
41 // ------------ method called to produce the data ------------
43  {
44 
45  // Output collection
46  std::auto_ptr<reco::GsfElectronCollection> outputElectrons_p(new reco::GsfElectronCollection);
47 
48  // read input collections
49  // electrons
51  event.getByToken(previousGsfElectrons_,gedElectronHandle);
52 
53  // value maps
54 
55  std::vector< edm::Handle< edm::ValueMap<double> > > isolationValueMaps(nDeps_);
56 
57  for(unsigned i=0; i < nDeps_ ; ++i) {
58  event.getByToken(tokenElectronIsoVals_[i],isolationValueMaps[i]);
59  }
60 
61  // Now loop on the electrons
62  unsigned nele=gedElectronHandle->size();
63  for(unsigned iele=0; iele<nele;++iele) {
64  reco::GsfElectronRef myElectronRef(gedElectronHandle,iele);
65 
66  reco::GsfElectron newElectron(*myElectronRef);
68  isoVariables.sumChargedHadronPt = (*(isolationValueMaps)[0])[myElectronRef];
69  isoVariables.sumPhotonEt = (*(isolationValueMaps)[1])[myElectronRef];
70  isoVariables.sumNeutralHadronEt = (*(isolationValueMaps)[2])[myElectronRef];
71  isoVariables.sumPUPt = (*(isolationValueMaps)[3])[myElectronRef];
72  newElectron.setPfIsolationVariables(isoVariables);
73 
74  outputElectrons_p->push_back(newElectron);
75  }
76 
77  event.put(outputElectrons_p,outputCollectionLabel_);
78  }
79 
80 
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
float sumPUPt
sum pt of charged Particles not from PV (for Pu corrections)
Definition: GsfElectron.h:531
void setPfIsolationVariables(const PflowIsolationVariables &iso)
Definition: GsfElectron.h:575
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
virtual void produce(edm::Event &, const edm::EventSetup &)
float sumPhotonEt
sum pt of PF photons // old float photonIso ;
Definition: GsfElectron.h:526
float sumNeutralHadronEt
sum pt of neutral hadrons // old float neutralHadronIso ;
Definition: GsfElectron.h:525
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
PFIsolationFiller(const edm::ParameterSet &)
float sumChargedHadronPt
sum-pt of charged Hadron // old float chargedHadronIso ;
Definition: GsfElectron.h:524
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")