ATLAS Offline Software
Loading...
Searching...
No Matches
MuonChamberProjectionHelper.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5
7// //
8// Implementation of class MuonChamberProjectionHelper //
9// //
10// Author: Thomas H. Kittelmann (Thomas.Kittelmann@cern.ch) //
11// Initial version: January 2008 //
12// //
14
18#include "VP1Base/IVP1System.h"
19
20#include "GeoModelKernel/GeoVolumeCursor.h"
21#include "GeoModelKernel/GeoLogVol.h"
22#include "GeoModelKernel/GeoTrd.h"
23#include "GeoModelKernel/GeoShapeShift.h"
24#include "GeoModelKernel/GeoShapeUnion.h"
25#include "GeoModelKernel/GeoShapeIntersection.h"
26#include "GeoModelKernel/GeoShapeSubtraction.h"
28
29#include <map>
30
31//____________________________________________________________________
33public:
43 bool ensureInited();//Returns false if can't init.
44 bool init();//Returns false if can't init.
45
46 //MDT chambers:
48 public:
49 MDTChamberInfo(const Amg::Transform3D& l2g, const GeoTrd* t)
50 : localToGlobal(l2g), trd(t) {}
52 std::unique_ptr<Amg::Transform3D> globalToLocal;//Only created on demand - saving ~100KB in a typical job.
53 const GeoTrd * trd;
54 void ensureInitGlobalToLocal() { if (!globalToLocal) globalToLocal = std::make_unique<Amg::Transform3D>(localToGlobal.inverse()); }
55 };
56 std::map<GeoPVConstLink,MDTChamberInfo>::iterator itLastMDTChamberLookedUp{};
57 std::map<GeoPVConstLink,MDTChamberInfo> mdtchambervolinfo;//Map typically has around 1124 entries.
58 typedef std::map<GeoPVConstLink,MDTChamberInfo>::iterator ChamberInfoMapItr;
59 inline bool nameIsMDTChamber( const std::string& n );
60 bool getMDTChamberVolInfo(const GeoPVConstLink& mdtChamber,ChamberInfoMapItr& itChamberInfo, bool silent = false );
61 void getMDTChamberXAndZ(ChamberInfoMapItr& itChamberInfo, double & trdX, double & trdZ );
62
63 //Todo: CSC and TGC chambers also.
64
65
66 //Utility:
67 inline double pointToPlaneDistAlongLine( const Amg::Vector3D& point, const Amg::Vector3D& lineDirection,
68 const Amg::Vector3D& planePoint, const Amg::Vector3D& planeNormal );
69 void projectXZPointToTrdAlongYAxis( const double& x, const double& z,const GeoTrd* trd,
70 Amg::Vector3D & firstEndWall_point, Amg::Vector3D & secondEndWall_point );
71
72 static bool constrainPointToRectangleAlongLine( const double& trdX, const double& trdZ, const double& x0, const double& z0,
73 double& x1, double& z1 );//Moves x1,z1 towards x0,z0 so (x1,z1) ends up on edge of
74 //rectangle defined by |x|<=trdX && |z|<=trdZ. Returns false if
75 //not possible (i.e. line segment doesn't cross rectangle edges).
76 bool clip2DLineSegmentToRectangle( const double& rectX, const double& rectY,
77 double& x0, double& y0, double& x1, double& y1 );
78 //Given P0 = (x0,y0) and P1 = (x1,y1), we have to constrain the line
79 //segment P0-P1 to the rectangle R given by x<|rectX|, y<|rectY|.
80 //
81 //Returns false if length of clipped line segment is not positive
82 //(in that case, don't trust the returned values of the parameters).
83
84 const GeoTrd * findTRDInShape(const GeoShape * shape)
85 {
86 if (shape->typeID()==GeoTrd::getClassTypeID())
87 return static_cast<const GeoTrd*>(shape);
88 if (shape->typeID() == GeoShapeShift::getClassTypeID() ) {
89 const GeoShapeShift* theShift = static_cast<const GeoShapeShift*>(shape);
90 return findTRDInShape(theShift->getOp());
91 }
92 if (shape->typeID() == GeoShapeSubtraction::getClassTypeID() ) {
93 const GeoShapeSubtraction* theSubtraction = static_cast<const GeoShapeSubtraction*>(shape);
94 const GeoTrd * trd = findTRDInShape(theSubtraction->getOpA());
95 return trd ? trd : findTRDInShape(theSubtraction->getOpB());
96 }
97 if (shape->typeID() == GeoShapeUnion::getClassTypeID() ) {
98 const GeoShapeUnion* theUnion = static_cast<const GeoShapeUnion*>(shape);
99 const GeoTrd * trd = findTRDInShape(theUnion->getOpA());
100 return trd ? trd : findTRDInShape(theUnion->getOpB());
101 }
102 if (shape->typeID() == GeoShapeIntersection::getClassTypeID() ) {
103 const GeoShapeIntersection* theIntersection = static_cast<const GeoShapeIntersection*>(shape);
104 const GeoTrd * trd = findTRDInShape(theIntersection->getOpA());
105 return trd ? trd : findTRDInShape(theIntersection->getOpB());
106 }
107 return 0;
108 }
109
110};
111
112
113
114//____________________________________________________________________
116: VP1HelperClassBase(0,"MuonChamberProjectionHelper"), m_d(new Imp(this,detectorStore))
117{
118 if (!detectorStore)
119 message("ERROR: Received NULL detectorstore");
120}
121
122//____________________________________________________________________
124 : VP1HelperClassBase(0,"MuonChamberProjectionHelper"), m_d(new Imp(this,(sys?sys->detectorStore():0)))
125{
126 if (!sys)
127 message("ERROR: Received NULL system pointer (and thus can't get detector store pointer");
128 else if (!m_d->detectorStore)
129 message("ERROR: Could not get detectorStore pointer from system pointer");
130}
131
132//____________________________________________________________________
134{
135 Imp::ChamberInfoMapItr itMDT, itMDTE(m_d->mdtchambervolinfo.end());
136 for ( itMDT = m_d->mdtchambervolinfo.begin(); itMDT!=itMDTE; ++itMDT )
137 itMDT->second.trd->unref();
138 delete m_d;
139}
140
141//____________________________________________________________________
143{
144 //It is a vector, so we apply the rotation part only:
145 double vx = v.x(), vy = v.y(), vz = v.z();
146// v.set(m.xx()*vx + m.xy()*vy + m.xz()*vz,
147// m.yx()*vx + m.yy()*vy + m.yz()*vz,
148// m.zx()*vx + m.zy()*vy + m.zz()*vz);
150 m(0,0)*vx + m(0,1)*vy + m(0,2)*vz,
151 m(1,0)*vx + m(1,1)*vy + m(1,2)*vz,
152 m(2,0)*vx + m(2,1)*vy + m(2,2)*vz);
153 return v;
154}
155
156//____________________________________________________________________
165
166//____________________________________________________________________
167inline bool MuonChamberProjectionHelper::Imp::nameIsMDTChamber( const std::string& n )
168{
169 //MDT chamber volumes starts with:
170 // Endcap: EI, EM, EO or EE
171 // Inner barrel: BI or BEE
172 // Middle barrel: BM
173 // Outer barrel:BO
174 if (n.size()<3)
175 return false;
176 if (n[0]=='E')
177 return n[1]=='I' || n[1]=='M' || n[1]=='O' || n[1]=='E';
178 if (n[0]=='B')
179 return n[1]=='I' || n[1]=='M' || n[1]=='O' || (n[1]=='E'&&n[2]=='E');
180 return false;
181}
182
183//____________________________________________________________________
185{
187 theclass->messageDebug("Warning: Can't init since muon geometry information is not present." );
188 return false;
189 }
190
191 VP1SGAccessHelper * sgaccess(0);
192 if (theclass->systemBase())
193 sgaccess = new VP1SGAccessHelper(theclass->systemBase());
194 else
195 sgaccess = new VP1SGAccessHelper(detectorStore);
196
197 //Locate the world volume if possible:
198 const GeoModelExperiment * theExpt;
199 if (!sgaccess->retrieve( theExpt, "ATLAS" )) {
200 theclass->message("MuonChamberProjectionHelper Error: Can't retrieve"
201 " the ATLAS GeoModelExperiment from detector store.");
202 delete sgaccess;
203 return false;
204 }
205 delete sgaccess;
206
207 PVConstLink world(theExpt->getPhysVol());
208 GeoVolumeCursor av(world);
209 const GeoLogVol * logvol(0);
210 const GeoShape * shape(0);
211 while (!av.atEnd()) {
212
213 if (av.getName()!="Muon") {
214 av.next();
215 continue;
216 }
217 Amg::Transform3D toptransform = av.getTransform();
218 GeoVolumeCursor av2(av.getVolume());
219 while (!av2.atEnd()) {
220 if (nameIsMDTChamber(av2.getName())) {
221 logvol = av2.getVolume()->getLogVol();
222 if (!logvol) {
223 theclass->message("MuonChamberProjectionHelper Error: Chamber has null logvol");
224 av2.next(); // increment volume cursor.
225 continue;
226 }
227 shape = logvol->getShape();
228 if (!shape) {
229 theclass->message("MuonChamberProjectionHelper Error: Chamber has null shape");
230 av2.next(); // increment volume cursor.
231 continue;
232 }
233 const GeoTrd * trd = findTRDInShape(shape);
234 if (trd) {
235 //Fixme: Test for nan's and clearly crazy numbers (if more than 1km for instance).
236 if ( trd->getZHalfLength()>0.0
237 && trd->getXHalfLength1() > 0.0
238 && trd->getXHalfLength2() > 0.0
239 && trd->getYHalfLength1() > 0.0
240 && trd->getYHalfLength2() > 0.0 ) {
241 trd->ref();
242 Amg::Transform3D geovolume_transf = av2.getTransform();
243 mdtchambervolinfo.insert(std::pair<const GeoPVConstLink,MDTChamberInfo>( av2.getVolume(), Imp::MDTChamberInfo(toptransform * geovolume_transf, trd) ));
244 } else {
245 theclass->message("MuonChamberProjectionHelper Error: Chamber trd has non-positive shape parameters!");
246 }
247 } else {
248 theclass->message("MuonChamberProjectionHelper Error: Chamber shape is not a GeoTrd, and is not a boolean with a Trd somewhere");
249 }
250 }
251 av2.next(); // increment volume cursor.
252 }
253 av.next(); // increment volume cursor.
254 }
255
256 if (mdtchambervolinfo.empty()) {
257 theclass->message("MuonChamberProjectionHelper Error: Found no MDT chambers");
258 return false;
259 }
260
262
263 return true;
264}
265
266//____________________________________________________________________
267bool MuonChamberProjectionHelper::isKnownMDTChamber( const GeoPVConstLink& mdtChamber )
268{
269 Imp::ChamberInfoMapItr itChamberInfo;
270 return m_d->getMDTChamberVolInfo( mdtChamber, itChamberInfo, true );
271}
272
273//____________________________________________________________________
275 const Amg::Vector3D & point, const Amg::Vector3D& lineDirection,
276 double& distanceToFirstEndPlane, double& distanceToSecondEndPlane,
277 const double& radius )
278{
279 Imp::ChamberInfoMapItr itChamberInfo;
280 if (!m_d->getMDTChamberVolInfo( mdtChamber, itChamberInfo ))
281 return false;
282
283 const GeoTrd * trd = itChamberInfo->second.trd;
284 double y1(trd->getYHalfLength1()), y2(trd->getYHalfLength2()), z(trd->getZHalfLength());
285
286 //Normals and points on ends (transformed from local to global coords):
287
288 Amg::Vector3D n1(0,+2*z,-(y2-y1));
289 Amg::Vector3D n2(0,-2*z,-(y2-y1));
290 applyTransformToVector(itChamberInfo->second.localToGlobal,n1);
291 applyTransformToVector(itChamberInfo->second.localToGlobal,n2);
292 const Amg::Vector3D p1(itChamberInfo->second.localToGlobal * Amg::Vector3D(0,y1,-z) );
293 const Amg::Vector3D p2(itChamberInfo->second.localToGlobal * Amg::Vector3D(0,-y1,-z) );
294
295 distanceToFirstEndPlane = m_d->pointToPlaneDistAlongLine(point,lineDirection,p1,n1);
296 if (distanceToFirstEndPlane < 0.0 )
297 return false;
298
299 distanceToSecondEndPlane = m_d->pointToPlaneDistAlongLine(point,lineDirection,p2,n2);
300 if (distanceToSecondEndPlane < 0.0 )
301 return false;
302
303 if (radius!=0.0) {
304 double r(fabs(radius)); //Map negative radii to positive.
305 Amg::Vector3D unitdir(lineDirection.unit());
306 double costheta1 = unitdir.dot(n1.unit());
307 double costheta2 = unitdir.dot(n2.unit());
308 //remember that tan(theta) = sqrt((1-cos^2(theta))/cos(theta))
309 distanceToFirstEndPlane += r*sqrt(fabs((1-costheta1*costheta1)/costheta1));
310 distanceToSecondEndPlane += r*sqrt(fabs((1-costheta2*costheta2)/costheta2));
311 }
312
313 return true;
314}
315//____________________________________________________________________
317 const Amg::Vector3D& planePoint, const Amg::Vector3D& planeNormal )
318{
319
320 double denominator(planeNormal.dot(lineDirection)*lineDirection.mag());
321 if (denominator==0.0) {
322 theclass->message("MuonChamberProjectionHelper Error: pointToPlaneDistAlongLine is undefined!");
323 return -1.0;
324 }
325 double numerator(planeNormal.x() * (planePoint.x() - point.x())
326 + planeNormal.y() * (planePoint.y() - point.y())
327 + planeNormal.z() * (planePoint.z() - point.z()));
328 return fabs(numerator/denominator);
329}
330
331//____________________________________________________________________
332bool MuonChamberProjectionHelper::Imp::getMDTChamberVolInfo( const GeoPVConstLink& mdtChamber,
334 bool silent ) {
335
336 if (!ensureInited())
337 return false;
338
339 if (itLastMDTChamberLookedUp->first == mdtChamber) {
340 itChamberInfo = itLastMDTChamberLookedUp;
341 return true;
342 }
343
344 itChamberInfo = mdtchambervolinfo.find(mdtChamber);
345 if (itChamberInfo == mdtchambervolinfo.end()) {
346 if (!silent)
347 theclass->message("MuonChamberProjectionHelper Error: Can't find MDT chamber among the "
348 +QString::number(mdtchambervolinfo.size())+" registered");
349 return false;
350 }
351
352 itLastMDTChamberLookedUp = itChamberInfo;
353
354 return true;
355}
356
357//____________________________________________________________________
358void MuonChamberProjectionHelper::Imp::getMDTChamberXAndZ(ChamberInfoMapItr& itChamberInfo, double & trdX, double & trdZ )
359{
360 const GeoTrd * trd = itChamberInfo->second.trd;
361 trdX = trd->getXHalfLength1();
362 trdZ = trd->getZHalfLength();
363 if ( trdX != trd->getXHalfLength2() ) {
364 theclass->message("MuonChamberProjectionHelper Warning: x1!=x2 in GeoTrd shape. Clippings etc. will be to a too large surface.");
365 if ( trdX < trd->getXHalfLength2() )
366 trdX = trd->getXHalfLength2();
367 }
368
369}
370
371//____________________________________________________________________
373 const Amg::Vector3D & pointA, const Amg::Vector3D & pointB,
374 Amg::Vector3D & firstEndWall_pointA, Amg::Vector3D & firstEndWall_pointB,
375 Amg::Vector3D & secondEndWall_pointA, Amg::Vector3D & secondEndWall_pointB,
376 bool& outsidechamber )
377{
378 Imp::ChamberInfoMapItr itChamberInfo;
379 if (!m_d->getMDTChamberVolInfo( mdtChamber, itChamberInfo ))
380 return false;
381
382 double trdX, trdZ;
383 m_d->getMDTChamberXAndZ(itChamberInfo, trdX, trdZ );
384
385 //Get local chamber coordinates, A and B, of pointA and pointB:
386 itChamberInfo->second.ensureInitGlobalToLocal();
387 Amg::Vector3D A((*(itChamberInfo->second.globalToLocal))*pointA), B((*(itChamberInfo->second.globalToLocal))*pointB);
388 double ax(A.x()), az(A.z()), bx(B.x()), bz(B.z());
389
390 //We basically have to project the line segment AB to the
391 //(x,z)-plane, and then constrain it to the rectangle given by
392 //x_i<|trdX|, z_i<|trdZ|.
393
394 outsidechamber = !(m_d->clip2DLineSegmentToRectangle( trdX, trdZ, ax, az, bx, bz ));
395 if (outsidechamber)
396 return true;
397
398 //Project the points to the end of the Trd:
399 m_d->projectXZPointToTrdAlongYAxis( ax, az,itChamberInfo->second.trd, firstEndWall_pointA, secondEndWall_pointA );
400 m_d->projectXZPointToTrdAlongYAxis( bx, bz,itChamberInfo->second.trd, firstEndWall_pointB, secondEndWall_pointB );
401
402 //Put points in global coordinates:
403// firstEndWall_pointA.transform(itChamberInfo->second.localToGlobal);
404// secondEndWall_pointA.transform(itChamberInfo->second.localToGlobal);
405// firstEndWall_pointB.transform(itChamberInfo->second.localToGlobal);
406// secondEndWall_pointB.transform(itChamberInfo->second.localToGlobal);
407 Amg::transform(firstEndWall_pointA, itChamberInfo->second.localToGlobal);
408 Amg::transform(secondEndWall_pointA, itChamberInfo->second.localToGlobal);
409 Amg::transform(firstEndWall_pointB, itChamberInfo->second.localToGlobal);
410 Amg::transform(secondEndWall_pointB, itChamberInfo->second.localToGlobal);
411
412 outsidechamber = false;
413 return true;
414}
415
416//____________________________________________________________________
417void MuonChamberProjectionHelper::Imp::projectXZPointToTrdAlongYAxis(const double& x, const double& z,const GeoTrd* trd,
418 Amg::Vector3D & firstEndWall_point, Amg::Vector3D & secondEndWall_point )
419{
420 const double epsilon(0.1);//100micron
421 const double trdY1(trd->getYHalfLength1()), trdY2(trd->getYHalfLength2());
422 const double y( trdY1 + 0.5*(1.0+z/trd->getZHalfLength())*(trdY2-trdY1) );
423 Amg::setVector3DCartesian(firstEndWall_point, x,y+epsilon,z);
424 Amg::setVector3DCartesian(secondEndWall_point, x,-y-epsilon,z);
425}
426
427//____________________________________________________________________
429 const double& x0, const double& z0,
430 double& x1, double& z1 )
431{
432 //rectangle R : { (x,z) | abs(x)<=trdX && abs(z)<=trdZ }
433 //
434 //Returns false if segment from (x0,z0) to (x1,z1) doesn't cross R.
435
436 if ( x1 < -trdX ) {
437 if ( x0 < -trdX )
438 return false;
439 //Move (x1,z1) to x == -trdX line:
440 z1 += (-trdX-x1)*(z1-z0)/(x1-x0);
441 x1 = -trdX;
442 if (fabs(z1)>trdZ)
443 return constrainPointToRectangleAlongLine(trdX,trdZ,x0,z0,x1,z1);
444 }
445
446 if ( x1 > trdX ) {
447 if ( x0 > trdX )
448 return false;
449 //Move (x1,z1) to x == trdX line:
450 z1 += (trdX-x1)*(z1-z0)/(x1-x0);
451 x1 = trdX;
452 if (fabs(z1)>trdZ)
453 return constrainPointToRectangleAlongLine(trdX,trdZ,x0,z0,x1,z1);
454 }
455
456 if ( z1 < -trdZ ) {
457 if ( z0 < -trdZ )
458 return false;
459 //Move (x1,z1) to z == -trdZ line:
460 x1 += (-trdZ-z1)*(x1-x0)/(z1-z0);
461 z1 = -trdZ;
462 if (fabs(x1)>trdX)
463 return constrainPointToRectangleAlongLine(trdX,trdZ,x0,z0,x1,z1);
464 }
465
466 if ( z1 > trdZ ) {
467 if ( z0 > trdZ )
468 return false;
469 //Move (x1,z1) to z == trdZ line:
470 x1 += (trdZ-z1)*(x1-x0)/(z1-z0);
471 z1 = trdZ;
472 if (fabs(x1)>trdX)
473 return constrainPointToRectangleAlongLine(trdX,trdZ,x0,z0,x1,z1);
474 }
475
476 //We were actually inside all along:
477 return true;
478}
479
480//____________________________________________________________________
481bool MuonChamberProjectionHelper::clipLineSegmentToMDTChamber( const GeoPVConstLink& mdtChamber,
482 Amg::Vector3D & pointA, Amg::Vector3D & pointB, bool& outsidechamber,
483 const double & extradist )
484{
485 Imp::ChamberInfoMapItr itChamberInfo;
486 if (!m_d->getMDTChamberVolInfo( mdtChamber, itChamberInfo ))
487 return false;
488
489 double trdX, trdZ;
490 m_d->getMDTChamberXAndZ(itChamberInfo, trdX, trdZ );
491
492 trdX += extradist;
493 trdZ += extradist;
494
495 if (trdX<=0.0||trdZ<=0.0)//Extradist must have been negative - and so much that effective chamber dimensions are collapsed.
496 return false;
497
498 //Get local chamber coordinates, A and B, of pointA and pointB:
499 itChamberInfo->second.ensureInitGlobalToLocal();
500 Amg::Vector3D A((*(itChamberInfo->second.globalToLocal))*pointA), B((*(itChamberInfo->second.globalToLocal))*pointB);
501 double ax(A.x()), az(A.z()), bx(B.x()), bz(B.z());
502
503 //Clip x and z dimensions:
504 outsidechamber = !(m_d->clip2DLineSegmentToRectangle( trdX, trdZ, ax, az, bx, bz ));
505 if (outsidechamber)
506 return true;
507
508 double ay(A.y()), by(B.y());
509 //Fixme: We must also clip y dimensions!!
510
511 //Put results back into points and in global coordinates:
512 Amg::setVector3DCartesian(pointA, ax,ay,az);
513 Amg::setVector3DCartesian(pointB, bx,by,bz);
514 Amg::transform(pointA, itChamberInfo->second.localToGlobal);
515 Amg::transform(pointB, itChamberInfo->second.localToGlobal);
516 outsidechamber = false;
517 return true;
518
519}
520
521//____________________________________________________________________
522bool MuonChamberProjectionHelper::Imp::clip2DLineSegmentToRectangle( const double& rectX, const double& rectY,
523 double& x0, double& y0, double& x1, double& y1 )
524{
525 if ( fabs(x0)<=rectX && fabs(y0)<=rectY ) {
526 if ( fabs(x1)>rectX || fabs(y1)>rectY ) {
527 //P0 inside R, P1 outside R. We must change (x1,y1) so P0-P1 is inside R.
528 if (!constrainPointToRectangleAlongLine( rectX, rectY, x0, y0, x1, y1 ))
529 theclass->message("MuonChamberProjectionHelper Error: Should never happen (1)");
530 }
531 } else {
532 if ( fabs(x1)<=rectX && fabs(y1)<=rectY ) {
533 //Point P1 inside R, P0 outside R. We must change (x0,y0) so P0-P1 is inside R.
534 if (!constrainPointToRectangleAlongLine( rectX, rectY, x1, y1, x0, y0 ))
535 theclass->message("MuonChamberProjectionHelper Error: Should never happen (2)");
536 } else {
537 //Both points outside - but the line might still R!
538
539 //First attempt to put (x1,y1) on edge of R, by sliding towards P0
540 if (!constrainPointToRectangleAlongLine( rectX, rectY, x0, y0, x1, y1 )) {
541 //failed - thus P0-P1 doesn't intersect target rectangle.
542 return false;
543 }
544
545 //Now change (x0,y0) so P0-P1 is inside the target rectangle.
546 if (!constrainPointToRectangleAlongLine( rectX, rectY, x1, y1, x0, y0 ))
547 theclass->message("MuonChamberProjectionHelper Error: Should never happen (3)");
548 }
549 }
550
551 return true;
552
553}
static Double_t tc
#define y
#define x
#define z
GeoPhysVol * getPhysVol()
Destructor.
MDTChamberInfo(const Amg::Transform3D &l2g, const GeoTrd *t)
std::map< GeoPVConstLink, MDTChamberInfo > mdtchambervolinfo
Imp(MuonChamberProjectionHelper *tc, StoreGateSvc *ds)
std::map< GeoPVConstLink, MDTChamberInfo >::iterator ChamberInfoMapItr
const GeoTrd * findTRDInShape(const GeoShape *shape)
std::map< GeoPVConstLink, MDTChamberInfo >::iterator itLastMDTChamberLookedUp
void getMDTChamberXAndZ(ChamberInfoMapItr &itChamberInfo, double &trdX, double &trdZ)
bool clip2DLineSegmentToRectangle(const double &rectX, const double &rectY, double &x0, double &y0, double &x1, double &y1)
double pointToPlaneDistAlongLine(const Amg::Vector3D &point, const Amg::Vector3D &lineDirection, const Amg::Vector3D &planePoint, const Amg::Vector3D &planeNormal)
void projectXZPointToTrdAlongYAxis(const double &x, const double &z, const GeoTrd *trd, Amg::Vector3D &firstEndWall_point, Amg::Vector3D &secondEndWall_point)
bool getMDTChamberVolInfo(const GeoPVConstLink &mdtChamber, ChamberInfoMapItr &itChamberInfo, bool silent=false)
static bool constrainPointToRectangleAlongLine(const double &trdX, const double &trdZ, const double &x0, const double &z0, double &x1, double &z1)
bool isKnownMDTChamber(const GeoPVConstLink &mdtChamber)
bool projectAndConstrainLineSegmentToMDTChamberEndWalls(const GeoPVConstLink &mdtChamber, const Amg::Vector3D &pointA, const Amg::Vector3D &pointB, Amg::Vector3D &firstEndWall_pointA, Amg::Vector3D &firstEndWall_pointB, Amg::Vector3D &secondEndWall_pointA, Amg::Vector3D &secondEndWall_pointB, bool &outsidechamber)
MuonChamberProjectionHelper(StoreGateSvc *detectorStore)
bool getDistancesToMDTChamberWallsAlongLine(const GeoPVConstLink &mdtChamber, const Amg::Vector3D &point, const Amg::Vector3D &lineDirection, double &distanceToFirstEndPlane, double &distanceToSecondEndPlane, const double &radius=0.0)
static Amg::Vector3D & applyTransformToVector(const Amg::Transform3D &m, Amg::Vector3D &v)
bool clipLineSegmentToMDTChamber(const GeoPVConstLink &mdtChamber, Amg::Vector3D &pointA, Amg::Vector3D &pointB, bool &outsidechamber, const double &extradist=0.0)
The Athena Transient Store API.
VP1HelperClassBase(IVP1System *sys=0, QString helpername="")
void message(const QString &) const
static bool hasMuonGeometry()
bool retrieve(const T *&, const QString &key) const
int r
Definition globals.cxx:22
void setVector3DCartesian(Amg::Vector3D &v1, double x1, double y1, double z1)
Sets components in cartesian coordinate system.
Eigen::Affine3d Transform3D
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Eigen::Matrix< double, 3, 1 > Vector3D
hold the test vectors and ease the comparison