diff --git a/CRVReco/fcl/prolog_v12.fcl b/CRVReco/fcl/prolog_v12.fcl index 8a334786fe..bafdc750da 100644 --- a/CRVReco/fcl/prolog_v12.fcl +++ b/CRVReco/fcl/prolog_v12.fcl @@ -411,8 +411,9 @@ BEGIN_PROLOG DoGeometric : true # CRV resolution per cluster sector type (type 1 first). Sector type numbering depends on the geometry: these are # the extracted geometry's types 1-4 (EX, T1, T2, muon taggers; crv_counters_extracted_v04.txt); other geometries - # need their own lists. SigmaV: robust spread of (cluster - true crossing) across the bars; SigmaU: along the bars, - # two-ended clusters (T1 and the taggers are single-ended). + # need their own lists. With DoGeometric true, a list needs one entry per sector type of the loaded geometry or a + # single entry for all types; the module throws at beginRun otherwise. SigmaV: robust spread of (cluster - true + # crossing) across the bars; SigmaU: along the bars, two-ended clusters (T1 and the taggers are single-ended). SigmaV : [ 7, 13, 7, 17 ] # mm SigmaU : [ 300 ] # mm SigmaT : [ 5 ] # ns provisional (MC dtXing robust width 2.0-2.4 ns, two-ended) diff --git a/CRVReco/inc/TrkCrvMatchTool.hh b/CRVReco/inc/TrkCrvMatchTool.hh index e4cc39c5f4..f70b009d25 100644 --- a/CRVReco/inc/TrkCrvMatchTool.hh +++ b/CRVReco/inc/TrkCrvMatchTool.hh @@ -41,7 +41,7 @@ namespace mu2e { fhicl::Atom maxDu{Name("MaxDu"), Comment("storage window on |along-bar residual| for two-ended clusters [mm]")}; fhicl::Atom doGeometric{Name("DoGeometric"), Comment("form geometric candidates from CRV KalIntersections")}; fhicl::Atom requireSameSector{Name("RequireSameSector"), Comment("project only from a crossing of the cluster's own sector (A/B tests)"), false}; - fhicl::Sequence sigmaV{Name("SigmaV"), Comment("CRV across-bar resolution [mm], indexed by the cluster's sector type (1 first; the last entry serves higher types); sector type numbering depends on the geometry")}; + fhicl::Sequence sigmaV{Name("SigmaV"), Comment("CRV across-bar resolution [mm], indexed by the cluster's sector type (1 first): one entry per sector type of the loaded CRV geometry, or one entry for all; sector type numbering depends on the geometry")}; fhicl::Sequence sigmaU{Name("SigmaU"), Comment("CRV along-bar resolution of two-ended clusters [mm], by sector type")}; fhicl::Sequence sigmaT{Name("SigmaT"), Comment("CRV time resolution of two-ended clusters [ns], by sector type")}; fhicl::Atom sigmaTSingleEnded{Name("SigmaTSingleEnded"), Comment("CRV time resolution of single-ended clusters [ns]")}; @@ -79,6 +79,7 @@ namespace mu2e { bool singleEnded = false; }; double resolution(std::vector const& tab, int sectorType) const; + void checkResolutions() const; // throws if a Sigma* list does not describe the loaded CRV geometry's sector types TrkCrvPlaneCov errorModel(ROOT::Math::SMatrix> const& cov) const; // k^2 C + a^2 I void probe(TrkCrvXing& x, double speed) const; static bool sameCluster(art::Ptr const& a, art::Ptr const& b); diff --git a/CRVReco/src/TrkCrvMatchTool.cc b/CRVReco/src/TrkCrvMatchTool.cc index 5f54a6a75a..9bf6373ca6 100644 --- a/CRVReco/src/TrkCrvMatchTool.cc +++ b/CRVReco/src/TrkCrvMatchTool.cc @@ -41,11 +41,36 @@ namespace mu2e { return tab[std::min(i, tab.size() - 1)]; } + void TrkCrvMatchTool::checkResolutions() const { + std::map> types; // sector type -> sector names + for(auto const& s : crs_->getCRSScintillatorShields()) types[s.getSectorType()].push_back(s.getName()); + if(types.empty()) return; + int minType = types.begin()->first, maxType = types.rbegin()->first; + std::pair const*> const tabs[] = {{"SigmaV", &sigmaV_}, {"SigmaU", &sigmaU_}, {"SigmaT", &sigmaT_}}; + for(auto const& [name, tab] : tabs) { + if(tab->size() == 1 || (minType >= 1 && tab->size() == static_cast(maxType))) continue; + cet::exception ex("CONFIG"); + ex << "TrkCrvMatchTool: " << name << " has " << tab->size() << " entries ["; + for(size_t i = 0; i < tab->size(); ++i) ex << (i ? ", " : "") << (*tab)[i]; + ex << "], but the loaded CRV geometry has sector types"; + for(auto const& [type, names] : types) { + ex << " " << type << " ("; + for(size_t i = 0; i < names.size(); ++i) ex << (i ? " " : "") << names[i]; + ex << ")"; + } + ex << ". With DoGeometric true, each of SigmaV, SigmaU and SigmaT needs one entry per sector type 1-" << maxType + << ", type 1 first, or a single entry for all types. The TrkCrvMatcher defaults in CRVReco/fcl/prolog_v12.fcl" + << " describe the extracted geometry only.\n"; + throw ex; + } + } + void TrkCrvMatchTool::beginRun() { GeomHandle crs; GeomHandle det; crs_ = crs.get(); det_ = det.get(); + if(doGeometric_) checkResolutions(); // the Sigma* lists enter only the geometric chi2 sectors_ = trkCrvSectors(); sidToShield_.clear(); for(size_t i = 0; i < sectors_.size(); ++i)