CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 PATElectronProducer (const edm::ParameterSet &iConfig)
 
virtual void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 ~PATElectronProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Types

typedef edm::RefToBase
< reco::GsfElectron
ElectronBaseRef
 
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::InputTag
IsolationLabel
 
typedef std::vector
< IsolationLabel
IsolationLabels
 
typedef std::vector
< edm::Handle< edm::ValueMap
< double > > > 
IsolationValueMaps
 
typedef std::pair< std::string,
edm::InputTag
NameTag
 

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)
 

Private Attributes

bool addEfficiencies_
 
bool addElecID_
 
bool addGenMatch_
 
bool addResolutions_
 
edm::EDGetTokenT< reco::BeamSpotbeamLineToken_
 
const CaloTopologyecalTopology_
 
pat::helper::EfficiencyLoader efficiencyLoader_
 
std::vector< NameTagelecIDSrcs_
 
std::vector< edm::EDGetTokenT
< edm::ValueMap< float > > > 
elecIDTokens_
 
edm::EDGetTokenT< edm::View
< reco::GsfElectron > > 
electronToken_
 
bool embedBasicClusters_
 
bool embedGenMatch_
 
bool embedGsfElectronCore_
 
bool embedGsfTrack_
 
bool embedHighLevelSelection_
 embed high level selection variables? More...
 
bool embedPFCandidate_
 
bool embedPflowBasicClusters_
 
bool embedPflowPreshowerClusters_
 
bool embedPflowSuperCluster_
 
bool embedPreshowerClusters_
 
bool embedRecHits_
 
bool embedSeedCluster_
 
bool embedSuperCluster_
 
bool embedTrack_
 
std::vector< edm::EDGetTokenT
< edm::Association
< reco::GenParticleCollection > > > 
genMatchTokens_
 
edm::EDGetTokenT
< reco::ConversionCollection
hConversionsToken_
 
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_
 
edm::EDGetTokenT
< edm::ValueMap
< reco::PFCandidatePtr > > 
pfCandidateMapToken_
 
edm::EDGetTokenT
< reco::PFCandidateCollection
pfElecToken_
 
GreaterByPt< ElectronpTComparator_
 
edm::EDGetTokenT< std::vector
< reco::Vertex > > 
pvToken_
 
edm::InputTag reducedBarrelRecHitCollection_
 mva input variables More...
 
edm::EDGetTokenT
< EcalRecHitCollection
reducedBarrelRecHitCollectionToken_
 
edm::InputTag reducedEndcapRecHitCollection_
 
edm::EDGetTokenT
< EcalRecHitCollection
reducedEndcapRecHitCollectionToken_
 
pat::helper::KinResolutionsLoader resolutionLoader_
 
bool useParticleFlow_
 pflow specific More...
 
bool usePV_
 
pat::PATUserDataHelper
< pat::Electron
userDataHelper_
 
bool useUserData_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 106 of file PATElectronProducer.h.

Definition at line 84 of file PATElectronProducer.h.

Definition at line 107 of file PATElectronProducer.h.

Definition at line 139 of file PATElectronProducer.h.

Definition at line 140 of file PATElectronProducer.h.

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

Definition at line 108 of file PATElectronProducer.h.

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

Definition at line 150 of file PATElectronProducer.h.

Constructor & Destructor Documentation

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

Definition at line 50 of file PATElectronProducer.cc.

References addGenMatch_, edm::EDConsumerBase::consumes(), electronToken_, embedBasicClusters_, embedGenMatch_, embedGsfElectronCore_, embedGsfTrack_, embedPFCandidate_, embedPflowBasicClusters_, embedPflowPreshowerClusters_, embedPflowSuperCluster_, embedPreshowerClusters_, embedRecHits_, embedSeedCluster_, embedSuperCluster_, embedTrack_, edm::ParameterSet::existsAs(), genMatchTokens_, edm::ParameterSet::getParameter(), hConversionsToken_, pfCandidateMapToken_, pfElecToken_, reducedBarrelRecHitCollection_, reducedBarrelRecHitCollectionToken_, reducedEndcapRecHitCollection_, reducedEndcapRecHitCollectionToken_, GlobalPosition_Frontier_DevDB_cff::tag, useParticleFlow_, and edm::vector_transform().

50  :
51  isolator_(iConfig.exists("userIsolation") ? iConfig.getParameter<edm::ParameterSet>("userIsolation") : edm::ParameterSet(), consumesCollector(), false) ,
52  useUserData_(iConfig.exists("userData"))
53 {
54  // general configurables
55  electronToken_ = consumes<edm::View<reco::GsfElectron> >(iConfig.getParameter<edm::InputTag>( "electronSource" ));
56  hConversionsToken_ = consumes<reco::ConversionCollection>(edm::InputTag("allConversions"));
57  embedGsfElectronCore_ = iConfig.getParameter<bool>( "embedGsfElectronCore" );
58  embedGsfTrack_ = iConfig.getParameter<bool>( "embedGsfTrack" );
59  embedSuperCluster_ = iConfig.getParameter<bool> ( "embedSuperCluster" );
60  embedPflowSuperCluster_ = iConfig.getParameter<bool> ( "embedPflowSuperCluster" );
61  embedSeedCluster_ = iConfig.getParameter<bool>( "embedSeedCluster" );
62  embedBasicClusters_ = iConfig.getParameter<bool>( "embedBasicClusters" );
63  embedPreshowerClusters_ = iConfig.getParameter<bool>( "embedPreshowerClusters" );
64  embedPflowBasicClusters_ = iConfig.getParameter<bool>( "embedPflowBasicClusters" );
65  embedPflowPreshowerClusters_ = iConfig.getParameter<bool>( "embedPflowPreshowerClusters" );
66  embedTrack_ = iConfig.getParameter<bool>( "embedTrack" );
67  embedRecHits_ = iConfig.getParameter<bool>( "embedRecHits" );
68  // pflow configurables
69  pfElecToken_ = consumes<reco::PFCandidateCollection>(iConfig.getParameter<edm::InputTag>( "pfElectronSource" ));
70  pfCandidateMapToken_ = mayConsume<edm::ValueMap<reco::PFCandidatePtr> >(iConfig.getParameter<edm::InputTag>( "pfCandidateMap" ));
71  useParticleFlow_ = iConfig.getParameter<bool>( "useParticleFlow" );
72  embedPFCandidate_ = iConfig.getParameter<bool>( "embedPFCandidate" );
73  // mva input variables
74  reducedBarrelRecHitCollection_ = iConfig.getParameter<edm::InputTag>("reducedBarrelRecHitCollection");
75  reducedBarrelRecHitCollectionToken_ = mayConsume<EcalRecHitCollection>(reducedBarrelRecHitCollection_);
76  reducedEndcapRecHitCollection_ = iConfig.getParameter<edm::InputTag>("reducedEndcapRecHitCollection");
77  reducedEndcapRecHitCollectionToken_ = mayConsume<EcalRecHitCollection>(reducedEndcapRecHitCollection_);
78  // MC matching configurables (scheduled mode)
79  addGenMatch_ = iConfig.getParameter<bool>( "addGenMatch" );
80  if (addGenMatch_) {
81  embedGenMatch_ = iConfig.getParameter<bool>( "embedGenMatch" );
82  if (iConfig.existsAs<edm::InputTag>("genParticleMatch")) {
84  }
85  else {
86  genMatchTokens_ = edm::vector_transform(iConfig.getParameter<std::vector<edm::InputTag> >( "genParticleMatch" ), [this](edm::InputTag const & tag){return consumes<edm::Association<reco::GenParticleCollection> >(tag);});
87  }
88  }
89  // resolution configurables
90  addResolutions_ = iConfig.getParameter<bool>( "addResolutions" );
91  if (addResolutions_) {
93  }
94  // electron ID configurables
95  addElecID_ = iConfig.getParameter<bool>( "addElectronID" );
96  if (addElecID_) {
97  // it might be a single electron ID
98  if (iConfig.existsAs<edm::InputTag>("electronIDSource")) {
99  elecIDSrcs_.push_back(NameTag("", iConfig.getParameter<edm::InputTag>("electronIDSource")));
100  }
101  // or there might be many of them
102  if (iConfig.existsAs<edm::ParameterSet>("electronIDSources")) {
103  // please don't configure me twice
104  if (!elecIDSrcs_.empty()){
105  throw cms::Exception("Configuration") << "PATElectronProducer: you can't specify both 'electronIDSource' and 'electronIDSources'\n";
106  }
107  // read the different electron ID names
108  edm::ParameterSet idps = iConfig.getParameter<edm::ParameterSet>("electronIDSources");
109  std::vector<std::string> names = idps.getParameterNamesForType<edm::InputTag>();
110  for (std::vector<std::string>::const_iterator it = names.begin(), ed = names.end(); it != ed; ++it) {
111  elecIDSrcs_.push_back(NameTag(*it, idps.getParameter<edm::InputTag>(*it)));
112  }
113  }
114  // but in any case at least once
115  if (elecIDSrcs_.empty()){
116  throw cms::Exception("Configuration") <<
117  "PATElectronProducer: id addElectronID is true, you must specify either:\n" <<
118  "\tInputTag electronIDSource = <someTag>\n" << "or\n" <<
119  "\tPSet electronIDSources = { \n" <<
120  "\t\tInputTag <someName> = <someTag> // as many as you want \n " <<
121  "\t}\n";
122  }
123  }
124  elecIDTokens_ = edm::vector_transform(elecIDSrcs_, [this](NameTag const & tag){return mayConsume<edm::ValueMap<float> >(tag.second);});
125  // construct resolution calculator
126 
127  // // IsoDeposit configurables
128  // if (iConfig.exists("isoDeposits")) {
129  // edm::ParameterSet depconf = iConfig.getParameter<edm::ParameterSet>("isoDeposits");
130  // if (depconf.exists("tracker")) isoDepositLabels_.push_back(std::make_pair(TrackerIso, depconf.getParameter<edm::InputTag>("tracker")));
131  // if (depconf.exists("ecal")) isoDepositLabels_.push_back(std::make_pair(ECalIso, depconf.getParameter<edm::InputTag>("ecal")));
132  // if (depconf.exists("hcal")) isoDepositLabels_.push_back(std::make_pair(HCalIso, depconf.getParameter<edm::InputTag>("hcal")));
133 
134 
135  // if (depconf.exists("user")) {
136  // std::vector<edm::InputTag> userdeps = depconf.getParameter<std::vector<edm::InputTag> >("user");
137  // std::vector<edm::InputTag>::const_iterator it = userdeps.begin(), ed = userdeps.end();
138  // int key = UserBaseIso;
139  // for ( ; it != ed; ++it, ++key) {
140  // isoDepositLabels_.push_back(std::make_pair(IsolationKeys(key), *it));
141  // }
142  // }
143  // }
144  // isoDepositTokens_ = edm::vector_transform(isoDepositLabels_, [this](std::pair<IsolationKeys,edm::InputTag> const & label){return consumes<edm::ValueMap<IsoDeposit> >(label.second);});
145 
146  // read isoDeposit labels, for direct embedding
147  readIsolationLabels(iConfig, "isoDeposits", isoDepositLabels_, isoDepositTokens_);
148  // read isolation value labels, for direct embedding
150  // read isolation value labels for non PF identified electron, for direct embedding
152  // Efficiency configurables
153  addEfficiencies_ = iConfig.getParameter<bool>("addEfficiencies");
154  if (addEfficiencies_) {
156  }
157  // Check to see if the user wants to add user data
158  if ( useUserData_ ) {
160  }
161  // embed high level selection variables?
162  embedHighLevelSelection_ = iConfig.getParameter<bool>("embedHighLevelSelection");
163  beamLineToken_ = consumes<reco::BeamSpot>(iConfig.getParameter<edm::InputTag>("beamLineSrc"));
164  if ( embedHighLevelSelection_ ) {
165  usePV_ = iConfig.getParameter<bool>("usePV");
166  pvToken_ = consumes<std::vector<reco::Vertex> >(iConfig.getParameter<edm::InputTag>("pvSrc"));
167  }
168  // produces vector of muons
169  produces<std::vector<Electron> >();
170  }
T getParameter(std::string const &) const
Assists in assimilating all pat::UserData into pat objects.
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:184
static const HistoName names[]
edm::EDGetTokenT< edm::View< reco::GsfElectron > > electronToken_
bool exists(std::string const &parameterName) const
checks if a parameter exists
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_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
Definition: ParameterSet.h:192
pat::helper::MultiIsolator isolator_
edm::EDGetTokenT< EcalRecHitCollection > reducedEndcapRecHitCollectionToken_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
std::vector< edm::EDGetTokenT< edm::Association< reco::GenParticleCollection > > > genMatchTokens_
edm::InputTag reducedEndcapRecHitCollection_
std::vector< edm::EDGetTokenT< edm::ValueMap< IsoDeposit > > > isoDepositTokens_
edm::InputTag reducedBarrelRecHitCollection_
mva input variables
edm::EDGetTokenT< reco::ConversionCollection > hConversionsToken_
bool embedHighLevelSelection_
embed high level selection variables?
std::pair< std::string, edm::InputTag > NameTag
edm::EDGetTokenT< EcalRecHitCollection > reducedBarrelRecHitCollectionToken_
std::vector< edm::EDGetTokenT< edm::ValueMap< double > > > isolationValueNoPFIdTokens_
pat::helper::EfficiencyLoader efficiencyLoader_
pat::PATUserDataHelper< pat::Electron > userDataHelper_
bool useParticleFlow_
pflow specific
IsolationLabels isolationValueLabelsNoPFId_
edm::EDGetTokenT< edm::ValueMap< reco::PFCandidatePtr > > pfCandidateMapToken_
IsolationLabels isolationValueLabels_
pat::helper::KinResolutionsLoader resolutionLoader_
void readIsolationLabels(const edm::ParameterSet &iConfig, const char *psetName, IsolationLabels &labels, std::vector< edm::EDGetTokenT< edm::ValueMap< T > > > &tokens)
std::vector< edm::EDGetTokenT< edm::ValueMap< double > > > isolationValueTokens_
edm::EDGetTokenT< reco::BeamSpot > beamLineToken_
edm::EDGetTokenT< reco::PFCandidateCollection > pfElecToken_
edm::EDGetTokenT< std::vector< reco::Vertex > > pvToken_
std::vector< NameTag > elecIDSrcs_
PATElectronProducer::~PATElectronProducer ( )

Definition at line 173 of file PATElectronProducer.cc.

174 {
175 }

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

References pat::Electron::BS2D, pat::Electron::BS3D, reco::BeamSpot::covariance3D(), reco::BeamSpot::position(), pat::Electron::PV2D, pat::Electron::PV3D, query::result, pat::Electron::setDB(), IPTools::signedImpactParameter3D(), and IPTools::signedTransverseImpactParameter().

Referenced by produce().

1017 {
1018  // Correct to PV
1019 
1020  // PV2D
1021  std::pair<bool,Measurement1D> result =
1023  GlobalVector(track->px(),
1024  track->py(),
1025  track->pz()),
1026  primaryVertex);
1027  double d0_corr = result.second.value();
1028  double d0_err = primaryVertexIsValid ? result.second.error() : -1.0;
1029  anElectron.setDB( d0_corr, d0_err, pat::Electron::PV2D);
1030 
1031 
1032  // PV3D
1033  result =
1035  GlobalVector(track->px(),
1036  track->py(),
1037  track->pz()),
1038  primaryVertex);
1039  d0_corr = result.second.value();
1040  d0_err = primaryVertexIsValid ? result.second.error() : -1.0;
1041  anElectron.setDB( d0_corr, d0_err, pat::Electron::PV3D);
1042 
1043 
1044  // Correct to beam spot
1045  // make a fake vertex out of beam spot
1046  reco::Vertex vBeamspot(beamspot.position(), beamspot.covariance3D());
1047 
1048  // BS2D
1049  result =
1051  GlobalVector(track->px(),
1052  track->py(),
1053  track->pz()),
1054  vBeamspot);
1055  d0_corr = result.second.value();
1056  d0_err = beamspotIsValid ? result.second.error() : -1.0;
1057  anElectron.setDB( d0_corr, d0_err, pat::Electron::BS2D);
1058 
1059  // BS3D
1060  result =
1062  GlobalVector(track->px(),
1063  track->py(),
1064  track->pz()),
1065  vBeamspot);
1066  d0_corr = result.second.value();
1067  d0_err = beamspotIsValid ? result.second.error() : -1.0;
1068  anElectron.setDB( d0_corr, d0_err, pat::Electron::BS3D);
1069 }
void setDB(double dB, double edB, IpType type=None)
Set impact parameter of a certain type and its uncertainty.
Covariance3DMatrix covariance3D() const
return only 3D position covariance matrix
Definition: BeamSpot.h:118
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
tuple result
Definition: query.py:137
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 883 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::setAllowAnything(), edm::ParameterSetDescription::setComment(), and edm::ParameterDescriptionNode::setComment().

884 {
886  iDesc.setComment("PAT electron producer module");
887 
888  // input source
889  iDesc.add<edm::InputTag>("pfCandidateMap", edm::InputTag("no default"))->setComment("input collection");
890  iDesc.add<edm::InputTag>("electronSource", edm::InputTag("no default"))->setComment("input collection");
891 
892  // embedding
893  iDesc.add<bool>("embedGsfElectronCore", true)->setComment("embed external gsf electron core");
894  iDesc.add<bool>("embedGsfTrack", true)->setComment("embed external gsf track");
895  iDesc.add<bool>("embedSuperCluster", true)->setComment("embed external super cluster");
896  iDesc.add<bool>("embedPflowSuperCluster", true)->setComment("embed external super cluster");
897  iDesc.add<bool>("embedSeedCluster", true)->setComment("embed external seed cluster");
898  iDesc.add<bool>("embedBasicClusters", true)->setComment("embed external basic clusters");
899  iDesc.add<bool>("embedPreshowerClusters", true)->setComment("embed external preshower clusters");
900  iDesc.add<bool>("embedPflowBasicClusters", true)->setComment("embed external pflow basic clusters");
901  iDesc.add<bool>("embedPflowPreshowerClusters", true)->setComment("embed external pflow preshower clusters");
902  iDesc.add<bool>("embedTrack", false)->setComment("embed external track");
903  iDesc.add<bool>("embedRecHits", true)->setComment("embed external RecHits");
904 
905  // pf specific parameters
906  iDesc.add<edm::InputTag>("pfElectronSource", edm::InputTag("pfElectrons"))->setComment("particle flow input collection");
907  iDesc.add<bool>("useParticleFlow", false)->setComment("whether to use particle flow or not");
908  iDesc.add<bool>("embedPFCandidate", false)->setComment("embed external particle flow object");
909 
910  // MC matching configurables
911  iDesc.add<bool>("addGenMatch", true)->setComment("add MC matching");
912  iDesc.add<bool>("embedGenMatch", false)->setComment("embed MC matched MC information");
913  std::vector<edm::InputTag> emptySourceVector;
914  iDesc.addNode( edm::ParameterDescription<edm::InputTag>("genParticleMatch", edm::InputTag(), true) xor
915  edm::ParameterDescription<std::vector<edm::InputTag> >("genParticleMatch", emptySourceVector, true)
916  )->setComment("input with MC match information");
917 
918  // electron ID configurables
919  iDesc.add<bool>("addElectronID",true)->setComment("add electron ID variables");
920  edm::ParameterSetDescription electronIDSourcesPSet;
921  electronIDSourcesPSet.setAllowAnything();
922  iDesc.addNode( edm::ParameterDescription<edm::InputTag>("electronIDSource", edm::InputTag(), true) xor
923  edm::ParameterDescription<edm::ParameterSetDescription>("electronIDSources", electronIDSourcesPSet, true)
924  )->setComment("input with electron ID variables");
925 
926 
927  // IsoDeposit configurables
928  edm::ParameterSetDescription isoDepositsPSet;
929  isoDepositsPSet.addOptional<edm::InputTag>("tracker");
930  isoDepositsPSet.addOptional<edm::InputTag>("ecal");
931  isoDepositsPSet.addOptional<edm::InputTag>("hcal");
932  isoDepositsPSet.addOptional<edm::InputTag>("pfAllParticles");
933  isoDepositsPSet.addOptional<edm::InputTag>("pfChargedHadrons");
934  isoDepositsPSet.addOptional<edm::InputTag>("pfChargedAll");
935  isoDepositsPSet.addOptional<edm::InputTag>("pfPUChargedHadrons");
936  isoDepositsPSet.addOptional<edm::InputTag>("pfNeutralHadrons");
937  isoDepositsPSet.addOptional<edm::InputTag>("pfPhotons");
938  isoDepositsPSet.addOptional<std::vector<edm::InputTag> >("user");
939  iDesc.addOptional("isoDeposits", isoDepositsPSet);
940 
941  // isolation values configurables
942  edm::ParameterSetDescription isolationValuesPSet;
943  isolationValuesPSet.addOptional<edm::InputTag>("tracker");
944  isolationValuesPSet.addOptional<edm::InputTag>("ecal");
945  isolationValuesPSet.addOptional<edm::InputTag>("hcal");
946  isolationValuesPSet.addOptional<edm::InputTag>("pfAllParticles");
947  isolationValuesPSet.addOptional<edm::InputTag>("pfChargedHadrons");
948  isolationValuesPSet.addOptional<edm::InputTag>("pfChargedAll");
949  isolationValuesPSet.addOptional<edm::InputTag>("pfPUChargedHadrons");
950  isolationValuesPSet.addOptional<edm::InputTag>("pfNeutralHadrons");
951  isolationValuesPSet.addOptional<edm::InputTag>("pfPhotons");
952  isolationValuesPSet.addOptional<std::vector<edm::InputTag> >("user");
953  iDesc.addOptional("isolationValues", isolationValuesPSet);
954 
955  // isolation values configurables
956  edm::ParameterSetDescription isolationValuesNoPFIdPSet;
957  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("tracker");
958  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("ecal");
959  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("hcal");
960  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("pfAllParticles");
961  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("pfChargedHadrons");
962  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("pfChargedAll");
963  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("pfPUChargedHadrons");
964  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("pfNeutralHadrons");
965  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("pfPhotons");
966  isolationValuesNoPFIdPSet.addOptional<std::vector<edm::InputTag> >("user");
967  iDesc.addOptional("isolationValuesNoPFId", isolationValuesNoPFIdPSet);
968 
969  // Efficiency configurables
970  edm::ParameterSetDescription efficienciesPSet;
971  efficienciesPSet.setAllowAnything(); // TODO: the pat helper needs to implement a description.
972  iDesc.add("efficiencies", efficienciesPSet);
973  iDesc.add<bool>("addEfficiencies", false);
974 
975  // Check to see if the user wants to add user data
976  edm::ParameterSetDescription userDataPSet;
978  iDesc.addOptional("userData", userDataPSet);
979 
980  // electron shapes
981  iDesc.add<bool>("addElectronShapes", true);
982  iDesc.add<edm::InputTag>("reducedBarrelRecHitCollection", edm::InputTag("reducedEcalRecHitsEB"));
983  iDesc.add<edm::InputTag>("reducedEndcapRecHitCollection", edm::InputTag("reducedEcalRecHitsEE"));
984 
985  edm::ParameterSetDescription isolationPSet;
986  isolationPSet.setAllowAnything(); // TODO: the pat helper needs to implement a description.
987  iDesc.add("userIsolation", isolationPSet);
988 
989  // Resolution configurables
991 
992  iDesc.add<bool>("embedHighLevelSelection", true)->setComment("embed high level selection");
993  edm::ParameterSetDescription highLevelPSet;
994  highLevelPSet.setAllowAnything();
995  iDesc.addNode( edm::ParameterDescription<edm::InputTag>("beamLineSrc", edm::InputTag(), true)
996  )->setComment("input with high level selection");
998  )->setComment("input with high level selection");
999  iDesc.addNode( edm::ParameterDescription<bool>("usePV", bool(), true)
1000  )->setComment("input with high level selection, use primary vertex (true) or beam line (false)");
1001 
1002  descriptions.add("PATElectronProducer", iDesc);
1003 
1004 }
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)
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 702 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(), first, i, edm::Ref< C, T, F >::isNull(), isoDepositLabels_, isolationValueLabels_, isolationValueLabelsNoPFId_, j, 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().

710  {
711 
712  //COLIN: might want to use the PFCandidate 4-mom. Which one is in use now?
713  // if (useParticleFlow_)
714  // aMuon.setP4( aMuon.pfCandidateRef()->p4() );
715 
716  //COLIN:
717  //In the embedding case, the reference cannot be used to look into a value map.
718  //therefore, one has to had the PFCandidateRef to this function, which becomes a bit
719  //too much specific.
720 
721  // in fact, this function needs a baseref or ptr for genmatch
722  // and a baseref or ptr for isodeposits and isolationvalues.
723  // baseref is not needed
724  // the ptrForIsolation and ptrForMatching should be defined upstream.
725 
726  // is the concrete elecRef needed for the efficiency loader? what is this loader?
727  // how can we make it compatible with the particle flow electrons?
728 
729  if (embedGsfElectronCore_) anElectron.embedGsfElectronCore();
730  if (embedGsfTrack_) anElectron.embedGsfTrack();
731  if (embedSuperCluster_) anElectron.embedSuperCluster();
732  if (embedPflowSuperCluster_) anElectron.embedPflowSuperCluster();
733  if (embedSeedCluster_) anElectron.embedSeedCluster();
734  if (embedBasicClusters_) anElectron.embedBasicClusters();
735  if (embedPreshowerClusters_) anElectron.embedPreshowerClusters();
736  if (embedPflowBasicClusters_ ) anElectron.embedPflowBasicClusters();
737  if (embedPflowPreshowerClusters_ ) anElectron.embedPflowPreshowerClusters();
738  if (embedTrack_) anElectron.embedTrack();
739 
740  // store the match to the generated final state muons
741  if (addGenMatch_) {
742  for(size_t i = 0, n = genMatches.size(); i < n; ++i) {
743  if(useParticleFlow_) {
744  reco::GenParticleRef genElectron = (*genMatches[i])[anElectron.pfCandidateRef()];
745  anElectron.addGenParticleRef(genElectron);
746  }
747  else {
748  reco::GenParticleRef genElectron = (*genMatches[i])[elecRef];
749  anElectron.addGenParticleRef(genElectron);
750  }
751  }
752  if (embedGenMatch_) anElectron.embedGenParticle();
753  }
754 
755  if (efficiencyLoader_.enabled()) {
756  efficiencyLoader_.setEfficiencies( anElectron, elecRef );
757  }
758 
759  if (resolutionLoader_.enabled()) {
760  resolutionLoader_.setResolutions(anElectron);
761  }
762 
763  for (size_t j = 0, nd = deposits.size(); j < nd; ++j) {
764  if(useParticleFlow_) {
765 
766  reco::PFCandidateRef pfcandref = anElectron.pfCandidateRef();
767  assert(!pfcandref.isNull());
768  reco::CandidatePtr source = pfcandref->sourceCandidatePtr(0);
769  anElectron.setIsoDeposit(isoDepositLabels_[j].first,
770  (*deposits[j])[source]);
771  }
772  else
773  anElectron.setIsoDeposit(isoDepositLabels_[j].first,
774  (*deposits[j])[elecRef]);
775  }
776 
777  for (size_t j = 0; j<isolationValues.size(); ++j) {
778  if(useParticleFlow_) {
779  reco::CandidatePtr source = anElectron.pfCandidateRef()->sourceCandidatePtr(0);
780  anElectron.setIsolation(isolationValueLabels_[j].first,
781  (*isolationValues[j])[source]);
782  }
783  else
784  if(pfId){
785  anElectron.setIsolation(isolationValueLabels_[j].first,(*isolationValues[j])[elecRef]);
786  }
787  }
788 
789  //for electrons not identified as PF electrons
790  for (size_t j = 0; j<isolationValuesNoPFId.size(); ++j) {
791  if( !pfId) {
792  anElectron.setIsolation(isolationValueLabelsNoPFId_[j].first,(*isolationValuesNoPFId[j])[elecRef]);
793  }
794  }
795 
796 }
bool enabled() const
&#39;true&#39; if this there is at least one efficiency configured
int i
Definition: DBlmapReader.cc:9
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
int j
Definition: DBlmapReader.cc:9
bool first
Definition: L1TdeRCT.cc:75
bool isNull() const
Checks for null.
Definition: Ref.h:247
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.
bool useParticleFlow_
pflow specific
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 798 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(), first, pat::HcalIso, i, edm::Ptr< T >::id(), isoDepositLabels_, isolationValueLabels_, j, 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().

804  {
805 
806  //COLIN/Florian: use the PFCandidate 4-mom.
807  anElectron.setEcalDrivenMomentum(anElectron.p4()) ;
808  anElectron.setP4( anElectron.pfCandidateRef()->p4() );
809 
810 
811  // is the concrete elecRef needed for the efficiency loader? what is this loader?
812  // how can we make it compatible with the particle flow electrons?
813 
815  if (embedGsfTrack_) anElectron.embedGsfTrack();
816  if (embedSuperCluster_) anElectron.embedSuperCluster();
818  if (embedSeedCluster_) anElectron.embedSeedCluster();
819  if (embedBasicClusters_) anElectron.embedBasicClusters();
823  if (embedTrack_) anElectron.embedTrack();
824 
825  // store the match to the generated final state muons
826 
827  if (addGenMatch_) {
828  for(size_t i = 0, n = genMatches.size(); i < n; ++i) {
829  reco::GenParticleRef genElectron = (*genMatches[i])[candPtrForGenMatch];
830  anElectron.addGenParticleRef(genElectron);
831  }
832  if (embedGenMatch_) anElectron.embedGenParticle();
833  }
834 
835  //COLIN what's this? does it have to be GsfElectron specific?
836  if (efficiencyLoader_.enabled()) {
837  efficiencyLoader_.setEfficiencies( anElectron, candPtrForLoader );
838  }
839 
840  if (resolutionLoader_.enabled()) {
841  resolutionLoader_.setResolutions(anElectron);
842  }
843 
844  for (size_t j = 0, nd = deposits.size(); j < nd; ++j) {
848  deposits[j]->contains(candPtrForGenMatch.id())) {
850  (*deposits[j])[candPtrForGenMatch]);
851  }
852  else if (deposits[j]->contains(candPtrForIsolation.id())) {
853  anElectron.setIsoDeposit(isoDepositLabels_[j].first,
854  (*deposits[j])[candPtrForIsolation]);
855  }
856  else {
857  anElectron.setIsoDeposit(isoDepositLabels_[j].first,
858  (*deposits[j])[candPtrForIsolation->sourceCandidatePtr(0)]);
859  }
860  }
861 
862  for (size_t j = 0; j<isolationValues.size(); ++j) {
863  if( isolationValueLabels_[j].first==pat::TrackIso ||
866  isolationValues[j]->contains(candPtrForGenMatch.id())) {
867  anElectron.setIsolation(isolationValueLabels_[j].first,
868  (*isolationValues[j])[candPtrForGenMatch]);
869  }
870  else if (isolationValues[j]->contains(candPtrForIsolation.id())) {
871  anElectron.setIsolation(isolationValueLabels_[j].first,
872  (*isolationValues[j])[candPtrForIsolation]);
873  }
874  else {
875  anElectron.setIsolation(isolationValueLabels_[j].first,
876  (*isolationValues[j])[candPtrForIsolation->sourceCandidatePtr(0)]);
877  }
878  }
879 }
bool enabled() const
&#39;true&#39; if this there is at least one efficiency configured
int i
Definition: DBlmapReader.cc:9
void setP4(P4Kind kind, const LorentzVector &p4, float p4Error, bool setCandidate)
Definition: GsfElectron.cc:197
void setIsolation(IsolationKeys key, float value)
Definition: Lepton.h:98
bool contains(EventRange const &lh, EventID const &rh)
Definition: EventRange.cc:38
const LorentzVector & p4(P4Kind kind) const
Definition: GsfElectron.cc:223
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:188
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:175
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:677
int j
Definition: DBlmapReader.cc:9
void embedPflowBasicClusters()
method to store the electron&#39;s pflow basic clusters
bool first
Definition: L1TdeRCT.cc:75
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:661
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:164
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 
)
overridevirtual

Implements edm::EDProducer.

Definition at line 178 of file PATElectronProducer.cc.

References IPTools::absoluteImpactParameter3D(), IPTools::absoluteTransverseImpactParameter(), addElecID_, addGenMatch_, Reference_intrackfit_cff::barrel, beamLineToken_, SiPixelRawToDigiRegional_cfi::beamSpot, pat::helper::MultiIsolator::beginEvent(), reco::PFCandidate::e, DetId::Ecal, EcalBarrel, EcalEndcap, ecalTopology_, efficiencyLoader_, elecIDSrcs_, elecIDTokens_, HI_PhotonSkim_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(), first, genMatchTokens_, edm::EventSetup::get(), edm::Event::getByToken(), CaloTopology::getSubdetectorTopology(), CaloSubdetectorTopology::getWindow(), ConversionTools::hasMatchedConversion(), hConversionsToken_, i, customizeTrackingMonitorSeedNumber::idx, cmsHarvester::index, edm::Ref< C, T, F >::isAvailable(), edm::Ptr< T >::isNonnull(), edm::Ref< C, T, F >::isNonnull(), isoDepositLabels_, isoDepositTokens_, isolationValueNoPFIdTokens_, isolationValueTokens_, isolator_, isolatorTmpStorage_, edm::EventBase::isRealData(), edm::HandleBase::isValid(), j, reco::Matched, reco::HitPattern::MISSING_INNER_HITS, pat::helper::EfficiencyLoader::newEvent(), pat::helper::KinResolutionsLoader::newEvent(), electronProducer_cfi::patElectrons, pfCandidateMapToken_, pfElecToken_, pfElectrons_cff::pfElectrons, HWWFunctions::primaryVertex(), pTComparator_, edm::SortedCollection< T, SORT >::push_back(), edm::Event::put(), pvToken_, reducedBarrelRecHitCollectionToken_, reducedEndcapRecHitCollectionToken_, resolutionLoader_, query::result, fileCollector::seed, pat::Electron::setDB(), pat::Electron::setElectronIDs(), pat::Lepton< LeptonType >::setIsoDeposit(), pat::Lepton< LeptonType >::setIsolation(), pat::Electron::setIsPF(), pat::Electron::setMvaVariables(), pat::Electron::setPassConversionVeto(), pat::Electron::setPFCandidateRef(), edm::SortedCollection< T, SORT >::size(), edm::SortedCollection< T, SORT >::sort(), python.multivaluedict::sort(), groupFilesInBlocks::tt, useParticleFlow_, usePV_, userDataHelper_, useUserData_, reco::BeamSpot::x0(), reco::BeamSpot::y0(), and reco::BeamSpot::z0().

179 {
180  // switch off embedding (in unschedules mode)
181  if (iEvent.isRealData()){
182  addGenMatch_ = false;
183  embedGenMatch_ = false;
184  }
185 
186  edm::ESHandle<CaloTopology> theCaloTopology;
187  iSetup.get<CaloTopologyRecord>().get(theCaloTopology);
188  ecalTopology_ = & (*theCaloTopology);
189 
190  // Get the collection of electrons from the event
192  iEvent.getByToken(electronToken_, electrons);
193 
194  // for additional mva variables
195  edm::InputTag reducedEBRecHitCollection(string("reducedEcalRecHitsEB"));
196  edm::InputTag reducedEERecHitCollection(string("reducedEcalRecHitsEE"));
197  //EcalClusterLazyTools lazyTools(iEvent, iSetup, reducedEBRecHitCollection, reducedEERecHitCollection);
199 
200  // for conversion veto selection
202  iEvent.getByToken(hConversionsToken_, hConversions);
203 
204  // Get the ESHandle for the transient track builder, if needed for
205  // high level selection embedding
207 
208  if (isolator_.enabled()) isolator_.beginEvent(iEvent,iSetup);
209 
211  if (resolutionLoader_.enabled()) resolutionLoader_.newEvent(iEvent, iSetup);
212 
213  IsoDepositMaps deposits(isoDepositTokens_.size());
214  for (size_t j = 0, nd = isoDepositTokens_.size(); j < nd; ++j) {
215  iEvent.getByToken(isoDepositTokens_[j], deposits[j]);
216  }
217 
218  IsolationValueMaps isolationValues(isolationValueTokens_.size());
219  for (size_t j = 0; j<isolationValueTokens_.size(); ++j) {
220  iEvent.getByToken(isolationValueTokens_[j], isolationValues[j]);
221  }
222 
223  IsolationValueMaps isolationValuesNoPFId(isolationValueNoPFIdTokens_.size());
224  for (size_t j = 0; j<isolationValueNoPFIdTokens_.size(); ++j) {
225  iEvent.getByToken(isolationValueNoPFIdTokens_[j], isolationValuesNoPFId[j]);
226  }
227 
228  // prepare the MC matching
229  GenAssociations genMatches(genMatchTokens_.size());
230  if (addGenMatch_) {
231  for (size_t j = 0, nd = genMatchTokens_.size(); j < nd; ++j) {
232  iEvent.getByToken(genMatchTokens_[j], genMatches[j]);
233  }
234  }
235 
236  // prepare ID extraction
237  std::vector<edm::Handle<edm::ValueMap<float> > > idhandles;
238  std::vector<pat::Electron::IdPair> ids;
239  if (addElecID_) {
240  idhandles.resize(elecIDSrcs_.size());
241  ids.resize(elecIDSrcs_.size());
242  for (size_t i = 0; i < elecIDSrcs_.size(); ++i) {
243  iEvent.getByToken(elecIDTokens_[i], idhandles[i]);
244  ids[i].first = elecIDSrcs_[i].first;
245  }
246  }
247 
248 
249  // prepare the high level selection:
250  // needs beamline
251  reco::TrackBase::Point beamPoint(0,0,0);
254  bool beamSpotIsValid = false;
255  bool primaryVertexIsValid = false;
256 
257  // Get the beamspot
258  edm::Handle<reco::BeamSpot> beamSpotHandle;
259  iEvent.getByToken(beamLineToken_, beamSpotHandle);
260 
261  if ( embedHighLevelSelection_ ) {
262  // Get the primary vertex
264  iEvent.getByToken( pvToken_, pvHandle );
265 
266  // This is needed by the IPTools methods from the tracking group
267  iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder", trackBuilder);
268 
269  if ( ! usePV_ ) {
270 
271  if ( beamSpotHandle.isValid() ){
272  beamSpot = *beamSpotHandle;
273  beamSpotIsValid = true;
274  } else{
275  edm::LogError("DataNotAvailable")
276  << "No beam spot available from EventSetup, not adding high level selection \n";
277  }
278 
279  double x0 = beamSpot.x0();
280  double y0 = beamSpot.y0();
281  double z0 = beamSpot.z0();
282 
283  beamPoint = reco::TrackBase::Point ( x0, y0, z0 );
284  } else {
285  if ( pvHandle.isValid() && !pvHandle->empty() ) {
286  primaryVertex = pvHandle->at(0);
287  primaryVertexIsValid = true;
288  } else {
289  edm::LogError("DataNotAvailable")
290  << "No primary vertex available from EventSetup, not adding high level selection \n";
291  }
292  }
293  }
294 
295  std::vector<Electron> * patElectrons = new std::vector<Electron>();
296 
297  if( useParticleFlow_ ) {
299  iEvent.getByToken(pfElecToken_, pfElectrons);
300  unsigned index=0;
301 
302  for( reco::PFCandidateConstIterator i = pfElectrons->begin();
303  i != pfElectrons->end(); ++i, ++index) {
304 
305  reco::PFCandidateRef pfRef(pfElectrons, index);
306  reco::PFCandidatePtr ptrToPFElectron(pfElectrons,index);
307 // reco::CandidateBaseRef pfBaseRef( pfRef );
308 
309  reco::GsfTrackRef PfTk= i->gsfTrackRef();
310 
311  bool Matched=false;
312  bool MatchedToAmbiguousGsfTrack=false;
313  for (edm::View<reco::GsfElectron>::const_iterator itElectron = electrons->begin(); itElectron != electrons->end(); ++itElectron) {
314  unsigned int idx = itElectron - electrons->begin();
315  if (Matched || MatchedToAmbiguousGsfTrack) continue;
316 
317  reco::GsfTrackRef EgTk= itElectron->gsfTrack();
318 
319  if (itElectron->gsfTrack()==i->gsfTrackRef()){
320  Matched=true;
321  }
322  else {
323  for( reco::GsfTrackRefVector::const_iterator it = itElectron->ambiguousGsfTracksBegin() ;
324  it!=itElectron->ambiguousGsfTracksEnd(); it++ ){
325  MatchedToAmbiguousGsfTrack |= (bool)(i->gsfTrackRef()==(*it));
326  }
327  }
328 
329  if (Matched || MatchedToAmbiguousGsfTrack){
330 
331  // ptr needed for finding the matched gen particle
332  reco::CandidatePtr ptrToGsfElectron(electrons,idx);
333 
334  // ref to base needed for the construction of the pat object
335  const edm::RefToBase<reco::GsfElectron>& elecsRef = electrons->refAt(idx);
336  Electron anElectron(elecsRef);
337  anElectron.setPFCandidateRef( pfRef );
338 
339  //it should be always true when particleFlow electrons are used.
340  anElectron.setIsPF( true );
341 
342  if( embedPFCandidate_ ) anElectron.embedPFCandidate();
343 
344  if ( useUserData_ ) {
345  userDataHelper_.add( anElectron, iEvent, iSetup );
346  }
347 
348  double ip3d = -999; // for mva variable
349 
350  // embed high level selection
351  if ( embedHighLevelSelection_ ) {
352  // get the global track
353  reco::GsfTrackRef track = PfTk;
354 
355  // Make sure the collection it points to is there
356  if ( track.isNonnull() && track.isAvailable() ) {
357 
358  reco::TransientTrack tt = trackBuilder->build(track);
359  embedHighLevel( anElectron,
360  track,
361  tt,
362  primaryVertex,
363  primaryVertexIsValid,
364  beamSpot,
365  beamSpotIsValid );
366 
367  std::pair<bool,Measurement1D> ip3dpv = IPTools::absoluteImpactParameter3D(tt, primaryVertex);
368  ip3d = ip3dpv.second.value(); // for mva variable
369 
370  if ( !usePV_ ) {
371  double corr_d0 = track->dxy( beamPoint );
372  anElectron.setDB( corr_d0, -1.0 );
373  } else {
374  std::pair<bool,Measurement1D> result = IPTools::absoluteTransverseImpactParameter(tt, primaryVertex);
375  double d0_corr = result.second.value();
376  double d0_err = result.second.error();
377  anElectron.setDB( d0_corr, d0_err );
378  }
379  }
380  }
381 
382  //Electron Id
383 
384  if (addElecID_) {
385  //STANDARD EL ID
386  for (size_t i = 0; i < elecIDSrcs_.size(); ++i) {
387  ids[i].second = (*idhandles[i])[elecsRef];
388  }
389  //SPECIFIC PF ID
390  ids.push_back(std::make_pair("pf_evspi",pfRef->mva_e_pi()));
391  ids.push_back(std::make_pair("pf_evsmu",pfRef->mva_e_mu()));
392  anElectron.setElectronIDs(ids);
393  }
394 
395  // add missing mva variables
396  std::vector<float> vCov = lazyTools.localCovariances(*( itElectron->superCluster()->seed()));
397  anElectron.setMvaVariables(vCov[1], ip3d);
398 
399  std::vector<DetId> selectedCells;
400  bool barrel = itElectron->isEB();
401  //loop over sub clusters
402  if (embedBasicClusters_) {
403  for (reco::CaloCluster_iterator clusIt = itElectron->superCluster()->clustersBegin(); clusIt!=itElectron->superCluster()->clustersEnd(); ++clusIt) {
404  //get seed (max energy xtal)
405  DetId seed = lazyTools.getMaximum(**clusIt).first;
406  //get all xtals in 5x5 window around the seed
407  std::vector<DetId> dets5x5 = (barrel) ? ecalTopology_->getSubdetectorTopology(DetId::Ecal,EcalBarrel)->getWindow(seed,5,5):
409  selectedCells.insert(selectedCells.end(), dets5x5.begin(), dets5x5.end());
410 
411  //get all xtals belonging to cluster
412  for (const std::pair<DetId, float> &hit : (*clusIt)->hitsAndFractions()) {
413  selectedCells.push_back(hit.first);
414  }
415  }
416  }
417 
418  if (embedPflowBasicClusters_ && itElectron->parentSuperCluster().isNonnull()) {
419  for (reco::CaloCluster_iterator clusIt = itElectron->parentSuperCluster()->clustersBegin(); clusIt!=itElectron->parentSuperCluster()->clustersEnd(); ++clusIt) {
420  //get seed (max energy xtal)
421  DetId seed = lazyTools.getMaximum(**clusIt).first;
422  //get all xtals in 5x5 window around the seed
423  std::vector<DetId> dets5x5 = (barrel) ? ecalTopology_->getSubdetectorTopology(DetId::Ecal,EcalBarrel)->getWindow(seed,5,5):
425  selectedCells.insert(selectedCells.end(), dets5x5.begin(), dets5x5.end());
426 
427  //get all xtals belonging to cluster
428  for (const std::pair<DetId, float> &hit : (*clusIt)->hitsAndFractions()) {
429  selectedCells.push_back(hit.first);
430  }
431  }
432  }
433 
434  //remove duplicates
435  std::sort(selectedCells.begin(),selectedCells.end());
436  std::unique(selectedCells.begin(),selectedCells.end());
437 
438 
439  // Retrieve the corresponding RecHits
440 
442  if(barrel)
444  else
446 
447  EcalRecHitCollection selectedRecHits;
448  const EcalRecHitCollection *recHits = rechitsH.product();
449 
450  unsigned nSelectedCells = selectedCells.size();
451  for (unsigned icell = 0 ; icell < nSelectedCells ; ++icell) {
452  EcalRecHitCollection::const_iterator it = recHits->find( selectedCells[icell] );
453  if ( it != recHits->end() ) {
454  selectedRecHits.push_back(*it);
455  }
456  }
457  selectedRecHits.sort();
458  if (embedRecHits_) anElectron.embedRecHits(& selectedRecHits);
459 
460  // set conversion veto selection
461  bool passconversionveto = false;
462  if( hConversions.isValid()){
463  // this is recommended method
464  passconversionveto = !ConversionTools::hasMatchedConversion( *itElectron, hConversions, beamSpotHandle->position());
465  }else{
466  // use missing hits without vertex fit method
467  passconversionveto = itElectron->gsfTrack()->hitPattern().numberOfLostHits(reco::HitPattern::MISSING_INNER_HITS) < 1;
468  }
469 
470  anElectron.setPassConversionVeto( passconversionveto );
471 
472 
473 // fillElectron(anElectron,elecsRef,pfBaseRef,
474 // genMatches, deposits, isolationValues);
475 
476  //COLIN small warning !
477  // we are currently choosing to take the 4-momentum of the PFCandidate;
478  // the momentum of the GsfElectron is saved though
479  // we must therefore match the GsfElectron.
480  // because of this, we should not change the source of the electron matcher
481  // to the collection of PFElectrons in the python configuration
482  // I don't know what to do with the efficiencyLoader, since I don't know
483  // what this class is for.
484  fillElectron2( anElectron,
485  ptrToPFElectron,
486  ptrToGsfElectron,
487  ptrToGsfElectron,
488  genMatches, deposits, isolationValues );
489 
490  //COLIN need to use fillElectron2 in the non-pflow case as well, and to test it.
491 
492  patElectrons->push_back(anElectron);
493  }
494  }
495  //if( !Matched && !MatchedToAmbiguousGsfTrack) std::cout << "!!!!A pf electron could not be matched to a gsf!!!!" << std::endl;
496  }
497  }
498 
499  else{
500  // Try to access PF electron collection
502  bool valMapPresent = iEvent.getByToken(pfCandidateMapToken_,ValMapH);
503  // Try to access a PFCandidate collection, as supplied by the user
505  bool pfCandsPresent = iEvent.getByToken(pfElecToken_, pfElectrons);
506 
507  for (edm::View<reco::GsfElectron>::const_iterator itElectron = electrons->begin(); itElectron != electrons->end(); ++itElectron) {
508  // construct the Electron from the ref -> save ref to original object
509  //FIXME: looks like a lot of instances could be turned into const refs
510  unsigned int idx = itElectron - electrons->begin();
511  edm::RefToBase<reco::GsfElectron> elecsRef = electrons->refAt(idx);
512  reco::CandidateBaseRef elecBaseRef(elecsRef);
513  Electron anElectron(elecsRef);
514 
515  // Is this GsfElectron also identified as an e- in the particle flow?
516  bool pfId = false;
517 
518  if ( pfCandsPresent ) {
519  // PF electron collection not available.
520  const reco::GsfTrackRef& trkRef = itElectron->gsfTrack();
521  int index = 0;
522  for( reco::PFCandidateConstIterator ie = pfElectrons->begin();
523  ie != pfElectrons->end(); ++ie, ++index) {
524  if(ie->particleId()!=reco::PFCandidate::e) continue;
525  const reco::GsfTrackRef& pfTrkRef= ie->gsfTrackRef();
526  if( trkRef == pfTrkRef ) {
527  pfId = true;
528  reco::PFCandidateRef pfRef(pfElectrons, index);
529  anElectron.setPFCandidateRef( pfRef );
530  break;
531  }
532  }
533  }
534  else if( valMapPresent ) {
535  // use value map if PF collection not available
536  const edm::ValueMap<reco::PFCandidatePtr> & myValMap(*ValMapH);
537  // Get the PFCandidate
538  const reco::PFCandidatePtr& pfElePtr(myValMap[elecsRef]);
539  pfId= pfElePtr.isNonnull();
540  }
541  // set PFId function
542  anElectron.setIsPF( pfId );
543 
544  // add resolution info
545 
546  // Isolation
547  if (isolator_.enabled()) {
548  isolator_.fill(*electrons, idx, isolatorTmpStorage_);
549  typedef pat::helper::MultiIsolator::IsolationValuePairs IsolationValuePairs;
550  // better to loop backwards, so the vector is resized less times
551  for (IsolationValuePairs::const_reverse_iterator it = isolatorTmpStorage_.rbegin(), ed = isolatorTmpStorage_.rend(); it != ed; ++it) {
552  anElectron.setIsolation(it->first, it->second);
553  }
554  }
555 
556  for (size_t j = 0, nd = deposits.size(); j < nd; ++j) {
557  anElectron.setIsoDeposit(isoDepositLabels_[j].first, (*deposits[j])[elecsRef]);
558  }
559 
560  // add electron ID info
561  if (addElecID_) {
562  for (size_t i = 0; i < elecIDSrcs_.size(); ++i) {
563  ids[i].second = (*idhandles[i])[elecsRef];
564  }
565  anElectron.setElectronIDs(ids);
566  }
567 
568 
569  if ( useUserData_ ) {
570  userDataHelper_.add( anElectron, iEvent, iSetup );
571  }
572 
573 
574  double ip3d = -999; //for mva variable
575 
576  // embed high level selection
577  if ( embedHighLevelSelection_ ) {
578  // get the global track
579  reco::GsfTrackRef track = itElectron->gsfTrack();
580 
581  // Make sure the collection it points to is there
582  if ( track.isNonnull() && track.isAvailable() ) {
583 
584  reco::TransientTrack tt = trackBuilder->build(track);
585  embedHighLevel( anElectron,
586  track,
587  tt,
588  primaryVertex,
589  primaryVertexIsValid,
590  beamSpot,
591  beamSpotIsValid );
592 
593  std::pair<bool,Measurement1D> ip3dpv = IPTools::absoluteImpactParameter3D(tt, primaryVertex);
594  ip3d = ip3dpv.second.value(); // for mva variable
595 
596  if ( !usePV_ ) {
597  double corr_d0 = track->dxy( beamPoint );
598  anElectron.setDB( corr_d0, -1.0 );
599  } else {
600  std::pair<bool,Measurement1D> result = IPTools::absoluteTransverseImpactParameter(tt, primaryVertex);
601  double d0_corr = result.second.value();
602  double d0_err = result.second.error();
603  anElectron.setDB( d0_corr, d0_err );
604  }
605  }
606  }
607 
608  // add mva variables
609  std::vector<float> vCov = lazyTools.localCovariances(*( itElectron->superCluster()->seed()));
610  anElectron.setMvaVariables(vCov[1], ip3d);
611 
612  std::vector<DetId> selectedCells;
613  bool barrel = itElectron->isEB();
614  //loop over sub clusters
615  if (embedBasicClusters_) {
616  for (reco::CaloCluster_iterator clusIt = itElectron->superCluster()->clustersBegin(); clusIt!=itElectron->superCluster()->clustersEnd(); ++clusIt) {
617  //get seed (max energy xtal)
618  DetId seed = lazyTools.getMaximum(**clusIt).first;
619  //get all xtals in 5x5 window around the seed
620  std::vector<DetId> dets5x5 = (barrel) ? ecalTopology_->getSubdetectorTopology(DetId::Ecal,EcalBarrel)->getWindow(seed,5,5):
622  selectedCells.insert(selectedCells.end(), dets5x5.begin(), dets5x5.end());
623 
624  //get all xtals belonging to cluster
625  for (const std::pair<DetId, float> &hit : (*clusIt)->hitsAndFractions()) {
626  selectedCells.push_back(hit.first);
627  }
628  }
629  }
630 
631  if (embedPflowBasicClusters_ && itElectron->parentSuperCluster().isNonnull()) {
632  for (reco::CaloCluster_iterator clusIt = itElectron->parentSuperCluster()->clustersBegin(); clusIt!=itElectron->parentSuperCluster()->clustersEnd(); ++clusIt) {
633  //get seed (max energy xtal)
634  DetId seed = lazyTools.getMaximum(**clusIt).first;
635  //get all xtals in 5x5 window around the seed
636  std::vector<DetId> dets5x5 = (barrel) ? ecalTopology_->getSubdetectorTopology(DetId::Ecal,EcalBarrel)->getWindow(seed,5,5):
638  selectedCells.insert(selectedCells.end(), dets5x5.begin(), dets5x5.end());
639 
640  //get all xtals belonging to cluster
641  for (const std::pair<DetId, float> &hit : (*clusIt)->hitsAndFractions()) {
642  selectedCells.push_back(hit.first);
643  }
644  }
645  }
646 
647  //remove duplicates
648  std::sort(selectedCells.begin(),selectedCells.end());
649  std::unique(selectedCells.begin(),selectedCells.end());
650 
651  // Retrieve the corresponding RecHits
652 
654  if(barrel)
656  else
658 
659  EcalRecHitCollection selectedRecHits;
660  const EcalRecHitCollection *recHits = rechitsH.product();
661 
662  unsigned nSelectedCells = selectedCells.size();
663  for (unsigned icell = 0 ; icell < nSelectedCells ; ++icell) {
664  EcalRecHitCollection::const_iterator it = recHits->find( selectedCells[icell] );
665  if ( it != recHits->end() ) {
666  selectedRecHits.push_back(*it);
667  }
668  }
669  selectedRecHits.sort();
670  if (embedRecHits_) anElectron.embedRecHits(& selectedRecHits);
671 
672  // set conversion veto selection
673  bool passconversionveto = false;
674  if( hConversions.isValid()){
675  // this is recommended method
676  passconversionveto = !ConversionTools::hasMatchedConversion( *itElectron, hConversions, beamSpotHandle->position());
677  }else{
678  // use missing hits without vertex fit method
679  passconversionveto = itElectron->gsfTrack()->hitPattern().numberOfLostHits(reco::HitPattern::MISSING_INNER_HITS) < 1;
680  }
681  anElectron.setPassConversionVeto( passconversionveto );
682 
683  // add sel to selected
684  fillElectron( anElectron, elecsRef,elecBaseRef,
685  genMatches, deposits, pfId, isolationValues, isolationValuesNoPFId);
686  patElectrons->push_back(anElectron);
687  }
688  }
689 
690  // sort electrons in pt
691  std::sort(patElectrons->begin(), patElectrons->end(), pTComparator_);
692 
693  // add the electrons to the event output
694  std::auto_ptr<std::vector<Electron> > ptr(patElectrons);
695  iEvent.put(ptr);
696 
697  // clean up
699 
700 }
bool enabled() const
&#39;true&#39; if this there is at least one efficiency configured
bool isAvailable() const
Definition: Ref.h:614
double z0() const
z coordinate
Definition: BeamSpot.h:68
int i
Definition: DBlmapReader.cc:9
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:250
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
edm::EDGetTokenT< edm::View< reco::GsfElectron > > electronToken_
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
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)
PFCandidateCollection::const_iterator PFCandidateConstIterator
iterator
std::vector< edm::EDGetTokenT< edm::ValueMap< float > > > elecIDTokens_
bool isRealData() const
Definition: EventBase.h:60
bool enabled() const
&#39;true&#39; if this there is at least one efficiency configured
bool enabled() const
True if it has a non null configuration.
Definition: MultiIsolator.h:50
GreaterByPt< Electron > pTComparator_
pat::helper::MultiIsolator isolator_
std::vector< edm::Handle< edm::Association< reco::GenParticleCollection > > > GenAssociations
void beginEvent(const edm::Event &event, const edm::EventSetup &eventSetup)
edm::EDGetTokenT< EcalRecHitCollection > reducedEndcapRecHitCollectionToken_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
std::vector< edm::EDGetTokenT< edm::Association< reco::GenParticleCollection > > > genMatchTokens_
tuple result
Definition: query.py:137
std::vector< edm::EDGetTokenT< edm::ValueMap< IsoDeposit > > > isoDepositTokens_
int j
Definition: DBlmapReader.cc:9
edm::EDGetTokenT< reco::ConversionCollection > hConversionsToken_
math::XYZPoint Point
point in the space
Definition: TrackBase.h:82
std::vector< edm::Handle< edm::ValueMap< double > > > IsolationValueMaps
bool embedHighLevelSelection_
embed high level selection variables?
bool first
Definition: L1TdeRCT.cc:75
bool isValid() const
Definition: HandleBase.h:76
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
edm::EDGetTokenT< EcalRecHitCollection > reducedBarrelRecHitCollectionToken_
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
pat::helper::EfficiencyLoader efficiencyLoader_
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
const T & get() const
Definition: EventSetup.h:55
pat::PATUserDataHelper< pat::Electron > userDataHelper_
bool useParticleFlow_
pflow specific
Analysis-level electron class.
Definition: Electron.h:52
const CaloTopology * ecalTopology_
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
Definition: CaloTopology.cc:26
edm::EDGetTokenT< edm::ValueMap< reco::PFCandidatePtr > > pfCandidateMapToken_
std::pair< bool, Measurement1D > absoluteTransverseImpactParameter(const reco::TransientTrack &transientTrack, const reco::Vertex &vertex)
Definition: IPTools.cc:43
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:81
size_type size() const
double y0() const
y coordinate
Definition: BeamSpot.h:66
pat::helper::KinResolutionsLoader resolutionLoader_
std::vector< edm::EDGetTokenT< edm::ValueMap< double > > > isolationValueTokens_
edm::EDGetTokenT< reco::BeamSpot > beamLineToken_
pat::helper::MultiIsolator::IsolationValuePairs isolatorTmpStorage_
void newEvent(const edm::Event &event, const edm::EventSetup &setup) const
To be called for each new event, reads in the EventSetup object.
edm::EDGetTokenT< reco::PFCandidateCollection > pfElecToken_
void newEvent(const edm::Event &event) const
To be called for each new event, reads in the ValueMaps for efficiencies.
edm::EDGetTokenT< std::vector< reco::Vertex > > pvToken_
std::vector< NameTag > elecIDSrcs_
void fill(const edm::View< T > &coll, int idx, IsolationValuePairs &isolations) const
Definition: MultiIsolator.h:82
double x0() const
x coordinate
Definition: BeamSpot.h:64
std::vector< edm::Handle< edm::ValueMap< IsoDeposit > > > IsoDepositMaps
template<typename T >
void 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 187 of file PATElectronProducer.h.

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

190  {
191 
192  labels.clear();
193 
194  if (iConfig.exists( psetName )) {
195  edm::ParameterSet depconf
196  = iConfig.getParameter<edm::ParameterSet>(psetName);
197 
198  if (depconf.exists("tracker")) labels.push_back(std::make_pair(pat::TrackIso, depconf.getParameter<edm::InputTag>("tracker")));
199  if (depconf.exists("ecal")) labels.push_back(std::make_pair(pat::EcalIso, depconf.getParameter<edm::InputTag>("ecal")));
200  if (depconf.exists("hcal")) labels.push_back(std::make_pair(pat::HcalIso, depconf.getParameter<edm::InputTag>("hcal")));
201  if (depconf.exists("pfAllParticles")) {
202  labels.push_back(std::make_pair(pat::PfAllParticleIso, depconf.getParameter<edm::InputTag>("pfAllParticles")));
203  }
204  if (depconf.exists("pfChargedHadrons")) {
205  labels.push_back(std::make_pair(pat::PfChargedHadronIso, depconf.getParameter<edm::InputTag>("pfChargedHadrons")));
206  }
207  if (depconf.exists("pfChargedAll")) {
208  labels.push_back(std::make_pair(pat::PfChargedAllIso, depconf.getParameter<edm::InputTag>("pfChargedAll")));
209  }
210  if (depconf.exists("pfPUChargedHadrons")) {
211  labels.push_back(std::make_pair(pat::PfPUChargedHadronIso, depconf.getParameter<edm::InputTag>("pfPUChargedHadrons")));
212  }
213  if (depconf.exists("pfNeutralHadrons")) {
214  labels.push_back(std::make_pair(pat::PfNeutralHadronIso, depconf.getParameter<edm::InputTag>("pfNeutralHadrons")));
215  }
216  if (depconf.exists("pfPhotons")) {
217  labels.push_back(std::make_pair(pat::PfGammaIso, depconf.getParameter<edm::InputTag>("pfPhotons")));
218  }
219  if (depconf.exists("user")) {
220  std::vector<edm::InputTag> userdeps = depconf.getParameter<std::vector<edm::InputTag> >("user");
221  std::vector<edm::InputTag>::const_iterator it = userdeps.begin(), ed = userdeps.end();
222  int key = UserBaseIso;
223  for ( ; it != ed; ++it, ++key) {
224  labels.push_back(std::make_pair(IsolationKeys(key), *it));
225  }
226  }
227  }
228  tokens = edm::vector_transform(labels, [this](IsolationLabel const & label){return consumes<edm::ValueMap<T> >(label.second);});
229 
230 
231 }
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
list key
Definition: combine.py:13

Member Data Documentation

bool pat::PATElectronProducer::addEfficiencies_
private

Definition at line 166 of file PATElectronProducer.h.

bool pat::PATElectronProducer::addElecID_
private

Definition at line 149 of file PATElectronProducer.h.

Referenced by produce().

bool pat::PATElectronProducer::addGenMatch_
private

Definition at line 80 of file PATElectronProducer.h.

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

bool pat::PATElectronProducer::addResolutions_
private

Definition at line 169 of file PATElectronProducer.h.

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

Definition at line 102 of file PATElectronProducer.h.

Referenced by produce().

const CaloTopology* pat::PATElectronProducer::ecalTopology_
private

Definition at line 175 of file PATElectronProducer.h.

Referenced by produce().

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

Definition at line 167 of file PATElectronProducer.h.

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

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

Definition at line 151 of file PATElectronProducer.h.

Referenced by produce().

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

Definition at line 152 of file PATElectronProducer.h.

Referenced by produce().

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

Definition at line 68 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

bool pat::PATElectronProducer::embedBasicClusters_
private

Definition at line 75 of file PATElectronProducer.h.

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

bool pat::PATElectronProducer::embedGenMatch_
private

Definition at line 81 of file PATElectronProducer.h.

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

bool pat::PATElectronProducer::embedGsfElectronCore_
private

Definition at line 70 of file PATElectronProducer.h.

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

bool pat::PATElectronProducer::embedGsfTrack_
private

Definition at line 71 of file PATElectronProducer.h.

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

bool pat::PATElectronProducer::embedHighLevelSelection_
private

embed high level selection variables?

Definition at line 101 of file PATElectronProducer.h.

Referenced by produce().

bool pat::PATElectronProducer::embedPFCandidate_
private

Definition at line 92 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

bool pat::PATElectronProducer::embedPflowBasicClusters_
private

Definition at line 77 of file PATElectronProducer.h.

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

bool pat::PATElectronProducer::embedPflowPreshowerClusters_
private

Definition at line 78 of file PATElectronProducer.h.

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

bool pat::PATElectronProducer::embedPflowSuperCluster_
private

Definition at line 73 of file PATElectronProducer.h.

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

bool pat::PATElectronProducer::embedPreshowerClusters_
private

Definition at line 76 of file PATElectronProducer.h.

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

bool pat::PATElectronProducer::embedRecHits_
private

Definition at line 82 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

bool pat::PATElectronProducer::embedSeedCluster_
private

Definition at line 74 of file PATElectronProducer.h.

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

bool pat::PATElectronProducer::embedSuperCluster_
private

Definition at line 72 of file PATElectronProducer.h.

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

bool pat::PATElectronProducer::embedTrack_
private

Definition at line 79 of file PATElectronProducer.h.

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

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

Definition at line 86 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

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

Definition at line 69 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

IsolationLabels pat::PATElectronProducer::isoDepositLabels_
private

Definition at line 159 of file PATElectronProducer.h.

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

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

Definition at line 160 of file PATElectronProducer.h.

Referenced by produce().

IsolationLabels pat::PATElectronProducer::isolationValueLabels_
private

Definition at line 161 of file PATElectronProducer.h.

Referenced by fillElectron(), and fillElectron2().

IsolationLabels pat::PATElectronProducer::isolationValueLabelsNoPFId_
private

Definition at line 163 of file PATElectronProducer.h.

Referenced by fillElectron().

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

Definition at line 164 of file PATElectronProducer.h.

Referenced by produce().

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

Definition at line 162 of file PATElectronProducer.h.

Referenced by produce().

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

Definition at line 157 of file PATElectronProducer.h.

Referenced by produce().

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

Definition at line 158 of file PATElectronProducer.h.

Referenced by produce().

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

Definition at line 91 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

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

Definition at line 90 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

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

Definition at line 155 of file PATElectronProducer.h.

Referenced by produce().

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

Definition at line 104 of file PATElectronProducer.h.

Referenced by produce().

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

mva input variables

Definition at line 95 of file PATElectronProducer.h.

Referenced by PATElectronProducer().

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

Definition at line 96 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

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

Definition at line 97 of file PATElectronProducer.h.

Referenced by PATElectronProducer().

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

Definition at line 98 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

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

Definition at line 170 of file PATElectronProducer.h.

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

bool pat::PATElectronProducer::useParticleFlow_
private

pflow specific

Definition at line 89 of file PATElectronProducer.h.

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

bool pat::PATElectronProducer::usePV_
private

Definition at line 103 of file PATElectronProducer.h.

Referenced by produce().

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

Definition at line 173 of file PATElectronProducer.h.

Referenced by produce().

bool pat::PATElectronProducer::useUserData_
private

Definition at line 172 of file PATElectronProducer.h.

Referenced by produce().