CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Attributes
TrackExtenderWithMTDT< TrackCollection > Class Template Reference
Inheritance diagram for TrackExtenderWithMTDT< TrackCollection >:
edm::stream::EDProducer<>

Public Types

typedef edm::View< TrackTypeInputCollection
 
typedef TrackCollection::value_type TrackType
 
- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T...>
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T...>
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Public Member Functions

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
 
reco::TrackExtra buildTrackExtra (const Trajectory &trajectory) const
 
RefitDirection::GeometricalDirection checkRecHitsOrdering (TransientTrackingRecHit::ConstRecHitContainer const &recHits) const
 
string dumpLayer (const DetLayer *layer) 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
 
template<class H , class T >
void fillValueMap (edm::Event &iEvent, const H &handle, const std::vector< T > &vec, const edm::EDPutToken &token) const
 
void produce (edm::Event &ev, const edm::EventSetup &es) final
 
 TrackExtenderWithMTDT (const ParameterSet &pset)
 
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
 
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
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Attributes

edm::EDPutToken assocOrigTrkToken
 
edm::EDPutToken betaOrigTrkToken
 
const float bsTimeSpread_
 
edm::EDGetTokenT< reco::BeamSpotbsToken_
 
const float btlChi2Cut_
 
edm::EDPutToken btlMatchChi2Token
 
edm::EDPutToken btlMatchTimeChi2Token
 
const float btlTimeChi2Cut_
 
edm::ESHandle
< TransientTrackBuilder
builder_
 
edm::ESGetToken
< TransientTrackBuilder,
TransientTrackRecord
builderToken_
 
edm::ESGetToken
< MTDDetLayerGeometry,
MTDRecoGeometryRecord
dlgeoToken_
 
const float dzCut_
 
const float estMaxChi2_
 
const float estMaxNSigma_
 
const float etlChi2Cut_
 
edm::EDPutToken etlMatchChi2Token
 
edm::EDPutToken etlMatchTimeChi2Token
 
const float etlTimeChi2Cut_
 
edm::EDGetTokenT< GlobalPointgenVtxPositionToken_
 
edm::EDGetTokenT< float > genVtxTimeToken_
 
edm::ESHandle
< GlobalTrackingGeometry
gtg_
 
edm::ESGetToken
< GlobalTrackingGeometry,
GlobalTrackingGeometryRecord
gtgToken_
 
edm::ESHandle
< TransientTrackingRecHitBuilder
hitbuilder_
 
edm::ESGetToken
< TransientTrackingRecHitBuilder,
TransientRecHitRecord
hitbuilderToken_
 
edm::EDGetTokenT
< MTDTrackingDetSetVector
hitsToken_
 
edm::ESGetToken< MagneticField,
IdealMagneticFieldRecord
magfldToken_
 
const std::string mtdRecHitBuilder_
 
edm::EDPutToken npixBarrelToken
 
edm::EDPutToken npixEndcapToken
 
edm::EDPutToken pathLengthOrigTrkToken
 
edm::EDPutToken pOrigTrkToken
 
const std::string propagator_
 
edm::ESGetToken< Propagator,
TrackingComponentsRecord
propToken_
 
edm::EDPutToken sigmat0OrigTrkToken
 
edm::EDPutToken sigmatmtdOrigTrkToken
 
edm::EDPutToken t0OrigTrkToken
 
std::unique_ptr
< MeasurementEstimator
theEstimator
 
std::unique_ptr< TrackTransformertheTransformer
 
edm::EDPutToken tmtdOrigTrkToken
 
edm::EDGetTokenT< InputCollectiontracksToken_
 
const std::string transientTrackBuilder_
 
edm::ESGetToken
< TrackerTopology,
TrackerTopologyRcd
ttopoToken_
 
const bool updateExtra_
 
const bool updatePattern_
 
const bool updateTraj_
 
const bool useSimVertex_
 
const bool useVertex_
 
edm::EDGetTokenT
< VertexCollection
vtxToken_
 

Detailed Description

template<class TrackCollection>
class TrackExtenderWithMTDT< TrackCollection >

Definition at line 283 of file TrackExtenderWithMTD.cc.

Member Typedef Documentation

template<class TrackCollection >
typedef edm::View<TrackType> TrackExtenderWithMTDT< TrackCollection >::InputCollection

Definition at line 286 of file TrackExtenderWithMTD.cc.

template<class TrackCollection >
typedef TrackCollection::value_type TrackExtenderWithMTDT< TrackCollection >::TrackType

Definition at line 285 of file TrackExtenderWithMTD.cc.

Constructor & Destructor Documentation

template<class TrackCollection >
TrackExtenderWithMTDT< TrackCollection >::TrackExtenderWithMTDT ( const ParameterSet pset)

Definition at line 421 of file TrackExtenderWithMTD.cc.

References TrackExtenderWithMTDT< TrackCollection >::assocOrigTrkToken, TrackExtenderWithMTDT< TrackCollection >::betaOrigTrkToken, TrackExtenderWithMTDT< TrackCollection >::btlMatchChi2Token, TrackExtenderWithMTDT< TrackCollection >::btlMatchTimeChi2Token, TrackExtenderWithMTDT< TrackCollection >::builderToken_, TrackExtenderWithMTDT< TrackCollection >::dlgeoToken_, TrackExtenderWithMTDT< TrackCollection >::estMaxChi2_, TrackExtenderWithMTDT< TrackCollection >::estMaxNSigma_, TrackExtenderWithMTDT< TrackCollection >::etlMatchChi2Token, TrackExtenderWithMTDT< TrackCollection >::etlMatchTimeChi2Token, TrackExtenderWithMTDT< TrackCollection >::genVtxPositionToken_, TrackExtenderWithMTDT< TrackCollection >::genVtxTimeToken_, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterSet(), TrackExtenderWithMTDT< TrackCollection >::gtgToken_, TrackExtenderWithMTDT< TrackCollection >::hitbuilderToken_, TrackExtenderWithMTDT< TrackCollection >::magfldToken_, TrackExtenderWithMTDT< TrackCollection >::mtdRecHitBuilder_, TrackExtenderWithMTDT< TrackCollection >::npixBarrelToken, TrackExtenderWithMTDT< TrackCollection >::npixEndcapToken, TrackExtenderWithMTDT< TrackCollection >::pathLengthOrigTrkToken, TrackExtenderWithMTDT< TrackCollection >::pOrigTrkToken, TrackExtenderWithMTDT< TrackCollection >::propagator_, TrackExtenderWithMTDT< TrackCollection >::propToken_, TrackExtenderWithMTDT< TrackCollection >::sigmat0OrigTrkToken, TrackExtenderWithMTDT< TrackCollection >::sigmatmtdOrigTrkToken, TrackExtenderWithMTDT< TrackCollection >::t0OrigTrkToken, TrackExtenderWithMTDT< TrackCollection >::theEstimator, TrackExtenderWithMTDT< TrackCollection >::theTransformer, TrackExtenderWithMTDT< TrackCollection >::tmtdOrigTrkToken, TrackExtenderWithMTDT< TrackCollection >::transientTrackBuilder_, TrackExtenderWithMTDT< TrackCollection >::ttopoToken_, TrackExtenderWithMTDT< TrackCollection >::useSimVertex_, TrackExtenderWithMTDT< TrackCollection >::useVertex_, and TrackExtenderWithMTDT< TrackCollection >::vtxToken_.

422  : tracksToken_(consumes<InputCollection>(iConfig.getParameter<edm::InputTag>("tracksSrc"))),
423  hitsToken_(consumes<MTDTrackingDetSetVector>(iConfig.getParameter<edm::InputTag>("hitsSrc"))),
424  bsToken_(consumes<reco::BeamSpot>(iConfig.getParameter<edm::InputTag>("beamSpotSrc"))),
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")) {
441  if (useVertex_) {
442  if (useSimVertex_) {
443  genVtxPositionToken_ = consumes<GlobalPoint>(iConfig.getParameter<edm::InputTag>("genVtxPositionSrc"));
444  genVtxTimeToken_ = consumes<float>(iConfig.getParameter<edm::InputTag>("genVtxTimeSrc"));
445  } else
446  vtxToken_ = consumes<VertexCollection>(iConfig.getParameter<edm::InputTag>("vtxSrc"));
447  }
448 
449  theEstimator = std::make_unique<Chi2MeasurementEstimator>(estMaxChi2_, estMaxNSigma_);
450  theTransformer = std::make_unique<TrackTransformer>(iConfig.getParameterSet("TrackTransformer"), consumesCollector());
451 
452  btlMatchChi2Token = produces<edm::ValueMap<float>>("btlMatchChi2");
453  etlMatchChi2Token = produces<edm::ValueMap<float>>("etlMatchChi2");
454  btlMatchTimeChi2Token = produces<edm::ValueMap<float>>("btlMatchTimeChi2");
455  etlMatchTimeChi2Token = produces<edm::ValueMap<float>>("etlMatchTimeChi2");
456  npixBarrelToken = produces<edm::ValueMap<int>>("npixBarrel");
457  npixEndcapToken = produces<edm::ValueMap<int>>("npixEndcap");
458  pOrigTrkToken = produces<edm::ValueMap<float>>("generalTrackp");
459  betaOrigTrkToken = produces<edm::ValueMap<float>>("generalTrackBeta");
460  t0OrigTrkToken = produces<edm::ValueMap<float>>("generalTrackt0");
461  sigmat0OrigTrkToken = produces<edm::ValueMap<float>>("generalTracksigmat0");
462  pathLengthOrigTrkToken = produces<edm::ValueMap<float>>("generalTrackPathLength");
463  tmtdOrigTrkToken = produces<edm::ValueMap<float>>("generalTracktmtd");
464  sigmatmtdOrigTrkToken = produces<edm::ValueMap<float>>("generalTracksigmatmtd");
465  assocOrigTrkToken = produces<edm::ValueMap<int>>("generalTrackassoc");
466 
467  builderToken_ = esConsumes<TransientTrackBuilder, TransientTrackRecord>(edm::ESInputTag("", transientTrackBuilder_));
469  esConsumes<TransientTrackingRecHitBuilder, TransientRecHitRecord>(edm::ESInputTag("", mtdRecHitBuilder_));
470  gtgToken_ = esConsumes<GlobalTrackingGeometry, GlobalTrackingGeometryRecord>();
471  dlgeoToken_ = esConsumes<MTDDetLayerGeometry, MTDRecoGeometryRecord>();
472  magfldToken_ = esConsumes<MagneticField, IdealMagneticFieldRecord>();
473  propToken_ = esConsumes<Propagator, TrackingComponentsRecord>(edm::ESInputTag("", propagator_));
474  ttopoToken_ = esConsumes<TrackerTopology, TrackerTopologyRcd>();
475 
476  produces<edm::OwnVector<TrackingRecHit>>();
477  produces<reco::TrackExtraCollection>();
478  produces<TrackCollection>();
479 }
edm::ESGetToken< TransientTrackingRecHitBuilder, TransientRecHitRecord > hitbuilderToken_
edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecord > gtgToken_
edm::EDGetTokenT< reco::BeamSpot > bsToken_
std::unique_ptr< MeasurementEstimator > theEstimator
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > ttopoToken_
edm::EDPutToken pathLengthOrigTrkToken
edm::EDGetTokenT< GlobalPoint > genVtxPositionToken_
edm::EDPutToken assocOrigTrkToken
edm::EDGetTokenT< MTDTrackingDetSetVector > hitsToken_
edm::EDPutToken tmtdOrigTrkToken
edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > builderToken_
const std::string mtdRecHitBuilder_
edm::EDPutToken betaOrigTrkToken
const std::string propagator_
edm::ESGetToken< Propagator, TrackingComponentsRecord > propToken_
edm::EDPutToken etlMatchChi2Token
const std::string transientTrackBuilder_
edm::EDPutToken sigmatmtdOrigTrkToken
edm::EDPutToken btlMatchTimeChi2Token
edm::EDPutToken etlMatchTimeChi2Token
std::unique_ptr< TrackTransformer > theTransformer
edm::EDPutToken sigmat0OrigTrkToken
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magfldToken_
edm::EDGetTokenT< float > genVtxTimeToken_
edm::EDGetTokenT< VertexCollection > vtxToken_
edm::EDPutToken btlMatchChi2Token
edm::EDGetTokenT< InputCollection > tracksToken_
edm::ESGetToken< MTDDetLayerGeometry, MTDRecoGeometryRecord > dlgeoToken_

Member Function Documentation

template<class TrackCollection >
reco::Track TrackExtenderWithMTDT< TrackCollection >::buildTrack ( const reco::Track orig,
const Trajectory traj,
const Trajectory trajWithMtd,
const reco::BeamSpot bs,
const MagneticField field,
const Propagator prop,
bool  hasMTD,
float &  pathLength,
float &  tmtdOut,
float &  sigmatmtdOut 
) const

Definition at line 977 of file TrackExtenderWithMTD.cc.

References funct::abs(), reco::TrackBase::algo(), FreeTrajectoryState::charge(), Trajectory::chiSquared(), FreeTrajectoryState::curvilinearError(), FastTime, DetId::Forward, LogDebug, Trajectory::measurements(), FreeTrajectoryState::momentum(), ndof, Trajectory::ndof(), AlCaHLTBitMon_ParallelJobs::p, FreeTrajectoryState::position(), Propagator::propagateWithPath(), cms_rounding::roundIfNear0(), mathSSE::sqrt(), FrontierCondition_GT_autoExpress_cfi::t0, MTDTrackingRecHit::time(), MTDTrackingRecHit::timeError(), TrajectoryStateClosestToBeamLine::trackStateAtPCA(), reco::TrackBase::undefQuality, findQualityFiles::v, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

986  {
988  bool tsbcl_status = getTrajectoryStateClosestToBeamLine(traj, bs, thePropagator, tscbl);
989 
990  if (!tsbcl_status)
991  return reco::Track();
992 
994  math::XYZPoint pos(v.x(), v.y(), v.z());
996  math::XYZVector mom(p.x(), p.y(), p.z());
997 
998  int ndof = traj.ndof();
999 
1000  double t0 = 0.;
1001  double covt0t0 = -1.;
1002  pathLengthOut = -1.f; // if there is no MTD flag the pathlength with -1
1003  tmtdOut = 0.f;
1004  sigmatmtdOut = -1.f;
1005  double betaOut = 0.;
1006  double covbetabeta = -1.;
1007 
1008  auto routput = [&]() {
1009  return reco::Track(traj.chiSquared(),
1010  int(ndof),
1011  pos,
1012  mom,
1013  tscbl.trackStateAtPCA().charge(),
1015  orig.algo(),
1017  t0,
1018  betaOut,
1019  covt0t0,
1020  covbetabeta);
1021  };
1022 
1023  //compute path length for time backpropagation, using first MTD hit for the momentum
1024  if (hasMTD) {
1025  double pathlength;
1026  bool validpropagation = trackPathLength(trajWithMtd, bs, thePropagator, pathlength);
1027  double thit = 0.;
1028  double thiterror = -1.;
1029  bool validmtd = false;
1030 
1031  if (!validpropagation) {
1032  return routput();
1033  }
1034 
1035  size_t ihitcount(0), ietlcount(0);
1036  for (auto const& hit : trajWithMtd.measurements()) {
1037  if (hit.recHit()->geographicalId().det() == DetId::Forward &&
1038  ForwardSubdetector(hit.recHit()->geographicalId().subdetId()) == FastTime) {
1039  ihitcount++;
1040  if (MTDDetId(hit.recHit()->geographicalId()).mtdSubDetector() == MTDDetId::MTDType::ETL) {
1041  ietlcount++;
1042  }
1043  }
1044  }
1045 
1046  auto ihit1 = trajWithMtd.measurements().cbegin();
1047  if (ihitcount == 1) {
1048  const MTDTrackingRecHit* mtdhit = static_cast<const MTDTrackingRecHit*>((*ihit1).recHit()->hit());
1049  thit = mtdhit->time();
1050  thiterror = mtdhit->timeError();
1051  validmtd = true;
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);
1056  //
1057  // The information of the two ETL hits is combined and attributed to the innermost hit
1058  //
1059  if (etlpathlength == 0.) {
1060  validpropagation = false;
1061  } else {
1062  pathlength -= etlpathlength;
1063  const MTDTrackingRecHit* mtdhit1 = static_cast<const MTDTrackingRecHit*>((*ihit1).recHit()->hit());
1064  const MTDTrackingRecHit* mtdhit2 = static_cast<const MTDTrackingRecHit*>((*(ihit1 + 1)).recHit()->hit());
1065  TrackTofPidInfo tofInfo =
1066  computeTrackTofPidInfo(p.mag2(), etlpathlength, mtdhit1->time(), mtdhit1->timeError(), 0., 0., true);
1067  //
1068  // Protect against incompatible times
1069  //
1070  double err1 = tofInfo.dterror * tofInfo.dterror;
1071  double err2 = mtdhit2->timeError() * mtdhit2->timeError();
1072  if (cms_rounding::roundIfNear0(err1) == 0. || cms_rounding::roundIfNear0(err2) == 0.) {
1073  edm::LogError("TrackExtenderWithMTD")
1074  << "MTD tracking hits with zero time uncertainty: " << err1 << " " << err2;
1075  } else {
1076  if ((tofInfo.dt - mtdhit2->time()) * (tofInfo.dt - mtdhit2->time()) < (err1 + err2) * etlTimeChi2Cut_) {
1077  //
1078  // Subtract the ETL time of flight from the outermost measurement, and combine it in a weighted average with the innermost
1079  // the mass ambiguity related uncertainty on the time of flight is added as an additional uncertainty
1080  //
1081  err1 = 1. / err1;
1082  err2 = 1. / err2;
1083  thiterror = 1. / (err1 + err2);
1084  thit = (tofInfo.dt * err1 + mtdhit2->time() * err2) * thiterror;
1085  thiterror = std::sqrt(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;
1090  validmtd = true;
1091  }
1092  }
1093  }
1094  } else {
1095  edm::LogInfo("TrackExtenderWithMTD")
1096  << "MTD hits #" << ihitcount << "ETL hits #" << ietlcount << " anomalous pattern, skipping...";
1097  }
1098 
1099  if (validmtd && validpropagation) {
1100  //here add the PID uncertainty for later use in the 1st step of 4D vtx reconstruction
1101  TrackTofPidInfo tofInfo = computeTrackTofPidInfo(p.mag2(), pathlength, thit, thiterror, 0., 0., true);
1102  pathLengthOut = pathlength; // set path length if we've got a timing hit
1103  tmtdOut = thit;
1104  sigmatmtdOut = thiterror;
1105  t0 = tofInfo.dt;
1106  covt0t0 = tofInfo.dterror * tofInfo.dterror;
1107  betaOut = tofInfo.beta_pi;
1108  covbetabeta = tofInfo.betaerror * tofInfo.betaerror;
1109  }
1110  }
1111 
1112  return routput();
1113 }
float time() const
T y() const
Definition: PV3DBase.h:60
TrackCharge charge() const
Log< level::Error, false > LogError
ForwardSubdetector
const CurvilinearTrajectoryError & curvilinearError() const
Detector identifier base class for the MIP Timing Layer.
Definition: MTDDetId.h:21
TrackAlgorithm algo() const
Definition: TrackBase.h:547
DataContainer const & measurements() const
Definition: Trajectory.h:178
T sqrt(T t)
Definition: SSEVec.h:19
T z() const
Definition: PV3DBase.h:61
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
constexpr valType roundIfNear0(valType value, double tolerance=1.e-7)
Definition: Rounding.h:11
GlobalVector momentum() const
Log< level::Info, false > LogInfo
GlobalPoint position() const
int ndof(bool bon=true) const
Definition: Trajectory.cc:97
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
A 2D TrackerRecHit with time and time error information.
float chiSquared() const
Definition: Trajectory.h:241
float timeError() const
T x() const
Definition: PV3DBase.h:59
#define LogDebug(id)
template<class TrackCollection >
reco::TrackExtra TrackExtenderWithMTDT< TrackCollection >::buildTrackExtra ( const Trajectory trajectory) const

Definition at line 1116 of file TrackExtenderWithMTD.cc.

References alongMomentum, Surface::bounds(), TrajectoryStateOnSurface::curvilinearError(), Trajectory::direction(), Trajectory::firstMeasurement(), TrajectoryStateOnSurface::globalParameters(), Bounds::inside(), Trajectory::lastMeasurement(), LogTrace, metname, GlobalTrajectoryParameters::momentum(), oppositeToMomentum, AlCaHLTBitMon_ParallelJobs::p, GlobalTrajectoryParameters::position(), TrajectoryMeasurement::recHit(), Trajectory::recHits(), Trajectory::seedRef(), GeomDet::surface(), GeomDet::toLocal(), TrajectoryMeasurement::updatedState(), findQualityFiles::v, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

1116  {
1117  static const string metname = "TrackExtenderWithMTD";
1118 
1119  const Trajectory::RecHitContainer transRecHits = trajectory.recHits();
1120 
1121  // put the collection of TrackingRecHit in the event
1122 
1123  // sets the outermost and innermost TSOSs
1124  // ToDo: validation for track states with MTD
1125  TrajectoryStateOnSurface outerTSOS;
1126  TrajectoryStateOnSurface innerTSOS;
1127  unsigned int innerId = 0, outerId = 0;
1129  DetId outerDetId;
1130 
1131  if (trajectory.direction() == alongMomentum) {
1132  LogTrace(metname) << "alongMomentum";
1133  outerTSOS = trajectory.lastMeasurement().updatedState();
1134  innerTSOS = trajectory.firstMeasurement().updatedState();
1135  outerId = trajectory.lastMeasurement().recHit()->geographicalId().rawId();
1136  innerId = trajectory.firstMeasurement().recHit()->geographicalId().rawId();
1137  outerRecHit = trajectory.lastMeasurement().recHit();
1138  outerDetId = trajectory.lastMeasurement().recHit()->geographicalId();
1139  } else if (trajectory.direction() == oppositeToMomentum) {
1140  LogTrace(metname) << "oppositeToMomentum";
1141  outerTSOS = trajectory.firstMeasurement().updatedState();
1142  innerTSOS = trajectory.lastMeasurement().updatedState();
1143  outerId = trajectory.firstMeasurement().recHit()->geographicalId().rawId();
1144  innerId = trajectory.lastMeasurement().recHit()->geographicalId().rawId();
1145  outerRecHit = trajectory.firstMeasurement().recHit();
1146  outerDetId = trajectory.firstMeasurement().recHit()->geographicalId();
1147  } else
1148  LogError(metname) << "Wrong propagation direction!";
1149 
1150  const GeomDet* outerDet = gtg_->idToDet(outerDetId);
1151  GlobalPoint outerTSOSPos = outerTSOS.globalParameters().position();
1152  bool inside = outerDet->surface().bounds().inside(outerDet->toLocal(outerTSOSPos));
1153 
1154  GlobalPoint hitPos =
1155  (outerRecHit->isValid()) ? outerRecHit->globalPosition() : outerTSOS.globalParameters().position();
1156 
1157  if (!inside) {
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;
1162  }
1163 
1164  //build the TrackExtra
1165  GlobalPoint v = (inside) ? outerTSOSPos : hitPos;
1166  GlobalVector p = outerTSOS.globalParameters().momentum();
1167  math::XYZPoint outpos(v.x(), v.y(), v.z());
1168  math::XYZVector outmom(p.x(), p.y(), p.z());
1169 
1170  v = innerTSOS.globalParameters().position();
1171  p = innerTSOS.globalParameters().momentum();
1172  math::XYZPoint inpos(v.x(), v.y(), v.z());
1173  math::XYZVector inmom(p.x(), p.y(), p.z());
1174 
1175  reco::TrackExtra trackExtra(outpos,
1176  outmom,
1177  true,
1178  inpos,
1179  inmom,
1180  true,
1181  outerTSOS.curvilinearError(),
1182  outerId,
1183  innerTSOS.curvilinearError(),
1184  innerId,
1185  trajectory.direction(),
1186  trajectory.seedRef());
1187 
1188  return trackExtra;
1189 }
ConstRecHitPointer const & recHit() const
virtual bool inside(const Local3DPoint &) const =0
Determine if the point is inside the bounds.
const std::string metname
const CurvilinearTrajectoryError & curvilinearError() const
T y() const
Definition: PV3DBase.h:60
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:58
ConstRecHitContainer recHits() const
Definition: Trajectory.h:186
const Bounds & bounds() const
Definition: Surface.h:87
Log< level::Error, false > LogError
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
#define LogTrace(id)
PropagationDirection const & direction() const
Definition: Trajectory.cc:133
TrajectoryMeasurement const & lastMeasurement() const
Definition: Trajectory.h:150
T z() const
Definition: PV3DBase.h:61
edm::RefToBase< TrajectorySeed > seedRef(void) const
Definition: Trajectory.h:303
Definition: DetId.h:17
TrajectoryMeasurement const & firstMeasurement() const
Definition: Trajectory.h:166
ConstRecHitContainer RecHitContainer
Definition: Trajectory.h:42
const GlobalTrajectoryParameters & globalParameters() const
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
TrackingRecHit::ConstRecHitPointer ConstRecHitPointer
TrajectoryStateOnSurface const & updatedState() const
edm::ESHandle< GlobalTrackingGeometry > gtg_
T x() const
Definition: PV3DBase.h:59
template<class TrackCollection >
RefitDirection::GeometricalDirection TrackExtenderWithMTDT< TrackCollection >::checkRecHitsOrdering ( TransientTrackingRecHit::ConstRecHitContainer const &  recHits) const
inline

Definition at line 336 of file TrackExtenderWithMTD.cc.

References first, RefitDirection::insideOut, dqmdumpme::last, LogDebug, PV3DBase< T, PVType, FrameType >::mag2(), RefitDirection::outsideIn, position, and RefitDirection::undetermined.

337  {
338  if (!recHits.empty()) {
339  GlobalPoint first = gtg_->idToDet(recHits.front()->geographicalId())->position();
340  GlobalPoint last = gtg_->idToDet(recHits.back()->geographicalId())->position();
341 
342  // maybe perp2?
343  auto rFirst = first.mag2();
344  auto rLast = last.mag2();
345  if (rFirst < rLast)
347  if (rFirst > rLast)
349  }
350  LogDebug("TrackExtenderWithMTD") << "Impossible to determine the rechits order" << endl;
352  }
T mag2() const
Definition: PV3DBase.h:63
static int position[264][3]
Definition: ReadPGInfo.cc:289
tuple last
Definition: dqmdumpme.py:56
edm::ESHandle< GlobalTrackingGeometry > gtg_
#define LogDebug(id)
template<class TrackCollection >
string TrackExtenderWithMTDT< TrackCollection >::dumpLayer ( const DetLayer layer) const

Definition at line 1192 of file TrackExtenderWithMTD.cc.

References convertSQLitetoXML_cfg::output, and GeometricSearchDet::surface().

1192  {
1193  stringstream output;
1194 
1195  const BoundSurface* sur = nullptr;
1196  const BoundCylinder* bc = nullptr;
1197  const BoundDisk* bd = nullptr;
1198 
1199  sur = &(layer->surface());
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;
1204  }
1205  return output.str();
1206 }
virtual const BoundSurface & surface() const =0
The surface of the GeometricSearchDet.
template<class TrackCollection >
void TrackExtenderWithMTDT< TrackCollection >::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 482 of file TrackExtenderWithMTD.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), submitPVResolutionJobs::desc, TrackTransformer::fillPSetDescription(), HLT_FULL_cff::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

482  {
484  desc.add<edm::InputTag>("tracksSrc", edm::InputTag("generalTracks"));
485  desc.add<edm::InputTag>("hitsSrc", edm::InputTag("mtdTrackingRecHits"));
486  desc.add<edm::InputTag>("beamSpotSrc", edm::InputTag("offlineBeamSpot"));
487  desc.add<edm::InputTag>("genVtxPositionSrc", edm::InputTag("genParticles:xyz0"));
488  desc.add<edm::InputTag>("genVtxTimeSrc", edm::InputTag("genParticles:t0"));
489  desc.add<edm::InputTag>("vtxSrc", edm::InputTag("offlinePrimaryVertices4D"));
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");
494  desc.add<std::string>("MTDRecHitBuilder", "MTDRecHitBuilder");
495  desc.add<std::string>("Propagator", "PropagatorWithMaterialForMTD");
497  false,
498  "KFFitterForRefitInsideOut",
499  "KFSmootherForRefitInsideOut",
500  "PropagatorWithMaterialForMTD",
501  "alongMomentum",
502  true,
503  "WithTrackAngle",
504  "MuonRecHitBuilder",
505  "MTDRecHitBuilder");
506  desc.add<edm::ParameterSetDescription>("TrackTransformer", transDesc);
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);
518 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static void fillPSetDescription(edm::ParameterSetDescription &descriptions, bool doPredictionsOnly=false, const std::string &fitter="KFFitterForRefitInsideOut", const std::string &smoother="KFSmootherForRefitInsideOut", const std::string &propagator="SmartPropagatorAnyRK", const std::string &refitDirection="alongMomentum", bool refitRPCHits=true, const std::string &trackerRecHitBuilder="WithTrackAngle", const std::string &muonRecHitBuilder="MuonRecHitBuilder", const std::string &mtdRecHitBuilder="MTDRecHitBuilder")
fillDescriptions
template<class TrackCollection >
void TrackExtenderWithMTDT< TrackCollection >::fillMatchingHits ( const DetLayer ilay,
const TrajectoryStateOnSurface tsos,
const Trajectory traj,
const double  pmag2,
const double  pathlength0,
const MTDTrackingDetSetVector hits,
const Propagator prop,
const reco::BeamSpot bs,
const double &  vtxTime,
const bool  matchVertex,
TransientTrackingRecHit::ConstRecHitContainer output,
MTDHitMatchingInfo &  bestHit 
) const

Definition at line 908 of file TrackExtenderWithMTD.cc.

919  {
920  std::set<MTDHitMatchingInfo> hitsInLayer;
921  bool hitMatched = false;
922 
923  using namespace std::placeholders;
924  auto find_hits = std::bind(find_hits_in_dets,
925  std::cref(hits),
926  std::cref(traj),
927  ilay,
928  std::cref(tsos),
929  pmag2,
930  pathlength0,
931  _1,
932  std::cref(bs),
934  prop,
935  theEstimator.get(),
936  _2,
937  std::ref(hitsInLayer));
938 
939  if (useVertex_ && matchVertex)
940  find_hits(vtxTime, true);
941  else
942  find_hits(0, false);
943 
944  //just take the first hit because the hits are sorted on their matching quality
945  if (!hitsInLayer.empty()) {
946  //check hits to pass minimum quality matching requirements
947  auto const& firstHit = *hitsInLayer.begin();
948  if (firstHit.estChi2 < etlChi2Cut_ && firstHit.timeChi2 < etlTimeChi2Cut_) {
949  hitMatched = true;
950  output.push_back(hitbuilder_->build(firstHit.hit));
951  if (firstHit < bestHit)
952  bestHit = firstHit;
953  }
954  }
955 
956  if (useVertex_ && matchVertex && !hitMatched) {
957  //try a second search with beamspot hypothesis
958  hitsInLayer.clear();
959  find_hits(0, false);
960  if (!hitsInLayer.empty()) {
961  auto const& firstHit = *hitsInLayer.begin();
962  if (firstHit.timeChi2 < etlTimeChi2Cut_) {
963  if (firstHit.estChi2 < etlChi2Cut_) {
964  hitMatched = true;
965  output.push_back(hitbuilder_->build(firstHit.hit));
966  if (firstHit < bestHit)
967  bestHit = firstHit;
968  }
969  }
970  }
971  }
972 }
std::unique_ptr< MeasurementEstimator > theEstimator
edm::ESHandle< TransientTrackingRecHitBuilder > hitbuilder_
template<class TrackCollection >
template<class H , class T >
void TrackExtenderWithMTDT< TrackCollection >::fillValueMap ( edm::Event iEvent,
const H &  handle,
const std::vector< T > &  vec,
const edm::EDPutToken token 
) const

Definition at line 522 of file TrackExtenderWithMTD.cc.

References eostools::move(), submitPVResolutionJobs::out, and edm::Event::put().

525  {
526  auto out = std::make_unique<edm::ValueMap<T>>();
527  typename edm::ValueMap<T>::Filler filler(*out);
528  filler.insert(handle, vec.begin(), vec.end());
529  filler.fill();
530  iEvent.put(token, std::move(out));
531 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
def move
Definition: eostools.py:511
tuple handle
Definition: patZpeak.py:23
template<class TrackCollection >
void TrackExtenderWithMTDT< TrackCollection >::produce ( edm::Event ev,
const edm::EventSetup es 
)
final

trajs.empty()

setup the track extras

Definition at line 534 of file TrackExtenderWithMTD.cc.

References funct::abs(), cms::cuda::bs, PVValHelper::dz, edm::Event::get(), edm::EventSetup::getHandle(), edm::Event::getHandle(), edm::Event::getRefBeforePut(), edm::EventSetup::getTransientHandle(), RefitDirection::insideOut, LogTrace, PV3DBase< T, PVType, FrameType >::mag2(), volumeBasedMagneticField_160812_cfi::magfield, FreeTrajectoryState::momentum(), eostools::move(), reco::TrackBase::ndof(), config::ordering, convertSQLitetoXML_cfg::output, reco::Vertex::position(), edm::Event::put(), MetAnalyzer::pv(), mps_fire::result, mathSSE::sqrt(), reco::Vertex::t(), HLT_FULL_cff::track, tracks, and TrajectoryStateClosestToBeamLine::trackStateAtPCA().

534  {
535  //this produces pieces of the track extra
536  Traj2TrackHits t2t;
537 
538  theTransformer->setServices(es);
539 
542 
543  gtg_ = es.getHandle(gtgToken_);
544 
545  auto geo = es.getTransientHandle(dlgeoToken_);
546 
548 
551 
552  auto propH = es.getTransientHandle(propToken_);
553  const Propagator* prop = propH.product();
554 
555  auto httopo = es.getTransientHandle(ttopoToken_);
556  const TrackerTopology& ttopo = *httopo;
557 
558  auto output = std::make_unique<TrackCollection>();
559  auto extras = std::make_unique<reco::TrackExtraCollection>();
560  auto outhits = std::make_unique<edm::OwnVector<TrackingRecHit>>();
561 
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;
576 
577  auto const tracksH = ev.getHandle(tracksToken_);
578  const auto& tracks = *tracksH;
579 
580  //MTD hits DetSet
581  const auto& hits = ev.get(hitsToken_);
582 
583  //beam spot
584  const auto& bs = ev.get(bsToken_);
585 
586  const Vertex* pv = nullptr;
587  if (useVertex_ && !useSimVertex_) {
588  auto const& vtxs = ev.get(vtxToken_);
589  if (!vtxs.empty())
590  pv = &vtxs[0];
591  }
592 
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);
599  }
600 
601  double vtxTime = 0.;
602  if (useVertex_) {
603  if (useSimVertex_ && genPV) {
604  vtxTime = genPV->t();
605  } else if (pv)
606  vtxTime = pv->t(); //already in ns
607  }
608 
609  std::vector<unsigned> track_indices;
610  unsigned itrack = 0;
611 
612  for (const auto& track : tracks) {
613  double trackVtxTime = 0.;
614  if (useVertex_) {
615  double dz;
616  if (useSimVertex_)
617  dz = std::abs(track.dz(math::XYZPoint(*genPV)));
618  else
619  dz = std::abs(track.dz(pv->position()));
620 
621  if (dz < dzCut_)
622  trackVtxTime = vtxTime;
623  }
624 
625  reco::TransientTrack ttrack(track, magfield.product(), gtg_);
626  const auto& trajs = theTransformer->transform(track);
627  auto thits = theTransformer->getTransientRecHits(ttrack);
629  MTDHitMatchingInfo mBTL, mETL;
630  if (!trajs.empty()) {
631  // get the outermost trajectory point on the track
632  TrajectoryStateOnSurface tsos = builder_->build(track).outermostMeasurementState();
634  bool tscbl_status = getTrajectoryStateClosestToBeamLine(trajs.front(), bs, prop, tscbl);
635 
636  if (tscbl_status) {
637  double pmag2 = tscbl.trackStateAtPCA().momentum().mag2();
638  double pathlength0;
639  trackPathLength(trajs.front(), tscbl, prop, pathlength0);
640 
641  const auto& btlhits = tryBTLLayers(tsos,
642  trajs.front(),
643  pmag2,
644  pathlength0,
645  hits,
646  geo.product(),
647  magfield.product(),
648  prop,
649  bs,
650  trackVtxTime,
651  trackVtxTime != 0.,
652  mBTL);
653  mtdthits.insert(mtdthits.end(), btlhits.begin(), btlhits.end());
654 
655  // in the future this should include an intermediate refit before propagating to the ETL
656  // for now it is ok
657  const auto& etlhits = tryETLLayers(tsos,
658  trajs.front(),
659  pmag2,
660  pathlength0,
661  hits,
662  geo.product(),
663  magfield.product(),
664  prop,
665  bs,
666  trackVtxTime,
667  trackVtxTime != 0.,
668  mETL);
669  mtdthits.insert(mtdthits.end(), etlhits.begin(), etlhits.end());
670  }
671  }
672 
673  auto ordering = checkRecHitsOrdering(thits);
675  thits.insert(thits.end(), mtdthits.begin(), mtdthits.end());
676  } else {
677  std::reverse(mtdthits.begin(), mtdthits.end());
678  mtdthits.insert(mtdthits.end(), thits.begin(), thits.end());
679  thits.swap(mtdthits);
680  }
681 
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,
684  sigmatmtdMap = -1.f;
685  int iMap = -1;
686 
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;
691  thetrj,
692  trj,
693  bs,
694  magfield.product(),
695  prop,
696  !trajwithmtd.empty() && !mtdthits.empty(),
697  pathLength,
698  tmtd,
699  sigmatmtd);
700  if (result.ndof() >= 0) {
702  reco::TrackExtra::TrajParams trajParams;
704  size_t hitsstart = outhits->size();
705  if (updatePattern_) {
706  t2t(trj, *outhits, trajParams, chi2s); // this fills the output hit collection
707  } else {
708  t2t(thetrj, *outhits, trajParams, chi2s);
709  }
710  size_t hitsend = outhits->size();
711  extras->push_back(buildTrackExtra(trj)); // always push back the fully built extra, update by setting in track
712  extras->back().setHits(hitsRefProd, hitsstart, hitsend - hitsstart);
713  extras->back().setTrajParams(trajParams, chi2s);
714  //create the track
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;
721  tmtdMap = tmtd;
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());
729  reco::TrackExtraRef extraRef(extrasRefProd, extras->size() - 1);
730  backtrack.setExtra((updateExtra_ ? extraRef : track.extra()));
731  for (unsigned ihit = hitsstart; ihit < hitsend; ++ihit) {
732  backtrack.appendHitPattern((*outhits)[ihit], ttopo);
733  }
734  npixBarrel.push_back(backtrack.hitPattern().numberOfValidPixelBarrelHits());
735  npixEndcap.push_back(backtrack.hitPattern().numberOfValidPixelEndcapHits());
736  } else {
737  LogTrace("TrackExtenderWithMTD") << "Error in the MTD track refitting. This should not happen";
738  }
739  }
740 
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);
749 
750  if (iMap == -1) {
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.);
757  }
758 
759  ++itrack;
760  }
761 
762  auto outTrksHandle = ev.put(std::move(output));
763  ev.put(std::move(extras));
764  ev.put(std::move(outhits));
765 
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);
780 }
T mag2() const
Definition: PV3DBase.h:63
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
edm::ESGetToken< TransientTrackingRecHitBuilder, TransientRecHitRecord > hitbuilderToken_
std::vector< unsigned char > Chi2sFive
reco::TrackExtra buildTrackExtra(const Trajectory &trajectory) const
edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecord > gtgToken_
edm::EDGetTokenT< reco::BeamSpot > bsToken_
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > ttopoToken_
edm::EDPutToken pathLengthOrigTrkToken
edm::EDGetTokenT< GlobalPoint > genVtxPositionToken_
auto const & tracks
cannot be loose
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
const Point & position() const
position
Definition: Vertex.h:127
edm::EDPutToken assocOrigTrkToken
edm::EDGetTokenT< MTDTrackingDetSetVector > hitsToken_
#define LogTrace(id)
tuple result
Definition: mps_fire.py:311
list ordering
Definition: config.py:7
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
Definition: Event.h:563
std::vector< LocalTrajectoryParameters > TrajParams
edm::EDPutToken tmtdOrigTrkToken
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_
double ndof() const
number of degrees of freedom of the fit
Definition: TrackBase.h:590
T sqrt(T t)
Definition: SSEVec.h:19
edm::EDPutToken betaOrigTrkToken
def move
Definition: eostools.py:511
RefitDirection::GeometricalDirection checkRecHitsOrdering(TransientTrackingRecHit::ConstRecHitContainer const &recHits) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool get(ProductID const &oid, Handle< PROD > &result) const
Definition: Event.h:346
edm::ESGetToken< Propagator, TrackingComponentsRecord > propToken_
edm::EDPutToken etlMatchChi2Token
edm::ESHandle< TransientTrackingRecHitBuilder > hitbuilder_
GlobalVector momentum() const
RefProd< PROD > getRefBeforePut()
Definition: Event.h:158
std::vector< ConstRecHitPointer > ConstRecHitContainer
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:10
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
edm::EDPutToken sigmatmtdOrigTrkToken
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_
ESTransientHandle< T > getTransientHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:168
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:157
edm::ESHandle< GlobalTrackingGeometry > gtg_
edm::EDGetTokenT< float > genVtxTimeToken_
edm::EDGetTokenT< VertexCollection > vtxToken_
edm::EDPutToken btlMatchChi2Token
edm::EDGetTokenT< InputCollection > tracksToken_
double t() const
t coordinate
Definition: Vertex.h:135
void fillValueMap(edm::Event &iEvent, const H &handle, const std::vector< T > &vec, const edm::EDPutToken &token) const
edm::ESGetToken< MTDDetLayerGeometry, MTDRecoGeometryRecord > dlgeoToken_
template<class TrackCollection >
TransientTrackingRecHit::ConstRecHitContainer TrackExtenderWithMTDT< TrackCollection >::tryBTLLayers ( const TrajectoryStateOnSurface tsos,
const Trajectory traj,
const double  pmag2,
const double  pathlength0,
const MTDTrackingDetSetVector hits,
const MTDDetLayerGeometry geo,
const MagneticField field,
const Propagator prop,
const reco::BeamSpot bs,
const double  vtxTime,
const bool  matchVertex,
MTDHitMatchingInfo &  bestHit 
) const

Definition at line 847 of file TrackExtenderWithMTD.cc.

References MTDDetLayerGeometry::allBTLLayers(), LayerTriplets::layers(), and convertSQLitetoXML_cfg::output.

859  {
860  const vector<const DetLayer*>& layers = geo->allBTLLayers();
861 
863  bestHit = MTDHitMatchingInfo();
864  for (const DetLayer* ilay : layers)
865  fillMatchingHits(ilay, tsos, traj, pmag2, pathlength0, hits, prop, bs, vtxTime, matchVertex, output, bestHit);
866  return output;
867 }
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4
const std::vector< const DetLayer * > & allBTLLayers() const
return the BTL DetLayers (barrel), inside-out
std::vector< ConstRecHitPointer > ConstRecHitContainer
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
template<class TrackCollection >
TransientTrackingRecHit::ConstRecHitContainer TrackExtenderWithMTDT< TrackCollection >::tryETLLayers ( const TrajectoryStateOnSurface tsos,
const Trajectory traj,
const double  pmag2,
const double  pathlength0,
const MTDTrackingDetSetVector hits,
const MTDDetLayerGeometry geo,
const MagneticField field,
const Propagator prop,
const reco::BeamSpot bs,
const double  vtxTime,
const bool  matchVertex,
MTDHitMatchingInfo &  bestHit 
) const

Definition at line 870 of file TrackExtenderWithMTD.cc.

References funct::abs(), MTDDetLayerGeometry::allETLLayers(), TrajectoryStateOnSurface::globalPosition(), LayerTriplets::layers(), convertSQLitetoXML_cfg::output, detailsBasic3DVector::z, and PV3DBase< T, PVType, FrameType >::z().

882  {
883  const vector<const DetLayer*>& layers = geo->allETLLayers();
884 
886  bestHit = MTDHitMatchingInfo();
887  for (const DetLayer* ilay : layers) {
888  const BoundDisk& disk = static_cast<const ForwardDetLayer*>(ilay)->specificSurface();
889  const double diskZ = disk.position().z();
890 
891  if (tsos.globalPosition().z() * diskZ < 0)
892  continue; // only propagate to the disk that's on the same side
893 
894  fillMatchingHits(ilay, tsos, traj, pmag2, pathlength0, hits, prop, bs, vtxTime, matchVertex, output, bestHit);
895  }
896 
897  // the ETL hits order must be from the innermost to the outermost
898 
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());
902  }
903  }
904  return output;
905 }
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4
GlobalPoint globalPosition() const
const std::vector< const DetLayer * > & allETLLayers() const
return the ETL DetLayers (endcap), -Z to +Z
T z() const
Definition: PV3DBase.h:61
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< ConstRecHitPointer > ConstRecHitContainer
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

Member Data Documentation

template<class TrackCollection >
edm::EDPutToken TrackExtenderWithMTDT< TrackCollection >::assocOrigTrkToken
private
template<class TrackCollection >
edm::EDPutToken TrackExtenderWithMTDT< TrackCollection >::betaOrigTrkToken
private
template<class TrackCollection >
const float TrackExtenderWithMTDT< TrackCollection >::bsTimeSpread_
private

Definition at line 417 of file TrackExtenderWithMTD.cc.

template<class TrackCollection >
edm::EDGetTokenT<reco::BeamSpot> TrackExtenderWithMTDT< TrackCollection >::bsToken_
private

Definition at line 386 of file TrackExtenderWithMTD.cc.

template<class TrackCollection >
const float TrackExtenderWithMTDT< TrackCollection >::btlChi2Cut_
private

Definition at line 409 of file TrackExtenderWithMTD.cc.

template<class TrackCollection >
edm::EDPutToken TrackExtenderWithMTDT< TrackCollection >::btlMatchChi2Token
private
template<class TrackCollection >
edm::EDPutToken TrackExtenderWithMTDT< TrackCollection >::btlMatchTimeChi2Token
private
template<class TrackCollection >
const float TrackExtenderWithMTDT< TrackCollection >::btlTimeChi2Cut_
private

Definition at line 410 of file TrackExtenderWithMTD.cc.

template<class TrackCollection >
edm::ESHandle<TransientTrackBuilder> TrackExtenderWithMTDT< TrackCollection >::builder_
private

Definition at line 395 of file TrackExtenderWithMTD.cc.

template<class TrackCollection >
edm::ESGetToken<TransientTrackBuilder, TransientTrackRecord> TrackExtenderWithMTDT< TrackCollection >::builderToken_
private
template<class TrackCollection >
edm::ESGetToken<MTDDetLayerGeometry, MTDRecoGeometryRecord> TrackExtenderWithMTDT< TrackCollection >::dlgeoToken_
private
template<class TrackCollection >
const float TrackExtenderWithMTDT< TrackCollection >::dzCut_
private

Definition at line 416 of file TrackExtenderWithMTD.cc.

template<class TrackCollection >
const float TrackExtenderWithMTDT< TrackCollection >::estMaxChi2_
private
template<class TrackCollection >
const float TrackExtenderWithMTDT< TrackCollection >::estMaxNSigma_
private
template<class TrackCollection >
const float TrackExtenderWithMTDT< TrackCollection >::etlChi2Cut_
private

Definition at line 411 of file TrackExtenderWithMTD.cc.

template<class TrackCollection >
edm::EDPutToken TrackExtenderWithMTDT< TrackCollection >::etlMatchChi2Token
private
template<class TrackCollection >
edm::EDPutToken TrackExtenderWithMTDT< TrackCollection >::etlMatchTimeChi2Token
private
template<class TrackCollection >
const float TrackExtenderWithMTDT< TrackCollection >::etlTimeChi2Cut_
private

Definition at line 412 of file TrackExtenderWithMTD.cc.

template<class TrackCollection >
edm::EDGetTokenT<GlobalPoint> TrackExtenderWithMTDT< TrackCollection >::genVtxPositionToken_
private
template<class TrackCollection >
edm::EDGetTokenT<float> TrackExtenderWithMTDT< TrackCollection >::genVtxTimeToken_
private
template<class TrackCollection >
edm::ESHandle<GlobalTrackingGeometry> TrackExtenderWithMTDT< TrackCollection >::gtg_
private

Definition at line 399 of file TrackExtenderWithMTD.cc.

template<class TrackCollection >
edm::ESHandle<TransientTrackingRecHitBuilder> TrackExtenderWithMTDT< TrackCollection >::hitbuilder_
private

Definition at line 397 of file TrackExtenderWithMTD.cc.

template<class TrackCollection >
edm::ESGetToken<TransientTrackingRecHitBuilder, TransientRecHitRecord> TrackExtenderWithMTDT< TrackCollection >::hitbuilderToken_
private
template<class TrackCollection >
edm::EDGetTokenT<MTDTrackingDetSetVector> TrackExtenderWithMTDT< TrackCollection >::hitsToken_
private

Definition at line 385 of file TrackExtenderWithMTD.cc.

template<class TrackCollection >
edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> TrackExtenderWithMTDT< TrackCollection >::magfldToken_
private
template<class TrackCollection >
const std::string TrackExtenderWithMTDT< TrackCollection >::mtdRecHitBuilder_
private
template<class TrackCollection >
edm::EDPutToken TrackExtenderWithMTDT< TrackCollection >::npixBarrelToken
private
template<class TrackCollection >
edm::EDPutToken TrackExtenderWithMTDT< TrackCollection >::npixEndcapToken
private
template<class TrackCollection >
edm::EDPutToken TrackExtenderWithMTDT< TrackCollection >::pathLengthOrigTrkToken
private
template<class TrackCollection >
edm::EDPutToken TrackExtenderWithMTDT< TrackCollection >::pOrigTrkToken
private
template<class TrackCollection >
const std::string TrackExtenderWithMTDT< TrackCollection >::propagator_
private
template<class TrackCollection >
edm::ESGetToken<Propagator, TrackingComponentsRecord> TrackExtenderWithMTDT< TrackCollection >::propToken_
private
template<class TrackCollection >
edm::EDPutToken TrackExtenderWithMTDT< TrackCollection >::sigmat0OrigTrkToken
private
template<class TrackCollection >
edm::EDPutToken TrackExtenderWithMTDT< TrackCollection >::sigmatmtdOrigTrkToken
private
template<class TrackCollection >
edm::EDPutToken TrackExtenderWithMTDT< TrackCollection >::t0OrigTrkToken
private
template<class TrackCollection >
std::unique_ptr<MeasurementEstimator> TrackExtenderWithMTDT< TrackCollection >::theEstimator
private
template<class TrackCollection >
std::unique_ptr<TrackTransformer> TrackExtenderWithMTDT< TrackCollection >::theTransformer
private
template<class TrackCollection >
edm::EDPutToken TrackExtenderWithMTDT< TrackCollection >::tmtdOrigTrkToken
private
template<class TrackCollection >
edm::EDGetTokenT<InputCollection> TrackExtenderWithMTDT< TrackCollection >::tracksToken_
private

Definition at line 384 of file TrackExtenderWithMTD.cc.

template<class TrackCollection >
const std::string TrackExtenderWithMTDT< TrackCollection >::transientTrackBuilder_
private
template<class TrackCollection >
edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> TrackExtenderWithMTDT< TrackCollection >::ttopoToken_
private
template<class TrackCollection >
const bool TrackExtenderWithMTDT< TrackCollection >::updateExtra_
private

Definition at line 391 of file TrackExtenderWithMTD.cc.

template<class TrackCollection >
const bool TrackExtenderWithMTDT< TrackCollection >::updatePattern_
private

Definition at line 391 of file TrackExtenderWithMTD.cc.

template<class TrackCollection >
const bool TrackExtenderWithMTDT< TrackCollection >::updateTraj_
private

Definition at line 391 of file TrackExtenderWithMTD.cc.

template<class TrackCollection >
const bool TrackExtenderWithMTDT< TrackCollection >::useSimVertex_
private
template<class TrackCollection >
const bool TrackExtenderWithMTDT< TrackCollection >::useVertex_
private
template<class TrackCollection >
edm::EDGetTokenT<VertexCollection> TrackExtenderWithMTDT< TrackCollection >::vtxToken_
private