CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
EgammaIsoHcalDetIdCollectionProducer Class Reference

#include <EgammaIsoHcalDetIdCollectionProducer.h>

Inheritance diagram for EgammaIsoHcalDetIdCollectionProducer:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void beginRun (edm::Run const &, const edm::EventSetup &) overridefinal
 
 EgammaIsoHcalDetIdCollectionProducer (const edm::ParameterSet &)
 ctor More...
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 producer More...
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

void addDetIds (const reco::SuperCluster &superClus, const HBHERecHitCollection &recHits, std::vector< DetId > &detIdsToStore)
 

Private Attributes

edm::EDGetTokenT
< reco::GsfElectronCollection
elesToken_
 
std::string interestingDetIdCollection_
 
int maxDIEta_
 
int maxDIPhi_
 
float minEleEt_
 
float minEnergyHCAL_
 
float minPhoEt_
 
float minSCEt_
 
edm::EDGetTokenT
< reco::PhotonCollection
phosToken_
 
edm::EDGetTokenT
< HBHERecHitCollection
recHitsToken_
 
edm::EDGetTokenT
< reco::SuperClusterCollection
superClustersToken_
 
edm::ESHandle
< CaloTowerConstituentsMap
towerMap_
 

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, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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 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)
 

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 44 of file EgammaIsoHcalDetIdCollectionProducer.h.

Constructor & Destructor Documentation

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

ctor

Definition at line 13 of file EgammaIsoHcalDetIdCollectionProducer.cc.

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

14 {
15 
16  recHitsToken_ =
17  consumes<HBHERecHitCollection>(iConfig.getParameter< edm::InputTag > ("recHitsLabel"));
18  elesToken_ =
19  consumes<reco::GsfElectronCollection>(iConfig.getParameter< edm::InputTag >("elesLabel"));
20 
21  phosToken_ =
22  consumes<reco::PhotonCollection>(iConfig.getParameter< edm::InputTag >("phosLabel"));
23 
25  consumes<reco::SuperClusterCollection>(iConfig.getParameter< edm::InputTag >("superClustersLabel"));
26 
27  minSCEt_ = iConfig.getParameter<double>("minSCEt");
28  minEleEt_ = iConfig.getParameter<double>("minEleEt");
29  minPhoEt_ = iConfig.getParameter<double>("minPhoEt");
30 
31 
32  interestingDetIdCollection_ = iConfig.getParameter<std::string>("interestingDetIdCollection");
33 
34  maxDIEta_ = iConfig.getParameter<int>("maxDIEta");
35  maxDIPhi_ = iConfig.getParameter<int>("maxDIPhi");
36 
37  minEnergyHCAL_= iConfig.getParameter<double>("minEnergyHCAL");
38 
39  //register your products
40  produces< DetIdCollection > (interestingDetIdCollection_) ;
41 
42 
43 }
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::addDetIds ( const reco::SuperCluster superClus,
const HBHERecHitCollection recHits,
std::vector< DetId > &  detIdsToStore 
)
private

Definition at line 132 of file EgammaIsoHcalDetIdCollectionProducer.cc.

References funct::abs(), calDIEta(), calDIPhi(), DetId::det(), DetId::Ecal, maxDIEta_, maxDIPhi_, minEnergyHCAL_, reco::SuperCluster::seed(), ecaldqm::towerId(), and towerMap_.

Referenced by produce().

133 {
134  DetId seedId = superClus.seed()->seed();
135  if(seedId.det() != DetId::Ecal) {
136  edm::LogError("EgammaIsoHcalDetIdCollectionProducerError") << "Somehow the supercluster has a seed which is not ECAL, something is badly wrong";
137  }
138  //so we are using CaloTowers to get the iEta/iPhi of the HCAL rec hit behind the seed cluster, this might go funny on tower 28 but shouldnt matter there
139 
140  CaloTowerDetId towerId(towerMap_->towerOf(seedId));
141  int seedHcalIEta = towerId.ieta();
142  int seedHcalIPhi = towerId.iphi();
143 
144  for(auto& recHit : recHits){
145  int dIEtaAbs = std::abs(calDIEta(seedHcalIEta,recHit.id().ieta()));
146  int dIPhiAbs = std::abs(calDIPhi(seedHcalIPhi,recHit.id().iphi()));
147 
148  if(dIEtaAbs<=maxDIEta_ && dIPhiAbs<=maxDIPhi_ && recHit.energy()>minEnergyHCAL_) detIdsToStore.push_back(recHit.id().rawId());
149  }
150 
151 }
int calDIPhi(int iPhi1, int iPhi2)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
unsigned towerId(DetId const &)
Definition: DetId.h:18
edm::ESHandle< CaloTowerConstituentsMap > towerMap_
const CaloClusterPtr & seed() const
seed BasicCluster
Definition: SuperCluster.h:66
Detector det() const
get the detector field from this detid
Definition: DetId.h:35
int calDIEta(int iEta1, int iEta2)
void EgammaIsoHcalDetIdCollectionProducer::beginRun ( edm::Run const &  run,
const edm::EventSetup iSetup 
)
finaloverridevirtual

Reimplemented from edm::stream::EDProducerBase.

Definition at line 46 of file EgammaIsoHcalDetIdCollectionProducer.cc.

References edm::EventSetup::get(), and towerMap_.

47 {
48  iSetup.get<IdealGeometryRecord>().get(towerMap_);
49  // std::cout <<" got geom "<<towerMap_.isValid()<<" "<<&(*towerMap_)<<std::endl;
50 }
const T & get() const
Definition: EventSetup.h:55
edm::ESHandle< CaloTowerConstituentsMap > towerMap_
void EgammaIsoHcalDetIdCollectionProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

producer

Implements edm::stream::EDProducerBase.

Definition at line 54 of file EgammaIsoHcalDetIdCollectionProducer.cc.

References addDetIds(), elesToken_, edm::Event::getByToken(), interestingDetIdCollection_, edm::HandleBase::isValid(), minEleEt_, minPhoEt_, minSCEt_, phosToken_, edm::Event::put(), HLT_25ns14e33_v3_cff::recHits, recHitsToken_, funct::sin(), python.multivaluedict::sort(), and superClustersToken_.

56 {
57 
58  // take BasicClusters
60  iEvent.getByToken(superClustersToken_, superClusters);
61 
63  iEvent.getByToken(elesToken_,eles);
64 
66  iEvent.getByToken(phosToken_,phos);
67 
69  iEvent.getByToken(recHitsToken_,recHits);
70 
71  //Create empty output collections
72  std::vector<DetId> indexToStore;
73  indexToStore.reserve(100);
74 
75  if(eles.isValid() && recHits.isValid()){
76  for(auto& ele : *eles){
77 
78  float scEt = ele.superCluster()->energy()*std::sin(ele.superCluster()->position().theta());
79  if(scEt > minEleEt_ || ele.et()> minEleEt_) addDetIds(*ele.superCluster(),*recHits,indexToStore);
80  }
81  }
82  if(phos.isValid() && recHits.isValid()){
83  for(auto& pho : *phos){
84  float scEt = pho.superCluster()->energy()*std::sin(pho.superCluster()->position().theta());
85  if(scEt > minPhoEt_ || pho.et()> minPhoEt_) addDetIds(*pho.superCluster(),*recHits,indexToStore);
86  }
87  }
88  if(superClusters.isValid() && recHits.isValid()){
89  for(auto& sc : *superClusters){
90  float scEt = sc.energy()*std::sin(sc.position().theta());
91  if(scEt > minSCEt_) addDetIds(sc,*recHits,indexToStore);
92  }
93  }
94 
95  //unify the vector
96  std::sort(indexToStore.begin(),indexToStore.end());
97  std::unique(indexToStore.begin(),indexToStore.end());
98 
99  std::auto_ptr< DetIdCollection > detIdCollection (new DetIdCollection(indexToStore) ) ;
100 
101  iEvent.put( detIdCollection, interestingDetIdCollection_ );
102 
103 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
edm::EDGetTokenT< reco::SuperClusterCollection > superClustersToken_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
edm::EDGetTokenT< HBHERecHitCollection > recHitsToken_
bool isValid() const
Definition: HandleBase.h:75
edm::EDGetTokenT< reco::GsfElectronCollection > elesToken_
edm::EDGetTokenT< reco::PhotonCollection > phosToken_
void addDetIds(const reco::SuperCluster &superClus, const HBHERecHitCollection &recHits, std::vector< DetId > &detIdsToStore)
edm::EDCollection< DetId > DetIdCollection

Member Data Documentation

edm::EDGetTokenT<reco::GsfElectronCollection> EgammaIsoHcalDetIdCollectionProducer::elesToken_
private
std::string EgammaIsoHcalDetIdCollectionProducer::interestingDetIdCollection_
private
int EgammaIsoHcalDetIdCollectionProducer::maxDIEta_
private
int EgammaIsoHcalDetIdCollectionProducer::maxDIPhi_
private
float EgammaIsoHcalDetIdCollectionProducer::minEleEt_
private
float EgammaIsoHcalDetIdCollectionProducer::minEnergyHCAL_
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
edm::ESHandle<CaloTowerConstituentsMap> EgammaIsoHcalDetIdCollectionProducer::towerMap_
private

Definition at line 72 of file EgammaIsoHcalDetIdCollectionProducer.h.

Referenced by addDetIds(), and beginRun().