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 hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () 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 34 of file EgammaEcalRecHitIsolationProducer.h.

Constructor & Destructor Documentation

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

Definition at line 31 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_.

31  : conf_(config)
32 {
33  // use configuration file to setup input/output collection names
34  //inputs
35  emObjectProducer_ = conf_.getParameter<edm::InputTag>("emObjectProducer");
36  ecalBarrelRecHitProducer_ = conf_.getParameter<edm::InputTag>("ecalBarrelRecHitProducer");
37  ecalBarrelRecHitCollection_ = conf_.getParameter<edm::InputTag>("ecalBarrelRecHitCollection");
38  ecalEndcapRecHitProducer_ = conf_.getParameter<edm::InputTag>("ecalEndcapRecHitProducer");
39  ecalEndcapRecHitCollection_ = conf_.getParameter<edm::InputTag>("ecalEndcapRecHitCollection");
40 
41  //vetos
42  egIsoPtMinBarrel_ = conf_.getParameter<double>("etMinBarrel");
43  egIsoEMinBarrel_ = conf_.getParameter<double>("eMinBarrel");
44  egIsoPtMinEndcap_ = conf_.getParameter<double>("etMinEndcap");
45  egIsoEMinEndcap_ = conf_.getParameter<double>("eMinEndcap");
46  egIsoConeSizeInBarrel_ = conf_.getParameter<double>("intRadiusBarrel");
47  egIsoConeSizeInEndcap_ = conf_.getParameter<double>("intRadiusEndcap");
48  egIsoConeSizeOut_ = conf_.getParameter<double>("extRadius");
49  egIsoJurassicWidth_ = conf_.getParameter<double>("jurassicWidth");
50 
51 
52 
53  // options
54  useIsolEt_ = conf_.getParameter<bool>("useIsolEt");
55  tryBoth_ = conf_.getParameter<bool>("tryBoth");
56  subtract_ = conf_.getParameter<bool>("subtract");
57  useNumCrystals_ = conf_.getParameter<bool>("useNumCrystals");
58  vetoClustered_ = conf_.getParameter<bool>("vetoClustered");
59 
60  //register your products
61  produces < edm::ValueMap<double> >();
62 }
T getParameter(std::string const &) const
EgammaEcalRecHitIsolationProducer::~EgammaEcalRecHitIsolationProducer ( )
override

Definition at line 65 of file EgammaEcalRecHitIsolationProducer.cc.

65 {}

Member Function Documentation

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

Definition at line 74 of file EgammaEcalRecHitIsolationProducer.cc.

References DetId::Ecal, ecalBarrelRecHitCollection_, ecalBarrelRecHitProducer_, ecalEndcapRecHitCollection_, ecalEndcapRecHitProducer_, egIsoConeSizeInBarrel_, egIsoConeSizeInEndcap_, egIsoConeSizeOut_, egIsoEMinBarrel_, egIsoEMinEndcap_, egIsoJurassicWidth_, egIsoPtMinBarrel_, egIsoPtMinEndcap_, emObjectProducer_, JetChargeProducer_cfi::exp, objects.autophobj::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_.

75 {
76 
77 
78  // Get the filtered objects
80  iEvent.getByLabel(emObjectProducer_,emObjectHandle);
81 
82  // Next get Ecal hits barrel
83  edm::Handle<EcalRecHitCollection> ecalBarrelRecHitHandle; //EcalRecHitCollection is a typedef to
85 
86  // Next get Ecal hits endcap
87  edm::Handle<EcalRecHitCollection> ecalEndcapRecHitHandle;
89 
91  iSetup.get<EcalSeverityLevelAlgoRcd>().get(sevlv);
92  const EcalSeverityLevelAlgo* sevLevel = sevlv.product();
93 
94  //Get Calo Geometry
96  iSetup.get<CaloGeometryRecord>().get(pG);
97  const CaloGeometry* caloGeom = pG.product();
98 
99  //reco::CandViewDoubleAssociations* isoMap = new reco::CandViewDoubleAssociations( reco::CandidateBaseRefProd( emObjectHandle ) );
100  auto isoMap = std::make_unique<edm::ValueMap<double>>();
102  std::vector<double> retV(emObjectHandle->size(),0);
103 
105  ecalBarrelIsol.setUseNumCrystals(useNumCrystals_);
106  ecalBarrelIsol.setVetoClustered(vetoClustered_);
107 
109  ecalEndcapIsol.setUseNumCrystals(useNumCrystals_);
110  ecalEndcapIsol.setVetoClustered(vetoClustered_);
111 
112 
113  for( size_t i = 0 ; i < emObjectHandle->size(); ++i) {
114 
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_) isoValue = ecalBarrelIsol.getEtSum(&(emObjectHandle->at(i))) + ecalEndcapIsol.getEtSum(&(emObjectHandle->at(i)));
125  else isoValue = ecalBarrelIsol.getEnergySum(&(emObjectHandle->at(i))) + ecalEndcapIsol.getEnergySum(&(emObjectHandle->at(i)));
126  }
127  else if( fabs(superClus->eta())<1.479) { //barrel
128  if(useIsolEt_) isoValue = ecalBarrelIsol.getEtSum(&(emObjectHandle->at(i)));
129  else isoValue = ecalBarrelIsol.getEnergySum(&(emObjectHandle->at(i)));
130  }
131  else{ //endcap
132  if(useIsolEt_) isoValue = ecalEndcapIsol.getEtSum(&(emObjectHandle->at(i)));
133  else isoValue = ecalEndcapIsol.getEnergySum(&(emObjectHandle->at(i)));
134  }
135 
136  //we subtract off the electron energy here as well
137  double subtractVal=0;
138 
139  if(useIsolEt_) subtractVal = superClus.get()->rawEnergy()*sin(2*atan(exp(-superClus.get()->eta())));
140  else subtractVal = superClus.get()->rawEnergy();
141 
142  if(subtract_) isoValue-= subtractVal;
143 
144  retV[i]=isoValue;
145  //all done, isolation is now in the map
146 
147  }//end of loop over em objects
148 
149  filler.insert(emObjectHandle,retV.begin(),retV.end());
150  filler.fill();
151 
152  iEvent.put(std::move(isoMap));
153 
154 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:245
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:535
std::string const & label() const
Definition: InputTag.h:36
T get() const
Definition: EventSetup.h:63
T const * product() const
Definition: ESHandle.h:86
def move(src, dest)
Definition: eostools.py:510

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