From 194cc61951df0595e60e89a5e2598c06cc87dea9 Mon Sep 17 00:00:00 2001 From: michaelmackenzie Date: Fri, 3 Jul 2026 11:53:33 -0500 Subject: [PATCH 1/7] Add track dt_hit / dt_ptoca calculation and data product --- ParticleID/src/SConscript | 1 + ParticleID/src/TrackDtDt_module.cc | 95 ++++++++++++++++++++++++++++ RecoDataProducts/inc/KalSeedDtDt.hh | 26 ++++++++ RecoDataProducts/src/classes.h | 1 + RecoDataProducts/src/classes_def.xml | 7 +- 5 files changed, 129 insertions(+), 1 deletion(-) create mode 100644 ParticleID/src/TrackDtDt_module.cc create mode 100644 RecoDataProducts/inc/KalSeedDtDt.hh diff --git a/ParticleID/src/SConscript b/ParticleID/src/SConscript index 6297a3b3f2..7a45d2954c 100644 --- a/ParticleID/src/SConscript +++ b/ParticleID/src/SConscript @@ -21,6 +21,7 @@ libs = [ 'mu2e_ConfigTools', 'mu2e_DbTables', 'mu2e_GeneralUtilities', + 'mu2e_Mu2eUtilities', 'art_Framework_Core', 'art_Framework_Principal', 'art_Framework_Services_Registry', diff --git a/ParticleID/src/TrackDtDt_module.cc b/ParticleID/src/TrackDtDt_module.cc new file mode 100644 index 0000000000..0b58624531 --- /dev/null +++ b/ParticleID/src/TrackDtDt_module.cc @@ -0,0 +1,95 @@ +// Fit the track dt_{hit} / dt_{track fit poca time} distribution +// +// Michael MacKenzie, 2026 + +#include +#include +#include + +#include "cetlib_except/exception.h" + +#include "fhiclcpp/types/Atom.h" +#include "fhiclcpp/types/Sequence.h" +#include "art/Framework/Core/EDProducer.h" +#include "art/Framework/Principal/Event.h" +#include "art/Framework/Principal/SubRun.h" +#include "art/Framework/Principal/Run.h" +#include "art/Framework/Principal/Handle.h" +#include "art_root_io/TFileService.h" + +#include "Offline/RecoDataProducts/inc/KalSeed.hh" +#include "Offline/RecoDataProducts/inc/KalSeedDtDt.hh" +#include "Offline/Mu2eUtilities/inc/LsqSums2.hh" + +#include "TH1.h" + +namespace mu2e { + + //================================================================ + class TrackDtDt : public art::EDProducer { + + struct Config + { + using Name = fhicl::Name; + using Comment = fhicl::Comment; + fhicl::Sequence kalSeeds { Name("kalSeeds") , Comment("KalSeed collection names") }; + fhicl::Atom diagLevel { Name("diagLevel"), Comment("Diag Level") ,0 }; + }; + + std::vector kalSeeds_; + int diagLevel_; + + public: + explicit TrackDtDt(const art::EDProducer::Table& config); + virtual void produce(art::Event& event); + KalSeedDtDt fitTrackDtDt(const KalSeed& seed); + }; + + //================================================================ + TrackDtDt::TrackDtDt(const art::EDProducer::Table& config) + : art::EDProducer{config} + , kalSeeds_(config().kalSeeds()) + , diagLevel_(config().diagLevel()) + { + for(const auto& name : kalSeeds_) { + produces(name); + } + } + + //================================================================ + KalSeedDtDt TrackDtDt::fitTrackDtDt(const KalSeed& seed) { + LsqSums2 fitter; + for(const auto& hit : seed.hits()) { + const double dt_hit = hit.time() - hit.TOTDriftTime(); + const double dt_trk = hit.particleToca(); + const double t_unc = std::sqrt(hit.fitDOCAVar())*hit._dvel; + const double weight = 1./t_unc; + fitter.addPoint(dt_trk, dt_hit, weight); + } + KalSeedDtDt result; + result.slope_ = fitter.dydx(); + result.offset_ = fitter.y0(); + result.slopeUnc_ = fitter.dydxErr(); + result.dof_ = fitter.qn() - 2; // two parameters fitted + result.chisq_ = fitter.chi2Dof()*result.dof_; + return result; + } + + //================================================================ + void TrackDtDt::produce(art::Event& event) { + for(const auto& name : kalSeeds_) { + auto const& seedHandle = event.getValidHandle(name); + auto const& seeds = *seedHandle; + std::unique_ptr dtDtCol(new KalSeedDtDtCollection()); + if(diagLevel_ > 0) std::cout << "[TrackDtDt::" << __func__ << "] Processing " << seeds.size() << " seeds from collection " << name << std::endl; + for(const auto& seed : seeds) { + dtDtCol->emplace_back(fitTrackDtDt(seed)); + } + event.put(std::move(dtDtCol), name); + } + } + + //================================================================ +} // namespace mu2e + +DEFINE_ART_MODULE(mu2e::TrackDtDt) diff --git a/RecoDataProducts/inc/KalSeedDtDt.hh b/RecoDataProducts/inc/KalSeedDtDt.hh new file mode 100644 index 0000000000..d2d3aa17ce --- /dev/null +++ b/RecoDataProducts/inc/KalSeedDtDt.hh @@ -0,0 +1,26 @@ +// +// Class representing the fit information of a dt_{straw hit time} / dt_{track hit time of closest approach} +// This is useful for PID, as the wrong hypothesis will typically have a slope +// Original Author: Michael MacKenzie, 2026 +// +#ifndef RecoDataProducts_KalSeedDtDt_HH +#define RecoDataProducts_KalSeedDtDt_HH +#include +namespace mu2e { + struct KalSeedDtDt { + Float_t slope_; + Float_t offset_; + Float_t slopeUnc_; + Float_t chisq_; + Int_t dof_; + Float_t slope () const { return slope_ ; } + Float_t offset () const { return offset_ ; } + Float_t slopeUnc () const { return slopeUnc_ ; } + Float_t chisq () const { return chisq_ ; } + Int_t dof () const { return dof_ ; } + KalSeedDtDt() : slope_(0.f), offset_(0.f), slopeUnc_(0.f), chisq_(0.f), dof_(0) {} + }; + + using KalSeedDtDtCollection = std::vector; +} +#endif diff --git a/RecoDataProducts/src/classes.h b/RecoDataProducts/src/classes.h index 1eda0cc472..10f747d571 100644 --- a/RecoDataProducts/src/classes.h +++ b/RecoDataProducts/src/classes.h @@ -52,6 +52,7 @@ #include "Offline/RecoDataProducts/inc/KalSeed.hh" #include "Offline/RecoDataProducts/inc/KalIntersection.hh" #include "Offline/RecoDataProducts/inc/KalSeedAssns.hh" +#include "Offline/RecoDataProducts/inc/KalSeedDtDt.hh" #include "Offline/RecoDataProducts/inc/TrkCaloHitPID.hh" #include "Offline/RecoDataProducts/inc/TrkQual.hh" #include "Offline/RecoDataProducts/inc/RecoQual.hh" diff --git a/RecoDataProducts/src/classes_def.xml b/RecoDataProducts/src/classes_def.xml index 00202da02d..89d341a131 100644 --- a/RecoDataProducts/src/classes_def.xml +++ b/RecoDataProducts/src/classes_def.xml @@ -264,6 +264,11 @@ + + + + + @@ -452,7 +457,7 @@ - + From e7ca7706235e5f59e19fad3a26ed56c0679e266b Mon Sep 17 00:00:00 2001 From: michaelmackenzie Date: Fri, 3 Jul 2026 12:08:39 -0500 Subject: [PATCH 2/7] Update hit time uncertainty, handle KalSeed and KalSeedPtr collections --- ParticleID/src/TrackDtDt_module.cc | 35 ++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/ParticleID/src/TrackDtDt_module.cc b/ParticleID/src/TrackDtDt_module.cc index 0b58624531..a06e917fb2 100644 --- a/ParticleID/src/TrackDtDt_module.cc +++ b/ParticleID/src/TrackDtDt_module.cc @@ -32,8 +32,8 @@ namespace mu2e { { using Name = fhicl::Name; using Comment = fhicl::Comment; - fhicl::Sequence kalSeeds { Name("kalSeeds") , Comment("KalSeed collection names") }; - fhicl::Atom diagLevel { Name("diagLevel"), Comment("Diag Level") ,0 }; + fhicl::Sequence kalSeeds { Name("kalSeeds") , Comment("KalSeed (Ptr) collection names") }; + fhicl::Atom diagLevel { Name("diagLevel"), Comment("Diag Level") ,0 }; }; std::vector kalSeeds_; @@ -62,7 +62,7 @@ namespace mu2e { for(const auto& hit : seed.hits()) { const double dt_hit = hit.time() - hit.TOTDriftTime(); const double dt_trk = hit.particleToca(); - const double t_unc = std::sqrt(hit.fitDOCAVar())*hit._dvel; + const double t_unc = hit._udresid / hit._dvel; const double weight = 1./t_unc; fitter.addPoint(dt_trk, dt_hit, weight); } @@ -77,14 +77,35 @@ namespace mu2e { //================================================================ void TrackDtDt::produce(art::Event& event) { + + // Loop over all KalSeed collections for(const auto& name : kalSeeds_) { - auto const& seedHandle = event.getValidHandle(name); - auto const& seeds = *seedHandle; + + // Retrieve the KalSeed collection from the event, checking if it is a collection of KalSeed or KalSeedPtr + art::Handle seedHandle; + event.getByLabel(name, seedHandle); + art::Handle seedPtrHandle; + const bool isSeedCollection = seedHandle.isValid(); + if(!isSeedCollection) { + event.getByLabel(name, seedPtrHandle); + if(!seedPtrHandle.isValid()) { + throw cet::exception("RECO") << "TrackDtDt: No KalSeed or KalSeedPtr collection with label " << name << std::endl; + } + } + + // Create the output collection std::unique_ptr dtDtCol(new KalSeedDtDtCollection()); - if(diagLevel_ > 0) std::cout << "[TrackDtDt::" << __func__ << "] Processing " << seeds.size() << " seeds from collection " << name << std::endl; - for(const auto& seed : seeds) { + + // Loop over all seeds in the collection and fit the dt_{hit} / dt_{track fit poca time} distribution + const auto nseeds = (isSeedCollection) ? seedHandle->size() : seedPtrHandle->size(); + if(diagLevel_ > 0) std::cout << "[TrackDtDt::" << __func__ << "] Processing " << nseeds << " seeds from collection " << name << std::endl; + for(size_t iseed = 0; iseed < nseeds; ++iseed) { + const auto& seed = (isSeedCollection) ? seedHandle->at(iseed) : *seedPtrHandle->at(iseed); + if(diagLevel_ > 1) std::cout << "[TrackDtDt::" << __func__ << "] Processing seed " << iseed << " with " << seed.hits().size() << " hits" << std::endl; dtDtCol->emplace_back(fitTrackDtDt(seed)); } + + // Put the results into the event event.put(std::move(dtDtCol), name); } } From 036e83b3008e11889c1a8db7414e72787b583d22 Mon Sep 17 00:00:00 2001 From: michaelmackenzie Date: Fri, 3 Jul 2026 12:43:03 -0500 Subject: [PATCH 3/7] Add missing cmake build --- ParticleID/CMakeLists.txt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ParticleID/CMakeLists.txt b/ParticleID/CMakeLists.txt index 09e0c0f1f5..01d72cb9dd 100644 --- a/ParticleID/CMakeLists.txt +++ b/ParticleID/CMakeLists.txt @@ -15,7 +15,16 @@ cet_build_plugin(ParticleIDRead art::module LIBRARIES REG art_root_io::TFileService_service Offline::ParticleID - + + Offline::RecoDataProducts +) + +cet_build_plugin(TrackDtDt art::module + REG_SOURCE src/TrackDtDt_module.cc + LIBRARIES REG + art_root_io::TFileService_service + Offline::Mu2eUtilities + Offline::ParticleID Offline::RecoDataProducts ) From e5feb7d4e466979a9569b7cf78c4ae92ce1df207 Mon Sep 17 00:00:00 2001 From: michaelmackenzie Date: Fri, 10 Jul 2026 13:50:22 -0500 Subject: [PATCH 4/7] Update time definitions --- ParticleID/src/TrackDtDt_module.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ParticleID/src/TrackDtDt_module.cc b/ParticleID/src/TrackDtDt_module.cc index a06e917fb2..b28caa8543 100644 --- a/ParticleID/src/TrackDtDt_module.cc +++ b/ParticleID/src/TrackDtDt_module.cc @@ -60,18 +60,18 @@ namespace mu2e { KalSeedDtDt TrackDtDt::fitTrackDtDt(const KalSeed& seed) { LsqSums2 fitter; for(const auto& hit : seed.hits()) { - const double dt_hit = hit.time() - hit.TOTDriftTime(); - const double dt_trk = hit.particleToca(); - const double t_unc = hit._udresid / hit._dvel; - const double weight = 1./t_unc; - fitter.addPoint(dt_trk, dt_hit, weight); + const double t_hit = hit.time(); + const double t_trk = hit.particleToca() + hit.fitDt(); // add dt to get to the estimated base hit time + const double t_var = hit.fitTocaVar() + hit.reTocaVar(); // variance of the track poca time and the hit time + const double weight = 1./t_var; // inverse variance weighting + fitter.addPoint(t_trk, t_hit, weight); } KalSeedDtDt result; result.slope_ = fitter.dydx(); result.offset_ = fitter.y0(); result.slopeUnc_ = fitter.dydxErr(); result.dof_ = fitter.qn() - 2; // two parameters fitted - result.chisq_ = fitter.chi2Dof()*result.dof_; + result.chisq_ = (result.dof_ > 0) ? fitter.chi2Dof()*result.dof_ : 0.f; // chi2Dof() not defined for dof <= 0 return result; } From ae3e95340fd5a234f8b97ed431b7ea12603a1251 Mon Sep 17 00:00:00 2001 From: michaelmackenzie Date: Tue, 14 Jul 2026 10:18:40 -0500 Subject: [PATCH 5/7] Update dt/dt definition, add debug histograms and test fcl --- ParticleID/src/TrackDtDt_module.cc | 62 +++++++++++++++++++++++++++--- ParticleID/test/trkdtdt.fcl | 33 ++++++++++++++++ 2 files changed, 90 insertions(+), 5 deletions(-) create mode 100644 ParticleID/test/trkdtdt.fcl diff --git a/ParticleID/src/TrackDtDt_module.cc b/ParticleID/src/TrackDtDt_module.cc index b28caa8543..45ef5e2e71 100644 --- a/ParticleID/src/TrackDtDt_module.cc +++ b/ParticleID/src/TrackDtDt_module.cc @@ -32,37 +32,80 @@ namespace mu2e { { using Name = fhicl::Name; using Comment = fhicl::Comment; - fhicl::Sequence kalSeeds { Name("kalSeeds") , Comment("KalSeed (Ptr) collection names") }; - fhicl::Atom diagLevel { Name("diagLevel"), Comment("Diag Level") ,0 }; + fhicl::Sequence kalSeeds { Name("kalSeeds") , Comment("KalSeed (Ptr) collection names") }; + fhicl::Atom doHistograms{ Name("doHistograms"), Comment("Make histograms") , false }; + fhicl::Atom diagLevel { Name("diagLevel") , Comment("Diag Level") ,0 }; }; std::vector kalSeeds_; + bool doHistograms_; int diagLevel_; + // Histograms + TH1* h_slope_ = nullptr; // fit results + TH1* h_offset_ = nullptr; + TH1* h_slopeUnc_ = nullptr; + TH1* h_chisq_ = nullptr; + TH1* h_dof_ = nullptr; + TH1* h_chisqDof_ = nullptr; + TH1* h_trk_chisq_ = nullptr; // track parameters + TH1* h_trk_fitcon_ = nullptr; + public: explicit TrackDtDt(const art::EDProducer::Table& config); virtual void produce(art::Event& event); KalSeedDtDt fitTrackDtDt(const KalSeed& seed); + + void bookHistograms(); + void fillHistograms(const KalSeedDtDt& dtDt, const KalSeed& seed); }; //================================================================ TrackDtDt::TrackDtDt(const art::EDProducer::Table& config) : art::EDProducer{config} , kalSeeds_(config().kalSeeds()) + , doHistograms_(config().doHistograms()) , diagLevel_(config().diagLevel()) { for(const auto& name : kalSeeds_) { produces(name); } + if(doHistograms_) bookHistograms(); + } + + //================================================================ + void TrackDtDt::bookHistograms() { + art::ServiceHandle tfs; + h_slope_ = tfs->make("h_slope", "Slope of dt_{hit} vs dt_{track fit poca time};Slope;Entries", 100, 0., 4.); + h_offset_ = tfs->make("h_offset", "Offset of dt_{hit} vs dt_{track fit poca time};Offset [ns];Entries", 100, -100., 100.); + h_slopeUnc_ = tfs->make("h_slopeUnc", "Uncertainty of slope;Slope Uncertainty;Entries", 100, 0., 0.1); + h_chisq_ = tfs->make("h_chisq", "Chi2 of fit;Chi2;Entries", 100, 0., 100.); + h_dof_ = tfs->make("h_dof", "Degrees of freedom of fit;DOF;Entries", 100, 0., 100.); + h_chisqDof_ = tfs->make("h_chisqDof", "Chi2/DOF of fit;Chi2/DOF;Entries", 100, 0., 5.); + h_trk_chisq_ = tfs->make("h_trk_chisq", "Track chi2;Chi2;Entries", 100, 0., 100.); + h_trk_fitcon_ = tfs->make("h_trk_fitcon", "Track fit convergence;Convergence;Entries", 100, 0., 1.); + } + + //================================================================ + void TrackDtDt::fillHistograms(const KalSeedDtDt& dtDt, const KalSeed& seed) { + if(!doHistograms_) return; + h_slope_->Fill(dtDt.slope_); + h_offset_->Fill(dtDt.offset_); + h_slopeUnc_->Fill(dtDt.slopeUnc_); + h_chisq_->Fill(dtDt.chisq_); + h_dof_->Fill(dtDt.dof_); + h_chisqDof_->Fill((dtDt.dof_ > 0) ? dtDt.chisq_/dtDt.dof_ : 0.); + h_trk_chisq_->Fill(seed.chisquared()); + h_trk_fitcon_->Fill(seed.fitConsistency()); } //================================================================ KalSeedDtDt TrackDtDt::fitTrackDtDt(const KalSeed& seed) { LsqSums2 fitter; for(const auto& hit : seed.hits()) { - const double t_hit = hit.time(); - const double t_trk = hit.particleToca() + hit.fitDt(); // add dt to get to the estimated base hit time - const double t_var = hit.fitTocaVar() + hit.reTocaVar(); // variance of the track poca time and the hit time + const double t_trk = hit.particleToca(); // estimated time of the particle + const double t_hit = t_trk + hit.fitDt(); // add dt to get the hit time + const double t_var = hit.fitTocaVar(); // variance of the track poca time and the hit time const double weight = 1./t_var; // inverse variance weighting fitter.addPoint(t_trk, t_hit, weight); } @@ -72,6 +115,15 @@ namespace mu2e { result.slopeUnc_ = fitter.dydxErr(); result.dof_ = fitter.qn() - 2; // two parameters fitted result.chisq_ = (result.dof_ > 0) ? fitter.chi2Dof()*result.dof_ : 0.f; // chi2Dof() not defined for dof <= 0 + + if(diagLevel_ > 1) { + std::cout << "[TrackDtDt::" << __func__ << "] Fit results for seed with " << seed.hits().size() << " hits:\n" + << " slope = " << result.slope_ << " +/- " << result.slopeUnc_ << "\n" + << " offset = " << result.offset_ << "\n" + << " chi2 = " << result.chisq_ << "\n" + << " dof = " << result.dof_ << "\n"; + } + if(doHistograms_) fillHistograms(result, seed); return result; } diff --git a/ParticleID/test/trkdtdt.fcl b/ParticleID/test/trkdtdt.fcl new file mode 100644 index 0000000000..9dcdbec8e5 --- /dev/null +++ b/ParticleID/test/trkdtdt.fcl @@ -0,0 +1,33 @@ +# Test TrackDtDt_module.cc + +#include "Offline/fcl/minimalMessageService.fcl" +#include "Offline/fcl/standardProducers.fcl" +#include "Offline/fcl/standardServices.fcl" + +process_name : TestTrkDtDt + +services : @local::Services.Reco +services.GeometryService.bFieldFile : "Offline/Mu2eG4/geom/bfgeom_reco_v01.txt" +services.scheduler.wantSummary: true + +source: { + module_type: RootInput + inputCommands: [ "keep *_*_*_*" + ] +} + +physics : { + producers : { + TrackDtDt : { + module_type : TrackDtDt + kalSeeds : [ "KKDe" ] + diagLevel : 0 + doHistograms: true + } + } + RecoPath : [ TrackDtDt ] + end_paths : [ ] + trigger_paths : [ RecoPath ] +} + +#include "Production/Validation/database.fcl" From 4eac53009b24a256829c94f61e11a239be9658ec Mon Sep 17 00:00:00 2001 From: michaelmackenzie Date: Tue, 14 Jul 2026 15:38:50 -0500 Subject: [PATCH 6/7] Adjust histogram range --- ParticleID/src/TrackDtDt_module.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ParticleID/src/TrackDtDt_module.cc b/ParticleID/src/TrackDtDt_module.cc index 45ef5e2e71..0137e1f69b 100644 --- a/ParticleID/src/TrackDtDt_module.cc +++ b/ParticleID/src/TrackDtDt_module.cc @@ -76,7 +76,7 @@ namespace mu2e { //================================================================ void TrackDtDt::bookHistograms() { art::ServiceHandle tfs; - h_slope_ = tfs->make("h_slope", "Slope of dt_{hit} vs dt_{track fit poca time};Slope;Entries", 100, 0., 4.); + h_slope_ = tfs->make("h_slope", "Slope of dt_{hit} vs dt_{track fit poca time};Slope;Entries", 100, -2., 4.); h_offset_ = tfs->make("h_offset", "Offset of dt_{hit} vs dt_{track fit poca time};Offset [ns];Entries", 100, -100., 100.); h_slopeUnc_ = tfs->make("h_slopeUnc", "Uncertainty of slope;Slope Uncertainty;Entries", 100, 0., 0.1); h_chisq_ = tfs->make("h_chisq", "Chi2 of fit;Chi2;Entries", 100, 0., 100.); From 3eff1ef475142d1a7f55987384da86554410733b Mon Sep 17 00:00:00 2001 From: michaelmackenzie Date: Thu, 16 Jul 2026 10:05:39 -0500 Subject: [PATCH 7/7] Add example TGraph --- ParticleID/src/TrackDtDt_module.cc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/ParticleID/src/TrackDtDt_module.cc b/ParticleID/src/TrackDtDt_module.cc index 0137e1f69b..83bd0f0d00 100644 --- a/ParticleID/src/TrackDtDt_module.cc +++ b/ParticleID/src/TrackDtDt_module.cc @@ -22,6 +22,7 @@ #include "Offline/Mu2eUtilities/inc/LsqSums2.hh" #include "TH1.h" +#include "TGraph.h" namespace mu2e { @@ -50,6 +51,9 @@ namespace mu2e { TH1* h_chisqDof_ = nullptr; TH1* h_trk_chisq_ = nullptr; // track parameters TH1* h_trk_fitcon_ = nullptr; + TGraph* g_t_hit_vs_z = nullptr; + TGraph* g_t_poca_vs_z = nullptr; + TGraph* g_t_hit_vs_t_poca = nullptr; public: explicit TrackDtDt(const art::EDProducer::Table& config); @@ -84,6 +88,9 @@ namespace mu2e { h_chisqDof_ = tfs->make("h_chisqDof", "Chi2/DOF of fit;Chi2/DOF;Entries", 100, 0., 5.); h_trk_chisq_ = tfs->make("h_trk_chisq", "Track chi2;Chi2;Entries", 100, 0., 100.); h_trk_fitcon_ = tfs->make("h_trk_fitcon", "Track fit convergence;Convergence;Entries", 100, 0., 1.); + g_t_hit_vs_z = tfs->makeAndRegister("t_hit_vs_z", "t_{hit} vs. z;z [mm];t_{hit} [ns]"); + g_t_poca_vs_z = tfs->makeAndRegister("t_poca_vs_z", "t_{POCA} vs. z;z [mm];t_{POCA} [ns]"); + g_t_hit_vs_t_poca = tfs->makeAndRegister("t_hit_vs_t_poca", "t_{hit} vs. t_{POCA};t_{POCA} [ns];t_{hit} [ns]"); } //================================================================ @@ -97,6 +104,18 @@ namespace mu2e { h_chisqDof_->Fill((dtDt.dof_ > 0) ? dtDt.chisq_/dtDt.dof_ : 0.); h_trk_chisq_->Fill(seed.chisquared()); h_trk_fitcon_->Fill(seed.fitConsistency()); + + // Fill one example event + if(g_t_hit_vs_z->GetN() == 0) { + for(const auto& hit : seed.hits()) { + const double t_trk = hit.particleToca(); // estimated time of the particle + const double t_hit = t_trk + hit.fitDt(); // add dt to get the hit time + const double z_trk = hit._upoca.z(); + g_t_hit_vs_z ->AddPoint(z_trk, t_hit); + g_t_poca_vs_z ->AddPoint(z_trk, t_trk); + g_t_hit_vs_t_poca->AddPoint(t_trk, t_hit); + } + } } //================================================================