Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 3 additions & 2 deletions CRVReco/fcl/prolog_v12.fcl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion CRVReco/inc/TrkCrvMatchTool.hh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace mu2e {
fhicl::Atom<double> maxDu{Name("MaxDu"), Comment("storage window on |along-bar residual| for two-ended clusters [mm]")};
fhicl::Atom<bool> doGeometric{Name("DoGeometric"), Comment("form geometric candidates from CRV KalIntersections")};
fhicl::Atom<bool> requireSameSector{Name("RequireSameSector"), Comment("project only from a crossing of the cluster's own sector (A/B tests)"), false};
fhicl::Sequence<double> 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<double> 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<double> sigmaU{Name("SigmaU"), Comment("CRV along-bar resolution of two-ended clusters [mm], by sector type")};
fhicl::Sequence<double> sigmaT{Name("SigmaT"), Comment("CRV time resolution of two-ended clusters [ns], by sector type")};
fhicl::Atom<double> sigmaTSingleEnded{Name("SigmaTSingleEnded"), Comment("CRV time resolution of single-ended clusters [ns]")};
Expand Down Expand Up @@ -79,6 +79,7 @@ namespace mu2e {
bool singleEnded = false;
};
double resolution(std::vector<double> 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<double,2,2,ROOT::Math::MatRepSym<double,2>> const& cov) const; // k^2 C + a^2 I
void probe(TrkCrvXing& x, double speed) const;
static bool sameCluster(art::Ptr<CrvCoincidenceCluster> const& a, art::Ptr<CrvCoincidenceCluster> const& b);
Expand Down
25 changes: 25 additions & 0 deletions CRVReco/src/TrkCrvMatchTool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,36 @@ namespace mu2e {
return tab[std::min(i, tab.size() - 1)];
}

void TrkCrvMatchTool::checkResolutions() const {
std::map<int, std::vector<std::string>> 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<char const*, std::vector<double> 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<size_t>(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<CosmicRayShield> crs;
GeomHandle<DetectorSystem> 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)
Expand Down