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::PATPhotonProducer Class Reference

Produces the pat::Photon. More...

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

Inheritance diagram for pat::PATPhotonProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 PATPhotonProducer (const edm::ParameterSet &iConfig)
 
virtual void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 ~PATPhotonProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
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::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Types

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

template<typename T >
void readIsolationLabels (const edm::ParameterSet &iConfig, const char *psetName, IsolationLabels &labels, std::vector< edm::EDGetTokenT< edm::ValueMap< T > > > &tokens)
 

Private Attributes

bool addEfficiencies_
 
bool addGenMatch_
 
bool addPFClusterIso_
 
bool addPhotonID_
 
bool addResolutions_
 
edm::EDGetTokenT< reco::BeamSpotbeamLineToken_
 
const CaloGeometryecalGeometry_
 
edm::EDGetTokenT
< edm::ValueMap< float > > 
ecalPFClusterIsoT_
 
const CaloTopologyecalTopology_
 
EcalClusterLocal ecl_
 
pat::helper::EfficiencyLoader efficiencyLoader_
 
edm::EDGetTokenT
< reco::GsfElectronCollection
electronToken_
 
bool embedBasicClusters_
 
bool embedGenMatch_
 
bool embedPreshowerClusters_
 
bool embedRecHits_
 
bool embedSeedCluster_
 
bool embedSuperCluster_
 
GreaterByEt< PhotoneTComparator_
 
std::vector< edm::EDGetTokenT
< edm::Association
< reco::GenParticleCollection > > > 
genMatchTokens_
 
edm::EDGetTokenT
< edm::ValueMap< float > > 
hcalPFClusterIsoT_
 
edm::EDGetTokenT
< reco::ConversionCollection
hConversionsToken_
 
IsolationLabels isoDepositLabels_
 
std::vector< edm::EDGetTokenT
< edm::ValueMap< IsoDeposit > > > 
isoDepositTokens_
 
IsolationLabels isolationValueLabels_
 
std::vector< edm::EDGetTokenT
< edm::ValueMap< double > > > 
isolationValueTokens_
 
pat::helper::MultiIsolator isolator_
 
pat::helper::MultiIsolator::IsolationValuePairs isolatorTmpStorage_
 
std::vector< NameTagphotIDSrcs_
 
std::vector< edm::EDGetTokenT
< edm::ValueMap< Bool_t > > > 
photIDTokens_
 
edm::EDGetTokenT< edm::View
< reco::Photon > > 
photonToken_
 
edm::InputTag reducedBarrelRecHitCollection_
 
edm::EDGetTokenT
< EcalRecHitCollection
reducedBarrelRecHitCollectionToken_
 
edm::InputTag reducedEndcapRecHitCollection_
 
edm::EDGetTokenT
< EcalRecHitCollection
reducedEndcapRecHitCollectionToken_
 
pat::helper::KinResolutionsLoader resolutionLoader_
 
pat::PATUserDataHelper
< pat::Photon
userDataHelper_
 
bool useUserData_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Produces the pat::Photon.

The PATPhotonProducer produces the analysis-level pat::Photon starting from a collection of objects of PhotonType.

Author
Steven Lowette
Version
Id:
PATPhotonProducer.h,v 1.19 2009/06/25 23:49:35 gpetrucc Exp

Definition at line 53 of file PATPhotonProducer.h.

Member Typedef Documentation

Definition at line 94 of file PATPhotonProducer.h.

Definition at line 96 of file PATPhotonProducer.h.

Definition at line 97 of file PATPhotonProducer.h.

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

Definition at line 95 of file PATPhotonProducer.h.

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

Definition at line 121 of file PATPhotonProducer.h.

Constructor & Destructor Documentation

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

Definition at line 31 of file PATPhotonProducer.cc.

References addGenMatch_, beamLineToken_, edm::EDConsumerBase::consumes(), electronToken_, embedBasicClusters_, embedGenMatch_, embedPreshowerClusters_, embedRecHits_, embedSeedCluster_, embedSuperCluster_, edm::ParameterSet::existsAs(), genMatchTokens_, edm::ParameterSet::getParameter(), hConversionsToken_, photonToken_, reducedBarrelRecHitCollection_, reducedBarrelRecHitCollectionToken_, reducedEndcapRecHitCollection_, reducedEndcapRecHitCollectionToken_, GlobalPosition_Frontier_DevDB_cff::tag, and edm::vector_transform().

31  :
32  isolator_(iConfig.exists("userIsolation") ? iConfig.getParameter<edm::ParameterSet>("userIsolation") : edm::ParameterSet(), consumesCollector(), false) ,
33  useUserData_(iConfig.exists("userData"))
34 {
35  // initialize the configurables
36  photonToken_ = consumes<edm::View<reco::Photon> >(iConfig.getParameter<edm::InputTag>("photonSource"));
37  electronToken_ = consumes<reco::GsfElectronCollection>(iConfig.getParameter<edm::InputTag>("electronSource"));
38  hConversionsToken_ = consumes<reco::ConversionCollection>(iConfig.getParameter<edm::InputTag>("conversionSource"));
39  beamLineToken_ = consumes<reco::BeamSpot>(iConfig.getParameter<edm::InputTag>("beamLineSrc"));
40  embedSuperCluster_ = iConfig.getParameter<bool>("embedSuperCluster");
41  embedSeedCluster_ = iConfig.getParameter<bool>( "embedSeedCluster" );
42  embedBasicClusters_ = iConfig.getParameter<bool>( "embedBasicClusters" );
43  embedPreshowerClusters_ = iConfig.getParameter<bool>( "embedPreshowerClusters" );
44  embedRecHits_ = iConfig.getParameter<bool>( "embedRecHits" );
45  reducedBarrelRecHitCollection_ = iConfig.getParameter<edm::InputTag>("reducedBarrelRecHitCollection");
46  reducedBarrelRecHitCollectionToken_ = mayConsume<EcalRecHitCollection>(reducedBarrelRecHitCollection_);
47  reducedEndcapRecHitCollection_ = iConfig.getParameter<edm::InputTag>("reducedEndcapRecHitCollection");
48  reducedEndcapRecHitCollectionToken_ = mayConsume<EcalRecHitCollection>(reducedEndcapRecHitCollection_);
49  // MC matching configurables
50  addGenMatch_ = iConfig.getParameter<bool>( "addGenMatch" );
51  if (addGenMatch_) {
52  embedGenMatch_ = iConfig.getParameter<bool>( "embedGenMatch" );
53  if (iConfig.existsAs<edm::InputTag>("genParticleMatch")) {
55  }
56  else {
57  genMatchTokens_ = edm::vector_transform(iConfig.getParameter<std::vector<edm::InputTag> >( "genParticleMatch" ), [this](edm::InputTag const & tag){return consumes<edm::Association<reco::GenParticleCollection> >(tag);});
58  }
59  }
60  // Efficiency configurables
61  addEfficiencies_ = iConfig.getParameter<bool>("addEfficiencies");
62  if (addEfficiencies_) {
64  }
65  // PFCluster Isolation maps
66  addPFClusterIso_ = iConfig.getParameter<bool>("addPFClusterIso");
67  ecalPFClusterIsoT_ = consumes<edm::ValueMap<float> >(iConfig.getParameter<edm::InputTag>("ecalPFClusterIsoMap"));
68  hcalPFClusterIsoT_ = consumes<edm::ValueMap<float> >(iConfig.getParameter<edm::InputTag>("hcalPFClusterIsoMap"));
69  // photon ID configurables
70  addPhotonID_ = iConfig.getParameter<bool>( "addPhotonID" );
71  if (addPhotonID_) {
72  // it might be a single photon ID
73  if (iConfig.existsAs<edm::InputTag>("photonIDSource")) {
74  photIDSrcs_.push_back(NameTag("", iConfig.getParameter<edm::InputTag>("photonIDSource")));
75  }
76  // or there might be many of them
77  if (iConfig.existsAs<edm::ParameterSet>("photonIDSources")) {
78  // please don't configure me twice
79  if (!photIDSrcs_.empty()){
80  throw cms::Exception("Configuration") << "PATPhotonProducer: you can't specify both 'photonIDSource' and 'photonIDSources'\n";
81  }
82  // read the different photon ID names
83  edm::ParameterSet idps = iConfig.getParameter<edm::ParameterSet>("photonIDSources");
84  std::vector<std::string> names = idps.getParameterNamesForType<edm::InputTag>();
85  for (std::vector<std::string>::const_iterator it = names.begin(), ed = names.end(); it != ed; ++it) {
86  photIDSrcs_.push_back(NameTag(*it, idps.getParameter<edm::InputTag>(*it)));
87  }
88  }
89  // but in any case at least once
90  if (photIDSrcs_.empty()) throw cms::Exception("Configuration") <<
91  "PATPhotonProducer: id addPhotonID is true, you must specify either:\n" <<
92  "\tInputTag photonIDSource = <someTag>\n" << "or\n" <<
93  "\tPSet photonIDSources = { \n" <<
94  "\t\tInputTag <someName> = <someTag> // as many as you want \n " <<
95  "\t}\n";
96  }
97  photIDTokens_ = edm::vector_transform(photIDSrcs_, [this](NameTag const & tag){return mayConsume<edm::ValueMap<Bool_t> >(tag.second);});
98  // Resolution configurables
99  addResolutions_ = iConfig.getParameter<bool>("addResolutions");
100  if (addResolutions_) {
102  }
103  // Check to see if the user wants to add user data
104  if ( useUserData_ ) {
106  }
107  // produces vector of photons
108  produces<std::vector<Photon> >();
109 
110  // read isoDeposit labels, for direct embedding
111  readIsolationLabels(iConfig, "isoDeposits", isoDepositLabels_, isoDepositTokens_);
112  // read isolation value labels, for direct embedding
114 
115 }
T getParameter(std::string const &) const
Assists in assimilating all pat::UserData into pat objects.
pat::PATUserDataHelper< pat::Photon > userDataHelper_
edm::EDGetTokenT< EcalRecHitCollection > reducedEndcapRecHitCollectionToken_
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:185
static const HistoName names[]
std::pair< std::string, edm::InputTag > NameTag
std::vector< edm::EDGetTokenT< edm::ValueMap< Bool_t > > > photIDTokens_
edm::EDGetTokenT< reco::BeamSpot > beamLineToken_
edm::EDGetTokenT< edm::View< reco::Photon > > photonToken_
bool exists(std::string const &parameterName) const
checks if a parameter exists
edm::EDGetTokenT< edm::ValueMap< float > > ecalPFClusterIsoT_
std::vector< edm::EDGetTokenT< edm::Association< reco::GenParticleCollection > > > genMatchTokens_
pat::helper::KinResolutionsLoader resolutionLoader_
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
edm::InputTag reducedEndcapRecHitCollection_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
Definition: ParameterSet.h:193
void readIsolationLabels(const edm::ParameterSet &iConfig, const char *psetName, IsolationLabels &labels, std::vector< edm::EDGetTokenT< edm::ValueMap< T > > > &tokens)
IsolationLabels isoDepositLabels_
IsolationLabels isolationValueLabels_
std::vector< edm::EDGetTokenT< edm::ValueMap< IsoDeposit > > > isoDepositTokens_
pat::helper::EfficiencyLoader efficiencyLoader_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
std::vector< NameTag > photIDSrcs_
pat::helper::MultiIsolator isolator_
edm::EDGetTokenT< EcalRecHitCollection > reducedBarrelRecHitCollectionToken_
std::vector< edm::EDGetTokenT< edm::ValueMap< double > > > isolationValueTokens_
edm::InputTag reducedBarrelRecHitCollection_
edm::EDGetTokenT< reco::ConversionCollection > hConversionsToken_
edm::EDGetTokenT< reco::GsfElectronCollection > electronToken_
PATPhotonProducer::~PATPhotonProducer ( )

Definition at line 117 of file PATPhotonProducer.cc.

117  {
118 }

Member Function Documentation

void PATPhotonProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 383 of file PATPhotonProducer.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().

384 {
386  iDesc.setComment("PAT photon producer module");
387 
388  // input source
389  iDesc.add<edm::InputTag>("photonSource", edm::InputTag("no default"))->setComment("input collection");
390  iDesc.add<edm::InputTag>("electronSource", edm::InputTag("no default"))->setComment("input collection");
391  iDesc.add<edm::InputTag>("conversionSource", edm::InputTag("allConversions"))->setComment("input collection");
392 
393  iDesc.add<edm::InputTag>("reducedBarrelRecHitCollection", edm::InputTag("reducedEcalRecHitsEB"));
394  iDesc.add<edm::InputTag>("reducedEndcapRecHitCollection", edm::InputTag("reducedEcalRecHitsEE"));
395 
396  iDesc.ifValue(edm::ParameterDescription<bool>("addPFClusterIso", false, true),
397  true >> (edm::ParameterDescription<edm::InputTag>("ecalPFClusterIsoMap", edm::InputTag("photonEcalPFClusterIsolationProducer"), true) and
398  edm::ParameterDescription<edm::InputTag>("hcalPFClusterIsoMap", edm::InputTag("photonHcalPFClusterIsolationProducer"),true)) or
399  false >> (edm::ParameterDescription<edm::InputTag>("ecalPFClusterIsoMap", edm::InputTag(""), true) and
400  edm::ParameterDescription<edm::InputTag>("hcalPFClusterIsoMap", edm::InputTag(""),true)));
401 
402  iDesc.add<bool>("embedSuperCluster", true)->setComment("embed external super cluster");
403  iDesc.add<bool>("embedSeedCluster", true)->setComment("embed external seed cluster");
404  iDesc.add<bool>("embedBasicClusters", true)->setComment("embed external basic clusters");
405  iDesc.add<bool>("embedPreshowerClusters", true)->setComment("embed external preshower clusters");
406  iDesc.add<bool>("embedRecHits", true)->setComment("embed external RecHits");
407 
408  // MC matching configurables
409  iDesc.add<bool>("addGenMatch", true)->setComment("add MC matching");
410  iDesc.add<bool>("embedGenMatch", false)->setComment("embed MC matched MC information");
411  std::vector<edm::InputTag> emptySourceVector;
412  iDesc.addNode( edm::ParameterDescription<edm::InputTag>("genParticleMatch", edm::InputTag(), true) xor
413  edm::ParameterDescription<std::vector<edm::InputTag> >("genParticleMatch", emptySourceVector, true)
414  )->setComment("input with MC match information");
415 
417 
418  // photon ID configurables
419  iDesc.add<bool>("addPhotonID",true)->setComment("add photon ID variables");
420  edm::ParameterSetDescription photonIDSourcesPSet;
421  photonIDSourcesPSet.setAllowAnything();
422  iDesc.addNode( edm::ParameterDescription<edm::InputTag>("photonIDSource", edm::InputTag(), true) xor
423  edm::ParameterDescription<edm::ParameterSetDescription>("photonIDSources", photonIDSourcesPSet, true)
424  )->setComment("input with photon ID variables");
425 
426  // IsoDeposit configurables
427  edm::ParameterSetDescription isoDepositsPSet;
428  isoDepositsPSet.addOptional<edm::InputTag>("tracker");
429  isoDepositsPSet.addOptional<edm::InputTag>("ecal");
430  isoDepositsPSet.addOptional<edm::InputTag>("hcal");
431  isoDepositsPSet.addOptional<edm::InputTag>("pfAllParticles");
432  isoDepositsPSet.addOptional<edm::InputTag>("pfChargedHadrons");
433  isoDepositsPSet.addOptional<edm::InputTag>("pfChargedAll");
434  isoDepositsPSet.addOptional<edm::InputTag>("pfPUChargedHadrons");
435  isoDepositsPSet.addOptional<edm::InputTag>("pfNeutralHadrons");
436  isoDepositsPSet.addOptional<edm::InputTag>("pfPhotons");
437  isoDepositsPSet.addOptional<std::vector<edm::InputTag> >("user");
438  iDesc.addOptional("isoDeposits", isoDepositsPSet);
439 
440  // isolation values configurables
441  edm::ParameterSetDescription isolationValuesPSet;
442  isolationValuesPSet.addOptional<edm::InputTag>("tracker");
443  isolationValuesPSet.addOptional<edm::InputTag>("ecal");
444  isolationValuesPSet.addOptional<edm::InputTag>("hcal");
445  isolationValuesPSet.addOptional<edm::InputTag>("pfAllParticles");
446  isolationValuesPSet.addOptional<edm::InputTag>("pfChargedHadrons");
447  isolationValuesPSet.addOptional<edm::InputTag>("pfChargedAll");
448  isolationValuesPSet.addOptional<edm::InputTag>("pfPUChargedHadrons");
449  isolationValuesPSet.addOptional<edm::InputTag>("pfNeutralHadrons");
450  isolationValuesPSet.addOptional<edm::InputTag>("pfPhotons");
451  isolationValuesPSet.addOptional<std::vector<edm::InputTag> >("user");
452  iDesc.addOptional("isolationValues", isolationValuesPSet);
453 
454  // Efficiency configurables
455  edm::ParameterSetDescription efficienciesPSet;
456  efficienciesPSet.setAllowAnything(); // TODO: the pat helper needs to implement a description.
457  iDesc.add("efficiencies", efficienciesPSet);
458  iDesc.add<bool>("addEfficiencies", false);
459 
460  // Check to see if the user wants to add user data
461  edm::ParameterSetDescription userDataPSet;
463  iDesc.addOptional("userData", userDataPSet);
464 
465  edm::ParameterSetDescription isolationPSet;
466  isolationPSet.setAllowAnything(); // TODO: the pat helper needs to implement a description.
467  iDesc.add("userIsolation", isolationPSet);
468 
469  iDesc.addNode( edm::ParameterDescription<edm::InputTag>("beamLineSrc", edm::InputTag(), true)
470  )->setComment("input with high level selection");
471 
472  descriptions.add("PATPhotonProducer", iDesc);
473 
474 }
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 PATPhotonProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::EDProducer.

Definition at line 120 of file PATPhotonProducer.cc.

References addGenMatch_, pat::PATObject< ObjectType >::addGenParticleRef(), addPFClusterIso_, addPhotonID_, Reference_intrackfit_cff::barrel, beamLineToken_, pat::helper::MultiIsolator::beginEvent(), EcalRegressionData::C1, EcalRegressionData::C2, EcalRegressionData::C3, EcalRegressionData::e2nd(), EcalRegressionData::e3x3(), EcalRegressionData::eBottom(), DetId::Ecal, EcalBarrel, EcalEndcap, ecalGeometry_, ecalPFClusterIsoT_, ecalTopology_, efficiencyLoader_, electronToken_, EcalRegressionData::eLeft(), EcalRegressionData::eMax(), pat::Photon::embedBasicClusters(), embedBasicClusters_, embedGenMatch_, pat::PATObject< ObjectType >::embedGenParticle(), pat::Photon::embedPreshowerClusters(), embedPreshowerClusters_, pat::Photon::embedRecHits(), embedRecHits_, pat::Photon::embedSeedCluster(), embedSeedCluster_, pat::Photon::embedSuperCluster(), embedSuperCluster_, pat::helper::EfficiencyLoader::enabled(), pat::helper::KinResolutionsLoader::enabled(), pat::helper::MultiIsolator::enabled(), edm::SortedCollection< T, SORT >::end(), pat::helper::MultiIsolator::endEvent(), EcalRegressionData::eRight(), eTComparator_, EcalRegressionData::eTop(), pat::helper::MultiIsolator::fill(), EcalRegressionData::fill(), edm::SortedCollection< T, SORT >::find(), plotBeamSpotDB::first, genMatchTokens_, edm::EventSetup::get(), edm::Event::getByToken(), CaloTopology::getSubdetectorTopology(), CaloSubdetectorTopology::getWindow(), ConversionTools::hasMatchedPromptElectron(), reco::Photon::hasPixelSeed(), hcalPFClusterIsoT_, hConversionsToken_, i, customizeTrackingMonitorSeedNumber::idx, isoDepositLabels_, isoDepositTokens_, isolationValueLabels_, isolationValueTokens_, isolator_, isolatorTmpStorage_, edm::EventBase::isRealData(), edm::HandleBase::isValid(), j, EcalRegressionData::maxSubClusDR(), EcalRegressionData::maxSubClusDRDEta(), EcalRegressionData::maxSubClusDRDPhi(), EcalRegressionData::maxSubClusDRRawEnergy(), gen::n, pat::helper::EfficiencyLoader::newEvent(), pat::helper::KinResolutionsLoader::newEvent(), photIDSrcs_, photIDTokens_, interactiveExample::photons, photonToken_, edm::Handle< T >::product(), edm::SortedCollection< T, SORT >::push_back(), edm::Event::put(), HLT_25ns14e33_v3_cff::recHits, reducedBarrelRecHitCollectionToken_, reducedEndcapRecHitCollectionToken_, resolutionLoader_, fileCollector::seed, EcalRegressionData::seedCrysEtaOrX(), EcalRegressionData::seedCrysIEtaOrIX(), EcalRegressionData::seedCrysIPhiOrIY(), EcalRegressionData::seedCrysPhiOrY(), pat::Photon::setCryEta(), pat::Photon::setCryPhi(), pat::Photon::setE2nd(), pat::Photon::setE3x3(), pat::Photon::setEBottom(), pat::Photon::setEcalPFClusterIso(), pat::helper::EfficiencyLoader::setEfficiencies(), pat::Photon::setELeft(), pat::Photon::setEMax(), pat::Photon::setERight(), pat::Photon::setETop(), pat::Photon::setHasPixelSeed(), pat::Photon::setHcalPFClusterIso(), pat::Photon::setIEta(), pat::Photon::setIPhi(), pat::Photon::setIsoDeposit(), pat::Photon::setIsolation(), pat::Photon::setMaxDR(), pat::Photon::setMaxDRDEta(), pat::Photon::setMaxDRDPhi(), pat::Photon::setMaxDRRawEnergy(), pat::Photon::setPassElectronVeto(), pat::Photon::setPhotonIDs(), pat::helper::KinResolutionsLoader::setResolutions(), pat::Photon::setSee(), pat::Photon::setSeedEnergy(), pat::Photon::setSep(), pat::Photon::setSpp(), pat::Photon::setSubClusDEta1(), pat::Photon::setSubClusDEta2(), pat::Photon::setSubClusDEta3(), pat::Photon::setSubClusDPhi1(), pat::Photon::setSubClusDPhi2(), pat::Photon::setSubClusDPhi3(), pat::Photon::setSubClusRawE1(), pat::Photon::setSubClusRawE2(), pat::Photon::setSubClusRawE3(), EcalRegressionData::sigmaIEtaIEta(), EcalRegressionData::sigmaIEtaIPhi(), EcalRegressionData::sigmaIPhiIPhi(), edm::SortedCollection< T, SORT >::size(), edm::SortedCollection< T, SORT >::sort(), python.multivaluedict::sort(), EcalRegressionData::subClusDEta(), EcalRegressionData::subClusDPhi(), EcalRegressionData::subClusRawEnergy(), reco::Photon::superCluster(), userDataHelper_, and useUserData_.

121 {
122  // switch off embedding (in unschedules mode)
123  if (iEvent.isRealData()){
124  addGenMatch_ = false;
125  embedGenMatch_ = false;
126  }
127 
128  edm::ESHandle<CaloTopology> theCaloTopology;
129  iSetup.get<CaloTopologyRecord>().get(theCaloTopology);
130  ecalTopology_ = & (*theCaloTopology);
131 
132  edm::ESHandle<CaloGeometry> theCaloGeometry;
133  iSetup.get<CaloGeometryRecord>().get(theCaloGeometry);
134  ecalGeometry_ = & (*theCaloGeometry);
135 
136  // Get the vector of Photon's from the event
138  iEvent.getByToken(photonToken_, photons);
139 
140  // for conversion veto selection
142  iEvent.getByToken(hConversionsToken_, hConversions);
143 
144  // Get the collection of electrons from the event
146  iEvent.getByToken(electronToken_, hElectrons);
147 
148  // Get the beamspot
149  edm::Handle<reco::BeamSpot> beamSpotHandle;
150  iEvent.getByToken(beamLineToken_, beamSpotHandle);
151 
153 
154  // prepare the MC matching
155  std::vector<edm::Handle<edm::Association<reco::GenParticleCollection> > >genMatches(genMatchTokens_.size());
156  if (addGenMatch_) {
157  for (size_t j = 0, nd = genMatchTokens_.size(); j < nd; ++j) {
158  iEvent.getByToken(genMatchTokens_[j], genMatches[j]);
159  }
160  }
161 
162  if (isolator_.enabled()) isolator_.beginEvent(iEvent,iSetup);
163 
165  if (resolutionLoader_.enabled()) resolutionLoader_.newEvent(iEvent, iSetup);
166 
167  IsoDepositMaps deposits(isoDepositTokens_.size());
168  for (size_t j = 0, nd = isoDepositTokens_.size(); j < nd; ++j) {
169  iEvent.getByToken(isoDepositTokens_[j], deposits[j]);
170  }
171 
172  IsolationValueMaps isolationValues(isolationValueTokens_.size());
173  for (size_t j = 0; j<isolationValueTokens_.size(); ++j) {
174  iEvent.getByToken(isolationValueTokens_[j], isolationValues[j]);
175  }
176 
177 
178  // prepare ID extraction
179  std::vector<edm::Handle<edm::ValueMap<Bool_t> > > idhandles;
180  std::vector<pat::Photon::IdPair> ids;
181  if (addPhotonID_) {
182  idhandles.resize(photIDSrcs_.size());
183  ids.resize(photIDSrcs_.size());
184  for (size_t i = 0; i < photIDSrcs_.size(); ++i) {
185  iEvent.getByToken(photIDTokens_[i], idhandles[i]);
186  ids[i].first = photIDSrcs_[i].first;
187  }
188  }
189 
190  // loop over photons
191  std::vector<Photon> * PATPhotons = new std::vector<Photon>();
192  for (edm::View<reco::Photon>::const_iterator itPhoton = photons->begin(); itPhoton != photons->end(); itPhoton++) {
193  // construct the Photon from the ref -> save ref to original object
194  unsigned int idx = itPhoton - photons->begin();
195  edm::RefToBase<reco::Photon> photonRef = photons->refAt(idx);
196  edm::Ptr<reco::Photon> photonPtr = photons->ptrAt(idx);
197  Photon aPhoton(photonRef);
198  if (embedSuperCluster_) aPhoton.embedSuperCluster();
199  if (embedSeedCluster_) aPhoton.embedSeedCluster();
200  if (embedBasicClusters_) aPhoton.embedBasicClusters();
201  if (embedPreshowerClusters_) aPhoton.embedPreshowerClusters();
202 
203  std::vector<DetId> selectedCells;
204  bool barrel = itPhoton->isEB();
205  //loop over sub clusters
206  if (embedBasicClusters_) {
207  for (reco::CaloCluster_iterator clusIt = itPhoton->superCluster()->clustersBegin(); clusIt!=itPhoton->superCluster()->clustersEnd(); ++clusIt) {
208  //get seed (max energy xtal)
209  DetId seed = lazyTools.getMaximum(**clusIt).first;
210  //get all xtals in 5x5 window around the seed
211  std::vector<DetId> dets5x5 = (barrel) ? ecalTopology_->getSubdetectorTopology(DetId::Ecal,EcalBarrel)->getWindow(seed,5,5):
213  selectedCells.insert(selectedCells.end(), dets5x5.begin(), dets5x5.end());
214 
215  //get all xtals belonging to cluster
216  for (const std::pair<DetId, float> &hit : (*clusIt)->hitsAndFractions()) {
217  selectedCells.push_back(hit.first);
218  }
219  }
220  }
221 
222  //remove duplicates
223  std::sort(selectedCells.begin(),selectedCells.end());
224  std::unique(selectedCells.begin(),selectedCells.end());
225 
226  // Retrieve the corresponding RecHits
227 
228 
229  edm::Handle< EcalRecHitCollection > recHitsEBHandle;
230  iEvent.getByToken(reducedBarrelRecHitCollectionToken_,recHitsEBHandle);
231  edm::Handle< EcalRecHitCollection > recHitsEEHandle;
232  iEvent.getByToken(reducedEndcapRecHitCollectionToken_,recHitsEEHandle);
233 
234 
235  //orginal code would throw an exception via the handle not being valid but now it'll just have a null pointer error
236  //should have little effect, if its not barrel or endcap, something very bad has happened elsewhere anyways
237  const EcalRecHitCollection *recHits = nullptr;
238  if(photonRef->superCluster()->seed()->hitsAndFractions().at(0).first.subdetId()==EcalBarrel ) recHits = recHitsEBHandle.product();
239  else if( photonRef->superCluster()->seed()->hitsAndFractions().at(0).first.subdetId()==EcalEndcap ) recHits = recHitsEEHandle.product();
240 
241 
242  EcalRecHitCollection selectedRecHits;
243 
244 
245  unsigned nSelectedCells = selectedCells.size();
246  for (unsigned icell = 0 ; icell < nSelectedCells ; ++icell) {
247  EcalRecHitCollection::const_iterator it = recHits->find( selectedCells[icell] );
248  if ( it != recHits->end() ) {
249  selectedRecHits.push_back(*it);
250  }
251  }
252  selectedRecHits.sort();
253  if (embedRecHits_) aPhoton.embedRecHits(& selectedRecHits);
254 
255  // store the match to the generated final state muons
256  if (addGenMatch_) {
257  for(size_t i = 0, n = genMatches.size(); i < n; ++i) {
258  reco::GenParticleRef genPhoton = (*genMatches[i])[photonRef];
259  aPhoton.addGenParticleRef(genPhoton);
260  }
261  if (embedGenMatch_) aPhoton.embedGenParticle();
262  }
263 
264  if (efficiencyLoader_.enabled()) {
265  efficiencyLoader_.setEfficiencies( aPhoton, photonRef );
266  }
267 
268  if (resolutionLoader_.enabled()) {
270  }
271 
272  // here comes the extra functionality
273  if (isolator_.enabled()) {
274  isolator_.fill(*photons, idx, isolatorTmpStorage_);
275  typedef pat::helper::MultiIsolator::IsolationValuePairs IsolationValuePairs;
276  // better to loop backwards, so the vector is resized less times
277  for (IsolationValuePairs::const_reverse_iterator it = isolatorTmpStorage_.rbegin(), ed = isolatorTmpStorage_.rend(); it != ed; ++it) {
278  aPhoton.setIsolation(it->first, it->second);
279  }
280  }
281 
282  for (size_t j = 0, nd = deposits.size(); j < nd; ++j) {
283  aPhoton.setIsoDeposit(isoDepositLabels_[j].first, (*deposits[j])[photonRef]);
284  }
285 
286  for (size_t j = 0; j<isolationValues.size(); ++j) {
287  aPhoton.setIsolation(isolationValueLabels_[j].first,(*isolationValues[j])[photonRef]);
288  }
289 
290  // add photon ID info
291  if (addPhotonID_) {
292  for (size_t i = 0; i < photIDSrcs_.size(); ++i) {
293  ids[i].second = (*idhandles[i])[photonRef];
294  }
295  aPhoton.setPhotonIDs(ids);
296  }
297 
298  if ( useUserData_ ) {
299  userDataHelper_.add( aPhoton, iEvent, iSetup );
300  }
301 
302 
303  // set conversion veto selection
304  bool passelectronveto = false;
305  if( hConversions.isValid()){
306  // this is recommended method
307  passelectronveto = !ConversionTools::hasMatchedPromptElectron(photonRef->superCluster(), hElectrons, hConversions, beamSpotHandle->position());
308  }
309  aPhoton.setPassElectronVeto( passelectronveto );
310 
311 
312  // set electron veto using pixel seed (not recommended but many analysis groups are still using since it is powerful method to remove electrons)
313  aPhoton.setHasPixelSeed( photonRef->hasPixelSeed() );
314 
315  // set seed energy
316  aPhoton.setSeedEnergy( photonRef->superCluster()->seed()->energy() );
317 
318  EcalRegressionData ecalRegData;
319  ecalRegData.fill(*(photonRef->superCluster()),
320  recHitsEBHandle.product(),recHitsEEHandle.product(),
322 
323 
324  // set input variables for regression energy correction
325  aPhoton.setEMax( ecalRegData.eMax() );
326  aPhoton.setE2nd( ecalRegData.e2nd() );
327  aPhoton.setE3x3( ecalRegData.e3x3() );
328  aPhoton.setETop( ecalRegData.eTop() );
329  aPhoton.setEBottom( ecalRegData.eBottom() );
330  aPhoton.setELeft( ecalRegData.eLeft() );
331  aPhoton.setERight( ecalRegData.eRight() );
332  aPhoton.setSee( ecalRegData.sigmaIEtaIEta() );
333  aPhoton.setSep( ecalRegData.sigmaIEtaIPhi()*ecalRegData.sigmaIEtaIEta()*ecalRegData.sigmaIPhiIPhi() ); //there is a conflict on what sigmaIEtaIPhi actually is, regression and ID have it differently, this may change in later releases
334  aPhoton.setSpp( ecalRegData.sigmaIPhiIPhi() );
335 
336  aPhoton.setMaxDR( ecalRegData.maxSubClusDR() );
337  aPhoton.setMaxDRDPhi( ecalRegData.maxSubClusDRDPhi() );
338  aPhoton.setMaxDRDEta( ecalRegData.maxSubClusDRDEta() );
339  aPhoton.setMaxDRRawEnergy( ecalRegData.maxSubClusDRRawEnergy() );
340  aPhoton.setSubClusRawE1( ecalRegData.subClusRawEnergy(EcalRegressionData::SubClusNr::C1) );
341  aPhoton.setSubClusRawE2( ecalRegData.subClusRawEnergy(EcalRegressionData::SubClusNr::C2) );
342  aPhoton.setSubClusRawE3( ecalRegData.subClusRawEnergy(EcalRegressionData::SubClusNr::C3) );
343  aPhoton.setSubClusDPhi1( ecalRegData.subClusDPhi(EcalRegressionData::SubClusNr::C1) );
344  aPhoton.setSubClusDPhi2( ecalRegData.subClusDPhi(EcalRegressionData::SubClusNr::C2) );
345  aPhoton.setSubClusDPhi3( ecalRegData.subClusDPhi(EcalRegressionData::SubClusNr::C3) );
346  aPhoton.setSubClusDEta1( ecalRegData.subClusDEta(EcalRegressionData::SubClusNr::C1) );
347  aPhoton.setSubClusDEta2( ecalRegData.subClusDEta(EcalRegressionData::SubClusNr::C2) );
348  aPhoton.setSubClusDEta3( ecalRegData.subClusDEta(EcalRegressionData::SubClusNr::C3) );
349 
350  aPhoton.setCryPhi( ecalRegData.seedCrysPhiOrY() );
351  aPhoton.setCryEta( ecalRegData.seedCrysEtaOrX() );
352  aPhoton.setIEta( ecalRegData.seedCrysIEtaOrIX() );
353  aPhoton.setIPhi( ecalRegData.seedCrysIPhiOrIY() );
354 
355  // Get PFCluster Isolation
356  if (addPFClusterIso_) {
357  edm::Handle<edm::ValueMap<float> > ecalPFClusterIsoMapH;
358  iEvent.getByToken(ecalPFClusterIsoT_, ecalPFClusterIsoMapH);
359  edm::Handle<edm::ValueMap<float> > hcalPFClusterIsoMapH;
360  iEvent.getByToken(hcalPFClusterIsoT_, hcalPFClusterIsoMapH);
361  aPhoton.setEcalPFClusterIso((*ecalPFClusterIsoMapH)[photonRef]);
362  aPhoton.setHcalPFClusterIso((*hcalPFClusterIsoMapH)[photonRef]);
363  } else {
364  aPhoton.setEcalPFClusterIso(-999.);
365  aPhoton.setHcalPFClusterIso(-999.);
366  }
367 
368  // add the Photon to the vector of Photons
369  PATPhotons->push_back(aPhoton);
370  }
371 
372  // sort Photons in ET
373  std::sort(PATPhotons->begin(), PATPhotons->end(), eTComparator_);
374 
375  // put genEvt object in Event
376  std::auto_ptr<std::vector<Photon> > myPhotons(PATPhotons);
377  iEvent.put(myPhotons);
379 
380 }
bool enabled() const
&#39;true&#39; if this there is at least one efficiency configured
float sigmaIPhiIPhi() const
int i
Definition: DBlmapReader.cc:9
const std::vector< float > & subClusRawEnergy() const
Analysis-level Photon class.
Definition: Photon.h:47
pat::PATUserDataHelper< pat::Photon > userDataHelper_
float maxSubClusDRRawEnergy() const
float maxSubClusDRDEta() const
edm::EDGetTokenT< EcalRecHitCollection > reducedEndcapRecHitCollectionToken_
reco::SuperClusterRef superCluster() const
Ref to SuperCluster.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
std::vector< edm::Handle< edm::ValueMap< double > > > IsolationValueMaps
std::vector< edm::EDGetTokenT< edm::ValueMap< Bool_t > > > photIDTokens_
void fill(const reco::SuperCluster &superClus, const EcalRecHitCollection *ebRecHits, const EcalRecHitCollection *eeRecHits, const CaloGeometry *geom, const CaloTopology *topology, const reco::VertexCollection *vertices)
edm::EDGetTokenT< reco::BeamSpot > beamLineToken_
static bool hasMatchedPromptElectron(const reco::SuperClusterRef &sc, const edm::Handle< reco::GsfElectronCollection > &eleCol, 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)
edm::EDGetTokenT< edm::View< reco::Photon > > photonToken_
std::vector< EcalRecHit >::const_iterator const_iterator
float eLeft() const
edm::EDGetTokenT< edm::ValueMap< float > > ecalPFClusterIsoT_
void push_back(T const &t)
float seedCrysPhiOrY() const
std::vector< edm::EDGetTokenT< edm::Association< reco::GenParticleCollection > > > genMatchTokens_
pat::helper::KinResolutionsLoader resolutionLoader_
float sigmaIEtaIEta() const
edm::EDGetTokenT< edm::ValueMap< float > > hcalPFClusterIsoT_
GreaterByEt< Photon > eTComparator_
const CaloGeometry * ecalGeometry_
float sigmaIEtaIPhi() const
void setResolutions(pat::PATObject< T > &obj) const
Sets the efficiencies for this object, using the reference to the original objects.
bool isRealData() const
Definition: EventBase.h:64
bool enabled() const
&#39;true&#39; if this there is at least one efficiency configured
bool enabled() const
True if it has a non null configuration.
Definition: MultiIsolator.h:50
IsolationLabels isoDepositLabels_
pat::helper::MultiIsolator::IsolationValuePairs isolatorTmpStorage_
void beginEvent(const edm::Event &event, const edm::EventSetup &eventSetup)
const CaloTopology * ecalTopology_
float seedCrysIPhiOrIY() const
IsolationLabels isolationValueLabels_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
std::vector< edm::EDGetTokenT< edm::ValueMap< IsoDeposit > > > isoDepositTokens_
pat::helper::EfficiencyLoader efficiencyLoader_
float maxSubClusDR() const
float seedCrysIEtaOrIX() const
int j
Definition: DBlmapReader.cc:9
float maxSubClusDRDPhi() const
std::vector< NameTag > photIDSrcs_
bool isValid() const
Definition: HandleBase.h:75
std::vector< edm::Handle< edm::ValueMap< IsoDeposit > > > IsoDepositMaps
pat::helper::MultiIsolator isolator_
float seedCrysEtaOrX() const
const_iterator end() const
Definition: DetId.h:18
virtual std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
T const * product() const
Definition: Handle.h:81
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
bool hasPixelSeed() const
Bool flagging photons having a non-zero size vector of Ref to electornPixel seeds.
Definition: Photon.h:75
const T & get() const
Definition: EventSetup.h:55
void setEfficiencies(pat::PATObject< T > &obj, const R &originalRef) const
Sets the efficiencies for this object, using the reference to the original objects.
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
Definition: CaloTopology.cc:26
const std::vector< float > & subClusDEta() const
std::vector< std::pair< pat::IsolationKeys, float > > IsolationValuePairs
Definition: MultiIsolator.h:16
iterator find(key_type k)
const std::vector< float > & subClusDPhi() const
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
size_type size() const
float eRight() const
edm::EDGetTokenT< EcalRecHitCollection > reducedBarrelRecHitCollectionToken_
std::vector< edm::EDGetTokenT< edm::ValueMap< double > > > isolationValueTokens_
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.
float eBottom() const
edm::EDGetTokenT< reco::ConversionCollection > hConversionsToken_
void fill(const edm::View< T > &coll, int idx, IsolationValuePairs &isolations) const
Definition: MultiIsolator.h:82
edm::EDGetTokenT< reco::GsfElectronCollection > electronToken_
template<typename T >
void PATPhotonProducer::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 141 of file PATPhotonProducer.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().

144  {
145 
146  labels.clear();
147 
148  if (iConfig.exists( psetName )) {
149  edm::ParameterSet depconf
150  = iConfig.getParameter<edm::ParameterSet>(psetName);
151 
152  if (depconf.exists("tracker")) labels.push_back(std::make_pair(pat::TrackIso, depconf.getParameter<edm::InputTag>("tracker")));
153  if (depconf.exists("ecal")) labels.push_back(std::make_pair(pat::EcalIso, depconf.getParameter<edm::InputTag>("ecal")));
154  if (depconf.exists("hcal")) labels.push_back(std::make_pair(pat::HcalIso, depconf.getParameter<edm::InputTag>("hcal")));
155  if (depconf.exists("pfAllParticles")) {
156  labels.push_back(std::make_pair(pat::PfAllParticleIso, depconf.getParameter<edm::InputTag>("pfAllParticles")));
157  }
158  if (depconf.exists("pfChargedHadrons")) {
159  labels.push_back(std::make_pair(pat::PfChargedHadronIso, depconf.getParameter<edm::InputTag>("pfChargedHadrons")));
160  }
161  if (depconf.exists("pfChargedAll")) {
162  labels.push_back(std::make_pair(pat::PfChargedAllIso, depconf.getParameter<edm::InputTag>("pfChargedAll")));
163  }
164  if (depconf.exists("pfPUChargedHadrons")) {
165  labels.push_back(std::make_pair(pat::PfPUChargedHadronIso, depconf.getParameter<edm::InputTag>("pfPUChargedHadrons")));
166  }
167  if (depconf.exists("pfNeutralHadrons")) {
168  labels.push_back(std::make_pair(pat::PfNeutralHadronIso, depconf.getParameter<edm::InputTag>("pfNeutralHadrons")));
169  }
170  if (depconf.exists("pfPhotons")) {
171  labels.push_back(std::make_pair(pat::PfGammaIso, depconf.getParameter<edm::InputTag>("pfPhotons")));
172  }
173  if (depconf.exists("user")) {
174  std::vector<edm::InputTag> userdeps = depconf.getParameter<std::vector<edm::InputTag> >("user");
175  std::vector<edm::InputTag>::const_iterator it = userdeps.begin(), ed = userdeps.end();
176  int key = UserBaseIso;
177  for ( ; it != ed; ++it, ++key) {
178  labels.push_back(std::make_pair(IsolationKeys(key), *it));
179  }
180  }
181  }
182 
183  tokens = edm::vector_transform(labels, [this](IsolationLabel const & label){return consumes<edm::ValueMap<T> >(label.second);});
184 
185 }
T getParameter(std::string const &) const
std::pair< pat::IsolationKeys, edm::InputTag > IsolationLabel
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

Member Data Documentation

bool pat::PATPhotonProducer::addEfficiencies_
private

Definition at line 114 of file PATPhotonProducer.h.

bool pat::PATPhotonProducer::addGenMatch_
private

Definition at line 87 of file PATPhotonProducer.h.

Referenced by PATPhotonProducer(), and produce().

bool pat::PATPhotonProducer::addPFClusterIso_
private

Definition at line 83 of file PATPhotonProducer.h.

Referenced by produce().

bool pat::PATPhotonProducer::addPhotonID_
private

Definition at line 120 of file PATPhotonProducer.h.

Referenced by produce().

bool pat::PATPhotonProducer::addResolutions_
private

Definition at line 117 of file PATPhotonProducer.h.

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

Definition at line 70 of file PATPhotonProducer.h.

Referenced by PATPhotonProducer(), and produce().

const CaloGeometry* pat::PATPhotonProducer::ecalGeometry_
private

Definition at line 129 of file PATPhotonProducer.h.

Referenced by produce().

edm::EDGetTokenT<edm::ValueMap<float> > pat::PATPhotonProducer::ecalPFClusterIsoT_
private

Definition at line 84 of file PATPhotonProducer.h.

Referenced by produce().

const CaloTopology* pat::PATPhotonProducer::ecalTopology_
private

Definition at line 128 of file PATPhotonProducer.h.

Referenced by produce().

EcalClusterLocal pat::PATPhotonProducer::ecl_
private

Definition at line 130 of file PATPhotonProducer.h.

pat::helper::EfficiencyLoader pat::PATPhotonProducer::efficiencyLoader_
private

Definition at line 115 of file PATPhotonProducer.h.

Referenced by produce().

edm::EDGetTokenT<reco::GsfElectronCollection> pat::PATPhotonProducer::electronToken_
private

Definition at line 68 of file PATPhotonProducer.h.

Referenced by PATPhotonProducer(), and produce().

bool pat::PATPhotonProducer::embedBasicClusters_
private

Definition at line 74 of file PATPhotonProducer.h.

Referenced by PATPhotonProducer(), and produce().

bool pat::PATPhotonProducer::embedGenMatch_
private

Definition at line 88 of file PATPhotonProducer.h.

Referenced by PATPhotonProducer(), and produce().

bool pat::PATPhotonProducer::embedPreshowerClusters_
private

Definition at line 75 of file PATPhotonProducer.h.

Referenced by PATPhotonProducer(), and produce().

bool pat::PATPhotonProducer::embedRecHits_
private

Definition at line 76 of file PATPhotonProducer.h.

Referenced by PATPhotonProducer(), and produce().

bool pat::PATPhotonProducer::embedSeedCluster_
private

Definition at line 73 of file PATPhotonProducer.h.

Referenced by PATPhotonProducer(), and produce().

bool pat::PATPhotonProducer::embedSuperCluster_
private

Definition at line 72 of file PATPhotonProducer.h.

Referenced by PATPhotonProducer(), and produce().

GreaterByEt<Photon> pat::PATPhotonProducer::eTComparator_
private

Definition at line 92 of file PATPhotonProducer.h.

Referenced by produce().

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

Definition at line 89 of file PATPhotonProducer.h.

Referenced by PATPhotonProducer(), and produce().

edm::EDGetTokenT<edm::ValueMap<float> > pat::PATPhotonProducer::hcalPFClusterIsoT_
private

Definition at line 85 of file PATPhotonProducer.h.

Referenced by produce().

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

Definition at line 69 of file PATPhotonProducer.h.

Referenced by PATPhotonProducer(), and produce().

IsolationLabels pat::PATPhotonProducer::isoDepositLabels_
private

Definition at line 104 of file PATPhotonProducer.h.

Referenced by produce().

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

Definition at line 101 of file PATPhotonProducer.h.

Referenced by produce().

IsolationLabels pat::PATPhotonProducer::isolationValueLabels_
private

Definition at line 105 of file PATPhotonProducer.h.

Referenced by produce().

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

Definition at line 102 of file PATPhotonProducer.h.

Referenced by produce().

pat::helper::MultiIsolator pat::PATPhotonProducer::isolator_
private

Definition at line 99 of file PATPhotonProducer.h.

Referenced by produce().

pat::helper::MultiIsolator::IsolationValuePairs pat::PATPhotonProducer::isolatorTmpStorage_
private

Definition at line 100 of file PATPhotonProducer.h.

Referenced by produce().

std::vector<NameTag> pat::PATPhotonProducer::photIDSrcs_
private

Definition at line 122 of file PATPhotonProducer.h.

Referenced by produce().

std::vector<edm::EDGetTokenT<edm::ValueMap<Bool_t> > > pat::PATPhotonProducer::photIDTokens_
private

Definition at line 123 of file PATPhotonProducer.h.

Referenced by produce().

edm::EDGetTokenT<edm::View<reco::Photon> > pat::PATPhotonProducer::photonToken_
private

Definition at line 67 of file PATPhotonProducer.h.

Referenced by PATPhotonProducer(), and produce().

edm::InputTag pat::PATPhotonProducer::reducedBarrelRecHitCollection_
private

Definition at line 78 of file PATPhotonProducer.h.

Referenced by PATPhotonProducer().

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

Definition at line 79 of file PATPhotonProducer.h.

Referenced by PATPhotonProducer(), and produce().

edm::InputTag pat::PATPhotonProducer::reducedEndcapRecHitCollection_
private

Definition at line 80 of file PATPhotonProducer.h.

Referenced by PATPhotonProducer().

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

Definition at line 81 of file PATPhotonProducer.h.

Referenced by PATPhotonProducer(), and produce().

pat::helper::KinResolutionsLoader pat::PATPhotonProducer::resolutionLoader_
private

Definition at line 118 of file PATPhotonProducer.h.

Referenced by produce().

pat::PATUserDataHelper<pat::Photon> pat::PATPhotonProducer::userDataHelper_
private

Definition at line 126 of file PATPhotonProducer.h.

Referenced by produce().

bool pat::PATPhotonProducer::useUserData_
private

Definition at line 125 of file PATPhotonProducer.h.

Referenced by produce().