CMS 3D CMS Logo

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

#include <EgammaIsoHcalDetIdCollectionProducer.h>

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

Public Member Functions

void beginRun (edm::Run const &, const edm::EventSetup &) final
 
 EgammaIsoHcalDetIdCollectionProducer (const edm::ParameterSet &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Attributes

edm::EDGetTokenT< reco::GsfElectronCollectionelesToken_
 
EGHcalRecHitSelector hcalHitSelector_
 
std::string interestingDetIdCollection_
 
float minEleEt_
 
float minPhoEt_
 
float minSCEt_
 
edm::EDGetTokenT< reco::PhotonCollectionphosToken_
 
edm::EDGetTokenT< HBHERecHitCollectionrecHitsToken_
 
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

Original author: Sam Harper (RAL)

Make a collection of detids to be kept tipically in a AOD rechit collection Modified from the ECAL version "InterestingDetIdCollectionProducer" to be HCAL

Definition at line 43 of file EgammaIsoHcalDetIdCollectionProducer.h.

Constructor & Destructor Documentation

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

Definition at line 9 of file EgammaIsoHcalDetIdCollectionProducer.cc.

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

9  :
10  hcalHitSelector_(iConfig.getParameter<edm::ParameterSet>("hitSelection"))
11 {
12 
13  recHitsToken_ =
14  consumes<HBHERecHitCollection>(iConfig.getParameter< edm::InputTag > ("recHitsLabel"));
15  elesToken_ =
16  consumes<reco::GsfElectronCollection>(iConfig.getParameter< edm::InputTag >("elesLabel"));
17 
18  phosToken_ =
19  consumes<reco::PhotonCollection>(iConfig.getParameter< edm::InputTag >("phosLabel"));
20 
22  consumes<reco::SuperClusterCollection>(iConfig.getParameter< edm::InputTag >("superClustersLabel"));
23 
24  minSCEt_ = iConfig.getParameter<double>("minSCEt");
25  minEleEt_ = iConfig.getParameter<double>("minEleEt");
26  minPhoEt_ = iConfig.getParameter<double>("minPhoEt");
27 
28 
29  interestingDetIdCollection_ = iConfig.getParameter<std::string>("interestingDetIdCollection");
30 
31  //register your products
32  produces< DetIdCollection > (interestingDetIdCollection_) ;
33 }
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::SuperClusterCollection > superClustersToken_
edm::EDGetTokenT< HBHERecHitCollection > recHitsToken_
edm::EDGetTokenT< reco::GsfElectronCollection > elesToken_
edm::EDGetTokenT< reco::PhotonCollection > phosToken_

Member Function Documentation

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

Definition at line 51 of file EgammaIsoHcalDetIdCollectionProducer.cc.

References hcalHitSelector_, and EGHcalRecHitSelector::setup().

52 {
53  hcalHitSelector_.setup(iSetup);
54 }
void setup(const edm::EventSetup &iSetup)
void EgammaIsoHcalDetIdCollectionProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 35 of file EgammaIsoHcalDetIdCollectionProducer.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), EGHcalRecHitSelector::makePSetDescription(), and AlCaHLTBitMon_QueryRunRegistry::string.

36 {
38  desc.add<edm::InputTag>("recHitsLabel",edm::InputTag("hbhereco"));
39  desc.add<edm::InputTag>("elesLabel",edm::InputTag("gedGsfElectrons"));
40  desc.add<edm::InputTag>("phosLabel",edm::InputTag("gedPhotons"));
41  desc.add<edm::InputTag>("superClustersLabel",edm::InputTag("particleFlowEGamma"));
42  desc.add<double>("minSCEt",20);
43  desc.add<double>("minEleEt",20);
44  desc.add<double>("minPhoEt",20);
45  desc.add<std::string>("interestingDetIdCollection","");
47  descriptions.add(("interestingGedEgammaIsoHCALDetId"), desc);
48 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
static edm::ParameterSetDescription makePSetDescription()
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void EgammaIsoHcalDetIdCollectionProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 58 of file EgammaIsoHcalDetIdCollectionProducer.cc.

References EGHcalRecHitSelector::addDetIds(), elesToken_, SimCluster::energy(), edm::Event::getByToken(), hcalHitSelector_, interestingDetIdCollection_, edm::HandleBase::isValid(), minEleEt_, minPhoEt_, minSCEt_, eostools::move(), phosToken_, edm::Event::put(), recHitsToken_, SimDataFormats::CaloAnalysis::sc, funct::sin(), superClustersToken_, SimCluster::theta(), and tier0::unique().

60 {
62  iEvent.getByToken(superClustersToken_, superClusters);
63 
65  iEvent.getByToken(elesToken_,eles);
66 
68  iEvent.getByToken(phosToken_,phos);
69 
71  iEvent.getByToken(recHitsToken_,recHits);
72 
73  std::vector<DetId> indexToStore;
74  indexToStore.reserve(100);
75 
76  if(eles.isValid() && recHits.isValid()){
77  for(auto& ele : *eles){
78  float scEt = ele.superCluster()->energy()*std::sin(ele.superCluster()->position().theta());
79  if(scEt > minEleEt_ || ele.et()> minEleEt_){
80  hcalHitSelector_.addDetIds(*ele.superCluster(),*recHits,indexToStore);
81  }
82  }
83  }
84  if(phos.isValid() && recHits.isValid()){
85  for(auto& pho : *phos){
86  float scEt = pho.superCluster()->energy()*std::sin(pho.superCluster()->position().theta());
87  if(scEt > minPhoEt_ || pho.et()> minPhoEt_){
88  hcalHitSelector_.addDetIds(*pho.superCluster(),*recHits,indexToStore);
89  }
90  }
91  }
92  if(superClusters.isValid() && recHits.isValid()){
93  for(auto& sc : *superClusters){
94  float scEt = sc.energy()*std::sin(sc.position().theta());
95  if(scEt > minSCEt_){
96  hcalHitSelector_.addDetIds(sc,*recHits,indexToStore);
97  }
98  }
99  }
100 
101  //unify the vector
102  std::sort(indexToStore.begin(),indexToStore.end());
103  std::unique(indexToStore.begin(),indexToStore.end());
104 
105  auto detIdCollection = std::make_unique<DetIdCollection>(indexToStore);
106 
107  iEvent.put(std::move(detIdCollection), interestingDetIdCollection_ );
108 
109 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
edm::EDGetTokenT< reco::SuperClusterCollection > superClustersToken_
def unique(seq, keepstr=True)
Definition: tier0.py:25
edm::EDGetTokenT< HBHERecHitCollection > recHitsToken_
float energy() const
Energy. Note this is taken from the first SimTrack only.
Definition: SimCluster.h:104
bool isValid() const
Definition: HandleBase.h:74
float theta() const
Momentum polar angle. Note this is taken from the first SimTrack only.
Definition: SimCluster.h:144
edm::EDGetTokenT< reco::GsfElectronCollection > elesToken_
void addDetIds(const reco::SuperCluster &superClus, const HBHERecHitCollection &recHits, CollType &detIdsToStore) const
edm::EDGetTokenT< reco::PhotonCollection > phosToken_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

edm::EDGetTokenT<reco::GsfElectronCollection> EgammaIsoHcalDetIdCollectionProducer::elesToken_
private
EGHcalRecHitSelector EgammaIsoHcalDetIdCollectionProducer::hcalHitSelector_
private

Definition at line 66 of file EgammaIsoHcalDetIdCollectionProducer.h.

Referenced by beginRun(), and produce().

std::string EgammaIsoHcalDetIdCollectionProducer::interestingDetIdCollection_
private
float EgammaIsoHcalDetIdCollectionProducer::minEleEt_
private
float EgammaIsoHcalDetIdCollectionProducer::minPhoEt_
private
float EgammaIsoHcalDetIdCollectionProducer::minSCEt_
private
edm::EDGetTokenT<reco::PhotonCollection> EgammaIsoHcalDetIdCollectionProducer::phosToken_
private
edm::EDGetTokenT<HBHERecHitCollection> EgammaIsoHcalDetIdCollectionProducer::recHitsToken_
private
edm::EDGetTokenT<reco::SuperClusterCollection> EgammaIsoHcalDetIdCollectionProducer::superClustersToken_
private