124 constexpr double c_cm_ns = CLHEP::c_light*CLHEP::ns/CLHEP::cm;
129 const auto&
tracks = *tracksH;
133 const auto &t0In = *t0H;
137 const auto &tmtdIn = *tmtdH;
141 const auto &sigmat0In = *sigmat0H;
145 const auto &sigmatmtdIn = *sigmatmtdH;
149 const auto &pathLengthIn = *pathLengthH;
153 const auto &pIn = *pH;
157 const auto& vtxs = *vtxsH;
160 std::vector<float> t0OutRaw;
161 std::vector<float> sigmat0OutRaw;
162 std::vector<float> t0safeOutRaw;
163 std::vector<float> sigmat0safeOutRaw;
164 std::vector<float> probPiOutRaw;
165 std::vector<float> probKOutRaw;
166 std::vector<float> probPOutRaw;
169 for (
unsigned int itrack = 0; itrack<
tracks.size(); ++itrack) {
172 float t0 = t0In[trackref];
174 float sigmat0safe = sigmat0In[trackref];
175 float sigmatmtd = sigmatmtdIn[trackref];
176 float sigmat0 = sigmatmtd;
185 double rsigmat = 1./sigmatmtd;
189 int vtxidxmindz = -1;
190 int vtxidxminchisq = -1;
194 for (
unsigned int ivtx = 0; ivtx<vtxs.size(); ++ivtx) {
208 double dtsig = dt*rsigmat;
209 double chisq = dz*dz*rsigmazsq + dtsig*dtsig;
212 vtxidxminchisq = ivtx;
221 if (vtxidxmindz>=0 && !(vtxs[vtxidxmindz].tError()>0. && vtxs[vtxidxmindz].tError()<
vtxMaxSigmaT_)) {
222 vtxidx = vtxidxmindz;
224 else if (vtxidxminchisq>=0) {
225 vtxidx = vtxidxminchisq;
227 else if (vtxidxmindz>=0) {
228 vtxidx = vtxidxmindz;
233 if (vtxidx>=0 && vtxs[vtxidx].tError()>0. && vtxs[vtxidx].tError()<
vtxMaxSigmaT_) {
237 double dtnom =
std::abs(t0 - vtxnom.
t());
238 double dtsignom = dtnom*rsigmat;
239 double chisqnom = dznom*dznom*rsigmazsq + dtsignom*dtsignom;
246 sigmat0safe = sigmatmtd;
249 double tmtd = tmtdIn[trackref];
250 double pathlength = pathLengthIn[trackref];
251 double magp = pIn[trackref];
253 double gammasq_k = 1. + magp*magp/m_k/m_k;
254 double beta_k =
std::sqrt(1.-1./gammasq_k);
255 double t0_k = tmtd - pathlength/beta_k*c_inv;
257 double gammasq_p = 1. + magp*magp/m_p/m_p;
258 double beta_p =
std::sqrt(1.-1./gammasq_p);
259 double t0_p = tmtd - pathlength/beta_p*c_inv;
261 double chisqmin = chisqnom;
263 double chisqmin_pi = chisqnom;
277 double chisqdz = dz*dz*rsigmazsq;
280 double dtsig_k = dt_k*rsigmat;
281 double chisq_k = chisqdz + dtsig_k*dtsig_k;
284 chisqmin_k = chisq_k;
288 double dtsig_p = dt_p*rsigmat;
289 double chisq_p = chisqdz + dtsig_p*dtsig_p;
292 chisqmin_p = chisq_p;
299 sigmat0safe = sigmatmtd;
305 sigmat0safe = sigmatmtd;
312 double rawprob_pi =
exp(-0.5*chisqmin_pi);
313 double rawprob_k =
exp(-0.5*chisqmin_k);
314 double rawprob_p =
exp(-0.5*chisqmin_p);
316 double normprob = 1./(rawprob_pi + rawprob_k + rawprob_p);
318 prob_pi = rawprob_pi*normprob;
319 prob_k = rawprob_k*normprob;
320 prob_p = rawprob_p*normprob;
322 double prob_heavy = 1.-prob_pi;
332 t0OutRaw.push_back(t0);
333 sigmat0OutRaw.push_back(sigmat0);
334 t0safeOutRaw.push_back(t0safe);
335 sigmat0safeOutRaw.push_back(sigmat0safe);
336 probPiOutRaw.push_back(prob_pi);
337 probKOutRaw.push_back(prob_k);
338 probPOutRaw.push_back(prob_p);
edm::EDGetTokenT< reco::VertexCollection > vtxsToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::EDGetTokenT< edm::ValueMap< float > > sigmat0Token_
edm::EDGetTokenT< edm::ValueMap< float > > pathLengthToken_
const Point & position() const
position
double maxDtSignificance_
Abs< T >::type abs(const T &t)
float trackWeight(const TREF &r) const
returns the weight with which a Track has contributed to the vertex-fit.
edm::EDGetTokenT< edm::ValueMap< float > > tmtdToken_
static char sigmat0safeName[]
double dz() const
dz parameter (= dsz/cos(lambda)). This is the track z0 w.r.t (0,0,0) only if the refPoint is close to...
double dzError() const
error on dz
edm::EDGetTokenT< edm::ValueMap< float > > t0Token_
edm::EDGetTokenT< edm::ValueMap< float > > sigmatmtdToken_
edm::EDGetTokenT< edm::ValueMap< float > > pToken_
static char sigmat0Name[]
edm::EDGetTokenT< reco::TrackCollection > tracksToken_
void fillValueMap(edm::Event &iEvent, const edm::Handle< H > &handle, const std::vector< T > &vec, const std::string &name) const
double tError() const
error on t
double t() const
t coordinate