ATLAS Offline Software
Loading...
Searching...
No Matches
VP1RawDataHandle_TGC_Digit.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
13#include <Inventor/nodes/SoTransform.h>
14
19
21{
22 const auto* helper = VP1DetInfo::tgcIDHelper();
23 const auto* manager = VP1DetInfo::muonDetMgr();
24 return manager && helper && helper->valid(m_data->identify())
25 ? manager->getTgcReadoutElement(m_data->identify()) : nullptr;
26}
27
29{
30 const Identifier id = m_data->identify();
31 const auto* helper = VP1DetInfo::tgcIDHelper();
32 const bool valid = helper && helper->valid(id);
33 QStringList lines;
34 lines << " ===> TGC Digit data";
35 lines << " Identifier: " + QString::fromStdString(id.getString());
36 lines << " Channel type: " + (valid ? QString(helper->isStrip(id) ? "Strip" : "Wire gang")
37 : QString("unavailable"));
38 QString bc;
39 switch (m_data->bcTag()) {
40 case TgcDigit::BC_UNDEFINED: bc = "undefined"; break;
41 case TgcDigit::BC_PREVIOUS: bc = "previous"; break;
42 case TgcDigit::BC_CURRENT: bc = "current"; break;
43 case TgcDigit::BC_NEXT: bc = "next"; break;
44 case TgcDigit::BC_NEXTNEXT: bc = "next-next"; break;
45 default: bc = "unknown"; break;
46 }
47 lines << QString(" BC tag: %1 (%2)").arg(m_data->bcTag()).arg(bc);
48 if (verbose) {
49 if (valid) {
50 lines << " Station name: " + QString::fromStdString(helper->stationNameString(id));
51 lines << " Station eta index: " + QString::number(helper->stationEta(id));
52 lines << " Station phi index: " + QString::number(helper->stationPhi(id));
53 lines << " Gas gap: " + QString::number(helper->gasGap(id));
54 lines << " Channel: " + QString::number(helper->channel(id));
55 } else {
56 lines << " Decoded identifier unavailable";
57 }
58 const auto* elem = element();
59 if (elem) {
60 const Amg::Vector3D position = elem->channelPos(id);
61 lines << QString(" Global position [mm] (x, y, z): (%1, %2, %3)")
62 .arg(position.x(), 0, 'g', 10).arg(position.y(), 0, 'g', 10)
63 .arg(position.z(), 0, 'g', 10);
64 } else {
65 lines << " Global position unavailable";
66 }
67 }
68 return lines;
69}
70
72{
73 const auto* elem = element();
74 if (!elem)
76 const auto* helper = VP1DetInfo::tgcIDHelper();
77 const Identifier id = m_data->identify();
78 const int gap = helper->gasGap(id);
79 const int channel = helper->channel(id);
80 const bool strip = helper->isStrip(id);
81 const double length = strip ? elem->stripLength() : elem->gangCentralWidth(gap, channel);
82 const double width = strip ? elem->stripWidth(gap, channel) : elem->gangRadialLength(gap, channel);
83 // The box represents the channel footprint; depth is a display thickness in mm.
85}
86
88{
89 const auto* elem = element();
90 if (!elem)
91 return new SoTransform;
92 const Identifier id = m_data->identify();
93 Amg::Transform3D transform = elem->localToGlobalTransf(id);
94 // VP1 strip shapes follow local Y. Use the actual strip direction, including
95 // its stereo angle; wire gangs follow the wire-plane X axis.
96 const bool strip = VP1DetInfo::tgcIDHelper()->isStrip(id);
97 const Amg::Vector3D along = strip ? elem->stripDir(id).normalized()
98 : Amg::Vector3D(transform.linear().col(0));
99 const Amg::Vector3D normal = transform.linear().col(2);
100 transform.linear().col(0) = along.cross(normal).normalized();
101 transform.linear().col(1) = along;
102 transform.linear().col(2) = normal;
103 transform.translation() = elem->channelPos(id);
104 return VP1LinAlgUtils::toSoTransform(transform);
105}
106
108{
109 const auto* helper = VP1DetInfo::tgcIDHelper();
110 return helper && helper->valid(m_data->identify()) && helper->isStrip(m_data->identify());
111}
112
114{
115 return m_data->bcTag();
116}
double length(const pvec &v)
const double width
SoNode * getShapeNode_Strip(double length, double width=0, double depth=0)
A TgcReadoutElement corresponds to a single TGC chamber; therefore typically a TGC station contains s...
@ BC_UNDEFINED
Definition TgcDigit.h:37
@ BC_NEXT
Definition TgcDigit.h:37
@ BC_CURRENT
Definition TgcDigit.h:37
@ BC_PREVIOUS
Definition TgcDigit.h:37
@ BC_NEXTNEXT
Definition TgcDigit.h:37
int isStrip(const Identifier &id) const
isStrip corresponds to measuresPhi
static const TgcIdHelper * tgcIDHelper()
static const MuonGM::MuonDetectorManager * muonDetMgr()
static SoTransform * toSoTransform(const HepGeom::Transform3D &, SoTransform *t=0)
HitsSoNodeManager * nodeManager() const
VP1RawDataCommonData * common() const
VP1RawDataHandleBase(VP1RawDataCollBase *)
VP1RawDataHandle_TGC_Digit(VP1RawDataCollBase *, const TgcDigit *)
SoTransform * buildTransform() override
const MuonGM::TgcReadoutElement * element() const
QStringList clicked(bool verbose) const override
bool verbose
Definition hcg.cxx:75
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 3, 1 > Vector3D