ATLAS Offline Software
Loading...
Searching...
No Matches
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//____________________________________________________________________
39void 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.
93 const MuonGM::MuonStation* station = m_prd->detectorElement()->parentMuonStation();
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//____________________________________________________________________
99QStringList 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}
std::string print_to_string(Identifier id, const IdContext *context=0) const
or provide the printout in string form
SoNode * getShapeNode_Strip(double length, double width=0, double depth=0)
int channel(const Identifier &id) const override
An MMReadoutElement corresponds to a single STGC module; therefore typicaly a barrel muon station con...
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,...
const MuonChannelDesign * getDesign(const Identifier &id) const
returns the MuonChannelDesign class for the given identifier
int getEtaIndex() const
a la AMDB
int getPhiIndex() const
a la AMDB
Class to represent MM measurements.
Definition MMPrepData.h:22
virtual const MuonGM::MMReadoutElement * detectorElement() const override final
Returns the detector element corresponding to this PRD.
Definition MMPrepData.h:206
PRDHandleBase(PRDCollHandleBase *)
PRDSysCommonData * common() const
void buildShapes(SoNode *&shape_simple, SoNode *&shape_detailed)
PRDHandle_MM(PRDCollHandle_MM *, const Muon::MMPrepData *)
QStringList clicked() const
const Muon::MMPrepData * mm() const
const Muon::MMPrepData * m_prd
HitsSoNodeManager * nodeManager() const
Identifier identify() const
return the identifier
static const MdtIdHelper * mdtIDHelper()
static const MmIdHelper * mmIDHelper()
static void messageDebug(const QString &)
Definition VP1Msg.cxx:39
static void message(const QString &, IVP1System *sys=0)
Definition VP1Msg.cxx:30
Eigen::Matrix< double, 2, 1 > Vector2D
double channelLength(int channel) const
STRIPS ONLY: calculate channel length for a given strip number.