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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 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
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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::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 12 of file EgammaIsoHcalDetIdCollectionProducer.cc.

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

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

132 {
133  DetId seedId = superClus.seed()->seed();
134  if(seedId.det() != DetId::Ecal) {
135  edm::LogError("EgammaIsoHcalDetIdCollectionProducerError") << "Somehow the supercluster has a seed which is not ECAL, something is badly wrong";
136  }
137  //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
138 
139  CaloTowerDetId towerId(towerMap_->towerOf(seedId));
140  int seedHcalIEta = towerId.ieta();
141  int seedHcalIPhi = towerId.iphi();
142 
143  for(auto& recHit : recHits){
144  int dIEtaAbs = std::abs(calDIEta(seedHcalIEta,recHit.id().ieta()));
145  int dIPhiAbs = std::abs(calDIPhi(seedHcalIPhi,recHit.id().iphi()));
146 
147  if(dIEtaAbs<=maxDIEta_ && dIPhiAbs<=maxDIPhi_ && recHit.energy()>minEnergyHCAL_) detIdsToStore.push_back(recHit.id().rawId());
148  }
149 
150 }
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 45 of file EgammaIsoHcalDetIdCollectionProducer.cc.

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

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

producer

Implements edm::stream::EDProducerBase.

Definition at line 53 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_.

55 {
56 
57  // take BasicClusters
59  iEvent.getByToken(superClustersToken_, superClusters);
60 
62  iEvent.getByToken(elesToken_,eles);
63 
65  iEvent.getByToken(phosToken_,phos);
66 
68  iEvent.getByToken(recHitsToken_,recHits);
69 
70  //Create empty output collections
71  std::vector<DetId> indexToStore;
72  indexToStore.reserve(100);
73 
74  if(eles.isValid() && recHits.isValid()){
75  for(auto& ele : *eles){
76 
77  float scEt = ele.superCluster()->energy()*std::sin(ele.superCluster()->position().theta());
78  if(scEt > minEleEt_ || ele.et()> minEleEt_) addDetIds(*ele.superCluster(),*recHits,indexToStore);
79  }
80  }
81  if(phos.isValid() && recHits.isValid()){
82  for(auto& pho : *phos){
83  float scEt = pho.superCluster()->energy()*std::sin(pho.superCluster()->position().theta());
84  if(scEt > minPhoEt_ || pho.et()> minPhoEt_) addDetIds(*pho.superCluster(),*recHits,indexToStore);
85  }
86  }
87  if(superClusters.isValid() && recHits.isValid()){
88  for(auto& sc : *superClusters){
89  float scEt = sc.energy()*std::sin(sc.position().theta());
90  if(scEt > minSCEt_) addDetIds(sc,*recHits,indexToStore);
91  }
92  }
93 
94  //unify the vector
95  std::sort(indexToStore.begin(),indexToStore.end());
96  std::unique(indexToStore.begin(),indexToStore.end());
97 
98  std::auto_ptr< DetIdCollection > detIdCollection (new DetIdCollection(indexToStore) ) ;
99 
100  iEvent.put( detIdCollection, interestingDetIdCollection_ );
101 
102 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
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:120
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().