55 #include "CLHEP/Units/GlobalPhysicalConstants.h"
66 class MTDHitMatchingInfo {
68 MTDHitMatchingInfo() {
75 inline bool operator<(
const MTDHitMatchingInfo&
m2)
const {
77 constexpr
double chi2_cut = 10.;
78 constexpr
double low_weight = 3.;
79 constexpr
double high_weight = 8.;
80 if (timeChi2 < chi2_cut && m2.timeChi2 < chi2_cut)
81 return chi2(low_weight) < m2.chi2(low_weight);
83 return chi2(high_weight) < m2.chi2(high_weight);
86 inline double chi2(
double timeWeight = 1.)
const {
return estChi2 + timeWeight * timeChi2; }
93 struct TrackTofPidInfo {
125 const TrackTofPidInfo computeTrackTofPidInfo(
double magp2,
131 bool addPIDError =
true) {
132 constexpr
double m_pi = 0.13957018;
133 constexpr
double m_pi_inv2 = 1.0 / m_pi /
m_pi;
134 constexpr
double m_k = 0.493677;
135 constexpr
double m_k_inv2 = 1.0 / m_k / m_k;
136 constexpr
double m_p = 0.9382720813;
137 constexpr
double m_p_inv2 = 1.0 / m_p / m_p;
141 TrackTofPidInfo tofpid;
144 tofpid.tmtderror = t_mtderr;
145 tofpid.pathlength = length;
147 tofpid.gammasq_pi = 1. + magp2 * m_pi_inv2;
148 tofpid.beta_pi =
std::sqrt(1. - 1. / tofpid.gammasq_pi);
149 tofpid.dt_pi = tofpid.pathlength / tofpid.beta_pi *
c_inv;
151 tofpid.gammasq_k = 1. + magp2 * m_k_inv2;
152 tofpid.beta_k =
std::sqrt(1. - 1. / tofpid.gammasq_k);
153 tofpid.dt_k = tofpid.pathlength / tofpid.beta_k *
c_inv;
155 tofpid.gammasq_p = 1. + magp2 * m_p_inv2;
156 tofpid.beta_p =
std::sqrt(1. - 1. / tofpid.gammasq_p);
157 tofpid.dt_p = tofpid.pathlength / tofpid.beta_p *
c_inv;
159 tofpid.dt = tofpid.tmtd - tofpid.dt_pi - t_vtx;
160 tofpid.dterror =
sqrt(tofpid.tmtderror * tofpid.tmtderror + t_vtx_err * t_vtx_err);
161 tofpid.betaerror = 0;
164 sqrt(tofpid.dterror * tofpid.dterror + (tofpid.dt_p - tofpid.dt_pi) * (tofpid.dt_p - tofpid.dt_pi));
165 tofpid.betaerror = tofpid.beta_p - tofpid.beta_pi;
168 tofpid.dtchi2 = (tofpid.dt * tofpid.dt) / (tofpid.dterror * tofpid.dterror);
170 tofpid.dt_best = tofpid.dt;
171 tofpid.dterror_best = tofpid.dterror;
172 tofpid.dtchi2_best = tofpid.dtchi2;
174 tofpid.prob_pi = -1.;
180 double chi2_pi = tofpid.dtchi2;
182 (tofpid.tmtd - tofpid.dt_k - t_vtx) * (tofpid.tmtd - tofpid.dt_k - t_vtx) / (tofpid.dterror * tofpid.dterror);
184 (tofpid.tmtd - tofpid.dt_p - t_vtx) * (tofpid.tmtd - tofpid.dt_p - t_vtx) / (tofpid.dterror * tofpid.dterror);
186 double rawprob_pi =
exp(-0.5 * chi2_pi);
187 double rawprob_k =
exp(-0.5 * chi2_k);
188 double rawprob_p =
exp(-0.5 * chi2_p);
189 double normprob = 1. / (rawprob_pi + rawprob_k + rawprob_p);
191 tofpid.prob_pi = rawprob_pi * normprob;
192 tofpid.prob_k = rawprob_k * normprob;
193 tofpid.prob_p = rawprob_p * normprob;
195 double prob_heavy = 1. - tofpid.prob_pi;
196 constexpr
double heavy_threshold = 0.75;
198 if (prob_heavy > heavy_threshold) {
199 if (chi2_k < chi2_p) {
200 tofpid.dt_best = (tofpid.tmtd - tofpid.dt_k - t_vtx);
201 tofpid.dtchi2_best = chi2_k;
203 tofpid.dt_best = (tofpid.tmtd - tofpid.dt_p - t_vtx);
204 tofpid.dtchi2_best = chi2_p;
211 bool getTrajectoryStateClosestToBeamLine(
const Trajectory& traj,
219 if (!stateForProjectionToBeamLineOnSurface.
isValid()) {
220 edm::LogError(
"CannotPropagateToBeamLine") <<
"the state on the closest measurement isnot valid. skipping track.";
227 tscbl = tscblBuilder(stateForProjectionToBeamLine, bs);
235 double& pathlength) {
238 bool validpropagation =
true;
239 double pathlength1 = 0.;
240 double pathlength2 = 0.;
244 const auto& propresult = thePropagator->
propagateWithPath(it->updatedState(), (it + 1)->updatedState().surface());
245 double layerpathlength =
std::abs(propresult.second);
246 if (layerpathlength == 0.) {
247 validpropagation =
false;
249 pathlength1 += layerpathlength;
257 if (pathlength2 == 0.) {
258 validpropagation =
false;
260 pathlength = pathlength1 + pathlength2;
262 return validpropagation;
268 double& pathlength) {
272 bool tscbl_status = getTrajectoryStateClosestToBeamLine(traj, bs, thePropagator, tscbl);
277 return trackPathLength(traj, tscbl, thePropagator, pathlength);
282 template <
class TrackCollection>
290 template <
class H,
class T>
306 const double vtxTime,
307 const bool matchVertex,
308 MTDHitMatchingInfo& bestHit)
const;
319 const double vtxTime,
320 const bool matchVertex,
321 MTDHitMatchingInfo& bestHit)
const;
323 void fillMatchingHits(
const DetLayer*,
334 MTDHitMatchingInfo&)
const;
338 if (!recHits.empty()) {
343 auto rFirst = first.
mag2();
344 auto rLast = last.
mag2();
350 LogDebug(
"TrackExtenderWithMTD") <<
"Impossible to determine the rechits order" << endl;
363 float& sigmatmtdOut)
const;
420 template <
class TrackCollection>
425 updateTraj_(iConfig.getParameter<bool>(
"updateTrackTrajectory")),
426 updateExtra_(iConfig.getParameter<bool>(
"updateTrackExtra")),
427 updatePattern_(iConfig.getParameter<bool>(
"updateTrackHitPattern")),
428 mtdRecHitBuilder_(iConfig.getParameter<std::
string>(
"MTDRecHitBuilder")),
429 propagator_(iConfig.getParameter<std::
string>(
"Propagator")),
430 transientTrackBuilder_(iConfig.getParameter<std::
string>(
"TransientTrackBuilder")),
431 estMaxChi2_(iConfig.getParameter<double>(
"estimatorMaxChi2")),
432 estMaxNSigma_(iConfig.getParameter<double>(
"estimatorMaxNSigma")),
433 btlChi2Cut_(iConfig.getParameter<double>(
"btlChi2Cut")),
434 btlTimeChi2Cut_(iConfig.getParameter<double>(
"btlTimeChi2Cut")),
435 etlChi2Cut_(iConfig.getParameter<double>(
"etlChi2Cut")),
436 etlTimeChi2Cut_(iConfig.getParameter<double>(
"etlTimeChi2Cut")),
437 useVertex_(iConfig.getParameter<bool>(
"useVertex")),
438 useSimVertex_(iConfig.getParameter<bool>(
"useSimVertex")),
439 dzCut_(iConfig.getParameter<double>(
"dZCut")),
440 bsTimeSpread_(iConfig.getParameter<double>(
"bsTimeSpread")) {
458 pOrigTrkToken = produces<edm::ValueMap<float>>(
"generalTrackp");
460 t0OrigTrkToken = produces<edm::ValueMap<float>>(
"generalTrackt0");
470 gtgToken_ = esConsumes<GlobalTrackingGeometry, GlobalTrackingGeometryRecord>();
471 dlgeoToken_ = esConsumes<MTDDetLayerGeometry, MTDRecoGeometryRecord>();
472 magfldToken_ = esConsumes<MagneticField, IdealMagneticFieldRecord>();
474 ttopoToken_ = esConsumes<TrackerTopology, TrackerTopologyRcd>();
476 produces<edm::OwnVector<TrackingRecHit>>();
477 produces<reco::TrackExtraCollection>();
478 produces<TrackCollection>();
481 template <
class TrackCollection>
490 desc.
add<
bool>(
"updateTrackTrajectory",
true);
491 desc.
add<
bool>(
"updateTrackExtra",
true);
492 desc.
add<
bool>(
"updateTrackHitPattern",
true);
493 desc.
add<
std::string>(
"TransientTrackBuilder",
"TransientTrackBuilder");
495 desc.
add<
std::string>(
"Propagator",
"PropagatorWithMaterialForMTD");
498 "KFFitterForRefitInsideOut",
499 "KFSmootherForRefitInsideOut",
500 "PropagatorWithMaterialForMTD",
507 desc.
add<
double>(
"estimatorMaxChi2", 500.);
508 desc.
add<
double>(
"estimatorMaxNSigma", 10.);
509 desc.
add<
double>(
"btlChi2Cut", 50.);
510 desc.
add<
double>(
"btlTimeChi2Cut", 10.);
511 desc.
add<
double>(
"etlChi2Cut", 50.);
512 desc.
add<
double>(
"etlTimeChi2Cut", 10.);
513 desc.
add<
bool>(
"useVertex",
false);
514 desc.
add<
bool>(
"useSimVertex",
false);
515 desc.
add<
double>(
"dZCut", 0.1);
516 desc.
add<
double>(
"bsTimeSpread", 0.2);
517 descriptions.
add(
"trackExtenderWithMTDBase", desc);
520 template <
class TrackCollection>
521 template <
class H,
class T>
524 const std::vector<T>& vec,
526 auto out = std::make_unique<edm::ValueMap<T>>();
528 filler.insert(handle, vec.begin(), vec.end());
533 template <
class TrackCollection>
538 theTransformer->setServices(es);
550 hitbuilder_ = es.
getHandle(hitbuilderToken_);
558 auto output = std::make_unique<TrackCollection>();
559 auto extras = std::make_unique<reco::TrackExtraCollection>();
560 auto outhits = std::make_unique<edm::OwnVector<TrackingRecHit>>();
562 std::vector<float> btlMatchChi2;
563 std::vector<float> etlMatchChi2;
564 std::vector<float> btlMatchTimeChi2;
565 std::vector<float> etlMatchTimeChi2;
566 std::vector<int> npixBarrel;
567 std::vector<int> npixEndcap;
568 std::vector<float> pOrigTrkRaw;
569 std::vector<float> betaOrigTrkRaw;
570 std::vector<float> t0OrigTrkRaw;
571 std::vector<float> sigmat0OrigTrkRaw;
572 std::vector<float> pathLengthsOrigTrkRaw;
573 std::vector<float> tmtdOrigTrkRaw;
574 std::vector<float> sigmatmtdOrigTrkRaw;
575 std::vector<int> assocOrigTrkRaw;
577 auto const tracksH = ev.
getHandle(tracksToken_);
578 const auto&
tracks = *tracksH;
581 const auto& hits = ev.
get(hitsToken_);
584 const auto& bs = ev.
get(bsToken_);
587 if (useVertex_ && !useSimVertex_) {
588 auto const& vtxs = ev.
get(vtxToken_);
593 std::unique_ptr<math::XYZTLorentzVectorF> genPV(
nullptr);
594 if (useVertex_ && useSimVertex_) {
595 const auto& genVtxPosition = ev.
get(genVtxPositionToken_);
596 const auto& genVtxTime = ev.
get(genVtxTimeToken_);
597 genPV = std::make_unique<math::XYZTLorentzVectorF>(
598 genVtxPosition.x(), genVtxPosition.y(), genVtxPosition.z(), genVtxTime);
603 if (useSimVertex_ && genPV) {
604 vtxTime = genPV->t();
609 std::vector<unsigned> track_indices;
613 double trackVtxTime = 0.;
622 trackVtxTime = vtxTime;
626 const auto& trajs = theTransformer->transform(
track);
627 auto thits = theTransformer->getTransientRecHits(ttrack);
629 MTDHitMatchingInfo mBTL, mETL;
630 if (!trajs.empty()) {
634 bool tscbl_status = getTrajectoryStateClosestToBeamLine(trajs.front(),
bs, prop, tscbl);
639 trackPathLength(trajs.front(), tscbl, prop, pathlength0);
641 const auto& btlhits = tryBTLLayers(tsos,
653 mtdthits.insert(mtdthits.end(), btlhits.begin(), btlhits.end());
657 const auto& etlhits = tryETLLayers(tsos,
669 mtdthits.insert(mtdthits.end(), etlhits.begin(), etlhits.end());
673 auto ordering = checkRecHitsOrdering(thits);
675 thits.insert(thits.end(), mtdthits.begin(), mtdthits.end());
677 std::reverse(mtdthits.begin(), mtdthits.end());
678 mtdthits.insert(mtdthits.end(), thits.begin(), thits.end());
679 thits.swap(mtdthits);
682 const auto& trajwithmtd = mtdthits.empty() ? trajs : theTransformer->transform(ttrack, thits);
683 float pMap = 0.f, betaMap = 0.f, t0Map = 0.f, sigmat0Map = -1.f, pathLengthMap = -1.f, tmtdMap = 0.f,
687 for (
const auto& trj : trajwithmtd) {
688 const auto& thetrj = (updateTraj_ ? trj : trajs.front());
689 float pathLength = 0.f, tmtd = 0.f, sigmatmtd = -1.f;
696 !trajwithmtd.empty() && !mtdthits.empty(),
700 if (result.
ndof() >= 0) {
704 size_t hitsstart = outhits->size();
705 if (updatePattern_) {
706 t2t(trj, *outhits, trajParams, chi2s);
708 t2t(thetrj, *outhits, trajParams, chi2s);
710 size_t hitsend = outhits->size();
711 extras->push_back(buildTrackExtra(trj));
712 extras->back().setHits(hitsRefProd, hitsstart, hitsend - hitsstart);
713 extras->back().setTrajParams(trajParams, chi2s);
715 output->push_back(result);
716 btlMatchChi2.push_back(mBTL.hit ? mBTL.estChi2 : -1);
717 etlMatchChi2.push_back(mETL.hit ? mETL.estChi2 : -1);
718 btlMatchTimeChi2.push_back(mBTL.hit ? mBTL.timeChi2 : -1);
719 etlMatchTimeChi2.push_back(mETL.hit ? mETL.timeChi2 : -1);
720 pathLengthMap = pathLength;
722 sigmatmtdMap = sigmatmtd;
723 auto& backtrack =
output->back();
724 iMap =
output->size() - 1;
725 pMap = backtrack.p();
726 betaMap = backtrack.beta();
727 t0Map = backtrack.t0();
728 sigmat0Map = std::copysign(
std::sqrt(
std::abs(backtrack.covt0t0())), backtrack.covt0t0());
730 backtrack.setExtra((updateExtra_ ? extraRef :
track.extra()));
731 for (
unsigned ihit = hitsstart; ihit < hitsend; ++ihit) {
732 backtrack.appendHitPattern((*outhits)[ihit], ttopo);
734 npixBarrel.push_back(backtrack.hitPattern().numberOfValidPixelBarrelHits());
735 npixEndcap.push_back(backtrack.hitPattern().numberOfValidPixelEndcapHits());
737 LogTrace(
"TrackExtenderWithMTD") <<
"Error in the MTD track refitting. This should not happen";
741 pOrigTrkRaw.push_back(pMap);
742 betaOrigTrkRaw.push_back(betaMap);
743 t0OrigTrkRaw.push_back(t0Map);
744 sigmat0OrigTrkRaw.push_back(sigmat0Map);
745 pathLengthsOrigTrkRaw.push_back(pathLengthMap);
746 tmtdOrigTrkRaw.push_back(tmtdMap);
747 sigmatmtdOrigTrkRaw.push_back(sigmatmtdMap);
748 assocOrigTrkRaw.push_back(iMap);
751 btlMatchChi2.push_back(-1.);
752 etlMatchChi2.push_back(-1.);
753 btlMatchTimeChi2.push_back(-1.);
754 etlMatchTimeChi2.push_back(-1.);
755 npixBarrel.push_back(-1.);
756 npixEndcap.push_back(-1.);
766 fillValueMap(ev, tracksH, btlMatchChi2, btlMatchChi2Token);
767 fillValueMap(ev, tracksH, etlMatchChi2, etlMatchChi2Token);
768 fillValueMap(ev, tracksH, btlMatchTimeChi2, btlMatchTimeChi2Token);
769 fillValueMap(ev, tracksH, etlMatchTimeChi2, etlMatchTimeChi2Token);
770 fillValueMap(ev, tracksH, npixBarrel, npixBarrelToken);
771 fillValueMap(ev, tracksH, npixEndcap, npixEndcapToken);
772 fillValueMap(ev, tracksH, pOrigTrkRaw, pOrigTrkToken);
773 fillValueMap(ev, tracksH, betaOrigTrkRaw, betaOrigTrkToken);
774 fillValueMap(ev, tracksH, t0OrigTrkRaw, t0OrigTrkToken);
775 fillValueMap(ev, tracksH, sigmat0OrigTrkRaw, sigmat0OrigTrkToken);
776 fillValueMap(ev, tracksH, pathLengthsOrigTrkRaw, pathLengthOrigTrkToken);
777 fillValueMap(ev, tracksH, tmtdOrigTrkRaw, tmtdOrigTrkToken);
778 fillValueMap(ev, tracksH, sigmatmtdOrigTrkRaw, sigmatmtdOrigTrkToken);
779 fillValueMap(ev, tracksH, assocOrigTrkRaw, assocOrigTrkToken);
783 bool cmp_for_detset(
const unsigned one,
const unsigned two) {
return one <
two; };
790 const double pathlength0,
791 const double vtxTime,
793 const float bsTimeSpread,
796 bool useVtxConstraint,
797 std::set<MTDHitMatchingInfo>&
out) {
798 pair<bool, TrajectoryStateOnSurface>
comp = layer->
compatible(tsos, *prop, *estimator);
800 const vector<DetLayer::DetWithState> compDets = layer->
compatibleDets(tsos, *prop, *estimator);
801 if (!compDets.empty()) {
802 for (
const auto& detWithState : compDets) {
803 auto range = hits.
equal_range(detWithState.first->geographicalId(), cmp_for_detset);
811 const double tot_pl = pathlength0 +
std::abs(pl.second);
812 const double t_vtx = useVtxConstraint ? vtxTime : 0.;
814 constexpr
double vtx_res = 0.008;
815 const double t_vtx_err = useVtxConstraint ? vtx_res : bsTimeSpread;
817 constexpr
double t_res_manual = 0.035;
819 for (
auto detitr =
range.first; detitr !=
range.second; ++detitr) {
820 for (
const auto&
hit : *detitr) {
821 auto est = estimator->
estimate(detWithState.second,
hit);
825 TrackTofPidInfo tof = computeTrackTofPidInfo(pmag2,
832 MTDHitMatchingInfo mi;
834 mi.estChi2 = est.second;
835 mi.timeChi2 = tof.dtchi2_best;
846 template <
class TrackCollection>
851 const double pathlength0,
857 const double vtxTime,
858 const bool matchVertex,
859 MTDHitMatchingInfo& bestHit)
const {
863 bestHit = MTDHitMatchingInfo();
865 fillMatchingHits(ilay, tsos, traj, pmag2, pathlength0, hits, prop, bs, vtxTime, matchVertex, output, bestHit);
869 template <
class TrackCollection>
874 const double pathlength0,
880 const double vtxTime,
881 const bool matchVertex,
882 MTDHitMatchingInfo& bestHit)
const {
886 bestHit = MTDHitMatchingInfo();
887 for (
const DetLayer* ilay : layers) {
889 const double diskZ = disk.position().z();
894 fillMatchingHits(ilay, tsos, traj, pmag2, pathlength0, hits, prop, bs, vtxTime, matchVertex, output, bestHit);
899 if (output.size() == 2) {
900 if (
std::abs(output[0]->globalPosition().
z()) >
std::abs(output[1]->globalPosition().
z())) {
901 std::reverse(output.begin(), output.end());
907 template <
class TrackCollection>
912 const double pathlength0,
916 const double& vtxTime,
917 const bool matchVertex,
919 MTDHitMatchingInfo& bestHit)
const {
920 std::set<MTDHitMatchingInfo> hitsInLayer;
921 bool hitMatched =
false;
923 using namespace std::placeholders;
924 auto find_hits = std::bind(find_hits_in_dets,
937 std::ref(hitsInLayer));
939 if (useVertex_ && matchVertex)
940 find_hits(vtxTime,
true);
945 if (!hitsInLayer.empty()) {
947 auto const& firstHit = *hitsInLayer.begin();
948 if (firstHit.estChi2 < etlChi2Cut_ && firstHit.timeChi2 < etlTimeChi2Cut_) {
950 output.push_back(hitbuilder_->build(firstHit.hit));
951 if (firstHit < bestHit)
956 if (useVertex_ && matchVertex && !hitMatched) {
960 if (!hitsInLayer.empty()) {
961 auto const& firstHit = *hitsInLayer.begin();
962 if (firstHit.timeChi2 < etlTimeChi2Cut_) {
963 if (firstHit.estChi2 < etlChi2Cut_) {
965 output.push_back(hitbuilder_->build(firstHit.hit));
966 if (firstHit < bestHit)
976 template <
class TrackCollection>
984 float& pathLengthOut,
986 float& sigmatmtdOut)
const {
988 bool tsbcl_status = getTrajectoryStateClosestToBeamLine(traj, bs, thePropagator, tscbl);
1001 double covt0t0 = -1.;
1002 pathLengthOut = -1.f;
1004 sigmatmtdOut = -1.f;
1005 double betaOut = 0.;
1006 double covbetabeta = -1.;
1008 auto routput = [&]() {
1026 bool validpropagation = trackPathLength(trajWithMtd, bs, thePropagator, pathlength);
1028 double thiterror = -1.;
1029 bool validmtd =
false;
1031 if (!validpropagation) {
1035 size_t ihitcount(0), ietlcount(0);
1040 if (
MTDDetId(
hit.recHit()->geographicalId()).mtdSubDetector() == MTDDetId::MTDType::ETL) {
1047 if (ihitcount == 1) {
1049 thit = mtdhit->
time();
1052 }
else if (ihitcount == 2 && ietlcount == 2) {
1053 const auto& propresult =
1054 thePropagator->
propagateWithPath(ihit1->updatedState(), (ihit1 + 1)->updatedState().surface());
1055 double etlpathlength =
std::abs(propresult.second);
1059 if (etlpathlength == 0.) {
1060 validpropagation =
false;
1062 pathlength -= etlpathlength;
1065 TrackTofPidInfo tofInfo =
1066 computeTrackTofPidInfo(p.mag2(), etlpathlength, mtdhit1->
time(), mtdhit1->
timeError(), 0., 0.,
true);
1070 double err1 = tofInfo.dterror * tofInfo.dterror;
1074 <<
"MTD tracking hits with zero time uncertainty: " << err1 <<
" " << err2;
1076 if ((tofInfo.dt - mtdhit2->
time()) * (tofInfo.dt - mtdhit2->
time()) < (err1 + err2) * etlTimeChi2Cut_) {
1083 thiterror = 1. / (err1 + err2);
1084 thit = (tofInfo.dt * err1 + mtdhit2->
time() * err2) * thiterror;
1086 LogDebug(
"TrackExtenderWithMTD") <<
"p trk = " << p.mag() <<
" ETL hits times/errors: " << mtdhit1->
time()
1087 <<
" +/- " << mtdhit1->
timeError() <<
" , " << mtdhit2->
time() <<
" +/- "
1088 << mtdhit2->
timeError() <<
" extrapolated time1: " << tofInfo.dt <<
" +/- "
1089 << tofInfo.dterror <<
" average = " << thit <<
" +/- " << thiterror;
1096 <<
"MTD hits #" << ihitcount <<
"ETL hits #" << ietlcount <<
" anomalous pattern, skipping...";
1099 if (validmtd && validpropagation) {
1101 TrackTofPidInfo tofInfo = computeTrackTofPidInfo(p.mag2(), pathlength, thit, thiterror, 0., 0.,
true);
1102 pathLengthOut = pathlength;
1104 sigmatmtdOut = thiterror;
1106 covt0t0 = tofInfo.dterror * tofInfo.dterror;
1107 betaOut = tofInfo.beta_pi;
1108 covbetabeta = tofInfo.betaerror * tofInfo.betaerror;
1115 template <
class TrackCollection>
1117 static const string metname =
"TrackExtenderWithMTD";
1127 unsigned int innerId = 0, outerId = 0;
1132 LogTrace(metname) <<
"alongMomentum";
1140 LogTrace(metname) <<
"oppositeToMomentum";
1148 LogError(metname) <<
"Wrong propagation direction!";
1150 const GeomDet* outerDet = gtg_->idToDet(outerDetId);
1158 LogTrace(metname) <<
"The Global Muon outerMostMeasurementState is not compatible with the recHit detector!"
1159 <<
" Setting outerMost postition to recHit position if recHit isValid: "
1160 << outerRecHit->isValid();
1161 LogTrace(metname) <<
"From " << outerTSOSPos <<
" to " << hitPos;
1191 template <
class TrackCollection>
1200 if ((bc = dynamic_cast<const BoundCylinder*>(sur))) {
1201 output <<
" Cylinder of radius: " << bc->radius() << endl;
1202 }
else if ((bd = dynamic_cast<const BoundDisk*>(sur))) {
1203 output <<
" Disk at: " << bd->position().z() << endl;
1205 return output.str();
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
virtual std::pair< bool, TrajectoryStateOnSurface > compatible(const TrajectoryStateOnSurface &ts, const Propagator &, const MeasurementEstimator &) const =0
double z0() const
z coordinate
virtual const BoundSurface & surface() const =0
The surface of the GeometricSearchDet.
TrackExtenderWithMTDT< reco::TrackCollection > TrackExtenderWithMTD
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
edm::ESGetToken< TransientTrackingRecHitBuilder, TransientRecHitRecord > hitbuilderToken_
ConstRecHitPointer const & recHit() const
const float bsTimeSpread_
Range equal_range(id_type i, CMP cmp, bool update=false) const
reco::TrackExtra buildTrackExtra(const Trajectory &trajectory) const
virtual bool inside(const Local3DPoint &) const =0
Determine if the point is inside the bounds.
const float btlTimeChi2Cut_
edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecord > gtgToken_
const std::string metname
edm::EDGetTokenT< reco::BeamSpot > bsToken_
std::unique_ptr< MeasurementEstimator > theEstimator
#define DEFINE_FWK_MODULE(type)
TrackExtenderWithMTDT(const ParameterSet &pset)
const CurvilinearTrajectoryError & curvilinearError() const
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > ttopoToken_
Global3DPoint GlobalPoint
edm::EDPutToken pathLengthOrigTrkToken
string dumpLayer(const DetLayer *layer) const
edm::View< TrackType > InputCollection
edm::EDGetTokenT< GlobalPoint > genVtxPositionToken_
GlobalPoint globalPosition() const
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
ConstRecHitContainer recHits() const
const Bounds & bounds() const
auto const & tracks
cannot be loose
const std::vector< const DetLayer * > & allBTLLayers() const
return the BTL DetLayers (barrel), inside-out
Exp< T >::type exp(const T &t)
TrackCharge charge() const
reco::Track buildTrack(const reco::Track &, const Trajectory &, const Trajectory &, const reco::BeamSpot &, const MagneticField *field, const Propagator *prop, bool hasMTD, float &pathLength, float &tmtdOut, float &sigmatmtdOut) const
Log< level::Error, false > LogError
TrajectoryMeasurement const & closestMeasurement(GlobalPoint) const
edm::EDPutToken t0OrigTrkToken
const Plane & surface() const
The nominal surface of the GeomDet.
const Point & position() const
position
const CurvilinearTrajectoryError & curvilinearError() const
virtual std::vector< DetWithState > compatibleDets(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
edm::EDPutToken assocOrigTrkToken
edm::EDGetTokenT< MTDTrackingDetSetVector > hitsToken_
Detector identifier base class for the MIP Timing Layer.
constexpr std::array< uint8_t, layerIndexSize > layer
const uint16_t range(const Frame &aFrame)
PropagationDirection const & direction() const
TrackAlgorithm algo() const
DataContainer const & measurements() const
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
const SurfaceType & surface() const
Container::value_type value_type
edm::EDPutToken tmtdOrigTrkToken
const float estMaxNSigma_
TransientTrackingRecHit::ConstRecHitContainer tryETLLayers(const TrajectoryStateOnSurface &, const Trajectory &traj, const double, const double, const MTDTrackingDetSetVector &, const MTDDetLayerGeometry *, const MagneticField *field, const Propagator *prop, const reco::BeamSpot &bs, const double vtxTime, const bool matchVertex, MTDHitMatchingInfo &bestHit) const
edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > builderToken_
const std::vector< const DetLayer * > & allETLLayers() const
return the ETL DetLayers (endcap), -Z to +Z
const std::string mtdRecHitBuilder_
double ndof() const
number of degrees of freedom of the fit
edm::EDPutToken betaOrigTrkToken
TrajectoryMeasurement const & lastMeasurement() const
FreeTrajectoryState const * freeState(bool withErrors=true) const
GlobalVector momentum() const
RefitDirection::GeometricalDirection checkRecHitsOrdering(TransientTrackingRecHit::ConstRecHitContainer const &recHits) const
Abs< T >::type abs(const T &t)
edm::EDPutToken pOrigTrkToken
bool get(ProductID const &oid, Handle< PROD > &result) const
const std::string propagator_
edm::ESGetToken< Propagator, TrackingComponentsRecord > propToken_
virtual HitReturnType estimate(const TrajectoryStateOnSurface &ts, const TrackingRecHit &hit) const =0
edm::EDPutToken etlMatchChi2Token
ParameterDescriptionBase * add(U const &iLabel, T const &value)
edm::RefToBase< TrajectorySeed > seedRef(void) const
virtual std::pair< TrajectoryStateOnSurface, double > propagateWithPath(const FreeTrajectoryState &, const Surface &) const final
constexpr valType roundIfNear0(valType value, double tolerance=1.e-7)
edm::ESHandle< TransientTrackingRecHitBuilder > hitbuilder_
GlobalVector momentum() const
RefProd< PROD > getRefBeforePut()
FTS const & trackStateAtPCA() const
GlobalPoint position() const
std::vector< ConstRecHitPointer > ConstRecHitContainer
const std::string transientTrackBuilder_
Log< level::Info, false > LogInfo
GlobalPoint position() const
int ndof(bool bon=true) const
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
TrajectoryMeasurement const & firstMeasurement() const
ConstRecHitContainer RecHitContainer
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const GlobalTrajectoryParameters & globalParameters() const
ParameterSet const & getParameterSet(std::string const &) const
XYZVectorD XYZVector
spatial vector with cartesian internal representation
XYZPointD XYZPoint
point in space with cartesian internal representation
edm::EDPutToken sigmatmtdOrigTrkToken
edm::EDPutToken npixEndcapToken
A 2D TrackerRecHit with time and time error information.
T getParameter(std::string const &) const
void add(std::string const &label, ParameterSetDescription const &psetDescription)
TrackingRecHit::ConstRecHitPointer ConstRecHitPointer
edm::ESHandle< TransientTrackBuilder > builder_
TransientTrackingRecHit::ConstRecHitContainer tryBTLLayers(const TrajectoryStateOnSurface &, const Trajectory &traj, const double, const double, const MTDTrackingDetSetVector &, const MTDDetLayerGeometry *, const MagneticField *field, const Propagator *prop, const reco::BeamSpot &bs, const double vtxTime, const bool matchVertex, MTDHitMatchingInfo &bestHit) const
edm::EDPutToken btlMatchTimeChi2Token
edm::EDPutToken etlMatchTimeChi2Token
std::unique_ptr< TrackTransformer > theTransformer
edm::EDPutToken sigmat0OrigTrkToken
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magfldToken_
bool operator<(DTCELinkId const &lhs, DTCELinkId const &rhs)
static int position[264][3]
ESTransientHandle< T > getTransientHandle(const ESGetToken< T, R > &iToken) const
constexpr NumType convertMmToCm(NumType millimeters)
double y0() const
y coordinate
edm::EDPutToken npixBarrelToken
TrajectoryStateOnSurface const & updatedState() const
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
edm::ESHandle< GlobalTrackingGeometry > gtg_
edm::EDGetTokenT< float > genVtxTimeToken_
edm::EDGetTokenT< VertexCollection > vtxToken_
edm::EDPutToken btlMatchChi2Token
void produce(edm::Event &ev, const edm::EventSetup &es) final
TrackCollection::value_type TrackType
edm::EDGetTokenT< InputCollection > tracksToken_
const float etlTimeChi2Cut_
double t() const
t coordinate
void fillValueMap(edm::Event &iEvent, const H &handle, const std::vector< T > &vec, const edm::EDPutToken &token) const
void fillMatchingHits(const DetLayer *, const TrajectoryStateOnSurface &, const Trajectory &, const double, const double, const MTDTrackingDetSetVector &, const Propagator *, const reco::BeamSpot &, const double &, const bool, TransientTrackingRecHit::ConstRecHitContainer &, MTDHitMatchingInfo &) const
edm::ESGetToken< MTDDetLayerGeometry, MTDRecoGeometryRecord > dlgeoToken_
double x0() const
x coordinate