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 ()
 
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 ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) 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
 
void readIsolationLabels (const edm::ParameterSet &iConfig, const char *psetName, IsolationLabels &labels)
 

Private Attributes

bool addEfficiencies_
 
bool addElecID_
 
bool addGenMatch_
 
bool addResolutions_
 
edm::InputTag beamLineSrc_
 
const CaloTopologyecalTopology_
 
pat::helper::EfficiencyLoader efficiencyLoader_
 
std::vector< NameTagelecIDSrcs_
 
edm::InputTag electronSrc_
 
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::InputTaggenMatchSrc_
 
IsolationLabels isoDepositLabels_
 
IsolationLabels isolationValueLabels_
 
IsolationLabels isolationValueLabelsNoPFId_
 
pat::helper::MultiIsolator isolator_
 
pat::helper::MultiIsolator::IsolationValuePairs isolatorTmpStorage_
 
edm::InputTag pfCandidateMap_
 
edm::InputTag pfElecSrc_
 
GreaterByPt< ElectronpTComparator_
 
edm::InputTag pvSrc_
 
edm::InputTag reducedBarrelRecHitCollection_
 mva input variables More...
 
edm::InputTag reducedEndcapRecHitCollection_
 
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
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- 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.32 2013/04/09 18:39:29 tjkim Exp

Definition at line 55 of file PATElectronProducer.h.

Member Typedef Documentation

Definition at line 103 of file PATElectronProducer.h.

Definition at line 102 of file PATElectronProducer.h.

Definition at line 104 of file PATElectronProducer.h.

Definition at line 136 of file PATElectronProducer.h.

Definition at line 137 of file PATElectronProducer.h.

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

Definition at line 105 of file PATElectronProducer.h.

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

Definition at line 146 of file PATElectronProducer.h.

Constructor & Destructor Documentation

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

Definition at line 49 of file PATElectronProducer.cc.

References addEfficiencies_, addElecID_, addGenMatch_, addResolutions_, beamLineSrc_, efficiencyLoader_, elecIDSrcs_, electronSrc_, embedBasicClusters_, embedGenMatch_, embedGsfElectronCore_, embedGsfTrack_, embedHighLevelSelection_, embedPFCandidate_, embedPflowBasicClusters_, embedPflowPreshowerClusters_, embedPflowSuperCluster_, embedPreshowerClusters_, embedRecHits_, embedSeedCluster_, embedSuperCluster_, embedTrack_, edm::hlt::Exception, edm::ParameterSet::existsAs(), genMatchSrc_, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNamesForType(), isoDepositLabels_, isolationValueLabels_, isolationValueLabelsNoPFId_, cscdqm::h::names, pfCandidateMap_, pfElecSrc_, pvSrc_, readIsolationLabels(), reducedBarrelRecHitCollection_, reducedEndcapRecHitCollection_, resolutionLoader_, useParticleFlow_, usePV_, userDataHelper_, and useUserData_.

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

Definition at line 167 of file PATElectronProducer.cc.

168 {
169 }

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 1062 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().

1070 {
1071  // Correct to PV
1072 
1073  // PV2D
1074  std::pair<bool,Measurement1D> result =
1076  GlobalVector(track->px(),
1077  track->py(),
1078  track->pz()),
1079  primaryVertex);
1080  double d0_corr = result.second.value();
1081  double d0_err = primaryVertexIsValid ? result.second.error() : -1.0;
1082  anElectron.setDB( d0_corr, d0_err, pat::Electron::PV2D);
1083 
1084 
1085  // PV3D
1086  result =
1088  GlobalVector(track->px(),
1089  track->py(),
1090  track->pz()),
1091  primaryVertex);
1092  d0_corr = result.second.value();
1093  d0_err = primaryVertexIsValid ? result.second.error() : -1.0;
1094  anElectron.setDB( d0_corr, d0_err, pat::Electron::PV3D);
1095 
1096 
1097  // Correct to beam spot
1098  // make a fake vertex out of beam spot
1099  reco::Vertex vBeamspot(beamspot.position(), beamspot.covariance3D());
1100 
1101  // BS2D
1102  result =
1104  GlobalVector(track->px(),
1105  track->py(),
1106  track->pz()),
1107  vBeamspot);
1108  d0_corr = result.second.value();
1109  d0_err = beamspotIsValid ? result.second.error() : -1.0;
1110  anElectron.setDB( d0_corr, d0_err, pat::Electron::BS2D);
1111 
1112  // BS3D
1113  result =
1115  GlobalVector(track->px(),
1116  track->py(),
1117  track->pz()),
1118  vBeamspot);
1119  d0_corr = result.second.value();
1120  d0_err = beamspotIsValid ? result.second.error() : -1.0;
1121  anElectron.setDB( d0_corr, d0_err, pat::Electron::BS3D);
1122 }
Covariance3DMatrix covariance3D() const
return only 3D position covariance matrix
Definition: BeamSpot.h:119
void setDB(double dB, double edB, IpType type=None)
Set impact parameter of a certain type and its uncertainty.
Definition: Electron.cc:424
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:63
Global3DVector GlobalVector
Definition: GlobalVector.h:10
void PATElectronProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

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

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

Referenced by produce().

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

811  {
812 
813  //COLIN/Florian: use the PFCandidate 4-mom.
814  anElectron.setEcalDrivenMomentum(anElectron.p4()) ;
815  anElectron.setP4( anElectron.pfCandidateRef()->p4() );
816 
817 
818  // is the concrete elecRef needed for the efficiency loader? what is this loader?
819  // how can we make it compatible with the particle flow electrons?
820 
822  if (embedGsfTrack_) anElectron.embedGsfTrack();
823  if (embedSuperCluster_) anElectron.embedSuperCluster();
825  if (embedSeedCluster_) anElectron.embedSeedCluster();
826  if (embedBasicClusters_) anElectron.embedBasicClusters();
830  if (embedTrack_) anElectron.embedTrack();
831 
832  // store the match to the generated final state muons
833 
834  if (addGenMatch_) {
835  for(size_t i = 0, n = genMatches.size(); i < n; ++i) {
836  reco::GenParticleRef genElectron = (*genMatches[i])[candPtrForGenMatch];
837  anElectron.addGenParticleRef(genElectron);
838  }
839  if (embedGenMatch_) anElectron.embedGenParticle();
840  }
841 
842  //COLIN what's this? does it have to be GsfElectron specific?
843  if (efficiencyLoader_.enabled()) {
844  efficiencyLoader_.setEfficiencies( anElectron, candPtrForLoader );
845  }
846 
847  if (resolutionLoader_.enabled()) {
848  resolutionLoader_.setResolutions(anElectron);
849  }
850 
851  for (size_t j = 0, nd = deposits.size(); j < nd; ++j) {
855  deposits[j]->contains(candPtrForGenMatch.id())) {
857  (*deposits[j])[candPtrForGenMatch]);
858  }
859  else if (deposits[j]->contains(candPtrForIsolation.id())) {
860  anElectron.setIsoDeposit(isoDepositLabels_[j].first,
861  (*deposits[j])[candPtrForIsolation]);
862  }
863  else {
864  anElectron.setIsoDeposit(isoDepositLabels_[j].first,
865  (*deposits[j])[candPtrForIsolation->sourceCandidatePtr(0)]);
866  }
867  }
868 
869  for (size_t j = 0; j<isolationValues.size(); ++j) {
870  if( isolationValueLabels_[j].first==pat::TrackIso ||
873  isolationValues[j]->contains(candPtrForGenMatch.id())) {
874  anElectron.setIsolation(isolationValueLabels_[j].first,
875  (*isolationValues[j])[candPtrForGenMatch]);
876  }
877  else if (isolationValues[j]->contains(candPtrForIsolation.id())) {
878  anElectron.setIsolation(isolationValueLabels_[j].first,
879  (*isolationValues[j])[candPtrForIsolation]);
880  }
881  else {
882  anElectron.setIsolation(isolationValueLabels_[j].first,
883  (*isolationValues[j])[candPtrForIsolation->sourceCandidatePtr(0)]);
884  }
885  }
886 }
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:178
void embedTrack()
method to store the electron&#39;s Track internally
Definition: Electron.cc:285
void embedSeedCluster()
method to store the electron&#39;s seedcluster internally
Definition: Electron.cc:228
void setIsolation(IsolationKeys key, float value)
Definition: Lepton.h:100
void embedGsfElectronCore()
method to store the electron&#39;s core internally
Definition: Electron.cc:191
bool contains(EventRange const &lh, EventID const &rh)
Definition: EventRange.cc:38
void embedPflowBasicClusters()
method to store the electron&#39;s pflow basic clusters
Definition: Electron.cc:261
const LorentzVector & p4(P4Kind kind) const
Definition: GsfElectron.cc:204
void embedSuperCluster()
method to store the electron&#39;s SuperCluster internally
Definition: Electron.cc:210
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 embedPreshowerClusters()
method to store the electron&#39;s preshower clusters
Definition: Electron.cc:249
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:177
void embedBasicClusters()
method to store the electron&#39;s basic clusters
Definition: Electron.cc:237
void embedGenParticle()
Definition: PATObject.h:675
ProductID id() const
Accessor for product ID.
Definition: Ptr.h:164
int j
Definition: DBlmapReader.cc:9
reco::PFCandidateRef pfCandidateRef() const
reference to the source PFCandidates; null if this has been built from a standard electron ...
Definition: Electron.cc:339
bool first
Definition: L1TdeRCT.cc:94
void embedGsfTrack()
method to store the electron&#39;s GsfTrack internally
Definition: Electron.cc:200
void addGenParticleRef(const reco::GenParticleRef &ref)
Definition: PATObject.h:659
pat::helper::EfficiencyLoader efficiencyLoader_
void embedPflowSuperCluster()
method to store the electron&#39;s PflowSuperCluster internally
Definition: Electron.cc:219
void setEfficiencies(pat::PATObject< T > &obj, const R &originalRef) const
Sets the efficiencies for this object, using the reference to the original objects.
IsolationLabels isolationValueLabels_
pat::helper::KinResolutionsLoader resolutionLoader_
void embedPflowPreshowerClusters()
method to store the electron&#39;s pflow preshower clusters
Definition: Electron.cc:273
void PATElectronProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::EDProducer.

Definition at line 172 of file PATElectronProducer.cc.

References IPTools::absoluteImpactParameter3D(), IPTools::absoluteTransverseImpactParameter(), addElecID_, addGenMatch_, Reference_intrackfit_cff::barrel, beamLineSrc_, SiPixelRawToDigiRegional_cfi::beamSpot, pat::helper::MultiIsolator::beginEvent(), reco::PFCandidate::e, EcalClusterLazyTools::e3x3(), DetId::Ecal, EcalBarrel, EcalEndcap, ecalTopology_, efficiencyLoader_, elecIDSrcs_, HI_PhotonSkim_cff::electrons, electronSrc_, embedGenMatch_, embedHighLevel(), embedHighLevelSelection_, pat::Electron::embedPFCandidate(), embedPFCandidate_, 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(), spr::find(), edm::SortedCollection< T, SORT >::find(), first, genMatchSrc_, edm::EventSetup::get(), edm::Event::getByLabel(), EcalClusterLazyTools::getMaximum(), CaloTopology::getSubdetectorTopology(), CaloSubdetectorTopology::getWindow(), ConversionTools::hasMatchedConversion(), i, customizeTrackingMonitorSeedNumber::idx, getHLTprescales::index, edm::Ref< C, T, F >::isAvailable(), edm::Ptr< T >::isNonnull(), edm::Ref< C, T, F >::isNonnull(), edm::isNotFinite(), isoDepositLabels_, isolationValueLabels_, isolationValueLabelsNoPFId_, isolator_, isolatorTmpStorage_, edm::EventBase::isRealData(), edm::HandleBase::isValid(), j, EcalClusterLazyTools::localCovariances(), reco::Matched, pat::helper::EfficiencyLoader::newEvent(), pat::helper::KinResolutionsLoader::newEvent(), electronProducer_cfi::patElectrons, pfCandidateMap_, pfElecSrc_, pfElectrons_cff::pfElectrons, edm::Handle< T >::product(), pTComparator_, edm::SortedCollection< T, SORT >::push_back(), edm::Event::put(), pvSrc_, reducedBarrelRecHitCollection_, reducedEndcapRecHitCollection_, resolutionLoader_, query::result, edm::second(), 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 >::sort(), python.multivaluedict::sort(), mathSSE::sqrt(), DetId::subdetId(), groupFilesInBlocks::tt, useParticleFlow_, usePV_, userDataHelper_, useUserData_, reco::BeamSpot::x0(), reco::BeamSpot::y0(), and reco::BeamSpot::z0().

173 {
174  // switch off embedding (in unschedules mode)
175  if (iEvent.isRealData()){
176  addGenMatch_ = false;
177  embedGenMatch_ = false;
178  }
179 
180  edm::ESHandle<CaloTopology> theCaloTopology;
181  iSetup.get<CaloTopologyRecord>().get(theCaloTopology);
182  ecalTopology_ = & (*theCaloTopology);
183 
184  // Get the collection of electrons from the event
186  iEvent.getByLabel(electronSrc_, electrons);
187 
188  // for additional mva variables
189  edm::InputTag reducedEBRecHitCollection(string("reducedEcalRecHitsEB"));
190  edm::InputTag reducedEERecHitCollection(string("reducedEcalRecHitsEE"));
191  //EcalClusterLazyTools lazyTools(iEvent, iSetup, reducedEBRecHitCollection, reducedEERecHitCollection);
193 
194  // for conversion veto selection
196  iEvent.getByLabel("allConversions", hConversions);
197 
198  // Get the ESHandle for the transient track builder, if needed for
199  // high level selection embedding
201 
202  if (isolator_.enabled()) isolator_.beginEvent(iEvent,iSetup);
203 
205  if (resolutionLoader_.enabled()) resolutionLoader_.newEvent(iEvent, iSetup);
206 
207  IsoDepositMaps deposits(isoDepositLabels_.size());
208  for (size_t j = 0, nd = deposits.size(); j < nd; ++j) {
209  iEvent.getByLabel(isoDepositLabels_[j].second, deposits[j]);
210  }
211 
212  IsolationValueMaps isolationValues(isolationValueLabels_.size());
213  for (size_t j = 0; j<isolationValueLabels_.size(); ++j) {
214  iEvent.getByLabel(isolationValueLabels_[j].second, isolationValues[j]);
215  }
216 
217  IsolationValueMaps isolationValuesNoPFId(isolationValueLabelsNoPFId_.size());
218  for (size_t j = 0; j<isolationValueLabelsNoPFId_.size(); ++j) {
219  iEvent.getByLabel(isolationValueLabelsNoPFId_[j].second, isolationValuesNoPFId[j]);
220  }
221 
222  // prepare the MC matching
223  GenAssociations genMatches(genMatchSrc_.size());
224  if (addGenMatch_) {
225  for (size_t j = 0, nd = genMatchSrc_.size(); j < nd; ++j) {
226  iEvent.getByLabel(genMatchSrc_[j], genMatches[j]);
227  }
228  }
229 
230  // prepare ID extraction
231  std::vector<edm::Handle<edm::ValueMap<float> > > idhandles;
232  std::vector<pat::Electron::IdPair> ids;
233  if (addElecID_) {
234  idhandles.resize(elecIDSrcs_.size());
235  ids.resize(elecIDSrcs_.size());
236  for (size_t i = 0; i < elecIDSrcs_.size(); ++i) {
237  iEvent.getByLabel(elecIDSrcs_[i].second, idhandles[i]);
238  ids[i].first = elecIDSrcs_[i].first;
239  }
240  }
241 
242 
243  // prepare the high level selection:
244  // needs beamline
245  reco::TrackBase::Point beamPoint(0,0,0);
246  reco::Vertex primaryVertex;
248  bool beamSpotIsValid = false;
249  bool primaryVertexIsValid = false;
250 
251  // Get the beamspot
252  edm::Handle<reco::BeamSpot> beamSpotHandle;
253  iEvent.getByLabel(beamLineSrc_, beamSpotHandle);
254 
255  if ( embedHighLevelSelection_ ) {
256  // Get the primary vertex
258  iEvent.getByLabel( pvSrc_, pvHandle );
259 
260  // This is needed by the IPTools methods from the tracking group
261  iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder", trackBuilder);
262 
263  if ( ! usePV_ ) {
264 
265  if ( beamSpotHandle.isValid() ){
266  beamSpot = *beamSpotHandle;
267  beamSpotIsValid = true;
268  } else{
269  edm::LogError("DataNotAvailable")
270  << "No beam spot available from EventSetup, not adding high level selection \n";
271  }
272 
273  double x0 = beamSpot.x0();
274  double y0 = beamSpot.y0();
275  double z0 = beamSpot.z0();
276 
277  beamPoint = reco::TrackBase::Point ( x0, y0, z0 );
278  } else {
279  if ( pvHandle.isValid() && !pvHandle->empty() ) {
280  primaryVertex = pvHandle->at(0);
281  primaryVertexIsValid = true;
282  } else {
283  edm::LogError("DataNotAvailable")
284  << "No primary vertex available from EventSetup, not adding high level selection \n";
285  }
286  }
287  }
288 
289  std::vector<Electron> * patElectrons = new std::vector<Electron>();
290 
291  if( useParticleFlow_ ) {
293  iEvent.getByLabel(pfElecSrc_, pfElectrons);
294  unsigned index=0;
295 
296  for( reco::PFCandidateConstIterator i = pfElectrons->begin();
297  i != pfElectrons->end(); ++i, ++index) {
298 
299  reco::PFCandidateRef pfRef(pfElectrons, index);
300  reco::PFCandidatePtr ptrToPFElectron(pfElectrons,index);
301 // reco::CandidateBaseRef pfBaseRef( pfRef );
302 
303  reco::GsfTrackRef PfTk= i->gsfTrackRef();
304 
305  bool Matched=false;
306  bool MatchedToAmbiguousGsfTrack=false;
307  for (edm::View<reco::GsfElectron>::const_iterator itElectron = electrons->begin(); itElectron != electrons->end(); ++itElectron) {
308  unsigned int idx = itElectron - electrons->begin();
309  if (Matched || MatchedToAmbiguousGsfTrack) continue;
310 
311  reco::GsfTrackRef EgTk= itElectron->gsfTrack();
312 
313  if (itElectron->gsfTrack()==i->gsfTrackRef()){
314  Matched=true;
315  }
316  else {
317  for( reco::GsfTrackRefVector::const_iterator it = itElectron->ambiguousGsfTracksBegin() ;
318  it!=itElectron->ambiguousGsfTracksEnd(); it++ ){
319  MatchedToAmbiguousGsfTrack |= (bool)(i->gsfTrackRef()==(*it));
320  }
321  }
322 
323  if (Matched || MatchedToAmbiguousGsfTrack){
324 
325  // ptr needed for finding the matched gen particle
326  reco::CandidatePtr ptrToGsfElectron(electrons,idx);
327 
328  // ref to base needed for the construction of the pat object
329  const edm::RefToBase<reco::GsfElectron>& elecsRef = electrons->refAt(idx);
330  Electron anElectron(elecsRef);
331  anElectron.setPFCandidateRef( pfRef );
332 
333  //it should be always true when particleFlow electrons are used.
334  anElectron.setIsPF( true );
335 
336  if( embedPFCandidate_ ) anElectron.embedPFCandidate();
337 
338  if ( useUserData_ ) {
339  userDataHelper_.add( anElectron, iEvent, iSetup );
340  }
341 
342  double ip3d = -999; // for mva variable
343 
344  // embed high level selection
345  if ( embedHighLevelSelection_ ) {
346  // get the global track
347  reco::GsfTrackRef track = PfTk;
348 
349  // Make sure the collection it points to is there
350  if ( track.isNonnull() && track.isAvailable() ) {
351 
352  reco::TransientTrack tt = trackBuilder->build(track);
353  embedHighLevel( anElectron,
354  track,
355  tt,
356  primaryVertex,
357  primaryVertexIsValid,
358  beamSpot,
359  beamSpotIsValid );
360 
361  std::pair<bool,Measurement1D> ip3dpv = IPTools::absoluteImpactParameter3D(tt, primaryVertex);
362  ip3d = ip3dpv.second.value(); // for mva variable
363 
364  if ( !usePV_ ) {
365  double corr_d0 = track->dxy( beamPoint );
366  anElectron.setDB( corr_d0, -1.0 );
367  } else {
368  std::pair<bool,Measurement1D> result = IPTools::absoluteTransverseImpactParameter(tt, primaryVertex);
369  double d0_corr = result.second.value();
370  double d0_err = result.second.error();
371  anElectron.setDB( d0_corr, d0_err );
372  }
373  }
374  }
375 
376  //Electron Id
377 
378  if (addElecID_) {
379  //STANDARD EL ID
380  for (size_t i = 0; i < elecIDSrcs_.size(); ++i) {
381  ids[i].second = (*idhandles[i])[elecsRef];
382  }
383  //SPECIFIC PF ID
384  ids.push_back(std::make_pair("pf_evspi",pfRef->mva_e_pi()));
385  ids.push_back(std::make_pair("pf_evsmu",pfRef->mva_e_mu()));
386  anElectron.setElectronIDs(ids);
387  }
388 
389  // add missing mva variables
390  double r9 = lazyTools.e3x3( *( itElectron->superCluster()->seed())) / itElectron->superCluster()->rawEnergy() ;
391  double sigmaIphiIphi;
392  double sigmaIetaIphi;
393  std::vector<float> vCov = lazyTools.localCovariances(*( itElectron->superCluster()->seed()));
394  if( !edm::isNotFinite(vCov[2])) sigmaIphiIphi = sqrt(vCov[2]);
395  else sigmaIphiIphi = 0;
396  sigmaIetaIphi = vCov[1];
397  anElectron.setMvaVariables( r9, sigmaIphiIphi, sigmaIetaIphi, ip3d);
398 
399  // get list of EcalDetId within 5x5 around the seed
400  bool barrel = itElectron->isEB();
401  DetId seed = lazyTools.getMaximum(*(itElectron->superCluster()->seed())).first;
402  std::vector<DetId> selectedCells = (barrel) ? ecalTopology_->getSubdetectorTopology(DetId::Ecal,EcalBarrel)->getWindow(seed,5,5):
404 
405  // Do it for all basic clusters in 5x5
406  reco::CaloCluster_iterator itscl = itElectron->superCluster()->clustersBegin();
407  reco::CaloCluster_iterator itsclE = itElectron->superCluster()->clustersEnd();
408  std::vector<DetId> cellsIn5x5;
409  for ( ; itscl!= itsclE ; ++ itscl) {
410  DetId seed=lazyTools.getMaximum(*(*itscl)).first;
411  bool bcbarrel = seed.subdetId()==EcalBarrel;
412  std::vector<DetId> cellsToAdd = (bcbarrel) ? ecalTopology_->getSubdetectorTopology(DetId::Ecal,EcalBarrel)->getWindow(seed,5,5):
414  cellsIn5x5.insert(cellsIn5x5.end(),cellsToAdd.begin(), cellsToAdd.end());
415 
416  }
417 
418  // Add to the list of selectedCells checking that there is no duplicate
419  unsigned nCellsIn5x5 = cellsIn5x5.size() ;
420 
421  for(unsigned i=0; i< nCellsIn5x5 ; ++i ) {
422  std::vector<DetId>::const_iterator itcheck = find(selectedCells.begin(), selectedCells.end(),cellsIn5x5[i]);
423  if (itcheck == selectedCells.end())
424  selectedCells.push_back(cellsIn5x5[i]);
425  }
426 
427 
428  // add the DetId of the SC
429  std::vector< std::pair<DetId, float> >::const_iterator it=itElectron->superCluster()->hitsAndFractions().begin();
430  std::vector< std::pair<DetId, float> >::const_iterator itend=itElectron->superCluster()->hitsAndFractions().end();
431  for( ; it!=itend ; ++it) {
432  DetId id=it->first;
433  // check if already saved
434  std::vector<DetId>::const_iterator itcheck = find(selectedCells.begin(),selectedCells.end(),id);
435  if ( itcheck == selectedCells.end()) {
436  selectedCells.push_back(id);
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()->trackerExpectedHitsInner().numberOfLostHits() < 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.getByLabel(pfCandidateMap_,ValMapH);
503  // Try to access a PFCandidate collection, as supplied by the user
505  bool pfCandsPresent = iEvent.getByLabel(pfElecSrc_, 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  double r9 = lazyTools.e3x3( *( itElectron->superCluster()->seed())) / itElectron->superCluster()->rawEnergy() ;
610  double sigmaIphiIphi;
611  double sigmaIetaIphi;
612  std::vector<float> vCov = lazyTools.localCovariances(*( itElectron->superCluster()->seed()));
613  if( !edm::isNotFinite(vCov[2])) sigmaIphiIphi = sqrt(vCov[2]);
614  else sigmaIphiIphi = 0;
615  sigmaIetaIphi = vCov[1];
616  anElectron.setMvaVariables( r9, sigmaIphiIphi, sigmaIetaIphi, ip3d);
617 
618  // get list of EcalDetId within 5x5 around the seed
619  bool barrel= itElectron->isEB();
620 
621  DetId seed=lazyTools.getMaximum(*(itElectron->superCluster()->seed())).first;
622  std::vector<DetId> selectedCells = (barrel) ? ecalTopology_->getSubdetectorTopology(DetId::Ecal,EcalBarrel)->getWindow(seed,5,5):
624 
625 
626  // Do it for all basic clusters in 5x5
627  reco::CaloCluster_iterator itscl = itElectron->superCluster()->clustersBegin();
628  reco::CaloCluster_iterator itsclE = itElectron->superCluster()->clustersEnd();
629  std::vector<DetId> cellsIn5x5;
630  for ( ; itscl!= itsclE ; ++ itscl) {
631  DetId seed=lazyTools.getMaximum(*(*itscl)).first;
632  bool bcbarrel = seed.subdetId()==EcalBarrel;
633  std::vector<DetId> cellsToAdd = (bcbarrel) ? ecalTopology_->getSubdetectorTopology(DetId::Ecal,EcalBarrel)->getWindow(seed,5,5):
635  cellsIn5x5.insert(cellsIn5x5.end(),cellsToAdd.begin(), cellsToAdd.end());
636 
637  }
638  // Add to the list of selectedCells checking that there is no duplicate
639  unsigned nCellsIn5x5 = cellsIn5x5.size() ;
640 
641  for(unsigned i=0; i< nCellsIn5x5 ; ++i ) {
642  std::vector<DetId>::const_iterator itcheck = find(selectedCells.begin(), selectedCells.end(),cellsIn5x5[i]);
643  if (itcheck == selectedCells.end())
644  selectedCells.push_back(cellsIn5x5[i]);
645  }
646 
647  // Add all RecHits of the SC if not already present
648  std::vector< std::pair<DetId, float> >::const_iterator it=itElectron->superCluster()->hitsAndFractions().begin();
649  std::vector< std::pair<DetId, float> >::const_iterator itend=itElectron->superCluster()->hitsAndFractions().end();
650  for( ; it!=itend ; ++it) {
651  DetId id=it->first;
652  // check if already saved
653  std::vector<DetId>::const_iterator itcheck = find(selectedCells.begin(),selectedCells.end(),id);
654  if ( itcheck == selectedCells.end()) {
655  selectedCells.push_back(id);
656  }
657  }
658  // Retrieve the corresponding RecHits
659 
661  if(barrel)
663  else
665 
666  EcalRecHitCollection selectedRecHits;
667  const EcalRecHitCollection *recHits = rechitsH.product();
668 
669  unsigned nSelectedCells = selectedCells.size();
670  for (unsigned icell = 0 ; icell < nSelectedCells ; ++icell) {
671  EcalRecHitCollection::const_iterator it = recHits->find( selectedCells[icell] );
672  if ( it != recHits->end() ) {
673  selectedRecHits.push_back(*it);
674  }
675  }
676  selectedRecHits.sort();
677  if (embedRecHits_) anElectron.embedRecHits(& selectedRecHits);
678 
679  // set conversion veto selection
680  bool passconversionveto = false;
681  if( hConversions.isValid()){
682  // this is recommended method
683  passconversionveto = !ConversionTools::hasMatchedConversion( *itElectron, hConversions, beamSpotHandle->position());
684  }else{
685  // use missing hits without vertex fit method
686  passconversionveto = itElectron->gsfTrack()->trackerExpectedHitsInner().numberOfLostHits() < 1;
687  }
688  anElectron.setPassConversionVeto( passconversionveto );
689 
690  // add sel to selected
691  fillElectron( anElectron, elecsRef,elecBaseRef,
692  genMatches, deposits, pfId, isolationValues, isolationValuesNoPFId);
693  patElectrons->push_back(anElectron);
694  }
695  }
696 
697  // sort electrons in pt
698  std::sort(patElectrons->begin(), patElectrons->end(), pTComparator_);
699 
700  // add the electrons to the event output
701  std::auto_ptr<std::vector<Electron> > ptr(patElectrons);
702  iEvent.put(ptr);
703 
704  // clean up
706 
707 }
bool enabled() const
&#39;true&#39; if this there is at least one efficiency configured
double z0() const
z coordinate
Definition: BeamSpot.h:69
int i
Definition: DBlmapReader.cc:9
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
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)
bool isAvailable() const
Definition: Ref.h:276
PFCandidateCollection::const_iterator PFCandidateConstIterator
iterator
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
bool isRealData() const
Definition: EventBase.h:60
std::vector< edm::InputTag > genMatchSrc_
bool enabled() const
&#39;true&#39; if this there is at least one efficiency configured
U second(std::pair< T, U > const &p)
bool enabled() const
True if it has a non null configuration.
Definition: MultiIsolator.h:50
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:250
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)
bool isNotFinite(T x)
Definition: isFinite.h:10
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
T sqrt(T t)
Definition: SSEVec.h:48
tuple result
Definition: query.py:137
edm::InputTag reducedEndcapRecHitCollection_
int j
Definition: DBlmapReader.cc:9
edm::InputTag reducedBarrelRecHitCollection_
mva input variables
math::XYZPoint Point
point in the space
Definition: TrackBase.h:76
std::vector< edm::Handle< edm::ValueMap< double > > > IsolationValueMaps
bool embedHighLevelSelection_
embed high level selection variables?
bool first
Definition: L1TdeRCT.cc:94
bool isValid() const
Definition: HandleBase.h:76
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
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:20
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
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
IsolationLabels isolationValueLabelsNoPFId_
T const * product() const
Definition: Handle.h:74
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)
IsolationLabels isolationValueLabels_
double y0() const
y coordinate
Definition: BeamSpot.h:67
pat::helper::KinResolutionsLoader resolutionLoader_
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.
void newEvent(const edm::Event &event) const
To be called for each new event, reads in the ValueMaps for efficiencies.
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:65
std::vector< edm::Handle< edm::ValueMap< IsoDeposit > > > IsoDepositMaps
void PATElectronProducer::readIsolationLabels ( const edm::ParameterSet iConfig,
const char *  psetName,
IsolationLabels labels 
)
private

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

Definition at line 1015 of file PATElectronProducer.cc.

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

Referenced by PATElectronProducer().

1017  {
1018 
1019  labels.clear();
1020 
1021  if (iConfig.exists( psetName )) {
1022  edm::ParameterSet depconf
1023  = iConfig.getParameter<edm::ParameterSet>(psetName);
1024 
1025  if (depconf.exists("tracker")) labels.push_back(std::make_pair(pat::TrackIso, depconf.getParameter<edm::InputTag>("tracker")));
1026  if (depconf.exists("ecal")) labels.push_back(std::make_pair(pat::EcalIso, depconf.getParameter<edm::InputTag>("ecal")));
1027  if (depconf.exists("hcal")) labels.push_back(std::make_pair(pat::HcalIso, depconf.getParameter<edm::InputTag>("hcal")));
1028  if (depconf.exists("pfAllParticles")) {
1029  labels.push_back(std::make_pair(pat::PfAllParticleIso, depconf.getParameter<edm::InputTag>("pfAllParticles")));
1030  }
1031  if (depconf.exists("pfChargedHadrons")) {
1032  labels.push_back(std::make_pair(pat::PfChargedHadronIso, depconf.getParameter<edm::InputTag>("pfChargedHadrons")));
1033  }
1034  if (depconf.exists("pfChargedAll")) {
1035  labels.push_back(std::make_pair(pat::PfChargedAllIso, depconf.getParameter<edm::InputTag>("pfChargedAll")));
1036  }
1037  if (depconf.exists("pfPUChargedHadrons")) {
1038  labels.push_back(std::make_pair(pat::PfPUChargedHadronIso, depconf.getParameter<edm::InputTag>("pfPUChargedHadrons")));
1039  }
1040  if (depconf.exists("pfNeutralHadrons")) {
1041  labels.push_back(std::make_pair(pat::PfNeutralHadronIso, depconf.getParameter<edm::InputTag>("pfNeutralHadrons")));
1042  }
1043  if (depconf.exists("pfPhotons")) {
1044  labels.push_back(std::make_pair(pat::PfGammaIso, depconf.getParameter<edm::InputTag>("pfPhotons")));
1045  }
1046  if (depconf.exists("user")) {
1047  std::vector<edm::InputTag> userdeps = depconf.getParameter<std::vector<edm::InputTag> >("user");
1048  std::vector<edm::InputTag>::const_iterator it = userdeps.begin(), ed = userdeps.end();
1049  int key = UserBaseIso;
1050  for ( ; it != ed; ++it, ++key) {
1051  labels.push_back(std::make_pair(IsolationKeys(key), *it));
1052  }
1053  }
1054  }
1055 
1056 
1057 }
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
list key
Definition: combine.py:13

Member Data Documentation

bool pat::PATElectronProducer::addEfficiencies_
private

Definition at line 158 of file PATElectronProducer.h.

Referenced by PATElectronProducer().

bool pat::PATElectronProducer::addElecID_
private

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

bool pat::PATElectronProducer::addResolutions_
private

Definition at line 161 of file PATElectronProducer.h.

Referenced by PATElectronProducer().

edm::InputTag pat::PATElectronProducer::beamLineSrc_
private

Definition at line 98 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

const CaloTopology* pat::PATElectronProducer::ecalTopology_
private

Definition at line 167 of file PATElectronProducer.h.

Referenced by produce().

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

Definition at line 159 of file PATElectronProducer.h.

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

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

Definition at line 147 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

edm::InputTag pat::PATElectronProducer::electronSrc_
private

Definition at line 69 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(), and PATElectronProducer().

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

Referenced by PATElectronProducer(), and produce().

bool pat::PATElectronProducer::embedPFCandidate_
private

Definition at line 90 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(), and PATElectronProducer().

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::InputTag> pat::PATElectronProducer::genMatchSrc_
private

Definition at line 84 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

IsolationLabels pat::PATElectronProducer::isoDepositLabels_
private

Definition at line 154 of file PATElectronProducer.h.

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

IsolationLabels pat::PATElectronProducer::isolationValueLabels_
private

Definition at line 155 of file PATElectronProducer.h.

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

IsolationLabels pat::PATElectronProducer::isolationValueLabelsNoPFId_
private

Definition at line 156 of file PATElectronProducer.h.

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

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

Definition at line 152 of file PATElectronProducer.h.

Referenced by produce().

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

Definition at line 153 of file PATElectronProducer.h.

Referenced by produce().

edm::InputTag pat::PATElectronProducer::pfCandidateMap_
private

Definition at line 89 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

edm::InputTag pat::PATElectronProducer::pfElecSrc_
private

Definition at line 88 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

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

Definition at line 150 of file PATElectronProducer.h.

Referenced by produce().

edm::InputTag pat::PATElectronProducer::pvSrc_
private

Definition at line 100 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

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

mva input variables

Definition at line 93 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

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

Definition at line 94 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

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

Definition at line 162 of file PATElectronProducer.h.

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

bool pat::PATElectronProducer::useParticleFlow_
private

pflow specific

Definition at line 87 of file PATElectronProducer.h.

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

bool pat::PATElectronProducer::usePV_
private

Definition at line 99 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

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

Definition at line 165 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

bool pat::PATElectronProducer::useUserData_
private

Definition at line 164 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().