CMS 3D CMS Logo

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::stream::EDProducer<>

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::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Types

typedef std::vector< edm::Handle< edm::ValueMap< IsoDeposit > > > IsoDepositMaps
 
typedef std::pair< pat::IsolationKeys, edm::InputTagIsolationLabel
 
typedef std::vector< IsolationLabelIsolationLabels
 
typedef std::vector< edm::Handle< edm::ValueMap< double > > > IsolationValueMaps
 
typedef std::pair< std::string, edm::InputTagNameTag
 

Private Member Functions

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 addPuppiIsolation_
 
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::GsfElectronCollectionelectronToken_
 
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::ConversionCollectionhConversionsToken_
 
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::EDGetTokenT< edm::ValueMap< float > > PUPPIIsolation_charged_hadrons_
 
edm::EDGetTokenT< edm::ValueMap< float > > PUPPIIsolation_neutral_hadrons_
 
edm::EDGetTokenT< edm::ValueMap< float > > PUPPIIsolation_photons_
 
edm::InputTag reducedBarrelRecHitCollection_
 
edm::EDGetTokenT< EcalRecHitCollectionreducedBarrelRecHitCollectionToken_
 
edm::InputTag reducedEndcapRecHitCollection_
 
edm::EDGetTokenT< EcalRecHitCollectionreducedEndcapRecHitCollectionToken_
 
pat::helper::KinResolutionsLoader resolutionLoader_
 
bool saveRegressionData_
 
pat::PATUserDataHelper< pat::PhotonuserDataHelper_
 
bool useUserData_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

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 95 of file PATPhotonProducer.h.

Definition at line 97 of file PATPhotonProducer.h.

Definition at line 98 of file PATPhotonProducer.h.

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

Definition at line 96 of file PATPhotonProducer.h.

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

Definition at line 122 of file PATPhotonProducer.h.

Constructor & Destructor Documentation

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

Definition at line 33 of file PATPhotonProducer.cc.

References addEfficiencies_, addGenMatch_, addPFClusterIso_, addPhotonID_, addPuppiIsolation_, addResolutions_, beamLineToken_, ecalPFClusterIsoT_, efficiencyLoader_, electronToken_, embedBasicClusters_, embedGenMatch_, embedPreshowerClusters_, embedRecHits_, embedSeedCluster_, embedSuperCluster_, Exception, edm::ParameterSet::existsAs(), genMatchTokens_, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNamesForType(), hcalPFClusterIsoT_, hConversionsToken_, isoDepositLabels_, isoDepositTokens_, isolationValueLabels_, isolationValueTokens_, names, photIDSrcs_, photIDTokens_, photonToken_, PUPPIIsolation_charged_hadrons_, PUPPIIsolation_neutral_hadrons_, PUPPIIsolation_photons_, readIsolationLabels(), reducedBarrelRecHitCollection_, reducedBarrelRecHitCollectionToken_, reducedEndcapRecHitCollection_, reducedEndcapRecHitCollectionToken_, resolutionLoader_, saveRegressionData_, GlobalPosition_Frontier_DevDB_cff::tag, userDataHelper_, useUserData_, and edm::vector_transform().

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

132  {
133 }

Member Function Documentation

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

Definition at line 447 of file PATPhotonProducer.cc.

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

448 {
450  iDesc.setComment("PAT photon producer module");
451 
452  // input source
453  iDesc.add<edm::InputTag>("photonSource", edm::InputTag("no default"))->setComment("input collection");
454  iDesc.add<edm::InputTag>("electronSource", edm::InputTag("no default"))->setComment("input collection");
455  iDesc.add<edm::InputTag>("conversionSource", edm::InputTag("allConversions"))->setComment("input collection");
456 
457  iDesc.add<edm::InputTag>("reducedBarrelRecHitCollection", edm::InputTag("reducedEcalRecHitsEB"));
458  iDesc.add<edm::InputTag>("reducedEndcapRecHitCollection", edm::InputTag("reducedEcalRecHitsEE"));
459 
460  iDesc.ifValue(edm::ParameterDescription<bool>("addPFClusterIso", false, true),
461  true >> (edm::ParameterDescription<edm::InputTag>("ecalPFClusterIsoMap", edm::InputTag("photonEcalPFClusterIsolationProducer"), true) and
462  edm::ParameterDescription<edm::InputTag>("hcalPFClusterIsoMap", edm::InputTag("photonHcalPFClusterIsolationProducer"),true)) or
463  false >> (edm::ParameterDescription<edm::InputTag>("ecalPFClusterIsoMap", edm::InputTag(""), true) and
464  edm::ParameterDescription<edm::InputTag>("hcalPFClusterIsoMap", edm::InputTag(""),true)));
465 
466  iDesc.ifValue(edm::ParameterDescription<bool>("addPuppiIsolation", false, true),
467  true >> (edm::ParameterDescription<edm::InputTag>("puppiIsolationChargedHadrons", edm::InputTag("egmPhotonPUPPIIsolation","h+-DR030-"), true) and
468  edm::ParameterDescription<edm::InputTag>("puppiIsolationNeutralHadrons", edm::InputTag("egmPhotonPUPPIIsolation","h0-DR030-"), true) and
469  edm::ParameterDescription<edm::InputTag>("puppiIsolationPhotons", edm::InputTag("egmPhotonPUPPIIsolation","gamma-DR030-"), true)) or
470  false >> edm::EmptyGroupDescription());
471 
472  iDesc.add<bool>("embedSuperCluster", true)->setComment("embed external super cluster");
473  iDesc.add<bool>("embedSeedCluster", true)->setComment("embed external seed cluster");
474  iDesc.add<bool>("embedBasicClusters", true)->setComment("embed external basic clusters");
475  iDesc.add<bool>("embedPreshowerClusters", true)->setComment("embed external preshower clusters");
476  iDesc.add<bool>("embedRecHits", true)->setComment("embed external RecHits");
477 
478  // MC matching configurables
479  iDesc.add<bool>("addGenMatch", true)->setComment("add MC matching");
480  iDesc.add<bool>("embedGenMatch", false)->setComment("embed MC matched MC information");
481  std::vector<edm::InputTag> emptySourceVector;
482  iDesc.addNode( edm::ParameterDescription<edm::InputTag>("genParticleMatch", edm::InputTag(), true) xor
483  edm::ParameterDescription<std::vector<edm::InputTag> >("genParticleMatch", emptySourceVector, true)
484  )->setComment("input with MC match information");
485 
487 
488  // photon ID configurables
489  iDesc.add<bool>("addPhotonID",true)->setComment("add photon ID variables");
490  edm::ParameterSetDescription photonIDSourcesPSet;
491  photonIDSourcesPSet.setAllowAnything();
492  iDesc.addNode( edm::ParameterDescription<edm::InputTag>("photonIDSource", edm::InputTag(), true) xor
493  edm::ParameterDescription<edm::ParameterSetDescription>("photonIDSources", photonIDSourcesPSet, true)
494  )->setComment("input with photon ID variables");
495 
496  // IsoDeposit configurables
497  edm::ParameterSetDescription isoDepositsPSet;
498  isoDepositsPSet.addOptional<edm::InputTag>("tracker");
499  isoDepositsPSet.addOptional<edm::InputTag>("ecal");
500  isoDepositsPSet.addOptional<edm::InputTag>("hcal");
501  isoDepositsPSet.addOptional<edm::InputTag>("pfAllParticles");
502  isoDepositsPSet.addOptional<edm::InputTag>("pfChargedHadrons");
503  isoDepositsPSet.addOptional<edm::InputTag>("pfChargedAll");
504  isoDepositsPSet.addOptional<edm::InputTag>("pfPUChargedHadrons");
505  isoDepositsPSet.addOptional<edm::InputTag>("pfNeutralHadrons");
506  isoDepositsPSet.addOptional<edm::InputTag>("pfPhotons");
507  isoDepositsPSet.addOptional<std::vector<edm::InputTag> >("user");
508  iDesc.addOptional("isoDeposits", isoDepositsPSet);
509 
510  // isolation values configurables
511  edm::ParameterSetDescription isolationValuesPSet;
512  isolationValuesPSet.addOptional<edm::InputTag>("tracker");
513  isolationValuesPSet.addOptional<edm::InputTag>("ecal");
514  isolationValuesPSet.addOptional<edm::InputTag>("hcal");
515  isolationValuesPSet.addOptional<edm::InputTag>("pfAllParticles");
516  isolationValuesPSet.addOptional<edm::InputTag>("pfChargedHadrons");
517  isolationValuesPSet.addOptional<edm::InputTag>("pfChargedAll");
518  isolationValuesPSet.addOptional<edm::InputTag>("pfPUChargedHadrons");
519  isolationValuesPSet.addOptional<edm::InputTag>("pfNeutralHadrons");
520  isolationValuesPSet.addOptional<edm::InputTag>("pfPhotons");
521  isolationValuesPSet.addOptional<std::vector<edm::InputTag> >("user");
522  iDesc.addOptional("isolationValues", isolationValuesPSet);
523 
524  // Efficiency configurables
525  edm::ParameterSetDescription efficienciesPSet;
526  efficienciesPSet.setAllowAnything(); // TODO: the pat helper needs to implement a description.
527  iDesc.add("efficiencies", efficienciesPSet);
528  iDesc.add<bool>("addEfficiencies", false);
529 
530  // Check to see if the user wants to add user data
531  edm::ParameterSetDescription userDataPSet;
533  iDesc.addOptional("userData", userDataPSet);
534 
535  edm::ParameterSetDescription isolationPSet;
536  isolationPSet.setAllowAnything(); // TODO: the pat helper needs to implement a description.
537  iDesc.add("userIsolation", isolationPSet);
538 
539  iDesc.addNode( edm::ParameterDescription<edm::InputTag>("beamLineSrc", edm::InputTag(), true)
540  )->setComment("input with high level selection");
541 
542  iDesc.add<bool>("saveRegressionData", true)->setComment("save regression input variables");
543 
544  descriptions.add("PATPhotonProducer", iDesc);
545 
546 }
void setComment(std::string const &value)
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
void setAllowAnything()
allow any parameter label/value pairs
ParameterDescriptionNode * addNode(ParameterDescriptionNode const &node)
static void fillDescription(edm::ParameterSetDescription &iDesc)
void setComment(std::string const &value)
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
ParameterDescriptionNode * ifValue(ParameterDescription< T > const &switchParameter, std::unique_ptr< ParameterDescriptionCases< T > > cases)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
static void fillDescription(edm::ParameterSetDescription &iDesc)
Method for documentation and validation of PSet.
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void PATPhotonProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Definition at line 135 of file PATPhotonProducer.cc.

References addGenMatch_, pat::PATObject< ObjectType >::addGenParticleRef(), addPFClusterIso_, addPhotonID_, addPuppiIsolation_, Reference_intrackfit_cff::barrel, beamLineToken_, pat::helper::MultiIsolator::beginEvent(), EcalRegressionData::C1, EcalRegressionData::C2, EcalRegressionData::C3, CandIsolatorFromDeposits_cfi::deposits, 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(), reco::Photon::getPflowIsolationVariables(), CaloTopology::getSubdetectorTopology(), CaloSubdetectorTopology::getWindow(), ConversionTools::hasMatchedPromptElectron(), reco::Photon::hasPixelSeed(), hcalPFClusterIsoT_, hConversionsToken_, mps_fire::i, photons_cff::ids, training_settings::idx, isoDepositLabels_, isoDepositTokens_, isolationValueLabels_, electronProducer_cff::isolationValues, isolationValueTokens_, isolator_, isolatorTmpStorage_, edm::EventBase::isRealData(), edm::EDGetTokenT< T >::isUninitialized(), edm::HandleBase::isValid(), EcalRegressionData::maxSubClusDR(), EcalRegressionData::maxSubClusDRDEta(), EcalRegressionData::maxSubClusDRDPhi(), EcalRegressionData::maxSubClusDRRawEnergy(), eostools::move(), gen::n, pat::helper::EfficiencyLoader::newEvent(), pat::helper::KinResolutionsLoader::newEvent(), photIDSrcs_, photIDTokens_, nano_cff::photons, photonToken_, reco::BeamSpot::position(), edm::Handle< T >::product(), PUPPIIsolation_charged_hadrons_, PUPPIIsolation_neutral_hadrons_, PUPPIIsolation_photons_, edm::SortedCollection< T, SORT >::push_back(), edm::Event::put(), reducedBarrelRecHitCollectionToken_, reducedEndcapRecHitCollectionToken_, resolutionLoader_, saveRegressionData_, SurveyInfoScenario_cff::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::helper::EfficiencyLoader::setEfficiencies(), pat::Photon::setELeft(), pat::Photon::setEMax(), pat::Photon::setERight(), pat::Photon::setETop(), pat::Photon::setHasPixelSeed(), pat::Photon::setIEta(), pat::Photon::setIPhi(), pat::Photon::setIsoDeposit(), pat::Photon::setIsolation(), pat::Photon::setIsolationPUPPI(), pat::Photon::setMaxDR(), pat::Photon::setMaxDRDEta(), pat::Photon::setMaxDRDPhi(), pat::Photon::setMaxDRRawEnergy(), pat::Photon::setPassElectronVeto(), reco::Photon::setPflowIsolationVariables(), 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(), EcalRegressionData::subClusDEta(), EcalRegressionData::subClusDPhi(), EcalRegressionData::subClusRawEnergy(), reco::Photon::PflowIsolationVariables::sumEcalClusterEt, reco::Photon::PflowIsolationVariables::sumHcalClusterEt, reco::Photon::superCluster(), tier0::unique(), userDataHelper_, and useUserData_.

136 {
137  // switch off embedding (in unschedules mode)
138  if (iEvent.isRealData()){
139  addGenMatch_ = false;
140  embedGenMatch_ = false;
141  }
142 
143  edm::ESHandle<CaloTopology> theCaloTopology;
144  iSetup.get<CaloTopologyRecord>().get(theCaloTopology);
145  ecalTopology_ = & (*theCaloTopology);
146 
147  edm::ESHandle<CaloGeometry> theCaloGeometry;
148  iSetup.get<CaloGeometryRecord>().get(theCaloGeometry);
149  ecalGeometry_ = & (*theCaloGeometry);
150 
151  // Get the vector of Photon's from the event
153  iEvent.getByToken(photonToken_, photons);
154 
155  // for conversion veto selection
157  iEvent.getByToken(hConversionsToken_, hConversions);
158 
159  // Get the collection of electrons from the event
161  iEvent.getByToken(electronToken_, hElectrons);
162 
163  // Get the beamspot
164  edm::Handle<reco::BeamSpot> beamSpotHandle;
165  iEvent.getByToken(beamLineToken_, beamSpotHandle);
166 
168 
169  // prepare the MC matching
170  std::vector<edm::Handle<edm::Association<reco::GenParticleCollection> > >genMatches(genMatchTokens_.size());
171  if (addGenMatch_) {
172  for (size_t j = 0, nd = genMatchTokens_.size(); j < nd; ++j) {
173  iEvent.getByToken(genMatchTokens_[j], genMatches[j]);
174  }
175  }
176 
177  if (isolator_.enabled()) isolator_.beginEvent(iEvent,iSetup);
178 
180  if (resolutionLoader_.enabled()) resolutionLoader_.newEvent(iEvent, iSetup);
181 
183  for (size_t j = 0, nd = isoDepositTokens_.size(); j < nd; ++j) {
184  iEvent.getByToken(isoDepositTokens_[j], deposits[j]);
185  }
186 
188  for (size_t j = 0; j<isolationValueTokens_.size(); ++j) {
190  }
191 
192 
193  // prepare ID extraction
194  std::vector<edm::Handle<edm::ValueMap<Bool_t> > > idhandles;
195  std::vector<pat::Photon::IdPair> ids;
196  if (addPhotonID_) {
197  idhandles.resize(photIDSrcs_.size());
198  ids.resize(photIDSrcs_.size());
199  for (size_t i = 0; i < photIDSrcs_.size(); ++i) {
200  iEvent.getByToken(photIDTokens_[i], idhandles[i]);
201  ids[i].first = photIDSrcs_[i].first;
202  }
203  }
204 
205  //value maps for puppi isolation
206  edm::Handle<edm::ValueMap<float>> PUPPIIsolation_charged_hadrons;
207  edm::Handle<edm::ValueMap<float>> PUPPIIsolation_neutral_hadrons;
208  edm::Handle<edm::ValueMap<float>> PUPPIIsolation_photons;
209  if (addPuppiIsolation_){
210  iEvent.getByToken(PUPPIIsolation_charged_hadrons_, PUPPIIsolation_charged_hadrons);
211  iEvent.getByToken(PUPPIIsolation_neutral_hadrons_, PUPPIIsolation_neutral_hadrons);
212  iEvent.getByToken(PUPPIIsolation_photons_, PUPPIIsolation_photons);
213  }
214 
215  // loop over photons
216  std::vector<Photon> * PATPhotons = new std::vector<Photon>();
217  for (edm::View<reco::Photon>::const_iterator itPhoton = photons->begin(); itPhoton != photons->end(); itPhoton++) {
218  // construct the Photon from the ref -> save ref to original object
219  unsigned int idx = itPhoton - photons->begin();
220  edm::RefToBase<reco::Photon> photonRef = photons->refAt(idx);
221  edm::Ptr<reco::Photon> photonPtr = photons->ptrAt(idx);
222  Photon aPhoton(photonRef);
223  auto phoPtr = photons -> ptrAt(idx);
224  if (embedSuperCluster_) aPhoton.embedSuperCluster();
225  if (embedSeedCluster_) aPhoton.embedSeedCluster();
226  if (embedBasicClusters_) aPhoton.embedBasicClusters();
227  if (embedPreshowerClusters_) aPhoton.embedPreshowerClusters();
228 
229  std::vector<DetId> selectedCells;
230  bool barrel = itPhoton->isEB();
231  //loop over sub clusters
232  if (embedBasicClusters_) {
233  for (reco::CaloCluster_iterator clusIt = itPhoton->superCluster()->clustersBegin(); clusIt!=itPhoton->superCluster()->clustersEnd(); ++clusIt) {
234  //get seed (max energy xtal)
235  DetId seed = lazyTools.getMaximum(**clusIt).first;
236  //get all xtals in 5x5 window around the seed
237  std::vector<DetId> dets5x5 = (barrel) ? ecalTopology_->getSubdetectorTopology(DetId::Ecal,EcalBarrel)->getWindow(seed,5,5):
239  selectedCells.insert(selectedCells.end(), dets5x5.begin(), dets5x5.end());
240 
241  //get all xtals belonging to cluster
242  for (const std::pair<DetId, float> &hit : (*clusIt)->hitsAndFractions()) {
243  selectedCells.push_back(hit.first);
244  }
245  }
246  }
247 
248  //remove duplicates
249  std::sort(selectedCells.begin(),selectedCells.end());
250  std::unique(selectedCells.begin(),selectedCells.end());
251 
252  // Retrieve the corresponding RecHits
253 
254 
255  edm::Handle< EcalRecHitCollection > recHitsEBHandle;
256  iEvent.getByToken(reducedBarrelRecHitCollectionToken_,recHitsEBHandle);
257  edm::Handle< EcalRecHitCollection > recHitsEEHandle;
258  iEvent.getByToken(reducedEndcapRecHitCollectionToken_,recHitsEEHandle);
259 
260 
261  //orginal code would throw an exception via the handle not being valid but now it'll just have a null pointer error
262  //should have little effect, if its not barrel or endcap, something very bad has happened elsewhere anyways
263  const EcalRecHitCollection *recHits = nullptr;
264  if(photonRef->superCluster()->seed()->hitsAndFractions().at(0).first.subdetId()==EcalBarrel ) recHits = recHitsEBHandle.product();
265  else if( photonRef->superCluster()->seed()->hitsAndFractions().at(0).first.subdetId()==EcalEndcap ) recHits = recHitsEEHandle.product();
266 
267 
268  EcalRecHitCollection selectedRecHits;
269 
270 
271  unsigned nSelectedCells = selectedCells.size();
272  for (unsigned icell = 0 ; icell < nSelectedCells ; ++icell) {
273  EcalRecHitCollection::const_iterator it = recHits->find( selectedCells[icell] );
274  if ( it != recHits->end() ) {
275  selectedRecHits.push_back(*it);
276  }
277  }
278  selectedRecHits.sort();
279  if (embedRecHits_) aPhoton.embedRecHits(& selectedRecHits);
280 
281  // store the match to the generated final state muons
282  if (addGenMatch_) {
283  for(size_t i = 0, n = genMatches.size(); i < n; ++i) {
284  reco::GenParticleRef genPhoton = (*genMatches[i])[photonRef];
285  aPhoton.addGenParticleRef(genPhoton);
286  }
287  if (embedGenMatch_) aPhoton.embedGenParticle();
288  }
289 
290  if (efficiencyLoader_.enabled()) {
291  efficiencyLoader_.setEfficiencies( aPhoton, photonRef );
292  }
293 
294  if (resolutionLoader_.enabled()) {
296  }
297 
298  // here comes the extra functionality
299  if (isolator_.enabled()) {
300  isolator_.fill(*photons, idx, isolatorTmpStorage_);
301  typedef pat::helper::MultiIsolator::IsolationValuePairs IsolationValuePairs;
302  // better to loop backwards, so the vector is resized less times
303  for (IsolationValuePairs::const_reverse_iterator it = isolatorTmpStorage_.rbegin(), ed = isolatorTmpStorage_.rend(); it != ed; ++it) {
304  aPhoton.setIsolation(it->first, it->second);
305  }
306  }
307 
308  for (size_t j = 0, nd = deposits.size(); j < nd; ++j) {
309  aPhoton.setIsoDeposit(isoDepositLabels_[j].first, (*deposits[j])[photonRef]);
310  }
311 
312  for (size_t j = 0; j<isolationValues.size(); ++j) {
313  aPhoton.setIsolation(isolationValueLabels_[j].first,(*isolationValues[j])[photonRef]);
314  }
315 
316  // add photon ID info
317  if (addPhotonID_) {
318  for (size_t i = 0; i < photIDSrcs_.size(); ++i) {
319  ids[i].second = (*idhandles[i])[photonRef];
320  }
321  aPhoton.setPhotonIDs(ids);
322  }
323 
324  if ( useUserData_ ) {
325  userDataHelper_.add( aPhoton, iEvent, iSetup );
326  }
327 
328 
329  // set conversion veto selection
330  bool passelectronveto = false;
331  if( hConversions.isValid()){
332  // this is recommended method
333  passelectronveto = !ConversionTools::hasMatchedPromptElectron(photonRef->superCluster(), hElectrons, hConversions, beamSpotHandle->position());
334  }
335  aPhoton.setPassElectronVeto( passelectronveto );
336 
337 
338  // set electron veto using pixel seed (not recommended but many analysis groups are still using since it is powerful method to remove electrons)
339  aPhoton.setHasPixelSeed( photonRef->hasPixelSeed() );
340 
341  // set seed energy
342  aPhoton.setSeedEnergy( photonRef->superCluster()->seed()->energy() );
343 
344  // set input variables for regression energy correction
345  if (saveRegressionData_) {
346  EcalRegressionData ecalRegData;
347  ecalRegData.fill(*(photonRef->superCluster()),
348  recHitsEBHandle.product(),recHitsEEHandle.product(),
350 
351  aPhoton.setEMax( ecalRegData.eMax() );
352  aPhoton.setE2nd( ecalRegData.e2nd() );
353  aPhoton.setE3x3( ecalRegData.e3x3() );
354  aPhoton.setETop( ecalRegData.eTop() );
355  aPhoton.setEBottom( ecalRegData.eBottom() );
356  aPhoton.setELeft( ecalRegData.eLeft() );
357  aPhoton.setERight( ecalRegData.eRight() );
358  aPhoton.setSee( ecalRegData.sigmaIEtaIEta() );
359  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
360  aPhoton.setSpp( ecalRegData.sigmaIPhiIPhi() );
361 
362  aPhoton.setMaxDR( ecalRegData.maxSubClusDR() );
363  aPhoton.setMaxDRDPhi( ecalRegData.maxSubClusDRDPhi() );
364  aPhoton.setMaxDRDEta( ecalRegData.maxSubClusDRDEta() );
365  aPhoton.setMaxDRRawEnergy( ecalRegData.maxSubClusDRRawEnergy() );
366  aPhoton.setSubClusRawE1( ecalRegData.subClusRawEnergy(EcalRegressionData::SubClusNr::C1) );
367  aPhoton.setSubClusRawE2( ecalRegData.subClusRawEnergy(EcalRegressionData::SubClusNr::C2) );
368  aPhoton.setSubClusRawE3( ecalRegData.subClusRawEnergy(EcalRegressionData::SubClusNr::C3) );
369  aPhoton.setSubClusDPhi1( ecalRegData.subClusDPhi(EcalRegressionData::SubClusNr::C1) );
370  aPhoton.setSubClusDPhi2( ecalRegData.subClusDPhi(EcalRegressionData::SubClusNr::C2) );
371  aPhoton.setSubClusDPhi3( ecalRegData.subClusDPhi(EcalRegressionData::SubClusNr::C3) );
372  aPhoton.setSubClusDEta1( ecalRegData.subClusDEta(EcalRegressionData::SubClusNr::C1) );
373  aPhoton.setSubClusDEta2( ecalRegData.subClusDEta(EcalRegressionData::SubClusNr::C2) );
374  aPhoton.setSubClusDEta3( ecalRegData.subClusDEta(EcalRegressionData::SubClusNr::C3) );
375 
376  aPhoton.setCryPhi( ecalRegData.seedCrysPhiOrY() );
377  aPhoton.setCryEta( ecalRegData.seedCrysEtaOrX() );
378  aPhoton.setIEta( ecalRegData.seedCrysIEtaOrIX() );
379  aPhoton.setIPhi( ecalRegData.seedCrysIPhiOrIY() );
380  } else {
381  aPhoton.setEMax(0);
382  aPhoton.setE2nd(0);
383  aPhoton.setE3x3(0);
384  aPhoton.setETop(0);
385  aPhoton.setEBottom(0);
386  aPhoton.setELeft(0);
387  aPhoton.setERight(0);
388  aPhoton.setSee(0);
389  aPhoton.setSep(0);
390  aPhoton.setSpp(0);
391 
392  aPhoton.setMaxDR(0);
393  aPhoton.setMaxDRDPhi(0);
394  aPhoton.setMaxDRDEta(0);
395  aPhoton.setMaxDRRawEnergy(0);
396  aPhoton.setSubClusRawE1(0);
397  aPhoton.setSubClusRawE2(0);
398  aPhoton.setSubClusRawE3(0);
399  aPhoton.setSubClusDPhi1(0);
400  aPhoton.setSubClusDPhi2(0);
401  aPhoton.setSubClusDPhi3(0);
402  aPhoton.setSubClusDEta1(0);
403  aPhoton.setSubClusDEta2(0);
404  aPhoton.setSubClusDEta3(0);
405 
406  aPhoton.setCryPhi(0);
407  aPhoton.setCryEta(0);
408  aPhoton.setIEta(0);
409  aPhoton.setIPhi(0);
410  }
411 
412  if (addPuppiIsolation_)aPhoton.setIsolationPUPPI((*PUPPIIsolation_charged_hadrons)[phoPtr], (*PUPPIIsolation_neutral_hadrons)[phoPtr], (*PUPPIIsolation_photons)[phoPtr]);
413  else aPhoton.setIsolationPUPPI(-999., -999.,-999.);
414 
415  // Get PFCluster Isolation
416  if (addPFClusterIso_) {
417  reco::Photon::PflowIsolationVariables newPFIsol = aPhoton.getPflowIsolationVariables();
418  edm::Handle<edm::ValueMap<float> > ecalPFClusterIsoMapH;
419  iEvent.getByToken(ecalPFClusterIsoT_, ecalPFClusterIsoMapH);
420  newPFIsol.sumEcalClusterEt = (*ecalPFClusterIsoMapH)[photonRef];
421  edm::Handle<edm::ValueMap<float> > hcalPFClusterIsoMapH;
423  iEvent.getByToken(hcalPFClusterIsoT_, hcalPFClusterIsoMapH);
424  newPFIsol.sumHcalClusterEt = (*hcalPFClusterIsoMapH)[photonRef];
425  }
426  else{
427  newPFIsol.sumHcalClusterEt = -999.;
428  }
429  aPhoton.setPflowIsolationVariables(newPFIsol);
430  }
431 
432  // add the Photon to the vector of Photons
433  PATPhotons->push_back(aPhoton);
434  }
435 
436  // sort Photons in ET
437  std::sort(PATPhotons->begin(), PATPhotons->end(), eTComparator_);
438 
439  // put genEvt object in Event
440  std::unique_ptr<std::vector<Photon> > myPhotons(PATPhotons);
441  iEvent.put(std::move(myPhotons));
443 
444 }
bool enabled() const
&#39;true&#39; if this there is at least one efficiency configured
float sigmaIPhiIPhi() const
void newEvent(const edm::Event &event)
To be called for each new event, reads in the ValueMaps for efficiencies.
const std::vector< float > & subClusRawEnergy() const
pat::PATUserDataHelper< pat::Photon > userDataHelper_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
float maxSubClusDRRawEnergy() const
float maxSubClusDRDEta() const
Definition: Photon.py:1
edm::EDGetTokenT< EcalRecHitCollection > reducedEndcapRecHitCollectionToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
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
reco::SuperClusterRef superCluster() const override
Ref to SuperCluster.
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_
std::vector< edm::EDGetTokenT< edm::ValueMap< IsoDeposit > > > isoDepositTokens_
pat::helper::EfficiencyLoader efficiencyLoader_
void newEvent(const edm::Event &event, const edm::EventSetup &setup)
To be called for each new event, reads in the EventSetup object.
float maxSubClusDR() const
def unique(seq, keepstr=True)
Definition: tier0.py:24
float seedCrysIEtaOrIX() const
edm::EDGetTokenT< edm::ValueMap< float > > PUPPIIsolation_photons_
float maxSubClusDRDPhi() const
std::vector< NameTag > photIDSrcs_
bool isValid() const
Definition: HandleBase.h:74
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
edm::EDGetTokenT< edm::ValueMap< float > > PUPPIIsolation_charged_hadrons_
T const * product() const
Definition: Handle.h:81
bool hasPixelSeed() const
Bool flagging photons having a non-zero size vector of Ref to electornPixel seeds.
Definition: Photon.h:76
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:25
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:86
size_type size() const
edm::EDGetTokenT< edm::ValueMap< float > > PUPPIIsolation_neutral_hadrons_
float eRight() const
T get() const
Definition: EventSetup.h:63
bool isUninitialized() const
Definition: EDGetToken.h:73
const Point & position() const
position
Definition: BeamSpot.h:62
edm::EDGetTokenT< EcalRecHitCollection > reducedBarrelRecHitCollectionToken_
std::vector< edm::EDGetTokenT< edm::ValueMap< double > > > isolationValueTokens_
def move(src, dest)
Definition: eostools.py:510
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 pat::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 146 of file PATPhotonProducer.h.

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

Referenced by PATPhotonProducer().

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

Referenced by PATPhotonProducer().

bool pat::PATPhotonProducer::addGenMatch_
private

Definition at line 88 of file PATPhotonProducer.h.

Referenced by PATPhotonProducer(), and produce().

bool pat::PATPhotonProducer::addPFClusterIso_
private

Definition at line 83 of file PATPhotonProducer.h.

Referenced by PATPhotonProducer(), and produce().

bool pat::PATPhotonProducer::addPhotonID_
private

Definition at line 121 of file PATPhotonProducer.h.

Referenced by PATPhotonProducer(), and produce().

bool pat::PATPhotonProducer::addPuppiIsolation_
private

Definition at line 84 of file PATPhotonProducer.h.

Referenced by PATPhotonProducer(), and produce().

bool pat::PATPhotonProducer::addResolutions_
private

Definition at line 118 of file PATPhotonProducer.h.

Referenced by PATPhotonProducer().

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 134 of file PATPhotonProducer.h.

Referenced by produce().

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

Definition at line 85 of file PATPhotonProducer.h.

Referenced by PATPhotonProducer(), and produce().

const CaloTopology* pat::PATPhotonProducer::ecalTopology_
private

Definition at line 133 of file PATPhotonProducer.h.

Referenced by produce().

EcalClusterLocal pat::PATPhotonProducer::ecl_
private

Definition at line 135 of file PATPhotonProducer.h.

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

Definition at line 116 of file PATPhotonProducer.h.

Referenced by PATPhotonProducer(), and 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 89 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 93 of file PATPhotonProducer.h.

Referenced by produce().

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

Definition at line 90 of file PATPhotonProducer.h.

Referenced by PATPhotonProducer(), and produce().

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

Definition at line 86 of file PATPhotonProducer.h.

Referenced by PATPhotonProducer(), and 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 105 of file PATPhotonProducer.h.

Referenced by PATPhotonProducer(), and produce().

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

Definition at line 102 of file PATPhotonProducer.h.

Referenced by PATPhotonProducer(), and produce().

IsolationLabels pat::PATPhotonProducer::isolationValueLabels_
private

Definition at line 106 of file PATPhotonProducer.h.

Referenced by PATPhotonProducer(), and produce().

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

Definition at line 103 of file PATPhotonProducer.h.

Referenced by PATPhotonProducer(), and produce().

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

Definition at line 100 of file PATPhotonProducer.h.

Referenced by produce().

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

Definition at line 101 of file PATPhotonProducer.h.

Referenced by produce().

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

Definition at line 123 of file PATPhotonProducer.h.

Referenced by PATPhotonProducer(), and produce().

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

Definition at line 124 of file PATPhotonProducer.h.

Referenced by PATPhotonProducer(), and 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::EDGetTokenT<edm::ValueMap<float> > pat::PATPhotonProducer::PUPPIIsolation_charged_hadrons_
private

Definition at line 128 of file PATPhotonProducer.h.

Referenced by PATPhotonProducer(), and produce().

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

Definition at line 129 of file PATPhotonProducer.h.

Referenced by PATPhotonProducer(), and produce().

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

Definition at line 130 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 119 of file PATPhotonProducer.h.

Referenced by PATPhotonProducer(), and produce().

bool pat::PATPhotonProducer::saveRegressionData_
private

Definition at line 137 of file PATPhotonProducer.h.

Referenced by PATPhotonProducer(), and produce().

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

Definition at line 131 of file PATPhotonProducer.h.

Referenced by PATPhotonProducer(), and produce().

bool pat::PATPhotonProducer::useUserData_
private

Definition at line 126 of file PATPhotonProducer.h.

Referenced by PATPhotonProducer(), and produce().