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