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 = transform.linear() * Amg::Vector3D::UnitZ();
41 if (common()->muonChamberProjectionHelper()
42 ->getDistancesToMDTChamberWallsAlongLine( parentMuonChamberPV(),
43 transform.translation(), tubedir,
44 distanceToFirstEndPlane, distanceToSecondEndPlane, radius )) {
45 if (fabs(distanceToFirstEndPlane-distanceToSecondEndPlane)>0.1*epsilon)
46 std::cout <<"PRDHandle_MDT: Warning tube is not centered in chamber! We should translate the prd object appropriately (todo)."<<std::endl;
47 halflength = std::max(distanceToFirstEndPlane,distanceToSecondEndPlane)+epsilon;
48 } else {
49 std::cout <<"PRDHandle_MDT: Couldn't retrieve data for projections to chamber end planes."<<std::endl;
50 halflength += 500.0;
51 }
52 } else {
53 assert(projection==PRDCollHandle_MDT::TOTUBES);
54 //To end of tubes.
55 halflength += 56.0 + epsilon;
56 }
57 }
58
59 shape_simple = common()->nodeManager()->getShapeNode_DriftTube( halflength, 0.0 );
60 //Detailed shape uses tube (unless negligible radius):
61 if (radius==0.0)
62 shape_detailed = shape_simple;
63 else
64 shape_detailed = common()->nodeManager()->getShapeNode_DriftTube( halflength, radius );
65
66 if ( m_driftcircle->rdoList().size() > 1)
67 VP1Msg::message("Warning: MDT has additional elements in rdoList: NOT IMPLEMENTED");
68}
69
70//____________________________________________________________________
72{
73 //Unique for each station.
74 const MuonGM::MuonStation* station = m_driftcircle->detectorElement()->parentMuonStation();
75 return station->getPhiIndex()-99999*station->getEtaIndex();//hopefully unique.
76}
77
78//____________________________________________________________________
79QStringList PRDHandle_MDT::clicked() const
80{
81
82 if (!m_driftcircle)
83 return QStringList("Null PRD");
84 const MdtIdHelper * idhelper = VP1DetInfo::mdtIDHelper();
85 if (!idhelper)
86 return QStringList("Null PRD");
87
88 std::ostringstream os;
89 Identifier id = m_driftcircle->identify();
90
91 os << "MdtPrepData with Identifier ["<<id.get_compact() ;
92 os << "] = [" << (idhelper->print_to_string(id)) ;
93 os << "]\n at global position = [" << m_driftcircle->globalPosition()<<"], local position = ["<<m_driftcircle->localPosition()<<"].";
94 os <<"\nDrift radius = "<<m_driftcircle->localPosition()[0]<<" CLHEP::mm. ";
95 os <<"ADC: "<<m_driftcircle->adc();
96 os <<", TDC: "<<m_driftcircle->tdc();
97 std::string status("Status: ");
98 os<<status;
99
100 QStringList l(QString(os.str().c_str())+driftCircleStatus());
101
102 return l;
103}
104
105//____________________________________________________________________
107{
108 QString status;
109 switch (m_driftcircle->status()){
111 status+="Masked";
112 break;
114 status+="Drift Time";
115 break;
117 status+="Before Spectrum";
118 break;
120 status+="After Spectrum";
121 break;
122 default:
123 status+=QString((" Unknown with value = "+std::to_string(m_driftcircle->status())).c_str());
124 }
125 return status;
126}
127
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)
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.