Skip to content

Commit

Permalink
Added more code doc for <facing> and unit tests. Re #6537
Browse files Browse the repository at this point in the history
Work I did last week but related to quality improve of code and doc
  • Loading branch information
Anders-Markvardsen committed Feb 14, 2013
1 parent 236ad4f commit b04fe05
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1616,7 +1616,8 @@ namespace Geometry
return;


// Face the component to the x,y,z or r,t,p coordinates of the facing component
// Face the component, i.e. rotate the z-axis of the component such that it points in the direction from
// the point x,y,z (or r,t,p) specified by the <facing> xml element towards the component

makeXYplaneFaceComponent(comp, parseFacingElementToV3D(facingElem));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,25 @@ class InstrumentDefinitionParserTest : public CxxTest::TestSuite
TS_ASSERT( !ptrDet11->isValid(V3D(0.0,-0.05,0.0)+ptrDet11->getPos()) );
TS_ASSERT( !ptrDet11->isValid(V3D(0.0,-0.01,0.05)+ptrDet11->getPos()) );
TS_ASSERT( !ptrDet11->isValid(V3D(0.0,-0.01,-0.05)+ptrDet11->getPos()) );
boost::shared_ptr<const IDetector> ptrDet1000 = i->getDetector(1000);
TS_ASSERT( ptrDet1000->isValid(V3D(0.0,0.0,0.1)+ptrDet1000->getPos()) );
TS_ASSERT( ptrDet1000->isValid(V3D(0.0,0.0,-0.1)+ptrDet1000->getPos()) );
TS_ASSERT( ptrDet1000->isValid(V3D(0.0,0.02,0.1)+ptrDet1000->getPos()) );
TS_ASSERT( ptrDet1000->isValid(V3D(0.0,0.02,-0.1)+ptrDet1000->getPos()) );
TS_ASSERT( !ptrDet1000->isValid(V3D(0.0,0.05,0.0)+ptrDet1000->getPos()) );
TS_ASSERT( !ptrDet1000->isValid(V3D(0.0,-0.05,0.0)+ptrDet1000->getPos()) );
TS_ASSERT( !ptrDet1000->isValid(V3D(0.0,-0.01,0.05)+ptrDet1000->getPos()) );
TS_ASSERT( !ptrDet1000->isValid(V3D(0.0,-0.01,-0.05)+ptrDet1000->getPos()) );
boost::shared_ptr<const IDetector> ptrDet1001 = i->getDetector(1001);
TS_ASSERT( ptrDet1001->isValid(V3D(-0.07,0.0,-0.07)+ptrDet1001->getPos()) );
TS_ASSERT( ptrDet1001->isValid(V3D(0.07,0.0,0.07)+ptrDet1001->getPos()) );
TS_ASSERT( ptrDet1001->isValid(V3D(0.07,0.01,0.07)+ptrDet1001->getPos()) );
TS_ASSERT( ptrDet1001->isValid(V3D(-0.07,0.01,-0.07)+ptrDet1001->getPos()) );
TS_ASSERT( !ptrDet1001->isValid(V3D(0.0,0.05,0.0)+ptrDet1001->getPos()) );
TS_ASSERT( !ptrDet1001->isValid(V3D(0.0,-0.05,0.0)+ptrDet1001->getPos()) );
TS_ASSERT( !ptrDet1001->isValid(V3D(0.0,-0.01,0.05)+ptrDet1001->getPos()) );
TS_ASSERT( !ptrDet1001->isValid(V3D(0.0,-0.01,-0.05)+ptrDet1001->getPos()) );


// test for "infinite-cylinder-test".
boost::shared_ptr<const IDetector> ptrDet12 = i->getDetector(12);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,12 @@

<component type="cuboid-rotating-test" idlist="cuboid-rotating-test">
<location x="0.0" y="100.0" z="0.0"> </location>
<location x="0.0" y="200.0" z="0.0"> <facing rot="45"/> </location>
<location x="0.0" y="200.0" z="0.0"> <facing rot="45"/> </location>
</component>

<component type="cuboid-rotating-test" idlist="cuboid-rotating-test2">
<location x="0.0" y="200.0" z="0.0"> </location>
<location x="0.0" y="200.0" z="0.0" rot="45"> </location>
</component>

<component type="infinite-cylinder-test" idlist="infinite-cylinder-test">
Expand Down Expand Up @@ -325,6 +330,10 @@
<id start="10" end="11" />
</idlist>

<idlist idname="cuboid-rotating-test2">
<id start="1000" end="1001" />
</idlist>

<idlist idname="infinite-cylinder-test">
<id val="12" />
</idlist>
Expand Down

0 comments on commit b04fe05

Please sign in to comment.