ATLAS Offline Software
Loading...
Searching...
No Matches
PRDHandle_TRT.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
9#include "VP1Base/VP1Msg.h"
12
13#include <Inventor/C/errors/debugerror.h>
14#include <Inventor/nodes/SoSeparator.h>
15#include <Inventor/nodes/SoTransform.h>
16#include <Inventor/nodes/SoTranslation.h>
17
20#include "TrkSurfaces/Surface.h"
21
23//____________________________________________________________________
28
29//____________________________________________________________________
30void PRDHandle_TRT::buildShapes(SoNode*&shape_simple, SoNode*&shape_detailed)
31{
32 const Trk::CylinderBounds* ccbo = dynamic_cast<const Trk::CylinderBounds*>(&(m_driftcircle->detectorElement()->surface(m_driftcircle->identify()).bounds()));
33 if (not ccbo) return;
34 const double radius = m_driftcircle->localPosition()[0];
35 const double halflength = ccbo->halflengthZ();
36 const double mintuberadius = 0.1;
37
38 if ( m_driftcircle->rdoList().size() > 1)
39 VP1Msg::message("Warning: TRT has additional elements in rdoList: NOT IMPLEMENTED");
40
41 const PRDCollHandle_TRT* trtcollhandle(static_cast<PRDCollHandle_TRT*>(collHandle()));
42
43 if (trtcollhandle->project()) {
44
46 // Projections: //
48
49 const InDetProjFlags::InDetProjPartsFlags projparts(trtcollhandle->appropriateProjections());
50 bool inner,outer;
51 if (isBarrel()) {
52 inner = (projparts&InDetProjFlags::BarrelCentral);
54 } else {
55 const bool posz(isPositiveZ());
58 //Special TRT EndCap Z->R projections.
59
60 //Find center of tube:
62 Amg::Vector3D center(prdtransform*Amg::Vector3D(0,0,0));
63
64 // --> Get points for special projections
66 std::vector<Amg::Vector3D > points;
67
68 if (posz) {
76 points.push_back(p);
77 }
78 if ( projparts & InDetProjFlags::TRT_EndCapZToRCentral ) {
80 //Fixme: Use same parameters here as in InDetProjHelper!!
86 points.push_back(p);
87 }
88 } else {
96 points.push_back(p);
97 }
98 if ( projparts & InDetProjFlags::TRT_EndCapZToRCentral ) {
105 points.push_back(p);
106 }
107 }
108 // --> Build scene objects for special projections
109
110 const unsigned npoints = points.size();
111 if (npoints<1||npoints>2) {
112 collHandle()->message("PRDHandle_TRT::buildShapes ERROR: Unexpected number of points in special endcap projections!!");
113 } else {
114 SoSeparator * sepsimple = new SoSeparator;
115 SoTransform * transf1(VP1LinAlgUtils::toSoTransform((prdtransform.inverse())
116 * Amg::Translation3D(points.at(0).x(),points.at(0).y(),points.at(0).z())));
117 SoNode* point = common()->nodeManager()->getShapeNode_Point();
118 sepsimple->addChild(transf1);
119 sepsimple->addChild(point);
120 SoTranslation * transf2(0);
121 if (npoints==2) {
122 transf2 = new SoTranslation;
123 transf2->translation.setValue(points[1].x()-points[0].x(),points[1].y()-points[0].y(),points[1].z()-points[0].z());
124 sepsimple->addChild(transf2);
125 sepsimple->addChild(point);
126 }
127 shape_simple = sepsimple;
128
129 if (radius<mintuberadius) {
130 shape_detailed = shape_simple;
131 return;
132 }
133 SoSeparator * sepdetailed = new SoSeparator;
134 SoNode* disc = common()->nodeManager()->getShapeNode_DriftDisc(radius);
135 sepdetailed->addChild(transf1);
136 sepdetailed->addChild(disc);
137 if (npoints==2) {
138 sepdetailed->addChild(transf2);
139 sepdetailed->addChild(disc);
140 }
141 shape_detailed = sepdetailed;
142 return;
143 }
144 inner = false;outer = false;
145 //end special projections
146 } else {
149 }
150 }//end endcap
151 if (!inner&&!outer) {
152 collHandle()->message("PRDHandle_TRT::buildShapes ERROR: Inconsistent projection settings! Won't project!");
153 } else {
154 //Perform projections
155 shape_simple = common()->nodeManager()->getShapeNode_ProjectedDriftTube( halflength, 0.0, inner, outer );
156 if (radius<mintuberadius)
157 shape_detailed = shape_simple;
158 else
159 shape_detailed = common()->nodeManager()->getShapeNode_ProjectedDriftTube( halflength, radius, inner, outer );
160 return;
161 }
162 }//endif projections
163
165 // No projections: //
167
168 shape_simple = common()->nodeManager()->getShapeNode_DriftTube( halflength, 0.0 );
169 if (radius<mintuberadius)
170 shape_detailed = shape_simple;
171 else
172 shape_detailed = common()->nodeManager()->getShapeNode_DriftTube( halflength, radius );
173
174}
175
176//____________________________________________________________________
178{
179 const TRT_ID * id_helper = VP1DetInfo::trtIDHelper();
180 if (!id_helper)
181 return 0;
182 Identifier id = m_driftcircle->identify();
183 return id_helper->barrel_ec(id)*10000+id_helper->layer_or_wheel(id)*100+(id_helper->phi_module(id)%4);
184}
185// MuonGM::MuonDetectorManager::getMdtReadoutElement ()
186
187//____________________________________________________________________
188QStringList PRDHandle_TRT::clicked() const
189{
190 QStringList l;
192 const unsigned int data = m_driftcircle->getWord();
193
194 QString s;
195 int i;
196 for (i = 26; i >=0; i--)
197 {
198 if (i!=26&&(i+1)%9==0)
199 s+=" ";
200 s += ( data & (0x1<<i) ? "1" : "0");
201 if ((i+1)%9==0)
202 s+=" ";
203 }
204 l << "Raw data bits: "+s;
205
206
207 std::ostringstream os;
208 os << std::hex<<data;
209 l << QString(os.str().c_str());
210
211
212// l << "Drift radius: "+QString::number(m_driftcircle->localPosition()[0]/CLHEP::mm)+" CLHEP::mm";
213// const Trk::CylinderBounds* ccbo = dynamic_cast<const Trk::CylinderBounds*>(&(m_driftcircle->detectorElement()->surface(m_driftcircle->identify()).bounds()));
214// if (ccbo)
215// l << "Straw length: "+QString::number(ccbo->halflengthZ()*2/CLHEP::cm)+" CLHEP::cm";
216
217 return l;
218}
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
This is an Identifier helper class for the TRT subdetector.
#define y
#define x
#define z
SoNode * getShapeNode_DriftDisc(double radius)
SoNode * getShapeNode_ProjectedDriftTube(double halfLength, double radius, bool inner, bool outer)
SoNode * getShapeNode_DriftTube(double halfLength, double radius)
static void transformECPointToZPlane_specialZtoR(Amg::Vector3D &p, const double &planeZ, const double &planeRBegin, const double &endcapZBegin, const double &squeezeFactor)
static double trt_barrel_posneg_z()
static double trt_endcap_zasr_squeezefact()
static double surfacethickness()
static double trt_endcap_zasr_endcapz_begin()
static double trt_data_disttosurface_epsilon()
static double trt_endcap_zasr_innerradius()
InDetProjFlags::InDetProjPartsFlags appropriateProjections() const
Amg::Transform3D getTransform_CLHEP() const
virtual QStringList clicked() const
PRDHandleBase(PRDCollHandleBase *)
PRDSysCommonData * common() const
PRDCollHandleBase * collHandle() const
virtual Amg::Vector3D center() const
bool isPositiveZ() const
bool isBarrel() const
const InDet::TRT_DriftCircle * m_driftcircle
void buildShapes(SoNode *&shape_simple, SoNode *&shape_detailed)
virtual QStringList clicked() const
PRDHandle_TRT(PRDCollHandle_TRT *, const InDet::TRT_DriftCircle *)
HitsSoNodeManager * nodeManager() const
This is an Identifier helper class for the TRT subdetector.
Definition TRT_ID.h:82
int phi_module(const Identifier &id) const
Definition TRT_ID.h:806
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
Definition TRT_ID.h:797
int layer_or_wheel(const Identifier &id) const
Definition TRT_ID.h:815
Bounds for a cylindrical Surface.
double halflengthZ() const
This method returns the halflengthZ.
static const TRT_ID * trtIDHelper()
void message(const QString &) const
static SoTransform * toSoTransform(const HepGeom::Transform3D &, SoTransform *t=0)
static void message(const QString &, IVP1System *sys=0)
Definition VP1Msg.cxx:30
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 3, 1 > Vector3D
Eigen::Translation< double, 3 > Translation3D