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

Definition at line 34 of file EgammaHLTEcalRecIsolationProducer.h.

Constructor & Destructor Documentation

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

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

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

Definition at line 65 of file EgammaHLTEcalRecIsolationProducer.cc.

66 {}

Member Function Documentation

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

Definition at line 68 of file EgammaHLTEcalRecIsolationProducer.cc.

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

68  {
69 
71  desc.add<edm::InputTag>("recoEcalCandidateProducer", edm::InputTag("hltL1SeededRecoEcalCandidate"));
72  desc.add<edm::InputTag>("ecalBarrelRecHitProducer", edm::InputTag("hltEcalRegionalEgammaRecHit", "EcalRecHitsEB"));
73  desc.add<edm::InputTag>("ecalEndcapRecHitProducer", edm::InputTag("hltEcalRegionalEgammaRecHit", "EcalRecHitsEE"));
74  desc.add<edm::InputTag>("rhoProducer", edm::InputTag("fixedGridRhoFastjetAllCalo"));
75  desc.add<bool>("doRhoCorrection", false);
76  desc.add<double>("rhoMax", 9.9999999E7);
77  desc.add<double>("rhoScale", 1.0);
78  desc.add<double>("etMinBarrel", -9999.0);
79  desc.add<double>("eMinBarrel", 0.095);
80  desc.add<double>("etMinEndcap", 0.11);
81  desc.add<double>("eMinEndcap", -9999.0);
82  desc.add<double>("intRadiusBarrel", 3.0);
83  desc.add<double>("intRadiusEndcap", 3.0);
84  desc.add<double>("extRadius", 0.3);
85  desc.add<double>("jurassicWidth", 3.0);
86  desc.add<double>("effectiveAreaBarrel", 0.101);
87  desc.add<double>("effectiveAreaEndcap", 0.046);
88  desc.add<bool>("useIsolEt", true);
89  desc.add<bool>("tryBoth", true);
90  desc.add<bool>("subtract", false);
91  desc.add<bool>("useNumCrystals", true);
92 
93  descriptions.add(("hltEgammaHLTEcalRecIsolationProducer"), desc);
94 }
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 
)
virtual

Implements edm::EDProducer.

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

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