81 const auto ticl_candidates = *ticl_cand_h;
87 const auto&
muons = *muonH;
89 auto candidates = std::make_unique<reco::PFCandidateCollection>();
91 for (
const auto& ticl_cand : ticl_candidates) {
92 const auto abs_pdg_id =
std::abs(ticl_cand.pdgId());
93 const auto charge = ticl_cand.charge();
94 const auto& four_mom = ticl_cand.p4();
95 float total_raw_energy = 0.f;
96 float total_em_raw_energy = 0.f;
97 for (
const auto&
t : ticl_cand.tracksters()) {
98 total_raw_energy +=
t->raw_energy();
99 total_em_raw_energy +=
t->raw_em_energy();
101 float ecal_energy_fraction = total_em_raw_energy / total_raw_energy;
103 : ticl_cand.rawEnergy() * ecal_energy_fraction;
107 hcal_energy =
std::max(0.
f, hcal_energy);
109 switch (abs_pdg_id) {
133 candidate.setEcalEnergy(ecal_energy, ecal_energy);
134 candidate.setHcalEnergy(hcal_energy, hcal_energy);
135 if (candidate.charge()) {
139 candidate.setTrackRef(trackref);
146 pfmu_->reconstructMuon(candidate, muonref, allowLoose);
151 auto time = ticl_cand.time();
152 auto timeE = ticl_cand.timeError();
161 const auto timeHGC =
time;
162 const auto timeEHGC = timeE;
163 const auto timeMTD = (*trackTimeH)[candidate.trackRef()];
164 const auto timeEMTD = (*trackTimeErrH)[candidate.trackRef()];
168 const auto invTimeESqHGC =
pow(timeEHGC, -2);
169 const auto invTimeESqMTD =
pow(timeEMTD, -2);
170 timeE = (invTimeESqHGC * invTimeESqMTD) / (invTimeESqHGC + invTimeESqMTD);
171 time = (timeHGC * invTimeESqHGC + timeMTD * invTimeESqMTD) * timeE;
173 }
else if (timeEMTD > 0) {
179 candidate.setTime(
time, timeE);
static int muAssocToTrack(const reco::TrackRef &trackref, const reco::MuonCollection &muons)
const bool energy_from_regression_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
ParticleType
particle types
const bool useTimingAverage_
const edm::EDGetTokenT< edm::ValueMap< float > > srcTrackTime_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const edm::EDGetTokenT< edm::ValueMap< float > > srcTrackTimeError_
EDProductGetter const & productGetter() const
const edm::EDGetTokenT< edm::ValueMap< float > > srcTrackTimeQuality_
const edm::EDGetTokenT< edm::View< TICLCandidate > > ticl_candidates_
std::unique_ptr< PFMuonAlgo > pfmu_
Abs< T >::type abs(const T &t)
edm::Ref< MuonCollection > MuonRef
presistent reference to a Muon
const float timingQualityThreshold_
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
Power< A, B >::type pow(const A &a, const B &b)
const edm::EDGetTokenT< reco::MuonCollection > muons_