@@ -27,6 +27,36 @@ namespace KinKal {
2727 SimpleWireHit (BFieldMap const & bfield, PCA const & pca, WireHitState const & whstate, double mindoca,
2828 double driftspeed, double tvar, double tot, double totvar, double rcell,int id);
2929 unsigned nResid () const override { return 2 ; } // 2 residuals
30+ // clone op for reinstantiation
31+ SimpleWireHit (SimpleWireHit<KTRAJ> const & rhs):
32+ ResidualHit<KTRAJ>(rhs),
33+ bfield_ (rhs.bfield()),
34+ whstate_ (rhs.hitState()),
35+ wire_ (rhs.wire()),
36+ ca_ (
37+ rhs.closestApproach().particleTraj(),
38+ wire_,
39+ rhs.closestApproach().hint(),
40+ rhs.closestApproach().precision()
41+ ),
42+ rresid_ (rhs.residuals()),
43+ mindoca_ (rhs.minDOCA()),
44+ dvel_ (driftVelocity()),
45+ tvar_ (timeVariance()),
46+ tot_ (rhs.tot()),
47+ totvar_ (rhs.totVariance()),
48+ rcell_ (rhs.cellRadius()),
49+ id_ (rhs.id()){
50+ /* */
51+ };
52+ std::shared_ptr< Hit<KTRAJ> > clone (CloneContext& context) const override {
53+ auto rv = std::make_shared< SimpleWireHit<KTRAJ> >(*this );
54+ auto ca = rv->closestApproach ();
55+ auto trajectory = std::make_shared<KTRAJ>(ca.particleTraj ());
56+ ca.setTrajectory (trajectory);
57+ rv->setClosestApproach (ca);
58+ return rv;
59+ };
3060 double time () const override { return ca_.particleToca (); }
3161 VEC3 dRdX (unsigned ires) const ;
3262 Residual const & refResidual (unsigned ires=dresid) const override ;
@@ -48,6 +78,10 @@ namespace KinKal {
4878 auto const & wire () const { return wire_; }
4979 auto const & bfield () const { return bfield_; }
5080 auto precision () const { return ca_.precision (); }
81+ auto const & residuals () const { return rresid_; }
82+ double tot () const { return tot_; }
83+ double totVariance () const { return totvar_; }
84+
5185 private:
5286 BFieldMap const & bfield_; // drift calculation requires the BField for ExB effects
5387 WireHitState whstate_; // current state
@@ -65,6 +99,9 @@ namespace KinKal {
6599 double rcell_; // straw radius
66100 int id_; // id
67101 void updateResiduals ();
102+
103+ // modifiers to support cloning
104+ void setClosestApproach (const CA& ca){ ca_ = ca; }
68105 };
69106
70107 // trivial 'updater' that sets the wire hit state to null
0 commit comments