ATLAS Offline Software
Loading...
Searching...
No Matches
PRDHandle_MDT.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
8#include "VP1Base/VP1Msg.h"
10
13#include "TrkSurfaces/Surface.h"
14
16
17
18//____________________________________________________________________
20 : PRDHandleBase(static_cast<PRDCollHandleBase*>(collhandle)), m_driftcircle(dc)
21{
22}
23
24//____________________________________________________________________
25void PRDHandle_MDT::buildShapes(SoNode*&shape_simple, SoNode*&shape_detailed)
26{
27 const Trk::CylinderBounds* ccbo = dynamic_cast<const Trk::CylinderBounds*>(&(m_driftcircle->detectorElement()->surface(m_driftcircle->identify()).bounds()));
28 if (not ccbo) return;
29
30 double radius = m_driftcircle->localPosition()[0];
31 if (radius<0.15)
32 radius = 0.0;//radius is so small it is better to collapse to line
33 double halflength(ccbo->halflengthZ());
34 PRDCollHandle_MDT::PROJECTION projection(static_cast<PRDCollHandle_MDT*>(collHandle())->projection());
35 if (projection!=PRDCollHandle_MDT::NONE) {
36 const double epsilon = 0.15;
37 if (projection==PRDCollHandle_MDT::TOCHAMBERS) {
38 double distanceToFirstEndPlane, distanceToSecondEndPlane;
40 Amg::Vector3D tubedir(0.0,0.0,1.0);
42 if (common()->muonChamberProjectionHelper()
43 ->getDistancesToMDTChamberWallsAlongLine( parentMuonChamberPV(),
44 transform * Amg::Vector3D(0.0,0.0,0.0), tubedir,
45 distanceToFirstEndPlane, distanceToSecondEndPlane, radius )) {
46 if (fabs(distanceToFirstEndPlane-distanceToSecondEndPlane)>0.1*epsilon)
47 std::cout <<"PRDHandle_MDT: Warning tube is not centered in chamber! We should translate the prd object appropriately (todo)."<<std::endl;
48 halflength = std::max(distanceToFirstEndPlane,distanceToSecondEndPlane)+epsilon;
49 } else {
50 std::cout <<"PRDHandle_MDT: Couldn't retrieve data for projections to chamber end planes."<<std::endl;
51 halflength += 500.0;
52 }
53 } else {
54 assert(projection==PRDCollHandle_MDT::TOTUBES);
55 //To end of tubes.
56 halflength += 56.0 + epsilon;
57 }
58 }
59
60 shape_simple = common()->nodeManager()->getShapeNode_DriftTube( halflength, 0.0 );
61 //Detailed shape uses tube (unless negligible radius):
62 if (radius==0.0)
63 shape_detailed = shape_simple;
64 else
65 shape_detailed = common()->nodeManager()->getShapeNode_DriftTube( halflength, radius );
66
67 if ( m_driftcircle->rdoList().size() > 1)
68 VP1Msg::message("Warning: MDT has additional elements in rdoList: NOT IMPLEMENTED");
69}
70
71//____________________________________________________________________
73{
74 //Unique for each station.
75 const MuonGM::MuonStation* station = m_driftcircle->detectorElement()->parentMuonStation();
76 return station->getPhiIndex()-99999*station->getEtaIndex();//hopefully unique.
77}
78
79//____________________________________________________________________
80QStringList PRDHandle_MDT::clicked() const
81{
82
83 if (!m_driftcircle)
84 return QStringList("Null PRD");
85 const MdtIdHelper * idhelper = VP1DetInfo::mdtIDHelper();
86 if (!idhelper)
87 return QStringList("Null PRD");
88
89 std::ostringstream os;
90 Identifier id = m_driftcircle->identify();
91
92 os << "MdtPrepData with Identifier ["<<id.get_compact() ;
93 os << "] = [" << (idhelper->print_to_string(id)) ;
94 os << "]\n at global position = [" << m_driftcircle->globalPosition()<<"], local position = ["<<m_driftcircle->localPosition()<<"].";
95 os <<"\nDrift radius = "<<m_driftcircle->localPosition()[0]<<" CLHEP::mm. ";
96 os <<"ADC: "<<m_driftcircle->adc();
97 os <<", TDC: "<<m_driftcircle->tdc();
98 std::string status("Status: ");
99 os<<status;
100
101 QStringList l(QString(os.str().c_str())+driftCircleStatus());
102
103 return l;
104}
105
106//____________________________________________________________________
108{
109 QString status;
110 switch (m_driftcircle->status()){
112 status+="Masked";
113 break;
115 status+="Drift Time";
116 break;
118 status+="Before Spectrum";
119 break;
121 status+="After Spectrum";
122 break;
123 default:
124 status+=QString((" Unknown with value = "+std::to_string(m_driftcircle->status())).c_str());
125 }
126 return status;
127}
128
std::string print_to_string(Identifier id, const IdContext *context=0) const
or provide the printout in string form
SoNode * getShapeNode_DriftTube(double halfLength, double radius)
static Amg::Vector3D & applyTransformToVector(const Amg::Transform3D &m, Amg::Vector3D &v)
int getEtaIndex() const
a la AMDB
int getPhiIndex() const
a la AMDB
Class to represent measurements from the Monitored Drift Tubes.
Definition MdtPrepData.h:33
Amg::Transform3D getTransform_CLHEP() const
PRDHandleBase(PRDCollHandleBase *)
PRDSysCommonData * common() const
PRDCollHandleBase * collHandle() const
const Muon::MdtPrepData * m_driftcircle
void buildShapes(SoNode *&shape_simple, SoNode *&shape_detailed)
GeoPVConstLink parentMuonChamberPV() const
PRDHandle_MDT(PRDCollHandle_MDT *, const Muon::MdtPrepData *)
QString driftCircleStatus() const
QStringList clicked() const
HitsSoNodeManager * nodeManager() const
Bounds for a cylindrical Surface.
double halflengthZ() const
This method returns the halflengthZ.
static const MdtIdHelper * mdtIDHelper()
static void message(const QString &, IVP1System *sys=0)
Definition VP1Msg.cxx:30
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 3, 1 > Vector3D
@ MdtStatusAfterSpectrum
The tube produced a hit that is inconsistent with the drift time spectrum, the drift time is larger t...
@ MdtStatusBeforeSpectrum
The tube produced a hit that is inconsistent with the drift time spectrum, the drift time is smaller ...
@ MdtStatusMasked
A hit during a previous bunch crossing occured which rendered the tube dead for this bunch crossing.
@ MdtStatusDriftTime
The tube produced a vaild measurement.