Skip to content
Merged
Show file tree
Hide file tree
Changes from 84 commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
1b88f7d
Seed reconstitution
brownd1978 May 2, 2025
6ccff27
p074
rlcee Apr 14, 2025
eeef5e2
go to p076 for clarity
rlcee Apr 18, 2025
9aa332c
Add example module to read luminosity stream information
michaelmackenzie Apr 23, 2025
1733104
Add additional compile-time flag for updated spack-mpd build
eflumerf Apr 25, 2025
dbd660e
New structure for the Calo Cosmics calibration archive table + adhoc
giro94 Apr 14, 2025
45e56ca
Adding new table to factory; remove unnecessary includes
giro94 Apr 28, 2025
7a6ee58
straw digis from artdaq fragments
Jan 24, 2025
c7b36d1
- update, pretty much everything except the initialization of the str…
Feb 6, 2025
efec48f
- update
Mar 5, 2025
0d08966
fix a typo
Apr 11, 2025
25040ca
replace hard-coded DTC-channeling with fcl-based mappings for panel l…
edcallaghan Apr 29, 2025
6c1aafa
config int -> bool + trim ProtonBunchTime comments
edcallaghan Apr 29, 2025
164968c
propagate module rename to DAQ cmake
edcallaghan May 1, 2025
fce00d1
new CRV geometry and prolog
ehrlich-uva Apr 4, 2025
6f388b9
added channel map for new CRV geometry
ehrlich-uva Apr 24, 2025
82bc4b6
added photon yield deviations for new CRV geometry
ehrlich-uva Apr 24, 2025
f687b8d
added calib tables and dead channel table for new CRV geometry
ehrlich-uva Apr 24, 2025
5d0f17a
added new geomety common file for crv v10
ehrlich-uva Apr 24, 2025
bae142b
decoupled the STM location from the CRV-D location
ehrlich-uva Apr 30, 2025
e68d30b
moved the borated poly over the CRV-TS-Ext
ehrlich-uva Apr 30, 2025
d1d39f0
removed surface check
ehrlich-uva Apr 30, 2025
f2d7a4a
moved CRV counter thickness from 19.78mm to 19.80mm (and changed the
ehrlich-uva Apr 30, 2025
fb15352
bug fix in EventDisplay
ehrlich-uva May 1, 2025
9636aef
small fixes: not yet working
brownd1978 May 5, 2025
939b0b2
Resolve conflicts
brownd1978 Jun 24, 2025
8cbfdb7
Make interface more consistent
brownd1978 Jul 3, 2025
bac7f77
Intermediate commit
brownd1978 Jul 17, 2025
0bd33de
Merge branch 'main' into kseed
brownd1978 Jul 17, 2025
590ee4c
More updates
brownd1978 Jul 25, 2025
33a972b
implement KKTrack copy-constructor and supporting infrastructure
edcallaghan Aug 6, 2025
28593e0
Updatse
brownd1978 Aug 25, 2025
1838971
Resolve conflicts
brownd1978 Aug 25, 2025
a4460e2
Small fixes (still non-functional)
brownd1978 Aug 25, 2025
2311c0c
Start implementation
brownd1978 Aug 26, 2025
283718a
update KKTrack for stl-pointer CloneContext member
edcallaghan Aug 26, 2025
6e58286
revert CMakeLists.txt to drop non-modules
edcallaghan Aug 26, 2025
a1cee45
rm non-functional hit updaters
edcallaghan Aug 26, 2025
4fbe268
again revert CMakeLists.txt to drop non-modules
edcallaghan Aug 26, 2025
b3126e6
Fix bug
brownd1978 Aug 28, 2025
79bc7fc
Merge remote-tracking branch 'brownd/trkmatfix' into kseed
brownd1978 Aug 29, 2025
44d556c
Fixes
brownd1978 Aug 29, 2025
bc38f2b
Follow KinKal changes
brownd1978 Sep 2, 2025
b33467a
Merge branch 'kkmat2' into kseed
brownd1978 Sep 2, 2025
6a26fa9
Follow KinKal changes. Fix BField config
brownd1978 Sep 3, 2025
ef18aba
Add back missing flag
brownd1978 Sep 3, 2025
0c64bd0
Add domains
brownd1978 Sep 3, 2025
6d8be8e
Fix printout
brownd1978 Sep 3, 2025
eef3363
KKTrack copy-constructor accepts external CloneContext
edcallaghan Sep 3, 2025
6a61ca5
Follow KinKal changes. Add track fit in regrow (not yet tested)
brownd1978 Sep 4, 2025
590844b
Add KalSeed output. Add PDG type
brownd1978 Sep 4, 2025
e611d92
Follow KinKal changes
brownd1978 Sep 5, 2025
23cb0e9
Add time to straw payload
brownd1978 Sep 5, 2025
ad03da8
Revert "KKTrack copy-constructor accepts external CloneContext"
edcallaghan Sep 5, 2025
91b06ba
restore KKTrack changes
edcallaghan Sep 5, 2025
35bf469
Tweak straw xing creation
brownd1978 Sep 5, 2025
147daac
Process collection directly
brownd1978 Sep 5, 2025
042b158
small merge fixes
brownd1978 Sep 5, 2025
a6ead21
Fix longstanding bug
brownd1978 Sep 8, 2025
1c90564
Move Intersection interface to KKFit
brownd1978 Sep 8, 2025
cb86b22
Add sampling
brownd1978 Sep 8, 2025
f701452
Factorize out extrapolation to a dedicated helper struct
brownd1978 Sep 8, 2025
06d5352
Add MC association. Not working due to art problem
brownd1978 Sep 8, 2025
7acdebd
Add missing instantiation
brownd1978 Sep 9, 2025
693e4b6
Keep the MC match for the original KalSeed in the regrown Assn
brownd1978 Sep 11, 2025
1656f43
print nactive
brownd1978 Sep 12, 2025
7e32304
Fix merge conflicts
brownd1978 Sep 12, 2025
eb0302b
Fix phi0 phase problem when regrowing
brownd1978 Sep 25, 2025
3ee0c0d
fix active flag setting. Improve comments and print
brownd1978 Sep 29, 2025
dde34e7
re-implement straw material adding
brownd1978 Oct 1, 2025
1b15b66
Clarify active flag
brownd1978 Oct 3, 2025
cc6bd17
Fix creation of StrawXings. Follow change to unbiased residuals
brownd1978 Oct 3, 2025
77573aa
Protect regrowing fits without domains. Add bits to flag failed unbia…
brownd1978 Oct 3, 2025
94887a7
Add KinematicLine regrow module
brownd1978 Oct 3, 2025
3495814
Small fixes
brownd1978 Oct 3, 2025
5d0409d
Add extension setting. Put basic configuration into prolog
brownd1978 Oct 6, 2025
0293eb5
Update envset
brownd1978 Oct 6, 2025
89f58a0
Merge branch 'main' into kseed
brownd1978 Oct 6, 2025
f0ff14f
Fix ordering error
brownd1978 Oct 6, 2025
2d3ad96
Merge branch 'kseed' of github.com:brownd1978/Offline into kseed
brownd1978 Oct 6, 2025
1a26d29
clarify order
brownd1978 Oct 6, 2025
d0d93a9
Add missing option to spack build
brownd1978 Oct 6, 2025
a3001c1
Add missing config
brownd1978 Oct 7, 2025
b405fa7
Add default
brownd1978 Oct 8, 2025
fb09862
Check fit status before calculating anything
brownd1978 Oct 8, 2025
1a5263e
Remove spurious output. Protect regrow extension
brownd1978 Oct 8, 2025
f443141
Add missing initialization. Add protection when filling drift info
brownd1978 Oct 8, 2025
25c3ae5
Update envset. Add protection against 0-domain seeds
brownd1978 Oct 9, 2025
c77e11d
Remove extraneous condition
brownd1978 Oct 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .muse
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# prefer to build with this environment
ENVSET p084
ENVSET p085
# add Offline/bin to path
PATH bin
# recent commits can take enforce these flags
Expand Down
9 changes: 5 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ cet_set_compiler_flags(DIAGS VIGILANT
-Wno-unused-parameter
-Wno-non-virtual-dtor
-Wno-extra
-Wreorder
)

if(DEFINED Offline_UPS_QUALIFIER_STRING)
Expand All @@ -54,7 +55,7 @@ endif()

message("Creating link from ${CMAKE_CURRENT_SOURCE_DIR} to ${CMAKE_CURRENT_SOURCE_DIR}/Offline to satisfy includes")
file(CREATE_LINK ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/Offline SYMBOLIC)

find_package(art_root_io REQUIRED EXPORT)
find_package(GSL REQUIRED EXPORT)
find_package(PostgreSQL REQUIRED EXPORT)
Expand All @@ -64,8 +65,8 @@ find_package(XercesC REQUIRED EXPORT)
find_package(BLAS REQUIRED EXPORT)
find_package(artdaq-core-mu2e REQUIRED EXPORT)
find_package(TRACE REQUIRED EXPORT)
if( ${WITH_G4} )
message("--> ADDING G4 LIBS")
if( ${WITH_G4} )
message("--> ADDING G4 LIBS")
find_package(Geant4 REQUIRED EXPORT)

# TODO: Find or implement FindCRY.cmake
Expand Down Expand Up @@ -142,7 +143,7 @@ add_subdirectory(MCDataProducts)
add_subdirectory(MECOStyleProtonAbsorberGeom)
add_subdirectory(Mu2e)
add_subdirectory(Mu2eBTrk)
if( ${WITH_G4} )
if( ${WITH_G4} )
message("---> ADDING G4 DIRS")
add_subdirectory(EventGenerator)
add_subdirectory(Mu2eG4)
Expand Down
1 change: 1 addition & 0 deletions DataProducts/inc/IndexMap.hh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ namespace mu2e {
ost << std::endl;
}
}
auto const& map() const { return _theMap; }

private:
std::map<FullIndex, CondensedIndex> _theMap; // FullIndex is first, CondensedIndex is second
Expand Down
2 changes: 1 addition & 1 deletion EventDisplay/src/DataInterface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1003,7 +1003,7 @@ void DataInterface::fillEvent(boost::shared_ptr<ContentSelector> const &contentS
{
const mu2e::TrkStrawHitSeed &hit = hits.at(j);
int sid = hit.strawId().asUint16();
double time = hit.hitTime();
double time = hit.time();

std::map<int,boost::shared_ptr<Straw> >::iterator straw=_straws.find(sid);
if(straw!=_straws.end() && !std::isnan(time))
Expand Down
12 changes: 12 additions & 0 deletions Mu2eKinKal/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,19 @@ cet_build_plugin(LoopHelixFit art::module
Offline::TrkReco

)
cet_build_plugin(RegrowLoopHelix art::module
REG_SOURCE src/RegrowLoopHelix_module.cc
LIBRARIES REG
Offline::Mu2eKinKal
Offline::TrkReco
)

cet_build_plugin(RegrowKinematicLine art::module
REG_SOURCE src/RegrowKinematicLine_module.cc
LIBRARIES REG
Offline::Mu2eKinKal
Offline::TrkReco
)

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/data/TrainBkgFinal.dat ${CURRENT_BINARY_DIR} data/TrainBkgFinal.dat COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/data/TrainBkgSeed.dat ${CURRENT_BINARY_DIR} data/TrainBkgSeed.dat COPYONLY)
Expand Down
91 changes: 60 additions & 31 deletions Mu2eKinKal/fcl/prolog.fcl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ Mu2eKinKal : {
MaxStrawDOCA : 5.0 # mm
MaxStrawDOCAConsistency : 1.0 # units of chi
MaxStrawUposBuffer : 0.0 # units of mm
IntersectionTolerance : 0.1 # tolerance for intersections (mm)
SampleInRange : true # require sample be in time range
SampleInBounds : true # require sample be in surface bounds
SampleSurfaces : [] # specific to the fit type
SaveHitCalibInfo : false
SaveDomains : false
}

CHSEEDFIT: {
Expand Down Expand Up @@ -185,7 +190,7 @@ Mu2eKinKal : {
]
}

SEEDFIT: {
LHSEEDFIT: {
PrintLevel : 0
MinNDOF : 1
MaxNIter : 10
Expand All @@ -194,7 +199,7 @@ Mu2eKinKal : {
DivergenceDeltaChisq : 10.0
DivergenceDeltaParams : 1e6
DivergenceGap : 10 # mm
BFieldCorrection : false
BFieldCorrection : true
BCorrTolerance : 1e-2 # momemntum fraction
ProcessEnds : false
MetaIterationSettings : [
Expand Down Expand Up @@ -234,7 +239,7 @@ Mu2eKinKal : {
StrawXingUpdaterSettings : []
}

SEEDEXT: {
LHSEEDEXT: {
PrintLevel : 0
MinNDOF : 1
MaxNIter : 10
Expand Down Expand Up @@ -346,24 +351,45 @@ Mu2eKinKal : {
CaloClusterCollection : "CaloClusterMaker"
}

LOOPHELIX : {
# Minimal common configuration for regrowing KalSeeds
REGROW : {
PrintLevel : 0
MinNDOF : 1
MaxNIter : 10
Deweight : 1.0e6
ConvergenceDeltaChisq : 0.1
DivergenceDeltaChisq : 10.0
DivergenceDeltaParams : 1e6
DivergenceGap : 100 # mm
ProcessEnds : true
BCorrTolerance : 1e-4
MetaIterationSettings : [ [ 0.0, "" ] ]
CADSHUSettings : [ ]
BkgANNSHUSettings : [ ]
DriftANNSHUSettings : [ ]
Chi2SHUSettings : [ ]
StrawXingUpdaterSettings : [ [-1.0, 1.0, false, 0 ] ]
}

LHHELIX : {
SeedErrors : [5.0, 5.0, 5.0, 5.0, 0.02, 5.0] # R(mm), Lambda(mm), Cx(mm), Cy(mm), phi0, t0 (ns)
SeedFlags : [ "HelixOK" ]
IntersectionTolerance : 0.1 # tolerance for intersections (mm)
SampleInRange : true # require sample be in time range
SampleInBounds : true # require sample be in surface bounds
}

LOOPEXTRAPOLATION : {
LHDRIFTXTRAP : {
IntersectionTolerance : 0.1
MaxDt : 200.0 # (ns)
BCorrTolerance : 1e-4 # momemntum fraction
ToTrackerEnds : true
Upstream : true
BackToTracker : false
ToOPA : true
}

SEEDEXTRAPOLATION : {
LHSEEDXTRAP : {
IntersectionTolerance : 0.1
MaxDt : 200.0 # (ns)
BCorrTolerance : 1e-2 # momemntum fraction
ToTrackerEnds : true
Upstream : false
BackToTracker : false
Expand Down Expand Up @@ -416,16 +442,16 @@ Mu2eKinKal : {
MaterialSettings : @local::Mu2eKinKal.MAT
KKFitSettings: {
@table::Mu2eKinKal.KKFIT
SaveDomains : false
SaveTrajectory : Detector
}
FitSettings : @local::Mu2eKinKal.SEEDFIT
ExtensionSettings : @local::Mu2eKinKal.SEEDEXT
FitSettings : @local::Mu2eKinKal.LHSEEDFIT
ExtensionSettings : @local::Mu2eKinKal.LHSEEDEXT
ModuleSettings : {
@table::Mu2eKinKal.LOOPHELIX
@table::Mu2eKinKal.LHHELIX
@table::Mu2eKinKal.KKPrecursors
SampleSurfaces : []
}
Extrapolation : @local::Mu2eKinKal.SEEDEXTRAPOLATION
ExtrapolationSettings : @local::Mu2eKinKal.LHSEEDXTRAP
UsePDGCharge: false
HelixMask: {
MinHelixMom : 0
Expand All @@ -437,17 +463,20 @@ Mu2eKinKal : {
MaterialSettings : @local::Mu2eKinKal.MAT
KKFitSettings : {
@table::Mu2eKinKal.KKFIT
SampleSurfaces : ["ST_Outer","ST_Front","ST_Back"] # these are additional surfaces; surfaces used in extrapolation are also sampled
# save trajectories in the Detector region
SaveDomains : true
SaveTrajectory : Full
}
FitSettings : @local::Mu2eKinKal.SEEDFIT
FitSettings : {
@table::Mu2eKinKal.LHSEEDFIT
}
ExtensionSettings : @local::Mu2eKinKal.LHDRIFTEXT
ModuleSettings : {
@table::Mu2eKinKal.LOOPHELIX
@table::Mu2eKinKal.LHHELIX
@table::Mu2eKinKal.KKPrecursors
SampleSurfaces : ["ST_Outer","ST_Front","ST_Back"] # these are additional surfaces; surfaces used in extrapolation are also sampled
}
Extrapolation : @local::Mu2eKinKal.LOOPEXTRAPOLATION
ExtrapolationSettings : @local::Mu2eKinKal.LHDRIFTXTRAP
UsePDGCharge: false
HelixMask: {
MinHelixMom : 0
Expand All @@ -459,7 +488,10 @@ Mu2eKinKal : {
MaterialSettings : @local::Mu2eKinKal.MAT
KKFitSettings: @local::Mu2eKinKal.KKFIT
FitSettings : @local::Mu2eKinKal.CHSEEDFIT
ExtensionSettings : @local::Mu2eKinKal.CHSEEDEXT
ExtensionSettings : {
@table::Mu2eKinKal.CHSEEDEXT
BFieldCorrection : false
}
ModuleSettings : {
@table::Mu2eKinKal.KINEMATICLINE
@table::Mu2eKinKal.KKPrecursors
Expand All @@ -478,6 +510,7 @@ Mu2eKinKal : {
MaxCaloClusterDt: 8
# save the full trajectory
SaveTrajectory: Full
SaveDomains : false # meaningless for Linefit
}
FitSettings : @local::Mu2eKinKal.CHSEEDFIT
ExtensionSettings : @local::Mu2eKinKal.CHDRIFTEXT
Expand All @@ -494,6 +527,7 @@ Mu2eKinKal : {
KKFitSettings: {
@table::Mu2eKinKal.KKFIT
SaveTrajectory : T0
SaveDomains : false
}
FitSettings : @local::Mu2eKinKal.CHSEEDFIT
ExtensionSettings : @local::Mu2eKinKal.CHSEEDEXT
Expand All @@ -509,6 +543,7 @@ Mu2eKinKal : {
KKFitSettings: {
@table::Mu2eKinKal.KKFIT
SaveTrajectory : Full
SaveDomains : true
}
FitSettings : @local::Mu2eKinKal.CHSEEDFIT
ExtensionSettings : @local::Mu2eKinKal.CHDRIFTEXT
Expand Down Expand Up @@ -538,15 +573,11 @@ Mu2eKinKal : {
KKUmu: @local::Mu2eKinKal.LHDriftFit
}
}
# Extrapolate upstream fits back to the tracker entrance
Mu2eKinKal.producers.KKUe.Extrapolation.BackToTracker : true
Mu2eKinKal.producers.KKUmu.Extrapolation.BackToTracker : true

# update directions and particles as needed
Mu2eKinKal.producers.KKCHSeedFitmuM.ModuleSettings.FitParticle : @local::Particle.muminus
Mu2eKinKal.producers.KKCHSeedFitmuP.ModuleSettings.FitParticle : @local::Particle.muplus
Mu2eKinKal.producers.KKCHmu.ModuleSettings.FitParticle : @local::Particle.muminus # charge floats in the fit, this just determines the mass

Mu2eKinKal.producers.KLSeedFit.ExtensionSettings.BFieldCorrection : false
Mu2eKinKal.producers.KLSeedFit.ModuleSettings.FitParticle : @local::Particle.muminus
Mu2eKinKal.producers.KKLine.ModuleSettings.FitParticle : @local::Particle.muminus

Expand All @@ -563,17 +594,15 @@ Mu2eKinKal.producers.KKUmuSeedFit.FitDirection : @local::FitDir.downstream
# save trajectories in the Detector region for downstream fits, just the T0 segment for the rest
Mu2eKinKal.producers.KKDe.ModuleSettings.FitParticle : @local::Particle.eminus
Mu2eKinKal.producers.KKDe.FitDirection : @local::FitDir.downstream
Mu2eKinKal.producers.KKDe.KKFitSettings.SaveTrajectory : "Detector"
Mu2eKinKal.producers.KKDmu.ModuleSettings.FitParticle : @local::Particle.muminus
Mu2eKinKal.producers.KKDmu.FitDirection : @local::FitDir.downstream
Mu2eKinKal.producers.KKDmu.KKFitSettings.SaveTrajectory : "Detector"
Mu2eKinKal.producers.KKUe.ModuleSettings.FitParticle : @local::Particle.eminus
Mu2eKinKal.producers.KKUe.FitDirection : @local::FitDir.upstream
Mu2eKinKal.producers.KKUe.KKFitSettings.SaveTrajectory : "Detector"
Mu2eKinKal.producers.KKUmu.ModuleSettings.FitParticle : @local::Particle.muminus
Mu2eKinKal.producers.KKUmu.FitDirection : @local::FitDir.upstream
Mu2eKinKal.producers.KKUmu.KKFitSettings.SaveTrajectory : "Detector"
# extrapolate upstream fits back to the tracker
physics.producers.KKUmu.Extrapolation.BackToTracker : true
physics.producers.KKUe.Extrapolation.BackToTracker : true
# propagate upstream fits back to the tracker
Mu2eKinKal.producers.KKUe.ExtrapolationSettings.BackToTracker : true
Mu2eKinKal.producers.KKUmu.ExtrapolationSettings.BackToTracker : true

#
END_PROLOG
2 changes: 1 addition & 1 deletion Mu2eKinKal/inc/Chi2SHU_updateCluster.hh
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ namespace mu2e {
pvar = resid.parameterVariance();
}
// Use the unbiased residual to compute the chisq
Residual uresid(uresidval,resid.variance(),pvar,resid.active(),resid.dRdP());
Residual uresid(uresidval,resid.variance(),pvar,resid.dRdP(),resid.active());
chisq += uresid.chisq();
++ndof;
}
Expand Down
2 changes: 1 addition & 1 deletion Mu2eKinKal/inc/ExtrapolateIPA.hh
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ namespace mu2e {
if(ktraj.range().range() <= epsilon) return true; // keep going if the step is very small
auto stime = tdir == TimeDir::forwards ? ktraj.range().begin()+epsilon : ktraj.range().end()-epsilon;
auto etime = tdir == TimeDir::forwards ? ktraj.range().end() : ktraj.range().begin();
auto vel = ktraj.speed(stime)*ktraj.axis(stime).direction();// use helix axis to define the velocity
auto vel = ktraj.speed(stime)*ktraj.linearize(stime).direction();// use hlinear approximation
auto spos = ktraj.position3(stime);
auto epos = ktraj.position3(etime);
double zvel = vel.Z()*timeDirSign(tdir); // sign by extrapolation direction
Expand Down
31 changes: 28 additions & 3 deletions Mu2eKinKal/inc/KKCaloHit.hh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,29 @@ namespace mu2e {
using CA = KinKal::ClosestApproach<KTRAJ,SensorLine>;
using HIT = KinKal::Hit<KTRAJ>;
using KTRAJPTR = std::shared_ptr<KTRAJ>;
// clone op for reinstantiation
KKCaloHit(KKCaloHit<KTRAJ> const& rhs):
caloCluster_(rhs.caloCluster()),
axis_(rhs.sensorAxis()),
tvar_(rhs.timeVariance()),
wvar_(rhs.widthVariance()),
ca_(
rhs.closestApproach().particleTraj(),
axis_,
rhs.closestApproach().hint(),
rhs.closestApproach().precision()
),
rresid_(rhs.timeResidual()){
/**/
};
std::shared_ptr< KinKal::Hit<KTRAJ> > clone(CloneContext& context) const override{
auto rv = std::make_shared< KKCaloHit<KTRAJ> >(*this);
auto ca = rv->closestApproach();
auto trajectory = std::make_shared<KTRAJ>(ca.particleTraj());
ca.setTrajectory(trajectory);
rv->setClosestApproach(ca);
return rv;
};
// Hit interface overrrides
unsigned nResid() const override { return 1; } // 1 time residual
Residual const& refResidual(unsigned ires=0) const override;
Expand Down Expand Up @@ -54,6 +77,8 @@ namespace mu2e {
double wvar_; // variance in transverse position of the sensor/measurement in mm. Assumes cylindrical error, could be more general
CA ca_; // reference time and distance of closest approach to the axis
Residual rresid_; // residual WRT most recent reference parameters
// clone support
void setClosestApproach(const CA& ca){ ca_ = ca; }
};

template <class KTRAJ> KKCaloHit<KTRAJ>::KKCaloHit(CCPtr caloCluster, PCA const& pca, double tvar, double wvar) : caloCluster_(caloCluster), axis_(pca.sensorTraj()), tvar_(tvar), wvar_(wvar),
Expand All @@ -73,7 +98,7 @@ namespace mu2e {
// if(ca_.usable()) tphint = CAHint(ca_.particleToca(),ca_.sensorToca());
PCA pca(ptraj,axis_,tphint,precision());
ca_ = pca.localClosestApproach();
if(!ca_.usable())rresid_ = Residual(rresid_.value(),rresid_.variance(),0.0,false,rresid_.dRdP());
rresid_ = Residual(rresid_.value(),rresid_.variance(),0.0,rresid_.dRdP(),ca_.usable());
}

template <class KTRAJ> void KKCaloHit<KTRAJ>::updateState(MetaIterConfig const& miconfig,bool first) {
Expand Down Expand Up @@ -112,9 +137,9 @@ namespace mu2e {
double invvar2 = std::max(s2*sint2/(cost2*wvar_), 12/(ldt*ldt));
totvar += 1.0/invvar2;
}
rresid_ = Residual(ca_.deltaT(),totvar,0.0,true,ca_.dTdP());
rresid_ = Residual(ca_.deltaT(),totvar,0.0,ca_.dTdP());
} else {
rresid_ = Residual(rresid_.value(),rresid_.variance(),0.0,false,rresid_.dRdP());
rresid_ = Residual(rresid_.value(),rresid_.variance(),0.0,rresid_.dRdP(),false);
}
// finally update the weight
this->updateWeight(miconfig);
Expand Down
Loading