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 ( const edm::ParameterSet config)
explicit

Definition at line 30 of file EgammaEcalRecHitIsolationProducer.cc.

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

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 }
T getParameter(std::string const &) const
EgammaEcalRecHitIsolationProducer::~EgammaEcalRecHitIsolationProducer ( )
override

Definition at line 60 of file EgammaEcalRecHitIsolationProducer.cc.

60 {}

Member Function Documentation

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

Definition at line 67 of file EgammaEcalRecHitIsolationProducer.cc.

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(), edm::Ref< C, T, F >::get(), edm::Event::getByLabel(), EgammaRecHitIsolation::getEnergySum(), EgammaRecHitIsolation::getEtSum(), mps_fire::i, edm::InputTag::label(), eostools::move(), edm::ESHandle< T >::product(), edm::Event::put(), EgammaRecHitIsolation::setUseNumCrystals(), EgammaRecHitIsolation::setVetoClustered(), funct::sin(), subtract_, tryBoth_, useIsolEt_, useNumCrystals_, and vetoClustered_.

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 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:232
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:488
std::string const & label() const
Definition: InputTag.h:36
T get() const
Definition: EventSetup.h:73
T const * product() const
Definition: ESHandle.h:86
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

edm::ParameterSet EgammaEcalRecHitIsolationProducer::conf_
private
edm::InputTag EgammaEcalRecHitIsolationProducer::ecalBarrelRecHitCollection_
private
edm::InputTag EgammaEcalRecHitIsolationProducer::ecalBarrelRecHitProducer_
private
edm::InputTag EgammaEcalRecHitIsolationProducer::ecalEndcapRecHitCollection_
private
edm::InputTag EgammaEcalRecHitIsolationProducer::ecalEndcapRecHitProducer_
private
double EgammaEcalRecHitIsolationProducer::egIsoConeSizeInBarrel_
private
double EgammaEcalRecHitIsolationProducer::egIsoConeSizeInEndcap_
private
double EgammaEcalRecHitIsolationProducer::egIsoConeSizeOut_
private
double EgammaEcalRecHitIsolationProducer::egIsoEMinBarrel_
private
double EgammaEcalRecHitIsolationProducer::egIsoEMinEndcap_
private
double EgammaEcalRecHitIsolationProducer::egIsoJurassicWidth_
private
double EgammaEcalRecHitIsolationProducer::egIsoPtMinBarrel_
private
double EgammaEcalRecHitIsolationProducer::egIsoPtMinEndcap_
private
edm::InputTag EgammaEcalRecHitIsolationProducer::emObjectProducer_
private
bool EgammaEcalRecHitIsolationProducer::subtract_
private
bool EgammaEcalRecHitIsolationProducer::tryBoth_
private
bool EgammaEcalRecHitIsolationProducer::useIsolEt_
private
bool EgammaEcalRecHitIsolationProducer::useNumCrystals_
private
bool EgammaEcalRecHitIsolationProducer::vetoClustered_
private