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
EgammaHLTEcalRecIsolationProducer Class Reference

#include <EgammaHLTEcalRecIsolationProducer.h>

Inheritance diagram for EgammaHLTEcalRecIsolationProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 EgammaHLTEcalRecIsolationProducer (const edm::ParameterSet &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~EgammaHLTEcalRecIsolationProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- 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 ()
 

Static Public Member Functions

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

Private Attributes

edm::ParameterSet conf_
 
bool doRhoCorrection_
 
edm::EDGetTokenT
< EcalRecHitCollection
ecalBarrelRecHitProducer_
 
edm::EDGetTokenT
< EcalRecHitCollection
ecalEndcapRecHitProducer_
 
float effectiveAreaBarrel_
 
float effectiveAreaEndcap_
 
double egIsoConeSizeInBarrel_
 
double egIsoConeSizeInEndcap_
 
double egIsoConeSizeOut_
 
double egIsoEMinBarrel_
 
double egIsoEMinEndcap_
 
double egIsoJurassicWidth_
 
double egIsoPtMinBarrel_
 
double egIsoPtMinEndcap_
 
edm::EDGetTokenT
< reco::RecoEcalCandidateCollection
recoEcalCandidateProducer_
 
float rhoMax_
 
edm::EDGetTokenT< double > rhoProducer_
 
float rhoScale_
 
bool subtract_
 
bool tryBoth_
 
bool useIsolEt_
 
bool useNumCrystals_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer 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 EgammaHLTEcalRecIsolationProducer.h.

Constructor & Destructor Documentation

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

Definition at line 24 of file EgammaHLTEcalRecIsolationProducer.cc.

References conf_, doRhoCorrection_, ecalBarrelRecHitProducer_, ecalEndcapRecHitProducer_, effectiveAreaBarrel_, effectiveAreaEndcap_, egIsoConeSizeInBarrel_, egIsoConeSizeInEndcap_, egIsoConeSizeOut_, egIsoEMinBarrel_, egIsoEMinEndcap_, egIsoJurassicWidth_, egIsoPtMinBarrel_, egIsoPtMinEndcap_, edm::ParameterSet::getParameter(), recoEcalCandidateProducer_, rhoMax_, rhoProducer_, rhoScale_, subtract_, tryBoth_, useIsolEt_, and useNumCrystals_.

24  : conf_(config) {
25 
26  recoEcalCandidateProducer_ = consumes<reco::RecoEcalCandidateCollection>(conf_.getParameter<edm::InputTag>("recoEcalCandidateProducer"));
27  ecalBarrelRecHitProducer_ = consumes<EcalRecHitCollection>(conf_.getParameter<edm::InputTag>("ecalBarrelRecHitProducer"));
28  ecalEndcapRecHitProducer_ = consumes<EcalRecHitCollection>(conf_.getParameter<edm::InputTag>("ecalEndcapRecHitProducer"));
29 
30  doRhoCorrection_ = config.getParameter<bool>("doRhoCorrection");
31  if (doRhoCorrection_)
32  rhoProducer_ = consumes<double>(config.getParameter<edm::InputTag>("rhoProducer"));
33 
34  rhoMax_ = config.getParameter<double>("rhoMax");
35  rhoScale_ = config.getParameter<double>("rhoScale");
36 
37  //vetos
38  egIsoPtMinBarrel_ = conf_.getParameter<double>("etMinBarrel");
39  egIsoEMinBarrel_ = conf_.getParameter<double>("eMinBarrel");
40  egIsoPtMinEndcap_ = conf_.getParameter<double>("etMinEndcap");
41  egIsoEMinEndcap_ = conf_.getParameter<double>("eMinEndcap");
42  egIsoConeSizeInBarrel_ = conf_.getParameter<double>("intRadiusBarrel");
43  egIsoConeSizeInEndcap_ = conf_.getParameter<double>("intRadiusEndcap");
44  egIsoConeSizeOut_ = conf_.getParameter<double>("extRadius");
45  egIsoJurassicWidth_ = conf_.getParameter<double>("jurassicWidth");
46  effectiveAreaBarrel_ = config.getParameter<double>("effectiveAreaBarrel");
47  effectiveAreaEndcap_ = config.getParameter<double>("effectiveAreaEndcap");
48 
49  // options
50  useIsolEt_ = conf_.getParameter<bool>("useIsolEt");
51  tryBoth_ = conf_.getParameter<bool>("tryBoth");
52  subtract_ = conf_.getParameter<bool>("subtract");
53  useNumCrystals_ = conf_.getParameter<bool>("useNumCrystals");
54 
55  //register your products
56  produces < reco::RecoEcalCandidateIsolationMap >();
57 }
T getParameter(std::string const &) const
edm::EDGetTokenT< EcalRecHitCollection > ecalEndcapRecHitProducer_
edm::EDGetTokenT< reco::RecoEcalCandidateCollection > recoEcalCandidateProducer_
edm::EDGetTokenT< EcalRecHitCollection > ecalBarrelRecHitProducer_
EgammaHLTEcalRecIsolationProducer::~EgammaHLTEcalRecIsolationProducer ( )

Definition at line 59 of file EgammaHLTEcalRecIsolationProducer.cc.

60 {}

Member Function Documentation

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

Definition at line 62 of file EgammaHLTEcalRecIsolationProducer.cc.

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

62  {
63 
65  desc.add<edm::InputTag>("recoEcalCandidateProducer", edm::InputTag("hltL1SeededRecoEcalCandidate"));
66  desc.add<edm::InputTag>("ecalBarrelRecHitProducer", edm::InputTag("hltEcalRegionalEgammaRecHit", "EcalRecHitsEB"));
67  desc.add<edm::InputTag>("ecalEndcapRecHitProducer", edm::InputTag("hltEcalRegionalEgammaRecHit", "EcalRecHitsEE"));
68  desc.add<edm::InputTag>("rhoProducer", edm::InputTag("fixedGridRhoFastjetAllCalo"));
69  desc.add<bool>("doRhoCorrection", false);
70  desc.add<double>("rhoMax", 9.9999999E7);
71  desc.add<double>("rhoScale", 1.0);
72  desc.add<double>("etMinBarrel", -9999.0);
73  desc.add<double>("eMinBarrel", 0.095);
74  desc.add<double>("etMinEndcap", 0.11);
75  desc.add<double>("eMinEndcap", -9999.0);
76  desc.add<double>("intRadiusBarrel", 3.0);
77  desc.add<double>("intRadiusEndcap", 3.0);
78  desc.add<double>("extRadius", 0.3);
79  desc.add<double>("jurassicWidth", 3.0);
80  desc.add<double>("effectiveAreaBarrel", 0.101);
81  desc.add<double>("effectiveAreaEndcap", 0.046);
82  desc.add<bool>("useIsolEt", true);
83  desc.add<bool>("tryBoth", true);
84  desc.add<bool>("subtract", false);
85  desc.add<bool>("useNumCrystals", true);
86 
87  descriptions.add(("hltEgammaHLTEcalRecIsolationProducer"), desc);
88 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void EgammaHLTEcalRecIsolationProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::EDProducer.

Definition at line 90 of file EgammaHLTEcalRecIsolationProducer.cc.

References begin, doRhoCorrection_, DetId::Ecal, ecalBarrelRecHitProducer_, ecalEndcapRecHitProducer_, effectiveAreaBarrel_, effectiveAreaEndcap_, egIsoConeSizeInBarrel_, egIsoConeSizeInEndcap_, egIsoConeSizeOut_, egIsoEMinBarrel_, egIsoEMinEndcap_, egIsoJurassicWidth_, egIsoPtMinBarrel_, egIsoPtMinEndcap_, create_public_lumi_plots::exp, edm::EventSetup::get(), edm::Ref< C, T, F >::get(), edm::Event::getByToken(), EgammaRecHitIsolation::getEnergySum(), EgammaRecHitIsolation::getEtSum(), edm::AssociationMap< Tag >::insert(), edm::Handle< T >::product(), edm::ESHandle< class >::product(), edm::Event::put(), recoEcalCandidateProducer_, rho, rhoMax_, rhoProducer_, rhoScale_, EgammaRecHitIsolation::setUseNumCrystals(), funct::sin(), subtract_, tryBoth_, useIsolEt_, and useNumCrystals_.

90  {
91 
92  // Get the RecoEcalCandidate Collection
94  iEvent.getByToken(recoEcalCandidateProducer_,recoecalcandHandle);
95 
96  // Next get Ecal hits barrel
97  edm::Handle<EcalRecHitCollection> ecalBarrelRecHitHandle; //EcalRecHitCollection is a typedef to
98  iEvent.getByToken(ecalBarrelRecHitProducer_, ecalBarrelRecHitHandle);
99 
100  // Next get Ecal hits endcap
101  edm::Handle<EcalRecHitCollection> ecalEndcapRecHitHandle;
102  iEvent.getByToken(ecalEndcapRecHitProducer_, ecalEndcapRecHitHandle);
103 
104  //Get Calo Geometry
106  iSetup.get<CaloGeometryRecord>().get(pG);
107  const CaloGeometry* caloGeom = pG.product();
108 
110  iSetup.get<EcalSeverityLevelAlgoRcd>().get(sevlv);
111  const EcalSeverityLevelAlgo* sevLevel = sevlv.product();
112 
113  edm::Handle<double> rhoHandle;
114  double rho = 0.0;
115  if (doRhoCorrection_) {
116  iEvent.getByToken(rhoProducer_, rhoHandle);
117  rho = *(rhoHandle.product());
118  }
119 
120  if (rho > rhoMax_)
121  rho = rhoMax_;
122 
123  rho = rho*rhoScale_;
124 
125  //prepare product
126  reco::RecoEcalCandidateIsolationMap isoMap(recoecalcandHandle);
127 
128  //create algorithm objects
130  ecalBarrelIsol.setUseNumCrystals(useNumCrystals_);
132  ecalEndcapIsol.setUseNumCrystals(useNumCrystals_);
133 
134  for (reco::RecoEcalCandidateCollection::const_iterator iRecoEcalCand= recoecalcandHandle->begin(); iRecoEcalCand!=recoecalcandHandle->end(); iRecoEcalCand++) {
135 
136  //create reference for storage in isolation map
137  reco::RecoEcalCandidateRef recoecalcandref(reco::RecoEcalCandidateRef(recoecalcandHandle,iRecoEcalCand -recoecalcandHandle ->begin()));
138 
139  //ecal isolation is centered on supecluster
140  reco::SuperClusterRef superClus = iRecoEcalCand->get<reco::SuperClusterRef>();
141 
142  //i need to know if its in the barrel/endcap so I get the supercluster handle to find out the detector eta
143  //this might not be the best way, are we guaranteed that eta<1.5 is barrel
144  //this can be safely replaced by another method which determines where the emobject is
145  //then we either get the isolation Et or isolation Energy depending on user selection
146  float isol =0.;
147 
148  if(tryBoth_){ //barrel + endcap
149  if(useIsolEt_) isol = ecalBarrelIsol.getEtSum(&(*iRecoEcalCand)) + ecalEndcapIsol.getEtSum(&(*iRecoEcalCand));
150  else isol = ecalBarrelIsol.getEnergySum(&(*iRecoEcalCand)) + ecalEndcapIsol.getEnergySum(&(*iRecoEcalCand));
151  }
152  else if( fabs(superClus->eta())<1.479) { //barrel
153  if(useIsolEt_) isol = ecalBarrelIsol.getEtSum(&(*iRecoEcalCand));
154  else isol = ecalBarrelIsol.getEnergySum(&(*iRecoEcalCand));
155  }
156  else{ //endcap
157  if(useIsolEt_) isol = ecalEndcapIsol.getEtSum(&(*iRecoEcalCand));
158  else isol = ecalEndcapIsol.getEnergySum(&(*iRecoEcalCand));
159  }
160 
161  //we subtract off the electron energy here as well
162  double subtractVal=0;
163 
164  if(useIsolEt_) subtractVal = superClus.get()->rawEnergy()*sin(2*atan(exp(-superClus.get()->eta())));
165  else subtractVal = superClus.get()->rawEnergy();
166 
167  if(subtract_) isol-= subtractVal;
168 
169  if (doRhoCorrection_) {
170  if (fabs(superClus->eta()) < 1.442)
171  isol = isol - rho*effectiveAreaBarrel_;
172  else
173  isol = isol - rho*effectiveAreaEndcap_;
174  }
175 
176  isoMap.insert(recoecalcandref, isol);
177  }
178 
179  std::auto_ptr<reco::RecoEcalCandidateIsolationMap> isolMap(new reco::RecoEcalCandidateIsolationMap(isoMap));
180  iEvent.put(isolMap);
181 
182 }
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< EcalRecHitCollection > ecalEndcapRecHitProducer_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:120
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:244
T const * product() const
Definition: Handle.h:81
const T & get() const
Definition: EventSetup.h:56
edm::EDGetTokenT< reco::RecoEcalCandidateCollection > recoEcalCandidateProducer_
T const * product() const
Definition: ESHandle.h:86
#define begin
Definition: vmac.h:30
edm::EDGetTokenT< EcalRecHitCollection > ecalBarrelRecHitProducer_

Member Data Documentation

edm::ParameterSet EgammaHLTEcalRecIsolationProducer::conf_
private
bool EgammaHLTEcalRecIsolationProducer::doRhoCorrection_
private
edm::EDGetTokenT<EcalRecHitCollection> EgammaHLTEcalRecIsolationProducer::ecalBarrelRecHitProducer_
private
edm::EDGetTokenT<EcalRecHitCollection> EgammaHLTEcalRecIsolationProducer::ecalEndcapRecHitProducer_
private
float EgammaHLTEcalRecIsolationProducer::effectiveAreaBarrel_
private
float EgammaHLTEcalRecIsolationProducer::effectiveAreaEndcap_
private
double EgammaHLTEcalRecIsolationProducer::egIsoConeSizeInBarrel_
private
double EgammaHLTEcalRecIsolationProducer::egIsoConeSizeInEndcap_
private
double EgammaHLTEcalRecIsolationProducer::egIsoConeSizeOut_
private
double EgammaHLTEcalRecIsolationProducer::egIsoEMinBarrel_
private
double EgammaHLTEcalRecIsolationProducer::egIsoEMinEndcap_
private
double EgammaHLTEcalRecIsolationProducer::egIsoJurassicWidth_
private
double EgammaHLTEcalRecIsolationProducer::egIsoPtMinBarrel_
private
double EgammaHLTEcalRecIsolationProducer::egIsoPtMinEndcap_
private
edm::EDGetTokenT<reco::RecoEcalCandidateCollection> EgammaHLTEcalRecIsolationProducer::recoEcalCandidateProducer_
private
float EgammaHLTEcalRecIsolationProducer::rhoMax_
private
edm::EDGetTokenT<double> EgammaHLTEcalRecIsolationProducer::rhoProducer_
private
float EgammaHLTEcalRecIsolationProducer::rhoScale_
private
bool EgammaHLTEcalRecIsolationProducer::subtract_
private
bool EgammaHLTEcalRecIsolationProducer::tryBoth_
private
bool EgammaHLTEcalRecIsolationProducer::useIsolEt_
private
bool EgammaHLTEcalRecIsolationProducer::useNumCrystals_
private