37 std::unique_ptr<PFMuonAlgo>
pfmu_;
43 : useTimingAverage_(conf.getParameter<
bool>(
"useTimingAverage")),
44 timingQualityThreshold_(conf.getParameter<double>(
"timingQualityThreshold")),
46 srcTrackTime_(consumes<
edm::ValueMap<
float>>(conf.getParameter<
edm::
InputTag>(
"trackTimeValueMap"))),
47 srcTrackTimeError_(consumes<
edm::ValueMap<
float>>(conf.getParameter<
edm::
InputTag>(
"trackTimeErrorMap"))),
48 srcTrackTimeQuality_(consumes<
edm::ValueMap<
float>>(conf.getParameter<
edm::
InputTag>(
"trackTimeQualityMap"))),
52 produces<reco::PFCandidateCollection>();
61 desc.add<
double>(
"timingQualityThreshold", 0.5);
62 desc.add<
bool>(
"useTimingAverage",
false);
69 descriptions.
add(
"pfTICLProducer",
desc);
76 const auto ticl_candidates = *ticl_cand_h;
82 const auto muons = *muonH;
84 auto candidates = std::make_unique<reco::PFCandidateCollection>();
86 for (
const auto& ticl_cand : ticl_candidates) {
87 const auto abs_pdg_id =
std::abs(ticl_cand.pdgId());
88 const auto charge = ticl_cand.charge();
89 const auto& four_mom = ticl_cand.p4();
90 double ecal_energy = 0.;
92 for (
const auto&
t : ticl_cand.tracksters()) {
93 double ecal_energy_fraction =
t->raw_em_pt() /
t->raw_pt();
94 ecal_energy +=
t->raw_energy() * ecal_energy_fraction;
96 double hcal_energy = ticl_cand.rawEnergy() - ecal_energy;
98 hcal_energy = hcal_energy < 0 ? 0 : hcal_energy;
101 switch (abs_pdg_id) {
125 candidate.setEcalEnergy(ecal_energy, ecal_energy);
126 candidate.setHcalEnergy(hcal_energy, hcal_energy);
127 if (candidate.charge()) {
131 candidate.setTrackRef(trackref);
138 pfmu_->reconstructMuon(candidate, muonref, allowLoose);
143 auto time = ticl_cand.time();
144 auto timeE = ticl_cand.timeError();
146 if (candidate.charge()) {
153 const auto timeHGC =
time;
154 const auto timeEHGC = timeE;
155 const auto timeMTD = (*trackTimeH)[candidate.trackRef()];
156 const auto timeEMTD = (*trackTimeErrH)[candidate.trackRef()];
160 const auto invTimeESqHGC =
pow(timeEHGC, -2);
161 const auto invTimeESqMTD =
pow(timeEMTD, -2);
162 timeE = (invTimeESqHGC * invTimeESqMTD) / (invTimeESqHGC + invTimeESqMTD);
163 time = (timeHGC * invTimeESqHGC + timeMTD * invTimeESqMTD) * timeE;
165 }
else if (timeEMTD > 0) {
171 candidate.setTime(
time, timeE);