7 #ifndef HLTrigger_JetMET_plugins_HLTJetTimingProducer_h 8 #define HLTrigger_JetMET_plugins_HLTJetTimingProducer_h 63 ecalRecHitsEBToken_{consumes<edm::SortedCollection<EcalRecHit, edm::StrictWeakOrdering<EcalRecHit>>>(
65 ecalRecHitsEEToken_{consumes<edm::SortedCollection<EcalRecHit, edm::StrictWeakOrdering<EcalRecHit>>>(
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");
83 float& weightedTimeCell,
84 float& totalEmEnergyCell,
86 for (
auto const& ecalRH : ecalRecHits) {
91 if (ecalRH.energy() < ecalCellEnergyThresh_)
93 if (ecalRH.timeError() <= 0. || ecalRH.timeError() > ecalCellTimeErrorThresh_)
95 if (
std::abs(ecalRH.time()) > ecalCellTimeThresh_)
100 weightedTimeCell += ecalRH.time() * ecalRH.energy() *
sin(
pos.theta());
101 totalEmEnergyCell += ecalRH.energy() *
sin(
pos.theta());
104 if (totalEmEnergyCell > 0) {
105 weightedTimeCell /= totalEmEnergyCell;
109 template <
typename T>
111 auto const& caloGeometry = iSetup.
getData(caloGeometryToken_);
112 auto const jets =
iEvent.getHandle(jetInputToken_);
116 std::vector<float> jetTimings;
120 jetTimings.reserve(
jets->size());
124 for (
auto const&
jet : *
jets) {
125 float weightedTimeCell = 0;
126 float totalEmEnergyCell = 0;
131 weightedTimeCell *= totalEmEnergyCell;
136 jetTimings.emplace_back(totalEmEnergyCell > 0 ? weightedTimeCell : -50);
143 jetTimings_filler.
insert(
jets, jetTimings.begin(), jetTimings.end());
144 jetTimings_filler.
fill();
150 jetEcalEtForTiming_filler.
fill();
156 jetCellsForTiming_filler.
fill();
160 template <
typename T>
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);
175 #endif // HLTrigger_JetMET_plugins_HLTJetTimingProducer_h HLTJetTimingProducer(const edm::ParameterSet &)
const double ecalCellEnergyThresh_
T getParameter(std::string const &) const
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometryToken_
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
const double ecalCellTimeThresh_
Sin< T >::type sin(const T &t)
void insert(const H &h, I begin, I end)
const double ecalCellTimeErrorThresh_
std::string defaultModuleLabel()
const edm::EDGetTokenT< edm::SortedCollection< EcalRecHit, edm::StrictWeakOrdering< EcalRecHit > > > ecalRecHitsEEToken_
const edm::EDGetTokenT< edm::SortedCollection< EcalRecHit, edm::StrictWeakOrdering< EcalRecHit > > > ecalRecHitsEBToken_
GlobalPoint getPosition(const DetId &id) const
Get the position of a given detector id.
const edm::EDGetTokenT< std::vector< T > > jetInputToken_
Abs< T >::type abs(const T &t)
TupleMultiplicity< TrackerTraits > const HitToTuple< TrackerTraits > const cms::cuda::AtomicPairCounter GPUCACellT< TrackerTraits > const *__restrict__ uint32_t const *__restrict__ nCells
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
void add(std::string const &label, ParameterSetDescription const &psetDescription)
This produces timing and associated ecal cell information for calo jets.
void produce(edm::Event &, const edm::EventSetup &) override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const double matchingRadius2_
void jetTimeFromEcalCells(const T &, const edm::SortedCollection< EcalRecHit, edm::StrictWeakOrdering< EcalRecHit >> &, const CaloGeometry &, float &, float &, uint &)