ATLAS Offline Software
PRDHandle_MM.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 /*
6  * update:
7  *
8  * - added MM and sTGC strip lenght from readout geometry
9  * 06.05.2013 - Riccardo BIANCHI <rbianchi@cern.ch>
10  *
11  */
12 
13 
17 #include "VP1Base/VP1Msg.h"
18 #include "VP1Utils/VP1DetInfo.h"
19 
20 #include <Inventor/nodes/SoSeparator.h>
21 
23 #include "TrkSurfaces/Surface.h"
28 
30 
31 
32 //____________________________________________________________________
34  : PRDHandleBase(static_cast<PRDCollHandleBase*>(collhandle)), m_prd(dc)
35 {
36 }
37 
38 //____________________________________________________________________
39 void PRDHandle_MM::buildShapes(SoNode*&shape_simple, SoNode*&shape_detailed)
40 {
41  // std::cout<<"m_prd->detectorElement()->surface(m_prd->identify())"<<m_prd->detectorElement()->surface(m_prd->identify())<<std::endl;
42  //const Trk::CylinderBounds* ccbo = dynamic_cast<const Trk::CylinderBounds*>(&(m_prd->detectorElement()->surface(m_prd->identify()).bounds()));
43  //assert(ccbo!=0);
44 
45  // const Trk::LocalPosition& localpos = m_prd->localPosition();
46 
47 
48  const MmIdHelper * idhelper = VP1DetInfo::mmIDHelper();
49 
50  if (!idhelper) {
51  VP1Msg::messageDebug("idhelper is null. Returning without building the shape...");
52  return;
53  }
54 
55  const Muon::MMPrepData * prd = mm();
56 
57  if (!prd) {
58  VP1Msg::messageDebug("prd is null. Returning without building the shape...");
59  return;
60  }
61 
62  Identifier id = prd->identify();
63 
64  const MuonGM::MMReadoutElement* detEl = prd->detectorElement();
65 
66  VP1Msg::messageDebug("Building MM strip...");
67  const MuonGM::MuonChannelDesign* design = detEl->getDesign( id );
68 
69  // using point shape for simple view
70  shape_simple = common()->nodeManager()->getShapeNode_Strip(0.);
71 
72  // local position of the strip
73  Amg::Vector2D locPos;
74  if (!detEl->stripPosition(id,locPos) ) return;
75  if (!design) return;
76 
77  double striplength=design->channelLength(idhelper->channel(id));
78  double stripWidth=design->inputWidth;
79 
80  // use rectangular shape for detailed view
81  SoSeparator * errDetailed = new SoSeparator;
82  errDetailed->addChild(common()->nodeManager()->getShapeNode_Strip(striplength,std::min(10.0,stripWidth),0.01));
83 
84  shape_detailed = errDetailed;
85 
86 }
87 
88 
89 //____________________________________________________________________
91 {
92  //Unique for each station.
94  if (!station) {VP1Msg::message("Warning - MM station gives null parent. Something is wrong with the geometry!"); return 0;}
95  return station->getPhiIndex()-99999*station->getEtaIndex();//hopefully unique.
96 }
97 
98 //____________________________________________________________________
99 QStringList PRDHandle_MM::clicked() const
100 {
101 
102  if (!m_prd)
103  return QStringList("Null PRD");
104  const MdtIdHelper * idhelper = VP1DetInfo::mdtIDHelper();
105  if (!idhelper)
106  return QStringList("Null PRD");
107 
108  std::ostringstream os;
109  Identifier id = m_prd->identify();
110 
111  os << "MMPrepData with Identifier ["<<id.get_compact() ;
112  os << "] = [" << (idhelper->print_to_string(id)) ;
113  os << "]\n at global position = [" << m_prd->globalPosition()<<"], local position = ["<<m_prd->localPosition()<<"].";
114  // os <<"ADC: "<<m_prd->adc();
115  // os <<", TDC: "<<m_prd->tdc();
116  // std::string status("Status: ");
117  // os<<status;
118 
119  //QStringList l(QString(os.str().c_str())+driftCircleStatus());
120  QStringList l(QString(os.str().c_str()));
121 
122  return l;
123 }
PRDCollHandle_MM
Definition: PRDCollHandle_MM.h:11
HitsSoNodeManager.h
MuonGM::MMReadoutElement::stripPosition
virtual bool stripPosition(const Identifier &id, Amg::Vector2D &pos) const override final
strip position – local or global If the strip number is outside the range of valid strips,...
Definition: MMReadoutElement.h:209
Muon::MMPrepData
Class to represent MM measurements.
Definition: MMPrepData.h:22
VP1DetInfo::mmIDHelper
static const MmIdHelper * mmIDHelper()
Definition: VP1DetInfo.cxx:162
Muon::MMPrepData::globalPosition
virtual const Amg::Vector3D & globalPosition() const override final
Returns the global position.
Definition: MMPrepData.h:211
Surface.h
PRDHandle_MM::m_prd
const Muon::MMPrepData * m_prd
Definition: PRDHandle_MM.h:39
sTgcReadoutElement.h
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition: GeoPrimitives.h:48
VP1Msg.h
MuonGM::MuonChannelDesign::inputWidth
double inputWidth
Definition: MuonChannelDesign.h:36
MuonGM::MMReadoutElement::getDesign
const MuonChannelDesign * getDesign(const Identifier &id) const
returns the MuonChannelDesign class for the given identifier
Definition: MMReadoutElement.h:193
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
PRDHandle_MM::clicked
QStringList clicked() const
Definition: PRDHandle_MM.cxx:99
PRDHandleBase::common
PRDSysCommonData * common() const
Definition: PRDHandleBase.h:53
PRDSysCommonData::nodeManager
HitsSoNodeManager * nodeManager() const
Definition: PRDSysCommonData.h:79
VP1DetInfo.h
GeoPrimitives.h
PRDCollHandleBase
Definition: PRDCollHandleBase.h:25
MMReadoutElement.h
PRDHandle_MM::mm
const Muon::MMPrepData * mm() const
Definition: PRDHandle_MM.h:24
MuonGM::MuonStation::getPhiIndex
int getPhiIndex() const
a la AMDB
Definition: MuonStation.h:162
Muon::MMPrepData::detectorElement
virtual const MuonGM::MMReadoutElement * detectorElement() const override final
Returns the detector element corresponding to this PRD.
Definition: MMPrepData.h:206
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
PRDHandle_MM::buildShapes
void buildShapes(SoNode *&shape_simple, SoNode *&shape_detailed)
Definition: PRDHandle_MM.cxx:39
MuonGM::MuonReadoutElement::parentMuonStation
const MuonStation * parentMuonStation() const
Definition: MuonDetDescr/MuonReadoutGeometry/src/MuonReadoutElement.cxx:135
MuonGM::MuonStation
Definition: MuonStation.h:51
PRDHandle_MM::regionIndex
int regionIndex()
Definition: PRDHandle_MM.cxx:90
HitsSoNodeManager::getShapeNode_Strip
SoNode * getShapeNode_Strip(double length, double width=0, double depth=0)
Definition: HitsSoNodeManager.cxx:269
MdtIdHelper
Definition: MdtIdHelper.h:61
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
min
#define min(a, b)
Definition: cfImp.cxx:40
Trk::PrepRawData::identify
Identifier identify() const
return the identifier
PRDHandle_MM.h
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
Trk::PrepRawData::localPosition
const Amg::Vector2D & localPosition() const
return the local position reference
MuonChamberProjectionHelper.h
MuonGM::MuonChannelDesign::channelLength
double channelLength(int channel) const
STRIPS ONLY: calculate channel length for a given strip number.
Definition: MuonChannelDesign.h:391
MuonChannelDesign.h
VP1DetInfo::mdtIDHelper
static const MdtIdHelper * mdtIDHelper()
Definition: VP1DetInfo.cxx:163
CylinderBounds.h
MuonGM::MuonChannelDesign
Definition: MuonChannelDesign.h:24
VP1Msg::messageDebug
static void messageDebug(const QString &)
Definition: VP1Msg.cxx:39
MmIdHelper::channel
int channel(const Identifier &id) const override
Definition: MmIdHelper.cxx:800
MmIdHelper
Definition: MmIdHelper.h:54
VP1Msg::message
static void message(const QString &, IVP1System *sys=0)
Definition: VP1Msg.cxx:30
MuonGM::MuonStation::getEtaIndex
int getEtaIndex() const
a la AMDB
Definition: MuonStation.h:163
MuonGM::MMReadoutElement
An MMReadoutElement corresponds to a single STGC module; therefore typicaly a barrel muon station con...
Definition: MMReadoutElement.h:23
PRDHandleBase
Definition: PRDHandleBase.h:35
MuonStation.h
PRDHandle_MM::PRDHandle_MM
PRDHandle_MM(PRDCollHandle_MM *, const Muon::MMPrepData *)
Definition: PRDHandle_MM.cxx:33