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::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 &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Attributes

edm::ParameterSet conf_
 
edm::InputTag ecalBarrelRecHitCollection_
 
edm::InputTag ecalBarrelRecHitProducer_
 
edm::InputTag ecalEndcapRecHitCollection_
 
edm::InputTag ecalEndcapRecHitProducer_
 
double egIsoConeSizeInBarrel_
 
double egIsoConeSizeInEndcap_
 
double egIsoConeSizeOut_
 
double egIsoEMinBarrel_
 
double egIsoEMinEndcap_
 
double egIsoJurassicWidth_
 
double egIsoPtMinBarrel_
 
double egIsoPtMinEndcap_
 
edm::InputTag recoEcalCandidateProducer_
 
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)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

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_, ecalBarrelRecHitCollection_, ecalBarrelRecHitProducer_, ecalEndcapRecHitCollection_, ecalEndcapRecHitProducer_, egIsoConeSizeInBarrel_, egIsoConeSizeInEndcap_, egIsoConeSizeOut_, egIsoEMinBarrel_, egIsoEMinEndcap_, egIsoJurassicWidth_, egIsoPtMinBarrel_, egIsoPtMinEndcap_, edm::ParameterSet::getParameter(), recoEcalCandidateProducer_, 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 
51  //vetos
52  egIsoPtMinBarrel_ = conf_.getParameter<double>("etMinBarrel");
53  egIsoEMinBarrel_ = conf_.getParameter<double>("eMinBarrel");
54  egIsoPtMinEndcap_ = conf_.getParameter<double>("etMinEndcap");
55  egIsoEMinEndcap_ = conf_.getParameter<double>("eMinEndcap");
56  egIsoConeSizeInBarrel_ = conf_.getParameter<double>("intRadiusBarrel");
57  egIsoConeSizeInEndcap_ = conf_.getParameter<double>("intRadiusEndcap");
58  egIsoConeSizeOut_ = conf_.getParameter<double>("extRadius");
59  egIsoJurassicWidth_ = conf_.getParameter<double>("jurassicWidth");
60 
61 
62  // options
63  useIsolEt_ = conf_.getParameter<bool>("useIsolEt");
64  tryBoth_ = conf_.getParameter<bool>("tryBoth");
65  subtract_ = conf_.getParameter<bool>("subtract");
66  useNumCrystals_ = conf_.getParameter<bool>("useNumCrystals");
67 
68  //register your products
69  produces < reco::RecoEcalCandidateIsolationMap >();
70 
71 }
T getParameter(std::string const &) const
EgammaHLTEcalRecIsolationProducer::~EgammaHLTEcalRecIsolationProducer ( )

Definition at line 73 of file EgammaHLTEcalRecIsolationProducer.cc.

73 {}

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 77 of file EgammaHLTEcalRecIsolationProducer.cc.

References begin, DetId::Ecal, ecalBarrelRecHitCollection_, ecalBarrelRecHitProducer_, ecalEndcapRecHitCollection_, ecalEndcapRecHitProducer_, egIsoConeSizeInBarrel_, egIsoConeSizeInEndcap_, egIsoConeSizeOut_, egIsoEMinBarrel_, egIsoEMinEndcap_, egIsoJurassicWidth_, egIsoPtMinBarrel_, egIsoPtMinEndcap_, funct::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::ESHandle< class >::product(), edm::Event::put(), recoEcalCandidateProducer_, EgammaRecHitIsolation::setUseNumCrystals(), funct::sin(), subtract_, tryBoth_, useIsolEt_, and useNumCrystals_.

77  {
78 
79  // Get the RecoEcalCandidate Collection
81  iEvent.getByLabel(recoEcalCandidateProducer_,recoecalcandHandle);
82 
83  // Next get Ecal hits barrel
84  edm::Handle<EcalRecHitCollection> ecalBarrelRecHitHandle; //EcalRecHitCollection is a typedef to
86 
87  // Next get Ecal hits endcap
88  edm::Handle<EcalRecHitCollection> ecalEndcapRecHitHandle;
90 
91  //create the meta hit collections inorder that we can pass them into the isolation objects
92 
93  EcalRecHitMetaCollection ecalBarrelHits(*ecalBarrelRecHitHandle);
94  EcalRecHitMetaCollection ecalEndcapHits(*ecalEndcapRecHitHandle);
95 
96  //Get Calo Geometry
98  iSetup.get<CaloGeometryRecord>().get(pG);
99  const CaloGeometry* caloGeom = pG.product();
100 
102  iSetup.get<EcalSeverityLevelAlgoRcd>().get(sevlv);
103  const EcalSeverityLevelAlgo* sevLevel = sevlv.product();
104 
105  //prepare product
107 
108  //create algorithm objects
110  ecalBarrelIsol.setUseNumCrystals(useNumCrystals_);
112  ecalEndcapIsol.setUseNumCrystals(useNumCrystals_);
113 
114  for (reco::RecoEcalCandidateCollection::const_iterator iRecoEcalCand= recoecalcandHandle->begin(); iRecoEcalCand!=recoecalcandHandle->end(); iRecoEcalCand++) {
115 
116  //create reference for storage in isolation map
117  reco::RecoEcalCandidateRef recoecalcandref(reco::RecoEcalCandidateRef(recoecalcandHandle,iRecoEcalCand -recoecalcandHandle ->begin()));
118 
119  //ecal isolation is centered on supecluster
120  reco::SuperClusterRef superClus = iRecoEcalCand->get<reco::SuperClusterRef>();
121 
122  //i need to know if its in the barrel/endcap so I get the supercluster handle to find out the detector eta
123  //this might not be the best way, are we guaranteed that eta<1.5 is barrel
124  //this can be safely replaced by another method which determines where the emobject is
125  //then we either get the isolation Et or isolation Energy depending on user selection
126  float isol =0.;
127 
128  if(tryBoth_){ //barrel + endcap
129  if(useIsolEt_) isol = ecalBarrelIsol.getEtSum(&(*iRecoEcalCand)) + ecalEndcapIsol.getEtSum(&(*iRecoEcalCand));
130  else isol = ecalBarrelIsol.getEnergySum(&(*iRecoEcalCand)) + ecalEndcapIsol.getEnergySum(&(*iRecoEcalCand));
131  }
132  else if( fabs(superClus->eta())<1.479) { //barrel
133  if(useIsolEt_) isol = ecalBarrelIsol.getEtSum(&(*iRecoEcalCand));
134  else isol = ecalBarrelIsol.getEnergySum(&(*iRecoEcalCand));
135  }
136  else{ //endcap
137  if(useIsolEt_) isol = ecalEndcapIsol.getEtSum(&(*iRecoEcalCand));
138  else isol = ecalEndcapIsol.getEnergySum(&(*iRecoEcalCand));
139  }
140 
141  //we subtract off the electron energy here as well
142  double subtractVal=0;
143 
144  if(useIsolEt_) subtractVal = superClus.get()->rawEnergy()*sin(2*atan(exp(-superClus.get()->eta())));
145  else subtractVal = superClus.get()->rawEnergy();
146 
147  if(subtract_) isol-= subtractVal;
148 
149 
150 
151  isoMap.insert(recoecalcandref, isol);
152 
153  }
154 
155  std::auto_ptr<reco::RecoEcalCandidateIsolationMap> isolMap(new reco::RecoEcalCandidateIsolationMap(isoMap));
156  iEvent.put(isolMap);
157 
158 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Exp< T >::type exp(const T &t)
Definition: Exp.h:22
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:84
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
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
std::string const & label() const
Definition: InputTag.h:25
#define begin
Definition: vmac.h:31
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:241

Member Data Documentation

edm::ParameterSet EgammaHLTEcalRecIsolationProducer::conf_
private
edm::InputTag EgammaHLTEcalRecIsolationProducer::ecalBarrelRecHitCollection_
private
edm::InputTag EgammaHLTEcalRecIsolationProducer::ecalBarrelRecHitProducer_
private
edm::InputTag EgammaHLTEcalRecIsolationProducer::ecalEndcapRecHitCollection_
private
edm::InputTag EgammaHLTEcalRecIsolationProducer::ecalEndcapRecHitProducer_
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
bool EgammaHLTEcalRecIsolationProducer::subtract_
private
bool EgammaHLTEcalRecIsolationProducer::tryBoth_
private
bool EgammaHLTEcalRecIsolationProducer::useIsolEt_
private
bool EgammaHLTEcalRecIsolationProducer::useNumCrystals_
private