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];
282 double tmtd = tmtdIn[trackref];
283 double t0_k = tmtd - tofkIn[trackref];
284 double t0_p = tmtd - tofpIn[trackref];
286 double chisqmin = chisqnom;
288 double chisqmin_pi = chisqnom;
292 for (
unsigned int ivtx = 0; ivtx < vtxs.size(); ++ivtx) {
295 if (ivtx != (
unsigned int)vtxidx)
307 double chisqdz =
dz *
dz * rsigmazsq;
310 double dtsig_k = dt_k * rsigmat[1];
311 double chisq_k = chisqdz + dtsig_k * dtsig_k;
314 chisqmin_k = chisq_k;
318 double dtsig_p = dt_p * rsigmat[2];
319 double chisq_p = chisqdz + dtsig_p * dtsig_p;
322 chisqmin_p = chisq_p;
329 sigmat0safe = 1. / rsigmat[1];
335 sigmat0safe = 1. / rsigmat[2];
341 double rawprob_pi =
probPion_ *
exp(-0.5 * chisqmin_pi);
345 double normprob = 1. / (rawprob_pi + rawprob_k + rawprob_p);
347 prob_pi = rawprob_pi * normprob;
348 prob_k = rawprob_k * normprob;
349 prob_p = rawprob_p * normprob;
351 double prob_heavy = 1. - prob_pi;
359 t0OutRaw.push_back(
t0);
360 sigmat0OutRaw.push_back(sigmat0);
361 t0safeOutRaw.push_back(t0safe);
362 sigmat0safeOutRaw.push_back(sigmat0safe);
363 probPiOutRaw.push_back(prob_pi);
364 probKOutRaw.push_back(prob_k);
365 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_