CMS 3D CMS Logo

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

#include <Calibration/EcalIsolatedParticleCandidateProducer/src/EcalIsolatedParticleCandidateProducer.cc>

Inheritance diagram for EcalIsolatedParticleCandidateProducer:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 EcalIsolatedParticleCandidateProducer (const edm::ParameterSet &)
 
 ~EcalIsolatedParticleCandidateProducer () 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 noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept final
 
bool wantsStreamLuminosityBlocks () const noexcept final
 
bool wantsStreamRuns () const noexcept 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
 
std::vector< bool > const & recordProvenanceList () 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)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~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
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

void beginJob () override
 
void endJob () override
 
void produce (edm::StreamID, edm::Event &, const edm::EventSetup &) const override
 

Private Attributes

const double hitCountEthr_
 
const double hitEthr_
 
const double InConeSize_
 
const double OutConeSize_
 
const edm::EDGetTokenT< EcalRecHitCollectiontok_EB_
 
const edm::EDGetTokenT< EcalRecHitCollectiontok_EE_
 
const edm::ESGetToken< CaloGeometry, CaloGeometryRecordtok_geom_
 
const edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefstok_hlt_
 
const edm::EDGetTokenT< l1extra::L1JetParticleCollectiontok_l1tau_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
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
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
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< Bconsumes (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 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 ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
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

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 49 of file EcalIsolatedParticleCandidateProducer.cc.

Constructor & Destructor Documentation

◆ EcalIsolatedParticleCandidateProducer()

EcalIsolatedParticleCandidateProducer::EcalIsolatedParticleCandidateProducer ( const edm::ParameterSet conf)
explicit

Definition at line 76 of file EcalIsolatedParticleCandidateProducer.cc.

77  : InConeSize_(conf.getParameter<double>("EcalInnerConeSize")),
78  OutConeSize_(conf.getParameter<double>("EcalOuterConeSize")),
79  hitCountEthr_(conf.getParameter<double>("ECHitCountEnergyThreshold")),
80  hitEthr_(conf.getParameter<double>("ECHitEnergyThreshold")),
81  tok_l1tau_(consumes<l1extra::L1JetParticleCollection>(conf.getParameter<edm::InputTag>("L1eTauJetsSource"))),
82  tok_hlt_(consumes<trigger::TriggerFilterObjectWithRefs>(conf.getParameter<edm::InputTag>("L1GTSeedLabel"))),
83  tok_EB_(consumes<EcalRecHitCollection>(conf.getParameter<edm::InputTag>("EBrecHitCollectionLabel"))),
84  tok_EE_(consumes<EcalRecHitCollection>(conf.getParameter<edm::InputTag>("EErecHitCollectionLabel"))),
85  tok_geom_(esConsumes<CaloGeometry, CaloGeometryRecord>()) {
86  //register your products
87  produces<reco::IsolatedPixelTrackCandidateCollection>();
88 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const edm::EDGetTokenT< l1extra::L1JetParticleCollection > tok_l1tau_
const edm::EDGetTokenT< EcalRecHitCollection > tok_EB_
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > tok_geom_
const edm::EDGetTokenT< EcalRecHitCollection > tok_EE_
const edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > tok_hlt_

◆ ~EcalIsolatedParticleCandidateProducer()

EcalIsolatedParticleCandidateProducer::~EcalIsolatedParticleCandidateProducer ( )
override

Definition at line 90 of file EcalIsolatedParticleCandidateProducer.cc.

90  {
91  // do anything here that needs to be done at desctruction time
92  // (e.g. close files, deallocate resources etc.)
93 }

Member Function Documentation

◆ beginJob()

void EcalIsolatedParticleCandidateProducer::beginJob ( )
inlineoverrideprivatevirtual

Reimplemented from edm::global::EDProducerBase.

Definition at line 58 of file EcalIsolatedParticleCandidateProducer.cc.

58 {}

◆ endJob()

void EcalIsolatedParticleCandidateProducer::endJob ( void  )
inlineoverrideprivatevirtual

Reimplemented from edm::global::EDProducerBase.

Definition at line 59 of file EcalIsolatedParticleCandidateProducer.cc.

Referenced by o2olib.O2ORunMgr::executeJob().

59 {}

◆ fillDescriptions()

void EcalIsolatedParticleCandidateProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 236 of file EcalIsolatedParticleCandidateProducer.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, and ProducerED_cfi::InputTag.

236  {
238  desc.add<double>("ECHitEnergyThreshold", 0.05);
239  desc.add<edm::InputTag>("L1eTauJetsSource", edm::InputTag("l1extraParticles", "Tau"));
240  desc.add<edm::InputTag>("L1GTSeedLabel", edm::InputTag("l1sIsolTrack"));
241  desc.add<edm::InputTag>("EBrecHitCollectionLabel", edm::InputTag("ecalRecHit", "EcalRecHitsEB"));
242  desc.add<edm::InputTag>("EErecHitCollectionLabel", edm::InputTag("ecalRecHit", "EcalRecHitsEE"));
243  desc.add<double>("ECHitCountEnergyThreshold", 0.5);
244  desc.add<double>("EcalInnerConeSize", 0.3);
245  desc.add<double>("EcalOuterConeSize", 0.7);
246  descriptions.add("ecalIsolPartProd", desc);
247 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produce()

void EcalIsolatedParticleCandidateProducer::produce ( edm::StreamID  ,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overrideprivatevirtual

Implements edm::global::EDProducerBase.

Definition at line 100 of file EcalIsolatedParticleCandidateProducer.cc.

References edm::SortedCollection< T, SORT >::begin(), edm::SortedCollection< T, SORT >::end(), HBHEDarkening_cff::energy, edm::EventSetup::getData(), trigger::TriggerRefsCollections::getObjects(), CaloGeometry::getPosition(), hitCountEthr_, hitEthr_, iEvent, InConeSize_, M_PI, eostools::move(), AlCaHLTBitMon_ParallelJobs::p, funct::pow(), DiDispStaMuonMonitor_cfi::pt, dttmaxenums::R, mathSSE::sqrt(), tok_EB_, tok_EE_, tok_geom_, tok_hlt_, tok_l1tau_, trigger::TriggerL1Jet, and trigger::TriggerL1Tau.

102  {
103 #ifdef EDM_ML_DEBUG
104  edm::LogVerbatim("HcalIsoTrack") << "get tau";
105 #endif
107 
108 #ifdef EDM_ML_DEBUG
109  edm::LogVerbatim("HcalIsoTrack") << "get geom";
110 #endif
111  const CaloGeometry* geo = &iSetup.getData(tok_geom_);
112 
113 #ifdef EDM_ML_DEBUG
114  edm::LogVerbatim("HcalIsoTrack") << "get ec rechit";
115 #endif
116  const edm::Handle<EcalRecHitCollection>& ecalEB = iEvent.getHandle(tok_EB_);
117  const edm::Handle<EcalRecHitCollection>& ecalEE = iEvent.getHandle(tok_EE_);
118 
119 #ifdef EDM_ML_DEBUG
120  edm::LogVerbatim("HcalIsoTrack") << "get l1 trig obj";
121 #endif
122 
124 
125  std::vector<edm::Ref<l1t::TauBxCollection> > l1tauobjref;
126  std::vector<edm::Ref<l1t::JetBxCollection> > l1jetobjref;
127 
128  l1trigobj->getObjects(trigger::TriggerL1Tau, l1tauobjref);
129  l1trigobj->getObjects(trigger::TriggerL1Jet, l1jetobjref);
130 
131  double ptTriggered = -10;
132  double etaTriggered = -100;
133  double phiTriggered = -100;
134 
135 #ifdef EDM_ML_DEBUG
136  edm::LogVerbatim("HcalIsoTrack") << "find highest pT triggered obj";
137 #endif
138  for (unsigned int p = 0; p < l1tauobjref.size(); p++) {
139  if (l1tauobjref[p]->pt() > ptTriggered) {
140  ptTriggered = l1tauobjref[p]->pt();
141  phiTriggered = l1tauobjref[p]->phi();
142  etaTriggered = l1tauobjref[p]->eta();
143  }
144  }
145  for (unsigned int p = 0; p < l1jetobjref.size(); p++) {
146  if (l1jetobjref[p]->pt() > ptTriggered) {
147  ptTriggered = l1jetobjref[p]->pt();
148  phiTriggered = l1jetobjref[p]->phi();
149  etaTriggered = l1jetobjref[p]->eta();
150  }
151  }
152 
153  auto iptcCollection = std::make_unique<reco::IsolatedPixelTrackCandidateCollection>();
154 
155 #ifdef EDM_ML_DEBUG
156  edm::LogVerbatim("HcalIsoTrack") << "loop over l1taus";
157 #endif
158  for (l1extra::L1JetParticleCollection::const_iterator tit = l1Taus->begin(); tit != l1Taus->end(); tit++) {
159  double dphi = fabs(tit->phi() - phiTriggered);
160  if (dphi > M_PI)
161  dphi = 2 * M_PI - dphi;
162  double Rseed = sqrt(pow(etaTriggered - tit->eta(), 2) + dphi * dphi);
163  if (Rseed < 1.2)
164  continue;
165  int nhitOut = 0;
166  int nhitIn = 0;
167  double OutEnergy = 0;
168  double InEnergy = 0;
169 #ifdef EDM_ML_DEBUG
170  edm::LogVerbatim("HcalIsoTrack") << "loops over rechits";
171 #endif
172  for (EcalRecHitCollection::const_iterator eItr = ecalEB->begin(); eItr != ecalEB->end(); eItr++) {
173  double phiD, R;
174  const GlobalPoint& pos = geo->getPosition(eItr->detid());
175  double phihit = pos.phi();
176  double etahit = pos.eta();
177  phiD = fabs(phihit - tit->phi());
178  if (phiD > M_PI)
179  phiD = 2 * M_PI - phiD;
180  R = sqrt(pow(etahit - tit->eta(), 2) + phiD * phiD);
181 
182  if (R < OutConeSize_ && R > InConeSize_ && eItr->energy() > hitCountEthr_) {
183  nhitOut++;
184  }
185  if (R < InConeSize_ && eItr->energy() > hitCountEthr_) {
186  nhitIn++;
187  }
188 
189  if (R < OutConeSize_ && R > InConeSize_ && eItr->energy() > hitEthr_) {
190  OutEnergy += eItr->energy();
191  }
192  if (R < InConeSize_ && eItr->energy() > hitEthr_) {
193  InEnergy += eItr->energy();
194  }
195  }
196 
197  for (EcalRecHitCollection::const_iterator eItr = ecalEE->begin(); eItr != ecalEE->end(); eItr++) {
198  double phiD, R;
199  const GlobalPoint& pos = geo->getPosition(eItr->detid());
200  double phihit = pos.phi();
201  double etahit = pos.eta();
202  phiD = fabs(phihit - tit->phi());
203  if (phiD > M_PI)
204  phiD = 2 * M_PI - phiD;
205  R = sqrt(pow(etahit - tit->eta(), 2) + phiD * phiD);
206  if (R < OutConeSize_ && R > InConeSize_ && eItr->energy() > hitCountEthr_) {
207  nhitOut++;
208  }
209  if (R < InConeSize_ && eItr->energy() > hitCountEthr_) {
210  nhitIn++;
211  }
212  if (R < OutConeSize_ && R > InConeSize_ && eItr->energy() > hitEthr_) {
213  OutEnergy += eItr->energy();
214  }
215  if (R < InConeSize_ && eItr->energy() > hitEthr_) {
216  InEnergy += eItr->energy();
217  }
218  }
219 #ifdef EDM_ML_DEBUG
220  edm::LogVerbatim("HcalIsoTrack") << "create and push_back candidate";
221 #endif
223  l1extra::L1JetParticleRef(l1Taus, tit - l1Taus->begin()), InEnergy, OutEnergy, nhitIn, nhitOut);
224  iptcCollection->push_back(newca);
225  }
226 
227  //Use the ExampleData to create an ExampleData2 which
228  // is put into the Event
229 
230 #ifdef EDM_ML_DEBUG
231  edm::LogVerbatim("HcalIsoTrack") << "put cand into event";
232 #endif
233  iEvent.put(std::move(iptcCollection));
234 }
Log< level::Info, true > LogVerbatim
void getObjects(Vids &ids, VRphoton &refs) const
various physics-level getters:
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
const edm::EDGetTokenT< l1extra::L1JetParticleCollection > tok_l1tau_
std::vector< EcalRecHit >::const_iterator const_iterator
const edm::EDGetTokenT< EcalRecHitCollection > tok_EB_
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > tok_geom_
int iEvent
Definition: GenABIO.cc:224
GlobalPoint getPosition(const DetId &id) const
Get the position of a given detector id.
Definition: CaloGeometry.cc:50
T sqrt(T t)
Definition: SSEVec.h:23
const edm::EDGetTokenT< EcalRecHitCollection > tok_EE_
const_iterator begin() const
#define M_PI
const_iterator end() const
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
def move(src, dest)
Definition: eostools.py:511
const edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > tok_hlt_

Member Data Documentation

◆ hitCountEthr_

const double EcalIsolatedParticleCandidateProducer::hitCountEthr_
private

Definition at line 63 of file EcalIsolatedParticleCandidateProducer.cc.

Referenced by produce().

◆ hitEthr_

const double EcalIsolatedParticleCandidateProducer::hitEthr_
private

Definition at line 64 of file EcalIsolatedParticleCandidateProducer.cc.

Referenced by produce().

◆ InConeSize_

const double EcalIsolatedParticleCandidateProducer::InConeSize_
private

Definition at line 61 of file EcalIsolatedParticleCandidateProducer.cc.

Referenced by produce().

◆ OutConeSize_

const double EcalIsolatedParticleCandidateProducer::OutConeSize_
private

Definition at line 62 of file EcalIsolatedParticleCandidateProducer.cc.

◆ tok_EB_

const edm::EDGetTokenT<EcalRecHitCollection> EcalIsolatedParticleCandidateProducer::tok_EB_
private

Definition at line 68 of file EcalIsolatedParticleCandidateProducer.cc.

Referenced by produce().

◆ tok_EE_

const edm::EDGetTokenT<EcalRecHitCollection> EcalIsolatedParticleCandidateProducer::tok_EE_
private

Definition at line 69 of file EcalIsolatedParticleCandidateProducer.cc.

Referenced by produce().

◆ tok_geom_

const edm::ESGetToken<CaloGeometry, CaloGeometryRecord> EcalIsolatedParticleCandidateProducer::tok_geom_
private

Definition at line 71 of file EcalIsolatedParticleCandidateProducer.cc.

Referenced by produce().

◆ tok_hlt_

const edm::EDGetTokenT<trigger::TriggerFilterObjectWithRefs> EcalIsolatedParticleCandidateProducer::tok_hlt_
private

Definition at line 67 of file EcalIsolatedParticleCandidateProducer.cc.

Referenced by produce().

◆ tok_l1tau_

const edm::EDGetTokenT<l1extra::L1JetParticleCollection> EcalIsolatedParticleCandidateProducer::tok_l1tau_
private

Definition at line 66 of file EcalIsolatedParticleCandidateProducer.cc.

Referenced by produce().