164 const auto&
tracks = *tracksH;
189 std::vector<float> t0OutRaw;
190 std::vector<float> sigmat0OutRaw;
191 std::vector<float> t0safeOutRaw;
192 std::vector<float> sigmat0safeOutRaw;
193 std::vector<float> probPiOutRaw;
194 std::vector<float> probKOutRaw;
195 std::vector<float> probPOutRaw;
198 for (
unsigned int itrack = 0; itrack <
tracks.size(); ++itrack) {
201 float t0 = t0In[trackref];
203 float sigmat0safe = sigmat0In[trackref];
205 float sigmat0 = sigmatmtd;
206 float sigmatofpi = sigmatofpiIn[trackref];
207 float sigmatofk = sigmatofkIn[trackref];
208 float sigmatofp = sigmatofpIn[trackref];
214 float trackMVAQual = trackMVAQualIn[trackref];
217 double rsigmazsq = 1. /
track.dzError() /
track.dzError();
218 std::array<double, 3> rsigmat = {{1. /
std::sqrt(sigmatmtd * sigmatmtd + sigmatofpi * sigmatofpi),
219 1. /
std::sqrt(sigmatmtd * sigmatmtd + sigmatofk * sigmatofk),
220 1. /
std::sqrt(sigmatmtd * sigmatmtd + sigmatofp * sigmatofp)}};
224 int vtxidxmindz = -1;
225 int vtxidxminchisq = -1;
229 for (
unsigned int ivtx = 0; ivtx < vtxs.size(); ++ivtx) {
231 float w =
vtx.trackWeight(trackref);
243 double dtsig =
dt * rsigmat[0];
244 double chisq =
dz *
dz * rsigmazsq + dtsig * dtsig;
247 vtxidxminchisq = ivtx;
256 if (vtxidxmindz >= 0 && !(vtxs[vtxidxmindz].tError() > 0. && vtxs[vtxidxmindz].tError() <
vtxMaxSigmaT_)) {
257 vtxidx = vtxidxmindz;
258 }
else if (vtxidxminchisq >= 0) {
259 vtxidx = vtxidxminchisq;
260 }
else if (vtxidxmindz >= 0) {
261 vtxidx = vtxidxmindz;
266 if (vtxidx >= 0 && vtxs[vtxidx].tError() > 0. && vtxs[vtxidx].tError() <
vtxMaxSigmaT_) {
271 double dtsignom = dtnom * rsigmat[0];
272 double chisqnom = dznom * dznom * rsigmazsq + dtsignom * dtsignom;
279 sigmat0safe = 1. / rsigmat[0];
280 sigmat0 = sigmat0safe;
283 double tmtd = tmtdIn[trackref];
284 double t0_k = tmtd - tofkIn[trackref];
285 double t0_p = tmtd - tofpIn[trackref];
287 double chisqmin = chisqnom;
289 double chisqmin_pi = chisqnom;
293 for (
unsigned int ivtx = 0; ivtx < vtxs.size(); ++ivtx) {
296 if (ivtx != (
unsigned int)vtxidx)
308 double chisqdz =
dz *
dz * rsigmazsq;
311 double dtsig_k = dt_k * rsigmat[1];
312 double chisq_k = chisqdz + dtsig_k * dtsig_k;
315 chisqmin_k = chisq_k;
319 double dtsig_p = dt_p * rsigmat[2];
320 double chisq_p = chisqdz + dtsig_p * dtsig_p;
323 chisqmin_p = chisq_p;
330 sigmat0safe = 1. / rsigmat[1];
331 sigmat0 = sigmat0safe;
337 sigmat0safe = 1. / rsigmat[2];
338 sigmat0 = sigmat0safe;
344 double rawprob_pi =
probPion_ *
exp(-0.5 * chisqmin_pi);
348 double normprob = 1. / (rawprob_pi + rawprob_k + rawprob_p);
350 prob_pi = rawprob_pi * normprob;
351 prob_k = rawprob_k * normprob;
352 prob_p = rawprob_p * normprob;
354 double prob_heavy = 1. - prob_pi;
362 t0OutRaw.push_back(
t0);
363 sigmat0OutRaw.push_back(sigmat0);
364 t0safeOutRaw.push_back(t0safe);
365 sigmat0safeOutRaw.push_back(sigmat0safe);
366 probPiOutRaw.push_back(prob_pi);
367 probKOutRaw.push_back(prob_k);
368 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 > > sigmatofpToken_
edm::EDGetTokenT< edm::ValueMap< float > > tmtdToken_
edm::EDGetTokenT< edm::ValueMap< float > > tofpToken_
edm::EDGetTokenT< edm::ValueMap< float > > sigmatofpiToken_
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 > > sigmatofkToken_
edm::EDGetTokenT< edm::ValueMap< float > > sigmatmtdToken_
const double maxDtSignificance_
static constexpr char probPiName[]
edm::EDGetTokenT< reco::TrackCollection > tracksToken_