 |
ATLAS Offline Software
|
#include <MuonPatternCalibration.h>
|
StatusCode | createRegionMap (const EventContext &ctx, const MuonPatternCombination &pat, RegionMap ®ionMap, bool hasPhiMeasurements) const |
|
void | printRegionMap (const RegionMap ®ionMap) const |
|
void | calibrateRegionMap (const RegionMap ®ionMap, IMuonPatternCalibration::ROTsPerRegion &hitsPerRegion) const |
|
void | insertCluster (const MuonCluster &mdt, RegionMap ®ionMap, const Amg::Vector3D &patpose, const Amg::Vector3D &patdire, bool hasPhiMeasurements) const |
|
void | insertMdt (const MdtPrepData &clus, RegionMap ®ionMap, const Amg::Vector3D &patpose, const Amg::Vector3D &patdire, bool hasPhiMeasurements) const |
|
template<class ContType > |
StatusCode | loadFromStoreGate (const EventContext &ctx, const SG::ReadHandleKey< ContType > &key, const ContType *&cont_ptr) const |
| load the container from storegate given a ReadHandleKey. More...
|
|
|
ToolHandle< IMdtDriftCircleOnTrackCreator > | m_mdtCreator |
|
ToolHandle< IMuonClusterOnTrackCreator > | m_clusterCreator |
|
PublicToolHandle< MuonEDMPrinterTool > | m_printer |
|
ServiceHandle< Muon::IMuonIdHelperSvc > | m_idHelperSvc |
|
Gaudi::Property< bool > | m_doMultiAnalysis {this, "DoMultiChamberAnalysis", true} |
|
Gaudi::Property< double > | m_dropDistance {this, "DropDistance", 1500.} |
|
Gaudi::Property< double > | m_phiAngleCut {this, "AngleCutPhi", 1.e9} |
|
Gaudi::Property< bool > | m_doSummary {this, "DoSummary", false} |
|
Gaudi::Property< bool > | m_recoverTriggerHits {this, "RecoverTriggerHits", true} |
|
Gaudi::Property< bool > | m_removeDoubleMdtHits {this, "RemoveDoubleMdtHits", true} |
|
SG::ReadHandleKey< Muon::RpcPrepDataContainer > | m_keyRpc {this, "RpcPrepDataContainer","RPC_Measurements"} |
|
SG::ReadHandleKey< Muon::TgcPrepDataContainer > | m_keyTgc {this, "TgcPrepDataContainer","TGC_Measurements"} |
|
Definition at line 30 of file MuonPatternCalibration.h.
◆ ISPrd
◆ ISPrdMdt
◆ ISPrdMdtVec
◆ ISPrdVec
◆ RegionIdMap
◆ RegionMap
◆ MuonPatternCalibration()
Muon::MuonPatternCalibration::MuonPatternCalibration |
( |
const std::string & |
t, |
|
|
const std::string & |
n, |
|
|
const IInterface * |
p |
|
) |
| |
◆ ~MuonPatternCalibration()
virtual Muon::MuonPatternCalibration::~MuonPatternCalibration |
( |
| ) |
|
|
virtualdefault |
◆ calibrate()
◆ calibrateRegionMap()
Definition at line 423 of file MuonPatternCalibration.cxx.
427 for (
const auto& [regionId, regMeasColl] : regionMap) {
429 ROTRegion rotRegion{};
430 rotRegion.regionId = regionId;
431 rotRegion.regionPos = regMeasColl.regionPos;
432 rotRegion.regionDir = regMeasColl.regionDir;
433 for (
const auto& [globalPos, prd] : regMeasColl.triggerPrds) {
434 std::unique_ptr<const MuonClusterOnTrack> cluster{
m_clusterCreator->createRIO_OnTrack(*prd, globalPos)};
435 if (!cluster)
continue;
436 rotRegion.push_back(std::move(cluster));
438 for (
const auto& [regionId, MdtsWithIsect] :regMeasColl.mdtPrdsPerChamber) {
441 for (
const auto& [globalPos, prd] : MdtsWithIsect) {
443 <<
",tdc: "<<prd->tdc()<<
",adc: "<<prd->adc()<<
" at "<<
Amg::toString(globalPos));
444 const MdtDriftCircleOnTrack* mdt =
m_mdtCreator->createRIO_OnTrack(*prd, globalPos, &globalPos);
449 mdtROTs.push_back(mdt);
451 if (!mdtROTs.empty()) rotRegion.push_back(std::move(mdtROTs));
453 hitsPerRegion.push_back(std::move(rotRegion));
◆ checkForPhiMeasurements()
◆ createRegionMap()
Try to recover missing phi clusters:
- loop over the clusters in the region and sort them by collection
- count the number of eta and phi clusters per collection
Remove the NSW hits from the segment building
Definition at line 74 of file MuonPatternCalibration.cxx.
77 if (hasPhiMeasurements)
78 ATH_MSG_DEBUG(
"pattern has phi measurements using extrapolation to determine second coordinate");
88 for (
const MuonPatternChamberIntersect& isect :
pat.chamberData()) {
90 if (isect.prepRawDataVec().empty())
continue;
93 const Amg::Vector3D patdire = isect.intersectDirection().unit();
100 std::map<int, EtaPhiHits> etaPhiHitsPerChamber;
101 std::set<Identifier> clusterIds;
109 double phiStart = patdire.phi();
112 constexpr
double phiRange2 = 0.25 *
M_PI;
113 double phiOffset = 0.;
115 phiOffset = 2 *
M_PI;
116 else if (phiStart > -phiRange2 && phiStart < phiRange2)
119 if (phiOffset > 1.5 *
M_PI) {
120 if (phiStart < 0) phiStart += phiOffset;
121 if (chPhi < 0) chPhi += phiOffset;
122 }
else if (phiOffset > 0.) {
123 phiStart += phiOffset;
126 double dphi = std::abs(phiStart - chPhi);
129 ATH_MSG_DEBUG(
"Large angular phi difference between pattern and chamber, phi pattern "
135 std::map<Identifier, const MdtPrepData*> idMdtMap{};
142 const MdtPrepData*& previousMdt = idMdtMap[mdt->identify()];
143 if (!previousMdt || previousMdt->tdc() > mdt->tdc())
148 insertMdt(*mdt, regionMap, patpose, patdire, hasPhiMeasurements);
157 if (!clusterIds.insert(
id).second)
continue;
161 int colHash = clus->collectionHash();
162 EtaPhiHits& hitsPerChamber = etaPhiHitsPerChamber[colHash];
164 ++hitsPerChamber.nphi;
166 ++hitsPerChamber.neta;
168 insertCluster(*clus, regionMap, patpose, patdire, hasPhiMeasurements);
170 for (
const auto& [coll_hash,
hits] : etaPhiHitsPerChamber) {
171 if ((
hits.neta > 0 &&
hits.nphi == 0) || (
hits.nphi > 0 &&
hits.neta == 0)) {
179 for (
const RpcPrepData* rpc_prd : *prd_coll) {
180 if (!clusterIds.insert(rpc_prd->identify()).second)
continue;
181 insertCluster(*rpc_prd, regionMap, patpose, patdire, hasPhiMeasurements);
190 for (
const TgcPrepData* tgc_prd : *prd_coll) {
191 if (!clusterIds.insert(tgc_prd->identify()).second)
continue;
192 insertCluster(*tgc_prd, regionMap, patpose, patdire, hasPhiMeasurements);
198 return StatusCode::SUCCESS;
◆ getRegionId()
int Muon::MuonPatternCalibration::getRegionId |
( |
const Identifier & |
id | ) |
const |
|
override |
◆ initialize()
StatusCode Muon::MuonPatternCalibration::initialize |
( |
| ) |
|
|
overridevirtual |
◆ insertCluster()
Definition at line 202 of file MuonPatternCalibration.cxx.
213 if (hasPhiMeasurements) {
218 const Trk::Surface& surf = clus.detectorElement()->surface(
id);
221 double denom = patdire.dot(planenormal);
222 double u = (planenormal.dot(planepostion - patpose)) / (
denom);
226 const Amg::Transform3D gToLocal = clus.detectorElement()->surface().transform().inverse();
234 bool hasPointingPhiStrips =
false;
239 striplen = rpc->detectorElement()->StripLength(measuresPhi);
246 hasPointingPhiStrips =
true;
247 striplen = tgc->detectorElement()->stripLength();
250 striplen = tgc->detectorElement()->gangCentralWidth(
gasGap, wire);
256 glpos[0] = ilpos.x();
258 if (hasPointingPhiStrips) {
260 glpos[1] = ilpos.y();
262 glpos[1] = ilpos.y();
271 ATH_MSG_VERBOSE(
">>>> extrapolated position far outside volume, dropping hit "
272 <<
m_idHelperSvc->toString(
id) <<
". dist along strip " << dif.mag() <<
" 1/2 strip len "
273 << 0.5 * striplen <<
" dist measurement plane " << (
intersect - piOnPlane).mag());
276 if (dif.mag() > 0.5 * striplen) {
277 Amg::Vector3D newpos = globalpos - dif * (0.5 * striplen / dif.mag());
279 ATH_MSG_VERBOSE(
">>>> extrapolated position outside volume, shifting position "
280 <<
m_idHelperSvc->toString(
id) <<
". position along strip " << dif.mag() <<
" 1/2 tube len "
281 << 0.5 * striplen <<
" dist To strip " << (
intersect - piOnPlane).mag()
282 <<
". dist to newpos " << (newpos - globalpos).mag() <<
" pos " << newpos);
294 Region& region = regionMap[regionId];
296 region.regionDir = patdire;
297 region.regionPos = patpose;
300 region.triggerPrds.emplace_back(
intersect, &clus);
◆ insertMdt()
Definition at line 305 of file MuonPatternCalibration.cxx.
315 if (hasPhiMeasurements) {
330 double denom = patdire.dot(planenormal);
331 double u = (planenormal.dot(planepostion - patpose)) / (
denom);
334 Amg::Vector3D lpiOnPlane = amdbToGlobal.inverse() * piOnPlane;
343 if (dif.mag() > 0.5 * tubelen) {
344 Amg::Vector3D newpos = tubePos - dif * (0.5 * tubelen / dif.mag());
346 ATH_MSG_VERBOSE(
">>>> extrapolated position outside volume, shifting position "
347 <<
m_idHelperSvc->toString(
id) <<
". position along strip " << dif.mag() <<
" 1/2 tube len "
348 << 0.5 * tubelen <<
" dist To Wire " << (piOnPlane -
intersect).mag() <<
". dist to newpos "
349 << (newpos - tubePos).mag() <<
" pos " << newpos);
390 Region& region = regionMap[regionId];
392 region.regionPos = patpose;
393 region.regionDir = patdire;
396 region.mdtPrdsPerChamber[chFlag].emplace_back(
intersect, &mdt);
◆ loadFromStoreGate()
template<class ContType >
StatusCode Muon::MuonPatternCalibration::loadFromStoreGate |
( |
const EventContext & |
ctx, |
|
|
const SG::ReadHandleKey< ContType > & |
key, |
|
|
const ContType *& |
cont_ptr |
|
) |
| const |
|
private |
load the container from storegate given a ReadHandleKey.
If the key is empty a nullptr will be returned
Definition at line 457 of file MuonPatternCalibration.cxx.
463 return StatusCode::SUCCESS;
466 if (!readHandle.isValid()) {
468 return StatusCode::FAILURE;
470 cont_ptr = readHandle.cptr();
471 return StatusCode::SUCCESS;
◆ printRegionMap()
void Muon::MuonPatternCalibration::printRegionMap |
( |
const RegionMap & |
regionMap | ) |
const |
|
private |
Definition at line 400 of file MuonPatternCalibration.cxx.
405 for (
const auto& [detRegionId, chamberData] : regionMap) {
406 ATH_MSG_INFO(
"new region " << detRegionId <<
" trigger " << chamberData.triggerPrds.size() <<
" mdt ch "
407 << chamberData.mdtPrdsPerChamber.size());
408 if (!chamberData.triggerPrds.empty())
ATH_MSG_INFO(
"trigger hits " << chamberData.triggerPrds.size());
410 for (
const auto& [globalPos, prd] : chamberData.triggerPrds) {
413 for (
const auto& [statId, MdtChamHits]: chamberData.mdtPrdsPerChamber) {
414 ATH_MSG_INFO(
"new MDT chamber with " << MdtChamHits.size() <<
" hits");
415 for (
const auto& [globalPos, prd] : MdtChamHits) {
◆ m_clusterCreator
Initial value:{
this,
"ClusterCreator",
"Muon::MuonClusterOnTrackCreator/MuonClusterOnTrackCreator",
}
Definition at line 88 of file MuonPatternCalibration.h.
◆ m_doMultiAnalysis
Gaudi::Property<bool> Muon::MuonPatternCalibration::m_doMultiAnalysis {this, "DoMultiChamberAnalysis", true} |
|
private |
◆ m_doSummary
Gaudi::Property<bool> Muon::MuonPatternCalibration::m_doSummary {this, "DoSummary", false} |
|
private |
◆ m_dropDistance
Gaudi::Property<double> Muon::MuonPatternCalibration::m_dropDistance {this, "DropDistance", 1500.} |
|
private |
◆ m_idHelperSvc
Initial value:{
this,
"MuonIdHelperSvc",
"Muon::MuonIdHelperSvc/MuonIdHelperSvc",
}
Definition at line 99 of file MuonPatternCalibration.h.
◆ m_keyRpc
◆ m_keyTgc
◆ m_mdtCreator
◆ m_phiAngleCut
Gaudi::Property<double> Muon::MuonPatternCalibration::m_phiAngleCut {this, "AngleCutPhi", 1.e9} |
|
private |
◆ m_printer
◆ m_recoverTriggerHits
Gaudi::Property<bool> Muon::MuonPatternCalibration::m_recoverTriggerHits {this, "RecoverTriggerHits", true} |
|
private |
◆ m_removeDoubleMdtHits
Gaudi::Property<bool> Muon::MuonPatternCalibration::m_removeDoubleMdtHits {this, "RemoveDoubleMdtHits", true} |
|
private |
The documentation for this class was generated from the following files:
Gaudi::Property< bool > m_removeDoubleMdtHits
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
virtual Amg::Transform3D AmdbLRSToGlobalTransform() const
PublicToolHandle< MuonEDMPrinterTool > m_printer
MuonPrepDataCollection< RpcPrepData > RpcPrepDataCollection
MuonPrepDataContainerT< TgcPrepData > TgcPrepDataContainer
int getRegionId(const Identifier &id) const override
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
#define ATH_MSG_VERBOSE(x)
const Amg::Vector3D & center() const
Returns the center position of the Surface.
void calibrateRegionMap(const RegionMap ®ionMap, IMuonPatternCalibration::ROTsPerRegion &hitsPerRegion) const
Gaudi::Property< bool > m_recoverTriggerHits
value_type get_compact() const
Get the compact id.
@ u
Enums for curvilinear frames.
ToolHandle< IMuonClusterOnTrackCreator > m_clusterCreator
std::map< int, Region > RegionMap
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
ChIndex chIndex(const std::string &index)
convert ChIndex name string to enum
double getActiveTubeLength(const int tubeLayer, const int tube) const
Eigen::Affine3d Transform3D
virtual const Amg::Vector3D & normal() const
Returns the normal vector of the Surface (i.e.
void insertCluster(const MuonCluster &mdt, RegionMap ®ionMap, const Amg::Vector3D &patpose, const Amg::Vector3D &patdire, bool hasPhiMeasurements) const
const Amg::Vector3D globalPosition() const
Gaudi::Property< double > m_dropDistance
bool checkForPhiMeasurements(const MuonPatternCombination &pat) const override
Identifier identify() const
return the identifier
StatusCode loadFromStoreGate(const EventContext &ctx, const SG::ReadHandleKey< ContType > &key, const ContType *&cont_ptr) const
load the container from storegate given a ReadHandleKey.
void insertMdt(const MdtPrepData &clus, RegionMap ®ionMap, const Amg::Vector3D &patpose, const Amg::Vector3D &patdire, bool hasPhiMeasurements) const
Definition of ATLAS Math & Geometry primitives (Amg)
constexpr int toInt(const ParamDefs p)
Eigen::Matrix< double, 3, 1 > Vector3D
Gaudi::Property< double > m_phiAngleCut
SG::ReadHandleKey< Muon::TgcPrepDataContainer > m_keyTgc
MuonPrepDataContainerT< RpcPrepData > RpcPrepDataContainer
ToolHandle< IMdtDriftCircleOnTrackCreator > m_mdtCreator
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.
StatusCode createRegionMap(const EventContext &ctx, const MuonPatternCombination &pat, RegionMap ®ionMap, bool hasPhiMeasurements) const
ChIndex
enum to classify the different chamber layers in the muon spectrometer
MuonPrepDataCollection< TgcPrepData > TgcPrepDataCollection
phiRange
Filling Phi ranges.
SG::ReadHandleKey< Muon::RpcPrepDataContainer > m_keyRpc
Gaudi::Property< bool > m_doMultiAnalysis
virtual const Amg::Vector3D & center() const =0
Return the center of the element.
bool isSmall(const ChIndex index)
Returns true if the chamber index is in a small sector.
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...