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::stream::EDProducer<> edm::stream::EDProducerBase 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::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 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
std::vector< ConsumesInfoconsumesInfo () const
 
 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
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) 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::stream::EDProducerBase
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

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

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Produces pat::Electron's.

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

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

Definition at line 54 of file PATElectronProducer.h.

Member Typedef Documentation

Definition at line 109 of file PATElectronProducer.h.

Definition at line 84 of file PATElectronProducer.h.

Definition at line 110 of file PATElectronProducer.h.

Definition at line 142 of file PATElectronProducer.h.

Definition at line 143 of file PATElectronProducer.h.

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

Definition at line 111 of file PATElectronProducer.h.

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

Definition at line 153 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(), edm::ParameterSet::existsAs(), genMatchTokens_, edm::ParameterSet::getParameter(), GlobalPosition_Frontier_DevDB_cff::tag, and edm::vector_transform().

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

Definition at line 178 of file PATElectronProducer.cc.

179 {
180 }

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

1018 {
1019  // Correct to PV
1020 
1021  // PV2D
1022  std::pair<bool,Measurement1D> result =
1024  GlobalVector(track->px(),
1025  track->py(),
1026  track->pz()),
1027  primaryVertex);
1028  double d0_corr = result.second.value();
1029  double d0_err = primaryVertexIsValid ? result.second.error() : -1.0;
1030  anElectron.setDB( d0_corr, d0_err, pat::Electron::PV2D);
1031 
1032 
1033  // PV3D
1034  result =
1036  GlobalVector(track->px(),
1037  track->py(),
1038  track->pz()),
1039  primaryVertex);
1040  d0_corr = result.second.value();
1041  d0_err = primaryVertexIsValid ? result.second.error() : -1.0;
1042  anElectron.setDB( d0_corr, d0_err, pat::Electron::PV3D);
1043 
1044 
1045  // Correct to beam spot
1046  // make a fake vertex out of beam spot
1047  reco::Vertex vBeamspot(beamspot.position(), beamspot.covariance3D());
1048 
1049  // BS2D
1050  result =
1052  GlobalVector(track->px(),
1053  track->py(),
1054  track->pz()),
1055  vBeamspot);
1056  d0_corr = result.second.value();
1057  d0_err = beamspotIsValid ? result.second.error() : -1.0;
1058  anElectron.setDB( d0_corr, d0_err, pat::Electron::BS2D);
1059 
1060  // BS3D
1061  result =
1063  GlobalVector(track->px(),
1064  track->py(),
1065  track->pz()),
1066  vBeamspot);
1067  d0_corr = result.second.value();
1068  d0_err = beamspotIsValid ? result.second.error() : -1.0;
1069  anElectron.setDB( d0_corr, d0_err, pat::Electron::BS3D);
1070 }
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
void setDB(double dB, double edB, IPTYPE type)
Set impact parameter of a certain type and its uncertainty.
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 880 of file PATElectronProducer.cc.

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

881 {
883  iDesc.setComment("PAT electron producer module");
884 
885  // input source
886  iDesc.add<edm::InputTag>("pfCandidateMap", edm::InputTag("no default"))->setComment("input collection");
887  iDesc.add<edm::InputTag>("electronSource", edm::InputTag("no default"))->setComment("input collection");
888 
889  iDesc.ifValue(edm::ParameterDescription<bool>("addPFClusterIso", false, true),
890  true >> (edm::ParameterDescription<edm::InputTag>("ecalPFClusterIsoMap", edm::InputTag("electronEcalPFClusterIsolationProducer"), true) and
891  edm::ParameterDescription<edm::InputTag>("hcalPFClusterIsoMap", edm::InputTag("electronHcalPFClusterIsolationProducer"),true)) or
892  false >> (edm::ParameterDescription<edm::InputTag>("ecalPFClusterIsoMap", edm::InputTag(""), true) and
893  edm::ParameterDescription<edm::InputTag>("hcalPFClusterIsoMap", edm::InputTag(""),true)));
894 
895  // embedding
896  iDesc.add<bool>("embedGsfElectronCore", true)->setComment("embed external gsf electron core");
897  iDesc.add<bool>("embedGsfTrack", true)->setComment("embed external gsf track");
898  iDesc.add<bool>("embedSuperCluster", true)->setComment("embed external super cluster");
899  iDesc.add<bool>("embedPflowSuperCluster", true)->setComment("embed external super cluster");
900  iDesc.add<bool>("embedSeedCluster", true)->setComment("embed external seed cluster");
901  iDesc.add<bool>("embedBasicClusters", true)->setComment("embed external basic clusters");
902  iDesc.add<bool>("embedPreshowerClusters", true)->setComment("embed external preshower clusters");
903  iDesc.add<bool>("embedPflowBasicClusters", true)->setComment("embed external pflow basic clusters");
904  iDesc.add<bool>("embedPflowPreshowerClusters", true)->setComment("embed external pflow preshower clusters");
905  iDesc.add<bool>("embedTrack", false)->setComment("embed external track");
906  iDesc.add<bool>("embedRecHits", true)->setComment("embed external RecHits");
907 
908  // pf specific parameters
909  iDesc.add<edm::InputTag>("pfElectronSource", edm::InputTag("pfElectrons"))->setComment("particle flow input collection");
910  iDesc.add<bool>("useParticleFlow", false)->setComment("whether to use particle flow or not");
911  iDesc.add<bool>("embedPFCandidate", false)->setComment("embed external particle flow object");
912 
913  // MC matching configurables
914  iDesc.add<bool>("addGenMatch", true)->setComment("add MC matching");
915  iDesc.add<bool>("embedGenMatch", false)->setComment("embed MC matched MC information");
916  std::vector<edm::InputTag> emptySourceVector;
917  iDesc.addNode( edm::ParameterDescription<edm::InputTag>("genParticleMatch", edm::InputTag(), true) xor
918  edm::ParameterDescription<std::vector<edm::InputTag> >("genParticleMatch", emptySourceVector, true)
919  )->setComment("input with MC match information");
920 
921  // electron ID configurables
922  iDesc.add<bool>("addElectronID",true)->setComment("add electron ID variables");
923  edm::ParameterSetDescription electronIDSourcesPSet;
924  electronIDSourcesPSet.setAllowAnything();
925  iDesc.addNode( edm::ParameterDescription<edm::InputTag>("electronIDSource", edm::InputTag(), true) xor
926  edm::ParameterDescription<edm::ParameterSetDescription>("electronIDSources", electronIDSourcesPSet, true)
927  )->setComment("input with electron ID variables");
928 
929 
930  // IsoDeposit configurables
931  edm::ParameterSetDescription isoDepositsPSet;
932  isoDepositsPSet.addOptional<edm::InputTag>("tracker");
933  isoDepositsPSet.addOptional<edm::InputTag>("ecal");
934  isoDepositsPSet.addOptional<edm::InputTag>("hcal");
935  isoDepositsPSet.addOptional<edm::InputTag>("pfAllParticles");
936  isoDepositsPSet.addOptional<edm::InputTag>("pfChargedHadrons");
937  isoDepositsPSet.addOptional<edm::InputTag>("pfChargedAll");
938  isoDepositsPSet.addOptional<edm::InputTag>("pfPUChargedHadrons");
939  isoDepositsPSet.addOptional<edm::InputTag>("pfNeutralHadrons");
940  isoDepositsPSet.addOptional<edm::InputTag>("pfPhotons");
941  isoDepositsPSet.addOptional<std::vector<edm::InputTag> >("user");
942  iDesc.addOptional("isoDeposits", isoDepositsPSet);
943 
944  // isolation values configurables
945  edm::ParameterSetDescription isolationValuesPSet;
946  isolationValuesPSet.addOptional<edm::InputTag>("tracker");
947  isolationValuesPSet.addOptional<edm::InputTag>("ecal");
948  isolationValuesPSet.addOptional<edm::InputTag>("hcal");
949  isolationValuesPSet.addOptional<edm::InputTag>("pfAllParticles");
950  isolationValuesPSet.addOptional<edm::InputTag>("pfChargedHadrons");
951  isolationValuesPSet.addOptional<edm::InputTag>("pfChargedAll");
952  isolationValuesPSet.addOptional<edm::InputTag>("pfPUChargedHadrons");
953  isolationValuesPSet.addOptional<edm::InputTag>("pfNeutralHadrons");
954  isolationValuesPSet.addOptional<edm::InputTag>("pfPhotons");
955  isolationValuesPSet.addOptional<std::vector<edm::InputTag> >("user");
956  iDesc.addOptional("isolationValues", isolationValuesPSet);
957 
958  // isolation values configurables
959  edm::ParameterSetDescription isolationValuesNoPFIdPSet;
960  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("tracker");
961  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("ecal");
962  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("hcal");
963  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("pfAllParticles");
964  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("pfChargedHadrons");
965  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("pfChargedAll");
966  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("pfPUChargedHadrons");
967  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("pfNeutralHadrons");
968  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("pfPhotons");
969  isolationValuesNoPFIdPSet.addOptional<std::vector<edm::InputTag> >("user");
970  iDesc.addOptional("isolationValuesNoPFId", isolationValuesNoPFIdPSet);
971 
972  // Efficiency configurables
973  edm::ParameterSetDescription efficienciesPSet;
974  efficienciesPSet.setAllowAnything(); // TODO: the pat helper needs to implement a description.
975  iDesc.add("efficiencies", efficienciesPSet);
976  iDesc.add<bool>("addEfficiencies", false);
977 
978  // Check to see if the user wants to add user data
979  edm::ParameterSetDescription userDataPSet;
981  iDesc.addOptional("userData", userDataPSet);
982 
983  // electron shapes
984  iDesc.add<bool>("addElectronShapes", true);
985  iDesc.add<edm::InputTag>("reducedBarrelRecHitCollection", edm::InputTag("reducedEcalRecHitsEB"));
986  iDesc.add<edm::InputTag>("reducedEndcapRecHitCollection", edm::InputTag("reducedEcalRecHitsEE"));
987 
988  edm::ParameterSetDescription isolationPSet;
989  isolationPSet.setAllowAnything(); // TODO: the pat helper needs to implement a description.
990  iDesc.add("userIsolation", isolationPSet);
991 
992  // Resolution configurables
994 
995  iDesc.add<bool>("embedHighLevelSelection", true)->setComment("embed high level selection");
996  edm::ParameterSetDescription highLevelPSet;
997  highLevelPSet.setAllowAnything();
998  iDesc.addNode( edm::ParameterDescription<edm::InputTag>("beamLineSrc", edm::InputTag(), true)
999  )->setComment("input with high level selection");
1001  )->setComment("input with high level selection");
1002 
1003  descriptions.add("PATElectronProducer", iDesc);
1004 
1005 }
void setComment(std::string const &value)
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
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)
ParameterDescriptionNode * ifValue(ParameterDescription< T > const &switchParameter, std::auto_ptr< ParameterDescriptionCases< T > > cases)
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 699 of file PATElectronProducer.cc.

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

Referenced by produce().

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

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

Referenced by produce().

801  {
802 
803  //COLIN/Florian: use the PFCandidate 4-mom.
804  anElectron.setEcalDrivenMomentum(anElectron.p4()) ;
805  anElectron.setP4( anElectron.pfCandidateRef()->p4() );
806 
807 
808  // is the concrete elecRef needed for the efficiency loader? what is this loader?
809  // how can we make it compatible with the particle flow electrons?
810 
812  if (embedGsfTrack_) anElectron.embedGsfTrack();
813  if (embedSuperCluster_) anElectron.embedSuperCluster();
815  if (embedSeedCluster_) anElectron.embedSeedCluster();
816  if (embedBasicClusters_) anElectron.embedBasicClusters();
820  if (embedTrack_) anElectron.embedTrack();
821 
822  // store the match to the generated final state muons
823 
824  if (addGenMatch_) {
825  for(size_t i = 0, n = genMatches.size(); i < n; ++i) {
826  reco::GenParticleRef genElectron = (*genMatches[i])[candPtrForGenMatch];
827  anElectron.addGenParticleRef(genElectron);
828  }
829  if (embedGenMatch_) anElectron.embedGenParticle();
830  }
831 
832  //COLIN what's this? does it have to be GsfElectron specific?
833  if (efficiencyLoader_.enabled()) {
834  efficiencyLoader_.setEfficiencies( anElectron, candPtrForLoader );
835  }
836 
837  if (resolutionLoader_.enabled()) {
838  resolutionLoader_.setResolutions(anElectron);
839  }
840 
841  for (size_t j = 0, nd = deposits.size(); j < nd; ++j) {
845  deposits[j]->contains(candPtrForGenMatch.id())) {
847  (*deposits[j])[candPtrForGenMatch]);
848  }
849  else if (deposits[j]->contains(candPtrForIsolation.id())) {
850  anElectron.setIsoDeposit(isoDepositLabels_[j].first,
851  (*deposits[j])[candPtrForIsolation]);
852  }
853  else {
854  anElectron.setIsoDeposit(isoDepositLabels_[j].first,
855  (*deposits[j])[candPtrForIsolation->sourceCandidatePtr(0)]);
856  }
857  }
858 
859  for (size_t j = 0; j<isolationValues.size(); ++j) {
860  if( isolationValueLabels_[j].first==pat::TrackIso ||
863  isolationValues[j]->contains(candPtrForGenMatch.id())) {
864  anElectron.setIsolation(isolationValueLabels_[j].first,
865  (*isolationValues[j])[candPtrForGenMatch]);
866  }
867  else if (isolationValues[j]->contains(candPtrForIsolation.id())) {
868  anElectron.setIsolation(isolationValueLabels_[j].first,
869  (*isolationValues[j])[candPtrForIsolation]);
870  }
871  else {
872  anElectron.setIsolation(isolationValueLabels_[j].first,
873  (*isolationValues[j])[candPtrForIsolation->sourceCandidatePtr(0)]);
874  }
875  }
876 }
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:197
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:692
int j
Definition: DBlmapReader.cc:9
void embedPflowBasicClusters()
method to store the electron&#39;s pflow basic clusters
void embedBasicClusters()
method to store the electron&#39;s basic clusters
void embedGsfTrack()
method to store the electron&#39;s GsfTrack internally
void addGenParticleRef(const reco::GenParticleRef &ref)
Definition: PATObject.h:676
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:181
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::stream::EDProducerBase.

Definition at line 183 of file PATElectronProducer.cc.

References IPTools::absoluteImpactParameter3D(), addElecID_, addGenMatch_, addPFClusterIso_, Reference_intrackfit_cff::barrel, beamLineToken_, SiPixelRawToDigiRegional_cfi::beamSpot, pat::helper::MultiIsolator::beginEvent(), reco::PFCandidate::e, DetId::Ecal, EcalBarrel, EcalEndcap, ecalPFClusterIsoT_, ecalTopology_, efficiencyLoader_, elecIDSrcs_, elecIDTokens_, electronToken_, embedBasicClusters_, embedGenMatch_, embedHighLevel(), embedHighLevelSelection_, pat::Electron::embedPFCandidate(), embedPFCandidate_, embedPflowBasicClusters_, pat::Electron::embedRecHits(), embedRecHits_, pat::helper::EfficiencyLoader::enabled(), pat::helper::KinResolutionsLoader::enabled(), pat::helper::MultiIsolator::enabled(), edm::SortedCollection< T, SORT >::end(), pat::helper::MultiIsolator::endEvent(), pat::helper::MultiIsolator::fill(), fillElectron(), fillElectron2(), edm::SortedCollection< T, SORT >::find(), plotBeamSpotDB::first, genMatchTokens_, edm::EventSetup::get(), edm::Event::getByToken(), CaloTopology::getSubdetectorTopology(), CaloSubdetectorTopology::getWindow(), ConversionTools::hasMatchedConversion(), hcalPFClusterIsoT_, hConversionsToken_, 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, HLT_25ns14e33_v1_cff::primaryVertex, pTComparator_, edm::SortedCollection< T, SORT >::push_back(), edm::Event::put(), pvToken_, HLT_25ns14e33_v3_cff::recHits, reducedBarrelRecHitCollectionToken_, reducedEndcapRecHitCollectionToken_, resolutionLoader_, fileCollector::seed, pat::Electron::setEcalPFClusterIso(), pat::Electron::setElectronIDs(), pat::Electron::setHcalPFClusterIso(), 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(), groupFilesInBlocks::tt, useParticleFlow_, userDataHelper_, and useUserData_.

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

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

Definition at line 183 of file PATElectronProducer.h.

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

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

Member Data Documentation

const bool pat::PATElectronProducer::addEfficiencies_
private

Definition at line 169 of file PATElectronProducer.h.

const bool pat::PATElectronProducer::addElecID_
private

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

const bool pat::PATElectronProducer::addPFClusterIso_
private

Definition at line 100 of file PATElectronProducer.h.

Referenced by produce().

const bool pat::PATElectronProducer::addResolutions_
private

Definition at line 172 of file PATElectronProducer.h.

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

Definition at line 106 of file PATElectronProducer.h.

Referenced by produce().

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

Definition at line 101 of file PATElectronProducer.h.

Referenced by produce().

const CaloTopology* pat::PATElectronProducer::ecalTopology_
private

Definition at line 178 of file PATElectronProducer.h.

Referenced by produce().

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

Definition at line 170 of file PATElectronProducer.h.

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

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

Definition at line 154 of file PATElectronProducer.h.

Referenced by produce().

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

Definition at line 155 of file PATElectronProducer.h.

Referenced by produce().

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

Definition at line 68 of file PATElectronProducer.h.

Referenced by produce().

const bool pat::PATElectronProducer::embedBasicClusters_
private

Definition at line 75 of file PATElectronProducer.h.

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

bool pat::PATElectronProducer::embedGenMatch_
private

Definition at line 81 of file PATElectronProducer.h.

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

const bool pat::PATElectronProducer::embedGsfElectronCore_
private

Definition at line 70 of file PATElectronProducer.h.

Referenced by fillElectron(), and fillElectron2().

const bool pat::PATElectronProducer::embedGsfTrack_
private

Definition at line 71 of file PATElectronProducer.h.

Referenced by fillElectron(), and fillElectron2().

const bool pat::PATElectronProducer::embedHighLevelSelection_
private

embed high level selection variables?

Definition at line 105 of file PATElectronProducer.h.

Referenced by produce().

const bool pat::PATElectronProducer::embedPFCandidate_
private

Definition at line 92 of file PATElectronProducer.h.

Referenced by produce().

const bool pat::PATElectronProducer::embedPflowBasicClusters_
private

Definition at line 77 of file PATElectronProducer.h.

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

const bool pat::PATElectronProducer::embedPflowPreshowerClusters_
private

Definition at line 78 of file PATElectronProducer.h.

Referenced by fillElectron(), and fillElectron2().

const bool pat::PATElectronProducer::embedPflowSuperCluster_
private

Definition at line 73 of file PATElectronProducer.h.

Referenced by fillElectron(), and fillElectron2().

const bool pat::PATElectronProducer::embedPreshowerClusters_
private

Definition at line 76 of file PATElectronProducer.h.

Referenced by fillElectron(), and fillElectron2().

const bool pat::PATElectronProducer::embedRecHits_
private

Definition at line 82 of file PATElectronProducer.h.

Referenced by produce().

const bool pat::PATElectronProducer::embedSeedCluster_
private

Definition at line 74 of file PATElectronProducer.h.

Referenced by fillElectron(), and fillElectron2().

const bool pat::PATElectronProducer::embedSuperCluster_
private

Definition at line 72 of file PATElectronProducer.h.

Referenced by fillElectron(), and fillElectron2().

const bool pat::PATElectronProducer::embedTrack_
private

Definition at line 79 of file PATElectronProducer.h.

Referenced by fillElectron(), and fillElectron2().

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

Definition at line 86 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

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

Definition at line 102 of file PATElectronProducer.h.

Referenced by produce().

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

Definition at line 69 of file PATElectronProducer.h.

Referenced by produce().

IsolationLabels pat::PATElectronProducer::isoDepositLabels_
private

Definition at line 162 of file PATElectronProducer.h.

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

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

Definition at line 163 of file PATElectronProducer.h.

Referenced by produce().

IsolationLabels pat::PATElectronProducer::isolationValueLabels_
private

Definition at line 164 of file PATElectronProducer.h.

Referenced by fillElectron(), and fillElectron2().

IsolationLabels pat::PATElectronProducer::isolationValueLabelsNoPFId_
private

Definition at line 166 of file PATElectronProducer.h.

Referenced by fillElectron().

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

Definition at line 167 of file PATElectronProducer.h.

Referenced by produce().

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

Definition at line 165 of file PATElectronProducer.h.

Referenced by produce().

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

Definition at line 160 of file PATElectronProducer.h.

Referenced by produce().

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

Definition at line 161 of file PATElectronProducer.h.

Referenced by produce().

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

Definition at line 91 of file PATElectronProducer.h.

Referenced by produce().

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

Definition at line 90 of file PATElectronProducer.h.

Referenced by produce().

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

Definition at line 158 of file PATElectronProducer.h.

Referenced by produce().

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

Definition at line 107 of file PATElectronProducer.h.

Referenced by produce().

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

mva input variables

Definition at line 95 of file PATElectronProducer.h.

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

Definition at line 96 of file PATElectronProducer.h.

Referenced by produce().

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

Definition at line 97 of file PATElectronProducer.h.

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

Definition at line 98 of file PATElectronProducer.h.

Referenced by produce().

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

Definition at line 173 of file PATElectronProducer.h.

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

const bool pat::PATElectronProducer::useParticleFlow_
private

pflow specific

Definition at line 89 of file PATElectronProducer.h.

Referenced by fillElectron(), and produce().

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

Definition at line 176 of file PATElectronProducer.h.

Referenced by produce().

const bool pat::PATElectronProducer::useUserData_
private

Definition at line 175 of file PATElectronProducer.h.

Referenced by produce().