CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
EgammaEcalRecHitIsolationProducer Class Reference

#include <EgammaEcalRecHitIsolationProducer.h>

Inheritance diagram for EgammaEcalRecHitIsolationProducer:
edm::stream::EDProducer<>

Public Member Functions

 EgammaEcalRecHitIsolationProducer (const edm::ParameterSet &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~EgammaEcalRecHitIsolationProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Attributes

edm::ESGetToken< CaloGeometry, CaloGeometryRecordcaloGeometrytoken_
 
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 emObjectProducer_
 
edm::ESGetToken< EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcdsevLvToken_
 
bool subtract_
 
bool tryBoth_
 
bool useIsolEt_
 
bool useNumCrystals_
 
bool vetoClustered_
 

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, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Definition at line 40 of file EgammaEcalRecHitIsolationProducer.h.

Constructor & Destructor Documentation

◆ EgammaEcalRecHitIsolationProducer()

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

Definition at line 24 of file EgammaEcalRecHitIsolationProducer.cc.

24  : conf_(config) {
25  // use configuration file to setup input/output collection names
26  //inputs
27  emObjectProducer_ = conf_.getParameter<edm::InputTag>("emObjectProducer");
28  ecalBarrelRecHitProducer_ = conf_.getParameter<edm::InputTag>("ecalBarrelRecHitProducer");
29  ecalBarrelRecHitCollection_ = conf_.getParameter<edm::InputTag>("ecalBarrelRecHitCollection");
30  ecalEndcapRecHitProducer_ = conf_.getParameter<edm::InputTag>("ecalEndcapRecHitProducer");
31  ecalEndcapRecHitCollection_ = conf_.getParameter<edm::InputTag>("ecalEndcapRecHitCollection");
32 
33  //vetos
34  egIsoPtMinBarrel_ = conf_.getParameter<double>("etMinBarrel");
35  egIsoEMinBarrel_ = conf_.getParameter<double>("eMinBarrel");
36  egIsoPtMinEndcap_ = conf_.getParameter<double>("etMinEndcap");
37  egIsoEMinEndcap_ = conf_.getParameter<double>("eMinEndcap");
38  egIsoConeSizeInBarrel_ = conf_.getParameter<double>("intRadiusBarrel");
39  egIsoConeSizeInEndcap_ = conf_.getParameter<double>("intRadiusEndcap");
40  egIsoConeSizeOut_ = conf_.getParameter<double>("extRadius");
41  egIsoJurassicWidth_ = conf_.getParameter<double>("jurassicWidth");
42 
43  // options
44  useIsolEt_ = conf_.getParameter<bool>("useIsolEt");
45  tryBoth_ = conf_.getParameter<bool>("tryBoth");
46  subtract_ = conf_.getParameter<bool>("subtract");
47  useNumCrystals_ = conf_.getParameter<bool>("useNumCrystals");
48  vetoClustered_ = conf_.getParameter<bool>("vetoClustered");
49 
50  //EventSetup Tokens
51  sevLvToken_ = esConsumes();
52  caloGeometrytoken_ = esConsumes();
53 
54  //register your products
55  produces<edm::ValueMap<double>>();
56 }

References caloGeometrytoken_, conf_, ecalBarrelRecHitCollection_, ecalBarrelRecHitProducer_, ecalEndcapRecHitCollection_, ecalEndcapRecHitProducer_, egIsoConeSizeInBarrel_, egIsoConeSizeInEndcap_, egIsoConeSizeOut_, egIsoEMinBarrel_, egIsoEMinEndcap_, egIsoJurassicWidth_, egIsoPtMinBarrel_, egIsoPtMinEndcap_, emObjectProducer_, edm::ParameterSet::getParameter(), sevLvToken_, subtract_, tryBoth_, useIsolEt_, useNumCrystals_, and vetoClustered_.

◆ ~EgammaEcalRecHitIsolationProducer()

EgammaEcalRecHitIsolationProducer::~EgammaEcalRecHitIsolationProducer ( )
override

Definition at line 58 of file EgammaEcalRecHitIsolationProducer.cc.

58 {}

Member Function Documentation

◆ produce()

void EgammaEcalRecHitIsolationProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 65 of file EgammaEcalRecHitIsolationProducer.cc.

65  {
66  // Get the filtered objects
68  iEvent.getByLabel(emObjectProducer_, emObjectHandle);
69 
70  // Next get Ecal hits barrel
71  edm::Handle<EcalRecHitCollection> ecalBarrelRecHitHandle; //EcalRecHitCollection is a typedef to
72  iEvent.getByLabel(ecalBarrelRecHitProducer_.label(), ecalBarrelRecHitCollection_.label(), ecalBarrelRecHitHandle);
73 
74  // Next get Ecal hits endcap
75  edm::Handle<EcalRecHitCollection> ecalEndcapRecHitHandle;
76  iEvent.getByLabel(ecalEndcapRecHitProducer_.label(), ecalEndcapRecHitCollection_.label(), ecalEndcapRecHitHandle);
77 
79  const EcalSeverityLevelAlgo* sevLevel = sevlv.product();
80 
81  //Get Calo Geometry
83  const CaloGeometry* caloGeom = pG.product();
84 
85  //reco::CandViewDoubleAssociations* isoMap = new reco::CandViewDoubleAssociations( reco::CandidateBaseRefProd( emObjectHandle ) );
86  auto isoMap = std::make_unique<edm::ValueMap<double>>();
88  std::vector<double> retV(emObjectHandle->size(), 0);
89 
95  caloGeom,
96  *ecalBarrelRecHitHandle,
97  sevLevel,
98  DetId::Ecal);
99  ecalBarrelIsol.setUseNumCrystals(useNumCrystals_);
100  ecalBarrelIsol.setVetoClustered(vetoClustered_);
101 
107  caloGeom,
108  *ecalEndcapRecHitHandle,
109  sevLevel,
110  DetId::Ecal);
111  ecalEndcapIsol.setUseNumCrystals(useNumCrystals_);
112  ecalEndcapIsol.setVetoClustered(vetoClustered_);
113 
114  for (size_t i = 0; i < emObjectHandle->size(); ++i) {
115  //i need to know if its in the barrel/endcap so I get the supercluster handle to find out the detector eta
116  //this might not be the best way, are we guaranteed that eta<1.5 is barrel
117  //this can be safely replaced by another method which determines where the emobject is
118  //then we either get the isolation Et or isolation Energy depending on user selection
119  double isoValue = 0.;
120 
121  reco::SuperClusterRef superClus = emObjectHandle->at(i).get<reco::SuperClusterRef>();
122 
123  if (tryBoth_) { //barrel + endcap
124  if (useIsolEt_)
125  isoValue =
126  ecalBarrelIsol.getEtSum(&(emObjectHandle->at(i))) + ecalEndcapIsol.getEtSum(&(emObjectHandle->at(i)));
127  else
128  isoValue = ecalBarrelIsol.getEnergySum(&(emObjectHandle->at(i))) +
129  ecalEndcapIsol.getEnergySum(&(emObjectHandle->at(i)));
130  } else if (fabs(superClus->eta()) < 1.479) { //barrel
131  if (useIsolEt_)
132  isoValue = ecalBarrelIsol.getEtSum(&(emObjectHandle->at(i)));
133  else
134  isoValue = ecalBarrelIsol.getEnergySum(&(emObjectHandle->at(i)));
135  } else { //endcap
136  if (useIsolEt_)
137  isoValue = ecalEndcapIsol.getEtSum(&(emObjectHandle->at(i)));
138  else
139  isoValue = ecalEndcapIsol.getEnergySum(&(emObjectHandle->at(i)));
140  }
141 
142  //we subtract off the electron energy here as well
143  double subtractVal = 0;
144 
145  if (useIsolEt_)
146  subtractVal = superClus.get()->rawEnergy() * sin(2 * atan(exp(-superClus.get()->eta())));
147  else
148  subtractVal = superClus.get()->rawEnergy();
149 
150  if (subtract_)
151  isoValue -= subtractVal;
152 
153  retV[i] = isoValue;
154  //all done, isolation is now in the map
155 
156  } //end of loop over em objects
157 
158  filler.insert(emObjectHandle, retV.begin(), retV.end());
159  filler.fill();
160 
161  iEvent.put(std::move(isoMap));
162 }

References caloGeometrytoken_, DetId::Ecal, ecalBarrelRecHitCollection_, ecalBarrelRecHitProducer_, ecalEndcapRecHitCollection_, ecalEndcapRecHitProducer_, egIsoConeSizeInBarrel_, egIsoConeSizeInEndcap_, egIsoConeSizeOut_, egIsoEMinBarrel_, egIsoEMinEndcap_, egIsoJurassicWidth_, egIsoPtMinBarrel_, egIsoPtMinEndcap_, emObjectProducer_, JetChargeProducer_cfi::exp, trigObjTnPSource_cfi::filler, edm::Ref< C, T, F >::get(), EgammaRecHitIsolation::getEnergySum(), EgammaRecHitIsolation::getEtSum(), edm::EventSetup::getHandle(), mps_fire::i, iEvent, edm::InputTag::label(), eostools::move(), edm::ESHandle< T >::product(), EgammaRecHitIsolation::setUseNumCrystals(), EgammaRecHitIsolation::setVetoClustered(), sevLvToken_, funct::sin(), subtract_, tryBoth_, useIsolEt_, useNumCrystals_, and vetoClustered_.

Member Data Documentation

◆ caloGeometrytoken_

edm::ESGetToken<CaloGeometry, CaloGeometryRecord> EgammaEcalRecHitIsolationProducer::caloGeometrytoken_
private

◆ conf_

edm::ParameterSet EgammaEcalRecHitIsolationProducer::conf_
private

◆ ecalBarrelRecHitCollection_

edm::InputTag EgammaEcalRecHitIsolationProducer::ecalBarrelRecHitCollection_
private

◆ ecalBarrelRecHitProducer_

edm::InputTag EgammaEcalRecHitIsolationProducer::ecalBarrelRecHitProducer_
private

◆ ecalEndcapRecHitCollection_

edm::InputTag EgammaEcalRecHitIsolationProducer::ecalEndcapRecHitCollection_
private

◆ ecalEndcapRecHitProducer_

edm::InputTag EgammaEcalRecHitIsolationProducer::ecalEndcapRecHitProducer_
private

◆ egIsoConeSizeInBarrel_

double EgammaEcalRecHitIsolationProducer::egIsoConeSizeInBarrel_
private

◆ egIsoConeSizeInEndcap_

double EgammaEcalRecHitIsolationProducer::egIsoConeSizeInEndcap_
private

◆ egIsoConeSizeOut_

double EgammaEcalRecHitIsolationProducer::egIsoConeSizeOut_
private

◆ egIsoEMinBarrel_

double EgammaEcalRecHitIsolationProducer::egIsoEMinBarrel_
private

◆ egIsoEMinEndcap_

double EgammaEcalRecHitIsolationProducer::egIsoEMinEndcap_
private

◆ egIsoJurassicWidth_

double EgammaEcalRecHitIsolationProducer::egIsoJurassicWidth_
private

◆ egIsoPtMinBarrel_

double EgammaEcalRecHitIsolationProducer::egIsoPtMinBarrel_
private

◆ egIsoPtMinEndcap_

double EgammaEcalRecHitIsolationProducer::egIsoPtMinEndcap_
private

◆ emObjectProducer_

edm::InputTag EgammaEcalRecHitIsolationProducer::emObjectProducer_
private

◆ sevLvToken_

edm::ESGetToken<EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd> EgammaEcalRecHitIsolationProducer::sevLvToken_
private

◆ subtract_

bool EgammaEcalRecHitIsolationProducer::subtract_
private

◆ tryBoth_

bool EgammaEcalRecHitIsolationProducer::tryBoth_
private

◆ useIsolEt_

bool EgammaEcalRecHitIsolationProducer::useIsolEt_
private

◆ useNumCrystals_

bool EgammaEcalRecHitIsolationProducer::useNumCrystals_
private

◆ vetoClustered_

bool EgammaEcalRecHitIsolationProducer::vetoClustered_
private
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
EcalSeverityLevelAlgo
Definition: EcalSeverityLevelAlgo.h:33
EgammaEcalRecHitIsolationProducer::egIsoConeSizeInEndcap_
double egIsoConeSizeInEndcap_
Definition: EgammaEcalRecHitIsolationProducer.h:62
EgammaEcalRecHitIsolationProducer::subtract_
bool subtract_
Definition: EgammaEcalRecHitIsolationProducer.h:67
mps_fire.i
i
Definition: mps_fire.py:428
EgammaEcalRecHitIsolationProducer::egIsoEMinBarrel_
double egIsoEMinBarrel_
Definition: EgammaEcalRecHitIsolationProducer.h:57
EgammaEcalRecHitIsolationProducer::egIsoConeSizeOut_
double egIsoConeSizeOut_
Definition: EgammaEcalRecHitIsolationProducer.h:60
EgammaEcalRecHitIsolationProducer::useIsolEt_
bool useIsolEt_
Definition: EgammaEcalRecHitIsolationProducer.h:65
EgammaEcalRecHitIsolationProducer::ecalEndcapRecHitProducer_
edm::InputTag ecalEndcapRecHitProducer_
Definition: EgammaEcalRecHitIsolationProducer.h:53
edm::Ref::get
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:232
EgammaEcalRecHitIsolationProducer::ecalBarrelRecHitCollection_
edm::InputTag ecalBarrelRecHitCollection_
Definition: EgammaEcalRecHitIsolationProducer.h:52
EgammaEcalRecHitIsolationProducer::egIsoEMinEndcap_
double egIsoEMinEndcap_
Definition: EgammaEcalRecHitIsolationProducer.h:59
EgammaRecHitIsolation
Definition: EgammaRecHitIsolation.h:26
EgammaEcalRecHitIsolationProducer::tryBoth_
bool tryBoth_
Definition: EgammaEcalRecHitIsolationProducer.h:66
EgammaEcalRecHitIsolationProducer::vetoClustered_
bool vetoClustered_
Definition: EgammaEcalRecHitIsolationProducer.h:70
edm::Handle
Definition: AssociativeIterator.h:50
EgammaEcalRecHitIsolationProducer::sevLvToken_
edm::ESGetToken< EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd > sevLvToken_
Definition: EgammaEcalRecHitIsolationProducer.h:73
edm::Ref< SuperClusterCollection >
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
config
Definition: config.py:1
edm::InputTag::label
std::string const & label() const
Definition: InputTag.h:36
CaloGeometry
Definition: CaloGeometry.h:21
EgammaEcalRecHitIsolationProducer::ecalBarrelRecHitProducer_
edm::InputTag ecalBarrelRecHitProducer_
Definition: EgammaEcalRecHitIsolationProducer.h:51
EgammaEcalRecHitIsolationProducer::caloGeometrytoken_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometrytoken_
Definition: EgammaEcalRecHitIsolationProducer.h:74
EgammaEcalRecHitIsolationProducer::egIsoJurassicWidth_
double egIsoJurassicWidth_
Definition: EgammaEcalRecHitIsolationProducer.h:63
EgammaEcalRecHitIsolationProducer::useNumCrystals_
bool useNumCrystals_
Definition: EgammaEcalRecHitIsolationProducer.h:69
EgammaEcalRecHitIsolationProducer::egIsoConeSizeInBarrel_
double egIsoConeSizeInBarrel_
Definition: EgammaEcalRecHitIsolationProducer.h:61
edm::ESHandle< EcalSeverityLevelAlgo >
EgammaEcalRecHitIsolationProducer::emObjectProducer_
edm::InputTag emObjectProducer_
Definition: EgammaEcalRecHitIsolationProducer.h:50
EgammaEcalRecHitIsolationProducer::ecalEndcapRecHitCollection_
edm::InputTag ecalEndcapRecHitCollection_
Definition: EgammaEcalRecHitIsolationProducer.h:54
EgammaEcalRecHitIsolationProducer::egIsoPtMinBarrel_
double egIsoPtMinBarrel_
Definition: EgammaEcalRecHitIsolationProducer.h:56
trigObjTnPSource_cfi.filler
filler
Definition: trigObjTnPSource_cfi.py:21
iEvent
int iEvent
Definition: GenABIO.cc:224
EgammaEcalRecHitIsolationProducer::conf_
edm::ParameterSet conf_
Definition: EgammaEcalRecHitIsolationProducer.h:72
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:148
EgammaEcalRecHitIsolationProducer::egIsoPtMinEndcap_
double egIsoPtMinEndcap_
Definition: EgammaEcalRecHitIsolationProducer.h:58
DetId::Ecal
Definition: DetId.h:27
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::helper::Filler
Definition: ValueMap.h:22
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
edm::InputTag
Definition: InputTag.h:15