CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
EgammaIsoESDetIdCollectionProducer Class Reference

#include <EgammaIsoESDetIdCollectionProducer.h>

Inheritance diagram for EgammaIsoESDetIdCollectionProducer:
edm::stream::EDProducer<>

Public Member Functions

void beginRun (edm::Run const &, const edm::EventSetup &) final
 
 EgammaIsoESDetIdCollectionProducer (const edm::ParameterSet &)
 ctor More...
 
void produce (edm::Event &, const edm::EventSetup &) override
 producer More...
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Member Functions

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

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::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

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 39 of file EgammaIsoESDetIdCollectionProducer.h.

Constructor & Destructor Documentation

◆ EgammaIsoESDetIdCollectionProducer()

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

ctor

Definition at line 9 of file EgammaIsoESDetIdCollectionProducer.cc.

9  {
11  consumes<reco::PFCluster::EEtoPSAssociation>(iConfig.getParameter<edm::InputTag>("eeClusToESMapLabel"));
12 
14  consumes<reco::PFClusterCollection>(iConfig.getParameter<edm::InputTag>("ecalPFClustersLabel"));
15  elesToken_ = consumes<reco::GsfElectronCollection>(iConfig.getParameter<edm::InputTag>("elesLabel"));
16 
17  phosToken_ = consumes<reco::PhotonCollection>(iConfig.getParameter<edm::InputTag>("phosLabel"));
18 
20  consumes<reco::SuperClusterCollection>(iConfig.getParameter<edm::InputTag>("superClustersLabel"));
21 
22  minSCEt_ = iConfig.getParameter<double>("minSCEt");
23  minEleEt_ = iConfig.getParameter<double>("minEleEt");
24  minPhoEt_ = iConfig.getParameter<double>("minPhoEt");
25 
26  interestingDetIdCollection_ = iConfig.getParameter<std::string>("interestingDetIdCollection");
27 
28  maxDR_ = iConfig.getParameter<double>("maxDR");
29 
30  //register your products
31  produces<DetIdCollection>(interestingDetIdCollection_);
32 }

References ecalPFClustersToken_, eeClusToESMapToken_, elesToken_, edm::ParameterSet::getParameter(), interestingDetIdCollection_, maxDR_, minEleEt_, minPhoEt_, minSCEt_, phosToken_, AlCaHLTBitMon_QueryRunRegistry::string, and superClustersToken_.

Member Function Documentation

◆ addDetIds()

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

Definition at line 90 of file EgammaIsoESDetIdCollectionProducer.cc.

93  {
94  const float scEta = superClus.eta();
95  // 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
96  const float scPhi = superClus.phi();
97 
98  const float maxDR2 = maxDR_ * maxDR_;
99 
100  for (size_t clusNr = 0; clusNr < clusters.size(); clusNr++) {
101  const reco::PFCluster& clus = clusters[clusNr];
102  if (clus.layer() == PFLayer::ECAL_ENDCAP && reco::deltaR2(scEta, scPhi, clus.eta(), clus.phi()) < maxDR2) {
103  auto keyVal = std::make_pair(clusNr, edm::Ptr<reco::PFCluster>());
104  const auto esClusters = std::equal_range(
105  eeClusToESMap.begin(),
106  eeClusToESMap.end(),
107  keyVal,
108  [](const reco::PFCluster::EEtoPSAssociation::value_type& rhs, //roll on c++14, auto & lambda 4 evar!
109  const reco::PFCluster::EEtoPSAssociation::value_type& lhs) -> bool { return rhs.first < lhs.first; });
110  // std::cout <<"cluster "<<clus.eta()<<" had "<<std::distance(esClusters.first,esClusters.second)<<" es clusters"<<std::endl;
111  for (auto esIt = esClusters.first; esIt != esClusters.second; ++esIt) {
112  // std::cout <<"es clus "<<esIt->second->hitsAndFractions().size()<<std::endl;
113  for (const auto& hitAndFrac : esIt->second->hitsAndFractions()) {
114  detIdsToStore.push_back(hitAndFrac.first);
115  }
116  }
117 
118  } //end of endcap & dR check
119  } //end of cluster loop
120 }

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

Referenced by produce().

◆ beginRun()

void EgammaIsoESDetIdCollectionProducer::beginRun ( edm::Run const &  run,
const edm::EventSetup iSetup 
)
final

Definition at line 34 of file EgammaIsoESDetIdCollectionProducer.cc.

34 {}

◆ produce()

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

producer

Definition at line 37 of file EgammaIsoESDetIdCollectionProducer.cc.

37  {
38  // take BasicClusters
41 
43  iEvent.getByToken(elesToken_, eles);
44 
46  iEvent.getByToken(phosToken_, phos);
47 
49  iEvent.getByToken(eeClusToESMapToken_, eeClusToESMap);
50 
52  iEvent.getByToken(ecalPFClustersToken_, ecalPFClusters);
53 
54  //Create empty output collections
55  std::vector<DetId> indexToStore;
56  indexToStore.reserve(100);
57 
58  if (eles.isValid() && eeClusToESMap.isValid() && ecalPFClusters.isValid()) {
59  for (auto& ele : *eles) {
60  float scEt = ele.superCluster()->energy() * std::sin(ele.superCluster()->position().theta());
61  if (scEt > minEleEt_ || ele.et() > minEleEt_)
62  addDetIds(*ele.superCluster(), *ecalPFClusters, *eeClusToESMap, indexToStore);
63  }
64  }
65  if (phos.isValid() && eeClusToESMap.isValid() && ecalPFClusters.isValid()) {
66  for (auto& pho : *phos) {
67  float scEt = pho.superCluster()->energy() * std::sin(pho.superCluster()->position().theta());
68  if (scEt > minPhoEt_ || pho.et() > minPhoEt_)
69  addDetIds(*pho.superCluster(), *ecalPFClusters, *eeClusToESMap, indexToStore);
70  }
71  }
72  if (superClusters.isValid() && eeClusToESMap.isValid() && ecalPFClusters.isValid()) {
73  for (auto& sc : *superClusters) {
74  float scEt = sc.energy() * std::sin(sc.position().theta());
75  if (scEt > minSCEt_)
76  addDetIds(sc, *ecalPFClusters, *eeClusToESMap, indexToStore);
77  }
78  }
79 
80  //unify the vector
81  std::sort(indexToStore.begin(), indexToStore.end());
82  std::unique(indexToStore.begin(), indexToStore.end());
83 
84  auto detIdCollection = std::make_unique<DetIdCollection>(indexToStore);
85 
86  iEvent.put(std::move(detIdCollection), interestingDetIdCollection_);
87 }

References addDetIds(), ecalPFClustersToken_, eeClusToESMapToken_, hltEgammaEleL1TrkIsoL1Seeded_cfi::eles, elesToken_, iEvent, interestingDetIdCollection_, edm::HandleBase::isValid(), minEleEt_, minPhoEt_, minSCEt_, eostools::move(), phosToken_, funct::sin(), HLT_2018_cff::superClusters, superClustersToken_, and tier0::unique().

Member Data Documentation

◆ ecalPFClustersToken_

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

◆ eeClusToESMapToken_

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

◆ elesToken_

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

◆ interestingDetIdCollection_

std::string EgammaIsoESDetIdCollectionProducer::interestingDetIdCollection_
private

◆ maxDR_

float EgammaIsoESDetIdCollectionProducer::maxDR_
private

◆ minEleEt_

float EgammaIsoESDetIdCollectionProducer::minEleEt_
private

◆ minPhoEt_

float EgammaIsoESDetIdCollectionProducer::minPhoEt_
private

◆ minSCEt_

float EgammaIsoESDetIdCollectionProducer::minSCEt_
private

◆ phosToken_

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

◆ superClustersToken_

edm::EDGetTokenT<reco::SuperClusterCollection> EgammaIsoESDetIdCollectionProducer::superClustersToken_
private
reco::CaloCluster::phi
double phi() const
azimuthal angle of cluster centroid
Definition: CaloCluster.h:184
EgammaIsoESDetIdCollectionProducer::maxDR_
float maxDR_
Definition: EgammaIsoESDetIdCollectionProducer.h:66
reco::PFCluster::layer
PFLayer::Layer layer() const
cluster layer, see PFLayer.h in this directory
Definition: PFCluster.cc:100
EgammaIsoESDetIdCollectionProducer::phosToken_
edm::EDGetTokenT< reco::PhotonCollection > phosToken_
Definition: EgammaIsoESDetIdCollectionProducer.h:58
edm::Handle
Definition: AssociativeIterator.h:50
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)
Definition: EgammaIsoESDetIdCollectionProducer.cc:90
EgammaIsoESDetIdCollectionProducer::superClustersToken_
edm::EDGetTokenT< reco::SuperClusterCollection > superClustersToken_
Definition: EgammaIsoESDetIdCollectionProducer.h:56
EgammaIsoESDetIdCollectionProducer::interestingDetIdCollection_
std::string interestingDetIdCollection_
Definition: EgammaIsoESDetIdCollectionProducer.h:60
hltEgammaEleL1TrkIsoL1Seeded_cfi.eles
eles
Definition: hltEgammaEleL1TrkIsoL1Seeded_cfi.py:5
HLT_2018_cff.superClusters
superClusters
Definition: HLT_2018_cff.py:13791
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
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
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.h:62
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition: JetExtendedAssociation.h:30
edm::Ptr< reco::PFCluster >
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
EgammaIsoESDetIdCollectionProducer::minPhoEt_
float minPhoEt_
Definition: EgammaIsoESDetIdCollectionProducer.h:64
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:46
EgammaIsoESDetIdCollectionProducer::elesToken_
edm::EDGetTokenT< reco::GsfElectronCollection > elesToken_
Definition: EgammaIsoESDetIdCollectionProducer.h:57
EgammaIsoESDetIdCollectionProducer::minEleEt_
float minEleEt_
Definition: EgammaIsoESDetIdCollectionProducer.h:63
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
PFLayer::ECAL_ENDCAP
Definition: PFLayer.h:32
EgammaIsoESDetIdCollectionProducer::eeClusToESMapToken_
edm::EDGetTokenT< reco::PFCluster::EEtoPSAssociation > eeClusToESMapToken_
Definition: EgammaIsoESDetIdCollectionProducer.h:54
EgammaIsoESDetIdCollectionProducer::ecalPFClustersToken_
edm::EDGetTokenT< reco::PFClusterCollection > ecalPFClustersToken_
Definition: EgammaIsoESDetIdCollectionProducer.h:55
edm::InputTag
Definition: InputTag.h:15