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 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 ()
 
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 ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

edm::ParameterSet conf_
 
bool doRhoCorrection_
 
edm::InputTag ecalBarrelRecHitCollection_
 
edm::InputTag ecalBarrelRecHitProducer_
 
edm::InputTag ecalEndcapRecHitCollection_
 
edm::InputTag ecalEndcapRecHitProducer_
 
float effectiveAreaBarrel_
 
float effectiveAreaEndcap_
 
double egIsoConeSizeInBarrel_
 
double egIsoConeSizeInEndcap_
 
double egIsoConeSizeOut_
 
double egIsoEMinBarrel_
 
double egIsoEMinEndcap_
 
double egIsoJurassicWidth_
 
double egIsoPtMinBarrel_
 
double egIsoPtMinEndcap_
 
edm::InputTag recoEcalCandidateProducer_
 
float rhoMax_
 
edm::InputTag rhoProducer_
 
float rhoScale_
 
bool subtract_
 
bool tryBoth_
 
bool useIsolEt_
 
bool useNumCrystals_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- 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 33 of file EgammaHLTEcalRecIsolationProducer.h.

Constructor & Destructor Documentation

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

Definition at line 41 of file EgammaHLTEcalRecIsolationProducer.cc.

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

41  : conf_(config)
42 {
43  // use configuration file to setup input/output collection names
44  //inputs
45  recoEcalCandidateProducer_ = conf_.getParameter<edm::InputTag>("recoEcalCandidateProducer");
46  ecalBarrelRecHitProducer_ = conf_.getParameter<edm::InputTag>("ecalBarrelRecHitProducer");
47  ecalBarrelRecHitCollection_ = conf_.getParameter<edm::InputTag>("ecalBarrelRecHitCollection");
48  ecalEndcapRecHitProducer_ = conf_.getParameter<edm::InputTag>("ecalEndcapRecHitProducer");
49  ecalEndcapRecHitCollection_ = conf_.getParameter<edm::InputTag>("ecalEndcapRecHitCollection");
50  rhoProducer_ = config.getParameter<edm::InputTag>("rhoProducer");
51  doRhoCorrection_ = config.getParameter<bool>("doRhoCorrection");
52  rhoMax_ = config.getParameter<double>("rhoMax");
53  rhoScale_ = config.getParameter<double>("rhoScale");
54 
55  //vetos
56  egIsoPtMinBarrel_ = conf_.getParameter<double>("etMinBarrel");
57  egIsoEMinBarrel_ = conf_.getParameter<double>("eMinBarrel");
58  egIsoPtMinEndcap_ = conf_.getParameter<double>("etMinEndcap");
59  egIsoEMinEndcap_ = conf_.getParameter<double>("eMinEndcap");
60  egIsoConeSizeInBarrel_ = conf_.getParameter<double>("intRadiusBarrel");
61  egIsoConeSizeInEndcap_ = conf_.getParameter<double>("intRadiusEndcap");
62  egIsoConeSizeOut_ = conf_.getParameter<double>("extRadius");
63  egIsoJurassicWidth_ = conf_.getParameter<double>("jurassicWidth");
64  effectiveAreaBarrel_ = config.getParameter<double>("effectiveAreaBarrel");
65  effectiveAreaEndcap_ = config.getParameter<double>("effectiveAreaEndcap");
66 
67  // options
68  useIsolEt_ = conf_.getParameter<bool>("useIsolEt");
69  tryBoth_ = conf_.getParameter<bool>("tryBoth");
70  subtract_ = conf_.getParameter<bool>("subtract");
71  useNumCrystals_ = conf_.getParameter<bool>("useNumCrystals");
72 
73  //register your products
74  produces < reco::RecoEcalCandidateIsolationMap >();
75 }
T getParameter(std::string const &) const
EgammaHLTEcalRecIsolationProducer::~EgammaHLTEcalRecIsolationProducer ( )

Definition at line 77 of file EgammaHLTEcalRecIsolationProducer.cc.

77 {}

Member Function Documentation

void EgammaHLTEcalRecIsolationProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDProducer.

Definition at line 81 of file EgammaHLTEcalRecIsolationProducer.cc.

References begin, doRhoCorrection_, DetId::Ecal, ecalBarrelRecHitCollection_, ecalBarrelRecHitProducer_, ecalEndcapRecHitCollection_, 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::getByLabel(), EgammaRecHitIsolation::getEnergySum(), EgammaRecHitIsolation::getEtSum(), edm::AssociationMap< Tag >::insert(), edm::InputTag::label(), 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_.

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

Member Data Documentation

edm::ParameterSet EgammaHLTEcalRecIsolationProducer::conf_
private
bool EgammaHLTEcalRecIsolationProducer::doRhoCorrection_
private
edm::InputTag EgammaHLTEcalRecIsolationProducer::ecalBarrelRecHitCollection_
private
edm::InputTag EgammaHLTEcalRecIsolationProducer::ecalBarrelRecHitProducer_
private
edm::InputTag EgammaHLTEcalRecIsolationProducer::ecalEndcapRecHitCollection_
private
edm::InputTag 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::InputTag EgammaHLTEcalRecIsolationProducer::recoEcalCandidateProducer_
private
float EgammaHLTEcalRecIsolationProducer::rhoMax_
private
edm::InputTag EgammaHLTEcalRecIsolationProducer::rhoProducer_
private
float EgammaHLTEcalRecIsolationProducer::rhoScale_
private
bool EgammaHLTEcalRecIsolationProducer::subtract_
private
bool EgammaHLTEcalRecIsolationProducer::tryBoth_
private
bool EgammaHLTEcalRecIsolationProducer::useIsolEt_
private
bool EgammaHLTEcalRecIsolationProducer::useNumCrystals_
private