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 hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

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 emObjectProducer_
 
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 33 of file EgammaEcalRecHitIsolationProducer.h.

Constructor & Destructor Documentation

◆ EgammaEcalRecHitIsolationProducer()

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

Definition at line 30 of file EgammaEcalRecHitIsolationProducer.cc.

30  : conf_(config) {
31  // use configuration file to setup input/output collection names
32  //inputs
33  emObjectProducer_ = conf_.getParameter<edm::InputTag>("emObjectProducer");
34  ecalBarrelRecHitProducer_ = conf_.getParameter<edm::InputTag>("ecalBarrelRecHitProducer");
35  ecalBarrelRecHitCollection_ = conf_.getParameter<edm::InputTag>("ecalBarrelRecHitCollection");
36  ecalEndcapRecHitProducer_ = conf_.getParameter<edm::InputTag>("ecalEndcapRecHitProducer");
37  ecalEndcapRecHitCollection_ = conf_.getParameter<edm::InputTag>("ecalEndcapRecHitCollection");
38 
39  //vetos
40  egIsoPtMinBarrel_ = conf_.getParameter<double>("etMinBarrel");
41  egIsoEMinBarrel_ = conf_.getParameter<double>("eMinBarrel");
42  egIsoPtMinEndcap_ = conf_.getParameter<double>("etMinEndcap");
43  egIsoEMinEndcap_ = conf_.getParameter<double>("eMinEndcap");
44  egIsoConeSizeInBarrel_ = conf_.getParameter<double>("intRadiusBarrel");
45  egIsoConeSizeInEndcap_ = conf_.getParameter<double>("intRadiusEndcap");
46  egIsoConeSizeOut_ = conf_.getParameter<double>("extRadius");
47  egIsoJurassicWidth_ = conf_.getParameter<double>("jurassicWidth");
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  vetoClustered_ = conf_.getParameter<bool>("vetoClustered");
55 
56  //register your products
57  produces<edm::ValueMap<double>>();
58 }

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

◆ ~EgammaEcalRecHitIsolationProducer()

EgammaEcalRecHitIsolationProducer::~EgammaEcalRecHitIsolationProducer ( )
override

Definition at line 60 of file EgammaEcalRecHitIsolationProducer.cc.

60 {}

Member Function Documentation

◆ produce()

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

Definition at line 67 of file EgammaEcalRecHitIsolationProducer.cc.

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

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

Member Data Documentation

◆ 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

◆ 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:55
EgammaEcalRecHitIsolationProducer::subtract_
bool subtract_
Definition: EgammaEcalRecHitIsolationProducer.h:60
mps_fire.i
i
Definition: mps_fire.py:355
EgammaEcalRecHitIsolationProducer::egIsoEMinBarrel_
double egIsoEMinBarrel_
Definition: EgammaEcalRecHitIsolationProducer.h:50
EgammaEcalRecHitIsolationProducer::egIsoConeSizeOut_
double egIsoConeSizeOut_
Definition: EgammaEcalRecHitIsolationProducer.h:53
CaloGeometryRecord
Definition: CaloGeometryRecord.h:30
EgammaEcalRecHitIsolationProducer::useIsolEt_
bool useIsolEt_
Definition: EgammaEcalRecHitIsolationProducer.h:58
EgammaEcalRecHitIsolationProducer::ecalEndcapRecHitProducer_
edm::InputTag ecalEndcapRecHitProducer_
Definition: EgammaEcalRecHitIsolationProducer.h:46
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:45
EgammaEcalRecHitIsolationProducer::egIsoEMinEndcap_
double egIsoEMinEndcap_
Definition: EgammaEcalRecHitIsolationProducer.h:52
EgammaRecHitIsolation
Definition: EgammaRecHitIsolation.h:26
EgammaEcalRecHitIsolationProducer::tryBoth_
bool tryBoth_
Definition: EgammaEcalRecHitIsolationProducer.h:59
EgammaEcalRecHitIsolationProducer::vetoClustered_
bool vetoClustered_
Definition: EgammaEcalRecHitIsolationProducer.h:63
edm::Handle
Definition: AssociativeIterator.h:50
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
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
EgammaEcalRecHitIsolationProducer::ecalBarrelRecHitProducer_
edm::InputTag ecalBarrelRecHitProducer_
Definition: EgammaEcalRecHitIsolationProducer.h:44
EgammaEcalRecHitIsolationProducer::egIsoJurassicWidth_
double egIsoJurassicWidth_
Definition: EgammaEcalRecHitIsolationProducer.h:56
EgammaEcalRecHitIsolationProducer::useNumCrystals_
bool useNumCrystals_
Definition: EgammaEcalRecHitIsolationProducer.h:62
EgammaEcalRecHitIsolationProducer::egIsoConeSizeInBarrel_
double egIsoConeSizeInBarrel_
Definition: EgammaEcalRecHitIsolationProducer.h:54
edm::ESHandle< EcalSeverityLevelAlgo >
EcalSeverityLevelAlgoRcd
Definition: EcalSeverityLevelAlgoRcd.h:12
EgammaEcalRecHitIsolationProducer::emObjectProducer_
edm::InputTag emObjectProducer_
Definition: EgammaEcalRecHitIsolationProducer.h:43
EgammaEcalRecHitIsolationProducer::ecalEndcapRecHitCollection_
edm::InputTag ecalEndcapRecHitCollection_
Definition: EgammaEcalRecHitIsolationProducer.h:47
EgammaEcalRecHitIsolationProducer::egIsoPtMinBarrel_
double egIsoPtMinBarrel_
Definition: EgammaEcalRecHitIsolationProducer.h:49
trigObjTnPSource_cfi.filler
filler
Definition: trigObjTnPSource_cfi.py:21
iEvent
int iEvent
Definition: GenABIO.cc:224
EgammaEcalRecHitIsolationProducer::conf_
edm::ParameterSet conf_
Definition: EgammaEcalRecHitIsolationProducer.h:65
EgammaEcalRecHitIsolationProducer::egIsoPtMinEndcap_
double egIsoPtMinEndcap_
Definition: EgammaEcalRecHitIsolationProducer.h:51
DetId::Ecal
Definition: DetId.h:27
get
#define get
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::helper::Filler
Definition: ValueMap.h:22
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
edm::InputTag
Definition: InputTag.h:15