152 const auto&
tracks = *tracksH;
171 std::vector<float> t0OutRaw;
172 std::vector<float> sigmat0OutRaw;
173 std::vector<float> t0safeOutRaw;
174 std::vector<float> sigmat0safeOutRaw;
175 std::vector<float> probPiOutRaw;
176 std::vector<float> probKOutRaw;
177 std::vector<float> probPOutRaw;
180 for (
unsigned int itrack = 0; itrack <
tracks.size(); ++itrack) {
183 float t0 = t0In[trackref];
185 float sigmat0safe = sigmat0In[trackref];
187 float sigmat0 = sigmatmtd;
193 float trackMVAQual = trackMVAQualIn[trackref];
196 double rsigmazsq = 1. /
track.dzError() /
track.dzError();
197 double rsigmat = 1. / sigmatmtd;
201 int vtxidxmindz = -1;
202 int vtxidxminchisq = -1;
206 for (
unsigned int ivtx = 0; ivtx < vtxs.size(); ++ivtx) {
208 float w =
vtx.trackWeight(trackref);
220 double dtsig =
dt * rsigmat;
221 double chisq =
dz *
dz * rsigmazsq + dtsig * dtsig;
224 vtxidxminchisq = ivtx;
233 if (vtxidxmindz >= 0 && !(vtxs[vtxidxmindz].tError() > 0. && vtxs[vtxidxmindz].tError() <
vtxMaxSigmaT_)) {
234 vtxidx = vtxidxmindz;
235 }
else if (vtxidxminchisq >= 0) {
236 vtxidx = vtxidxminchisq;
237 }
else if (vtxidxmindz >= 0) {
238 vtxidx = vtxidxmindz;
243 if (vtxidx >= 0 && vtxs[vtxidx].tError() > 0. && vtxs[vtxidx].tError() <
vtxMaxSigmaT_) {
248 double dtsignom = dtnom * rsigmat;
249 double chisqnom = dznom * dznom * rsigmazsq + dtsignom * dtsignom;
256 sigmat0safe = sigmatmtd;
259 double tmtd = tmtdIn[trackref];
260 double t0_k = tmtd - tofkIn[trackref];
261 double t0_p = tmtd - tofpIn[trackref];
263 double chisqmin = chisqnom;
265 double chisqmin_pi = chisqnom;
269 for (
unsigned int ivtx = 0; ivtx < vtxs.size(); ++ivtx) {
272 if (ivtx != (
unsigned int)vtxidx)
284 double chisqdz =
dz *
dz * rsigmazsq;
287 double dtsig_k = dt_k * rsigmat;
288 double chisq_k = chisqdz + dtsig_k * dtsig_k;
291 chisqmin_k = chisq_k;
295 double dtsig_p = dt_p * rsigmat;
296 double chisq_p = chisqdz + dtsig_p * dtsig_p;
299 chisqmin_p = chisq_p;
306 sigmat0safe = sigmatmtd;
312 sigmat0safe = sigmatmtd;
318 double rawprob_pi =
probPion_ *
exp(-0.5 * chisqmin_pi);
322 double normprob = 1. / (rawprob_pi + rawprob_k + rawprob_p);
324 prob_pi = rawprob_pi * normprob;
325 prob_k = rawprob_k * normprob;
326 prob_p = rawprob_p * normprob;
328 double prob_heavy = 1. - prob_pi;
336 t0OutRaw.push_back(
t0);
337 sigmat0OutRaw.push_back(sigmat0);
338 t0safeOutRaw.push_back(t0safe);
339 sigmat0safeOutRaw.push_back(sigmat0safe);
340 probPiOutRaw.push_back(prob_pi);
341 probKOutRaw.push_back(prob_k);
342 probPOutRaw.push_back(prob_p);
edm::EDGetTokenT< reco::VertexCollection > vtxsToken_
const Point & position() const
position
edm::EDGetTokenT< edm::ValueMap< float > > sigmat0Token_
const double minProbHeavy_
const double fixedT0Error_
edm::EDGetTokenT< edm::ValueMap< float > > tofkToken_
static constexpr char t0Name[]
static constexpr char t0safeName[]
edm::EDGetTokenT< edm::ValueMap< float > > trackMTDTimeQualityToken_
const double vtxMaxSigmaT_
static constexpr char sigmat0safeName[]
Abs< T >::type abs(const T &t)
void fillValueMap(edm::Event &iEvent, const edm::Handle< H > &handle, const std::vector< T > &vec, const std::string &name) const
edm::EDGetTokenT< edm::ValueMap< float > > tmtdToken_
edm::EDGetTokenT< edm::ValueMap< float > > tofpToken_
const bool vertexReassignment_
static constexpr char sigmat0Name[]
static constexpr char probKName[]
static constexpr char probPName[]
const double minTrackTimeQuality_
double t() const
t coordinate
edm::EDGetTokenT< edm::ValueMap< float > > t0Token_
edm::EDGetTokenT< edm::ValueMap< float > > sigmatmtdToken_
const double maxDtSignificance_
static constexpr char probPiName[]
edm::EDGetTokenT< reco::TrackCollection > tracksToken_