CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
EgammaIsoESDetIdCollectionProducer Class Reference
Inheritance diagram for EgammaIsoESDetIdCollectionProducer:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 EgammaIsoESDetIdCollectionProducer (const edm::ParameterSet &)
 ctor More...
 
void produce (edm::StreamID, edm::Event &, const edm::EventSetup &) const override
 producer More...
 
- Public Member Functions inherited from edm::global::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
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void addDetIds (const reco::SuperCluster &superClus, reco::PFClusterCollection clusters, const reco::PFCluster::EEtoPSAssociation &eeClusToESMap, std::vector< DetId > &detIdsToStore) const
 

Private Attributes

edm::EDGetTokenT< reco::PFClusterCollectionecalPFClustersToken_
 
edm::EDGetTokenT< reco::PFCluster::EEtoPSAssociationeeClusToESMapToken_
 
edm::EDGetTokenT< reco::GsfElectronCollectionelesToken_
 
std::string interestingDetIdCollection_
 
float maxDR_
 
float minEleEt_
 
float minPhoEt_
 
float minSCEt_
 
edm::EDGetTokenT< reco::PhotonCollectionphosToken_
 
edm::EDGetTokenT< reco::SuperClusterCollectionsuperClustersToken_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

author: Sam Harper (inspired by InterestingDetIdProducer)

Make a collection of detids to be kept in a AOD rechit collection These are all the ES DetIds of ES PFClusters associated to all PF clusters within dR of ele/pho/sc The aim is to save enough preshower info in the AOD to remake the PF clusters near an ele/pho/sc

Definition at line 31 of file EgammaIsoESDetIdCollectionProducer.cc.

Constructor & Destructor Documentation

◆ EgammaIsoESDetIdCollectionProducer()

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

ctor

Definition at line 63 of file EgammaIsoESDetIdCollectionProducer.cc.

References edm::EDConsumerBase::consumes(), and edm::ParameterSet::getParameter().

64  : eeClusToESMapToken_{consumes(iConfig.getParameter<edm::InputTag>("eeClusToESMapLabel"))},
65  ecalPFClustersToken_{consumes(iConfig.getParameter<edm::InputTag>("ecalPFClustersLabel"))},
66  superClustersToken_{consumes(iConfig.getParameter<edm::InputTag>("superClustersLabel"))},
67  elesToken_{consumes(iConfig.getParameter<edm::InputTag>("elesLabel"))},
68  phosToken_{consumes(iConfig.getParameter<edm::InputTag>("phosLabel"))} {
69  minSCEt_ = iConfig.getParameter<double>("minSCEt");
70  minEleEt_ = iConfig.getParameter<double>("minEleEt");
71  minPhoEt_ = iConfig.getParameter<double>("minPhoEt");
72 
73  interestingDetIdCollection_ = iConfig.getParameter<std::string>("interestingDetIdCollection");
74 
75  maxDR_ = iConfig.getParameter<double>("maxDR");
76 
77  //register your products
78  produces<DetIdCollection>(interestingDetIdCollection_);
79 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::EDGetTokenT< reco::GsfElectronCollection > elesToken_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< reco::PFCluster::EEtoPSAssociation > eeClusToESMapToken_
edm::EDGetTokenT< reco::PFClusterCollection > ecalPFClustersToken_
edm::EDGetTokenT< reco::PhotonCollection > phosToken_
edm::EDGetTokenT< reco::SuperClusterCollection > superClustersToken_

Member Function Documentation

◆ addDetIds()

void EgammaIsoESDetIdCollectionProducer::addDetIds ( const reco::SuperCluster superClus,
reco::PFClusterCollection  clusters,
const reco::PFCluster::EEtoPSAssociation eeClusToESMap,
std::vector< DetId > &  detIdsToStore 
) const
private

Definition at line 125 of file EgammaIsoESDetIdCollectionProducer.cc.

References bsc_activity_cfg::clusters, reco::deltaR2(), PFLayer::ECAL_ENDCAP, reco::CaloCluster::eta(), reco::PFCluster::layer(), maxDR_, and reco::CaloCluster::phi().

Referenced by produce().

128  {
129  const float scEta = superClus.eta();
130  // if(std::abs(scEta)+maxDR_<1.5) return; //not possible to have a endcap cluster, let alone one with preshower (eta>1.65) so exit without checking further
131  const float scPhi = superClus.phi();
132 
133  const float maxDR2 = maxDR_ * maxDR_;
134 
135  for (size_t clusNr = 0; clusNr < clusters.size(); clusNr++) {
136  const reco::PFCluster& clus = clusters[clusNr];
137  if (clus.layer() == PFLayer::ECAL_ENDCAP && reco::deltaR2(scEta, scPhi, clus.eta(), clus.phi()) < maxDR2) {
138  auto keyVal = std::make_pair(clusNr, edm::Ptr<reco::PFCluster>());
139  const auto esClusters = std::equal_range(
140  eeClusToESMap.begin(),
141  eeClusToESMap.end(),
142  keyVal,
143  [](const reco::PFCluster::EEtoPSAssociation::value_type& rhs, //roll on c++14, auto & lambda 4 evar!
144  const reco::PFCluster::EEtoPSAssociation::value_type& lhs) -> bool { return rhs.first < lhs.first; });
145  // std::cout <<"cluster "<<clus.eta()<<" had "<<std::distance(esClusters.first,esClusters.second)<<" es clusters"<<std::endl;
146  for (auto esIt = esClusters.first; esIt != esClusters.second; ++esIt) {
147  // std::cout <<"es clus "<<esIt->second->hitsAndFractions().size()<<std::endl;
148  for (const auto& hitAndFrac : esIt->second->hitsAndFractions()) {
149  detIdsToStore.push_back(hitAndFrac.first);
150  }
151  }
152 
153  } //end of endcap & dR check
154  } //end of cluster loop
155 }
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
Definition: PFCluster.h:42
PFLayer::Layer layer() const
cluster layer, see PFLayer.h in this directory
Definition: PFCluster.cc:56
double phi() const
azimuthal angle of cluster centroid
Definition: CaloCluster.h:184
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
double eta() const
pseudorapidity of cluster centroid
Definition: CaloCluster.h:181

◆ produce()

void EgammaIsoESDetIdCollectionProducer::produce ( edm::StreamID  ,
edm::Event iEvent,
const edm::EventSetup  
) const
overridevirtual

producer

Implements edm::global::EDProducerBase.

Definition at line 82 of file EgammaIsoESDetIdCollectionProducer.cc.

References addDetIds(), ecalPFClustersToken_, eeClusToESMapToken_, hltEgammaEleL1TrkIsoL1Seeded_cfi::eles, elesToken_, iEvent, interestingDetIdCollection_, minEleEt_, minPhoEt_, minSCEt_, eostools::move(), phosToken_, funct::sin(), jetUpdater_cfi::sort, HLT_2022v12_cff::superClusters, superClustersToken_, and tier0::unique().

82  {
83  auto superClusters = iEvent.getHandle(superClustersToken_);
84  auto eles = iEvent.getHandle(elesToken_);
85  auto phos = iEvent.getHandle(phosToken_);
86  auto eeClusToESMap = iEvent.getHandle(eeClusToESMapToken_);
87  auto ecalPFClusters = iEvent.getHandle(ecalPFClustersToken_);
88 
89  //Create empty output collections
90  std::vector<DetId> indexToStore;
91  indexToStore.reserve(100);
92 
93  if (eles.isValid() && eeClusToESMap.isValid() && ecalPFClusters.isValid()) {
94  for (auto& ele : *eles) {
95  float scEt = ele.superCluster()->energy() * std::sin(ele.superCluster()->position().theta());
96  if (scEt > minEleEt_ || ele.et() > minEleEt_)
97  addDetIds(*ele.superCluster(), *ecalPFClusters, *eeClusToESMap, indexToStore);
98  }
99  }
100  if (phos.isValid() && eeClusToESMap.isValid() && ecalPFClusters.isValid()) {
101  for (auto& pho : *phos) {
102  float scEt = pho.superCluster()->energy() * std::sin(pho.superCluster()->position().theta());
103  if (scEt > minPhoEt_ || pho.et() > minPhoEt_)
104  addDetIds(*pho.superCluster(), *ecalPFClusters, *eeClusToESMap, indexToStore);
105  }
106  }
107  if (superClusters.isValid() && eeClusToESMap.isValid() && ecalPFClusters.isValid()) {
108  for (auto& sc : *superClusters) {
109  float scEt = sc.energy() * std::sin(sc.position().theta());
110  if (scEt > minSCEt_)
111  addDetIds(sc, *ecalPFClusters, *eeClusToESMap, indexToStore);
112  }
113  }
114 
115  //unify the vector
116  std::sort(indexToStore.begin(), indexToStore.end());
117  std::unique(indexToStore.begin(), indexToStore.end());
118 
119  auto detIdCollection = std::make_unique<DetIdCollection>(indexToStore);
120 
121  iEvent.put(std::move(detIdCollection), interestingDetIdCollection_);
122 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
edm::EDGetTokenT< reco::GsfElectronCollection > elesToken_
edm::EDGetTokenT< reco::PFCluster::EEtoPSAssociation > eeClusToESMapToken_
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< reco::PFClusterCollection > ecalPFClustersToken_
def unique(seq, keepstr=True)
Definition: tier0.py:24
edm::EDGetTokenT< reco::PhotonCollection > phosToken_
void addDetIds(const reco::SuperCluster &superClus, reco::PFClusterCollection clusters, const reco::PFCluster::EEtoPSAssociation &eeClusToESMap, std::vector< DetId > &detIdsToStore) const
edm::EDGetTokenT< reco::SuperClusterCollection > superClustersToken_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ ecalPFClustersToken_

edm::EDGetTokenT<reco::PFClusterCollection> EgammaIsoESDetIdCollectionProducer::ecalPFClustersToken_
private

Definition at line 46 of file EgammaIsoESDetIdCollectionProducer.cc.

Referenced by produce().

◆ eeClusToESMapToken_

edm::EDGetTokenT<reco::PFCluster::EEtoPSAssociation> EgammaIsoESDetIdCollectionProducer::eeClusToESMapToken_
private

Definition at line 45 of file EgammaIsoESDetIdCollectionProducer.cc.

Referenced by produce().

◆ elesToken_

edm::EDGetTokenT<reco::GsfElectronCollection> EgammaIsoESDetIdCollectionProducer::elesToken_
private

Definition at line 48 of file EgammaIsoESDetIdCollectionProducer.cc.

Referenced by produce().

◆ interestingDetIdCollection_

std::string EgammaIsoESDetIdCollectionProducer::interestingDetIdCollection_
private

Definition at line 51 of file EgammaIsoESDetIdCollectionProducer.cc.

Referenced by produce().

◆ maxDR_

float EgammaIsoESDetIdCollectionProducer::maxDR_
private

Definition at line 57 of file EgammaIsoESDetIdCollectionProducer.cc.

Referenced by addDetIds().

◆ minEleEt_

float EgammaIsoESDetIdCollectionProducer::minEleEt_
private

Definition at line 54 of file EgammaIsoESDetIdCollectionProducer.cc.

Referenced by produce().

◆ minPhoEt_

float EgammaIsoESDetIdCollectionProducer::minPhoEt_
private

Definition at line 55 of file EgammaIsoESDetIdCollectionProducer.cc.

Referenced by produce().

◆ minSCEt_

float EgammaIsoESDetIdCollectionProducer::minSCEt_
private

Definition at line 53 of file EgammaIsoESDetIdCollectionProducer.cc.

Referenced by produce().

◆ phosToken_

edm::EDGetTokenT<reco::PhotonCollection> EgammaIsoESDetIdCollectionProducer::phosToken_
private

Definition at line 49 of file EgammaIsoESDetIdCollectionProducer.cc.

Referenced by produce().

◆ superClustersToken_

edm::EDGetTokenT<reco::SuperClusterCollection> EgammaIsoESDetIdCollectionProducer::superClustersToken_
private

Definition at line 47 of file EgammaIsoESDetIdCollectionProducer.cc.

Referenced by produce().