CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Attributes
EgammaEcalRecHitIsolationProducer Class Reference
Inheritance diagram for EgammaEcalRecHitIsolationProducer:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 EgammaEcalRecHitIsolationProducer (const edm::ParameterSet &)
 
void produce (edm::StreamID, edm::Event &, const edm::EventSetup &) const override
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector
< edm::ProductResolverIndex >
const & 
indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector
< edm::ProductResolverIndex >
const & 
putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex >
const & 
esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector
< ProductResolverIndexAndSkipBit >
const & 
itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

edm::ESGetToken< CaloGeometry,
CaloGeometryRecord
caloGeometrytoken_
 
const edm::EDGetTokenT
< EcalRecHitCollection
ecalBarrelRecHitCollection_
 
const edm::EDGetTokenT
< EcalRecHitCollection
ecalEndcapRecHitCollection_
 
double egIsoConeSizeInBarrel_
 
double egIsoConeSizeInEndcap_
 
double egIsoConeSizeOut_
 
double egIsoEMinBarrel_
 
double egIsoEMinEndcap_
 
double egIsoJurassicWidth_
 
double egIsoPtMinBarrel_
 
double egIsoPtMinEndcap_
 
const edm::EDGetTokenT
< edm::View< reco::Candidate > > 
emObjectProducer_
 
edm::ESGetToken
< EcalSeverityLevelAlgo,
EcalSeverityLevelAlgoRcd
sevLvToken_
 
bool subtract_
 
bool tryBoth_
 
bool useIsolEt_
 
bool useNumCrystals_
 
bool vetoClustered_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 29 of file EgammaEcalRecHitIsolationProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 63 of file EgammaEcalRecHitIsolationProducer.cc.

References edm::EDConsumerBase::consumes(), and edm::ParameterSet::getParameter().

65  : emObjectProducer_{consumes(config.getParameter<edm::InputTag>("emObjectProducer"))},
66  ecalBarrelRecHitCollection_{consumes(config.getParameter<edm::InputTag>("ecalBarrelRecHitCollection"))},
67  ecalEndcapRecHitCollection_{consumes(config.getParameter<edm::InputTag>("ecalEndcapRecHitCollection"))} {
68  //vetos
69  egIsoPtMinBarrel_ = config.getParameter<double>("etMinBarrel");
70  egIsoEMinBarrel_ = config.getParameter<double>("eMinBarrel");
71  egIsoPtMinEndcap_ = config.getParameter<double>("etMinEndcap");
72  egIsoEMinEndcap_ = config.getParameter<double>("eMinEndcap");
73  egIsoConeSizeInBarrel_ = config.getParameter<double>("intRadiusBarrel");
74  egIsoConeSizeInEndcap_ = config.getParameter<double>("intRadiusEndcap");
75  egIsoConeSizeOut_ = config.getParameter<double>("extRadius");
76  egIsoJurassicWidth_ = config.getParameter<double>("jurassicWidth");
77 
78  // options
79  useIsolEt_ = config.getParameter<bool>("useIsolEt");
80  tryBoth_ = config.getParameter<bool>("tryBoth");
81  subtract_ = config.getParameter<bool>("subtract");
82  useNumCrystals_ = config.getParameter<bool>("useNumCrystals");
83  vetoClustered_ = config.getParameter<bool>("vetoClustered");
84 
85  //EventSetup Tokens
88 
89  //register your products
90  produces<edm::ValueMap<double>>();
91 }
const edm::EDGetTokenT< EcalRecHitCollection > ecalEndcapRecHitCollection_
const edm::EDGetTokenT< EcalRecHitCollection > ecalBarrelRecHitCollection_
const edm::EDGetTokenT< edm::View< reco::Candidate > > emObjectProducer_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::ESGetToken< EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd > sevLvToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometrytoken_

Member Function Documentation

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

Implements edm::global::EDProducerBase.

Definition at line 94 of file EgammaEcalRecHitIsolationProducer.cc.

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

96  {
97  // Get the filtered objects
98  auto emObjectHandle = iEvent.getHandle(emObjectProducer_);
99 
100  // Next get Ecal hits barrel
101  auto ecalBarrelRecHitHandle = iEvent.getHandle(ecalBarrelRecHitCollection_);
102 
103  // Next get Ecal hits endcap
104  auto ecalEndcapRecHitHandle = iEvent.getHandle(ecalEndcapRecHitCollection_);
105 
107  const EcalSeverityLevelAlgo* sevLevel = sevlv.product();
108 
109  //Get Calo Geometry
111  const CaloGeometry* caloGeom = pG.product();
112 
113  //reco::CandViewDoubleAssociations* isoMap = new reco::CandViewDoubleAssociations( reco::CandidateBaseRefProd( emObjectHandle ) );
114  auto isoMap = std::make_unique<edm::ValueMap<double>>();
115  edm::ValueMap<double>::Filler filler(*isoMap);
116  std::vector<double> retV(emObjectHandle->size(), 0);
117 
123  caloGeom,
124  *ecalBarrelRecHitHandle,
125  sevLevel,
126  DetId::Ecal);
127  ecalBarrelIsol.setUseNumCrystals(useNumCrystals_);
128  ecalBarrelIsol.setVetoClustered(vetoClustered_);
129 
135  caloGeom,
136  *ecalEndcapRecHitHandle,
137  sevLevel,
138  DetId::Ecal);
139  ecalEndcapIsol.setUseNumCrystals(useNumCrystals_);
140  ecalEndcapIsol.setVetoClustered(vetoClustered_);
141 
142  for (size_t i = 0; i < emObjectHandle->size(); ++i) {
143  //i need to know if its in the barrel/endcap so I get the supercluster handle to find out the detector eta
144  //this might not be the best way, are we guaranteed that eta<1.5 is barrel
145  //this can be safely replaced by another method which determines where the emobject is
146  //then we either get the isolation Et or isolation Energy depending on user selection
147  double isoValue = 0.;
148 
149  reco::SuperClusterRef superClus = emObjectHandle->at(i).get<reco::SuperClusterRef>();
150 
151  if (tryBoth_) { //barrel + endcap
152  if (useIsolEt_)
153  isoValue =
154  ecalBarrelIsol.getEtSum(&(emObjectHandle->at(i))) + ecalEndcapIsol.getEtSum(&(emObjectHandle->at(i)));
155  else
156  isoValue = ecalBarrelIsol.getEnergySum(&(emObjectHandle->at(i))) +
157  ecalEndcapIsol.getEnergySum(&(emObjectHandle->at(i)));
158  } else if (fabs(superClus->eta()) < 1.479) { //barrel
159  if (useIsolEt_)
160  isoValue = ecalBarrelIsol.getEtSum(&(emObjectHandle->at(i)));
161  else
162  isoValue = ecalBarrelIsol.getEnergySum(&(emObjectHandle->at(i)));
163  } else { //endcap
164  if (useIsolEt_)
165  isoValue = ecalEndcapIsol.getEtSum(&(emObjectHandle->at(i)));
166  else
167  isoValue = ecalEndcapIsol.getEnergySum(&(emObjectHandle->at(i)));
168  }
169 
170  //we subtract off the electron energy here as well
171  double subtractVal = 0;
172 
173  if (useIsolEt_)
174  subtractVal = superClus.get()->rawEnergy() * sin(2 * atan(exp(-superClus.get()->eta())));
175  else
176  subtractVal = superClus.get()->rawEnergy();
177 
178  if (subtract_)
179  isoValue -= subtractVal;
180 
181  retV[i] = isoValue;
182  //all done, isolation is now in the map
183 
184  } //end of loop over em objects
185 
186  filler.insert(emObjectHandle, retV.begin(), retV.end());
187  filler.fill();
188 
189  iEvent.put(std::move(isoMap));
190 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
const edm::EDGetTokenT< EcalRecHitCollection > ecalEndcapRecHitCollection_
const edm::EDGetTokenT< EcalRecHitCollection > ecalBarrelRecHitCollection_
const edm::EDGetTokenT< edm::View< reco::Candidate > > emObjectProducer_
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Exp< T >::type exp(const T &t)
Definition: Exp.h:22
edm::ESGetToken< EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd > sevLvToken_
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
Definition: Event.h:563
def move
Definition: eostools.py:511
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:232
T const * product() const
Definition: ESHandle.h:86
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometrytoken_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:157

Member Data Documentation

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

Definition at line 57 of file EgammaEcalRecHitIsolationProducer.cc.

Referenced by produce().

const edm::EDGetTokenT<EcalRecHitCollection> EgammaEcalRecHitIsolationProducer::ecalBarrelRecHitCollection_
private

Definition at line 37 of file EgammaEcalRecHitIsolationProducer.cc.

Referenced by produce().

const edm::EDGetTokenT<EcalRecHitCollection> EgammaEcalRecHitIsolationProducer::ecalEndcapRecHitCollection_
private

Definition at line 38 of file EgammaEcalRecHitIsolationProducer.cc.

Referenced by produce().

double EgammaEcalRecHitIsolationProducer::egIsoConeSizeInBarrel_
private

Definition at line 45 of file EgammaEcalRecHitIsolationProducer.cc.

Referenced by produce().

double EgammaEcalRecHitIsolationProducer::egIsoConeSizeInEndcap_
private

Definition at line 46 of file EgammaEcalRecHitIsolationProducer.cc.

Referenced by produce().

double EgammaEcalRecHitIsolationProducer::egIsoConeSizeOut_
private

Definition at line 44 of file EgammaEcalRecHitIsolationProducer.cc.

Referenced by produce().

double EgammaEcalRecHitIsolationProducer::egIsoEMinBarrel_
private

Definition at line 41 of file EgammaEcalRecHitIsolationProducer.cc.

Referenced by produce().

double EgammaEcalRecHitIsolationProducer::egIsoEMinEndcap_
private

Definition at line 43 of file EgammaEcalRecHitIsolationProducer.cc.

Referenced by produce().

double EgammaEcalRecHitIsolationProducer::egIsoJurassicWidth_
private

Definition at line 47 of file EgammaEcalRecHitIsolationProducer.cc.

Referenced by produce().

double EgammaEcalRecHitIsolationProducer::egIsoPtMinBarrel_
private

Definition at line 40 of file EgammaEcalRecHitIsolationProducer.cc.

Referenced by produce().

double EgammaEcalRecHitIsolationProducer::egIsoPtMinEndcap_
private

Definition at line 42 of file EgammaEcalRecHitIsolationProducer.cc.

Referenced by produce().

const edm::EDGetTokenT<edm::View<reco::Candidate> > EgammaEcalRecHitIsolationProducer::emObjectProducer_
private

Definition at line 36 of file EgammaEcalRecHitIsolationProducer.cc.

Referenced by produce().

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

Definition at line 56 of file EgammaEcalRecHitIsolationProducer.cc.

Referenced by produce().

bool EgammaEcalRecHitIsolationProducer::subtract_
private

Definition at line 51 of file EgammaEcalRecHitIsolationProducer.cc.

Referenced by produce().

bool EgammaEcalRecHitIsolationProducer::tryBoth_
private

Definition at line 50 of file EgammaEcalRecHitIsolationProducer.cc.

Referenced by produce().

bool EgammaEcalRecHitIsolationProducer::useIsolEt_
private

Definition at line 49 of file EgammaEcalRecHitIsolationProducer.cc.

Referenced by produce().

bool EgammaEcalRecHitIsolationProducer::useNumCrystals_
private

Definition at line 53 of file EgammaEcalRecHitIsolationProducer.cc.

Referenced by produce().

bool EgammaEcalRecHitIsolationProducer::vetoClustered_
private

Definition at line 54 of file EgammaEcalRecHitIsolationProducer.cc.

Referenced by produce().