Skip to content

Commit 4f603b9

Browse files
committed
Merge branch 'main' into regrow
2 parents d071e58 + 3c80e4a commit 4f603b9

File tree

8 files changed

+60
-24
lines changed

8 files changed

+60
-24
lines changed

Detector/ParameterHit.hh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,18 @@ namespace KinKal {
1515
using PTRAJ = ParticleTrajectory<KTRAJ>;
1616
using KTRAJPTR = std::shared_ptr<KTRAJ>;
1717

18-
// clone op for reinstantiation
18+
// copy constructor
1919
ParameterHit(ParameterHit<KTRAJ> const& rhs):
2020
time_(rhs.time()),
2121
params_(rhs.constraintParameters()),
22-
pweight_(rhs.pweight()),
22+
pweight_(rhs.parameterWeights()),
2323
weight_(rhs.weight()),
24-
pmask_(rhs.pmask()),
25-
mask_(rhs.mask()),
26-
ncons_(rhs.ncons()){
24+
pmask_(rhs.constraintMask()),
25+
mask_(rhs.maskMatrix()),
26+
ncons_(rhs.numConstrainedParameters()){
2727
/**/
2828
};
29+
// clone op for reinstantiation
2930
std::shared_ptr< Hit<KTRAJ> > clone(CloneContext& context) const override{
3031
auto rv = std::make_shared< ParameterHit<KTRAJ> >(*this);
3132
return rv;
@@ -47,10 +48,9 @@ namespace KinKal {
4748
unsigned nDOF() const override { return ncons_; }
4849
Parameters const& constraintParameters() const { return params_; }
4950
PMASK const& constraintMask() const { return pmask_; }
50-
Weights pweight() const { return pweight_; };
51-
PMASK pmask() const { return pmask_; };
52-
DMAT mask() const { return mask_; }
53-
unsigned ncons() const { return ncons_; };
51+
Weights parameterWeights() const { return pweight_; };
52+
DMAT maskMatrix() const { return mask_; }
53+
unsigned numConstrainedParameters() const { return ncons_; };
5454
private:
5555
double time_; // time of this constraint: must be supplied on construction and does not change
5656
KTRAJPTR reftraj_; // reference WRT this hits weight was calculated

Detector/ResidualHit.hh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace KinKal {
1010

1111
template <class KTRAJ> class ResidualHit : public Hit<KTRAJ> {
1212
public:
13-
// clone op for reinstantiation
13+
// copy constructor
1414
ResidualHit(ResidualHit<KTRAJ> const& rhs): weight_(rhs.weight()){
1515
/**/
1616
};

Examples/ScintHit.hh

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,28 @@ namespace KinKal {
1717
using RESIDHIT = ResidualHit<KTRAJ>;
1818
using HIT = Hit<KTRAJ>;
1919
using KTRAJPTR = std::shared_ptr<KTRAJ>;
20-
// clone op for reinstantiation
20+
// copy constructor
2121
ScintHit(ScintHit<KTRAJ> const& rhs):
2222
ResidualHit<KTRAJ>(rhs),
2323
saxis_(rhs.sensorAxis()),
2424
tvar_(rhs.timeVariance()),
2525
wvar_(rhs.widthVariance()),
26-
tpca_(rhs.closestApproach()),
26+
tpca_(
27+
rhs.closestApproach().particleTraj(),
28+
saxis_,
29+
rhs.closestApproach().hint(),
30+
rhs.closestApproach().precision()
31+
),
2732
rresid_(rhs.refResidual()){
2833
/**/
2934
};
35+
// clone op for reinstantiation
3036
std::shared_ptr< Hit<KTRAJ> > clone(CloneContext& context) const override{
3137
auto rv = std::make_shared< ScintHit<KTRAJ> >(*this);
38+
auto ca = rv->closestApproach();
39+
auto trajectory = std::make_shared<KTRAJ>(ca.particleTraj());
40+
ca.setTrajectory(trajectory);
41+
rv->setClosestApproach(ca);
3242
return rv;
3343
};
3444
// ResidualHit interface implementation
@@ -54,6 +64,9 @@ namespace KinKal {
5464
double wvar_; // variance in transverse position of the sensor/measurement in mm. Assumes cylindrical error, could be more general
5565
CA tpca_; // reference time and position of closest approach to the axis
5666
Residual rresid_; // residual WRT most recent reference parameters
67+
68+
// modifiers to support cloning
69+
void setClosestApproach(const CA& ca){ tpca_ = ca; }
5770
};
5871

5972
template <class KTRAJ> ScintHit<KTRAJ>::ScintHit(PCA const& pca, double tvar, double wvar) :

Examples/SimpleWireHit.hh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ namespace KinKal {
8181
auto const& residuals() const { return rresid_; }
8282
double tot() const { return tot_; }
8383
double totVariance() const { return totvar_; }
84-
// other accessors
85-
void setClosestApproach(const CA& ca){ ca_ = ca; }
84+
8685
private:
8786
BFieldMap const& bfield_; // drift calculation requires the BField for ExB effects
8887
WireHitState whstate_; // current state
@@ -100,6 +99,9 @@ namespace KinKal {
10099
double rcell_; // straw radius
101100
int id_; // id
102101
void updateResiduals();
102+
103+
// modifiers to support cloning
104+
void setClosestApproach(const CA& ca){ ca_ = ca; }
103105
};
104106

105107
//trivial 'updater' that sets the wire hit state to null

Examples/StrawXing.hh

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,25 @@ namespace KinKal {
2121
// construct from PCA and material
2222
StrawXing(PCA const& pca, StrawMaterial const& smat);
2323
virtual ~StrawXing() {}
24+
// copy constructor
25+
StrawXing(StrawXing const& rhs):
26+
ElementXing<KTRAJ>(rhs),
27+
axis_(rhs.axis_),
28+
smat_(rhs.smat_),
29+
tpca_(
30+
rhs.closestApproach().particleTraj(),
31+
axis_,
32+
rhs.closestApproach().hint(),
33+
rhs.closestApproach().precision()
34+
),
35+
toff_(rhs.toff_),
36+
sxconfig_(rhs.sxconfig_),
37+
varscale_(rhs.varscale_),
38+
mxings_(rhs.mxings_),
39+
fparams_(rhs.fparams_){
40+
/**/
41+
}
2442
// clone op for reinstantiation
25-
// ejc TODO does typeof(tpca_) == ClosestApproach<> need a deeper clone?
26-
StrawXing(StrawXing const& rhs) = default;
2743
std::shared_ptr< ElementXing<KTRAJ> > clone(CloneContext& context) const override{
2844
auto rv = std::make_shared< StrawXing<KTRAJ> >(*this);
2945
auto ca = rv->closestApproach();
@@ -47,8 +63,7 @@ namespace KinKal {
4763
auto const& strawMaterial() const { return smat_; }
4864
auto const& config() const { return sxconfig_; }
4965
auto precision() const { return tpca_.precision(); }
50-
// other accessors
51-
void setClosestApproach(const CA& ca){ tpca_ = ca; }
66+
5267
private:
5368
SensorLine axis_; // straw axis, expressed as a timeline
5469
StrawMaterial const& smat_;
@@ -58,6 +73,9 @@ namespace KinKal {
5873
double varscale_; // variance scale
5974
std::vector<MaterialXing> mxings_;
6075
Parameters fparams_; // parameter change for forwards time
76+
77+
// modifiers to support cloning
78+
void setClosestApproach(const CA& ca){ tpca_ = ca; }
6179
};
6280

6381
template <class KTRAJ> StrawXing<KTRAJ>::StrawXing(PCA const& pca, StrawMaterial const& smat) :

Fit/DomainWall.hh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,16 @@ namespace KinKal {
5151
auto const& prevWeight() const { return prevwt_; }
5252
auto const& nextWeight() const { return nextwt_; }
5353
auto const& fwdCovarianceRotation() const { return dpdpdb_; }
54-
void setPrevPtr(DOMAINPTR const& ptr){ prev_ = ptr; }
55-
void setNextPtr(DOMAINPTR const& ptr){ next_ = ptr; }
5654

5755
private:
5856
DOMAINPTR prev_, next_; // pointers to previous and next domains
5957
DVEC dpfwd_; // parameter change across this domain wall in the forwards time direction
6058
Weights prevwt_, nextwt_; // cache of weights
6159
PSMAT dpdpdb_; // forward rotation of covariance matrix going in the forwards direction
6260

61+
// modifiers to support cloning
62+
void setPrevPtr(DOMAINPTR const& ptr){ prev_ = ptr; }
63+
void setNextPtr(DOMAINPTR const& ptr){ next_ = ptr; }
6364
};
6465

6566
template<class KTRAJ> DomainWall<KTRAJ>::DomainWall(

Fit/Material.hh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,13 @@ namespace KinKal {
3939
auto const& elementXing() const { return *exingptr_; }
4040
auto const& elementXingPtr() const { return exingptr_; }
4141
auto const& referenceTrajectory() const { return exingptr_->referenceTrajectory(); }
42-
// other accessors
4342
auto const& weights() const { return nextwt_; }
44-
void setElementXingPtr(EXINGPTR const& ptr){ exingptr_ = ptr; }
4543
private:
4644
EXINGPTR exingptr_; // element crossing for this effect
4745
Weights nextwt_; // cache of weight forwards of this effect.
46+
47+
// modifiers to support cloning
48+
void setElementXingPtr(EXINGPTR const& ptr){ exingptr_ = ptr; }
4849
};
4950

5051
template<class KTRAJ> Material<KTRAJ>::Material(EXINGPTR const& exingptr, PTRAJ const& ptraj) : exingptr_(exingptr) {

Fit/Measurement.hh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,11 @@ namespace KinKal {
3737
std::unique_ptr< Effect<KTRAJ> > clone(CloneContext&) const override;
3838
// access the underlying hit
3939
HITPTR const& hit() const { return hit_; }
40-
// other accessors
41-
void setHitPtr(HITPTR const& ptr){ hit_ = ptr; }
4240
private:
4341
HITPTR hit_ ; // hit used for this measurement
42+
43+
// modifiers to support cloning
44+
void setHitPtr(HITPTR const& ptr){ hit_ = ptr; }
4445
};
4546

4647
template<class KTRAJ> Measurement<KTRAJ>::Measurement(HITPTR const& hit,PTRAJ const& ptraj) : hit_(hit) {

0 commit comments

Comments
 (0)