38 : useTimingAverage_(conf.getParameter<
bool>(
"useTimingAverage")),
39 timingQualityThreshold_(conf.getParameter<double>(
"timingQualityThreshold")),
41 srcTrackTime_(consumes<
edm::ValueMap<
float>>(conf.getParameter<
edm::
InputTag>(
"trackTimeValueMap"))),
42 srcTrackTimeError_(consumes<
edm::ValueMap<
float>>(conf.getParameter<
edm::
InputTag>(
"trackTimeErrorMap"))),
43 srcTrackTimeQuality_(consumes<
edm::ValueMap<
float>>(conf.getParameter<
edm::
InputTag>(
"trackTimeQualityMap"))) {
44 produces<reco::PFCandidateCollection>();
53 desc.add<
double>(
"timingQualityThreshold", 0.5);
54 desc.add<
bool>(
"useTimingAverage",
false);
55 descriptions.
add(
"pfTICLProducer",
desc);
62 const auto ticl_candidates = *ticl_cand_h;
68 auto candidates = std::make_unique<reco::PFCandidateCollection>();
70 for (
const auto& ticl_cand : ticl_candidates) {
71 const auto abs_pdg_id =
std::abs(ticl_cand.pdgId());
72 const auto charge = ticl_cand.charge();
73 const auto& four_mom = ticl_cand.p4();
74 double ecal_energy = 0.;
76 for (
const auto&
t : ticl_cand.tracksters()) {
77 double ecal_energy_fraction =
t->raw_em_pt() /
t->raw_pt();
78 ecal_energy +=
t->raw_energy() * ecal_energy_fraction;
80 double hcal_energy = ticl_cand.rawEnergy() - ecal_energy;
82 hcal_energy = hcal_energy < 0 ? 0 : hcal_energy;
109 candidate.setEcalEnergy(ecal_energy, ecal_energy);
110 candidate.setHcalEnergy(hcal_energy, hcal_energy);
111 if (candidate.charge()) {
115 candidate.setTrackRef(ref);
119 auto time = ticl_cand.time();
120 auto timeE = ticl_cand.timeError();
122 if (candidate.charge()) {
129 const auto timeHGC =
time;
130 const auto timeEHGC = timeE;
131 const auto timeMTD = (*trackTimeH)[candidate.trackRef()];
132 const auto timeEMTD = (*trackTimeErrH)[candidate.trackRef()];
136 const auto invTimeESqHGC =
pow(timeEHGC, -2);
137 const auto invTimeESqMTD =
pow(timeEMTD, -2);
138 timeE = (invTimeESqHGC * invTimeESqMTD) / (invTimeESqHGC + invTimeESqMTD);
139 time = (timeHGC * invTimeESqHGC + timeMTD * invTimeESqMTD) * timeE;
141 }
else if (timeEMTD > 0) {
147 candidate.setTime(
time, timeE);