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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
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<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
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)
 
template<Transition B>
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 (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

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.

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 }

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

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.

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 }

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

Referenced by produce().

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

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 }

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

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

reco::CaloCluster::phi
double phi() const
azimuthal angle of cluster centroid
Definition: CaloCluster.h:184
EgammaIsoESDetIdCollectionProducer::maxDR_
float maxDR_
Definition: EgammaIsoESDetIdCollectionProducer.cc:57
reco::PFCluster::layer
PFLayer::Layer layer() const
cluster layer, see PFLayer.h in this directory
Definition: PFCluster.cc:56
EgammaIsoESDetIdCollectionProducer::phosToken_
edm::EDGetTokenT< reco::PhotonCollection > phosToken_
Definition: EgammaIsoESDetIdCollectionProducer.cc:49
HLT_FULL_cff.superClusters
superClusters
Definition: HLT_FULL_cff.py:15191
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
EgammaIsoESDetIdCollectionProducer::addDetIds
void addDetIds(const reco::SuperCluster &superClus, reco::PFClusterCollection clusters, const reco::PFCluster::EEtoPSAssociation &eeClusToESMap, std::vector< DetId > &detIdsToStore) const
Definition: EgammaIsoESDetIdCollectionProducer.cc:125
EgammaIsoESDetIdCollectionProducer::superClustersToken_
edm::EDGetTokenT< reco::SuperClusterCollection > superClustersToken_
Definition: EgammaIsoESDetIdCollectionProducer.cc:47
EgammaIsoESDetIdCollectionProducer::interestingDetIdCollection_
std::string interestingDetIdCollection_
Definition: EgammaIsoESDetIdCollectionProducer.cc:51
bsc_activity_cfg.clusters
clusters
Definition: bsc_activity_cfg.py:36
reco::CaloCluster::eta
double eta() const
pseudorapidity of cluster centroid
Definition: CaloCluster.h:181
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
reco::deltaR2
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
iEvent
int iEvent
Definition: GenABIO.cc:224
EgammaIsoESDetIdCollectionProducer::minSCEt_
float minSCEt_
Definition: EgammaIsoESDetIdCollectionProducer.cc:53
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition: JetExtendedAssociation.h:30
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::Ptr< reco::PFCluster >
EgammaIsoESDetIdCollectionProducer::minPhoEt_
float minPhoEt_
Definition: EgammaIsoESDetIdCollectionProducer.cc:55
eostools.move
def move(src, dest)
Definition: eostools.py:511
tier0.unique
def unique(seq, keepstr=True)
Definition: tier0.py:24
reco::PFCluster
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
Definition: PFCluster.h:42
EgammaIsoESDetIdCollectionProducer::elesToken_
edm::EDGetTokenT< reco::GsfElectronCollection > elesToken_
Definition: EgammaIsoESDetIdCollectionProducer.cc:48
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
EgammaIsoESDetIdCollectionProducer::minEleEt_
float minEleEt_
Definition: EgammaIsoESDetIdCollectionProducer.cc:54
edm::EDConsumerBase::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: EDConsumerBase.h:159
PFLayer::ECAL_ENDCAP
Definition: PFLayer.h:32
EgammaIsoESDetIdCollectionProducer::eeClusToESMapToken_
edm::EDGetTokenT< reco::PFCluster::EEtoPSAssociation > eeClusToESMapToken_
Definition: EgammaIsoESDetIdCollectionProducer.cc:45
EgammaIsoESDetIdCollectionProducer::ecalPFClustersToken_
edm::EDGetTokenT< reco::PFClusterCollection > ecalPFClustersToken_
Definition: EgammaIsoESDetIdCollectionProducer.cc:46
edm::InputTag
Definition: InputTag.h:15