203 auto outputTracks = std::make_unique<std::vector<recob::Track>>();
204 auto outputHitsMeta =
205 std::make_unique<art::Assns<recob::Track, recob::Hit, recob::TrackHitMeta>>();
206 auto outputHits = std::make_unique<art::Assns<recob::Track, recob::Hit>>();
207 auto outputHitInfo = std::make_unique<std::vector<std::vector<recob::TrackFitHitInfo>>>();
210 auto outputTTjTAssn = std::make_unique<art::Assns<recob::TrackTrajectory, recob::Track>>();
211 auto outputTjTAssn = std::make_unique<art::Assns<recob::Trajectory, recob::Track>>();
213 auto const tid = e.
getProductID<std::vector<recob::Track>>();
216 auto outputSpacePoints = std::make_unique<std::vector<recob::SpacePoint>>();
217 auto outputHitSpacePointAssn = std::make_unique<art::Assns<recob::Hit, recob::SpacePoint>>();
218 auto const spid = e.
getProductID<std::vector<recob::SpacePoint>>();
227 for (
unsigned int iMC = 0; iMC < simTracks->size(); ++iMC) {
230 if (mctrack.
PdgCode() != 13)
continue;
231 if (mctrack.
Process() !=
"primary")
continue;
233 mcdir = TVector3(mctrack.
Start().
Momentum().X() * 0.001 / pMC,
241 unsigned int nTrajs = 0;
245 const std::vector<recob::TrackTrajectory>* trackTrajectoryVec =
nullptr;
246 const std::vector<recob::Trajectory>* trajectoryVec =
nullptr;
253 <<
"Cannot find recob::TrackTrajectory art::Handle with inputTag " <<
trajectoryInputTag;
254 trackTrajectoryVec = inputTrackTrajectoryH.
product();
255 trackTrajectoryHitsAssn =
258 nTrajs = trackTrajectoryVec->size();
265 trajectoryVec = inputTrajectoryH.
product();
268 nTrajs = trajectoryVec->size();
273 for (
unsigned int iTraj = 0; iTraj < nTrajs; ++iTraj) {
276 (
isTT ? trackTrajectoryVec->at(iTraj) :
278 std::vector<recob::TrajectoryPointFlags>()));
281 std::vector<art::Ptr<recob::Hit>> inHits;
283 for (
auto it = trackTrajectoryHitsAssn->
begin(); it != trackTrajectoryHitsAssn->
end(); ++it) {
284 if (it->first.key() == iTraj)
285 inHits.push_back(it->second);
286 else if (inHits.size() > 0)
291 for (
auto it = trajectoryHitsAssn->
begin(); it != trajectoryHitsAssn->
end(); ++it) {
292 if (it->first.key() == iTraj)
293 inHits.push_back(it->second);
294 else if (inHits.size() > 0)
300 const bool flipDir =
setDirFlip(&inTraj, mcdir);
303 std::vector<art::Ptr<recob::Hit>> outHits;
318 if (!fitok)
continue;
320 if (
p_().
options().keepInputTrajectoryPoints()) {
324 outputTracks->emplace_back(
std::move(outTrack));
327 for (
auto const& trhit : outHits) {
330 outputHitsMeta->addSingle(aptr, trhit,
metadata);
331 outputHits->addSingle(aptr, trhit);
332 if (
p_().
options().produceSpacePoints() && outputTracks->back().HasValidPoint(ip)) {
333 auto& tp = outputTracks->back().Trajectory().LocationAtPoint(ip);
334 double fXYZ[3] = {tp.X(), tp.Y(), tp.Z()};
335 double fErrXYZ[6] = {0};
337 outputSpacePoints->emplace_back(
std::move(sp));
339 outputHitSpacePointAssn->addSingle(trhit, apsp);
356 if (
p_().
options().produceSpacePoints()) {
trkf::TrackKalmanFitter kalmanFitter
void restoreInputPoints(const recob::TrackTrajectory &track, const std::vector< art::Ptr< recob::Hit >> &inHits, recob::Track &outTrack, std::vector< art::Ptr< recob::Hit >> &outHits) const
void initTrackFitInfos()
initialize the output vector of TrackFitHitInfos
ProductID getProductID(std::string const &instance_name="") const
recob::tracking::SMatrixSym55 SMatrixSym55
bool fitTrack(detinfo::DetectorPropertiesData const &detProp, const recob::TrackTrajectory &traj, int tkID, const SMatrixSym55 &covVtx, const SMatrixSym55 &covEnd, const std::vector< art::Ptr< recob::Hit >> &hits, const double pval, const int pdgid, const bool flipDirection, recob::Track &outTrack, std::vector< art::Ptr< recob::Hit >> &outHits, trkmkr::OptionalOutputs &optionals) const
Fit track starting from TrackTrajectory.
art::InputTag simTrackInputTag
const_iterator begin() const
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
T const * product() const
A trajectory in space reconstructed from hits.
EDProductGetter const * productGetter(ProductID const pid) const
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
double setMomValue(const recob::TrackTrajectory *ptraj, const double pMC, const int pId) const
const TLorentzVector & Momentum() const
const_iterator end() const
std::vector< recob::TrackFitHitInfo > trackFitHitInfos()
get the output vector of TrackFitHitInfos by releasing and moving
const std::string & Process() const
const MCStep & Start() const
bool setDirFlip(const recob::TrackTrajectory *ptraj, TVector3 &mcdir) const
art::InputTag trajectoryInputTag
Struct holding optional TrackMaker outputs.
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
cet::coded_exception< error, detail::translate > exception