CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
HLTJetTimingProducer< T > Class Template Reference

This produces timing and associated ecal cell information for calo jets. More...

#include <HLTJetTimingProducer.h>

Inheritance diagram for HLTJetTimingProducer< T >:
edm::stream::EDProducer<>

Public Member Functions

 HLTJetTimingProducer (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::stream::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
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

void jetTimeFromEcalCells (const T &, const edm::SortedCollection< EcalRecHit, edm::StrictWeakOrdering< EcalRecHit >> &, const CaloGeometry &, float &, float &, uint &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

const bool barrelJets_
 
const edm::ESGetToken< CaloGeometry, CaloGeometryRecordcaloGeometryToken_
 
const double ecalCellEnergyThresh_
 
const double ecalCellTimeErrorThresh_
 
const double ecalCellTimeThresh_
 
const edm::EDGetTokenT< edm::SortedCollection< EcalRecHit, edm::StrictWeakOrdering< EcalRecHit > > > ecalRecHitsEBToken_
 
const edm::EDGetTokenT< edm::SortedCollection< EcalRecHit, edm::StrictWeakOrdering< EcalRecHit > > > ecalRecHitsEEToken_
 
const bool endcapJets_
 
const edm::EDGetTokenT< std::vector< T > > jetInputToken_
 
const double matchingRadius2_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

template<typename T>
class HLTJetTimingProducer< T >

This produces timing and associated ecal cell information for calo jets.

Author
Matthew Citron

Definition at line 28 of file HLTJetTimingProducer.h.

Constructor & Destructor Documentation

◆ HLTJetTimingProducer()

template<typename T >
HLTJetTimingProducer< T >::HLTJetTimingProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 60 of file HLTJetTimingProducer.h.

References edm::ParameterSet::getParameter().

62  jetInputToken_{consumes<std::vector<T>>(iConfig.getParameter<edm::InputTag>("jets"))},
63  ecalRecHitsEBToken_{consumes<edm::SortedCollection<EcalRecHit, edm::StrictWeakOrdering<EcalRecHit>>>(
64  iConfig.getParameter<edm::InputTag>("ebRecHitsColl"))},
65  ecalRecHitsEEToken_{consumes<edm::SortedCollection<EcalRecHit, edm::StrictWeakOrdering<EcalRecHit>>>(
66  iConfig.getParameter<edm::InputTag>("eeRecHitsColl"))},
67  barrelJets_{iConfig.getParameter<bool>("barrelJets")},
68  endcapJets_{iConfig.getParameter<bool>("endcapJets")},
69  ecalCellEnergyThresh_{iConfig.getParameter<double>("ecalCellEnergyThresh")},
70  ecalCellTimeThresh_{iConfig.getParameter<double>("ecalCellTimeThresh")},
71  ecalCellTimeErrorThresh_{iConfig.getParameter<double>("ecalCellTimeErrorThresh")},
72  matchingRadius2_{std::pow(iConfig.getParameter<double>("matchingRadius"), 2)} {
73  produces<edm::ValueMap<float>>("");
74  produces<edm::ValueMap<unsigned int>>("jetCellsForTiming");
75  produces<edm::ValueMap<float>>("jetEcalEtForTiming");
76 }
const double ecalCellEnergyThresh_
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometryToken_
const double ecalCellTimeThresh_
const double ecalCellTimeErrorThresh_
const edm::EDGetTokenT< edm::SortedCollection< EcalRecHit, edm::StrictWeakOrdering< EcalRecHit > > > ecalRecHitsEEToken_
const edm::EDGetTokenT< edm::SortedCollection< EcalRecHit, edm::StrictWeakOrdering< EcalRecHit > > > ecalRecHitsEBToken_
const edm::EDGetTokenT< std::vector< T > > jetInputToken_
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

Member Function Documentation

◆ fillDescriptions()

template<typename T >
void HLTJetTimingProducer< T >::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 161 of file HLTJetTimingProducer.h.

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

161  {
163  desc.add<edm::InputTag>("jets", edm::InputTag(""));
164  desc.add<bool>("barrelJets", false);
165  desc.add<bool>("endcapJets", false);
166  desc.add<double>("ecalCellEnergyThresh", 0.5);
167  desc.add<double>("ecalCellTimeThresh", 12.5);
168  desc.add<double>("ecalCellTimeErrorThresh", 100.);
169  desc.add<double>("matchingRadius", 0.4);
170  desc.add<edm::InputTag>("ebRecHitsColl", edm::InputTag("hltEcalRecHit", "EcalRecHitsEB"));
171  desc.add<edm::InputTag>("eeRecHitsColl", edm::InputTag("hltEcalRecHit", "EcalRecHitsEE"));
173 }
std::string defaultModuleLabel()
void add(std::string const &label, ParameterSetDescription const &psetDescription)
This produces timing and associated ecal cell information for calo jets.

◆ jetTimeFromEcalCells()

template<typename T >
void HLTJetTimingProducer< T >::jetTimeFromEcalCells ( const T jet,
const edm::SortedCollection< EcalRecHit, edm::StrictWeakOrdering< EcalRecHit >> &  ecalRecHits,
const CaloGeometry caloGeometry,
float &  weightedTimeCell,
float &  totalEmEnergyCell,
uint &  nCells 
)
private

Definition at line 79 of file HLTJetTimingProducer.h.

References funct::abs(), reco::deltaR2(), CaloGeometry::getPosition(), metsig::jet, EcalRecHit::kDiWeird, EcalRecHit::kLeadingEdgeRecovered, EcalRecHit::kPoorReco, EcalRecHit::kSaturated, EcalRecHit::kWeird, ALPAKA_ACCELERATOR_NAMESPACE::caPixelDoublets::nCells, and funct::sin().

85  {
86  for (auto const& ecalRH : ecalRecHits) {
87  if (ecalRH.checkFlag(EcalRecHit::kSaturated) || ecalRH.checkFlag(EcalRecHit::kLeadingEdgeRecovered) ||
88  ecalRH.checkFlag(EcalRecHit::kPoorReco) || ecalRH.checkFlag(EcalRecHit::kWeird) ||
89  ecalRH.checkFlag(EcalRecHit::kDiWeird))
90  continue;
91  if (ecalRH.energy() < ecalCellEnergyThresh_)
92  continue;
93  if (ecalRH.timeError() <= 0. || ecalRH.timeError() > ecalCellTimeErrorThresh_)
94  continue;
95  if (std::abs(ecalRH.time()) > ecalCellTimeThresh_)
96  continue;
97  auto const pos = caloGeometry.getPosition(ecalRH.detid());
99  continue;
100  weightedTimeCell += ecalRH.time() * ecalRH.energy() * sin(pos.theta());
101  totalEmEnergyCell += ecalRH.energy() * sin(pos.theta());
102  nCells++;
103  }
104  if (totalEmEnergyCell > 0) {
105  weightedTimeCell /= totalEmEnergyCell;
106  }
107 }
const double ecalCellEnergyThresh_
const double ecalCellTimeThresh_
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
const double ecalCellTimeErrorThresh_
GlobalPoint getPosition(const DetId &id) const
Get the position of a given detector id.
Definition: CaloGeometry.cc:50
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
ALPAKA_FN_ACC ALPAKA_FN_INLINE void uint32_t const uint32_t CACellT< TrackerTraits > uint32_t * nCells

◆ produce()

template<typename T >
void HLTJetTimingProducer< T >::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 110 of file HLTJetTimingProducer.h.

References HLT_2024v10_cff::ecalRecHitsEB, HLT_2024v10_cff::ecalRecHitsEE, edm::helper::Filler< Map >::fill(), edm::EventSetup::getData(), iEvent, edm::helper::Filler< Map >::insert(), metsig::jet, PDWG_EXODelayedJetMET_cff::jetCellsForTiming, PDWG_EXODelayedJetMET_cff::jetEcalEtForTiming, PDWG_EXODelayedJetMET_cff::jets, eostools::move(), and ALPAKA_ACCELERATOR_NAMESPACE::caPixelDoublets::nCells.

110  {
111  auto const& caloGeometry = iSetup.getData(caloGeometryToken_);
112  auto const jets = iEvent.getHandle(jetInputToken_);
113  auto const& ecalRecHitsEB = iEvent.get(ecalRecHitsEBToken_);
114  auto const& ecalRecHitsEE = iEvent.get(ecalRecHitsEEToken_);
115 
116  std::vector<float> jetTimings;
117  std::vector<unsigned int> jetCellsForTiming;
118  std::vector<float> jetEcalEtForTiming;
119 
120  jetTimings.reserve(jets->size());
121  jetEcalEtForTiming.reserve(jets->size());
122  jetCellsForTiming.reserve(jets->size());
123 
124  for (auto const& jet : *jets) {
125  float weightedTimeCell = 0;
126  float totalEmEnergyCell = 0;
127  unsigned int nCells = 0;
128  if (barrelJets_)
129  jetTimeFromEcalCells(jet, ecalRecHitsEB, caloGeometry, weightedTimeCell, totalEmEnergyCell, nCells);
130  if (endcapJets_) {
131  weightedTimeCell *= totalEmEnergyCell;
132  jetTimeFromEcalCells(jet, ecalRecHitsEE, caloGeometry, weightedTimeCell, totalEmEnergyCell, nCells);
133  }
134 
135  // If there is at least one ecal cell passing selection, calculate timing
136  jetTimings.emplace_back(totalEmEnergyCell > 0 ? weightedTimeCell : -50);
137  jetEcalEtForTiming.emplace_back(totalEmEnergyCell);
138  jetCellsForTiming.emplace_back(nCells);
139  }
140 
141  std::unique_ptr<edm::ValueMap<float>> jetTimings_out(new edm::ValueMap<float>());
142  edm::ValueMap<float>::Filler jetTimings_filler(*jetTimings_out);
143  jetTimings_filler.insert(jets, jetTimings.begin(), jetTimings.end());
144  jetTimings_filler.fill();
145  iEvent.put(std::move(jetTimings_out), "");
146 
147  std::unique_ptr<edm::ValueMap<float>> jetEcalEtForTiming_out(new edm::ValueMap<float>());
148  edm::ValueMap<float>::Filler jetEcalEtForTiming_filler(*jetEcalEtForTiming_out);
149  jetEcalEtForTiming_filler.insert(jets, jetEcalEtForTiming.begin(), jetEcalEtForTiming.end());
150  jetEcalEtForTiming_filler.fill();
151  iEvent.put(std::move(jetEcalEtForTiming_out), "jetEcalEtForTiming");
152 
153  std::unique_ptr<edm::ValueMap<unsigned int>> jetCellsForTiming_out(new edm::ValueMap<unsigned int>());
154  edm::ValueMap<unsigned int>::Filler jetCellsForTiming_filler(*jetCellsForTiming_out);
155  jetCellsForTiming_filler.insert(jets, jetCellsForTiming.begin(), jetCellsForTiming.end());
156  jetCellsForTiming_filler.fill();
157  iEvent.put(std::move(jetCellsForTiming_out), "jetCellsForTiming");
158 }
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometryToken_
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
const edm::EDGetTokenT< edm::SortedCollection< EcalRecHit, edm::StrictWeakOrdering< EcalRecHit > > > ecalRecHitsEEToken_
const edm::EDGetTokenT< edm::SortedCollection< EcalRecHit, edm::StrictWeakOrdering< EcalRecHit > > > ecalRecHitsEBToken_
int iEvent
Definition: GenABIO.cc:224
const edm::EDGetTokenT< std::vector< T > > jetInputToken_
ALPAKA_FN_ACC ALPAKA_FN_INLINE void uint32_t const uint32_t CACellT< TrackerTraits > uint32_t * nCells
void jetTimeFromEcalCells(const T &, const edm::SortedCollection< EcalRecHit, edm::StrictWeakOrdering< EcalRecHit >> &, const CaloGeometry &, float &, float &, uint &)
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ barrelJets_

template<typename T >
const bool HLTJetTimingProducer< T >::barrelJets_
private

Definition at line 49 of file HLTJetTimingProducer.h.

◆ caloGeometryToken_

template<typename T >
const edm::ESGetToken<CaloGeometry, CaloGeometryRecord> HLTJetTimingProducer< T >::caloGeometryToken_
private

Definition at line 42 of file HLTJetTimingProducer.h.

◆ ecalCellEnergyThresh_

template<typename T >
const double HLTJetTimingProducer< T >::ecalCellEnergyThresh_
private

Definition at line 53 of file HLTJetTimingProducer.h.

◆ ecalCellTimeErrorThresh_

template<typename T >
const double HLTJetTimingProducer< T >::ecalCellTimeErrorThresh_
private

Definition at line 55 of file HLTJetTimingProducer.h.

◆ ecalCellTimeThresh_

template<typename T >
const double HLTJetTimingProducer< T >::ecalCellTimeThresh_
private

Definition at line 54 of file HLTJetTimingProducer.h.

◆ ecalRecHitsEBToken_

template<typename T >
const edm::EDGetTokenT<edm::SortedCollection<EcalRecHit, edm::StrictWeakOrdering<EcalRecHit> > > HLTJetTimingProducer< T >::ecalRecHitsEBToken_
private

Definition at line 45 of file HLTJetTimingProducer.h.

◆ ecalRecHitsEEToken_

template<typename T >
const edm::EDGetTokenT<edm::SortedCollection<EcalRecHit, edm::StrictWeakOrdering<EcalRecHit> > > HLTJetTimingProducer< T >::ecalRecHitsEEToken_
private

Definition at line 46 of file HLTJetTimingProducer.h.

◆ endcapJets_

template<typename T >
const bool HLTJetTimingProducer< T >::endcapJets_
private

Definition at line 50 of file HLTJetTimingProducer.h.

◆ jetInputToken_

template<typename T >
const edm::EDGetTokenT<std::vector<T> > HLTJetTimingProducer< T >::jetInputToken_
private

Definition at line 44 of file HLTJetTimingProducer.h.

◆ matchingRadius2_

template<typename T >
const double HLTJetTimingProducer< T >::matchingRadius2_
private

Definition at line 56 of file HLTJetTimingProducer.h.