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<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

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
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (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 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_
 
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_
 mva input variables More...
 
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
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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 117 of file PATElectronProducer.h.

Definition at line 89 of file PATElectronProducer.h.

Definition at line 118 of file PATElectronProducer.h.

Definition at line 153 of file PATElectronProducer.h.

Definition at line 154 of file PATElectronProducer.h.

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

Definition at line 119 of file PATElectronProducer.h.

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

Definition at line 164 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_, edm::EDConsumerBase::consumes(), edm::EDConsumerBase::consumesCollector(), efficiencyLoader_, elecIDSrcs_, elecIDTokens_, Exception, edm::ParameterSet::existsAs(), genMatchTokens_, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNamesForType(), isoDepositLabels_, isoDepositTokens_, isolationValueLabels_, isolationValueLabelsNoPFId_, isolationValueNoPFIdTokens_, isolationValueTokens_, miniIsoParamsB_, miniIsoParamsE_, cscdqm::h::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
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  reducedBarrelRecHitCollection_(iConfig.getParameter<edm::InputTag>("reducedBarrelRecHitCollection")),
82  reducedEndcapRecHitCollection_(iConfig.getParameter<edm::InputTag>("reducedEndcapRecHitCollection")),
84  // PFCluster Isolation maps
85  addPFClusterIso_(iConfig.getParameter<bool>("addPFClusterIso")),
86  addPuppiIsolation_(iConfig.getParameter<bool>("addPuppiIsolation")),
89  // embed high level selection variables?
90  embedHighLevelSelection_(iConfig.getParameter<bool>("embedHighLevelSelection")),
91  beamLineToken_(consumes<reco::BeamSpot>(iConfig.getParameter<edm::InputTag>("beamLineSrc"))),
92  pvToken_(mayConsume<std::vector<reco::Vertex> >(iConfig.getParameter<edm::InputTag>("pvSrc"))),
93  addElecID_(iConfig.getParameter<bool>( "addElectronID" )),
94  pTComparator_(),
95  isolator_(iConfig.exists("userIsolation") ? iConfig.getParameter<edm::ParameterSet>("userIsolation") : edm::ParameterSet(), consumesCollector(), false) ,
96  addEfficiencies_(iConfig.getParameter<bool>("addEfficiencies")),
97  addResolutions_(iConfig.getParameter<bool>( "addResolutions" )),
98  useUserData_(iConfig.exists("userData"))
99 
100 {
101  // MC matching configurables (scheduled mode)
102 
103  if (addGenMatch_) {
104  if (iConfig.existsAs<edm::InputTag>("genParticleMatch")) {
106  }
107  else {
108  genMatchTokens_ = edm::vector_transform(iConfig.getParameter<std::vector<edm::InputTag> >( "genParticleMatch" ), [this](edm::InputTag const & tag){return consumes<edm::Association<reco::GenParticleCollection> >(tag);});
109  }
110  }
111  // resolution configurables
112  if (addResolutions_) {
114  }
115  if(addPuppiIsolation_){
116  //puppi
117  PUPPIIsolation_charged_hadrons_ = consumes<edm::ValueMap<float> >(iConfig.getParameter<edm::InputTag>("puppiIsolationChargedHadrons"));
118  PUPPIIsolation_neutral_hadrons_ = consumes<edm::ValueMap<float> >(iConfig.getParameter<edm::InputTag>("puppiIsolationNeutralHadrons"));
119  PUPPIIsolation_photons_ = consumes<edm::ValueMap<float> >(iConfig.getParameter<edm::InputTag>("puppiIsolationPhotons"));
120  //puppiNoLeptons
121  PUPPINoLeptonsIsolation_charged_hadrons_ = consumes<edm::ValueMap<float> >(iConfig.getParameter<edm::InputTag>("puppiNoLeptonsIsolationChargedHadrons"));
122  PUPPINoLeptonsIsolation_neutral_hadrons_ = consumes<edm::ValueMap<float> >(iConfig.getParameter<edm::InputTag>("puppiNoLeptonsIsolationNeutralHadrons"));
123  PUPPINoLeptonsIsolation_photons_ = consumes<edm::ValueMap<float> >(iConfig.getParameter<edm::InputTag>("puppiNoLeptonsIsolationPhotons"));
124  }
125  // electron ID configurables
126  if (addElecID_) {
127  // it might be a single electron ID
128  if (iConfig.existsAs<edm::InputTag>("electronIDSource")) {
129  elecIDSrcs_.push_back(NameTag("", iConfig.getParameter<edm::InputTag>("electronIDSource")));
130  }
131  // or there might be many of them
132  if (iConfig.existsAs<edm::ParameterSet>("electronIDSources")) {
133  // please don't configure me twice
134  if (!elecIDSrcs_.empty()){
135  throw cms::Exception("Configuration") << "PATElectronProducer: you can't specify both 'electronIDSource' and 'electronIDSources'\n";
136  }
137  // read the different electron ID names
138  edm::ParameterSet idps = iConfig.getParameter<edm::ParameterSet>("electronIDSources");
139  std::vector<std::string> names = idps.getParameterNamesForType<edm::InputTag>();
140  for (std::vector<std::string>::const_iterator it = names.begin(), ed = names.end(); it != ed; ++it) {
141  elecIDSrcs_.push_back(NameTag(*it, idps.getParameter<edm::InputTag>(*it)));
142  }
143  }
144  // but in any case at least once
145  if (elecIDSrcs_.empty()){
146  throw cms::Exception("Configuration") <<
147  "PATElectronProducer: id addElectronID is true, you must specify either:\n" <<
148  "\tInputTag electronIDSource = <someTag>\n" << "or\n" <<
149  "\tPSet electronIDSources = { \n" <<
150  "\t\tInputTag <someName> = <someTag> // as many as you want \n " <<
151  "\t}\n";
152  }
153  }
154  elecIDTokens_ = edm::vector_transform(elecIDSrcs_, [this](NameTag const & tag){return mayConsume<edm::ValueMap<float> >(tag.second);});
155  // construct resolution calculator
156 
157  // // IsoDeposit configurables
158  // if (iConfig.exists("isoDeposits")) {
159  // edm::ParameterSet depconf = iConfig.getParameter<edm::ParameterSet>("isoDeposits");
160  // if (depconf.exists("tracker")) isoDepositLabels_.push_back(std::make_pair(TrackerIso, depconf.getParameter<edm::InputTag>("tracker")));
161  // if (depconf.exists("ecal")) isoDepositLabels_.push_back(std::make_pair(ECalIso, depconf.getParameter<edm::InputTag>("ecal")));
162  // if (depconf.exists("hcal")) isoDepositLabels_.push_back(std::make_pair(HCalIso, depconf.getParameter<edm::InputTag>("hcal")));
163 
164 
165  // if (depconf.exists("user")) {
166  // std::vector<edm::InputTag> userdeps = depconf.getParameter<std::vector<edm::InputTag> >("user");
167  // std::vector<edm::InputTag>::const_iterator it = userdeps.begin(), ed = userdeps.end();
168  // int key = UserBaseIso;
169  // for ( ; it != ed; ++it, ++key) {
170  // isoDepositLabels_.push_back(std::make_pair(IsolationKeys(key), *it));
171  // }
172  // }
173  // }
174  // isoDepositTokens_ = edm::vector_transform(isoDepositLabels_, [this](std::pair<IsolationKeys,edm::InputTag> const & label){return consumes<edm::ValueMap<IsoDeposit> >(label.second);});
175 
176  // for mini-iso
177  computeMiniIso_ = iConfig.getParameter<bool>("computeMiniIso");
178  miniIsoParamsE_ = iConfig.getParameter<std::vector<double> >("miniIsoParamsE");
179  miniIsoParamsB_ = iConfig.getParameter<std::vector<double> >("miniIsoParamsB");
180  if(computeMiniIso_ && (miniIsoParamsE_.size() != 9 || miniIsoParamsB_.size() != 9)){
181  throw cms::Exception("ParameterError") << "miniIsoParams must have exactly 9 elements.\n";
182  }
183  if(computeMiniIso_)
184  pcToken_ = consumes<pat::PackedCandidateCollection>(iConfig.getParameter<edm::InputTag>("pfCandsForMiniIso"));
185 
186  // read isoDeposit labels, for direct embedding
187  readIsolationLabels(iConfig, "isoDeposits", isoDepositLabels_, isoDepositTokens_);
188  // read isolation value labels, for direct embedding
190  // read isolation value labels for non PF identified electron, for direct embedding
192  // Efficiency configurables
193  if (addEfficiencies_) {
195  }
196  // Check to see if the user wants to add user data
197  if ( useUserData_ ) {
199  }
200 
201  // consistency check
202  if (useParticleFlow_ && usePfCandidateMultiMap_) throw cms::Exception("Configuration", "usePfCandidateMultiMap not supported when useParticleFlow is set to true");
203 
204  // produces vector of muons
205  produces<std::vector<Electron> >();
206  }
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:186
edm::EDGetTokenT< edm::ValueMap< float > > PUPPIIsolation_charged_hadrons_
const bool useParticleFlow_
pflow specific
static const HistoName names[]
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_
mva input variables
const edm::EDGetTokenT< edm::ValueMap< float > > hcalPFClusterIsoT_
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< float > > > elecIDTokens_
const edm::EDGetTokenT< edm::View< reco::GsfElectron > > electronToken_
std::vector< double > miniIsoParamsB_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
Definition: ParameterSet.h:194
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?
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
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_
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_
EDGetTokenT< ProductType > mayConsume(edm::InputTag const &tag)
edm::EDGetTokenT< pat::PackedCandidateCollection > pcToken_
std::vector< NameTag > elecIDSrcs_
PATElectronProducer::~PATElectronProducer ( )
override

Definition at line 209 of file PATElectronProducer.cc.

210 {
211 }

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 1139 of file PATElectronProducer.cc.

References pat::Electron::BS2D, pat::Electron::BS3D, reco::BeamSpot::covariance3D(), DEFINE_FWK_MODULE, 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().

1147 {
1148  // Correct to PV
1149 
1150  // PV2D
1151  std::pair<bool,Measurement1D> result =
1153  GlobalVector(track->px(),
1154  track->py(),
1155  track->pz()),
1156  primaryVertex);
1157  double d0_corr = result.second.value();
1158  double d0_err = primaryVertexIsValid ? result.second.error() : -1.0;
1159  anElectron.setDB( d0_corr, d0_err, pat::Electron::PV2D);
1160 
1161 
1162  // PV3D
1163  result =
1165  GlobalVector(track->px(),
1166  track->py(),
1167  track->pz()),
1168  primaryVertex);
1169  d0_corr = result.second.value();
1170  d0_err = primaryVertexIsValid ? result.second.error() : -1.0;
1171  anElectron.setDB( d0_corr, d0_err, pat::Electron::PV3D);
1172 
1173 
1174  // Correct to beam spot
1175  // make a fake vertex out of beam spot
1176  reco::Vertex vBeamspot(beamspot.position(), beamspot.covariance3D());
1177 
1178  // BS2D
1179  result =
1181  GlobalVector(track->px(),
1182  track->py(),
1183  track->pz()),
1184  vBeamspot);
1185  d0_corr = result.second.value();
1186  d0_err = beamspotIsValid ? result.second.error() : -1.0;
1187  anElectron.setDB( d0_corr, d0_err, pat::Electron::BS2D);
1188 
1189  // BS3D
1190  result =
1192  GlobalVector(track->px(),
1193  track->py(),
1194  track->pz()),
1195  vBeamspot);
1196  d0_corr = result.second.value();
1197  d0_err = beamspotIsValid ? result.second.error() : -1.0;
1198  anElectron.setDB( d0_corr, d0_err, pat::Electron::BS3D);
1199 
1200  // PVDZ
1201  anElectron.setDB( track->dz(primaryVertex.position()), std::hypot(track->dzError(), primaryVertex.zError()), pat::Electron::PVDZ );
1202 }
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
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 987 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.

988 {
990  iDesc.setComment("PAT electron producer module");
991 
992  // input source
993  iDesc.add<edm::InputTag>("pfCandidateMap", edm::InputTag("no default"))->setComment("input collection");
994  iDesc.add<edm::InputTag>("electronSource", edm::InputTag("no default"))->setComment("input collection");
995 
996  iDesc.ifValue(edm::ParameterDescription<bool>("addPFClusterIso", false, true),
997  true >> (edm::ParameterDescription<edm::InputTag>("ecalPFClusterIsoMap", edm::InputTag("electronEcalPFClusterIsolationProducer"), true) and
998  edm::ParameterDescription<edm::InputTag>("hcalPFClusterIsoMap", edm::InputTag("electronHcalPFClusterIsolationProducer"),true)) or
999  false >> (edm::ParameterDescription<edm::InputTag>("ecalPFClusterIsoMap", edm::InputTag(""), true) and
1000  edm::ParameterDescription<edm::InputTag>("hcalPFClusterIsoMap", edm::InputTag(""),true)));
1001 
1002  iDesc.ifValue(edm::ParameterDescription<bool>("addPuppiIsolation", false, true),
1003  true >> (edm::ParameterDescription<edm::InputTag>("puppiIsolationChargedHadrons", edm::InputTag("egmElectronPUPPIIsolation","h+-DR030-BarVeto000-EndVeto001"), true) and
1004  edm::ParameterDescription<edm::InputTag>("puppiIsolationNeutralHadrons", edm::InputTag("egmElectronPUPPIIsolation","h0-DR030-BarVeto000-EndVeto000"), true) and
1005  edm::ParameterDescription<edm::InputTag>("puppiIsolationPhotons", edm::InputTag("egmElectronPUPPIIsolation","gamma-DR030-BarVeto000-EndVeto008"), true) and
1006  edm::ParameterDescription<edm::InputTag>("puppiNoLeptonsIsolationChargedHadrons", edm::InputTag("egmElectronPUPPINoLeptonsIsolation","gamma-DR030-BarVeto000-EndVeto008"), true) and
1007  edm::ParameterDescription<edm::InputTag>("puppiNoLeptonsIsolationNeutralHadrons", edm::InputTag("egmElectronPUPPINoLeptonsIsolation","gamma-DR030-BarVeto000-EndVeto008"), true) and
1008  edm::ParameterDescription<edm::InputTag>("puppiNoLeptonsIsolationPhotons", edm::InputTag("egmElectronPUPPINoLeptonsIsolation","gamma-DR030-BarVeto000-EndVeto008"), true)) or
1009  false >> edm::EmptyGroupDescription());
1010 
1011 
1012  // embedding
1013  iDesc.add<bool>("embedGsfElectronCore", true)->setComment("embed external gsf electron core");
1014  iDesc.add<bool>("embedGsfTrack", true)->setComment("embed external gsf track");
1015  iDesc.add<bool>("embedSuperCluster", true)->setComment("embed external super cluster");
1016  iDesc.add<bool>("embedPflowSuperCluster", true)->setComment("embed external super cluster");
1017  iDesc.add<bool>("embedSeedCluster", true)->setComment("embed external seed cluster");
1018  iDesc.add<bool>("embedBasicClusters", true)->setComment("embed external basic clusters");
1019  iDesc.add<bool>("embedPreshowerClusters", true)->setComment("embed external preshower clusters");
1020  iDesc.add<bool>("embedPflowBasicClusters", true)->setComment("embed external pflow basic clusters");
1021  iDesc.add<bool>("embedPflowPreshowerClusters", true)->setComment("embed external pflow preshower clusters");
1022  iDesc.add<bool>("embedTrack", false)->setComment("embed external track");
1023  iDesc.add<bool>("embedRecHits", true)->setComment("embed external RecHits");
1024 
1025  // pf specific parameters
1026  iDesc.add<edm::InputTag>("pfElectronSource", edm::InputTag("pfElectrons"))->setComment("particle flow input collection");
1027  auto && usePfCandidateMultiMap = edm::ParameterDescription<bool>("usePfCandidateMultiMap", false, true);
1028  usePfCandidateMultiMap.setComment("take ParticleFlow candidates from pfCandidateMultiMap instead of matching to pfElectrons by Gsf track reference");
1030  true >> edm::ParameterDescription<edm::InputTag>("pfCandidateMultiMap", true) or
1031  false >> edm::EmptyGroupDescription());
1032  iDesc.add<bool>("useParticleFlow", false)->setComment("whether to use particle flow or not");
1033  iDesc.add<bool>("embedPFCandidate", false)->setComment("embed external particle flow object");
1034 
1035  // MC matching configurables
1036  iDesc.add<bool>("addGenMatch", true)->setComment("add MC matching");
1037  iDesc.add<bool>("embedGenMatch", false)->setComment("embed MC matched MC information");
1038  std::vector<edm::InputTag> emptySourceVector;
1039  iDesc.addNode( edm::ParameterDescription<edm::InputTag>("genParticleMatch", edm::InputTag(), true) xor
1040  edm::ParameterDescription<std::vector<edm::InputTag> >("genParticleMatch", emptySourceVector, true)
1041  )->setComment("input with MC match information");
1042 
1043  // electron ID configurables
1044  iDesc.add<bool>("addElectronID",true)->setComment("add electron ID variables");
1045  edm::ParameterSetDescription electronIDSourcesPSet;
1046  electronIDSourcesPSet.setAllowAnything();
1047  iDesc.addNode( edm::ParameterDescription<edm::InputTag>("electronIDSource", edm::InputTag(), true) xor
1048  edm::ParameterDescription<edm::ParameterSetDescription>("electronIDSources", electronIDSourcesPSet, true)
1049  )->setComment("input with electron ID variables");
1050 
1051 
1052  // mini-iso
1053  iDesc.add<bool>("computeMiniIso", false)->setComment("whether or not to compute and store electron mini-isolation");
1054  iDesc.add<edm::InputTag>("pfCandsForMiniIso", edm::InputTag("packedPFCandidates"))->setComment("collection to use to compute mini-iso");
1055  iDesc.add<std::vector<double> >("miniIsoParamsE", std::vector<double>())->setComment("mini-iso parameters to use for endcap electrons");
1056  iDesc.add<std::vector<double> >("miniIsoParamsB", std::vector<double>())->setComment("mini-iso parameters to use for barrel electrons");
1057 
1058  // IsoDeposit configurables
1059  edm::ParameterSetDescription isoDepositsPSet;
1060  isoDepositsPSet.addOptional<edm::InputTag>("tracker");
1061  isoDepositsPSet.addOptional<edm::InputTag>("ecal");
1062  isoDepositsPSet.addOptional<edm::InputTag>("hcal");
1063  isoDepositsPSet.addOptional<edm::InputTag>("pfAllParticles");
1064  isoDepositsPSet.addOptional<edm::InputTag>("pfChargedHadrons");
1065  isoDepositsPSet.addOptional<edm::InputTag>("pfChargedAll");
1066  isoDepositsPSet.addOptional<edm::InputTag>("pfPUChargedHadrons");
1067  isoDepositsPSet.addOptional<edm::InputTag>("pfNeutralHadrons");
1068  isoDepositsPSet.addOptional<edm::InputTag>("pfPhotons");
1069  isoDepositsPSet.addOptional<std::vector<edm::InputTag> >("user");
1070  iDesc.addOptional("isoDeposits", isoDepositsPSet);
1071 
1072  // isolation values configurables
1073  edm::ParameterSetDescription isolationValuesPSet;
1074  isolationValuesPSet.addOptional<edm::InputTag>("tracker");
1075  isolationValuesPSet.addOptional<edm::InputTag>("ecal");
1076  isolationValuesPSet.addOptional<edm::InputTag>("hcal");
1077  isolationValuesPSet.addOptional<edm::InputTag>("pfAllParticles");
1078  isolationValuesPSet.addOptional<edm::InputTag>("pfChargedHadrons");
1079  isolationValuesPSet.addOptional<edm::InputTag>("pfChargedAll");
1080  isolationValuesPSet.addOptional<edm::InputTag>("pfPUChargedHadrons");
1081  isolationValuesPSet.addOptional<edm::InputTag>("pfNeutralHadrons");
1082  isolationValuesPSet.addOptional<edm::InputTag>("pfPhotons");
1083  isolationValuesPSet.addOptional<std::vector<edm::InputTag> >("user");
1084  iDesc.addOptional("isolationValues", isolationValuesPSet);
1085 
1086  // isolation values configurables
1087  edm::ParameterSetDescription isolationValuesNoPFIdPSet;
1088  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("tracker");
1089  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("ecal");
1090  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("hcal");
1091  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("pfAllParticles");
1092  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("pfChargedHadrons");
1093  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("pfChargedAll");
1094  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("pfPUChargedHadrons");
1095  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("pfNeutralHadrons");
1096  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("pfPhotons");
1097  isolationValuesNoPFIdPSet.addOptional<std::vector<edm::InputTag> >("user");
1098  iDesc.addOptional("isolationValuesNoPFId", isolationValuesNoPFIdPSet);
1099 
1100  // Efficiency configurables
1101  edm::ParameterSetDescription efficienciesPSet;
1102  efficienciesPSet.setAllowAnything(); // TODO: the pat helper needs to implement a description.
1103  iDesc.add("efficiencies", efficienciesPSet);
1104  iDesc.add<bool>("addEfficiencies", false);
1105 
1106  // Check to see if the user wants to add user data
1107  edm::ParameterSetDescription userDataPSet;
1109  iDesc.addOptional("userData", userDataPSet);
1110 
1111 
1112  // electron shapes
1113  iDesc.add<bool>("addElectronShapes", true);
1114  iDesc.add<edm::InputTag>("reducedBarrelRecHitCollection", edm::InputTag("reducedEcalRecHitsEB"));
1115  iDesc.add<edm::InputTag>("reducedEndcapRecHitCollection", edm::InputTag("reducedEcalRecHitsEE"));
1116 
1117  edm::ParameterSetDescription isolationPSet;
1118  isolationPSet.setAllowAnything(); // TODO: the pat helper needs to implement a description.
1119  iDesc.add("userIsolation", isolationPSet);
1120 
1121  // Resolution configurables
1123 
1124  iDesc.add<bool>("embedHighLevelSelection", true)->setComment("embed high level selection");
1125  edm::ParameterSetDescription highLevelPSet;
1126  highLevelPSet.setAllowAnything();
1127  iDesc.addNode( edm::ParameterDescription<edm::InputTag>("beamLineSrc", edm::InputTag(), true)
1128  )->setComment("input with high level selection");
1130  )->setComment("input with high level selection");
1131 
1132  descriptions.add("PATElectronProducer", iDesc);
1133 
1134 }
void setComment(std::string const &value)
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
ParameterDescriptionNode * ifValue(ParameterDescription< T > const &switchParameter, std::unique_ptr< ParameterDescriptionCases< T > > cases)
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 790 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().

798  {
799 
800  //COLIN: might want to use the PFCandidate 4-mom. Which one is in use now?
801  // if (useParticleFlow_)
802  // aMuon.setP4( aMuon.pfCandidateRef()->p4() );
803 
804  //COLIN:
805  //In the embedding case, the reference cannot be used to look into a value map.
806  //therefore, one has to had the PFCandidateRef to this function, which becomes a bit
807  //too much specific.
808 
809  // in fact, this function needs a baseref or ptr for genmatch
810  // and a baseref or ptr for isodeposits and isolationvalues.
811  // baseref is not needed
812  // the ptrForIsolation and ptrForMatching should be defined upstream.
813 
814  // is the concrete elecRef needed for the efficiency loader? what is this loader?
815  // how can we make it compatible with the particle flow electrons?
816 
817  if (embedGsfElectronCore_) anElectron.embedGsfElectronCore();
818  if (embedGsfTrack_) anElectron.embedGsfTrack();
819  if (embedSuperCluster_) anElectron.embedSuperCluster();
820  if (embedPflowSuperCluster_) anElectron.embedPflowSuperCluster();
821  if (embedSeedCluster_) anElectron.embedSeedCluster();
822  if (embedBasicClusters_) anElectron.embedBasicClusters();
823  if (embedPreshowerClusters_) anElectron.embedPreshowerClusters();
824  if (embedPflowBasicClusters_ ) anElectron.embedPflowBasicClusters();
825  if (embedPflowPreshowerClusters_ ) anElectron.embedPflowPreshowerClusters();
826  if (embedTrack_) anElectron.embedTrack();
827 
828  // store the match to the generated final state muons
829  if (addGenMatch_) {
830  for(size_t i = 0, n = genMatches.size(); i < n; ++i) {
831  if(useParticleFlow_) {
832  reco::GenParticleRef genElectron = (*genMatches[i])[anElectron.pfCandidateRef()];
833  anElectron.addGenParticleRef(genElectron);
834  }
835  else {
836  reco::GenParticleRef genElectron = (*genMatches[i])[elecRef];
837  anElectron.addGenParticleRef(genElectron);
838  }
839  }
840  if (embedGenMatch_) anElectron.embedGenParticle();
841  }
842 
843  if (efficiencyLoader_.enabled()) {
844  efficiencyLoader_.setEfficiencies( anElectron, elecRef );
845  }
846 
847  if (resolutionLoader_.enabled()) {
848  resolutionLoader_.setResolutions(anElectron);
849  }
850 
851  for (size_t j = 0, nd = deposits.size(); j < nd; ++j) {
852  if(useParticleFlow_) {
853 
854  reco::PFCandidateRef pfcandref = anElectron.pfCandidateRef();
855  assert(!pfcandref.isNull());
856  reco::CandidatePtr source = pfcandref->sourceCandidatePtr(0);
857  anElectron.setIsoDeposit(isoDepositLabels_[j].first,
858  (*deposits[j])[source]);
859  }
860  else
861  anElectron.setIsoDeposit(isoDepositLabels_[j].first,
862  (*deposits[j])[elecRef]);
863  }
864 
865  for (size_t j = 0; j<isolationValues.size(); ++j) {
866  if(useParticleFlow_) {
867  reco::CandidatePtr source = anElectron.pfCandidateRef()->sourceCandidatePtr(0);
868  anElectron.setIsolation(isolationValueLabels_[j].first,
869  (*isolationValues[j])[source]);
870  }
871  else
872  if(pfId){
873  anElectron.setIsolation(isolationValueLabels_[j].first,(*isolationValues[j])[elecRef]);
874  }
875  }
876 
877  //for electrons not identified as PF electrons
878  for (size_t j = 0; j<isolationValuesNoPFId.size(); ++j) {
879  if( !pfId) {
880  anElectron.setIsolation(isolationValueLabelsNoPFId_[j].first,(*isolationValuesNoPFId[j])[elecRef]);
881  }
882  }
883 
884 }
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:250
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:43
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 886 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().

892  {
893 
894  //COLIN/Florian: use the PFCandidate 4-mom.
895  anElectron.setEcalDrivenMomentum(anElectron.p4()) ;
896  anElectron.setP4( anElectron.pfCandidateRef()->p4() );
897 
898 
899  // is the concrete elecRef needed for the efficiency loader? what is this loader?
900  // how can we make it compatible with the particle flow electrons?
901 
903  if (embedGsfTrack_) anElectron.embedGsfTrack();
904  if (embedSuperCluster_) anElectron.embedSuperCluster();
906  if (embedSeedCluster_) anElectron.embedSeedCluster();
907  if (embedBasicClusters_) anElectron.embedBasicClusters();
911  if (embedTrack_) anElectron.embedTrack();
912 
913  // store the match to the generated final state muons
914 
915  if (addGenMatch_) {
916  for(size_t i = 0, n = genMatches.size(); i < n; ++i) {
917  reco::GenParticleRef genElectron = (*genMatches[i])[candPtrForGenMatch];
918  anElectron.addGenParticleRef(genElectron);
919  }
920  if (embedGenMatch_) anElectron.embedGenParticle();
921  }
922 
923  //COLIN what's this? does it have to be GsfElectron specific?
924  if (efficiencyLoader_.enabled()) {
925  efficiencyLoader_.setEfficiencies( anElectron, candPtrForLoader );
926  }
927 
928  if (resolutionLoader_.enabled()) {
929  resolutionLoader_.setResolutions(anElectron);
930  }
931 
932  for (size_t j = 0, nd = deposits.size(); j < nd; ++j) {
936  deposits[j]->contains(candPtrForGenMatch.id())) {
937  anElectron.setIsoDeposit(isoDepositLabels_[j].first,
938  (*deposits[j])[candPtrForGenMatch]);
939  }
940  else if (deposits[j]->contains(candPtrForIsolation.id())) {
941  anElectron.setIsoDeposit(isoDepositLabels_[j].first,
942  (*deposits[j])[candPtrForIsolation]);
943  }
944  else {
945  anElectron.setIsoDeposit(isoDepositLabels_[j].first,
946  (*deposits[j])[candPtrForIsolation->sourceCandidatePtr(0)]);
947  }
948  }
949 
950  for (size_t j = 0; j<isolationValues.size(); ++j) {
951  if( isolationValueLabels_[j].first==pat::TrackIso ||
954  isolationValues[j]->contains(candPtrForGenMatch.id())) {
955  anElectron.setIsolation(isolationValueLabels_[j].first,
956  (*isolationValues[j])[candPtrForGenMatch]);
957  }
958  else if (isolationValues[j]->contains(candPtrForIsolation.id())) {
959  anElectron.setIsolation(isolationValueLabels_[j].first,
960  (*isolationValues[j])[candPtrForIsolation]);
961  }
962  else {
963  anElectron.setIsolation(isolationValueLabels_[j].first,
964  (*isolationValues[j])[candPtrForIsolation->sourceCandidatePtr(0)]);
965  }
966  }
967 }
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:220
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 214 of file PATElectronProducer.cc.

References IPTools::absoluteImpactParameter3D(), addElecID_, addGenMatch_, 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_, electrons_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, electrons_cff::ids, training_settings::idx, diffTreeTool::index, 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::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::setEcalPFClusterIso(), pat::Electron::setElectronIDs(), setElectronMiniIso(), pat::Electron::setHcalPFClusterIso(), 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(), edm::SortedCollection< T, SORT >::size(), edm::SortedCollection< T, SORT >::sort(), HiIsolationCommonParameters_cff::track, groupFilesInBlocks::tt, tier0::unique(), useParticleFlow_, usePfCandidateMultiMap_, userDataHelper_, and useUserData_.

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

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

Referenced by PATElectronProducer().

206  {
207 
208  labels.clear();
209 
210  if (iConfig.exists( psetName )) {
211  edm::ParameterSet depconf
212  = iConfig.getParameter<edm::ParameterSet>(psetName);
213 
214  if (depconf.exists("tracker")) labels.push_back(std::make_pair(pat::TrackIso, depconf.getParameter<edm::InputTag>("tracker")));
215  if (depconf.exists("ecal")) labels.push_back(std::make_pair(pat::EcalIso, depconf.getParameter<edm::InputTag>("ecal")));
216  if (depconf.exists("hcal")) labels.push_back(std::make_pair(pat::HcalIso, depconf.getParameter<edm::InputTag>("hcal")));
217  if (depconf.exists("pfAllParticles")) {
218  labels.push_back(std::make_pair(pat::PfAllParticleIso, depconf.getParameter<edm::InputTag>("pfAllParticles")));
219  }
220  if (depconf.exists("pfChargedHadrons")) {
221  labels.push_back(std::make_pair(pat::PfChargedHadronIso, depconf.getParameter<edm::InputTag>("pfChargedHadrons")));
222  }
223  if (depconf.exists("pfChargedAll")) {
224  labels.push_back(std::make_pair(pat::PfChargedAllIso, depconf.getParameter<edm::InputTag>("pfChargedAll")));
225  }
226  if (depconf.exists("pfPUChargedHadrons")) {
227  labels.push_back(std::make_pair(pat::PfPUChargedHadronIso, depconf.getParameter<edm::InputTag>("pfPUChargedHadrons")));
228  }
229  if (depconf.exists("pfNeutralHadrons")) {
230  labels.push_back(std::make_pair(pat::PfNeutralHadronIso, depconf.getParameter<edm::InputTag>("pfNeutralHadrons")));
231  }
232  if (depconf.exists("pfPhotons")) {
233  labels.push_back(std::make_pair(pat::PfGammaIso, depconf.getParameter<edm::InputTag>("pfPhotons")));
234  }
235  if (depconf.exists("user")) {
236  std::vector<edm::InputTag> userdeps = depconf.getParameter<std::vector<edm::InputTag> >("user");
237  std::vector<edm::InputTag>::const_iterator it = userdeps.begin(), ed = userdeps.end();
239  for ( ; it != ed; ++it, ++key) {
240  labels.push_back(std::make_pair(pat::IsolationKeys(key), *it));
241  }
242  }
243  }
244  tokens = edm::vector_transform(labels, [this](IsolationLabel const & label){return consumes<edm::ValueMap<T> >(label.second);});
245 }
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
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::pair< pat::IsolationKeys, edm::InputTag > IsolationLabel
void PATElectronProducer::setElectronMiniIso ( pat::Electron anElectron,
const pat::PackedCandidateCollection pc 
)
private

Definition at line 969 of file PATElectronProducer.cc.

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

Referenced by produce().

970 {
971  pat::PFIsolation miniiso;
972  if(anElectron.isEE())
973  miniiso = pat::getMiniPFIsolation(pc, anElectron.p4(),
974  miniIsoParamsE_[0], miniIsoParamsE_[1], miniIsoParamsE_[2],
975  miniIsoParamsE_[3], miniIsoParamsE_[4], miniIsoParamsE_[5],
976  miniIsoParamsE_[6], miniIsoParamsE_[7], miniIsoParamsE_[8]);
977  else
978  miniiso = pat::getMiniPFIsolation(pc, anElectron.p4(),
979  miniIsoParamsB_[0], miniIsoParamsB_[1], miniIsoParamsB_[2],
980  miniIsoParamsB_[3], miniIsoParamsB_[4], miniIsoParamsB_[5],
981  miniIsoParamsB_[6], miniIsoParamsB_[7], miniIsoParamsB_[8]);
982  anElectron.setMiniPFIsolation(miniiso);
983 
984 }
const LorentzVector & p4(P4Kind kind) const
Definition: GsfElectron.cc:225
std::vector< double > miniIsoParamsE_
bool isEE() const
Definition: GsfElectron.h:353
std::vector< double > miniIsoParamsB_
void setMiniPFIsolation(PFIsolation const &iso)
Definition: Lepton.h:197
PFIsolation getMiniPFIsolation(const pat::PackedCandidateCollection *pfcands, const math::XYZTLorentzVector &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 180 of file PATElectronProducer.h.

Referenced by PATElectronProducer().

const bool pat::PATElectronProducer::addElecID_
private

Definition at line 163 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::addPFClusterIso_
private

Definition at line 107 of file PATElectronProducer.h.

Referenced by produce().

const bool pat::PATElectronProducer::addPuppiIsolation_
private

Definition at line 108 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

const bool pat::PATElectronProducer::addResolutions_
private

Definition at line 183 of file PATElectronProducer.h.

Referenced by PATElectronProducer().

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

Definition at line 114 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 109 of file PATElectronProducer.h.

Referenced by produce().

const CaloTopology* pat::PATElectronProducer::ecalTopology_
private

Definition at line 197 of file PATElectronProducer.h.

Referenced by produce().

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

Definition at line 181 of file PATElectronProducer.h.

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

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

Definition at line 165 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

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

Definition at line 166 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 113 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().

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

Definition at line 110 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 173 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 174 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

IsolationLabels pat::PATElectronProducer::isolationValueLabels_
private

Definition at line 175 of file PATElectronProducer.h.

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

IsolationLabels pat::PATElectronProducer::isolationValueLabelsNoPFId_
private

Definition at line 177 of file PATElectronProducer.h.

Referenced by fillElectron(), and PATElectronProducer().

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

Definition at line 178 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

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

Definition at line 176 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

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

Definition at line 171 of file PATElectronProducer.h.

Referenced by produce().

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

Definition at line 172 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 169 of file PATElectronProducer.h.

Referenced by produce().

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

Definition at line 188 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

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

Definition at line 189 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

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

Definition at line 190 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

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

Definition at line 192 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

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

Definition at line 193 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

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

Definition at line 194 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

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

Definition at line 115 of file PATElectronProducer.h.

Referenced by produce().

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

mva input variables

Definition at line 102 of file PATElectronProducer.h.

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

Definition at line 103 of file PATElectronProducer.h.

Referenced by produce().

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

Definition at line 104 of file PATElectronProducer.h.

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

Definition at line 105 of file PATElectronProducer.h.

Referenced by produce().

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

Definition at line 184 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 195 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

const bool pat::PATElectronProducer::useUserData_
private

Definition at line 186 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().