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...

Inheritance diagram for pat::PATPhotonProducer:
edm::stream::EDProducer<>

Public Member Functions

 PATPhotonProducer (const edm::ParameterSet &iConfig)
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 ~PATPhotonProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

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 EcalClusterLazyTools::ESGetTokens ecalClusterToolsESGetTokens_
 
const CaloGeometryecalGeometry_
 
const edm::ESGetToken< CaloGeometry, CaloGeometryRecordecalGeometryToken_
 
edm::EDGetTokenT< edm::ValueMap< float > > ecalPFClusterIsoT_
 
const CaloTopologyecalTopology_
 
const edm::ESGetToken< CaloTopology, CaloTopologyRecordecalTopologyToken_
 
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<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::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 49 of file PATPhotonProducer.cc.

Member Typedef Documentation

◆ IsoDepositMaps

Definition at line 90 of file PATPhotonProducer.cc.

◆ IsolationLabel

Definition at line 92 of file PATPhotonProducer.cc.

◆ IsolationLabels

Definition at line 93 of file PATPhotonProducer.cc.

◆ IsolationValueMaps

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

Definition at line 91 of file PATPhotonProducer.cc.

◆ NameTag

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

Definition at line 118 of file PATPhotonProducer.cc.

Constructor & Destructor Documentation

◆ PATPhotonProducer()

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

Definition at line 192 of file PATPhotonProducer.cc.

193  : ecalClusterToolsESGetTokens_{consumesCollector()},
194  isolator_(iConfig.getParameter<edm::ParameterSet>("userIsolation"), consumesCollector(), false),
195  useUserData_(iConfig.exists("userData")),
198  // initialize the configurables
199  photonToken_ = consumes<edm::View<reco::Photon>>(iConfig.getParameter<edm::InputTag>("photonSource"));
200  electronToken_ = consumes<reco::GsfElectronCollection>(iConfig.getParameter<edm::InputTag>("electronSource"));
201  hConversionsToken_ = consumes<reco::ConversionCollection>(iConfig.getParameter<edm::InputTag>("conversionSource"));
202  beamLineToken_ = consumes<reco::BeamSpot>(iConfig.getParameter<edm::InputTag>("beamLineSrc"));
203  embedSuperCluster_ = iConfig.getParameter<bool>("embedSuperCluster");
204  embedSeedCluster_ = iConfig.getParameter<bool>("embedSeedCluster");
205  embedBasicClusters_ = iConfig.getParameter<bool>("embedBasicClusters");
206  embedPreshowerClusters_ = iConfig.getParameter<bool>("embedPreshowerClusters");
207  embedRecHits_ = iConfig.getParameter<bool>("embedRecHits");
208  reducedBarrelRecHitCollection_ = iConfig.getParameter<edm::InputTag>("reducedBarrelRecHitCollection");
209  reducedBarrelRecHitCollectionToken_ = mayConsume<EcalRecHitCollection>(reducedBarrelRecHitCollection_);
210  reducedEndcapRecHitCollection_ = iConfig.getParameter<edm::InputTag>("reducedEndcapRecHitCollection");
211  reducedEndcapRecHitCollectionToken_ = mayConsume<EcalRecHitCollection>(reducedEndcapRecHitCollection_);
212  // MC matching configurables
213  addGenMatch_ = iConfig.getParameter<bool>("addGenMatch");
214  if (addGenMatch_) {
215  embedGenMatch_ = iConfig.getParameter<bool>("embedGenMatch");
217  iConfig.getParameter<edm::InputTag>("genParticleMatch")));
218  }
219  // Efficiency configurables
220  addEfficiencies_ = iConfig.getParameter<bool>("addEfficiencies");
221  if (addEfficiencies_) {
223  pat::helper::EfficiencyLoader(iConfig.getParameter<edm::ParameterSet>("efficiencies"), consumesCollector());
224  }
225  // PFCluster Isolation maps
226  addPuppiIsolation_ = iConfig.getParameter<bool>("addPuppiIsolation");
227  if (addPuppiIsolation_) {
229  consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("puppiIsolationChargedHadrons"));
231  consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("puppiIsolationNeutralHadrons"));
233  consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("puppiIsolationPhotons"));
234  }
235  addPFClusterIso_ = iConfig.getParameter<bool>("addPFClusterIso");
236  if (addPFClusterIso_) {
237  ecalPFClusterIsoT_ = consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("ecalPFClusterIsoMap"));
238  auto hcPFC = iConfig.getParameter<edm::InputTag>("hcalPFClusterIsoMap");
239  if (not hcPFC.label().empty())
240  hcalPFClusterIsoT_ = consumes<edm::ValueMap<float>>(hcPFC);
241  }
242 
243  // photon ID configurables
244  addPhotonID_ = iConfig.getParameter<bool>("addPhotonID");
245  if (addPhotonID_) {
246  // it might be a single photon ID
247  if (iConfig.existsAs<edm::InputTag>("photonIDSource")) {
248  photIDSrcs_.push_back(NameTag("", iConfig.getParameter<edm::InputTag>("photonIDSource")));
249  }
250  // or there might be many of them
251  if (iConfig.existsAs<edm::ParameterSet>("photonIDSources")) {
252  // please don't configure me twice
253  if (!photIDSrcs_.empty()) {
254  throw cms::Exception("Configuration")
255  << "PATPhotonProducer: you can't specify both 'photonIDSource' and 'photonIDSources'\n";
256  }
257  // read the different photon ID names
258  edm::ParameterSet idps = iConfig.getParameter<edm::ParameterSet>("photonIDSources");
259  std::vector<std::string> names = idps.getParameterNamesForType<edm::InputTag>();
260  for (std::vector<std::string>::const_iterator it = names.begin(), ed = names.end(); it != ed; ++it) {
261  photIDSrcs_.push_back(NameTag(*it, idps.getParameter<edm::InputTag>(*it)));
262  }
263  }
264  // but in any case at least once
265  if (photIDSrcs_.empty())
266  throw cms::Exception("Configuration") << "PATPhotonProducer: id addPhotonID is true, you must specify either:\n"
267  << "\tInputTag photonIDSource = <someTag>\n"
268  << "or\n"
269  << "\tPSet photonIDSources = { \n"
270  << "\t\tInputTag <someName> = <someTag> // as many as you want \n "
271  << "\t}\n";
272  }
274  photIDSrcs_, [this](NameTag const& tag) { return mayConsume<edm::ValueMap<Bool_t>>(tag.second); });
275  // Resolution configurables
276  addResolutions_ = iConfig.getParameter<bool>("addResolutions");
277  if (addResolutions_) {
279  pat::helper::KinResolutionsLoader(iConfig.getParameter<edm::ParameterSet>("resolutions"), consumesCollector());
280  }
281  // Check to see if the user wants to add user data
282  if (useUserData_) {
284  PATUserDataHelper<Photon>(iConfig.getParameter<edm::ParameterSet>("userData"), consumesCollector());
285  }
286  // produces vector of photons
287  produces<std::vector<Photon>>();
288 
289  // read isoDeposit labels, for direct embedding
290  readIsolationLabels(iConfig, "isoDeposits", isoDepositLabels_, isoDepositTokens_);
291  // read isolation value labels, for direct embedding
293 
294  saveRegressionData_ = iConfig.getParameter<bool>("saveRegressionData");
295 }
Assists in assimilating all pat::UserData into pat objects.
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
pat::PATUserDataHelper< pat::Photon > userDataHelper_
edm::EDGetTokenT< EcalRecHitCollection > reducedEndcapRecHitCollectionToken_
std::pair< std::string, edm::InputTag > NameTag
void readIsolationLabels(const edm::ParameterSet &iConfig, const char *psetName, IsolationLabels &labels, std::vector< edm::EDGetTokenT< edm::ValueMap< T >>> &tokens)
std::vector< edm::EDGetTokenT< edm::ValueMap< Bool_t > > > photIDTokens_
bool exists(std::string const &parameterName) const
checks if a parameter exists
edm::EDGetTokenT< reco::BeamSpot > beamLineToken_
edm::EDGetTokenT< edm::View< reco::Photon > > photonToken_
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_
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:172
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_
IsolationLabels isoDepositLabels_
IsolationLabels isolationValueLabels_
std::vector< edm::EDGetTokenT< edm::ValueMap< IsoDeposit > > > isoDepositTokens_
pat::helper::EfficiencyLoader efficiencyLoader_
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
Definition: ParameterSet.h:180
edm::EDGetTokenT< edm::ValueMap< float > > PUPPIIsolation_photons_
std::vector< NameTag > photIDSrcs_
pat::helper::MultiIsolator isolator_
edm::EDGetTokenT< edm::ValueMap< float > > PUPPIIsolation_charged_hadrons_
const EcalClusterLazyTools::ESGetTokens ecalClusterToolsESGetTokens_
const edm::ESGetToken< CaloTopology, CaloTopologyRecord > ecalTopologyToken_
edm::EDGetTokenT< edm::ValueMap< float > > PUPPIIsolation_neutral_hadrons_
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > ecalGeometryToken_
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::~PATPhotonProducer ( )
override

Definition at line 297 of file PATPhotonProducer.cc.

297 {}

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 628 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(), ProducerED_cfi::InputTag, or, edm::ParameterSetDescription::setAllowAnything(), edm::ParameterSetDescription::setComment(), and edm::ParameterDescriptionNode::setComment().

628  {
630  iDesc.setComment("PAT photon producer module");
631 
632  // input source
633  iDesc.add<edm::InputTag>("photonSource", edm::InputTag("no default"))->setComment("input collection");
634  iDesc.add<edm::InputTag>("electronSource", edm::InputTag("no default"))->setComment("input collection");
635  iDesc.add<edm::InputTag>("conversionSource", edm::InputTag("allConversions"))->setComment("input collection");
636 
637  iDesc.add<edm::InputTag>("reducedBarrelRecHitCollection", edm::InputTag("reducedEcalRecHitsEB"));
638  iDesc.add<edm::InputTag>("reducedEndcapRecHitCollection", edm::InputTag("reducedEcalRecHitsEE"));
639 
640  iDesc.ifValue(
641  edm::ParameterDescription<bool>("addPFClusterIso", false, true),
643  "ecalPFClusterIsoMap", edm::InputTag("photonEcalPFClusterIsolationProducer"), true) and
645  "hcalPFClusterIsoMap", edm::InputTag("photonHcalPFClusterIsolationProducer"), true)) or
646  false >> (edm::ParameterDescription<edm::InputTag>("ecalPFClusterIsoMap", edm::InputTag(""), true) and
647  edm::ParameterDescription<edm::InputTag>("hcalPFClusterIsoMap", edm::InputTag(""), true)));
648 
649  iDesc.ifValue(
650  edm::ParameterDescription<bool>("addPuppiIsolation", false, true),
652  "puppiIsolationChargedHadrons", edm::InputTag("egmPhotonPUPPIIsolation", "h+-DR030-"), true) and
654  "puppiIsolationNeutralHadrons", edm::InputTag("egmPhotonPUPPIIsolation", "h0-DR030-"), true) and
656  "puppiIsolationPhotons", edm::InputTag("egmPhotonPUPPIIsolation", "gamma-DR030-"), true)) or
657  false >> edm::EmptyGroupDescription());
658 
659  iDesc.add<bool>("embedSuperCluster", true)->setComment("embed external super cluster");
660  iDesc.add<bool>("embedSeedCluster", true)->setComment("embed external seed cluster");
661  iDesc.add<bool>("embedBasicClusters", true)->setComment("embed external basic clusters");
662  iDesc.add<bool>("embedPreshowerClusters", true)->setComment("embed external preshower clusters");
663  iDesc.add<bool>("embedRecHits", true)->setComment("embed external RecHits");
664 
665  // MC matching configurables
666  iDesc.add<bool>("addGenMatch", true)->setComment("add MC matching");
667  iDesc.add<bool>("embedGenMatch", false)->setComment("embed MC matched MC information");
668  std::vector<edm::InputTag> emptySourceVector;
669  iDesc
670  .addNode(edm::ParameterDescription<edm::InputTag>("genParticleMatch", edm::InputTag(), true) xor
671  edm::ParameterDescription<std::vector<edm::InputTag>>("genParticleMatch", emptySourceVector, true))
672  ->setComment("input with MC match information");
673 
675 
676  // photon ID configurables
677  iDesc.add<bool>("addPhotonID", true)->setComment("add photon ID variables");
678  edm::ParameterSetDescription photonIDSourcesPSet;
679  photonIDSourcesPSet.setAllowAnything();
680  iDesc
681  .addNode(edm::ParameterDescription<edm::InputTag>("photonIDSource", edm::InputTag(), true) xor
682  edm::ParameterDescription<edm::ParameterSetDescription>("photonIDSources", photonIDSourcesPSet, true))
683  ->setComment("input with photon ID variables");
684 
685  // IsoDeposit configurables
686  edm::ParameterSetDescription isoDepositsPSet;
687  isoDepositsPSet.addOptional<edm::InputTag>("tracker");
688  isoDepositsPSet.addOptional<edm::InputTag>("ecal");
689  isoDepositsPSet.addOptional<edm::InputTag>("hcal");
690  isoDepositsPSet.addOptional<edm::InputTag>("pfAllParticles");
691  isoDepositsPSet.addOptional<edm::InputTag>("pfChargedHadrons");
692  isoDepositsPSet.addOptional<edm::InputTag>("pfChargedAll");
693  isoDepositsPSet.addOptional<edm::InputTag>("pfPUChargedHadrons");
694  isoDepositsPSet.addOptional<edm::InputTag>("pfNeutralHadrons");
695  isoDepositsPSet.addOptional<edm::InputTag>("pfPhotons");
696  isoDepositsPSet.addOptional<std::vector<edm::InputTag>>("user");
697  iDesc.addOptional("isoDeposits", isoDepositsPSet);
698 
699  // isolation values configurables
700  edm::ParameterSetDescription isolationValuesPSet;
701  isolationValuesPSet.addOptional<edm::InputTag>("tracker");
702  isolationValuesPSet.addOptional<edm::InputTag>("ecal");
703  isolationValuesPSet.addOptional<edm::InputTag>("hcal");
704  isolationValuesPSet.addOptional<edm::InputTag>("pfAllParticles");
705  isolationValuesPSet.addOptional<edm::InputTag>("pfChargedHadrons");
706  isolationValuesPSet.addOptional<edm::InputTag>("pfChargedAll");
707  isolationValuesPSet.addOptional<edm::InputTag>("pfPUChargedHadrons");
708  isolationValuesPSet.addOptional<edm::InputTag>("pfNeutralHadrons");
709  isolationValuesPSet.addOptional<edm::InputTag>("pfPhotons");
710  isolationValuesPSet.addOptional<std::vector<edm::InputTag>>("user");
711  iDesc.addOptional("isolationValues", isolationValuesPSet);
712 
713  // Efficiency configurables
714  edm::ParameterSetDescription efficienciesPSet;
715  efficienciesPSet.setAllowAnything(); // TODO: the pat helper needs to implement a description.
716  iDesc.add("efficiencies", efficienciesPSet);
717  iDesc.add<bool>("addEfficiencies", false);
718 
719  // Check to see if the user wants to add user data
720  edm::ParameterSetDescription userDataPSet;
722  iDesc.addOptional("userData", userDataPSet);
723 
724  edm::ParameterSetDescription isolationPSet;
725  isolationPSet.setAllowAnything(); // TODO: the pat helper needs to implement a description.
726  iDesc.add("userIsolation", isolationPSet);
727 
728  iDesc.addNode(edm::ParameterDescription<edm::InputTag>("beamLineSrc", edm::InputTag(), true))
729  ->setComment("input with high level selection");
730 
731  iDesc.add<bool>("saveRegressionData", true)->setComment("save regression input variables");
732 
733  descriptions.add("PATPhotonProducer", iDesc);
734 }
void setComment(std::string const &value)
ParameterDescriptionNode * ifValue(ParameterDescription< T > const &switchParameter, std::unique_ptr< ParameterDescriptionCases< T >> cases)
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
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)

◆ produce()

void PATPhotonProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 299 of file PATPhotonProducer.cc.

References pat::PATUserDataHelper< ObjectType >::add(), 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, ecalClusterToolsESGetTokens_, EcalEndcap, ecalGeometry_, ecalGeometryToken_, ecalPFClusterIsoT_, ecalTopology_, ecalTopologyToken_, 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(), pat::helper::MultiIsolator::endEvent(), EcalRegressionData::eRight(), eTComparator_, EcalRegressionData::eTop(), pat::helper::MultiIsolator::fill(), EcalRegressionData::fill(), dqmdumpme::first, genMatchTokens_, EcalClusterLazyToolsBase::ESGetTokens::get(), edm::EventSetup::getData(), reco::Photon::getPflowIsolationVariables(), CaloTopology::getSubdetectorTopology(), CaloSubdetectorTopology::getWindow(), ConversionTools::hasMatchedPromptElectron(), reco::Photon::hasPixelSeed(), hcalPFClusterIsoT_, hConversionsToken_, mps_fire::i, heavyIonCSV_trainingSettings::idx, iEvent, isoDepositLabels_, isoDepositTokens_, isolationValueLabels_, displacedMuonProducer_cff::isolationValues, isolationValueTokens_, isolator_, isolatorTmpStorage_, edm::EDGetTokenT< T >::isUninitialized(), edm::HandleBase::isValid(), dqmiolumiharvest::j, EcalRegressionData::maxSubClusDR(), EcalRegressionData::maxSubClusDRDEta(), EcalRegressionData::maxSubClusDRDPhi(), EcalRegressionData::maxSubClusDRRawEnergy(), eostools::move(), dqmiodumpmetadata::n, pat::helper::EfficiencyLoader::newEvent(), pat::helper::KinResolutionsLoader::newEvent(), photIDSrcs_, photIDTokens_, BPHMonitor_cfi::photons, photonToken_, reco::BeamSpot::position(), edm::Handle< T >::product(), PUPPIIsolation_charged_hadrons_, PUPPIIsolation_neutral_hadrons_, PUPPIIsolation_photons_, edm::SortedCollection< T, SORT >::push_back(), FastTrackerRecHitMaskProducer_cfi::recHits, reducedBarrelRecHitCollectionToken_, reducedEndcapRecHitCollectionToken_, resolutionLoader_, saveRegressionData_, 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::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(), jetUpdater_cfi::sort, 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_.

299  {
300  // switch off embedding (in unschedules mode)
301  if (iEvent.isRealData()) {
302  addGenMatch_ = false;
303  embedGenMatch_ = false;
304  }
305 
308 
309  // Get the vector of Photon's from the event
311  iEvent.getByToken(photonToken_, photons);
312 
313  // for conversion veto selection
315  iEvent.getByToken(hConversionsToken_, hConversions);
316 
317  // Get the collection of electrons from the event
319  iEvent.getByToken(electronToken_, hElectrons);
320 
321  // Get the beamspot
322  edm::Handle<reco::BeamSpot> beamSpotHandle;
323  iEvent.getByToken(beamLineToken_, beamSpotHandle);
324 
325  EcalClusterLazyTools lazyTools(iEvent,
329 
330  // prepare the MC matching
331  std::vector<edm::Handle<edm::Association<reco::GenParticleCollection>>> genMatches(genMatchTokens_.size());
332  if (addGenMatch_) {
333  for (size_t j = 0, nd = genMatchTokens_.size(); j < nd; ++j) {
334  iEvent.getByToken(genMatchTokens_[j], genMatches[j]);
335  }
336  }
337 
338  if (isolator_.enabled())
339  isolator_.beginEvent(iEvent, iSetup);
340 
345 
347  for (size_t j = 0, nd = isoDepositTokens_.size(); j < nd; ++j) {
348  iEvent.getByToken(isoDepositTokens_[j], deposits[j]);
349  }
350 
352  for (size_t j = 0; j < isolationValueTokens_.size(); ++j) {
354  }
355 
356  // prepare ID extraction
357  std::vector<edm::Handle<edm::ValueMap<Bool_t>>> idhandles;
358  std::vector<pat::Photon::IdPair> ids;
359  if (addPhotonID_) {
360  idhandles.resize(photIDSrcs_.size());
361  ids.resize(photIDSrcs_.size());
362  for (size_t i = 0; i < photIDSrcs_.size(); ++i) {
363  iEvent.getByToken(photIDTokens_[i], idhandles[i]);
364  ids[i].first = photIDSrcs_[i].first;
365  }
366  }
367 
368  //value maps for puppi isolation
369  edm::Handle<edm::ValueMap<float>> PUPPIIsolation_charged_hadrons;
370  edm::Handle<edm::ValueMap<float>> PUPPIIsolation_neutral_hadrons;
371  edm::Handle<edm::ValueMap<float>> PUPPIIsolation_photons;
372  if (addPuppiIsolation_) {
373  iEvent.getByToken(PUPPIIsolation_charged_hadrons_, PUPPIIsolation_charged_hadrons);
374  iEvent.getByToken(PUPPIIsolation_neutral_hadrons_, PUPPIIsolation_neutral_hadrons);
375  iEvent.getByToken(PUPPIIsolation_photons_, PUPPIIsolation_photons);
376  }
377 
378  // loop over photons
379  std::vector<Photon>* PATPhotons = new std::vector<Photon>();
380  for (edm::View<reco::Photon>::const_iterator itPhoton = photons->begin(); itPhoton != photons->end(); itPhoton++) {
381  // construct the Photon from the ref -> save ref to original object
382  unsigned int idx = itPhoton - photons->begin();
383  edm::RefToBase<reco::Photon> photonRef = photons->refAt(idx);
384  edm::Ptr<reco::Photon> photonPtr = photons->ptrAt(idx);
385  Photon aPhoton(photonRef);
386  auto phoPtr = photons->ptrAt(idx);
387  if (embedSuperCluster_)
388  aPhoton.embedSuperCluster();
389  if (embedSeedCluster_)
390  aPhoton.embedSeedCluster();
392  aPhoton.embedBasicClusters();
394  aPhoton.embedPreshowerClusters();
395 
396  std::vector<DetId> selectedCells;
397  bool barrel = itPhoton->isEB();
398  //loop over sub clusters
399  if (embedBasicClusters_) {
400  for (reco::CaloCluster_iterator clusIt = itPhoton->superCluster()->clustersBegin();
401  clusIt != itPhoton->superCluster()->clustersEnd();
402  ++clusIt) {
403  //get seed (max energy xtal)
404  DetId seed = lazyTools.getMaximum(**clusIt).first;
405  //get all xtals in 5x5 window around the seed
406  std::vector<DetId> dets5x5 =
409  selectedCells.insert(selectedCells.end(), dets5x5.begin(), dets5x5.end());
410 
411  //get all xtals belonging to cluster
412  for (const std::pair<DetId, float>& hit : (*clusIt)->hitsAndFractions()) {
413  selectedCells.push_back(hit.first);
414  }
415  }
416  }
417 
418  //remove duplicates
419  std::sort(selectedCells.begin(), selectedCells.end());
420  std::unique(selectedCells.begin(), selectedCells.end());
421 
422  // Retrieve the corresponding RecHits
423 
424  edm::Handle<EcalRecHitCollection> recHitsEBHandle;
425  iEvent.getByToken(reducedBarrelRecHitCollectionToken_, recHitsEBHandle);
426  edm::Handle<EcalRecHitCollection> recHitsEEHandle;
427  iEvent.getByToken(reducedEndcapRecHitCollectionToken_, recHitsEEHandle);
428 
429  //orginal code would throw an exception via the handle not being valid but now it'll just have a null pointer error
430  //should have little effect, if its not barrel or endcap, something very bad has happened elsewhere anyways
431  const EcalRecHitCollection* recHits = nullptr;
432  if (photonRef->superCluster()->seed()->hitsAndFractions().at(0).first.subdetId() == EcalBarrel)
433  recHits = recHitsEBHandle.product();
434  else if (photonRef->superCluster()->seed()->hitsAndFractions().at(0).first.subdetId() == EcalEndcap)
435  recHits = recHitsEEHandle.product();
436 
437  EcalRecHitCollection selectedRecHits;
438 
439  unsigned nSelectedCells = selectedCells.size();
440  for (unsigned icell = 0; icell < nSelectedCells; ++icell) {
441  EcalRecHitCollection::const_iterator it = recHits->find(selectedCells[icell]);
442  if (it != recHits->end()) {
443  selectedRecHits.push_back(*it);
444  }
445  }
446  selectedRecHits.sort();
447  if (embedRecHits_)
448  aPhoton.embedRecHits(&selectedRecHits);
449 
450  // store the match to the generated final state muons
451  if (addGenMatch_) {
452  for (size_t i = 0, n = genMatches.size(); i < n; ++i) {
453  reco::GenParticleRef genPhoton = (*genMatches[i])[photonRef];
454  aPhoton.addGenParticleRef(genPhoton);
455  }
456  if (embedGenMatch_)
457  aPhoton.embedGenParticle();
458  }
459 
460  if (efficiencyLoader_.enabled()) {
461  efficiencyLoader_.setEfficiencies(aPhoton, photonRef);
462  }
463 
464  if (resolutionLoader_.enabled()) {
466  }
467 
468  // here comes the extra functionality
469  if (isolator_.enabled()) {
471  typedef pat::helper::MultiIsolator::IsolationValuePairs IsolationValuePairs;
472  // better to loop backwards, so the vector is resized less times
473  for (IsolationValuePairs::const_reverse_iterator it = isolatorTmpStorage_.rbegin(),
474  ed = isolatorTmpStorage_.rend();
475  it != ed;
476  ++it) {
477  aPhoton.setIsolation(it->first, it->second);
478  }
479  }
480 
481  for (size_t j = 0, nd = deposits.size(); j < nd; ++j) {
482  aPhoton.setIsoDeposit(isoDepositLabels_[j].first, (*deposits[j])[photonRef]);
483  }
484 
485  for (size_t j = 0; j < isolationValues.size(); ++j) {
486  aPhoton.setIsolation(isolationValueLabels_[j].first, (*isolationValues[j])[photonRef]);
487  }
488 
489  // add photon ID info
490  if (addPhotonID_) {
491  for (size_t i = 0; i < photIDSrcs_.size(); ++i) {
492  ids[i].second = (*idhandles[i])[photonRef];
493  }
494  aPhoton.setPhotonIDs(ids);
495  }
496 
497  if (useUserData_) {
498  userDataHelper_.add(aPhoton, iEvent, iSetup);
499  }
500 
501  // set conversion veto selection
502  bool passelectronveto = false;
503  if (hConversions.isValid()) {
504  // this is recommended method
505  passelectronveto = !ConversionTools::hasMatchedPromptElectron(
506  photonRef->superCluster(), *hElectrons, *hConversions, beamSpotHandle->position());
507  }
508  aPhoton.setPassElectronVeto(passelectronveto);
509 
510  // set electron veto using pixel seed (not recommended but many analysis groups are still using since it is powerful method to remove electrons)
511  aPhoton.setHasPixelSeed(photonRef->hasPixelSeed());
512 
513  // set seed energy
514  aPhoton.setSeedEnergy(photonRef->superCluster()->seed()->energy());
515 
516  // set input variables for regression energy correction
517  if (saveRegressionData_) {
518  EcalRegressionData ecalRegData;
519  ecalRegData.fill(*(photonRef->superCluster()),
520  recHitsEBHandle.product(),
521  recHitsEEHandle.product(),
524  -1);
525 
526  aPhoton.setEMax(ecalRegData.eMax());
527  aPhoton.setE2nd(ecalRegData.e2nd());
528  aPhoton.setE3x3(ecalRegData.e3x3());
529  aPhoton.setETop(ecalRegData.eTop());
530  aPhoton.setEBottom(ecalRegData.eBottom());
531  aPhoton.setELeft(ecalRegData.eLeft());
532  aPhoton.setERight(ecalRegData.eRight());
533  aPhoton.setSee(ecalRegData.sigmaIEtaIEta());
534  aPhoton.setSep(
535  ecalRegData.sigmaIEtaIPhi() * ecalRegData.sigmaIEtaIEta() *
536  ecalRegData
537  .sigmaIPhiIPhi()); //there is a conflict on what sigmaIEtaIPhi actually is, regression and ID have it differently, this may change in later releases
538  aPhoton.setSpp(ecalRegData.sigmaIPhiIPhi());
539 
540  aPhoton.setMaxDR(ecalRegData.maxSubClusDR());
541  aPhoton.setMaxDRDPhi(ecalRegData.maxSubClusDRDPhi());
542  aPhoton.setMaxDRDEta(ecalRegData.maxSubClusDRDEta());
543  aPhoton.setMaxDRRawEnergy(ecalRegData.maxSubClusDRRawEnergy());
544  aPhoton.setSubClusRawE1(ecalRegData.subClusRawEnergy(EcalRegressionData::SubClusNr::C1));
545  aPhoton.setSubClusRawE2(ecalRegData.subClusRawEnergy(EcalRegressionData::SubClusNr::C2));
546  aPhoton.setSubClusRawE3(ecalRegData.subClusRawEnergy(EcalRegressionData::SubClusNr::C3));
547  aPhoton.setSubClusDPhi1(ecalRegData.subClusDPhi(EcalRegressionData::SubClusNr::C1));
548  aPhoton.setSubClusDPhi2(ecalRegData.subClusDPhi(EcalRegressionData::SubClusNr::C2));
549  aPhoton.setSubClusDPhi3(ecalRegData.subClusDPhi(EcalRegressionData::SubClusNr::C3));
550  aPhoton.setSubClusDEta1(ecalRegData.subClusDEta(EcalRegressionData::SubClusNr::C1));
551  aPhoton.setSubClusDEta2(ecalRegData.subClusDEta(EcalRegressionData::SubClusNr::C2));
552  aPhoton.setSubClusDEta3(ecalRegData.subClusDEta(EcalRegressionData::SubClusNr::C3));
553 
554  aPhoton.setCryPhi(ecalRegData.seedCrysPhiOrY());
555  aPhoton.setCryEta(ecalRegData.seedCrysEtaOrX());
556  aPhoton.setIEta(ecalRegData.seedCrysIEtaOrIX());
557  aPhoton.setIPhi(ecalRegData.seedCrysIPhiOrIY());
558  } else {
559  aPhoton.setEMax(0);
560  aPhoton.setE2nd(0);
561  aPhoton.setE3x3(0);
562  aPhoton.setETop(0);
563  aPhoton.setEBottom(0);
564  aPhoton.setELeft(0);
565  aPhoton.setERight(0);
566  aPhoton.setSee(0);
567  aPhoton.setSep(0);
568  aPhoton.setSpp(0);
569 
570  aPhoton.setMaxDR(0);
571  aPhoton.setMaxDRDPhi(0);
572  aPhoton.setMaxDRDEta(0);
573  aPhoton.setMaxDRRawEnergy(0);
574  aPhoton.setSubClusRawE1(0);
575  aPhoton.setSubClusRawE2(0);
576  aPhoton.setSubClusRawE3(0);
577  aPhoton.setSubClusDPhi1(0);
578  aPhoton.setSubClusDPhi2(0);
579  aPhoton.setSubClusDPhi3(0);
580  aPhoton.setSubClusDEta1(0);
581  aPhoton.setSubClusDEta2(0);
582  aPhoton.setSubClusDEta3(0);
583 
584  aPhoton.setCryPhi(0);
585  aPhoton.setCryEta(0);
586  aPhoton.setIEta(0);
587  aPhoton.setIPhi(0);
588  }
589 
590  if (addPuppiIsolation_)
591  aPhoton.setIsolationPUPPI((*PUPPIIsolation_charged_hadrons)[phoPtr],
592  (*PUPPIIsolation_neutral_hadrons)[phoPtr],
593  (*PUPPIIsolation_photons)[phoPtr]);
594  else
595  aPhoton.setIsolationPUPPI(-999., -999., -999.);
596 
597  // Get PFCluster Isolation
598  if (addPFClusterIso_) {
599  reco::Photon::PflowIsolationVariables newPFIsol = aPhoton.getPflowIsolationVariables();
600  edm::Handle<edm::ValueMap<float>> ecalPFClusterIsoMapH;
601  iEvent.getByToken(ecalPFClusterIsoT_, ecalPFClusterIsoMapH);
602  newPFIsol.sumEcalClusterEt = (*ecalPFClusterIsoMapH)[photonRef];
603  edm::Handle<edm::ValueMap<float>> hcalPFClusterIsoMapH;
605  iEvent.getByToken(hcalPFClusterIsoT_, hcalPFClusterIsoMapH);
606  newPFIsol.sumHcalClusterEt = (*hcalPFClusterIsoMapH)[photonRef];
607  } else {
608  newPFIsol.sumHcalClusterEt = -999.;
609  }
610  aPhoton.setPflowIsolationVariables(newPFIsol);
611  }
612 
613  // add the Photon to the vector of Photons
614  PATPhotons->push_back(aPhoton);
615  }
616 
617  // sort Photons in ET
618  std::sort(PATPhotons->begin(), PATPhotons->end(), eTComparator_);
619 
620  // put genEvt object in Event
621  std::unique_ptr<std::vector<Photon>> myPhotons(PATPhotons);
622  iEvent.put(std::move(myPhotons));
623  if (isolator_.enabled())
625 }
float maxSubClusDRDEta() const
bool hasPixelSeed() const
Bool flagging photons having a non-zero size vector of Ref to electornPixel seeds.
Definition: Photon.h:79
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.
float seedCrysPhiOrY() const
pat::PATUserDataHelper< pat::Photon > userDataHelper_
Definition: Photon.py:1
edm::EDGetTokenT< EcalRecHitCollection > reducedEndcapRecHitCollectionToken_
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
float maxSubClusDRDPhi() const
bool enabled() const
True if it has a non null configuration.
Definition: MultiIsolator.h:55
std::vector< edm::Handle< edm::ValueMap< IsoDeposit > > > IsoDepositMaps
const Point & position() const
position
Definition: BeamSpot.h:59
float seedCrysIPhiOrIY() const
void setEfficiencies(pat::PATObject< T > &obj, const R &originalRef) const
Sets the efficiencies for this object, using the reference to the original objects.
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)
size_type size() const
float maxSubClusDRRawEnergy() const
static bool hasMatchedPromptElectron(const reco::SuperClusterRef &sc, const reco::GsfElectronCollection &eleCol, const reco::ConversionCollection &convCol, const math::XYZPoint &beamspot, bool allowCkfMatch=true, float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=0)
edm::EDGetTokenT< reco::BeamSpot > beamLineToken_
T const * product() const
Definition: Handle.h:70
constexpr bool isUninitialized() const noexcept
Definition: EDGetToken.h:104
edm::EDGetTokenT< edm::View< reco::Photon > > photonToken_
std::vector< EcalRecHit >::const_iterator const_iterator
edm::EDGetTokenT< edm::ValueMap< float > > ecalPFClusterIsoT_
void push_back(T const &t)
std::vector< edm::EDGetTokenT< edm::Association< reco::GenParticleCollection > > > genMatchTokens_
float seedCrysEtaOrX() const
pat::helper::KinResolutionsLoader resolutionLoader_
edm::EDGetTokenT< edm::ValueMap< float > > hcalPFClusterIsoT_
GreaterByEt< Photon > eTComparator_
void setResolutions(pat::PATObject< T > &obj) const
Sets the efficiencies for this object, using the reference to the original objects.
const CaloGeometry * ecalGeometry_
float seedCrysIEtaOrIX() const
void fill(const edm::View< T > &coll, int idx, IsolationValuePairs &isolations) const
Definition: MultiIsolator.h:84
IsolationLabels isoDepositLabels_
const std::vector< float > & subClusDEta() const
ESData get(edm::EventSetup const &eventSetup) const
pat::helper::MultiIsolator::IsolationValuePairs isolatorTmpStorage_
int iEvent
Definition: GenABIO.cc:224
const std::vector< float > & subClusDPhi() const
void beginEvent(const edm::Event &event, const edm::EventSetup &eventSetup)
const CaloTopology * ecalTopology_
reco::SuperClusterRef superCluster() const override
Ref to SuperCluster.
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.
def unique(seq, keepstr=True)
Definition: tier0.py:24
bool enabled() const
&#39;true&#39; if this there is at least one efficiency configured
edm::EDGetTokenT< edm::ValueMap< float > > PUPPIIsolation_photons_
virtual std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
std::vector< NameTag > photIDSrcs_
pat::helper::MultiIsolator isolator_
void add(ObjectType &patObject, edm::Event const &iEvent, edm::EventSetup const &iSetup)
float sigmaIEtaIEta() const
Definition: DetId.h:17
std::vector< std::pair< pat::IsolationKeys, float > > IsolationValuePairs
Definition: MultiIsolator.h:17
float sigmaIEtaIPhi() const
edm::EDGetTokenT< edm::ValueMap< float > > PUPPIIsolation_charged_hadrons_
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
Definition: CaloTopology.cc:17
float maxSubClusDR() const
bool isValid() const
Definition: HandleBase.h:70
const EcalClusterLazyTools::ESGetTokens ecalClusterToolsESGetTokens_
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
const edm::ESGetToken< CaloTopology, CaloTopologyRecord > ecalTopologyToken_
edm::EDGetTokenT< edm::ValueMap< float > > PUPPIIsolation_neutral_hadrons_
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > ecalGeometryToken_
edm::EDGetTokenT< EcalRecHitCollection > reducedBarrelRecHitCollectionToken_
std::vector< edm::EDGetTokenT< edm::ValueMap< double > > > isolationValueTokens_
std::vector< edm::Handle< edm::ValueMap< double > > > IsolationValueMaps
const std::vector< float > & subClusRawEnergy() const
def move(src, dest)
Definition: eostools.py:511
edm::EDGetTokenT< reco::ConversionCollection > hConversionsToken_
edm::EDGetTokenT< reco::GsfElectronCollection > electronToken_

◆ readIsolationLabels()

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 141 of file PATPhotonProducer.cc.

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

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

Member Data Documentation

◆ addEfficiencies_

bool pat::PATPhotonProducer::addEfficiencies_
private

Definition at line 111 of file PATPhotonProducer.cc.

◆ addGenMatch_

bool pat::PATPhotonProducer::addGenMatch_
private

Definition at line 83 of file PATPhotonProducer.cc.

Referenced by produce().

◆ addPFClusterIso_

bool pat::PATPhotonProducer::addPFClusterIso_
private

Definition at line 78 of file PATPhotonProducer.cc.

Referenced by produce().

◆ addPhotonID_

bool pat::PATPhotonProducer::addPhotonID_
private

Definition at line 117 of file PATPhotonProducer.cc.

Referenced by produce().

◆ addPuppiIsolation_

bool pat::PATPhotonProducer::addPuppiIsolation_
private

Definition at line 79 of file PATPhotonProducer.cc.

Referenced by produce().

◆ addResolutions_

bool pat::PATPhotonProducer::addResolutions_
private

Definition at line 114 of file PATPhotonProducer.cc.

◆ beamLineToken_

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

Definition at line 63 of file PATPhotonProducer.cc.

Referenced by produce().

◆ ecalClusterToolsESGetTokens_

const EcalClusterLazyTools::ESGetTokens pat::PATPhotonProducer::ecalClusterToolsESGetTokens_
private

Definition at line 76 of file PATPhotonProducer.cc.

Referenced by produce().

◆ ecalGeometry_

const CaloGeometry* pat::PATPhotonProducer::ecalGeometry_
private

Definition at line 130 of file PATPhotonProducer.cc.

Referenced by produce().

◆ ecalGeometryToken_

const edm::ESGetToken<CaloGeometry, CaloGeometryRecord> pat::PATPhotonProducer::ecalGeometryToken_
private

Definition at line 135 of file PATPhotonProducer.cc.

Referenced by produce().

◆ ecalPFClusterIsoT_

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

Definition at line 80 of file PATPhotonProducer.cc.

Referenced by produce().

◆ ecalTopology_

const CaloTopology* pat::PATPhotonProducer::ecalTopology_
private

Definition at line 129 of file PATPhotonProducer.cc.

Referenced by produce().

◆ ecalTopologyToken_

const edm::ESGetToken<CaloTopology, CaloTopologyRecord> pat::PATPhotonProducer::ecalTopologyToken_
private

Definition at line 134 of file PATPhotonProducer.cc.

Referenced by produce().

◆ efficiencyLoader_

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

Definition at line 112 of file PATPhotonProducer.cc.

Referenced by produce().

◆ electronToken_

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

Definition at line 61 of file PATPhotonProducer.cc.

Referenced by produce().

◆ embedBasicClusters_

bool pat::PATPhotonProducer::embedBasicClusters_
private

Definition at line 67 of file PATPhotonProducer.cc.

Referenced by produce().

◆ embedGenMatch_

bool pat::PATPhotonProducer::embedGenMatch_
private

Definition at line 84 of file PATPhotonProducer.cc.

Referenced by produce().

◆ embedPreshowerClusters_

bool pat::PATPhotonProducer::embedPreshowerClusters_
private

Definition at line 68 of file PATPhotonProducer.cc.

Referenced by produce().

◆ embedRecHits_

bool pat::PATPhotonProducer::embedRecHits_
private

Definition at line 69 of file PATPhotonProducer.cc.

Referenced by produce().

◆ embedSeedCluster_

bool pat::PATPhotonProducer::embedSeedCluster_
private

Definition at line 66 of file PATPhotonProducer.cc.

Referenced by produce().

◆ embedSuperCluster_

bool pat::PATPhotonProducer::embedSuperCluster_
private

Definition at line 65 of file PATPhotonProducer.cc.

Referenced by produce().

◆ eTComparator_

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

Definition at line 88 of file PATPhotonProducer.cc.

Referenced by produce().

◆ genMatchTokens_

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

Definition at line 85 of file PATPhotonProducer.cc.

Referenced by produce().

◆ hcalPFClusterIsoT_

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

Definition at line 81 of file PATPhotonProducer.cc.

Referenced by produce().

◆ hConversionsToken_

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

Definition at line 62 of file PATPhotonProducer.cc.

Referenced by produce().

◆ isoDepositLabels_

IsolationLabels pat::PATPhotonProducer::isoDepositLabels_
private

Definition at line 100 of file PATPhotonProducer.cc.

Referenced by produce().

◆ isoDepositTokens_

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

Definition at line 97 of file PATPhotonProducer.cc.

Referenced by produce().

◆ isolationValueLabels_

IsolationLabels pat::PATPhotonProducer::isolationValueLabels_
private

Definition at line 101 of file PATPhotonProducer.cc.

Referenced by produce().

◆ isolationValueTokens_

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

Definition at line 98 of file PATPhotonProducer.cc.

Referenced by produce().

◆ isolator_

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

Definition at line 95 of file PATPhotonProducer.cc.

Referenced by produce().

◆ isolatorTmpStorage_

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

Definition at line 96 of file PATPhotonProducer.cc.

Referenced by produce().

◆ photIDSrcs_

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

Definition at line 119 of file PATPhotonProducer.cc.

Referenced by produce().

◆ photIDTokens_

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

Definition at line 120 of file PATPhotonProducer.cc.

Referenced by produce().

◆ photonToken_

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

Definition at line 60 of file PATPhotonProducer.cc.

Referenced by produce().

◆ PUPPIIsolation_charged_hadrons_

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

Definition at line 124 of file PATPhotonProducer.cc.

Referenced by produce().

◆ PUPPIIsolation_neutral_hadrons_

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

Definition at line 125 of file PATPhotonProducer.cc.

Referenced by produce().

◆ PUPPIIsolation_photons_

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

Definition at line 126 of file PATPhotonProducer.cc.

Referenced by produce().

◆ reducedBarrelRecHitCollection_

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

Definition at line 71 of file PATPhotonProducer.cc.

◆ reducedBarrelRecHitCollectionToken_

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

Definition at line 72 of file PATPhotonProducer.cc.

Referenced by produce().

◆ reducedEndcapRecHitCollection_

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

Definition at line 73 of file PATPhotonProducer.cc.

◆ reducedEndcapRecHitCollectionToken_

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

Definition at line 74 of file PATPhotonProducer.cc.

Referenced by produce().

◆ resolutionLoader_

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

Definition at line 115 of file PATPhotonProducer.cc.

Referenced by produce().

◆ saveRegressionData_

bool pat::PATPhotonProducer::saveRegressionData_
private

Definition at line 132 of file PATPhotonProducer.cc.

Referenced by produce().

◆ userDataHelper_

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

Definition at line 127 of file PATPhotonProducer.cc.

Referenced by produce().

◆ useUserData_

bool pat::PATPhotonProducer::useUserData_
private

Definition at line 122 of file PATPhotonProducer.cc.

Referenced by produce().