ATLAS Offline Software
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"
9 #include "VP1Utils/VP1DetInfo.h"
10 
13 #include "TrkSurfaces/Surface.h"
14 
16 
17 
18 //____________________________________________________________________
20  : PRDHandleBase(static_cast<PRDCollHandleBase*>(collhandle)), m_driftcircle(dc)
21 {
22 }
23 
24 //____________________________________________________________________
25 void PRDHandle_MDT::buildShapes(SoNode*&shape_simple, SoNode*&shape_detailed)
26 {
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.
76  return station->getPhiIndex()-99999*station->getEtaIndex();//hopefully unique.
77 }
78 
79 //____________________________________________________________________
80 QStringList 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;
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 
HitsSoNodeManager.h
PRDHandle_MDT::driftCircleStatus
QString driftCircleStatus() const
Definition: PRDHandle_MDT.cxx:107
PRDHandle_MDT::m_driftcircle
const Muon::MdtPrepData * m_driftcircle
Definition: PRDHandle_MDT.h:40
PRDHandleBase::getTransform_CLHEP
Amg::Transform3D getTransform_CLHEP() const
Definition: PRDHandleBase.cxx:322
PRDHandle_MDT::PRDHandle_MDT
PRDHandle_MDT(PRDCollHandle_MDT *, const Muon::MdtPrepData *)
Definition: PRDHandle_MDT.cxx:19
max
#define max(a, b)
Definition: cfImp.cxx:41
Surface.h
VP1Msg.h
PRDHandleBase::collHandle
PRDCollHandleBase * collHandle() const
Definition: PRDHandleBase.cxx:228
PRDHandle_MDT::parentMuonChamberPV
GeoPVConstLink parentMuonChamberPV() const
Definition: PRDHandle_MDT.h:33
PRDHandle_MDT::clicked
QStringList clicked() const
Definition: PRDHandle_MDT.cxx:80
Muon::MdtStatusAfterSpectrum
@ MdtStatusAfterSpectrum
The tube produced a hit that is inconsistent with the drift time spectrum, the drift time is larger t...
Definition: MdtDriftCircleStatus.h:40
Trk::PrepRawData::rdoList
const std::vector< Identifier > & rdoList() const
return the List of rdo identifiers (pointers)
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
Muon::MdtPrepData::adc
int adc() const
Returns the ADC (typically range is 0 to 250)
Definition: MdtPrepData.h:146
PRDHandleBase::common
PRDSysCommonData * common() const
Definition: PRDHandleBase.h:53
Muon::MdtStatusDriftTime
@ MdtStatusDriftTime
The tube produced a vaild measurement.
Definition: MdtDriftCircleStatus.h:34
PRDCollHandle_MDT::TOTUBES
@ TOTUBES
Definition: PRDCollHandle_MDT.h:24
Muon::MdtStatusMasked
@ MdtStatusMasked
A hit during a previous bunch crossing occured which rendered the tube dead for this bunch crossing.
Definition: MdtDriftCircleStatus.h:31
PRDSysCommonData::nodeManager
HitsSoNodeManager * nodeManager() const
Definition: PRDSysCommonData.h:79
VP1DetInfo.h
GeoPrimitives.h
PRDCollHandleBase
Definition: PRDCollHandleBase.h:25
MuonGM::MuonStation::getPhiIndex
int getPhiIndex() const
a la AMDB
Definition: MuonStation.h:162
Muon::MdtStatusBeforeSpectrum
@ MdtStatusBeforeSpectrum
The tube produced a hit that is inconsistent with the drift time spectrum, the drift time is smaller ...
Definition: MdtDriftCircleStatus.h:37
Trk::CylinderBounds
Definition: CylinderBounds.h:46
MuonGM::MuonReadoutElement::parentMuonStation
const MuonStation * parentMuonStation() const
Definition: MuonDetDescr/MuonReadoutGeometry/src/MuonReadoutElement.cxx:135
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
MuonGM::MuonStation
Definition: MuonStation.h:51
Amg::transform
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Definition: GeoPrimitivesHelpers.h:156
PRDHandle_MDT::regionIndex
int regionIndex()
Definition: PRDHandle_MDT.cxx:72
MdtIdHelper
Definition: MdtIdHelper.h:61
Muon::MdtPrepData::globalPosition
virtual const Amg::Vector3D & globalPosition() const
Returns the global position of the CENTER of the drift tube (i.e.
Definition: MdtPrepData.h:133
PRDCollHandle_MDT
Definition: PRDCollHandle_MDT.h:11
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
Trk::PrepRawData::identify
Identifier identify() const
return the identifier
AtlasDetectorID::print_to_string
std::string print_to_string(Identifier id, const IdContext *context=0) const
or provide the printout in string form
Definition: AtlasDetectorID.cxx:655
Muon::MdtPrepData::tdc
int tdc() const
Returns the TDC (typically range is 0 to 2500).
Definition: MdtPrepData.h:145
Trk::Surface::bounds
virtual const SurfaceBounds & bounds() const =0
Surface Bounds method.
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
Trk::PrepRawData::localPosition
const Amg::Vector2D & localPosition() const
return the local position reference
Muon::MdtPrepData
Class to represent measurements from the Monitored Drift Tubes.
Definition: MdtPrepData.h:33
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
MuonChamberProjectionHelper.h
ParticleGun_SamplingFraction.radius
radius
Definition: ParticleGun_SamplingFraction.py:96
PRDHandle_MDT.h
VP1DetInfo::mdtIDHelper
static const MdtIdHelper * mdtIDHelper()
Definition: VP1DetInfo.cxx:163
CylinderBounds.h
VP1Msg::message
static void message(const QString &, IVP1System *sys=0)
Definition: VP1Msg.cxx:30
PRDHandle_MDT::buildShapes
void buildShapes(SoNode *&shape_simple, SoNode *&shape_detailed)
Definition: PRDHandle_MDT.cxx:25
PRDCollHandle_MDT::PROJECTION
PROJECTION
Definition: PRDCollHandle_MDT.h:24
MuonGM::MuonStation::getEtaIndex
int getEtaIndex() const
a la AMDB
Definition: MuonStation.h:163
MuonGM::MdtReadoutElement::surface
virtual const Trk::Surface & surface() const override final
Return surface associated with this detector element.
Definition: MuonDetDescr/MuonReadoutGeometry/src/MdtReadoutElement.cxx:891
PRDHandleBase
Definition: PRDHandleBase.h:35
merge.status
status
Definition: merge.py:17
PRDCollHandle_MDT::TOCHAMBERS
@ TOCHAMBERS
Definition: PRDCollHandle_MDT.h:24
HitsSoNodeManager::getShapeNode_DriftTube
SoNode * getShapeNode_DriftTube(double halfLength, double radius)
Definition: HitsSoNodeManager.cxx:138
Muon::MdtPrepData::status
MdtDriftCircleStatus status() const
Returns the status of the measurement.
Definition: MdtPrepData.h:147
MuonStation.h
PRDCollHandle_MDT::NONE
@ NONE
Definition: PRDCollHandle_MDT.h:24
Muon::MdtPrepData::detectorElement
virtual const MuonGM::MdtReadoutElement * detectorElement() const override
Returns the detector element corresponding to this PRD.
Definition: MdtPrepData.h:141
MuonChamberProjectionHelper::applyTransformToVector
static Amg::Vector3D & applyTransformToVector(const Amg::Transform3D &m, Amg::Vector3D &v)
Definition: MuonChamberProjectionHelper.cxx:143
Identifier
Definition: IdentifierFieldParser.cxx:14