test
CMS 3D CMS Logo

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

#include <EgammaHLTBcHcalIsolationProducersRegional.h>

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

Public Member Functions

 EgammaHLTBcHcalIsolationProducersRegional (const edm::ParameterSet &)
 
 EgammaHLTBcHcalIsolationProducersRegional (EgammaHLTBcHcalIsolationProducersRegional const &)=delete
 
EgammaHLTBcHcalIsolationProducersRegionaloperator= (EgammaHLTBcHcalIsolationProducersRegional const &)=delete
 
virtual void produce (edm::Event &, const edm::EventSetup &) overridefinal
 
 ~EgammaHLTBcHcalIsolationProducersRegional ()
 
- 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 (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &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 ()
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Attributes

const std::vector< double > absEtaLowEdges_
 
const edm::EDGetTokenT
< CaloTowerCollection
caloTowerProducer_
 
const int depth_
 
const bool doEtSum_
 
const bool doRhoCorrection_
 
const std::vector< double > effectiveAreas_
 
const double etMin_
 
ElectronHcalHelperhcalHelper_
 
const double innerCone_
 
const double outerCone_
 
const edm::EDGetTokenT
< reco::RecoEcalCandidateCollection
recoEcalCandidateProducer_
 
const double rhoMax_
 
const edm::EDGetTokenT< double > rhoProducer_
 
const double rhoScale_
 
const bool useSingleTower_
 

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

Definition at line 34 of file EgammaHLTBcHcalIsolationProducersRegional.h.

Constructor & Destructor Documentation

EgammaHLTBcHcalIsolationProducersRegional::EgammaHLTBcHcalIsolationProducersRegional ( const edm::ParameterSet config)
explicit

Definition at line 31 of file EgammaHLTBcHcalIsolationProducersRegional.cc.

References absEtaLowEdges_, caloTowerProducer_, doRhoCorrection_, effectiveAreas_, etMin_, Exception, hcalHelper_, ElectronHcalHelper::Configuration::hcalTowers, ElectronHcalHelper::Configuration::hOverEConeSize, ElectronHcalHelper::Configuration::hOverEPtMin, outerCone_, and ElectronHcalHelper::Configuration::useTowers.

31  :
32  doEtSum_( config.getParameter<bool>("doEtSum") ),
33  etMin_( config.getParameter<double>("etMin") ),
34  innerCone_( config.getParameter<double>("innerCone") ),
35  outerCone_( config.getParameter<double>("outerCone") ),
36  depth_( config.getParameter<int>("depth") ),
37  useSingleTower_( config.getParameter<bool>("useSingleTower") ),
38  doRhoCorrection_( config.getParameter<bool>("doRhoCorrection") ),
39  rhoScale_( config.getParameter<double>("rhoScale") ),
40  rhoMax_( config.getParameter<double>("rhoMax") ),
41  effectiveAreas_( config.getParameter<std::vector<double> >("effectiveAreas") ),
42  absEtaLowEdges_( config.getParameter<std::vector<double> >("absEtaLowEdges") ),
43  recoEcalCandidateProducer_( consumes<reco::RecoEcalCandidateCollection>(config.getParameter<edm::InputTag>("recoEcalCandidateProducer")) ),
44  caloTowerProducer_( consumes<CaloTowerCollection>(config.getParameter<edm::InputTag>("caloTowerProducer")) ),
45  rhoProducer_( doRhoCorrection_ ? consumes<double>(config.getParameter<edm::InputTag>("rhoProducer")) : edm::EDGetTokenT<double>() )
46 {
47 
48  if (doRhoCorrection_) {
49  if (absEtaLowEdges_.size() != effectiveAreas_.size())
50  throw cms::Exception("IncompatibleVects") << "absEtaLowEdges and effectiveAreas should be of the same size. \n";
51 
52  if (absEtaLowEdges_.at(0) != 0.0)
53  throw cms::Exception("IncompleteCoverage") << "absEtaLowEdges should start from 0. \n";
54 
55  for (unsigned int aIt = 0; aIt < absEtaLowEdges_.size() - 1; aIt++) {
56  if ( !(absEtaLowEdges_.at( aIt ) < absEtaLowEdges_.at( aIt + 1 )) )
57  throw cms::Exception("ImproperBinning") << "absEtaLowEdges entries should be in increasing order. \n";
58  }
59  }
60 
62  hcalCfg.hOverEConeSize = outerCone_;
63  hcalCfg.useTowers = true;
65  hcalCfg.hOverEPtMin = etMin_;
66  hcalHelper_ = new ElectronHcalHelper(hcalCfg);
67 
68  produces<reco::RecoEcalCandidateIsolationMap>();
69 }
T getParameter(std::string const &) const
const edm::EDGetTokenT< CaloTowerCollection > caloTowerProducer_
edm::EDGetTokenT< CaloTowerCollection > hcalTowers
const edm::EDGetTokenT< reco::RecoEcalCandidateCollection > recoEcalCandidateProducer_
EgammaHLTBcHcalIsolationProducersRegional::~EgammaHLTBcHcalIsolationProducersRegional ( )

Definition at line 71 of file EgammaHLTBcHcalIsolationProducersRegional.cc.

References hcalHelper_.

EgammaHLTBcHcalIsolationProducersRegional::EgammaHLTBcHcalIsolationProducersRegional ( EgammaHLTBcHcalIsolationProducersRegional const &  )
delete

Member Function Documentation

void EgammaHLTBcHcalIsolationProducersRegional::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 75 of file EgammaHLTBcHcalIsolationProducersRegional.cc.

References edm::ConfigurationDescriptions::add(), and edm::ParameterSetDescription::add().

75  {
76 
78 
79  desc.add<edm::InputTag>(("recoEcalCandidateProducer"), edm::InputTag("hltRecoEcalCandidate"));
80  desc.add<edm::InputTag>(("caloTowerProducer"), edm::InputTag("hltTowerMakerForAll"));
81  desc.add<edm::InputTag>(("rhoProducer"), edm::InputTag("fixedGridRhoFastjetAllCalo"));
82  desc.add<bool>(("doRhoCorrection"), false);
83  desc.add<double>(("rhoMax"), 999999.);
84  desc.add<double>(("rhoScale"), 1.0);
85  desc.add<double>(("etMin"), -1.0);
86  desc.add<double>(("innerCone"), 0);
87  desc.add<double>(("outerCone"), 0.15);
88  desc.add<int>(("depth"), -1);
89  desc.add<bool>(("doEtSum"), false);
90  desc.add<bool>(("useSingleTower"), false);
91  desc.add<std::vector<double> >("effectiveAreas", {0.079, 0.25}); // 2016 post-ichep sinEle default
92  desc.add<std::vector<double> >("absEtaLowEdges", {0.0, 1.479}); // Barrel, Endcap
93  descriptions.add(("hltEgammaHLTBcHcalIsolationProducersRegional"), desc);
94 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
EgammaHLTBcHcalIsolationProducersRegional& EgammaHLTBcHcalIsolationProducersRegional::operator= ( EgammaHLTBcHcalIsolationProducersRegional const &  )
delete
void EgammaHLTBcHcalIsolationProducersRegional::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
finaloverridevirtual

Implements edm::stream::EDProducerBase.

Definition at line 96 of file EgammaHLTBcHcalIsolationProducersRegional.cc.

References funct::abs(), absEtaLowEdges_, caloTowerProducer_, ElectronHcalHelper::checkSetup(), depth_, doEtSum_, doRhoCorrection_, effectiveAreas_, etMin_, edm::Event::getByToken(), EgammaTowerIsolation::getTowerEtSum(), ElectronHcalHelper::hcalESum(), ElectronHcalHelper::hcalESumDepth1BehindClusters(), ElectronHcalHelper::hcalESumDepth2BehindClusters(), hcalHelper_, ElectronHcalHelper::hcalTowersBehindClusters(), innerCone_, edm::AssociationMap< Tag >::insert(), outerCone_, edm::Handle< T >::product(), edm::Event::put(), ElectronHcalHelper::readEvent(), recoEcalCandidateProducer_, rho, rhoMax_, rhoProducer_, rhoScale_, and useSingleTower_.

96  {
97 
98  // Get the HLT filtered objects
100  iEvent.getByToken(recoEcalCandidateProducer_, recoEcalCandHandle);
101 
102  edm::Handle<CaloTowerCollection> caloTowersHandle;
103  iEvent.getByToken(caloTowerProducer_, caloTowersHandle);
104 
105  edm::Handle<double> rhoHandle;
106  double rho = 0.0;
107 
108  if (doRhoCorrection_) {
109  iEvent.getByToken(rhoProducer_, rhoHandle);
110  rho = *(rhoHandle.product());
111  }
112 
113  if (rho > rhoMax_)
114  rho = rhoMax_;
115 
116  rho = rho*rhoScale_;
117 
118  hcalHelper_->checkSetup(iSetup);
119  hcalHelper_->readEvent(iEvent);
120 
121  reco::RecoEcalCandidateIsolationMap isoMap(recoEcalCandHandle);
122 
123  for(unsigned int iRecoEcalCand=0; iRecoEcalCand <recoEcalCandHandle->size(); iRecoEcalCand++) {
124 
125  reco::RecoEcalCandidateRef recoEcalCandRef(recoEcalCandHandle, iRecoEcalCand);
126 
127  float isol = 0;
128 
129  std::vector<CaloTowerDetId> towersBehindCluster;
130 
131  if (useSingleTower_)
132  towersBehindCluster = hcalHelper_->hcalTowersBehindClusters(*(recoEcalCandRef->superCluster()));
133 
134  if (doEtSum_) { //calculate hcal isolation excluding the towers behind the cluster which will be used for H for H/E
135  EgammaTowerIsolation isolAlgo(outerCone_, innerCone_, etMin_, depth_, caloTowersHandle.product());
136  if (useSingleTower_)
137  isol = isolAlgo.getTowerEtSum(&(*recoEcalCandRef), &(towersBehindCluster)); // towersBehindCluster are excluded from the isolation sum
138  else
139  isol = isolAlgo.getTowerEtSum(&(*recoEcalCandRef));
140 
141  } else { //calcuate H for H/E
142  if (useSingleTower_)
143  isol = hcalHelper_->hcalESumDepth1BehindClusters(towersBehindCluster) + hcalHelper_->hcalESumDepth2BehindClusters(towersBehindCluster);
144  else
145  isol = hcalHelper_->hcalESum(*(recoEcalCandRef->superCluster()));
146 
147  }
148 
149  if (doRhoCorrection_) {
150  int iEA = -1;
151  auto scEta = std::abs(recoEcalCandRef->superCluster()->eta());
152  for (int bIt = absEtaLowEdges_.size() - 1; bIt > -1; bIt--) {
153  if ( scEta > absEtaLowEdges_.at(bIt) ) {
154  iEA = bIt;
155  break;
156  }
157  }
158  isol = isol - rho*effectiveAreas_.at(iEA);
159  }
160 
161  isoMap.insert(recoEcalCandRef, isol);
162  }
163 
164  std::auto_ptr<reco::RecoEcalCandidateIsolationMap> isolMap(new reco::RecoEcalCandidateIsolationMap(isoMap));
165  iEvent.put(isolMap);
166 }
double hcalESum(const reco::SuperCluster &, const std::vector< CaloTowerDetId > *excludeTowers=0)
void readEvent(const edm::Event &)
const edm::EDGetTokenT< CaloTowerCollection > caloTowerProducer_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
double hcalESumDepth2BehindClusters(const std::vector< CaloTowerDetId > &towers)
std::vector< CaloTowerDetId > hcalTowersBehindClusters(const reco::SuperCluster &sc)
void checkSetup(const edm::EventSetup &)
double hcalESumDepth1BehindClusters(const std::vector< CaloTowerDetId > &towers)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
T const * product() const
Definition: Handle.h:81
double getTowerEtSum(const reco::Candidate *cand, const std::vector< CaloTowerDetId > *detIdToExclude=0) const
const edm::EDGetTokenT< reco::RecoEcalCandidateCollection > recoEcalCandidateProducer_

Member Data Documentation

const std::vector<double> EgammaHLTBcHcalIsolationProducersRegional::absEtaLowEdges_
private
const edm::EDGetTokenT<CaloTowerCollection> EgammaHLTBcHcalIsolationProducersRegional::caloTowerProducer_
private
const int EgammaHLTBcHcalIsolationProducersRegional::depth_
private

Definition at line 52 of file EgammaHLTBcHcalIsolationProducersRegional.h.

Referenced by produce().

const bool EgammaHLTBcHcalIsolationProducersRegional::doEtSum_
private

Definition at line 48 of file EgammaHLTBcHcalIsolationProducersRegional.h.

Referenced by produce().

const bool EgammaHLTBcHcalIsolationProducersRegional::doRhoCorrection_
private
const std::vector<double> EgammaHLTBcHcalIsolationProducersRegional::effectiveAreas_
private
const double EgammaHLTBcHcalIsolationProducersRegional::etMin_
private
ElectronHcalHelper* EgammaHLTBcHcalIsolationProducersRegional::hcalHelper_
private
const double EgammaHLTBcHcalIsolationProducersRegional::innerCone_
private

Definition at line 50 of file EgammaHLTBcHcalIsolationProducersRegional.h.

Referenced by produce().

const double EgammaHLTBcHcalIsolationProducersRegional::outerCone_
private
const edm::EDGetTokenT<reco::RecoEcalCandidateCollection> EgammaHLTBcHcalIsolationProducersRegional::recoEcalCandidateProducer_
private

Definition at line 61 of file EgammaHLTBcHcalIsolationProducersRegional.h.

Referenced by produce().

const double EgammaHLTBcHcalIsolationProducersRegional::rhoMax_
private

Definition at line 57 of file EgammaHLTBcHcalIsolationProducersRegional.h.

Referenced by produce().

const edm::EDGetTokenT<double> EgammaHLTBcHcalIsolationProducersRegional::rhoProducer_
private

Definition at line 63 of file EgammaHLTBcHcalIsolationProducersRegional.h.

Referenced by produce().

const double EgammaHLTBcHcalIsolationProducersRegional::rhoScale_
private

Definition at line 56 of file EgammaHLTBcHcalIsolationProducersRegional.h.

Referenced by produce().

const bool EgammaHLTBcHcalIsolationProducersRegional::useSingleTower_
private

Definition at line 53 of file EgammaHLTBcHcalIsolationProducersRegional.h.

Referenced by produce().