Skip to content

Commit 27945d1

Browse files
committed
Update for better calcSurfIntersection:
This uses the surface logically +/- to determine the exit point. [This improved the old +/- delta where delta was a small number and ths inaccurate along a surface.]
1 parent 2dcfe72 commit 27945d1

28 files changed

+238
-361
lines changed

Model/d4cModel/DetectorBank.cxx

+19-19
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
44
* File: d4cModel/DetectorBank.cxx
55
*
6-
* Copyright (c) 2004-2019 by Stuart Ansell
6+
* Copyright (c) 2004-2024 by Stuart Ansell
77
*
88
* This program is free software: you can redistribute it and/or modify
99
* it under the terms of the GNU General Public License as published by
@@ -57,7 +57,7 @@
5757
#include "TallyCreate.h"
5858
#include "LinkUnit.h"
5959
#include "FixedComp.h"
60-
#include "FixedOffset.h"
60+
#include "FixedRotate.h"
6161
#include "ContainedComp.h"
6262
#include "DetectorBank.h"
6363

@@ -69,8 +69,8 @@ namespace d4cSystem
6969
{
7070

7171
DetectorBank::DetectorBank(const size_t BN,const std::string& Key) :
72+
attachSystem::FixedRotate(Key+std::to_string(BN),6),
7273
attachSystem::ContainedComp(),
73-
attachSystem::FixedOffset(Key+std::to_string(BN),6),
7474
bankNumber(BN),baseName(Key)
7575
/*!
7676
Constructor
@@ -79,8 +79,9 @@ DetectorBank::DetectorBank(const size_t BN,const std::string& Key) :
7979
*/
8080
{}
8181

82-
DetectorBank::DetectorBank(const DetectorBank& A) :
83-
attachSystem::ContainedComp(A),attachSystem::FixedOffset(A),
82+
DetectorBank::DetectorBank(const DetectorBank& A) :
83+
attachSystem::FixedRotate(A),
84+
attachSystem::ContainedComp(A),
8485
bankNumber(A.bankNumber),baseName(A.baseName),
8586
centreOffset(A.centreOffset),
8687
centreAngle(A.centreAngle),detDepth(A.detDepth),
@@ -103,8 +104,8 @@ DetectorBank::operator=(const DetectorBank& A)
103104
{
104105
if (this!=&A)
105106
{
107+
attachSystem::FixedRotate::operator=(A);
106108
attachSystem::ContainedComp::operator=(A);
107-
attachSystem::FixedOffset::operator=(A);
108109
centreOffset=A.centreOffset;
109110
centreAngle=A.centreAngle;
110111
detDepth=A.detDepth;
@@ -133,11 +134,11 @@ DetectorBank::populate(const FuncDataBase& Control)
133134
{
134135
ELog::RegMethod RegA("DetectorBank","populate");
135136

136-
FixedOffset::populate(Control);
137+
FixedRotate::populate(Control);
137138

138139
centreOffset=Control.EvalTail<double>(keyName,baseName,"CentreOffset");
139140
centreAngle=Control.EvalTail<double>(keyName,baseName,"CentreAngle");
140-
xyAngle-=centreAngle;
141+
zAngle-=centreAngle;
141142
centreAngle*=M_PI/180.0;
142143

143144
detHeight=Control.EvalTail<double>(keyName,baseName,"DetHeight");
@@ -152,8 +153,7 @@ DetectorBank::populate(const FuncDataBase& Control)
152153
baseName+"DetMat");
153154

154155
// trick to get def var of a pair.
155-
nDet=Control.EvalDefVar<size_t>(baseName+"NDet",0);
156-
nDet=Control.EvalDefVar<size_t>(keyName+"NDet",nDet);
156+
nDet=Control.EvalDefTail<size_t>(keyName,baseName,"NDet",0);
157157
return;
158158
}
159159

@@ -170,7 +170,7 @@ DetectorBank::createUnitVector(const attachSystem::FixedComp& FC,
170170

171171
Origin += (X*sin(centreAngle)+Y*cos(centreAngle))*centreOffset;
172172
applyShift(xStep,yStep,zStep);
173-
applyAngleRotate(xyAngle,zAngle);
173+
applyAngleRotate(xAngle,yAngle,zAngle);
174174

175175
return;
176176
}
@@ -222,17 +222,17 @@ DetectorBank::createObjects(Simulation& System)
222222
{
223223
ELog::RegMethod RegA("DetectorBank","createObjects");
224224

225-
std::string Out;
225+
HeadRule HR;
226226
// First make inner/outer void/wall and top/base
227227

228-
Out=ModelSupport::getComposite(SMap,buildIndex,"11 -12 13 -14 15 -16");
229-
addOuterSurf(Out);
228+
HR=ModelSupport::getHeadRule(SMap,buildIndex,"11 -12 13 -14 15 -16");
229+
addOuterSurf(HR);
230230

231-
Out=ModelSupport::getComposite(SMap,buildIndex," 1 -2 3 -4 5 -6 ");
232-
System.addCell(MonteCarlo::Object(cellIndex++,detMat,0.0,Out));
233-
Out=ModelSupport::getComposite(SMap,buildIndex,
234-
" 11 -12 13 -14 15 -16 (-1:2:-3:4:-5:6)");
235-
System.addCell(MonteCarlo::Object(cellIndex++,wallMat,0.0,Out));
231+
HR=ModelSupport::getHeadRule(SMap,buildIndex,"1 -2 3 -4 5 -6");
232+
System.addCell(cellIndex++,detMat,0.0,HR);
233+
HR=ModelSupport::getHeadRule(SMap,buildIndex,
234+
"11 -12 13 -14 15 -16 (-1:2:-3:4:-5:6)");
235+
System.addCell(cellIndex++,wallMat,0.0,HR);
236236
return;
237237
}
238238

Model/d4cModel/d4cVariables.cxx

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/*********************************************************************
2-
CombLayer : MNCPX Input builder
2+
CombLayer : MCNP(X) Input builder
33
44
* File: d4cModel/d4cVariables.cxx
55
*
6-
* Copyright (c) 2004-2014 by Stuart Ansell
6+
* Copyright (c) 2004-2024 by Stuart Ansell
77
*
88
* This program is free software: you can redistribute it and/or modify
99
* it under the terms of the GNU General Public License as published by
@@ -115,7 +115,6 @@ D4CModel(FuncDataBase& Control)
115115
Control.addVariable("detectorYStep",0.0); // Radius the beam
116116
Control.addVariable("detectorZStep",0.0); // Radius the beam
117117
Control.addVariable("detectorZAngle",0.0); // Radius the beam
118-
Control.addVariable("detectorXYAngle",0.0); // Radius the beam
119118
Control.addVariable("detectorNDetector",100); //
120119
Control.addVariable("detectorInitAngle",2.0); //
121120
Control.addVariable("detectorFinalAngle",165.0); //
@@ -133,7 +132,6 @@ D4CModel(FuncDataBase& Control)
133132
Control.addVariable("DetBankYStep",0.0); // Radius the beam
134133
Control.addVariable("DetBankZStep",0.0); // Radius the beam
135134
Control.addVariable("DetBankZAngle",0.0); // Radius the beam
136-
Control.addVariable("DetBankXYAngle",0.0); // Radius the beam
137135
Control.addVariable("DetBankNDet",8); //
138136
Control.addVariable("DetBankCentreOffset",114.6); //
139137
Control.addVariable("DetBankDetHeight",10.0); //

Model/d4cModel/makeD4C.cxx

+6-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
44
* File: d4cModel/makeD4C.cxx
55
*
6-
* Copyright (c) 2004-2018 by Stuart Ansell
6+
* Copyright (c) 2004-2024 by Stuart Ansell
77
*
88
* This program is free software: you can redistribute it and/or modify
99
* it under the terms of the GNU General Public License as published by
@@ -52,8 +52,10 @@
5252
#include "Simulation.h"
5353
#include "LinkUnit.h"
5454
#include "FixedComp.h"
55-
#include "FixedOffset.h"
55+
#include "FixedRotate.h"
5656
#include "ContainedComp.h"
57+
#include "BaseMap.h"
58+
#include "CellMap.h"
5759
#include "World.h"
5860
#include "CylSample.h"
5961
#include "BellJar.h"
@@ -121,13 +123,13 @@ makeD4C::build(Simulation* SimPtr,
121123

122124
BellObj->setInsertCell(74123);
123125
BellObj->createAll(*SimPtr,World::masterOrigin(),0);
124-
CellObj->setInsertCell(BellObj->innerCell());
126+
CellObj->setInsertCell(BellObj->getCell("innerVoid"));
125127
CellObj->createAll(*SimPtr,*BellObj,0);
126128

127129
SimMonte* SM=dynamic_cast<SimMonte*>(SimPtr);
128130
for(size_t i=0;i<NDet;i++)
129131
{
130-
DetObj[i]->setInsertCell(BellObj->outerCell());
132+
DetObj[i]->setInsertCell(BellObj->getCell("outerVoid"));
131133
DetObj[i]->createAll(*SimPtr,*BellObj,0);
132134
DetObj[i]->createTally(*SimPtr);
133135

Model/d4cModelInc/DetectorBank.h

+4-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
44
* File: d4cModelInc/DetectorBank.h
55
*
6-
* Copyright (c) 2004-2018 by Stuart Ansell
6+
* Copyright (c) 2004-2024 by Stuart Ansell
77
*
88
* This program is free software: you can redistribute it and/or modify
99
* it under the terms of the GNU General Public License as published by
@@ -40,8 +40,9 @@ namespace d4cSystem
4040
\brief Grid of detector objects
4141
*/
4242

43-
class DetectorBank : public attachSystem::ContainedComp,
44-
public attachSystem::FixedOffset
43+
class DetectorBank :
44+
public attachSystem::FixedRotate,
45+
public attachSystem::ContainedComp
4546
{
4647
private:
4748

Model/essBuild/BilbaoWheelInnerStructure.cxx

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
44
* File: essBuild/BilbaoWheelInnerStructure.cxx
55
*
6-
* Copyright (c) 2004-2023 by Stuart Ansell/Konstain Batkov
6+
* Copyright (c) 2004-2024 by Stuart Ansell/Konstain Batkov
77
*
88
* This program is free software: you can redistribute it and/or modify
99
* it under the terms of the GNU General Public License as published by
@@ -410,9 +410,10 @@ BilbaoWheelInnerStructure::createBrickSurfaces
410410
}
411411

412412
double
413-
BilbaoWheelInnerStructure::sideIntersect(HeadRule&& HR,
414-
const Geometry::Plane *plSide)
415-
/*!
413+
BilbaoWheelInnerStructure::sideIntersect
414+
(HeadRule HR,
415+
const Geometry::Plane *plSide)
416+
/*!
416417
Calculates intersect of a brick (void between bricks)
417418
and one of the sector side surfaces.
418419
\param surf :: usrface string to calcuatex
@@ -422,7 +423,6 @@ BilbaoWheelInnerStructure::sideIntersect(HeadRule&& HR,
422423
ELog::RegMethod RegA("BilbaoWhieelInnerStructure","sideIntersect");
423424

424425
std::vector<Geometry::Vec3D> Pts;
425-
std::vector<int> SNum;
426426
const Geometry::Plane *pz = SMap.realPtr<Geometry::Plane>(buildIndex+5);
427427

428428
HR.populateSurf();
@@ -433,7 +433,7 @@ BilbaoWheelInnerStructure::sideIntersect(HeadRule&& HR,
433433
if (!plSide->onSurface(Org))
434434
ELog::EM << "Origin of line is not on the surface" << ELog::endErr;
435435

436-
const size_t n = HR.calcSurfIntersection(Org, Unit, Pts, SNum);
436+
const size_t n = HR.calcSurfIntersection(Org, Unit, Pts);
437437
double dist = -1.0;
438438
if (n>1)
439439
dist = Pts[0].Distance(Pts[1])+0.01; // 0.01 is a "safety" summand to get rid of the bricks where we cross in the corner. For some reason, 1st layer is not built without this number.

Model/essBuildInc/BilbaoWheelInnerStructure.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
44
* File: essBuildInc/BilbaoWheelInnerStructure.h
55
*
6-
* Copyright (c) 2004-2023 by Stuart Ansell
6+
* Copyright (c) 2004-2024 by Stuart Ansell
77
*
88
* This program is free software: you can redistribute it and/or modify
99
* it under the terms of the GNU General Public License as published by
@@ -79,7 +79,7 @@ class BilbaoWheelInnerStructure :
7979
double getSectorAngle(const size_t index) const
8080
{ return 180.0*static_cast<double>(2*(index+1)-1)/static_cast<double>(nSectors); }
8181

82-
double sideIntersect(HeadRule&&,const Geometry::Plane*);
82+
double sideIntersect(HeadRule,const Geometry::Plane*);
8383

8484
void createAll(Simulation&,const attachSystem::FixedComp&,const long int) override {}
8585

0 commit comments

Comments
 (0)