CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes
pat::PATElectronProducer Class Reference

Produces pat::Electron's. More...

#include "PhysicsTools/PatAlgos/interface/PATElectronProducer.h"

Inheritance diagram for pat::PATElectronProducer:
edm::stream::EDProducer<>

Public Member Functions

 PATElectronProducer (const edm::ParameterSet &iConfig)
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 ~PATElectronProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Types

typedef edm::RefToBase< reco::GsfElectronElectronBaseRef
 
typedef std::vector< edm::Handle< edm::Association< reco::GenParticleCollection > > > GenAssociations
 
typedef std::vector< edm::Handle< edm::ValueMap< IsoDeposit > > > IsoDepositMaps
 
typedef std::pair< pat::IsolationKeys, edm::InputTagIsolationLabel
 
typedef std::vector< IsolationLabelIsolationLabels
 
typedef std::vector< edm::Handle< edm::ValueMap< double > > > IsolationValueMaps
 
typedef std::pair< std::string, edm::InputTagNameTag
 

Private Member Functions

void embedHighLevel (pat::Electron &anElectron, reco::GsfTrackRef track, reco::TransientTrack &tt, reco::Vertex &primaryVertex, bool primaryVertexIsValid, reco::BeamSpot &beamspot, bool beamspotIsValid)
 
void fillElectron (Electron &aElectron, const ElectronBaseRef &electronRef, const reco::CandidateBaseRef &baseRef, const GenAssociations &genMatches, const IsoDepositMaps &deposits, const bool pfId, const IsolationValueMaps &isolationValues, const IsolationValueMaps &isolationValuesNoPFId) const
 common electron filling, for both the standard and PF2PAT case More...
 
void fillElectron2 (Electron &anElectron, const reco::CandidatePtr &candPtrForIsolation, const reco::CandidatePtr &candPtrForGenMatch, const reco::CandidatePtr &candPtrForLoader, const GenAssociations &genMatches, const IsoDepositMaps &deposits, const IsolationValueMaps &isolationValues) const
 
template<typename T >
void readIsolationLabels (const edm::ParameterSet &iConfig, const char *psetName, IsolationLabels &labels, std::vector< edm::EDGetTokenT< edm::ValueMap< T > > > &tokens)
 
void setElectronMiniIso (pat::Electron &anElectron, const pat::PackedCandidateCollection *pc)
 

Private Attributes

const bool addEfficiencies_
 
const bool addElecID_
 
bool addGenMatch_
 
const bool addMVAVariables_
 mva input variables More...
 
const bool addPFClusterIso_
 
const bool addPuppiIsolation_
 
const bool addResolutions_
 
const edm::EDGetTokenT< reco::BeamSpotbeamLineToken_
 
bool computeMiniIso_
 
const edm::EDGetTokenT< edm::ValueMap< float > > ecalPFClusterIsoT_
 
const CaloTopologyecalTopology_
 
pat::helper::EfficiencyLoader efficiencyLoader_
 
std::vector< NameTagelecIDSrcs_
 
std::vector< edm::EDGetTokenT< edm::ValueMap< float > > > elecIDTokens_
 
const edm::EDGetTokenT< edm::View< reco::GsfElectron > > electronToken_
 
const bool embedBasicClusters_
 
bool embedGenMatch_
 
const bool embedGsfElectronCore_
 
const bool embedGsfTrack_
 
const bool embedHighLevelSelection_
 embed high level selection variables? More...
 
const bool embedPFCandidate_
 
const bool embedPflowBasicClusters_
 
const bool embedPflowPreshowerClusters_
 
const bool embedPflowSuperCluster_
 
const bool embedPreshowerClusters_
 
const bool embedRecHits_
 
const bool embedSeedCluster_
 
const bool embedSuperCluster_
 
const bool embedTrack_
 
std::vector< edm::EDGetTokenT< edm::Association< reco::GenParticleCollection > > > genMatchTokens_
 
bool getdBFromTrack_
 
const edm::EDGetTokenT< edm::ValueMap< float > > hcalPFClusterIsoT_
 
const edm::EDGetTokenT< reco::ConversionCollectionhConversionsToken_
 
IsolationLabels isoDepositLabels_
 
std::vector< edm::EDGetTokenT< edm::ValueMap< IsoDeposit > > > isoDepositTokens_
 
IsolationLabels isolationValueLabels_
 
IsolationLabels isolationValueLabelsNoPFId_
 
std::vector< edm::EDGetTokenT< edm::ValueMap< double > > > isolationValueNoPFIdTokens_
 
std::vector< edm::EDGetTokenT< edm::ValueMap< double > > > isolationValueTokens_
 
pat::helper::MultiIsolator isolator_
 
pat::helper::MultiIsolator::IsolationValuePairs isolatorTmpStorage_
 
std::vector< double > miniIsoParamsB_
 
std::vector< double > miniIsoParamsE_
 
edm::EDGetTokenT< pat::PackedCandidateCollectionpcToken_
 
const edm::EDGetTokenT< edm::ValueMap< reco::PFCandidatePtr > > pfCandidateMapToken_
 
const edm::EDGetTokenT< edm::ValueMap< std::vector< reco::PFCandidateRef > > > pfCandidateMultiMapToken_
 
const edm::EDGetTokenT< reco::PFCandidateCollectionpfElecToken_
 
const GreaterByPt< ElectronpTComparator_
 
edm::EDGetTokenT< edm::ValueMap< float > > PUPPIIsolation_charged_hadrons_
 
edm::EDGetTokenT< edm::ValueMap< float > > PUPPIIsolation_neutral_hadrons_
 
edm::EDGetTokenT< edm::ValueMap< float > > PUPPIIsolation_photons_
 
edm::EDGetTokenT< edm::ValueMap< float > > PUPPINoLeptonsIsolation_charged_hadrons_
 
edm::EDGetTokenT< edm::ValueMap< float > > PUPPINoLeptonsIsolation_neutral_hadrons_
 
edm::EDGetTokenT< edm::ValueMap< float > > PUPPINoLeptonsIsolation_photons_
 
const edm::EDGetTokenT< std::vector< reco::Vertex > > pvToken_
 
const edm::InputTag reducedBarrelRecHitCollection_
 
const edm::EDGetTokenT< EcalRecHitCollectionreducedBarrelRecHitCollectionToken_
 
const edm::InputTag reducedEndcapRecHitCollection_
 
const edm::EDGetTokenT< EcalRecHitCollectionreducedEndcapRecHitCollectionToken_
 
pat::helper::KinResolutionsLoader resolutionLoader_
 
const bool useParticleFlow_
 pflow specific More...
 
const bool usePfCandidateMultiMap_
 
pat::PATUserDataHelper< pat::ElectronuserDataHelper_
 
const bool useUserData_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Produces pat::Electron's.

The PATElectronProducer produces analysis-level pat::Electron's starting from a collection of objects of reco::GsfElectron.

Author
Steven Lowette, James Lamb\
Version
Id
PATElectronProducer.h,v 1.31 2013/02/27 23:26:56 wmtan Exp

Definition at line 54 of file PATElectronProducer.h.

Member Typedef Documentation

Definition at line 119 of file PATElectronProducer.h.

Definition at line 89 of file PATElectronProducer.h.

Definition at line 120 of file PATElectronProducer.h.

Definition at line 155 of file PATElectronProducer.h.

Definition at line 156 of file PATElectronProducer.h.

typedef std::vector< edm::Handle< edm::ValueMap<double> > > pat::PATElectronProducer::IsolationValueMaps
private

Definition at line 121 of file PATElectronProducer.h.

typedef std::pair<std::string, edm::InputTag> pat::PATElectronProducer::NameTag
private

Definition at line 166 of file PATElectronProducer.h.

Constructor & Destructor Documentation

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

Definition at line 55 of file PATElectronProducer.cc.

References addEfficiencies_, addElecID_, addGenMatch_, addPuppiIsolation_, addResolutions_, computeMiniIso_, efficiencyLoader_, elecIDSrcs_, elecIDTokens_, Exception, edm::ParameterSet::existsAs(), genMatchTokens_, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNamesForType(), isoDepositLabels_, isoDepositTokens_, isolationValueLabels_, isolationValueLabelsNoPFId_, isolationValueNoPFIdTokens_, isolationValueTokens_, miniIsoParamsB_, miniIsoParamsE_, names, pcToken_, PUPPIIsolation_charged_hadrons_, PUPPIIsolation_neutral_hadrons_, PUPPIIsolation_photons_, PUPPINoLeptonsIsolation_charged_hadrons_, PUPPINoLeptonsIsolation_neutral_hadrons_, PUPPINoLeptonsIsolation_photons_, readIsolationLabels(), resolutionLoader_, GlobalPosition_Frontier_DevDB_cff::tag, useParticleFlow_, usePfCandidateMultiMap_, userDataHelper_, useUserData_, and edm::vector_transform().

55  :
56  // general configurables
57  electronToken_(consumes<edm::View<reco::GsfElectron> >(iConfig.getParameter<edm::InputTag>( "electronSource" ))),
58  hConversionsToken_(consumes<reco::ConversionCollection>(edm::InputTag("allConversions"))),
59  embedGsfElectronCore_(iConfig.getParameter<bool>( "embedGsfElectronCore" )),
60  embedGsfTrack_(iConfig.getParameter<bool>( "embedGsfTrack" )),
61  embedSuperCluster_(iConfig.getParameter<bool> ( "embedSuperCluster" )),
62  embedPflowSuperCluster_(iConfig.getParameter<bool> ( "embedPflowSuperCluster" )),
63  embedSeedCluster_(iConfig.getParameter<bool>( "embedSeedCluster" )),
64  embedBasicClusters_(iConfig.getParameter<bool>( "embedBasicClusters" )),
65  embedPreshowerClusters_(iConfig.getParameter<bool>( "embedPreshowerClusters" )),
66  embedPflowBasicClusters_(iConfig.getParameter<bool>( "embedPflowBasicClusters" )),
67  embedPflowPreshowerClusters_(iConfig.getParameter<bool>( "embedPflowPreshowerClusters" )),
68  embedTrack_(iConfig.getParameter<bool>( "embedTrack" )),
69  addGenMatch_(iConfig.getParameter<bool>( "addGenMatch" )),
70  embedGenMatch_(addGenMatch_ ? iConfig.getParameter<bool>( "embedGenMatch" ) : false),
71  embedRecHits_(iConfig.getParameter<bool>( "embedRecHits" )),
72  // pflow configurables
73  useParticleFlow_(iConfig.getParameter<bool>( "useParticleFlow" )),
74  usePfCandidateMultiMap_(iConfig.getParameter<bool>( "usePfCandidateMultiMap" )),
75  pfElecToken_(!usePfCandidateMultiMap_ ? consumes<reco::PFCandidateCollection>(iConfig.getParameter<edm::InputTag>( "pfElectronSource" )) : edm::EDGetTokenT<reco::PFCandidateCollection>()),
77  pfCandidateMultiMapToken_(usePfCandidateMultiMap_ ? consumes<edm::ValueMap<std::vector<reco::PFCandidateRef>>>(iConfig.getParameter<edm::InputTag>( "pfCandidateMultiMap" )) : edm::EDGetTokenT<edm::ValueMap<std::vector<reco::PFCandidateRef>>>()),
78  embedPFCandidate_(iConfig.getParameter<bool>( "embedPFCandidate" )),
79  // mva input variables
80  addMVAVariables_(iConfig.getParameter<bool>("addMVAVariables")),
81  reducedBarrelRecHitCollection_(iConfig.getParameter<edm::InputTag>("reducedBarrelRecHitCollection")),
83  reducedEndcapRecHitCollection_(iConfig.getParameter<edm::InputTag>("reducedEndcapRecHitCollection")),
85  // PFCluster Isolation maps
86  addPFClusterIso_(iConfig.getParameter<bool>("addPFClusterIso")),
87  addPuppiIsolation_(iConfig.getParameter<bool>("addPuppiIsolation")),
88  ecalPFClusterIsoT_(consumes<edm::ValueMap<float> >(iConfig.getParameter<edm::InputTag>("ecalPFClusterIsoMap"))),
89  hcalPFClusterIsoT_(consumes<edm::ValueMap<float> >(iConfig.getParameter<edm::InputTag>("hcalPFClusterIsoMap"))),
90  // embed high level selection variables?
91  embedHighLevelSelection_(iConfig.getParameter<bool>("embedHighLevelSelection")),
92  beamLineToken_(consumes<reco::BeamSpot>(iConfig.getParameter<edm::InputTag>("beamLineSrc"))),
93  pvToken_(mayConsume<std::vector<reco::Vertex> >(iConfig.getParameter<edm::InputTag>("pvSrc"))),
94  getdBFromTrack_(iConfig.getParameter<bool>("getdBFromTrack")),
95  addElecID_(iConfig.getParameter<bool>( "addElectronID" )),
96  pTComparator_(),
97  isolator_(iConfig.exists("userIsolation") ? iConfig.getParameter<edm::ParameterSet>("userIsolation") : edm::ParameterSet(), consumesCollector(), false) ,
98  addEfficiencies_(iConfig.getParameter<bool>("addEfficiencies")),
99  addResolutions_(iConfig.getParameter<bool>( "addResolutions" )),
100  useUserData_(iConfig.exists("userData"))
101 
102 {
103  // MC matching configurables (scheduled mode)
104 
105  if (addGenMatch_) {
106  if (iConfig.existsAs<edm::InputTag>("genParticleMatch")) {
107  genMatchTokens_.push_back(consumes<edm::Association<reco::GenParticleCollection> >(iConfig.getParameter<edm::InputTag>( "genParticleMatch" )));
108  }
109  else {
110  genMatchTokens_ = edm::vector_transform(iConfig.getParameter<std::vector<edm::InputTag> >( "genParticleMatch" ), [this](edm::InputTag const & tag){return consumes<edm::Association<reco::GenParticleCollection> >(tag);});
111  }
112  }
113  // resolution configurables
114  if (addResolutions_) {
116  }
117  if(addPuppiIsolation_){
118  //puppi
119  PUPPIIsolation_charged_hadrons_ = consumes<edm::ValueMap<float> >(iConfig.getParameter<edm::InputTag>("puppiIsolationChargedHadrons"));
120  PUPPIIsolation_neutral_hadrons_ = consumes<edm::ValueMap<float> >(iConfig.getParameter<edm::InputTag>("puppiIsolationNeutralHadrons"));
121  PUPPIIsolation_photons_ = consumes<edm::ValueMap<float> >(iConfig.getParameter<edm::InputTag>("puppiIsolationPhotons"));
122  //puppiNoLeptons
123  PUPPINoLeptonsIsolation_charged_hadrons_ = consumes<edm::ValueMap<float> >(iConfig.getParameter<edm::InputTag>("puppiNoLeptonsIsolationChargedHadrons"));
124  PUPPINoLeptonsIsolation_neutral_hadrons_ = consumes<edm::ValueMap<float> >(iConfig.getParameter<edm::InputTag>("puppiNoLeptonsIsolationNeutralHadrons"));
125  PUPPINoLeptonsIsolation_photons_ = consumes<edm::ValueMap<float> >(iConfig.getParameter<edm::InputTag>("puppiNoLeptonsIsolationPhotons"));
126  }
127  // electron ID configurables
128  if (addElecID_) {
129  // it might be a single electron ID
130  if (iConfig.existsAs<edm::InputTag>("electronIDSource")) {
131  elecIDSrcs_.push_back(NameTag("", iConfig.getParameter<edm::InputTag>("electronIDSource")));
132  }
133  // or there might be many of them
134  if (iConfig.existsAs<edm::ParameterSet>("electronIDSources")) {
135  // please don't configure me twice
136  if (!elecIDSrcs_.empty()){
137  throw cms::Exception("Configuration") << "PATElectronProducer: you can't specify both 'electronIDSource' and 'electronIDSources'\n";
138  }
139  // read the different electron ID names
140  edm::ParameterSet idps = iConfig.getParameter<edm::ParameterSet>("electronIDSources");
141  std::vector<std::string> names = idps.getParameterNamesForType<edm::InputTag>();
142  for (std::vector<std::string>::const_iterator it = names.begin(), ed = names.end(); it != ed; ++it) {
143  elecIDSrcs_.push_back(NameTag(*it, idps.getParameter<edm::InputTag>(*it)));
144  }
145  }
146  // but in any case at least once
147  if (elecIDSrcs_.empty()){
148  throw cms::Exception("Configuration") <<
149  "PATElectronProducer: id addElectronID is true, you must specify either:\n" <<
150  "\tInputTag electronIDSource = <someTag>\n" << "or\n" <<
151  "\tPSet electronIDSources = { \n" <<
152  "\t\tInputTag <someName> = <someTag> // as many as you want \n " <<
153  "\t}\n";
154  }
155  }
156  elecIDTokens_ = edm::vector_transform(elecIDSrcs_, [this](NameTag const & tag){return mayConsume<edm::ValueMap<float> >(tag.second);});
157  // construct resolution calculator
158 
159  // // IsoDeposit configurables
160  // if (iConfig.exists("isoDeposits")) {
161  // edm::ParameterSet depconf = iConfig.getParameter<edm::ParameterSet>("isoDeposits");
162  // if (depconf.exists("tracker")) isoDepositLabels_.push_back(std::make_pair(TrackerIso, depconf.getParameter<edm::InputTag>("tracker")));
163  // if (depconf.exists("ecal")) isoDepositLabels_.push_back(std::make_pair(ECalIso, depconf.getParameter<edm::InputTag>("ecal")));
164  // if (depconf.exists("hcal")) isoDepositLabels_.push_back(std::make_pair(HCalIso, depconf.getParameter<edm::InputTag>("hcal")));
165 
166 
167  // if (depconf.exists("user")) {
168  // std::vector<edm::InputTag> userdeps = depconf.getParameter<std::vector<edm::InputTag> >("user");
169  // std::vector<edm::InputTag>::const_iterator it = userdeps.begin(), ed = userdeps.end();
170  // int key = UserBaseIso;
171  // for ( ; it != ed; ++it, ++key) {
172  // isoDepositLabels_.push_back(std::make_pair(IsolationKeys(key), *it));
173  // }
174  // }
175  // }
176  // isoDepositTokens_ = edm::vector_transform(isoDepositLabels_, [this](std::pair<IsolationKeys,edm::InputTag> const & label){return consumes<edm::ValueMap<IsoDeposit> >(label.second);});
177 
178  // for mini-iso
179  computeMiniIso_ = iConfig.getParameter<bool>("computeMiniIso");
180  miniIsoParamsE_ = iConfig.getParameter<std::vector<double> >("miniIsoParamsE");
181  miniIsoParamsB_ = iConfig.getParameter<std::vector<double> >("miniIsoParamsB");
182  if(computeMiniIso_ && (miniIsoParamsE_.size() != 9 || miniIsoParamsB_.size() != 9)){
183  throw cms::Exception("ParameterError") << "miniIsoParams must have exactly 9 elements.\n";
184  }
185  if(computeMiniIso_)
186  pcToken_ = consumes<pat::PackedCandidateCollection>(iConfig.getParameter<edm::InputTag>("pfCandsForMiniIso"));
187 
188  // read isoDeposit labels, for direct embedding
189  readIsolationLabels(iConfig, "isoDeposits", isoDepositLabels_, isoDepositTokens_);
190  // read isolation value labels, for direct embedding
192  // read isolation value labels for non PF identified electron, for direct embedding
194  // Efficiency configurables
195  if (addEfficiencies_) {
196  efficiencyLoader_ = pat::helper::EfficiencyLoader(iConfig.getParameter<edm::ParameterSet>("efficiencies"), consumesCollector());
197  }
198  // Check to see if the user wants to add user data
199  if ( useUserData_ ) {
200  userDataHelper_ = PATUserDataHelper<Electron>(iConfig.getParameter<edm::ParameterSet>("userData"), consumesCollector());
201  }
202 
203  // consistency check
204  if (useParticleFlow_ && usePfCandidateMultiMap_) throw cms::Exception("Configuration", "usePfCandidateMultiMap not supported when useParticleFlow is set to true");
205 
206  // produces vector of muons
207  produces<std::vector<Electron> >();
208  }
void readIsolationLabels(const edm::ParameterSet &iConfig, const char *psetName, IsolationLabels &labels, std::vector< edm::EDGetTokenT< edm::ValueMap< T > > > &tokens)
T getParameter(std::string const &) const
Assists in assimilating all pat::UserData into pat objects.
const edm::EDGetTokenT< reco::ConversionCollection > hConversionsToken_
edm::EDGetTokenT< edm::ValueMap< float > > PUPPINoLeptonsIsolation_charged_hadrons_
const GreaterByPt< Electron > pTComparator_
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:161
edm::EDGetTokenT< edm::ValueMap< float > > PUPPIIsolation_charged_hadrons_
const bool useParticleFlow_
pflow specific
const edm::EDGetTokenT< reco::PFCandidateCollection > pfElecToken_
std::vector< double > miniIsoParamsE_
edm::EDGetTokenT< edm::ValueMap< float > > PUPPIIsolation_neutral_hadrons_
const edm::EDGetTokenT< edm::ValueMap< float > > ecalPFClusterIsoT_
bool exists(std::string const &parameterName) const
checks if a parameter exists
const edm::InputTag reducedBarrelRecHitCollection_
const edm::EDGetTokenT< edm::ValueMap< float > > hcalPFClusterIsoT_
std::vector< edm::EDGetTokenT< edm::ValueMap< float > > > elecIDTokens_
const std::string names[nVars_]
const edm::EDGetTokenT< edm::View< reco::GsfElectron > > electronToken_
const bool addMVAVariables_
mva input variables
std::vector< double > miniIsoParamsB_
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
Definition: ParameterSet.h:169
const edm::EDGetTokenT< std::vector< reco::Vertex > > pvToken_
const edm::EDGetTokenT< edm::ValueMap< reco::PFCandidatePtr > > pfCandidateMapToken_
pat::helper::MultiIsolator isolator_
edm::EDGetTokenT< edm::ValueMap< float > > PUPPIIsolation_photons_
const bool embedHighLevelSelection_
embed high level selection variables?
std::vector< edm::EDGetTokenT< edm::Association< reco::GenParticleCollection > > > genMatchTokens_
std::vector< edm::EDGetTokenT< edm::ValueMap< IsoDeposit > > > isoDepositTokens_
edm::EDGetTokenT< edm::ValueMap< float > > PUPPINoLeptonsIsolation_neutral_hadrons_
const edm::EDGetTokenT< EcalRecHitCollection > reducedEndcapRecHitCollectionToken_
const edm::InputTag reducedEndcapRecHitCollection_
std::pair< std::string, edm::InputTag > NameTag
edm::EDGetTokenT< edm::ValueMap< float > > PUPPINoLeptonsIsolation_photons_
const edm::EDGetTokenT< reco::BeamSpot > beamLineToken_
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
Definition: transform.h:11
std::vector< edm::EDGetTokenT< edm::ValueMap< double > > > isolationValueNoPFIdTokens_
pat::helper::EfficiencyLoader efficiencyLoader_
const edm::EDGetTokenT< EcalRecHitCollection > reducedBarrelRecHitCollectionToken_
const edm::EDGetTokenT< edm::ValueMap< std::vector< reco::PFCandidateRef > > > pfCandidateMultiMapToken_
pat::PATUserDataHelper< pat::Electron > userDataHelper_
IsolationLabels isolationValueLabelsNoPFId_
IsolationLabels isolationValueLabels_
pat::helper::KinResolutionsLoader resolutionLoader_
std::vector< edm::EDGetTokenT< edm::ValueMap< double > > > isolationValueTokens_
edm::EDGetTokenT< pat::PackedCandidateCollection > pcToken_
std::vector< NameTag > elecIDSrcs_
PATElectronProducer::~PATElectronProducer ( )
override

Definition at line 211 of file PATElectronProducer.cc.

212 {
213 }

Member Function Documentation

void PATElectronProducer::embedHighLevel ( pat::Electron anElectron,
reco::GsfTrackRef  track,
reco::TransientTrack tt,
reco::Vertex primaryVertex,
bool  primaryVertexIsValid,
reco::BeamSpot beamspot,
bool  beamspotIsValid 
)
private

Definition at line 1144 of file PATElectronProducer.cc.

References pat::Electron::BS2D, pat::Electron::BS3D, reco::Vertex::covariance(), reco::BeamSpot::covariance3D(), DEFINE_FWK_MODULE, getdBFromTrack_, reco::BeamSpot::position(), reco::Vertex::position(), pat::Electron::PV2D, pat::Electron::PV3D, pat::Electron::PVDZ, mps_fire::result, pat::Electron::setDB(), IPTools::signedImpactParameter3D(), IPTools::signedTransverseImpactParameter(), and reco::Vertex::zError().

Referenced by produce().

1152 {
1153  // Correct to PV
1154  std::pair<bool,Measurement1D> result;
1155  double d0_corr, d0_err;
1156 
1157  // PV2D
1158  if (getdBFromTrack_)
1159  anElectron.setDB(track->dxy(primaryVertex.position()),
1160  track->dxyError(primaryVertex.position(), primaryVertex.covariance()),
1162  else {
1163  result = IPTools::signedTransverseImpactParameter(tt, GlobalVector(track->px(), track->py(), track->pz()), primaryVertex);
1164  d0_corr = result.second.value();
1165  d0_err = primaryVertexIsValid ? result.second.error() : -1.0;
1166  anElectron.setDB(d0_corr, d0_err, pat::Electron::PV2D);
1167  }
1168 
1169  // PV3D
1170  result = IPTools::signedImpactParameter3D(tt, GlobalVector(track->px(), track->py(), track->pz()), primaryVertex);
1171  d0_corr = result.second.value();
1172  d0_err = primaryVertexIsValid ? result.second.error() : -1.0;
1173  anElectron.setDB(d0_corr, d0_err, pat::Electron::PV3D);
1174 
1175  // Correct to beam spot
1176  // make a fake vertex out of beam spot
1177  reco::Vertex vBeamspot(beamspot.position(), beamspot.covariance3D());
1178 
1179  // BS2D
1180  if (getdBFromTrack_)
1181  anElectron.setDB(track->dxy(beamspot), track->dxyError(beamspot), pat::Electron::BS2D);
1182  else {
1183  result = IPTools::signedTransverseImpactParameter(tt, GlobalVector(track->px(), track->py(), track->pz()), vBeamspot);
1184  d0_corr = result.second.value();
1185  d0_err = beamspotIsValid ? result.second.error() : -1.0;
1186  anElectron.setDB(d0_corr, d0_err, pat::Electron::BS2D);
1187  }
1188 
1189  // BS3D
1190  result = IPTools::signedImpactParameter3D(tt, GlobalVector(track->px(), track->py(), track->pz()), vBeamspot);
1191  d0_corr = result.second.value();
1192  d0_err = beamspotIsValid ? result.second.error() : -1.0;
1193  anElectron.setDB(d0_corr, d0_err, pat::Electron::BS3D);
1194 
1195  // PVDZ
1196  anElectron.setDB(track->dz(primaryVertex.position()), std::hypot(track->dzError(), primaryVertex.zError()), pat::Electron::PVDZ);
1197 }
Covariance3DMatrix covariance3D() const
return only 3D position covariance matrix
Definition: BeamSpot.h:118
double zError() const
error on z
Definition: Vertex.h:123
std::pair< bool, Measurement1D > signedTransverseImpactParameter(const reco::TransientTrack &track, const GlobalVector &direction, const reco::Vertex &vertex)
Definition: IPTools.cc:50
std::pair< bool, Measurement1D > signedImpactParameter3D(const reco::TransientTrack &track, const GlobalVector &direction, const reco::Vertex &vertex)
Definition: IPTools.cc:71
double covariance(int i, int j) const
(i, j)-th element of error matrix, i, j = 0, ... 2
Definition: Vertex.h:130
const Point & position() const
position
Definition: Vertex.h:109
void setDB(double dB, double edB, IPTYPE type)
Set impact parameter of a certain type and its uncertainty.
const Point & position() const
position
Definition: BeamSpot.h:62
Global3DVector GlobalVector
Definition: GlobalVector.h:10
void PATElectronProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 991 of file PATElectronProducer.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), edm::ParameterSetDescription::addNode(), edm::ParameterSetDescription::addOptional(), pat::helper::KinResolutionsLoader::fillDescription(), pat::PATUserDataHelper< ObjectType >::fillDescription(), edm::ParameterSetDescription::ifValue(), or, edm::ParameterSetDescription::setAllowAnything(), edm::ParameterSetDescription::setComment(), edm::ParameterDescriptionNode::setComment(), and electronProducer_cfi::usePfCandidateMultiMap.

992 {
994  iDesc.setComment("PAT electron producer module");
995 
996  // input source
997  iDesc.add<edm::InputTag>("pfCandidateMap", edm::InputTag("no default"))->setComment("input collection");
998  iDesc.add<edm::InputTag>("electronSource", edm::InputTag("no default"))->setComment("input collection");
999 
1000  iDesc.ifValue(edm::ParameterDescription<bool>("addPFClusterIso", false, true),
1001  true >> (edm::ParameterDescription<edm::InputTag>("ecalPFClusterIsoMap", edm::InputTag("electronEcalPFClusterIsolationProducer"), true) and
1002  edm::ParameterDescription<edm::InputTag>("hcalPFClusterIsoMap", edm::InputTag("electronHcalPFClusterIsolationProducer"),true)) or
1003  false >> (edm::ParameterDescription<edm::InputTag>("ecalPFClusterIsoMap", edm::InputTag(""), true) and
1004  edm::ParameterDescription<edm::InputTag>("hcalPFClusterIsoMap", edm::InputTag(""),true)));
1005 
1006  iDesc.ifValue(edm::ParameterDescription<bool>("addPuppiIsolation", false, true),
1007  true >> (edm::ParameterDescription<edm::InputTag>("puppiIsolationChargedHadrons", edm::InputTag("egmElectronPUPPIIsolation","h+-DR030-BarVeto000-EndVeto001"), true) and
1008  edm::ParameterDescription<edm::InputTag>("puppiIsolationNeutralHadrons", edm::InputTag("egmElectronPUPPIIsolation","h0-DR030-BarVeto000-EndVeto000"), true) and
1009  edm::ParameterDescription<edm::InputTag>("puppiIsolationPhotons", edm::InputTag("egmElectronPUPPIIsolation","gamma-DR030-BarVeto000-EndVeto008"), true) and
1010  edm::ParameterDescription<edm::InputTag>("puppiNoLeptonsIsolationChargedHadrons", edm::InputTag("egmElectronPUPPINoLeptonsIsolation","gamma-DR030-BarVeto000-EndVeto008"), true) and
1011  edm::ParameterDescription<edm::InputTag>("puppiNoLeptonsIsolationNeutralHadrons", edm::InputTag("egmElectronPUPPINoLeptonsIsolation","gamma-DR030-BarVeto000-EndVeto008"), true) and
1012  edm::ParameterDescription<edm::InputTag>("puppiNoLeptonsIsolationPhotons", edm::InputTag("egmElectronPUPPINoLeptonsIsolation","gamma-DR030-BarVeto000-EndVeto008"), true)) or
1013  false >> edm::EmptyGroupDescription());
1014 
1015 
1016  // embedding
1017  iDesc.add<bool>("embedGsfElectronCore", true)->setComment("embed external gsf electron core");
1018  iDesc.add<bool>("embedGsfTrack", true)->setComment("embed external gsf track");
1019  iDesc.add<bool>("embedSuperCluster", true)->setComment("embed external super cluster");
1020  iDesc.add<bool>("embedPflowSuperCluster", true)->setComment("embed external super cluster");
1021  iDesc.add<bool>("embedSeedCluster", true)->setComment("embed external seed cluster");
1022  iDesc.add<bool>("embedBasicClusters", true)->setComment("embed external basic clusters");
1023  iDesc.add<bool>("embedPreshowerClusters", true)->setComment("embed external preshower clusters");
1024  iDesc.add<bool>("embedPflowBasicClusters", true)->setComment("embed external pflow basic clusters");
1025  iDesc.add<bool>("embedPflowPreshowerClusters", true)->setComment("embed external pflow preshower clusters");
1026  iDesc.add<bool>("embedTrack", false)->setComment("embed external track");
1027  iDesc.add<bool>("embedRecHits", true)->setComment("embed external RecHits");
1028 
1029  // pf specific parameters
1030  iDesc.add<edm::InputTag>("pfElectronSource", edm::InputTag("pfElectrons"))->setComment("particle flow input collection");
1031  auto && usePfCandidateMultiMap = edm::ParameterDescription<bool>("usePfCandidateMultiMap", false, true);
1032  usePfCandidateMultiMap.setComment("take ParticleFlow candidates from pfCandidateMultiMap instead of matching to pfElectrons by Gsf track reference");
1034  true >> edm::ParameterDescription<edm::InputTag>("pfCandidateMultiMap", true) or
1035  false >> edm::EmptyGroupDescription());
1036  iDesc.add<bool>("useParticleFlow", false)->setComment("whether to use particle flow or not");
1037  iDesc.add<bool>("embedPFCandidate", false)->setComment("embed external particle flow object");
1038 
1039  // MC matching configurables
1040  iDesc.add<bool>("addGenMatch", true)->setComment("add MC matching");
1041  iDesc.add<bool>("embedGenMatch", false)->setComment("embed MC matched MC information");
1042  std::vector<edm::InputTag> emptySourceVector;
1043  iDesc.addNode( edm::ParameterDescription<edm::InputTag>("genParticleMatch", edm::InputTag(), true) xor
1044  edm::ParameterDescription<std::vector<edm::InputTag> >("genParticleMatch", emptySourceVector, true)
1045  )->setComment("input with MC match information");
1046 
1047  // electron ID configurables
1048  iDesc.add<bool>("addElectronID",true)->setComment("add electron ID variables");
1049  edm::ParameterSetDescription electronIDSourcesPSet;
1050  electronIDSourcesPSet.setAllowAnything();
1051  iDesc.addNode( edm::ParameterDescription<edm::InputTag>("electronIDSource", edm::InputTag(), true) xor
1052  edm::ParameterDescription<edm::ParameterSetDescription>("electronIDSources", electronIDSourcesPSet, true)
1053  )->setComment("input with electron ID variables");
1054 
1055 
1056  // mini-iso
1057  iDesc.add<bool>("computeMiniIso", false)->setComment("whether or not to compute and store electron mini-isolation");
1058  iDesc.add<edm::InputTag>("pfCandsForMiniIso", edm::InputTag("packedPFCandidates"))->setComment("collection to use to compute mini-iso");
1059  iDesc.add<std::vector<double> >("miniIsoParamsE", std::vector<double>())->setComment("mini-iso parameters to use for endcap electrons");
1060  iDesc.add<std::vector<double> >("miniIsoParamsB", std::vector<double>())->setComment("mini-iso parameters to use for barrel electrons");
1061 
1062  // IsoDeposit configurables
1063  edm::ParameterSetDescription isoDepositsPSet;
1064  isoDepositsPSet.addOptional<edm::InputTag>("tracker");
1065  isoDepositsPSet.addOptional<edm::InputTag>("ecal");
1066  isoDepositsPSet.addOptional<edm::InputTag>("hcal");
1067  isoDepositsPSet.addOptional<edm::InputTag>("pfAllParticles");
1068  isoDepositsPSet.addOptional<edm::InputTag>("pfChargedHadrons");
1069  isoDepositsPSet.addOptional<edm::InputTag>("pfChargedAll");
1070  isoDepositsPSet.addOptional<edm::InputTag>("pfPUChargedHadrons");
1071  isoDepositsPSet.addOptional<edm::InputTag>("pfNeutralHadrons");
1072  isoDepositsPSet.addOptional<edm::InputTag>("pfPhotons");
1073  isoDepositsPSet.addOptional<std::vector<edm::InputTag> >("user");
1074  iDesc.addOptional("isoDeposits", isoDepositsPSet);
1075 
1076  // isolation values configurables
1077  edm::ParameterSetDescription isolationValuesPSet;
1078  isolationValuesPSet.addOptional<edm::InputTag>("tracker");
1079  isolationValuesPSet.addOptional<edm::InputTag>("ecal");
1080  isolationValuesPSet.addOptional<edm::InputTag>("hcal");
1081  isolationValuesPSet.addOptional<edm::InputTag>("pfAllParticles");
1082  isolationValuesPSet.addOptional<edm::InputTag>("pfChargedHadrons");
1083  isolationValuesPSet.addOptional<edm::InputTag>("pfChargedAll");
1084  isolationValuesPSet.addOptional<edm::InputTag>("pfPUChargedHadrons");
1085  isolationValuesPSet.addOptional<edm::InputTag>("pfNeutralHadrons");
1086  isolationValuesPSet.addOptional<edm::InputTag>("pfPhotons");
1087  isolationValuesPSet.addOptional<std::vector<edm::InputTag> >("user");
1088  iDesc.addOptional("isolationValues", isolationValuesPSet);
1089 
1090  // isolation values configurables
1091  edm::ParameterSetDescription isolationValuesNoPFIdPSet;
1092  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("tracker");
1093  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("ecal");
1094  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("hcal");
1095  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("pfAllParticles");
1096  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("pfChargedHadrons");
1097  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("pfChargedAll");
1098  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("pfPUChargedHadrons");
1099  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("pfNeutralHadrons");
1100  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("pfPhotons");
1101  isolationValuesNoPFIdPSet.addOptional<std::vector<edm::InputTag> >("user");
1102  iDesc.addOptional("isolationValuesNoPFId", isolationValuesNoPFIdPSet);
1103 
1104  // Efficiency configurables
1105  edm::ParameterSetDescription efficienciesPSet;
1106  efficienciesPSet.setAllowAnything(); // TODO: the pat helper needs to implement a description.
1107  iDesc.add("efficiencies", efficienciesPSet);
1108  iDesc.add<bool>("addEfficiencies", false);
1109 
1110  // Check to see if the user wants to add user data
1111  edm::ParameterSetDescription userDataPSet;
1113  iDesc.addOptional("userData", userDataPSet);
1114 
1115 
1116  // electron shapes
1117  iDesc.add<bool>("addMVAVariables", true)->setComment("embed extra variables in pat::Electron : sip3d, sigmaIEtaIPhi");
1118  iDesc.add<edm::InputTag>("reducedBarrelRecHitCollection", edm::InputTag("reducedEcalRecHitsEB"));
1119  iDesc.add<edm::InputTag>("reducedEndcapRecHitCollection", edm::InputTag("reducedEcalRecHitsEE"));
1120 
1121  edm::ParameterSetDescription isolationPSet;
1122  isolationPSet.setAllowAnything(); // TODO: the pat helper needs to implement a description.
1123  iDesc.add("userIsolation", isolationPSet);
1124 
1125  // Resolution configurables
1127 
1128  iDesc.add<bool>("embedHighLevelSelection", true)->setComment("embed high level selection");
1129  edm::ParameterSetDescription highLevelPSet;
1130  highLevelPSet.setAllowAnything();
1131  iDesc.addNode( edm::ParameterDescription<edm::InputTag>("beamLineSrc", edm::InputTag(), true)
1132  )->setComment("input with high level selection");
1134  )->setComment("input with high level selection");
1135  iDesc.add<bool>("getdBFromTrack", false)->setComment("switch IP2D computation to use the GSF track instead of IPTools");
1136 
1137  descriptions.add("PATElectronProducer", iDesc);
1138 
1139 }
void setComment(std::string const &value)
ParameterDescriptionNode * ifValue(ParameterDescription< T > const &switchParameter, std::unique_ptr< ParameterDescriptionCases< T >> cases)
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
void setAllowAnything()
allow any parameter label/value pairs
ParameterDescriptionNode * addNode(ParameterDescriptionNode const &node)
static void fillDescription(edm::ParameterSetDescription &iDesc)
void setComment(std::string const &value)
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
ParameterDescriptionBase * add(U const &iLabel, T const &value)
static void fillDescription(edm::ParameterSetDescription &iDesc)
Method for documentation and validation of PSet.
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void PATElectronProducer::fillElectron ( Electron aElectron,
const ElectronBaseRef electronRef,
const reco::CandidateBaseRef baseRef,
const GenAssociations genMatches,
const IsoDepositMaps deposits,
const bool  pfId,
const IsolationValueMaps isolationValues,
const IsolationValueMaps isolationValuesNoPFId 
) const
private

common electron filling, for both the standard and PF2PAT case

Definition at line 794 of file PATElectronProducer.cc.

References addGenMatch_, pat::PATObject< ObjectType >::addGenParticleRef(), efficiencyLoader_, pat::Electron::embedBasicClusters(), embedBasicClusters_, embedGenMatch_, pat::PATObject< ObjectType >::embedGenParticle(), pat::Electron::embedGsfElectronCore(), embedGsfElectronCore_, pat::Electron::embedGsfTrack(), embedGsfTrack_, pat::Electron::embedPflowBasicClusters(), embedPflowBasicClusters_, pat::Electron::embedPflowPreshowerClusters(), embedPflowPreshowerClusters_, pat::Electron::embedPflowSuperCluster(), embedPflowSuperCluster_, pat::Electron::embedPreshowerClusters(), embedPreshowerClusters_, pat::Electron::embedSeedCluster(), embedSeedCluster_, pat::Electron::embedSuperCluster(), embedSuperCluster_, pat::Electron::embedTrack(), embedTrack_, pat::helper::EfficiencyLoader::enabled(), pat::helper::KinResolutionsLoader::enabled(), plotBeamSpotDB::first, mps_fire::i, edm::Ref< C, T, F >::isNull(), isoDepositLabels_, isolationValueLabels_, isolationValueLabelsNoPFId_, gen::n, pat::Electron::pfCandidateRef(), resolutionLoader_, pat::helper::EfficiencyLoader::setEfficiencies(), pat::Lepton< LeptonType >::setIsoDeposit(), pat::Lepton< LeptonType >::setIsolation(), pat::helper::KinResolutionsLoader::setResolutions(), source, and useParticleFlow_.

Referenced by produce().

802  {
803 
804  //COLIN: might want to use the PFCandidate 4-mom. Which one is in use now?
805  // if (useParticleFlow_)
806  // aMuon.setP4( aMuon.pfCandidateRef()->p4() );
807 
808  //COLIN:
809  //In the embedding case, the reference cannot be used to look into a value map.
810  //therefore, one has to had the PFCandidateRef to this function, which becomes a bit
811  //too much specific.
812 
813  // in fact, this function needs a baseref or ptr for genmatch
814  // and a baseref or ptr for isodeposits and isolationvalues.
815  // baseref is not needed
816  // the ptrForIsolation and ptrForMatching should be defined upstream.
817 
818  // is the concrete elecRef needed for the efficiency loader? what is this loader?
819  // how can we make it compatible with the particle flow electrons?
820 
821  if (embedGsfElectronCore_) anElectron.embedGsfElectronCore();
822  if (embedGsfTrack_) anElectron.embedGsfTrack();
823  if (embedSuperCluster_) anElectron.embedSuperCluster();
824  if (embedPflowSuperCluster_) anElectron.embedPflowSuperCluster();
825  if (embedSeedCluster_) anElectron.embedSeedCluster();
826  if (embedBasicClusters_) anElectron.embedBasicClusters();
827  if (embedPreshowerClusters_) anElectron.embedPreshowerClusters();
828  if (embedPflowBasicClusters_ ) anElectron.embedPflowBasicClusters();
829  if (embedPflowPreshowerClusters_ ) anElectron.embedPflowPreshowerClusters();
830  if (embedTrack_) anElectron.embedTrack();
831 
832  // store the match to the generated final state muons
833  if (addGenMatch_) {
834  for(size_t i = 0, n = genMatches.size(); i < n; ++i) {
835  if(useParticleFlow_) {
836  reco::GenParticleRef genElectron = (*genMatches[i])[anElectron.pfCandidateRef()];
837  anElectron.addGenParticleRef(genElectron);
838  }
839  else {
840  reco::GenParticleRef genElectron = (*genMatches[i])[elecRef];
841  anElectron.addGenParticleRef(genElectron);
842  }
843  }
844  if (embedGenMatch_) anElectron.embedGenParticle();
845  }
846 
847  if (efficiencyLoader_.enabled()) {
848  efficiencyLoader_.setEfficiencies( anElectron, elecRef );
849  }
850 
851  if (resolutionLoader_.enabled()) {
852  resolutionLoader_.setResolutions(anElectron);
853  }
854 
855  for (size_t j = 0, nd = deposits.size(); j < nd; ++j) {
856  if(useParticleFlow_) {
857 
858  reco::PFCandidateRef pfcandref = anElectron.pfCandidateRef();
859  assert(!pfcandref.isNull());
860  reco::CandidatePtr source = pfcandref->sourceCandidatePtr(0);
861  anElectron.setIsoDeposit(isoDepositLabels_[j].first,
862  (*deposits[j])[source]);
863  }
864  else
865  anElectron.setIsoDeposit(isoDepositLabels_[j].first,
866  (*deposits[j])[elecRef]);
867  }
868 
869  for (size_t j = 0; j<isolationValues.size(); ++j) {
870  if(useParticleFlow_) {
871  reco::CandidatePtr source = anElectron.pfCandidateRef()->sourceCandidatePtr(0);
872  anElectron.setIsolation(isolationValueLabels_[j].first,
873  (*isolationValues[j])[source]);
874  }
875  else
876  if(pfId){
877  anElectron.setIsolation(isolationValueLabels_[j].first,(*isolationValues[j])[elecRef]);
878  }
879  }
880 
881  //for electrons not identified as PF electrons
882  for (size_t j = 0; j<isolationValuesNoPFId.size(); ++j) {
883  if( !pfId) {
884  anElectron.setIsolation(isolationValueLabelsNoPFId_[j].first,(*isolationValuesNoPFId[j])[elecRef]);
885  }
886  }
887 
888 }
bool enabled() const
&#39;true&#39; if this there is at least one efficiency configured
const bool useParticleFlow_
pflow specific
void setResolutions(pat::PATObject< T > &obj) const
Sets the efficiencies for this object, using the reference to the original objects.
bool enabled() const
&#39;true&#39; if this there is at least one efficiency configured
bool isNull() const
Checks for null.
Definition: Ref.h:248
pat::helper::EfficiencyLoader efficiencyLoader_
void setEfficiencies(pat::PATObject< T > &obj, const R &originalRef) const
Sets the efficiencies for this object, using the reference to the original objects.
IsolationLabels isolationValueLabelsNoPFId_
IsolationLabels isolationValueLabels_
pat::helper::KinResolutionsLoader resolutionLoader_
static std::string const source
Definition: EdmProvDump.cc:47
void PATElectronProducer::fillElectron2 ( Electron anElectron,
const reco::CandidatePtr candPtrForIsolation,
const reco::CandidatePtr candPtrForGenMatch,
const reco::CandidatePtr candPtrForLoader,
const GenAssociations genMatches,
const IsoDepositMaps deposits,
const IsolationValueMaps isolationValues 
) const
private

Definition at line 890 of file PATElectronProducer.cc.

References addGenMatch_, pat::PATObject< ObjectType >::addGenParticleRef(), edm::contains(), pat::EcalIso, efficiencyLoader_, pat::Electron::embedBasicClusters(), embedBasicClusters_, embedGenMatch_, pat::PATObject< ObjectType >::embedGenParticle(), pat::Electron::embedGsfElectronCore(), embedGsfElectronCore_, pat::Electron::embedGsfTrack(), embedGsfTrack_, pat::Electron::embedPflowBasicClusters(), embedPflowBasicClusters_, pat::Electron::embedPflowPreshowerClusters(), embedPflowPreshowerClusters_, pat::Electron::embedPflowSuperCluster(), embedPflowSuperCluster_, pat::Electron::embedPreshowerClusters(), embedPreshowerClusters_, pat::Electron::embedSeedCluster(), embedSeedCluster_, pat::Electron::embedSuperCluster(), embedSuperCluster_, pat::Electron::embedTrack(), embedTrack_, pat::helper::EfficiencyLoader::enabled(), pat::helper::KinResolutionsLoader::enabled(), plotBeamSpotDB::first, pat::HcalIso, mps_fire::i, edm::Ptr< T >::id(), isoDepositLabels_, isolationValueLabels_, gen::n, reco::GsfElectron::p4(), pat::Electron::pfCandidateRef(), resolutionLoader_, pat::Electron::setEcalDrivenMomentum(), pat::helper::EfficiencyLoader::setEfficiencies(), pat::Lepton< LeptonType >::setIsoDeposit(), pat::Lepton< LeptonType >::setIsolation(), reco::GsfElectron::setP4(), pat::helper::KinResolutionsLoader::setResolutions(), and pat::TrackIso.

Referenced by produce().

896  {
897 
898  //COLIN/Florian: use the PFCandidate 4-mom.
899  anElectron.setEcalDrivenMomentum(anElectron.p4()) ;
900  anElectron.setP4( anElectron.pfCandidateRef()->p4() );
901 
902 
903  // is the concrete elecRef needed for the efficiency loader? what is this loader?
904  // how can we make it compatible with the particle flow electrons?
905 
907  if (embedGsfTrack_) anElectron.embedGsfTrack();
908  if (embedSuperCluster_) anElectron.embedSuperCluster();
910  if (embedSeedCluster_) anElectron.embedSeedCluster();
911  if (embedBasicClusters_) anElectron.embedBasicClusters();
915  if (embedTrack_) anElectron.embedTrack();
916 
917  // store the match to the generated final state muons
918 
919  if (addGenMatch_) {
920  for(size_t i = 0, n = genMatches.size(); i < n; ++i) {
921  reco::GenParticleRef genElectron = (*genMatches[i])[candPtrForGenMatch];
922  anElectron.addGenParticleRef(genElectron);
923  }
924  if (embedGenMatch_) anElectron.embedGenParticle();
925  }
926 
927  //COLIN what's this? does it have to be GsfElectron specific?
928  if (efficiencyLoader_.enabled()) {
929  efficiencyLoader_.setEfficiencies( anElectron, candPtrForLoader );
930  }
931 
932  if (resolutionLoader_.enabled()) {
933  resolutionLoader_.setResolutions(anElectron);
934  }
935 
936  for (size_t j = 0, nd = deposits.size(); j < nd; ++j) {
940  deposits[j]->contains(candPtrForGenMatch.id())) {
941  anElectron.setIsoDeposit(isoDepositLabels_[j].first,
942  (*deposits[j])[candPtrForGenMatch]);
943  }
944  else if (deposits[j]->contains(candPtrForIsolation.id())) {
945  anElectron.setIsoDeposit(isoDepositLabels_[j].first,
946  (*deposits[j])[candPtrForIsolation]);
947  }
948  else {
949  anElectron.setIsoDeposit(isoDepositLabels_[j].first,
950  (*deposits[j])[candPtrForIsolation->sourceCandidatePtr(0)]);
951  }
952  }
953 
954  for (size_t j = 0; j<isolationValues.size(); ++j) {
955  if( isolationValueLabels_[j].first==pat::TrackIso ||
958  isolationValues[j]->contains(candPtrForGenMatch.id())) {
959  anElectron.setIsolation(isolationValueLabels_[j].first,
960  (*isolationValues[j])[candPtrForGenMatch]);
961  }
962  else if (isolationValues[j]->contains(candPtrForIsolation.id())) {
963  anElectron.setIsolation(isolationValueLabels_[j].first,
964  (*isolationValues[j])[candPtrForIsolation]);
965  }
966  else {
967  anElectron.setIsolation(isolationValueLabels_[j].first,
968  (*isolationValues[j])[candPtrForIsolation->sourceCandidatePtr(0)]);
969  }
970  }
971 }
bool enabled() const
&#39;true&#39; if this there is at least one efficiency configured
void setP4(P4Kind kind, const LorentzVector &p4, float p4Error, bool setCandidate)
Definition: GsfElectron.cc:199
void setIsolation(IsolationKeys key, float value)
Definition: Lepton.h:99
bool contains(EventRange const &lh, EventID const &rh)
Definition: EventRange.cc:38
const LorentzVector & p4(P4Kind kind) const
Definition: GsfElectron.cc:225
void embedSuperCluster()
method to store the electron&#39;s SuperCluster internally
void embedGsfElectronCore()
method to store the electron&#39;s core internally
void setEcalDrivenMomentum(const Candidate::LorentzVector &mom)
Definition: Electron.h:215
void setResolutions(pat::PATObject< T > &obj) const
Sets the efficiencies for this object, using the reference to the original objects.
void embedPflowSuperCluster()
method to store the electron&#39;s PflowSuperCluster internally
bool enabled() const
&#39;true&#39; if this there is at least one efficiency configured
void setIsoDeposit(IsolationKeys key, const IsoDeposit &dep)
Sets the IsoDeposit associated with some key; if it is already existent, it is overwritten.
Definition: Lepton.h:176
void embedSeedCluster()
method to store the electron&#39;s seedcluster internally
reco::PFCandidateRef pfCandidateRef() const
reference to the source PFCandidates; null if this has been built from a standard electron ...
void embedGenParticle()
Definition: PATObject.h:694
void embedPflowBasicClusters()
method to store the electron&#39;s pflow basic clusters
void embedBasicClusters()
method to store the electron&#39;s basic clusters
void embedGsfTrack()
method to store the electron&#39;s GsfTrack internally
void addGenParticleRef(const reco::GenParticleRef &ref)
Definition: PATObject.h:678
pat::helper::EfficiencyLoader efficiencyLoader_
void setEfficiencies(pat::PATObject< T > &obj, const R &originalRef) const
Sets the efficiencies for this object, using the reference to the original objects.
ProductID id() const
Accessor for product ID.
Definition: Ptr.h:180
void embedPreshowerClusters()
method to store the electron&#39;s preshower clusters
IsolationLabels isolationValueLabels_
pat::helper::KinResolutionsLoader resolutionLoader_
void embedPflowPreshowerClusters()
method to store the electron&#39;s pflow preshower clusters
void embedTrack()
method to store the electron&#39;s Track internally
void PATElectronProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 216 of file PATElectronProducer.cc.

References IPTools::absoluteImpactParameter3D(), addElecID_, addGenMatch_, addMVAVariables_, addPFClusterIso_, addPuppiIsolation_, Reference_intrackfit_cff::barrel, beamLineToken_, ecalDrivenElectronSeedsParameters_cff::beamSpot, pat::helper::MultiIsolator::beginEvent(), electrons_cff::bool, TransientTrackBuilder::build(), computeMiniIso_, CandIsolatorFromDeposits_cfi::deposits, reco::PFCandidate::e, DetId::Ecal, EcalBarrel, EcalEndcap, ecalPFClusterIsoT_, ecalTopology_, efficiencyLoader_, elecIDSrcs_, elecIDTokens_, nano_cff::electrons, electronToken_, embedBasicClusters_, embedGenMatch_, embedHighLevel(), embedHighLevelSelection_, pat::Electron::embedPFCandidate(), embedPFCandidate_, embedPflowBasicClusters_, pat::Electron::embedRecHits(), embedRecHits_, pat::helper::EfficiencyLoader::enabled(), pat::helper::KinResolutionsLoader::enabled(), pat::helper::MultiIsolator::enabled(), edm::SortedCollection< T, SORT >::end(), pat::helper::MultiIsolator::endEvent(), pat::helper::MultiIsolator::fill(), fillElectron(), fillElectron2(), edm::SortedCollection< T, SORT >::find(), plotBeamSpotDB::first, genMatchTokens_, edm::EventSetup::get(), edm::Event::getByToken(), CaloTopology::getSubdetectorTopology(), CaloSubdetectorTopology::getWindow(), ConversionTools::hasMatchedConversion(), hcalPFClusterIsoT_, hConversionsToken_, mps_fire::i, training_settings::idx, electrons_cff::ip3d, edm::Ref< C, T, F >::isAvailable(), edm::Ptr< T >::isNonnull(), edm::Ref< C, T, F >::isNonnull(), isoDepositLabels_, isoDepositTokens_, isolationValueNoPFIdTokens_, electronProducer_cff::isolationValues, electronProducer_cff::isolationValuesNoPFId, isolationValueTokens_, isolator_, isolatorTmpStorage_, edm::EventBase::isRealData(), edm::HandleBase::isValid(), reco::Matched, reco::HitPattern::MISSING_INNER_HITS, eostools::move(), pat::helper::EfficiencyLoader::newEvent(), pat::helper::KinResolutionsLoader::newEvent(), electronProducer_cfi::patElectrons, pcToken_, packedPFCandidateRefMixer_cfi::pf, pfCandidateMapToken_, pfCandidateMultiMapToken_, pfElecToken_, reco::GsfElectron::pfIsolationVariables(), reco::BeamSpot::position(), impactParameterTagInfos_cfi::primaryVertex, edm::Handle< T >::product(), pTComparator_, PUPPIIsolation_charged_hadrons_, PUPPIIsolation_neutral_hadrons_, PUPPIIsolation_photons_, PUPPINoLeptonsIsolation_charged_hadrons_, PUPPINoLeptonsIsolation_neutral_hadrons_, PUPPINoLeptonsIsolation_photons_, edm::SortedCollection< T, SORT >::push_back(), edm::Event::put(), pvToken_, reducedBarrelRecHitCollectionToken_, reducedEndcapRecHitCollectionToken_, resolutionLoader_, SurveyInfoScenario_cff::seed, pat::Electron::setElectronIDs(), setElectronMiniIso(), pat::Lepton< LeptonType >::setIsoDeposit(), pat::Lepton< LeptonType >::setIsolation(), pat::Electron::setIsolationPUPPI(), pat::Electron::setIsolationPUPPINoLeptons(), pat::Electron::setIsPF(), pat::Electron::setMvaVariables(), pat::Electron::setPassConversionVeto(), pat::Electron::setPFCandidateRef(), reco::GsfElectron::setPfIsolationVariables(), edm::SortedCollection< T, SORT >::size(), edm::SortedCollection< T, SORT >::sort(), reco::GsfElectron::PflowIsolationVariables::sumEcalClusterEt, reco::GsfElectron::PflowIsolationVariables::sumHcalClusterEt, HiIsolationCommonParameters_cff::track, groupFilesInBlocks::tt, tier0::unique(), useParticleFlow_, usePfCandidateMultiMap_, userDataHelper_, and useUserData_.

217 {
218  // switch off embedding (in unschedules mode)
219  if (iEvent.isRealData()){
220  addGenMatch_ = false;
221  embedGenMatch_ = false;
222  }
223 
224  edm::ESHandle<CaloTopology> theCaloTopology;
225  iSetup.get<CaloTopologyRecord>().get(theCaloTopology);
226  ecalTopology_ = & (*theCaloTopology);
227 
228  // Get the collection of electrons from the event
230  iEvent.getByToken(electronToken_, electrons);
231 
233  if(computeMiniIso_)
234  iEvent.getByToken(pcToken_, pc);
235 
236  // for additional mva variables
237  edm::InputTag reducedEBRecHitCollection(string("reducedEcalRecHitsEB"));
238  edm::InputTag reducedEERecHitCollection(string("reducedEcalRecHitsEE"));
239  //EcalClusterLazyTools lazyTools(iEvent, iSetup, reducedEBRecHitCollection, reducedEERecHitCollection);
241 
242  // for conversion veto selection
244  iEvent.getByToken(hConversionsToken_, hConversions);
245 
246  // Get the ESHandle for the transient track builder, if needed for
247  // high level selection embedding
249 
250  if (isolator_.enabled()) isolator_.beginEvent(iEvent,iSetup);
251 
253  if (resolutionLoader_.enabled()) resolutionLoader_.newEvent(iEvent, iSetup);
254 
256  for (size_t j = 0, nd = isoDepositTokens_.size(); j < nd; ++j) {
257  iEvent.getByToken(isoDepositTokens_[j], deposits[j]);
258  }
259 
261  for (size_t j = 0; j<isolationValueTokens_.size(); ++j) {
263  }
264 
266  for (size_t j = 0; j<isolationValueNoPFIdTokens_.size(); ++j) {
268  }
269 
270  // prepare the MC matching
271  GenAssociations genMatches(genMatchTokens_.size());
272  if (addGenMatch_) {
273  for (size_t j = 0, nd = genMatchTokens_.size(); j < nd; ++j) {
274  iEvent.getByToken(genMatchTokens_[j], genMatches[j]);
275  }
276  }
277 
278  // prepare ID extraction
279  std::vector<edm::Handle<edm::ValueMap<float> > > idhandles;
280  std::vector<pat::Electron::IdPair> ids;
281  if (addElecID_) {
282  idhandles.resize(elecIDSrcs_.size());
283  ids.resize(elecIDSrcs_.size());
284  for (size_t i = 0; i < elecIDSrcs_.size(); ++i) {
285  iEvent.getByToken(elecIDTokens_[i], idhandles[i]);
286  ids[i].first = elecIDSrcs_[i].first;
287  }
288  }
289 
290 
291  // prepare the high level selection:
292  // needs beamline
293  reco::TrackBase::Point beamPoint(0,0,0);
296  bool beamSpotIsValid = false;
297  bool primaryVertexIsValid = false;
298 
299  // Get the beamspot
300  edm::Handle<reco::BeamSpot> beamSpotHandle;
301  iEvent.getByToken(beamLineToken_, beamSpotHandle);
302 
303  if ( embedHighLevelSelection_ ) {
304  // Get the primary vertex
306  iEvent.getByToken( pvToken_, pvHandle );
307 
308  // This is needed by the IPTools methods from the tracking group
309  iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder", trackBuilder);
310 
311  if ( pvHandle.isValid() && !pvHandle->empty() ) {
312  primaryVertex = pvHandle->at(0);
313  primaryVertexIsValid = true;
314  } else {
315  edm::LogError("DataNotAvailable")
316  << "No primary vertex available from EventSetup, not adding high level selection \n";
317  }
318  }
319  //value maps for puppi isolation
320  edm::Handle<edm::ValueMap<float>> PUPPIIsolation_charged_hadrons;
321  edm::Handle<edm::ValueMap<float>> PUPPIIsolation_neutral_hadrons;
322  edm::Handle<edm::ValueMap<float>> PUPPIIsolation_photons;
323  //value maps for puppiNoLeptons isolation
324  edm::Handle<edm::ValueMap<float>> PUPPINoLeptonsIsolation_charged_hadrons;
325  edm::Handle<edm::ValueMap<float>> PUPPINoLeptonsIsolation_neutral_hadrons;
326  edm::Handle<edm::ValueMap<float>> PUPPINoLeptonsIsolation_photons;
327  if(addPuppiIsolation_){
328  //puppi
329  iEvent.getByToken(PUPPIIsolation_charged_hadrons_, PUPPIIsolation_charged_hadrons);
330  iEvent.getByToken(PUPPIIsolation_neutral_hadrons_, PUPPIIsolation_neutral_hadrons);
331  iEvent.getByToken(PUPPIIsolation_photons_, PUPPIIsolation_photons);
332  //puppiNoLeptons
333  iEvent.getByToken(PUPPINoLeptonsIsolation_charged_hadrons_, PUPPINoLeptonsIsolation_charged_hadrons);
334  iEvent.getByToken(PUPPINoLeptonsIsolation_neutral_hadrons_, PUPPINoLeptonsIsolation_neutral_hadrons);
335  iEvent.getByToken(PUPPINoLeptonsIsolation_photons_, PUPPINoLeptonsIsolation_photons);
336  }
337 
338 
339  std::vector<Electron> * patElectrons = new std::vector<Electron>();
340 
341  if( useParticleFlow_ ) {
343  iEvent.getByToken(pfElecToken_, pfElectrons);
344  unsigned index=0;
345 
346  for( reco::PFCandidateConstIterator i = pfElectrons->begin();
347  i != pfElectrons->end(); ++i, ++index) {
348 
349  reco::PFCandidateRef pfRef(pfElectrons, index);
350  reco::PFCandidatePtr ptrToPFElectron(pfElectrons,index);
351 // reco::CandidateBaseRef pfBaseRef( pfRef );
352 
353  reco::GsfTrackRef PfTk= i->gsfTrackRef();
354 
355  bool Matched=false;
356  bool MatchedToAmbiguousGsfTrack=false;
357  for (edm::View<reco::GsfElectron>::const_iterator itElectron = electrons->begin(); itElectron != electrons->end(); ++itElectron) {
358  unsigned int idx = itElectron - electrons->begin();
359  auto elePtr = electrons -> ptrAt(idx);
360  if (Matched || MatchedToAmbiguousGsfTrack) continue;
361 
362  reco::GsfTrackRef EgTk= itElectron->gsfTrack();
363 
364  if (itElectron->gsfTrack()==i->gsfTrackRef()){
365  Matched=true;
366  }
367  else {
368  for( reco::GsfTrackRefVector::const_iterator it = itElectron->ambiguousGsfTracksBegin() ;
369  it!=itElectron->ambiguousGsfTracksEnd(); it++ ){
370  MatchedToAmbiguousGsfTrack |= (bool)(i->gsfTrackRef()==(*it));
371  }
372  }
373 
374  if (Matched || MatchedToAmbiguousGsfTrack){
375 
376  // ptr needed for finding the matched gen particle
377  reco::CandidatePtr ptrToGsfElectron(electrons,idx);
378 
379  // ref to base needed for the construction of the pat object
380  const edm::RefToBase<reco::GsfElectron>& elecsRef = electrons->refAt(idx);
381  Electron anElectron(elecsRef);
382  anElectron.setPFCandidateRef( pfRef );
383  if (addPuppiIsolation_) {
384  anElectron.setIsolationPUPPI((*PUPPIIsolation_charged_hadrons)[elePtr], (*PUPPIIsolation_neutral_hadrons)[elePtr], (*PUPPIIsolation_photons)[elePtr]);
385  anElectron.setIsolationPUPPINoLeptons((*PUPPINoLeptonsIsolation_charged_hadrons)[elePtr], (*PUPPINoLeptonsIsolation_neutral_hadrons)[elePtr], (*PUPPINoLeptonsIsolation_photons)[elePtr]);
386  }
387  else {
388  anElectron.setIsolationPUPPI(-999., -999.,-999.);
389  anElectron.setIsolationPUPPINoLeptons(-999., -999.,-999.);
390  }
391 
392  //it should be always true when particleFlow electrons are used.
393  anElectron.setIsPF( true );
394 
395  if( embedPFCandidate_ ) anElectron.embedPFCandidate();
396 
397  if ( useUserData_ ) {
398  userDataHelper_.add( anElectron, iEvent, iSetup );
399  }
400 
401  double ip3d = -999; // for mva variable
402 
403  // embed high level selection
404  if ( embedHighLevelSelection_ ) {
405  // get the global track
406  const reco::GsfTrackRef& track = PfTk;
407 
408  // Make sure the collection it points to is there
409  if ( track.isNonnull() && track.isAvailable() ) {
410 
411  reco::TransientTrack tt = trackBuilder->build(track);
412  embedHighLevel( anElectron,
413  track,
414  tt,
415  primaryVertex,
416  primaryVertexIsValid,
417  beamSpot,
418  beamSpotIsValid );
419 
420  std::pair<bool,Measurement1D> ip3dpv = IPTools::absoluteImpactParameter3D(tt, primaryVertex);
421  ip3d = ip3dpv.second.value(); // for mva variable
422  }
423  }
424 
425  //Electron Id
426 
427  if (addElecID_) {
428  //STANDARD EL ID
429  for (size_t i = 0; i < elecIDSrcs_.size(); ++i) {
430  ids[i].second = (*idhandles[i])[elecsRef];
431  }
432  //SPECIFIC PF ID
433  ids.push_back(std::make_pair("pf_evspi",pfRef->mva_e_pi()));
434  ids.push_back(std::make_pair("pf_evsmu",pfRef->mva_e_mu()));
435  anElectron.setElectronIDs(ids);
436  }
437 
438  if (addMVAVariables_) {
439  // add missing mva variables
440  std::vector<float> vCov = lazyTools.localCovariances(*( itElectron->superCluster()->seed()));
441  anElectron.setMvaVariables(vCov[1], ip3d);
442  }
443  // PFClusterIso
444  if (addPFClusterIso_) {
445  // Get PFCluster Isolation
446  edm::Handle<edm::ValueMap<float> > ecalPFClusterIsoMapH;
447  iEvent.getByToken(ecalPFClusterIsoT_, ecalPFClusterIsoMapH);
448  edm::Handle<edm::ValueMap<float> > hcalPFClusterIsoMapH;
449  iEvent.getByToken(hcalPFClusterIsoT_, hcalPFClusterIsoMapH);
450  reco::GsfElectron::PflowIsolationVariables newPFIsol = anElectron.pfIsolationVariables();
451  newPFIsol.sumEcalClusterEt = (*ecalPFClusterIsoMapH)[elecsRef];
452  newPFIsol.sumHcalClusterEt = (*hcalPFClusterIsoMapH)[elecsRef];
453  anElectron.setPfIsolationVariables(newPFIsol);
454  }
455 
456  std::vector<DetId> selectedCells;
457  bool barrel = itElectron->isEB();
458  //loop over sub clusters
459  if (embedBasicClusters_) {
460  for (reco::CaloCluster_iterator clusIt = itElectron->superCluster()->clustersBegin(); clusIt!=itElectron->superCluster()->clustersEnd(); ++clusIt) {
461  //get seed (max energy xtal)
462  DetId seed = lazyTools.getMaximum(**clusIt).first;
463  //get all xtals in 5x5 window around the seed
464  std::vector<DetId> dets5x5 = (barrel) ? ecalTopology_->getSubdetectorTopology(DetId::Ecal,EcalBarrel)->getWindow(seed,5,5):
466  selectedCells.insert(selectedCells.end(), dets5x5.begin(), dets5x5.end());
467 
468  //get all xtals belonging to cluster
469  for (const std::pair<DetId, float> &hit : (*clusIt)->hitsAndFractions()) {
470  selectedCells.push_back(hit.first);
471  }
472  }
473  }
474 
475  if (embedPflowBasicClusters_ && itElectron->parentSuperCluster().isNonnull()) {
476  for (reco::CaloCluster_iterator clusIt = itElectron->parentSuperCluster()->clustersBegin(); clusIt!=itElectron->parentSuperCluster()->clustersEnd(); ++clusIt) {
477  //get seed (max energy xtal)
478  DetId seed = lazyTools.getMaximum(**clusIt).first;
479  //get all xtals in 5x5 window around the seed
480  std::vector<DetId> dets5x5 = (barrel) ? ecalTopology_->getSubdetectorTopology(DetId::Ecal,EcalBarrel)->getWindow(seed,5,5):
482  selectedCells.insert(selectedCells.end(), dets5x5.begin(), dets5x5.end());
483 
484  //get all xtals belonging to cluster
485  for (const std::pair<DetId, float> &hit : (*clusIt)->hitsAndFractions()) {
486  selectedCells.push_back(hit.first);
487  }
488  }
489  }
490 
491  //remove duplicates
492  std::sort(selectedCells.begin(),selectedCells.end());
493  std::unique(selectedCells.begin(),selectedCells.end());
494 
495 
496  // Retrieve the corresponding RecHits
497 
499  if(barrel)
501  else
503 
504  EcalRecHitCollection selectedRecHits;
505  const EcalRecHitCollection *recHits = rechitsH.product();
506 
507  unsigned nSelectedCells = selectedCells.size();
508  for (unsigned icell = 0 ; icell < nSelectedCells ; ++icell) {
509  EcalRecHitCollection::const_iterator it = recHits->find( selectedCells[icell] );
510  if ( it != recHits->end() ) {
511  selectedRecHits.push_back(*it);
512  }
513  }
514  selectedRecHits.sort();
515  if (embedRecHits_) anElectron.embedRecHits(& selectedRecHits);
516 
517  // set conversion veto selection
518  bool passconversionveto = false;
519  if( hConversions.isValid()){
520  // this is recommended method
521  passconversionveto = !ConversionTools::hasMatchedConversion( *itElectron, *hConversions, beamSpotHandle->position());
522  }else{
523  // use missing hits without vertex fit method
524  passconversionveto = itElectron->gsfTrack()->hitPattern().numberOfLostHits(reco::HitPattern::MISSING_INNER_HITS) < 1;
525  }
526 
527  anElectron.setPassConversionVeto( passconversionveto );
528 
529 
530 // fillElectron(anElectron,elecsRef,pfBaseRef,
531 // genMatches, deposits, isolationValues);
532 
533  //COLIN small warning !
534  // we are currently choosing to take the 4-momentum of the PFCandidate;
535  // the momentum of the GsfElectron is saved though
536  // we must therefore match the GsfElectron.
537  // because of this, we should not change the source of the electron matcher
538  // to the collection of PFElectrons in the python configuration
539  // I don't know what to do with the efficiencyLoader, since I don't know
540  // what this class is for.
541  fillElectron2( anElectron,
542  ptrToPFElectron,
543  ptrToGsfElectron,
544  ptrToGsfElectron,
545  genMatches, deposits, isolationValues );
546 
547  //COLIN need to use fillElectron2 in the non-pflow case as well, and to test it.
548 
549  if(computeMiniIso_)
550  setElectronMiniIso(anElectron, pc.product());
551 
552  patElectrons->push_back(anElectron);
553  }
554  }
555  //if( !Matched && !MatchedToAmbiguousGsfTrack) std::cout << "!!!!A pf electron could not be matched to a gsf!!!!" << std::endl;
556  }
557  }
558 
559  else{
563  bool pfCandsPresent = false, valMapPresent = false;
565  iEvent.getByToken(pfCandidateMultiMapToken_, ValMultiMapH);
566  } else {
567  pfCandsPresent = iEvent.getByToken(pfElecToken_, pfElectrons);
568  valMapPresent = iEvent.getByToken(pfCandidateMapToken_,ValMapH);
569  }
570 
571  for (edm::View<reco::GsfElectron>::const_iterator itElectron = electrons->begin(); itElectron != electrons->end(); ++itElectron) {
572  // construct the Electron from the ref -> save ref to original object
573  //FIXME: looks like a lot of instances could be turned into const refs
574  unsigned int idx = itElectron - electrons->begin();
575  edm::RefToBase<reco::GsfElectron> elecsRef = electrons->refAt(idx);
576  reco::CandidateBaseRef elecBaseRef(elecsRef);
577  Electron anElectron(elecsRef);
578  auto elePtr = electrons -> ptrAt(idx);
579 
580  // Is this GsfElectron also identified as an e- in the particle flow?
581  bool pfId = false;
582 
584  for (const reco::PFCandidateRef& pf : (*ValMultiMapH)[elePtr]) {
585  if (pf->particleId() == reco::PFCandidate::e) {
586  pfId = true;
587  anElectron.setPFCandidateRef( pf );
588  break;
589  }
590  }
591  } else if ( pfCandsPresent ) {
592  // PF electron collection not available.
593  const reco::GsfTrackRef& trkRef = itElectron->gsfTrack();
594  int index = 0;
595  for( reco::PFCandidateConstIterator ie = pfElectrons->begin();
596  ie != pfElectrons->end(); ++ie, ++index) {
597  if(ie->particleId()!=reco::PFCandidate::e) continue;
598  const reco::GsfTrackRef& pfTrkRef= ie->gsfTrackRef();
599  if( trkRef == pfTrkRef ) {
600  pfId = true;
601  reco::PFCandidateRef pfRef(pfElectrons, index);
602  anElectron.setPFCandidateRef( pfRef );
603  break;
604  }
605  }
606  }
607  else if( valMapPresent ) {
608  // use value map if PF collection not available
609  const edm::ValueMap<reco::PFCandidatePtr> & myValMap(*ValMapH);
610  // Get the PFCandidate
611  const reco::PFCandidatePtr& pfElePtr(myValMap[elecsRef]);
612  pfId= pfElePtr.isNonnull();
613  }
614  // set PFId function
615  anElectron.setIsPF( pfId );
616 
617  // add resolution info
618 
619  // Isolation
620  if (isolator_.enabled()) {
621  isolator_.fill(*electrons, idx, isolatorTmpStorage_);
622  typedef pat::helper::MultiIsolator::IsolationValuePairs IsolationValuePairs;
623  // better to loop backwards, so the vector is resized less times
624  for (IsolationValuePairs::const_reverse_iterator it = isolatorTmpStorage_.rbegin(), ed = isolatorTmpStorage_.rend(); it != ed; ++it) {
625  anElectron.setIsolation(it->first, it->second);
626  }
627  }
628 
629  for (size_t j = 0, nd = deposits.size(); j < nd; ++j) {
630  anElectron.setIsoDeposit(isoDepositLabels_[j].first, (*deposits[j])[elecsRef]);
631  }
632 
633  // add electron ID info
634  if (addElecID_) {
635  for (size_t i = 0; i < elecIDSrcs_.size(); ++i) {
636  ids[i].second = (*idhandles[i])[elecsRef];
637  }
638  anElectron.setElectronIDs(ids);
639  }
640 
641 
642  if ( useUserData_ ) {
643  userDataHelper_.add( anElectron, iEvent, iSetup );
644  }
645 
646 
647  double ip3d = -999; //for mva variable
648 
649  // embed high level selection
650  if ( embedHighLevelSelection_ ) {
651  // get the global track
652  reco::GsfTrackRef track = itElectron->gsfTrack();
653 
654  // Make sure the collection it points to is there
655  if ( track.isNonnull() && track.isAvailable() ) {
656 
657  reco::TransientTrack tt = trackBuilder->build(track);
658  embedHighLevel( anElectron,
659  track,
660  tt,
661  primaryVertex,
662  primaryVertexIsValid,
663  beamSpot,
664  beamSpotIsValid );
665 
666  std::pair<bool,Measurement1D> ip3dpv = IPTools::absoluteImpactParameter3D(tt, primaryVertex);
667  ip3d = ip3dpv.second.value(); // for mva variable
668 
669  }
670  }
671 
672  if (addMVAVariables_) {
673  // add mva variables
674  std::vector<float> vCov = lazyTools.localCovariances(*( itElectron->superCluster()->seed()));
675  anElectron.setMvaVariables(vCov[1], ip3d);
676  }
677 
678  // PFCluster Isolation
679  if (addPFClusterIso_) {
680  // Get PFCluster Isolation
681  edm::Handle<edm::ValueMap<float> > ecalPFClusterIsoMapH;
682  iEvent.getByToken(ecalPFClusterIsoT_, ecalPFClusterIsoMapH);
683  edm::Handle<edm::ValueMap<float> > hcalPFClusterIsoMapH;
684  iEvent.getByToken(hcalPFClusterIsoT_, hcalPFClusterIsoMapH);
685  reco::GsfElectron::PflowIsolationVariables newPFIsol = anElectron.pfIsolationVariables();
686  newPFIsol.sumEcalClusterEt = (*ecalPFClusterIsoMapH)[elecsRef];
687  newPFIsol.sumHcalClusterEt = (*hcalPFClusterIsoMapH)[elecsRef];
688  anElectron.setPfIsolationVariables(newPFIsol);
689  }
690 
691  if (addPuppiIsolation_) {
692  anElectron.setIsolationPUPPI((*PUPPIIsolation_charged_hadrons)[elePtr], (*PUPPIIsolation_neutral_hadrons)[elePtr], (*PUPPIIsolation_photons)[elePtr]);
693  anElectron.setIsolationPUPPINoLeptons((*PUPPINoLeptonsIsolation_charged_hadrons)[elePtr], (*PUPPINoLeptonsIsolation_neutral_hadrons)[elePtr], (*PUPPINoLeptonsIsolation_photons)[elePtr]);
694  }
695  else {
696  anElectron.setIsolationPUPPI(-999., -999.,-999.);
697  anElectron.setIsolationPUPPINoLeptons(-999., -999.,-999.);
698  }
699 
700  std::vector<DetId> selectedCells;
701  bool barrel = itElectron->isEB();
702  //loop over sub clusters
703  if (embedBasicClusters_) {
704  for (reco::CaloCluster_iterator clusIt = itElectron->superCluster()->clustersBegin(); clusIt!=itElectron->superCluster()->clustersEnd(); ++clusIt) {
705  //get seed (max energy xtal)
706  DetId seed = lazyTools.getMaximum(**clusIt).first;
707  //get all xtals in 5x5 window around the seed
708  std::vector<DetId> dets5x5 = (barrel) ? ecalTopology_->getSubdetectorTopology(DetId::Ecal,EcalBarrel)->getWindow(seed,5,5):
710  selectedCells.insert(selectedCells.end(), dets5x5.begin(), dets5x5.end());
711 
712  //get all xtals belonging to cluster
713  for (const std::pair<DetId, float> &hit : (*clusIt)->hitsAndFractions()) {
714  selectedCells.push_back(hit.first);
715  }
716  }
717  }
718 
719  if (embedPflowBasicClusters_ && itElectron->parentSuperCluster().isNonnull()) {
720  for (reco::CaloCluster_iterator clusIt = itElectron->parentSuperCluster()->clustersBegin(); clusIt!=itElectron->parentSuperCluster()->clustersEnd(); ++clusIt) {
721  //get seed (max energy xtal)
722  DetId seed = lazyTools.getMaximum(**clusIt).first;
723  //get all xtals in 5x5 window around the seed
724  std::vector<DetId> dets5x5 = (barrel) ? ecalTopology_->getSubdetectorTopology(DetId::Ecal,EcalBarrel)->getWindow(seed,5,5):
726  selectedCells.insert(selectedCells.end(), dets5x5.begin(), dets5x5.end());
727 
728  //get all xtals belonging to cluster
729  for (const std::pair<DetId, float> &hit : (*clusIt)->hitsAndFractions()) {
730  selectedCells.push_back(hit.first);
731  }
732  }
733  }
734 
735  //remove duplicates
736  std::sort(selectedCells.begin(),selectedCells.end());
737  std::unique(selectedCells.begin(),selectedCells.end());
738 
739  // Retrieve the corresponding RecHits
740 
742  if(barrel)
744  else
746 
747  EcalRecHitCollection selectedRecHits;
748  const EcalRecHitCollection *recHits = rechitsH.product();
749 
750  unsigned nSelectedCells = selectedCells.size();
751  for (unsigned icell = 0 ; icell < nSelectedCells ; ++icell) {
752  EcalRecHitCollection::const_iterator it = recHits->find( selectedCells[icell] );
753  if ( it != recHits->end() ) {
754  selectedRecHits.push_back(*it);
755  }
756  }
757  selectedRecHits.sort();
758  if (embedRecHits_) anElectron.embedRecHits(& selectedRecHits);
759 
760  // set conversion veto selection
761  bool passconversionveto = false;
762  if( hConversions.isValid()){
763  // this is recommended method
764  passconversionveto = !ConversionTools::hasMatchedConversion( *itElectron, *hConversions, beamSpotHandle->position());
765  }else{
766  // use missing hits without vertex fit method
767  passconversionveto = itElectron->gsfTrack()->hitPattern().numberOfLostHits(reco::HitPattern::MISSING_INNER_HITS) < 1;
768  }
769  anElectron.setPassConversionVeto( passconversionveto );
770 
771  // add sel to selected
772  fillElectron( anElectron, elecsRef,elecBaseRef,
773  genMatches, deposits, pfId, isolationValues, isolationValuesNoPFId);
774 
775  if(computeMiniIso_)
776  setElectronMiniIso(anElectron, pc.product());
777 
778  patElectrons->push_back(anElectron);
779  }
780  }
781 
782  // sort electrons in pt
783  std::sort(patElectrons->begin(), patElectrons->end(), pTComparator_);
784 
785  // add the electrons to the event output
786  std::unique_ptr<std::vector<Electron> > ptr(patElectrons);
787  iEvent.put(std::move(ptr));
788 
789  // clean up
791 
792 }
bool enabled() const
&#39;true&#39; if this there is at least one efficiency configured
bool isAvailable() const
Definition: Ref.h:575
void newEvent(const edm::Event &event)
To be called for each new event, reads in the ValueMaps for efficiencies.
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
const edm::EDGetTokenT< reco::ConversionCollection > hConversionsToken_
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:251
edm::EDGetTokenT< edm::ValueMap< float > > PUPPINoLeptonsIsolation_charged_hadrons_
const GreaterByPt< Electron > pTComparator_
edm::EDGetTokenT< edm::ValueMap< float > > PUPPIIsolation_charged_hadrons_
const bool useParticleFlow_
pflow specific
const edm::EDGetTokenT< reco::PFCandidateCollection > pfElecToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
edm::EDGetTokenT< edm::ValueMap< float > > PUPPIIsolation_neutral_hadrons_
const edm::EDGetTokenT< edm::ValueMap< float > > ecalPFClusterIsoT_
void embedHighLevel(pat::Electron &anElectron, reco::GsfTrackRef track, reco::TransientTrack &tt, reco::Vertex &primaryVertex, bool primaryVertexIsValid, reco::BeamSpot &beamspot, bool beamspotIsValid)
std::vector< EcalRecHit >::const_iterator const_iterator
reco::TransientTrack build(const reco::Track *p) const
std::pair< bool, Measurement1D > absoluteImpactParameter3D(const reco::TransientTrack &transientTrack, const reco::Vertex &vertex)
Definition: IPTools.cc:37
void fillElectron(Electron &aElectron, const ElectronBaseRef &electronRef, const reco::CandidateBaseRef &baseRef, const GenAssociations &genMatches, const IsoDepositMaps &deposits, const bool pfId, const IsolationValueMaps &isolationValues, const IsolationValueMaps &isolationValuesNoPFId) const
common electron filling, for both the standard and PF2PAT case
void push_back(T const &t)
const edm::EDGetTokenT< edm::ValueMap< float > > hcalPFClusterIsoT_
PFCandidateCollection::const_iterator PFCandidateConstIterator
iterator
std::vector< edm::EDGetTokenT< edm::ValueMap< float > > > elecIDTokens_
bool isRealData() const
Definition: EventBase.h:62
const edm::EDGetTokenT< edm::View< reco::GsfElectron > > electronToken_
const bool addMVAVariables_
mva input variables
bool enabled() const
&#39;true&#39; if this there is at least one efficiency configured
const edm::EDGetTokenT< std::vector< reco::Vertex > > pvToken_
bool enabled() const
True if it has a non null configuration.
Definition: MultiIsolator.h:50
const edm::EDGetTokenT< edm::ValueMap< reco::PFCandidatePtr > > pfCandidateMapToken_
pat::helper::MultiIsolator isolator_
std::vector< edm::Handle< edm::Association< reco::GenParticleCollection > > > GenAssociations
edm::EDGetTokenT< edm::ValueMap< float > > PUPPIIsolation_photons_
void beginEvent(const edm::Event &event, const edm::EventSetup &eventSetup)
const bool embedHighLevelSelection_
embed high level selection variables?
void newEvent(const edm::Event &event, const edm::EventSetup &setup)
To be called for each new event, reads in the EventSetup object.
std::vector< edm::EDGetTokenT< edm::Association< reco::GenParticleCollection > > > genMatchTokens_
static bool hasMatchedConversion(const reco::GsfElectron &ele, const reco::ConversionCollection &convCol, const math::XYZPoint &beamspot, bool allowCkfMatch=true, float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=0)
def unique(seq, keepstr=True)
Definition: tier0.py:25
std::vector< edm::EDGetTokenT< edm::ValueMap< IsoDeposit > > > isoDepositTokens_
edm::EDGetTokenT< edm::ValueMap< float > > PUPPINoLeptonsIsolation_neutral_hadrons_
const edm::EDGetTokenT< EcalRecHitCollection > reducedEndcapRecHitCollectionToken_
math::XYZPoint Point
point in the space
Definition: TrackBase.h:83
std::vector< edm::Handle< edm::ValueMap< double > > > IsolationValueMaps
bool isValid() const
Definition: HandleBase.h:74
edm::EDGetTokenT< edm::ValueMap< float > > PUPPINoLeptonsIsolation_photons_
const_iterator end() const
Definition: DetId.h:18
const edm::EDGetTokenT< reco::BeamSpot > beamLineToken_
void fillElectron2(Electron &anElectron, const reco::CandidatePtr &candPtrForIsolation, const reco::CandidatePtr &candPtrForGenMatch, const reco::CandidatePtr &candPtrForLoader, const GenAssociations &genMatches, const IsoDepositMaps &deposits, const IsolationValueMaps &isolationValues) const
std::vector< edm::EDGetTokenT< edm::ValueMap< double > > > isolationValueNoPFIdTokens_
virtual std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
T const * product() const
Definition: Handle.h:74
pat::helper::EfficiencyLoader efficiencyLoader_
const edm::EDGetTokenT< EcalRecHitCollection > reducedBarrelRecHitCollectionToken_
const edm::EDGetTokenT< edm::ValueMap< std::vector< reco::PFCandidateRef > > > pfCandidateMultiMapToken_
pat::PATUserDataHelper< pat::Electron > userDataHelper_
const CaloTopology * ecalTopology_
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
Definition: CaloTopology.cc:20
void setElectronMiniIso(pat::Electron &anElectron, const pat::PackedCandidateCollection *pc)
std::vector< std::pair< pat::IsolationKeys, float > > IsolationValuePairs
Definition: MultiIsolator.h:16
iterator find(key_type k)
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
size_type size() const
T get() const
Definition: EventSetup.h:71
pat::helper::KinResolutionsLoader resolutionLoader_
const Point & position() const
position
Definition: BeamSpot.h:62
std::vector< edm::EDGetTokenT< edm::ValueMap< double > > > isolationValueTokens_
pat::helper::MultiIsolator::IsolationValuePairs isolatorTmpStorage_
edm::EDGetTokenT< pat::PackedCandidateCollection > pcToken_
def move(src, dest)
Definition: eostools.py:511
std::vector< NameTag > elecIDSrcs_
void fill(const edm::View< T > &coll, int idx, IsolationValuePairs &isolations) const
Definition: MultiIsolator.h:82
std::vector< edm::Handle< edm::ValueMap< IsoDeposit > > > IsoDepositMaps
template<typename T >
void pat::PATElectronProducer::readIsolationLabels ( const edm::ParameterSet iConfig,
const char *  psetName,
IsolationLabels labels,
std::vector< edm::EDGetTokenT< edm::ValueMap< T > > > &  tokens 
)
private

fill the labels vector from the contents of the parameter set, for the isodeposit or isolation values embedding

Definition at line 205 of file PATElectronProducer.h.

References pat::EcalIso, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), pat::HcalIso, crabWrapper::key, label, pat::PfAllParticleIso, pat::PfChargedAllIso, pat::PfChargedHadronIso, pat::PfGammaIso, pat::PfNeutralHadronIso, pat::PfPUChargedHadronIso, pat::TrackIso, pat::UserBaseIso, and edm::vector_transform().

Referenced by PATElectronProducer().

208  {
209 
210  labels.clear();
211 
212  if (iConfig.exists( psetName )) {
213  edm::ParameterSet depconf
214  = iConfig.getParameter<edm::ParameterSet>(psetName);
215 
216  if (depconf.exists("tracker")) labels.push_back(std::make_pair(pat::TrackIso, depconf.getParameter<edm::InputTag>("tracker")));
217  if (depconf.exists("ecal")) labels.push_back(std::make_pair(pat::EcalIso, depconf.getParameter<edm::InputTag>("ecal")));
218  if (depconf.exists("hcal")) labels.push_back(std::make_pair(pat::HcalIso, depconf.getParameter<edm::InputTag>("hcal")));
219  if (depconf.exists("pfAllParticles")) {
220  labels.push_back(std::make_pair(pat::PfAllParticleIso, depconf.getParameter<edm::InputTag>("pfAllParticles")));
221  }
222  if (depconf.exists("pfChargedHadrons")) {
223  labels.push_back(std::make_pair(pat::PfChargedHadronIso, depconf.getParameter<edm::InputTag>("pfChargedHadrons")));
224  }
225  if (depconf.exists("pfChargedAll")) {
226  labels.push_back(std::make_pair(pat::PfChargedAllIso, depconf.getParameter<edm::InputTag>("pfChargedAll")));
227  }
228  if (depconf.exists("pfPUChargedHadrons")) {
229  labels.push_back(std::make_pair(pat::PfPUChargedHadronIso, depconf.getParameter<edm::InputTag>("pfPUChargedHadrons")));
230  }
231  if (depconf.exists("pfNeutralHadrons")) {
232  labels.push_back(std::make_pair(pat::PfNeutralHadronIso, depconf.getParameter<edm::InputTag>("pfNeutralHadrons")));
233  }
234  if (depconf.exists("pfPhotons")) {
235  labels.push_back(std::make_pair(pat::PfGammaIso, depconf.getParameter<edm::InputTag>("pfPhotons")));
236  }
237  if (depconf.exists("user")) {
238  std::vector<edm::InputTag> userdeps = depconf.getParameter<std::vector<edm::InputTag> >("user");
239  std::vector<edm::InputTag>::const_iterator it = userdeps.begin(), ed = userdeps.end();
241  for ( ; it != ed; ++it, ++key) {
242  labels.push_back(std::make_pair(pat::IsolationKeys(key), *it));
243  }
244  }
245  }
246  tokens = edm::vector_transform(labels, [this](IsolationLabel const & label){return consumes<edm::ValueMap<T> >(label.second);});
247 }
T getParameter(std::string const &) const
bool exists(std::string const &parameterName) const
checks if a parameter exists
IsolationKeys
Enum defining isolation keys.
Definition: Isolation.h:9
std::pair< pat::IsolationKeys, edm::InputTag > IsolationLabel
char const * label
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
Definition: transform.h:11
void PATElectronProducer::setElectronMiniIso ( pat::Electron anElectron,
const pat::PackedCandidateCollection pc 
)
private

Definition at line 973 of file PATElectronProducer.cc.

References pat::getMiniPFIsolation(), reco::GsfElectron::isEE(), miniIsoParamsB_, miniIsoParamsE_, reco::LeafCandidate::polarP4(), and pat::Lepton< LeptonType >::setMiniPFIsolation().

Referenced by produce().

974 {
975  pat::PFIsolation miniiso;
976  if(anElectron.isEE())
977  miniiso = pat::getMiniPFIsolation(pc, anElectron.polarP4(),
978  miniIsoParamsE_[0], miniIsoParamsE_[1], miniIsoParamsE_[2],
979  miniIsoParamsE_[3], miniIsoParamsE_[4], miniIsoParamsE_[5],
980  miniIsoParamsE_[6], miniIsoParamsE_[7], miniIsoParamsE_[8]);
981  else
982  miniiso = pat::getMiniPFIsolation(pc, anElectron.polarP4(),
983  miniIsoParamsB_[0], miniIsoParamsB_[1], miniIsoParamsB_[2],
984  miniIsoParamsB_[3], miniIsoParamsB_[4], miniIsoParamsB_[5],
985  miniIsoParamsB_[6], miniIsoParamsB_[7], miniIsoParamsB_[8]);
986  anElectron.setMiniPFIsolation(miniiso);
987 
988 }
const PolarLorentzVector & polarP4() const final
four-momentum Lorentz vector
std::vector< double > miniIsoParamsE_
bool isEE() const
Definition: GsfElectron.h:357
std::vector< double > miniIsoParamsB_
void setMiniPFIsolation(PFIsolation const &iso)
Definition: Lepton.h:197
PFIsolation getMiniPFIsolation(const pat::PackedCandidateCollection *pfcands, const reco::Candidate::PolarLorentzVector &p4, float mindr=0.05, float maxdr=0.2, float kt_scale=10.0, float ptthresh=0.5, float deadcone_ch=0.0001, float deadcone_pu=0.01, float deadcone_ph=0.01, float deadcone_nh=0.01, float dZ_cut=0.0)

Member Data Documentation

const bool pat::PATElectronProducer::addEfficiencies_
private

Definition at line 182 of file PATElectronProducer.h.

Referenced by PATElectronProducer().

const bool pat::PATElectronProducer::addElecID_
private

Definition at line 165 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

bool pat::PATElectronProducer::addGenMatch_
private

Definition at line 80 of file PATElectronProducer.h.

Referenced by fillElectron(), fillElectron2(), PATElectronProducer(), and produce().

const bool pat::PATElectronProducer::addMVAVariables_
private

mva input variables

Definition at line 102 of file PATElectronProducer.h.

Referenced by produce().

const bool pat::PATElectronProducer::addPFClusterIso_
private

Definition at line 108 of file PATElectronProducer.h.

Referenced by produce().

const bool pat::PATElectronProducer::addPuppiIsolation_
private

Definition at line 109 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

const bool pat::PATElectronProducer::addResolutions_
private

Definition at line 185 of file PATElectronProducer.h.

Referenced by PATElectronProducer().

const edm::EDGetTokenT<reco::BeamSpot> pat::PATElectronProducer::beamLineToken_
private

Definition at line 115 of file PATElectronProducer.h.

Referenced by produce().

bool pat::PATElectronProducer::computeMiniIso_
private

Definition at line 85 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

const edm::EDGetTokenT<edm::ValueMap<float> > pat::PATElectronProducer::ecalPFClusterIsoT_
private

Definition at line 110 of file PATElectronProducer.h.

Referenced by produce().

const CaloTopology* pat::PATElectronProducer::ecalTopology_
private

Definition at line 199 of file PATElectronProducer.h.

Referenced by produce().

pat::helper::EfficiencyLoader pat::PATElectronProducer::efficiencyLoader_
private

Definition at line 183 of file PATElectronProducer.h.

Referenced by fillElectron(), fillElectron2(), PATElectronProducer(), and produce().

std::vector<NameTag> pat::PATElectronProducer::elecIDSrcs_
private

Definition at line 167 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

std::vector<edm::EDGetTokenT<edm::ValueMap<float> > > pat::PATElectronProducer::elecIDTokens_
private

Definition at line 168 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

const edm::EDGetTokenT<edm::View<reco::GsfElectron> > pat::PATElectronProducer::electronToken_
private

Definition at line 68 of file PATElectronProducer.h.

Referenced by produce().

const bool pat::PATElectronProducer::embedBasicClusters_
private

Definition at line 75 of file PATElectronProducer.h.

Referenced by fillElectron(), fillElectron2(), and produce().

bool pat::PATElectronProducer::embedGenMatch_
private

Definition at line 81 of file PATElectronProducer.h.

Referenced by fillElectron(), fillElectron2(), and produce().

const bool pat::PATElectronProducer::embedGsfElectronCore_
private

Definition at line 70 of file PATElectronProducer.h.

Referenced by fillElectron(), and fillElectron2().

const bool pat::PATElectronProducer::embedGsfTrack_
private

Definition at line 71 of file PATElectronProducer.h.

Referenced by fillElectron(), and fillElectron2().

const bool pat::PATElectronProducer::embedHighLevelSelection_
private

embed high level selection variables?

Definition at line 114 of file PATElectronProducer.h.

Referenced by produce().

const bool pat::PATElectronProducer::embedPFCandidate_
private

Definition at line 99 of file PATElectronProducer.h.

Referenced by produce().

const bool pat::PATElectronProducer::embedPflowBasicClusters_
private

Definition at line 77 of file PATElectronProducer.h.

Referenced by fillElectron(), fillElectron2(), and produce().

const bool pat::PATElectronProducer::embedPflowPreshowerClusters_
private

Definition at line 78 of file PATElectronProducer.h.

Referenced by fillElectron(), and fillElectron2().

const bool pat::PATElectronProducer::embedPflowSuperCluster_
private

Definition at line 73 of file PATElectronProducer.h.

Referenced by fillElectron(), and fillElectron2().

const bool pat::PATElectronProducer::embedPreshowerClusters_
private

Definition at line 76 of file PATElectronProducer.h.

Referenced by fillElectron(), and fillElectron2().

const bool pat::PATElectronProducer::embedRecHits_
private

Definition at line 82 of file PATElectronProducer.h.

Referenced by produce().

const bool pat::PATElectronProducer::embedSeedCluster_
private

Definition at line 74 of file PATElectronProducer.h.

Referenced by fillElectron(), and fillElectron2().

const bool pat::PATElectronProducer::embedSuperCluster_
private

Definition at line 72 of file PATElectronProducer.h.

Referenced by fillElectron(), and fillElectron2().

const bool pat::PATElectronProducer::embedTrack_
private

Definition at line 79 of file PATElectronProducer.h.

Referenced by fillElectron(), and fillElectron2().

std::vector<edm::EDGetTokenT<edm::Association<reco::GenParticleCollection> > > pat::PATElectronProducer::genMatchTokens_
private

Definition at line 91 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

bool pat::PATElectronProducer::getdBFromTrack_
private

Definition at line 117 of file PATElectronProducer.h.

Referenced by embedHighLevel().

const edm::EDGetTokenT<edm::ValueMap<float> > pat::PATElectronProducer::hcalPFClusterIsoT_
private

Definition at line 111 of file PATElectronProducer.h.

Referenced by produce().

const edm::EDGetTokenT<reco::ConversionCollection> pat::PATElectronProducer::hConversionsToken_
private

Definition at line 69 of file PATElectronProducer.h.

Referenced by produce().

IsolationLabels pat::PATElectronProducer::isoDepositLabels_
private

Definition at line 175 of file PATElectronProducer.h.

Referenced by fillElectron(), fillElectron2(), PATElectronProducer(), and produce().

std::vector<edm::EDGetTokenT<edm::ValueMap<IsoDeposit> > > pat::PATElectronProducer::isoDepositTokens_
private

Definition at line 176 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

IsolationLabels pat::PATElectronProducer::isolationValueLabels_
private

Definition at line 177 of file PATElectronProducer.h.

Referenced by fillElectron(), fillElectron2(), and PATElectronProducer().

IsolationLabels pat::PATElectronProducer::isolationValueLabelsNoPFId_
private

Definition at line 179 of file PATElectronProducer.h.

Referenced by fillElectron(), and PATElectronProducer().

std::vector<edm::EDGetTokenT<edm::ValueMap<double> > > pat::PATElectronProducer::isolationValueNoPFIdTokens_
private

Definition at line 180 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

std::vector<edm::EDGetTokenT<edm::ValueMap<double> > > pat::PATElectronProducer::isolationValueTokens_
private

Definition at line 178 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

pat::helper::MultiIsolator pat::PATElectronProducer::isolator_
private

Definition at line 173 of file PATElectronProducer.h.

Referenced by produce().

pat::helper::MultiIsolator::IsolationValuePairs pat::PATElectronProducer::isolatorTmpStorage_
private

Definition at line 174 of file PATElectronProducer.h.

Referenced by produce().

std::vector<double> pat::PATElectronProducer::miniIsoParamsB_
private

Definition at line 87 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and setElectronMiniIso().

std::vector<double> pat::PATElectronProducer::miniIsoParamsE_
private

Definition at line 86 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and setElectronMiniIso().

edm::EDGetTokenT<pat::PackedCandidateCollection> pat::PATElectronProducer::pcToken_
private

Definition at line 84 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

const edm::EDGetTokenT<edm::ValueMap<reco::PFCandidatePtr> > pat::PATElectronProducer::pfCandidateMapToken_
private

Definition at line 97 of file PATElectronProducer.h.

Referenced by produce().

const edm::EDGetTokenT<edm::ValueMap<std::vector<reco::PFCandidateRef> > > pat::PATElectronProducer::pfCandidateMultiMapToken_
private

Definition at line 98 of file PATElectronProducer.h.

Referenced by produce().

const edm::EDGetTokenT<reco::PFCandidateCollection> pat::PATElectronProducer::pfElecToken_
private

Definition at line 96 of file PATElectronProducer.h.

Referenced by produce().

const GreaterByPt<Electron> pat::PATElectronProducer::pTComparator_
private

Definition at line 171 of file PATElectronProducer.h.

Referenced by produce().

edm::EDGetTokenT<edm::ValueMap<float> > pat::PATElectronProducer::PUPPIIsolation_charged_hadrons_
private

Definition at line 190 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

edm::EDGetTokenT<edm::ValueMap<float> > pat::PATElectronProducer::PUPPIIsolation_neutral_hadrons_
private

Definition at line 191 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

edm::EDGetTokenT<edm::ValueMap<float> > pat::PATElectronProducer::PUPPIIsolation_photons_
private

Definition at line 192 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

edm::EDGetTokenT<edm::ValueMap<float> > pat::PATElectronProducer::PUPPINoLeptonsIsolation_charged_hadrons_
private

Definition at line 194 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

edm::EDGetTokenT<edm::ValueMap<float> > pat::PATElectronProducer::PUPPINoLeptonsIsolation_neutral_hadrons_
private

Definition at line 195 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

edm::EDGetTokenT<edm::ValueMap<float> > pat::PATElectronProducer::PUPPINoLeptonsIsolation_photons_
private

Definition at line 196 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

const edm::EDGetTokenT<std::vector<reco::Vertex> > pat::PATElectronProducer::pvToken_
private

Definition at line 116 of file PATElectronProducer.h.

Referenced by produce().

const edm::InputTag pat::PATElectronProducer::reducedBarrelRecHitCollection_
private

Definition at line 103 of file PATElectronProducer.h.

const edm::EDGetTokenT<EcalRecHitCollection> pat::PATElectronProducer::reducedBarrelRecHitCollectionToken_
private

Definition at line 104 of file PATElectronProducer.h.

Referenced by produce().

const edm::InputTag pat::PATElectronProducer::reducedEndcapRecHitCollection_
private

Definition at line 105 of file PATElectronProducer.h.

const edm::EDGetTokenT<EcalRecHitCollection> pat::PATElectronProducer::reducedEndcapRecHitCollectionToken_
private

Definition at line 106 of file PATElectronProducer.h.

Referenced by produce().

pat::helper::KinResolutionsLoader pat::PATElectronProducer::resolutionLoader_
private

Definition at line 186 of file PATElectronProducer.h.

Referenced by fillElectron(), fillElectron2(), PATElectronProducer(), and produce().

const bool pat::PATElectronProducer::useParticleFlow_
private

pflow specific

Definition at line 94 of file PATElectronProducer.h.

Referenced by fillElectron(), PATElectronProducer(), and produce().

const bool pat::PATElectronProducer::usePfCandidateMultiMap_
private

Definition at line 95 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

pat::PATUserDataHelper<pat::Electron> pat::PATElectronProducer::userDataHelper_
private

Definition at line 197 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

const bool pat::PATElectronProducer::useUserData_
private

Definition at line 188 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().