86 const auto ticl_candidates = *ticl_cand_h;
94 const auto&
muons = *muonH;
96 auto candidates = std::make_unique<reco::PFCandidateCollection>();
98 for (
const auto& ticl_cand : ticl_candidates) {
99 const auto abs_pdg_id =
std::abs(ticl_cand.pdgId());
100 const auto charge = ticl_cand.charge();
101 const auto& four_mom = ticl_cand.p4();
102 float total_raw_energy = 0.f;
103 float total_em_raw_energy = 0.f;
104 for (
const auto&
t : ticl_cand.tracksters()) {
105 total_raw_energy +=
t->raw_energy();
106 total_em_raw_energy +=
t->raw_em_energy();
108 float ecal_energy_fraction = total_em_raw_energy / total_raw_energy;
110 : ticl_cand.rawEnergy() * ecal_energy_fraction;
114 hcal_energy =
std::max(0.
f, hcal_energy);
116 switch (abs_pdg_id) {
140 candidate.setEcalEnergy(ecal_energy, ecal_energy);
141 candidate.setHcalEnergy(hcal_energy, hcal_energy);
142 if (candidate.charge()) {
146 candidate.setTrackRef(trackref);
153 (ticl_cand.tracksters().empty() and muonref.
isNonnull() and muonref->isGlobalMuon())) {
156 pfmu_->reconstructMuon(candidate, muonref, allowLoose);
164 pfmu_->reconstructMuon(candidate, muonref, allowLoose);
170 candidate.setTime(ticl_cand.time(), ticl_cand.timeError());
173 auto time = ticl_cand.time();
174 auto timeE = ticl_cand.timeError();
183 const auto timeHGC =
time;
184 const auto timeEHGC = timeE;
185 const auto timeMTD = (*trackTimeH)[candidate.trackRef()];
186 const auto timeEMTD = (*trackTimeErrH)[candidate.trackRef()];
190 const auto invTimeESqHGC =
pow(timeEHGC, -2);
191 const auto invTimeESqMTD =
pow(timeEMTD, -2);
192 timeE = 1.f / (invTimeESqHGC + invTimeESqMTD);
193 time = (timeHGC * invTimeESqHGC + timeMTD * invTimeESqMTD) * timeE;
195 }
else if (timeEMTD > 0) {
201 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
edm::EDGetTokenT< edm::ValueMap< float > > srcTrackTimeError_
const bool useTimingAverage_
static bool isMuon(const reco::PFBlockElement &elt)
bool isNonnull() const
Checks for non-null.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
muons
the two sets of parameters below are mutually exclusive, depending if RECO or ALCARECO is used the us...
EDProductGetter const & productGetter() const
edm::EDGetTokenT< edm::ValueMap< float > > srcTrackTimeQuality_
const edm::EDGetTokenT< edm::View< TICLCandidate > > ticl_candidates_
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
std::unique_ptr< PFMuonAlgo > pfmu_
Abs< T >::type abs(const T &t)
edm::Ref< MuonCollection > MuonRef
presistent reference to a Muon
edm::EDGetTokenT< edm::ValueMap< float > > srcTrackTime_
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_