Loading [MathJax]/jax/output/SVG/config.js
 |
ATLAS Offline Software
|
#include <MuonCombinePatternTool.h>
|
| MuonCombinePatternTool (const std::string &type, const std::string &name, const IInterface *parent) |
|
virtual | ~MuonCombinePatternTool ()=default |
|
StatusCode | initialize () override |
|
std::unique_ptr< MuonPrdPatternCollection > | combineEtaPhiPatterns (const MuonPrdPatternCollection &phiPatternCollection, const MuonPrdPatternCollection &etaPatternCollection, const EtaPhiHitAssocMap &phiEtaHitAssMap) const override |
| Combines phi and eta pattern collection into a new combined pattern collection. More...
|
|
std::unique_ptr< Muon::MuonPrdPattern > | makeCombinedPattern (const Muon::MuonPrdPattern &phipattern, const Muon::MuonPrdPattern &etapattern) const override |
| Combines phi and eta pattern into a new combined pattern. More...
|
|
virtual std::unique_ptr< MuonPatternCombinationCollection > | makePatternCombinations (const MuonPrdPatternCollection &muonpatterns) const override |
| converts MuonPrdPatterns into MuonPatternCombinationCollection MuonPatternCombinationCollection are default output for PatternFinder More...
|
|
ServiceHandle< StoreGateSvc > & | evtStore () |
| The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
const ServiceHandle< StoreGateSvc > & | evtStore () const |
| The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
const ServiceHandle< StoreGateSvc > & | detStore () const |
| The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
virtual StatusCode | sysInitialize () override |
| Perform system initialization for an algorithm. More...
|
|
virtual StatusCode | sysStart () override |
| Handle START transition. More...
|
|
virtual std::vector< Gaudi::DataHandle * > | inputHandles () const override |
| Return this algorithm's input handles. More...
|
|
virtual std::vector< Gaudi::DataHandle * > | outputHandles () const override |
| Return this algorithm's output handles. More...
|
|
Gaudi::Details::PropertyBase & | declareProperty (Gaudi::Property< T > &t) |
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &) |
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, T &property, const std::string &doc="none") |
| Declare a new Gaudi property. More...
|
|
void | updateVHKA (Gaudi::Details::PropertyBase &) |
|
MsgStream & | msg () const |
|
MsgStream & | msg (const MSG::Level lvl) const |
|
bool | msgLvl (const MSG::Level lvl) const |
|
|
std::unique_ptr< MuonPrdPatternCollection > | makeCombinedPatterns (std::vector< CandidatePatPair > &candidates) const |
| make combined pattern from all candidates, removes duplicates with phi when no overlap with eta pattern More...
|
|
std::unique_ptr< Muon::MuonPrdPattern > | cleanPhiPattern (std::unique_ptr< Muon::MuonPrdPattern > phipattern) const |
| clean phi pattern, similar as in MuonHoughPatternTool, used for newly created phi patterns based on hit association More...
|
|
std::unique_ptr< Muon::MuonPrdPattern > | cleanupCombinedPattern (const Muon::MuonPrdPattern &combinedpattern) const |
| clean combined pattern, remove outliers More...
|
|
std::vector< PrdPatternPair > | splitPatterns2D (const Muon::MuonPrdPattern *phipattern, const Muon::MuonPrdPattern *etapattern) const |
| split patterns in two at point closest to IP in rphi More...
|
|
std::vector< PrdPatternPair > | splitPatterns3D (const Muon::MuonPrdPattern *phipattern, const Muon::MuonPrdPattern *etapattern) const |
| split patterns in two at point closest to IP in 3D More...
|
|
std::vector< PrdPatternPair > | splitPatternsCylinder (const Muon::MuonPrdPattern *phipattern, const Muon::MuonPrdPattern *etapattern) const |
| split patterns in two when crossing calorimeter at point closest to IP in 3D (should be same as splitting at calorimeter) if not split empty vector is returned More...
|
|
std::unique_ptr< Muon::MuonPrdPattern > | makeAssPhiPattern (const Muon::MuonPrdPattern &pattern, const EtaPhiHitAssocMap &phiEtaHitAssMap, bool check=false) const |
| make combined phi pattern by associating phi hits to noncombined eta pattern, return 0 if no phi measurements added, 2nd argument is if checking that added phi hits are already on pattern (not necessary for uncombined etapattern) More...
|
|
std::array< double, 4 > | updateParametersForCosmics (const Muon::MuonPrdPattern &phipattern, const Muon::MuonPrdPattern &etapattern) const |
| calculate new track parameters of match (only for cosmics!) returns [r0, phi, rz0, theta] More...
|
|
std::pair< double, double > | calculateR0Phi (const Muon::MuonPrdPattern &phipattern, const Muon::MuonPrdPattern &etapattern, double phi_estimate=-M_PI_2) const |
| calculate phi and r0 for cosmic patterns, phi estimate needs to be given More...
|
|
PrdPatternPair | updatePatternsForCosmics (const Muon::MuonPrdPattern &phipattern, const Muon::MuonPrdPattern &etapattern, const std::array< double, 4 > &new_pars) const |
| update patterns based on new track parameters (used only for cosmics) builds 2 new prd patterns More...
|
|
void | addCandidate (const CandPrdPatPtr &etapattern, const CandPrdPatPtr &phipattern, std::vector< CandidatePatPair > &candidates, bool add_asspattern, const EtaPhiHitAssocMap &phiEtaHitAssMap) const |
| adds eta,phi pair to candidate vector, also performs splitting and associated pattern (only for cosmics!) More...
|
|
void | printPattern (const Muon::MuonPrdPattern *muonpattern) const |
| print out pattern hits More...
|
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &) |
| specialization for handling Gaudi::Property<SG::VarHandleKey> More...
|
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &) |
| specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
|
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &) |
| specialization for handling Gaudi::Property<SG::VarHandleBase> More...
|
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &) |
| specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
|
|
Definition at line 17 of file MuonCombinePatternTool.h.
◆ CandidatePatPair
◆ CandPrdPatPtr
◆ EtaPhiHitAssocMap
◆ IdChMap
◆ PrdPatternPair
◆ PrepDataSet
◆ StoreGateSvc_t
◆ MuonCombinePatternTool()
MuonCombinePatternTool::MuonCombinePatternTool |
( |
const std::string & |
type, |
|
|
const std::string & |
name, |
|
|
const IInterface * |
parent |
|
) |
| |
◆ ~MuonCombinePatternTool()
virtual MuonCombinePatternTool::~MuonCombinePatternTool |
( |
| ) |
|
|
virtualdefault |
◆ addCandidate()
adds eta,phi pair to candidate vector, also performs splitting and associated pattern (only for cosmics!)
Definition at line 1591 of file MuonCombinePatternTool.cxx.
1595 candidates.emplace_back(etapattern, phipattern);
1599 std::vector<PrdPatternPair> splitpatterns =
splitPatternsCylinder(phipattern.get(), etapattern.get());
1601 if (splitpatterns.empty()) {
1602 candidates.emplace_back(etapattern, phipattern);
1606 for (
auto& [phiPattern, etaPattern] : splitpatterns) {
1609 if (etaPattern->numberOfContainedPrds() == 0) {
1612 candidates.emplace_back(std::move(etaPattern), std::move(phiPattern));
1618 if (!add_asspattern) { return ;}
1619 std::unique_ptr<Muon::MuonPrdPattern> assphipattern =
makeAssPhiPattern(*etapattern, phiEtaHitAssMap,
true);
1621 if (!assphipattern) {
return;}
1633 std::unique_ptr<Muon::MuonPrdPattern>& cosmicPhiPattern = updatedpatterns.first;
1634 std::unique_ptr<Muon::MuonPrdPattern>& cosmicEtaPattern = updatedpatterns.second;
1636 std::vector<PrdPatternPair> splitpatterns_ass =
splitPatternsCylinder(cosmicPhiPattern.get(), cosmicEtaPattern.get());
1637 if (splitpatterns_ass.empty()) {
1638 candidates.emplace_back(std::move(cosmicEtaPattern), std::move(cosmicPhiPattern));
1643 for (
auto& [splitPhiPattern, splitEtaPattern] : splitpatterns_ass) {
1644 if (splitPhiPattern->numberOfContainedPrds() == 0 ||
1645 splitEtaPattern->numberOfContainedPrds() == 0) {
1648 candidates.emplace_back(std::move(splitEtaPattern), std::move(splitPhiPattern));
◆ calculateR0Phi()
calculate phi and r0 for cosmic patterns, phi estimate needs to be given
Definition at line 1178 of file MuonCombinePatternTool.cxx.
1194 const double phi_etapattern = etaglobaldir.phi();
1199 const double phi_phipattern = phiglobaldir.phi();
1202 const double phi_error_inv = 1. / 20.;
1203 const double phi_error_inv2 = phi_error_inv * phi_error_inv;
1204 const double eta_error_inv = 1. / 400.;
1205 const double eta_error_inv2 = eta_error_inv * eta_error_inv;
1210 double sum_etax{0.}, sum_etay{0.}, sum_phix{0.}, sum_phiy{0.};
1214 for (
unsigned int i = 0;
i < etasize;
i++) {
1217 sum_etax += globalposhit.x();
1218 sum_etay += globalposhit.y();
1221 for (
unsigned int i = 0;
i < phisize;
i++) {
1224 sum_phix += globalposhit.x();
1225 sum_phiy += globalposhit.y();
1228 const double av_x = (eta_error_inv2 * sum_etax + phi_error_inv2 * sum_phix) / (eta_error_inv2 * etasize + phi_error_inv2 * phisize);
1229 const double av_y = (eta_error_inv2 * sum_etay + phi_error_inv2 * sum_phiy) / (eta_error_inv2 * etasize + phi_error_inv2 * phisize);
1235 double sumx {0.}, sumy {0.};
1239 double x_min {0.}, x_max {0.}, y_min {0.}, y_max {0.}, lever_min {0.}, lever_max{0.};
1241 for (
unsigned int i = 0;
i < etasize;
i++) {
1244 double x_offset = globalposhit.x() - av_x;
1245 double y_offset = globalposhit.y() - av_y;
1246 double height_squared = x_offset * x_offset + y_offset * y_offset;
1247 double weight = height_squared * eta_error_inv2;
1249 if (x_offset * scphi_est.cs + y_offset * scphi_est.sn < 0) {
sign = -1; }
1253 if (
sign == 1 && height_squared > lever_max) {
1254 lever_max = height_squared;
1255 x_max = globalposhit.x();
1256 y_max = globalposhit.y();
1257 }
else if (
sign == -1 && height_squared > lever_min) {
1258 lever_min = height_squared;
1259 x_min = globalposhit.x();
1260 y_min = globalposhit.y();
1264 for (
unsigned int i = 0;
i < phisize;
i++) {
1267 double x_offset = globalposhit.x() - av_x;
1268 double y_offset = globalposhit.y() - av_y;
1269 double height_squared = x_offset * x_offset + y_offset * y_offset;
1270 double weight = height_squared * phi_error_inv2;
1272 if (x_offset * scphi_est.cs + y_offset * scphi_est.sn < 0) {
sign = -1; }
1276 if (
sign == 1 && height_squared > lever_max) {
1277 lever_max = height_squared;
1278 x_max = globalposhit.x();
1279 y_max = globalposhit.y();
1280 }
else if (
sign == -1 && height_squared > lever_min) {
1281 lever_min = height_squared;
1282 x_min = globalposhit.x();
1283 y_min = globalposhit.y();
1287 ATH_MSG_VERBOSE(
"av_x : " << av_x <<
" av_y: " << av_y <<
" sumx: " << sumx <<
" sumy: " << sumy);
1289 if (std::abs(sumx) < 0.000001 || std::abs(sumy) < 0.000001) {
1296 if (std::hypot(x_max - x_min , y_max - y_min) < 2000) {
1297 ATH_MSG_VERBOSE(
"lever arm too small: av_x : " << std::sqrt((x_max - x_min) * (x_max - x_min) + (y_max - y_min) * (y_max - y_min))
1298 <<
" x_max: " << x_max <<
" x_min: " << x_min <<
" y_max: " << y_max
1299 <<
" y_min: " << y_min);
1303 double phi_fit = std::atan2(sumy, sumx);
1304 if (phi_fit > 0) phi_fit -=
M_PI;
1306 const double r0_fit = scphi.apply(av_x, -av_y);
1308 return std::make_pair(phi_fit, r0_fit);
◆ calculateRz0()
calculate rz0 for cosmic pattern
Definition at line 1311 of file MuonCombinePatternTool.cxx.
1312 double nhits =
pattern.numberOfContainedPrds();
1339 for (
unsigned int i = 0;
i < nhits;
i++) {
1342 int sign = (poshit.x() * scphi.cs + poshit.y() * scphi.sn > 0) ? 1 : -1;
1343 rz0 += poshit.z() * sctheta.sn -
sign * sctheta.cs * poshit.perp();
1346 if (nhits > 0) rz0 /= nhits;
◆ cleanCandidates()
void MuonCombinePatternTool::cleanCandidates |
( |
std::vector< CandidatePatPair > & |
candidates | ) |
|
|
staticprivate |
clean candidates from subsets or duplicates
Definition at line 1652 of file MuonCombinePatternTool.cxx.
1656 std::map<CandidatePatPair, std::pair<PrepDataSet, PrepDataSet>> hitsMap;
1661 for (
unsigned int hitnr = 0; hitnr < (*it1).first->numberOfContainedPrds(); hitnr++) { etahits.insert((*it1).first->prd(hitnr)); }
1663 if ((*it1).second) {
1664 for (
unsigned int hitnr = 0; hitnr < (*it1).second->numberOfContainedPrds(); hitnr++) {
1665 phihits.insert((*it1).second->prd(hitnr));
1668 hitsMap.insert(std::make_pair((*
it1), std::make_pair(etahits, phihits)));
1672 std::pair<PrepDataSet, PrepDataSet>& hits1 = hitsMap[(*it1)];
1675 std::pair<PrepDataSet, PrepDataSet>& hits2 = hitsMap[(*it2)];
1676 if (
subset((hits2), (hits1))) {
1679 }
else if (
subset((hits1), (hits2))) {
1683 hits1 = hitsMap[(*it1)];
◆ cleanPhiPattern()
clean phi pattern, similar as in MuonHoughPatternTool, used for newly created phi patterns based on hit association
Definition at line 1499 of file MuonCombinePatternTool.cxx.
1501 const double theta = olddir.theta();
1506 <<
" theta " <<
theta);
1513 std::unique_ptr<MuonHoughPattern> newpattern = std::make_unique<MuonHoughPattern>(
MuonHough::hough_xy);
1514 for (
unsigned int phihitnr = 0; phihitnr <
size; phihitnr++) { newpattern->
addHit(std::make_shared<MuonHoughHit>(phipattern->
prd(phihitnr))); }
1521 constexpr
int number_of_iterations = 4;
1522 std::array<double,number_of_iterations> cutvalues {1000., 500., 250., 125.};
1524 cutvalues[0] = 5000.;
1525 cutvalues[1] = 2500.;
1526 cutvalues[2] = 1250.;
1527 cutvalues[3] = 1250.;
1530 for (
int it = 0;
it < number_of_iterations; ++
it) {
1536 double max_dist = 0.;
1537 unsigned int max_i = 99999;
1538 for (
unsigned int i = 0;
i < newpattern->
size();
i++) {
1543 if (std::fabs(dist) > std::abs(max_dist)) {
1548 if (std::abs(max_dist) < cutvalues[
it]) {
1565 double thetanew = 0.;
1570 unsigned int nPatterns = newpattern->
size();
1571 for (
unsigned int i = 0;
i < nPatterns;
i++) { thetanew += newpattern->
getTheta(
i); }
1573 if (nPatterns > 0) thetanew /= nPatterns;
1577 double x0_new = r0_new * scphi.sn;
1578 double y0_new = -r0_new * scphi.cs;
1582 const Amg::Vector3D dir {sctheta.sn * scphi.cs, sctheta.sn * scphi.sn, sctheta.cs};
1584 std::unique_ptr<Muon::MuonPrdPattern> cleanpattern = std::make_unique<Muon::MuonPrdPattern>(
pos,
dir);
1586 for (
unsigned int i = 0;
i < newpattern->
size();
i++) { cleanpattern->
addPrd(newpattern->
getPrd(
i)); }
1588 return cleanpattern;
◆ cleanupCombinedPattern()
clean combined pattern, remove outliers
Definition at line 921 of file MuonCombinePatternTool.cxx.
928 const double posx = patternpos.x();
929 const double posy = patternpos.y();
930 const double posz = patternpos.z();
932 double invcurvature = 0.;
937 if (curvature > 2) invcurvature =
charge / curvature;
939 ATH_MSG_DEBUG(
"cleaned up pattern: phi " << phipattern <<
" theta: " << thetapattern <<
" position: " << posx <<
" " << posy <<
" "
943 std::unique_ptr<Muon::MuonPrdPattern> combinedpattern_cleaned =
953 double radius_pattern = globalposhit.perp();
954 double z0 = posz - radius_pattern * scthetapattern.cs / scthetapattern.sn;
958 const double scale =
std::max(1., globalposhit.mag() / 7000.);
961 <<
" dist xy " << distance_xy <<
" dist rz " << distance_rz <<
" scale: " <<
scale);
963 combinedpattern_cleaned->
addPrd(prd);
965 ATH_MSG_DEBUG(
"Hit discarded: " << hitid <<
" dis xy " << distance_xy <<
" dis rz " << distance_rz);
974 "cleaned up pattern is empty (should happen only when initially no phi "
975 "pattern found and phi hits are added by ascociation map)");
978 return combinedpattern_cleaned;
◆ combineEtaPhiPatterns()
Combines phi and eta pattern collection into a new combined pattern collection.
vector of etapatterns (key) and phipatterns (value), that are candidates for combining. Both etapatterns and phipatterns can occur multiple times
- Parameters
-
phiEtaHitAssMap | phi eta association map, eta prds are key |
Implements Muon::IMuonCombinePatternTool.
Definition at line 69 of file MuonCombinePatternTool.cxx.
87 <<
" eta patterns: " << etaPatternCollection.
size()
88 <<
" phi patterns: " << phiPatternCollection.
size()
89 <<std::endl<<
"#################################################################################"
90 <<std::endl<<
"Print eta pattern collection "<<std::endl<<
m_printer->print(etaPatternCollection)
91 <<std::endl<<
"+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
92 <<std::endl<<
"Print phi pattern collection "<<std::endl<<
m_printer->print(phiPatternCollection)
95 for (
unsigned int etalevel = 0; etalevel < etaPatternCollection.
size(); etalevel++) {
97 if (etapattern->numberOfContainedPrds() == 0)
continue;
98 const Amg::Vector3D etaPatDir = etapattern->globalDirection().unit();
99 const Amg::Vector3D& etaPatPos = etapattern->globalPosition();
100 double theta = etaPatDir.theta();
101 const double phieta = etaPatDir.phi();
104 double z0 = etaPatPos.z();
105 double rz0 =
z0 * sctheta.sn;
107 double eta_x = etaPatPos.x();
108 double eta_y = etaPatPos.y();
109 double pattern_z0 =
z0 + etaPatPos.perp() * sctheta.cs / sctheta.sn;
113 const double charge = eta_r0>= 0. ? 1. : -1;
115 const double curvature = etapattern->globalDirection().mag();
116 const double invcurvature = curvature > 2 ?
charge / curvature : 0.;
118 ATH_MSG_DEBUG(
" eta pattern info level: " << etalevel <<
" phi " << phieta <<
" theta " <<
theta <<
" x0 " << eta_x <<
" y0 "
119 << eta_y <<
" z0 " <<
z0 <<
" hits " << etapattern->numberOfContainedPrds());
123 int max_philevel = -1;
125 double dotprodbest = -1.;
127 bool ismatched =
false;
128 for (
unsigned int philevel = 0; philevel < phiPatternCollection.
size(); philevel++) {
129 CandPrdPatPtr phipattern{phiPatternCollection.
at(philevel), Unowned()};
130 if (phipattern->numberOfContainedPrds() == 0)
continue;
131 bool useTightAssociation =
false;
136 ATH_MSG_DEBUG(
" using tight cuts due to phi hits " << phipattern->numberOfContainedPrds() <<
" cut "
139 ATH_MSG_DEBUG(
" using tight cuts due to eta hits " << etapattern->numberOfContainedPrds() <<
" cut "
141 useTightAssociation =
true;
144 const Amg::Vector3D phiPatDir = phipattern->globalDirection().unit();
145 const double dotprod = phiPatDir.dot(etaPatDir);
147 if (dotprod > dotprodbest) {
148 dotprodbest = dotprod;
153 ATH_MSG_DEBUG(
" eta nr " << etalevel <<
" phi nr " << philevel <<
" inproduct " << dotprod <<
" sin angle "
157 double r0{0.}, phipattern_x{0.}, phipattern_y{0.},
phi{phiPatDir.phi()};
168 phipattern_x =
r0 * scphi.sn;
169 phipattern_y =
r0 * scphi.cs;
171 const Amg::Vector3D posphipattern = phipattern->globalPosition();
172 phipattern_x = posphipattern.x();
173 phipattern_y = posphipattern.y();
188 std::map<Identifier, ChamberInfo> infoPerChamber;
189 std::map<Muon::MuonStationIndex::StIndex, ChamberInfo> infoPerStation;
191 double average_distance{0};
192 int nhits_in_average{0}, nhits_inside_distance_cut{0};
194 double phiPatMin{1e9}, phiPatMax{-1e9};
196 for (
unsigned int phihitid = 0; phihitid < phipattern->numberOfContainedPrds(); phihitid++) {
199 double radius_hit = globalposhit.perp();
200 double dotprodradius = sctheta.apply(radius_hit, globalposhit.z());
206 const double perp = scphi.apply(globalposhit.y(), globalposhit.x());
212 double distancetoline = std::abs(residu_distance_mm);
218 nhits_inside_distance_cut++;
220 average_distance += distancetoline;
222 if (!useTightAssociation) {
continue; }
224 ChamberInfo& chInfo = infoPerChamber[chId];
226 double hitphi = globalposhit.phi();
227 chInfo.phiMin =
std::min(hitphi,chInfo.phiMin);
228 chInfo.phiMax =
std::min(hitphi,chInfo.phiMax);
231 ChamberInfo& stInfo = infoPerStation[stIndex];
233 stInfo.phiMin =
std::min(hitphi, stInfo.phiMin);
234 stInfo.phiMax =
std::max(hitphi, stInfo.phiMax);
235 phiPatMin =
std::min(hitphi,phiPatMin);
236 phiPatMax =
std::max(hitphi,phiPatMax);
240 if (nhits_in_average > 0) average_distance /= nhits_in_average;
242 ATH_MSG_DEBUG(
" Result for phi pattern: accepted hits " << nhits_inside_distance_cut <<
" average distance "
243 << average_distance);
245 bool etapattern_passed =
false;
246 for (
unsigned int etahitid = 0; etahitid < etapattern->numberOfContainedPrds(); etahitid++) {
249 const double etahitx = etaglobalposhit.x();
250 const double etahity = etaglobalposhit.y();
253 double etadotprod = scphi.apply(etahity, etahitx);
255 if (etadotprod < 0)
continue;
258 const double xdiff = phipattern_x - etahitx;
259 const double ydiff = phipattern_y - etahity;
260 const double etahitr = std::hypot(xdiff, ydiff);
262 bool hit_passed =
false;
270 const double scale = etahitr / 7000.;
272 }
else if (2 * etadistancetoline < etahitr) {
277 if (!hit_passed) {
continue; }
279 etapattern_passed =
true;
283 if (!useTightAssociation) { continue ;}
286 ChamberInfo& chInfo = infoPerChamber[chId];
290 ChamberInfo& stInfo = infoPerStation[stIndex];
294 if (!mdtDetEl)
continue;
303 double phiLeft = gposLeft.phi();
307 double phiRight = gposRight.phi();
308 double phiMin =
std::min(phiRight, phiLeft);
309 double phiMax =
std::max(phiLeft ,phiRight);
314 double tubeL = (HVPos - ROPos).
mag();
315 double phiRO = ROPos.phi();
316 double phiHV = HVPos.phi();
317 double phiMinPos =
std::min(phiHV, phiRO);
318 double phiMaxPos =
std::max(phiRO, phiHV);
320 if (std::abs(phiMin - phiMinPos) > 0.01 || std::abs(phiMax - phiMaxPos) > 0.01) {
321 ATH_MSG_DEBUG(
" inconsistent Phi!!: from locToGlob (" << phiMin <<
"," << phiMax <<
"), from positions ("
322 << phiMinPos <<
"," << phiMaxPos <<
")");
324 double rotationFraction = 0.;
325 if (phiMin < 0 && phiMax > 0) {
326 if (phiMin < -0.75 * M_PI || phiMax > 0.75 *
M_PI)
327 rotationFraction = 1.5;
329 rotationFraction = 0.5;
330 }
else if (phiMax < 0) {
331 rotationFraction = 1.;
333 double phiMinR = rotatePhi(phiMin, rotationFraction);
334 double phiMaxR = rotatePhi(phiMax, rotationFraction);
335 phiMin =
std::min(phiMinR, phiMaxR);
336 phiMax =
std::max(phiMinR, phiMaxR);
338 phiMinR = rotatePhi(phiMinPos, rotationFraction);
339 phiMaxR = rotatePhi(phiMaxPos, rotationFraction);
340 phiMinPos =
std::min(phiMinR, phiMaxR);
341 phiMaxPos =
std::max(phiMinR, phiMaxR);
344 phiMin = phiMin > 0 ? phiMin - 0.1 : phiMin + 0.1;
345 phiMax = phiMax > 0 ? phiMax + 0.1 : phiMax - 0.1;
347 double phiMinSec{1.e9},phiMaxSec{-1.e9};
348 if (stInfo.nphi > 0 && stInfo.phiMin < 1000) {
349 phiMinR = rotatePhi(stInfo.phiMin, rotationFraction);
350 phiMaxR = rotatePhi(stInfo.phiMax, rotationFraction);
351 phiMinSec =
std::min(phiMinR, phiMaxR);
352 phiMaxSec =
std::max(phiMinR, phiMaxR);
357 if (phiMinSec > 0 && phiMaxSec > 0) {
358 if (phiMin > phiMaxSec || phiMax < phiMinSec)
inside =
false;
359 }
else if (phiMinSec < 0 && phiMaxSec < 0) {
364 if (phiMax < phiMaxSec)
inside =
false;
378 phiMinR = rotatePhi(phiPatMin, rotationFraction);
379 phiMaxR = rotatePhi(phiPatMax, rotationFraction);
380 double phiMinPat =
std::min(phiMinR, phiMaxR);
381 double phiMaxPat =
std::max(phiMinR, phiMaxR);
383 bool insidePat =
true;
385 if (phiMinPat > 0 && phiMaxPat > 0) {
386 if (phiMin > phiMaxPat || phiMax < phiMinPat) insidePat =
false;
387 }
else if (phiMinPat < 0 && phiMaxPat < 0) {
392 if (phiMax < phiMaxPat) insidePat =
false;
401 ++stInfo.noutsidePat;
402 ++chInfo.noutsidePat;
407 << std::setprecision(3) << std::setw(4) << phiMin <<
"," << std::setw(4) << phiMax <<
") "
408 <<
" from pos (" << std::setprecision(3) << std::setw(4) << phiMinPos <<
"," << std::setw(4)
409 << phiMaxPos <<
") ");
410 if (stInfo.nphi > 0 && stInfo.phiMin < 1000) {
411 ATH_MSG_DEBUG(
" phi range (" << std::setprecision(3) << std::setw(4) << stInfo.phiMin <<
","
412 << std::setw(4) << stInfo.phiMax <<
") ");
414 ATH_MSG_DEBUG(
" pat range (" << std::setprecision(3) << std::setw(4) << phiMinPat <<
"," << std::setw(4)
422 if (!etapattern_passed)
continue;
423 unsigned int netaPhiPairs = 0;
424 if (useTightAssociation) {
427 for (
auto& [chamberId, chamberInfo] : infoPerChamber) {
430 << chamberInfo.neta <<
" phi hits " << chamberInfo.nphi <<
" ninside "
431 << chamberInfo.ninside <<
" noutside " << chamberInfo.noutside <<
" ninside "
432 << chamberInfo.ninsidePat <<
" noutside " << chamberInfo.noutsidePat);
434 netaPhiPairs += (chamberInfo.neta && chamberInfo.nphi);
437 ATH_MSG_DEBUG(
" eta/phi pattern hit overlap " << netaPhiPairs);
438 if (!etapattern_passed) {
ATH_MSG_DEBUG(
" failed eta hit match "); }
439 if (nhits_inside_distance_cut < (phipattern->numberOfContainedPrds() * 0.25)) {
442 if (netaPhiPairs == 0) {
ATH_MSG_DEBUG(
" Bad match, no overlap "); }
445 ATH_MSG_VERBOSE(
" Eta pattern compatible with phi pattern, eta/phi overlap " << netaPhiPairs <<
" ass phi hits "
446 << nhits_inside_distance_cut <<
" tot phi hits "
447 << phipattern->numberOfContainedPrds()
448 <<(useTightAssociation ?
" using tight association ":
"" ));
451 if ((!useTightAssociation || netaPhiPairs > 0) && nhits_inside_distance_cut >= (phipattern->numberOfContainedPrds() * 0.25)) {
458 std::array<double,4> new_pars{
r0,
phi, pattern_z0,
theta};
460 phipattern = std::move(updatedpatterns.first);
461 etapattern = std::move(updatedpatterns.second);
462 ATH_MSG_DEBUG(
" Combination accepted with cosmic selection ");
463 }
else if (useTightAssociation) {
467 std::unique_ptr<Muon::MuonPrdPattern> etaPat = std::make_unique<Muon::MuonPrdPattern>(etapattern->globalPosition(), etapattern->globalDirection());
468 std::unique_ptr<Muon::MuonPrdPattern> phiPat = std::make_unique<Muon::MuonPrdPattern>(phipattern->globalPosition(), phipattern->globalDirection());
469 for (
unsigned int etahitid = 0; etahitid < etapattern->numberOfContainedPrds(); ++etahitid) {
474 if (chPos == infoPerChamber.end())
continue;
477 if (chPos->second.ninside == 0 && chPos->second.noutside > 0)
continue;
478 if (chPos->second.ninsidePat == 0 && chPos->second.noutsidePat > 0)
continue;
480 if (chPos->second.nphi == 0)
continue;
484 for (
unsigned int phihitid = 0; phihitid < phipattern->numberOfContainedPrds(); ++phihitid) {
489 if (chPos == infoPerChamber.end())
continue;
491 if (chPos->second.neta == 0)
continue;
494 phipattern = std::move(phiPat);
495 etapattern = std::move(etaPat);
500 ATH_MSG_DEBUG(
"Candidate FOUND eta " << etalevel <<
" phi " << philevel <<
" dotprod: " << dotprod);
502 if (average_distance < min_average_distance) {
504 min_average_distance = average_distance;
505 max_phipattern = phipattern;
506 max_philevel = philevel;
508 ATH_MSG_DEBUG(
" theta pattern " << etapattern->globalDirection().theta() <<
" phi "
509 << phipattern->globalDirection().phi() <<
"average distance " << average_distance
510 <<
" number of hits " << nhits_inside_distance_cut <<
" etalevel: " << etalevel);
514 }
else if (useTightAssociation && netaPhiPairs == 0 &&
515 nhits_inside_distance_cut >= (phipattern->numberOfContainedPrds() * 0.25)) {
516 ATH_MSG_DEBUG(
" Combination rejected by phi/eta overlap: average distance " << average_distance);
518 if (average_distance < min_average_distance) {
520 min_average_distance = average_distance;
521 max_phipattern = phipattern;
522 max_philevel = philevel;
530 ATH_MSG_DEBUG(
"Candidate FOUND eta " << etalevel <<
" phi " << max_philevel);
537 std::unique_ptr<Muon::MuonPrdPattern> assphipattern =
makeAssPhiPattern(*etapattern, phiEtaHitAssMap,
true);
538 ATH_MSG_DEBUG(
"No match found, trying to create associated phi pattern ");
543 bool subsetcheck =
false;
548 if ((*rit).first != etapattern) {
break; }
550 if (
subset(assphipattern.get(), (*rit).second.get())) {
561 ATH_MSG_DEBUG(
"Candidate FOUND eta " << etalevel <<
" and associated phipattern ");
571 assphipattern = std::move(updatedpatterns.first);
572 etapattern = std::move(updatedpatterns.second);
574 ATH_MSG_DEBUG(
" adding eta pattern with recalculated associated phi pattern ");
580 if (!ismatched && max_philevel > -1) {
583 ATH_MSG_DEBUG(
"No good candidate found, adding best phi pattern " << etalevel <<
" phi " << max_philevel);
587 ATH_MSG_DEBUG(
"NO COMBINED Candidate FOUND eta " << etalevel <<
" phi " << phibest);
◆ declareGaudiProperty() [1/4]
specialization for handling Gaudi::Property<SG::VarHandleKeyArray>
Definition at line 170 of file AthCommonDataStore.h.
175 hndl.documentation());
◆ declareGaudiProperty() [2/4]
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition at line 156 of file AthCommonDataStore.h.
161 hndl.documentation());
◆ declareGaudiProperty() [3/4]
specialization for handling Gaudi::Property<SG::VarHandleBase>
Definition at line 184 of file AthCommonDataStore.h.
189 hndl.documentation());
◆ declareGaudiProperty() [4/4]
◆ declareProperty() [1/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
hndl | Object holding the property value. |
doc | Documentation string for the property. |
This is the version for types that derive from SG::VarHandleBase
. The property value object is put on the input and output lists as appropriate; then we forward to the base class.
Definition at line 245 of file AthCommonDataStore.h.
250 this->declare(hndl.
vhKey());
251 hndl.
vhKey().setOwner(
this);
253 return PBASE::declareProperty(
name,hndl,
doc);
◆ declareProperty() [2/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
hndl | Object holding the property value. |
doc | Documentation string for the property. |
This is the version for types that derive from SG::VarHandleKey
. The property value object is put on the input and output lists as appropriate; then we forward to the base class.
Definition at line 221 of file AthCommonDataStore.h.
229 return PBASE::declareProperty(
name,hndl,
doc);
◆ declareProperty() [3/6]
◆ declareProperty() [4/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
property | Object holding the property value. |
doc | Documentation string for the property. |
This is the generic version, for types that do not derive from SG::VarHandleKey
. It just forwards to the base class version of declareProperty
.
Definition at line 333 of file AthCommonDataStore.h.
338 return PBASE::declareProperty(
name, property,
doc);
◆ declareProperty() [5/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
property | Object holding the property value. |
doc | Documentation string for the property. |
This dispatches to either the generic declareProperty
or the one for VarHandle/Key/KeyArray.
Definition at line 352 of file AthCommonDataStore.h.
◆ declareProperty() [6/6]
◆ detStore()
◆ evtStore() [1/2]
◆ evtStore() [2/2]
◆ extraDeps_update_handler()
Add StoreName to extra input/output deps as needed.
use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given
◆ initialize()
StatusCode MuonCombinePatternTool::initialize |
( |
| ) |
|
|
override |
◆ inputHandles()
Return this algorithm's input handles.
We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.
◆ interfaceID()
static const InterfaceID& Muon::IMuonCombinePatternTool::interfaceID |
( |
| ) |
|
|
inlinestaticinherited |
Definition at line 29 of file IMuonCombinePatternTool.h.
30 static const InterfaceID IID_IMuonCombinePatternTool(
"Muon::IMuonCombinePatternTool", 1, 0);
31 return IID_IMuonCombinePatternTool;
◆ makeAssPhiPattern()
make combined phi pattern by associating phi hits to noncombined eta pattern, return 0 if no phi measurements added, 2nd argument is if checking that added phi hits are already on pattern (not necessary for uncombined etapattern)
No phi hits were recorded in that chamber
- Parameters
-
phiEtaHitAssMap | phi eta association map, eta prds are key |
Definition at line 981 of file MuonCombinePatternTool.cxx.
987 const unsigned int size = muonpattern.numberOfContainedPrds();
990 if (check_already_on_pattern) {
991 for (
unsigned int i = 0;
i <
size;
i++) {
hits.insert(muonpattern.prd(
i)); }
993 std::vector<const Trk::PrepRawData*> phihits;
994 for (
unsigned int i = 0;
i <
size;
i++) {
998 if (!muoncluster)
continue;
999 EtaPhiHitAssocMap::const_iterator itr = phiEtaHitAssMap.find(prd);
1001 if (itr == phiEtaHitAssMap.end()) {
1004 std::copy_if(itr->second.begin(), itr->second.end(), std::back_inserter(phihits),
1006 return !check_already_on_pattern || hits.insert(phiHit).second;
1011 if (phihits.empty()) {
return nullptr; }
1013 std::unique_ptr<Muon::MuonPrdPattern> phipattern;
1015 double phi = 0., sin_phi = 0., cos_phi = 0.;
1017 phi = muonpattern.globalDirection().phi();
1022 sin_phi += scphihit.sn;
1023 cos_phi += scphihit.cs;
1025 phi = std::atan2(sin_phi, cos_phi);
1028 const double curvature = muonpattern.globalDirection().mag();
1029 const double theta = muonpattern.globalDirection().theta();
1034 phipattern = std::make_unique<Muon::MuonPrdPattern>(muonpattern.globalPosition(), muonpattern.globalDirection(), phihits);
1037 const Amg::Vector3D& globaldir{curvature * scphi.cs * sctheta.sn,
1038 curvature * scphi.sn * sctheta.sn, curvature * sctheta.cs};
1039 phipattern = std::make_unique<Muon::MuonPrdPattern>(globalpos, globaldir, phihits);
1044 std::unique_ptr<Muon::MuonPrdPattern> phipatternclean =
cleanPhiPattern(std::move(phipattern));
1047 phipatternclean.reset();
1049 return phipatternclean;
◆ makeCombinedPattern()
Combines phi and eta pattern into a new combined pattern.
Implements Muon::IMuonCombinePatternTool.
Definition at line 648 of file MuonCombinePatternTool.cxx.
671 const Amg::Vector3D dir{curvature * scphi.cs * sctheta.sn, curvature * scphi.sn * sctheta.sn, curvature * sctheta.cs};
677 std::unique_ptr<Muon::MuonPrdPattern> combinedpattern = std::make_unique<Muon::MuonPrdPattern>(
pos,
dir, std::move(comb_prds));
680 ATH_MSG_DEBUG(
"direction combined pattern: " << scphi.cs * sctheta.sn <<
" " << scphi.sn * sctheta.sn <<
" " << sctheta.cs);
681 ATH_MSG_DEBUG(
"position combined pattern: " << x0 <<
" " << y0 <<
" " << z0_phi);
690 return combinedpattern;
693 ATH_MSG_DEBUG(
"Start Cleaning and Recalculating of Combined Pattern");
699 ATH_MSG_DEBUG(
"size before cleanup: " << size_before_cleanup);
706 if (size_before_cleanup == size_after_cleanup || size_after_cleanup == 0) {
708 return cleaneduppattern;
709 }
else if (size_after_cleanup < size_before_cleanup) {
710 combinedpattern = std::move(cleaneduppattern);
◆ makeCombinedPatterns()
make combined pattern from all candidates, removes duplicates with phi when no overlap with eta pattern
Definition at line 600 of file MuonCombinePatternTool.cxx.
609 std::unique_ptr<MuonPrdPatternCollection> combinedPatternCollection = std::make_unique<MuonPrdPatternCollection>();
610 int number_comb_patterns = 0;
611 for (
const auto& [etapattern, phipattern] :
candidates) {
614 std::unique_ptr<Muon::MuonPrdPattern> combinedpattern =
makeCombinedPattern(*phipattern, *etapattern);
615 if (combinedpattern) {
617 combinedPatternCollection->
push_back(combinedpattern.release());
618 number_comb_patterns++;
623 ATH_MSG_VERBOSE(
"No combined pattern, eta pattern split based on phi direction of eta pattern ");
626 if (splitetapatterns.empty()) {
627 combinedPatternCollection->
push_back(etapattern->clone());
629 for (
unsigned int i = 0;
i < splitetapatterns.size();
i++) {
630 if (splitetapatterns[
i].
second->numberOfContainedPrds() != 0) {
637 combinedPatternCollection->
push_back(etapattern->clone());
642 ATH_MSG_DEBUG(
"Number of combined patterns: " << number_comb_patterns <<
" Number of unmatched etapatterns: "
643 << combinedPatternCollection->
size() - number_comb_patterns);
645 return combinedPatternCollection;
◆ makePatternCombinations()
converts MuonPrdPatterns into MuonPatternCombinationCollection MuonPatternCombinationCollection are default output for PatternFinder
Implements Muon::IMuonCombinePatternTool.
Definition at line 1383 of file MuonCombinePatternTool.cxx.
1386 std::unique_ptr<MuonPatternCombinationCollection> patterncombinations = std::make_unique<MuonPatternCombinationCollection>();
1391 ATH_MSG_DEBUG(
"phi: " << roadmom.phi() <<
" eta: " << roadmom.eta());
1392 ATH_MSG_DEBUG(
"x: " << roadpos.x() <<
" y: " << roadpos.y() <<
" z: " << roadpos.z());
1395 std::map<Identifier, std::vector<const Trk::PrepRawData*>> chamberMap;
1396 for (
unsigned int i = 0;
i < pit->numberOfContainedPrds(); ++
i) {
1400 std::vector<const Trk::PrepRawData*>& chambVec = chamberMap[moduleId];
1401 if (chambVec.empty()) chambVec.reserve(pit->numberOfContainedPrds());
1402 chambVec.push_back(prd);
1406 std::vector<Muon::MuonPatternChamberIntersect> mpciVec;
1407 mpciVec.reserve(chamberMap.size());
1409 for (
const auto& [moduleId, chambVec] : chamberMap) {
1414 patdire = roadmom.unit();
1421 mpciVec.push_back(mpci);
1428 patterncombinations->
push_back(combination);
1430 return patterncombinations;
◆ msg() [1/2]
◆ msg() [2/2]
◆ msgLvl()
◆ outputHandles()
Return this algorithm's output handles.
We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.
◆ printPattern()
print out pattern hits
Definition at line 1469 of file MuonCombinePatternTool.cxx.
1486 ATH_MSG_VERBOSE(
"mdt " <<
k <<
" x: " << gpos.x() <<
" y: " << gpos.y() <<
" z: " << gpos.z());
1487 }
else if (!mdtprd) {
1491 ATH_MSG_VERBOSE(
"cluster " <<
k <<
" x: " << gpos.x() <<
" y: " << gpos.y() <<
" z: " << gpos.z());
◆ renounce()
◆ renounceArray()
◆ splitPatterns2D()
split patterns in two at point closest to IP in rphi
Definition at line 719 of file MuonCombinePatternTool.cxx.
721 std::vector<PrdPatternPair> splitPatterns;
722 splitPatterns.reserve(2);
730 const Amg::Vector3D dir1{scphi.cs * sctheta.sn, scphi.sn * sctheta.sn, sctheta.cs};
732 std::unique_ptr<Muon::MuonPrdPattern> phipattern1 = std::make_unique<Muon::MuonPrdPattern>(phipattern->
globalPosition(), dir1);
733 std::unique_ptr<Muon::MuonPrdPattern> etapattern1 = std::make_unique<Muon::MuonPrdPattern>(etapattern->
globalPosition(), dir1);
738 const double newphi =
phi +
M_PI;
744 dir2 =
Amg::Vector3D(scnewphi.cs * scnewtheta.sn, scnewphi.sn * scnewtheta.sn, scnewtheta.cs);
747 std::unique_ptr<Muon::MuonPrdPattern> phipattern2 = std::make_unique<Muon::MuonPrdPattern>(phipattern->
globalPosition(), dir2);
748 std::unique_ptr<Muon::MuonPrdPattern> etapattern2 = std::make_unique<Muon::MuonPrdPattern>(etapattern->
globalPosition(), dir2);
756 const double dotprod = scphi.apply(globalposhit.y(), globalposhit.x());
766 const double dotprod = scphi.apply(globalposhit.y(), globalposhit.x());
774 splitPatterns.emplace_back(std::move(phipattern1), std::make_unique<Muon::MuonPrdPattern>(*etapattern1));
775 splitPatterns.emplace_back(std::move(etapattern1), std::move(etapattern2));
776 return splitPatterns;
◆ splitPatterns3D()
split patterns in two at point closest to IP in 3D
Definition at line 779 of file MuonCombinePatternTool.cxx.
783 std::vector<PrdPatternPair> splitPatterns;
784 splitPatterns.reserve(2);
808 Amg::Vector3D dir1{scphi.cs * sctheta.sn, scphi.sn * sctheta.sn, sctheta.cs};
812 const double newphi =
phi +
M_PI;
819 dir2 =
Amg::Vector3D(scnewphi.cs * scnewtheta.sn, scnewphi.sn * scnewtheta.sn, scnewtheta.cs);
822 std::unique_ptr<Muon::MuonPrdPattern> etapattern1 = std::make_unique<Muon::MuonPrdPattern>(globalpos, dir1);
823 std::unique_ptr<Muon::MuonPrdPattern> etapattern2 = std::make_unique<Muon::MuonPrdPattern>(globalpos, dir2);
824 std::unique_ptr<Muon::MuonPrdPattern> phipattern1, phipattern2{};
827 phipattern1 = std::make_unique<Muon::MuonPrdPattern>(globalpos, dir1);
828 phipattern2 = std::make_unique<Muon::MuonPrdPattern>(globalpos, dir2);
840 ATH_MSG_DEBUG(
" splitpoint, x: " << splitpoint[0] <<
" y: " << splitpoint[1] <<
" z: " << splitpoint[2]);
843 double d_x = scphi.cs * sctheta.sn;
844 double d_y = scphi.sn * sctheta.sn;
850 const double hitx = globalposhit.x();
851 const double hity = globalposhit.y();
852 const double hitz = globalposhit.z();
853 const double dotprod = hitx * d_x + hity * d_y + hitz * sctheta.cs;
857 phipattern2->addPrd(prd);
866 const double hitx = globalposhit.x();
867 const double hity = globalposhit.y();
868 const double hitz = globalposhit.z();
869 const double dotprod = hitx * d_x + hity * d_y + hitz * sctheta.cs;
884 splitPatterns.emplace_back(std::move(phipattern1), std::move(etapattern1));
885 splitPatterns.emplace_back(std::move(phipattern2), std::move(etapattern2));
887 return splitPatterns;
◆ splitPatternsCylinder()
split patterns in two when crossing calorimeter at point closest to IP in 3D (should be same as splitting at calorimeter) if not split empty vector is returned
Definition at line 890 of file MuonCombinePatternTool.cxx.
914 ATH_MSG_DEBUG(
"Pattern not through calorimeter -> do not split ");
◆ subset() [1/2]
is pattern1 a complete subset of other pattern2?
is pattern1 a complete subset of other pattern2?
Definition at line 1433 of file MuonCombinePatternTool.cxx.
1443 if (!
hits.count(pattern1->
prd(hitnr))) {
◆ subset() [2/2]
is candidate1 a complete subset of other candidate2?
is candidate1 a complete subset of other candidate2?
Definition at line 1450 of file MuonCombinePatternTool.cxx.
1457 if (candidate1.first.size() > candidate2.first.size() ||
1458 candidate1.second.size() > candidate2.second.size()) {
return false; }
1460 if (!candidate2.first.count(find_me)) {
return false; }
1463 if (candidate2.second.count(find_me)) {
return false; }
◆ sysInitialize()
◆ sysStart()
Handle START transition.
We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.
◆ updateParametersForCosmics()
calculate new track parameters of match (only for cosmics!) returns [r0, phi, rz0, theta]
Definition at line 1052 of file MuonCombinePatternTool.cxx.
1065 std::array<double,4> old_pars{0};
1068 old_pars[1] = phiglobaldir.phi();
1070 const double theta_orig = etaglobaldir.theta();
1071 old_pars[2] = etaglobalpos.z() *
std::sin(theta_orig);
1072 old_pars[3] = theta_orig;
1074 if (phisize + etasize <= 1)
return old_pars;
1077 std::pair<double, double> rphi_start =
calculateR0Phi(phipattern, etapattern);
1079 std::pair<double, double> rphi =
calculateR0Phi(phipattern, etapattern, rphi_start.first);
1082 std::abs(
std::sin(etaglobaldir.phi() - phiglobaldir.phi())) < 0.15) {
1084 ATH_MSG_DEBUG(
"phi first: " << rphi_start.first <<
" phi second: " << rphi.first);
1085 ATH_MSG_DEBUG(
"phi etapattern: " << etaglobaldir.phi() <<
" phi phipattern: " << phiglobaldir.phi());
1088 const double phi = rphi.first;
1089 const double r0 = rphi.second;
1096 double av_radii{0.}, av_z{0.};
1098 for (
unsigned int i = 0;
i < etasize; ++
i) {
1101 av_radii += scphi.apply(globalposhit.y(), globalposhit.x());
1102 av_z += globalposhit.z();
1106 av_radii /= etasize;
1111 for (
unsigned int i = 0;
i < etasize;
i++) {
1115 double radius = scphi.apply(globalposhit.y(), globalposhit.x());
1116 double r_offset =
radius - av_radii;
1117 double z_offset = globalposhit.z() - av_z;
1118 double weight = r_offset * r_offset + z_offset * z_offset;
1127 ATH_MSG_VERBOSE(
"av_z : " << av_z <<
" av_radii: " << av_radii <<
" sumr: " << sumr <<
" sumz: " << sumz);
1128 if (std::abs(sumr) < 0.000001 || std::abs(sumz) < 0.000001)
return old_pars;
1130 double theta = std::atan2(sumr, sumz);
1140 std::array<double,4> new_pars {
r0,
phi,rz0,
theta};
1142 ATH_MSG_VERBOSE(
"updated parameters: r0: " << new_pars[0] <<
" phi: " << new_pars[1] <<
" rz0: " << new_pars[2]
1143 <<
" theta: " << new_pars[3]);
1144 ATH_MSG_VERBOSE(
"old parameters: r0: " << old_pars[0] <<
" phi: " << old_pars[1] <<
" rz0: " << old_pars[2] <<
" theta: " << old_pars[3]);
1148 for (
unsigned int i = 0;
i < phisize;
i++) {
1156 for (
unsigned int i = 0;
i < etasize;
i++) {
1164 for (
unsigned int i = 0;
i < etasize; ++
i) {
1167 double perp = scphi.apply(globalposhit.y(),
◆ updatePatternsForCosmics()
update patterns based on new track parameters (used only for cosmics) builds 2 new prd patterns
Definition at line 1350 of file MuonCombinePatternTool.cxx.
1352 double phi = new_pars[1];
1353 double theta = new_pars[3];
1358 double x0 = new_pars[0] * scphi.sn;
1359 double y0 = -new_pars[0] * scphi.cs;
1360 double z0_phi = new_pars[2];
1361 double z0_eta = new_pars[2];
1362 if (std::abs(sctheta.sn) > 1
e-7) {
1363 z0_phi = (new_pars[2] + new_pars[0] * sctheta.cs) / sctheta.sn;
1364 z0_eta = new_pars[2] / sctheta.sn;
1367 const Amg::Vector3D globalDir{scphi.cs * sctheta.sn, scphi.sn * sctheta.sn, sctheta.cs};
1370 ATH_MSG_VERBOSE(
"updatePatternsForCosmics() -- eta pattern "<<std::endl
1372 <<
" -- phi pattern "<<std::endl
1377 std::unique_ptr<Muon::MuonPrdPattern> updatedphipattern = std::make_unique<Muon::MuonPrdPattern>(globalPosPhi, globalDir, phipattern.
prepRawDataVec());
1378 std::unique_ptr<Muon::MuonPrdPattern> updatedetapattern = std::make_unique<Muon::MuonPrdPattern>(globalPosEta, globalDir, etapattern.
prepRawDataVec());
1380 return std::make_pair(std::move(updatedphipattern), std::move(updatedetapattern));
◆ updateVHKA()
◆ m_bestphimatch
bool MuonCombinePatternTool::m_bestphimatch |
|
private |
take only best phi match as candidate or take all phi matches (false by default, but true for cosmics)
Definition at line 151 of file MuonCombinePatternTool.h.
◆ m_detStore
◆ m_evtStore
◆ m_flipdirectionforcosmics
bool MuonCombinePatternTool::m_flipdirectionforcosmics |
|
private |
flip direction for cosmics after splitting as if coming from IP (false by default)
Definition at line 155 of file MuonCombinePatternTool.h.
◆ m_idHelperSvc
◆ m_maximum_rzdistance
const double MuonCombinePatternTool::m_maximum_rzdistance |
|
private |
◆ m_maximum_xydistance
const double MuonCombinePatternTool::m_maximum_xydistance |
|
private |
◆ m_maxSizeEtaPatternLoose
unsigned int MuonCombinePatternTool::m_maxSizeEtaPatternLoose |
|
private |
◆ m_maxSizePhiPatternLoose
unsigned int MuonCombinePatternTool::m_maxSizePhiPatternLoose |
|
private |
◆ m_muonHoughMathUtils
◆ m_nodiscarding
bool MuonCombinePatternTool::m_nodiscarding |
|
private |
◆ m_printer
Initial value:{this, "printerTool", "Muon::MuonEDMPrinterTool/MuonEDMPrinterTool",
"ToolHandle for EDM printing of segments"}
Definition at line 163 of file MuonCombinePatternTool.h.
◆ m_splitpatterns
bool MuonCombinePatternTool::m_splitpatterns |
|
private |
◆ m_use_cosmics
bool MuonCombinePatternTool::m_use_cosmics |
|
private |
◆ m_useTightAssociation
bool MuonCombinePatternTool::m_useTightAssociation |
|
private |
◆ m_varHandleArraysDeclared
◆ m_vhka
The documentation for this class was generated from the following files:
JetConstituentVector::iterator iterator
const Amg::Vector3D & globalDirection() const
Global direction of the pattern.
virtual const Trk::PrepRawData * prd(unsigned int index) const
returns the PrepRawData objects depending on the integer, return zero if index out of range
static double signedDistanceToLine(double x0, double y0, double r0, double phi)
distance from (x0,y0) to the line (r0,phi), phi in rad
double getTheta(unsigned int hitno) const
returns theta of hit hitno
static Amg::Vector3D shortestPointOfLineToOrigin(const Amg::Vector3D &vec, double phi, double theta)
calculates the 3d-point closest to origin
Scalar phi() const
phi method
virtual void addPrd(const Trk::PrepRawData *prd)
add hit to pattern
Scalar perp() const
perp method - perpenticular length
Eigen::Matrix< double, 2, 1 > Vector2D
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
double getEPhi() const
returns phi of pattern
Scalar theta() const
theta method
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool msgLvl(const MSG::Level lvl) const
constexpr double z_cylinder
length of cylinder
virtual const Amg::Vector3D & globalPosition() const =0
Returns the global position of the measurement (calculated on the fly)
#define ATH_MSG_VERBOSE(x)
const Amg::Vector3D & center() const
Returns the center position of the Surface.
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
void addHit(const std::shared_ptr< MuonHoughHit > &hit)
add hit to container
virtual void setOwner(IDataHandleHolder *o)=0
double getWireLength(const int tubeLayer, const int tube) const
Basic class for patterns in the muon spectrometer consistig out of a list of Trk::PrepRawData objects...
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
This class holds information needed for the Moore and MoMu pattern recognition for a muon chamber.
static double distanceToLine(double x0, double y0, double r0, double phi)
distance from (x0,y0) to the line (r0,phi), phi in rad
std::vector< HWIdentifier >::iterator it1
unsigned int size() const
returns size of hitcontainer
static double signedDistanceOfLineToOrigin2D(double x, double y, double phi)
signed distance of line with point (x,y) and angle phi to origin
double getHity(unsigned int hitno) const
returns y position of hit hitno
double getActiveTubeLength(const int tubeLayer, const int tube) const
const Trk::PrepRawData * getPrd(unsigned int hitno) const
returns preprawdata pointer of hit hitno
const double r0
electron radius{cm}
Out copy_if(In first, const In &last, Out res, const Pred &p)
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
const Amg::Vector3D & globalPosition() const
Global position of the pattern.
static void extrapolateCurvedRoad(const Amg::Vector3D &roadpos, const Amg::Vector3D &roadmom, const Amg::Vector3D &pos, Amg::Vector3D &roadpose, Amg::Vector3D &roaddire)
extrapolates road to global position
void updateParametersRPhi(bool cosmics=false)
update parameters in rphi plane based on weighted fit
virtual void renounce()=0
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Identifier identify() const
return the identifier
double charge(const T &p)
value_type push_back(value_type pElem)
Add an element to the end of the collection.
Class to represent measurements from the Monitored Drift Tubes.
Eigen::Matrix< double, 3, 1 > Vector3D
Amg::Vector3D ROPos(const int tubelayer, const int tube) const
std::vector< const Trk::PrepRawData * > PrdVector
Amg::Vector3D tubePos(const Identifier &id) const
Returns the global position of the given tube.
std::optional< double > intersect(const AmgVector(N)&posA, const AmgVector(N)&dirA, const AmgVector(N)&posB, const AmgVector(N)&dirB)
Calculates the point B' along the line B that's closest to a second line A.
#define ATH_MSG_WARNING(x)
void removeHit(unsigned int hitno)
remove hit from container
virtual const Trk::Surface & surface() const override final
Return surface associated with this detector element.
double getERPhi() const
returns r0/d0 of pattern
Helper to simultaneously calculate sin and cos of the same angle.
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
virtual unsigned int numberOfContainedPrds() const
Number or PrepRawData contained by this Pattern.
StIndex
enum to classify the different station layers in the muon spectrometer
Class representing clusters in the muon system.
constexpr double radius_cylinder
radius of cylinder
const T * at(size_type n) const
Access an element, as an rvalue.
static bool lineThroughCylinder(const Amg::Vector3D &vec, double phi, double theta, double r_0, double z_0)
calculates if line (x,y,z,phi,theta) crosses cylinder (r_0,z_0) around origin
The MuonPatternCombination class provides the means to store the output of the initial global pattern...
double getHitx(unsigned int hitno) const
returns x position of hit hitno
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
size_type size() const noexcept
Returns the number of elements in the collection.
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
virtual const MuonGM::MdtReadoutElement * detectorElement() const override
Returns the detector element corresponding to this PRD.
Scalar mag() const
mag method
virtual void localToGlobal(const Amg::Vector2D &locp, const Amg::Vector3D &mom, Amg::Vector3D &glob) const =0
Specified by each surface type: LocalToGlobal method without dynamic memory allocation.
static double signedDistanceCurvedToHit(double z0, double theta, double invcurvature, const Amg::Vector3D &hit)
calculates distance of point (x,y,z) to curved track with z0, theta and invcurvature for curved track...
const PrdVector & prepRawDataVec() const
virtual const TrkDetElementBase * detectorElement() const =0
return the detector element corresponding to this PRD The pointer will be zero if the det el is not d...