Skip to content

Commit 04a65b3

Browse files
committed
Start of M1Detail [simple block]
1 parent 4b18a82 commit 04a65b3

File tree

8 files changed

+107
-115
lines changed

8 files changed

+107
-115
lines changed

CMake.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@
196196
[@singleItem,
197197
qw( essConstruct commonVar commonGenerator
198198
R1Common R3Common commonBeam Linac
199-
beamline formax)]);
199+
beamline softimax formax)]);
200200
}
201201

202202

Model/MaxIV/commonGenerator/M1DetailGenerator.cxx

+13-6
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,14 @@ M1DetailGenerator::M1DetailGenerator() :
5050
mWidth(6.0),mHeight(6.0),
5151
mLength(37.0),mSlotXStep(4.5),
5252
mSlotWidth(1.0),mSlotDepth(0.90),
53-
mPipeXStep(2.17), mPipeYStep(2.0),
53+
mPipeXStep(2.17),mPipeYStep(2.0),
5454
mPipeZStep(1.8),mPipeSideRadius(0.225),
5555
mPipeBaseLen(2.1),mPipeBaseRadius(0.25),
5656
mPipeOuterLen(1.5),mPipeOuterRadius(0.30),
5757

58-
mirrorMat("Silicon300K"),plateMat("Stainless304"),
59-
baseMat("Copper"),voidMat("Void")
58+
mirrorMat("Silicon300K"),waterMat("H2O"),
59+
pipeMat("Stainless304"),outerMat("Copper"),
60+
voidMat("Void")
6061
/*!
6162
Constructor and defaults
6263
*/
@@ -88,27 +89,33 @@ M1DetailGenerator::makeCrystal(FuncDataBase& Control,
8889
ELog::RegMethod RegA("M1DetailGenerator","makeCrystal");
8990

9091
Control.addVariable(cryName+"ZStep",zStep);
91-
Control.addVariable(cryName+"ZAngle",theta);
92+
93+
Control.addVariable(cryName+"Theta",theta);
94+
Control.addVariable(cryName+"Phi",0.0);
9295

9396
Control.addVariable(cryName+"Width",mWidth);
9497
Control.addVariable(cryName+"Height",mHeight);
9598
Control.addVariable(cryName+"Length",mLength);
99+
96100
Control.addVariable(cryName+"SlotXStep",mSlotXStep);
97101
Control.addVariable(cryName+"SlotWidth",mSlotWidth);
98102
Control.addVariable(cryName+"SlotDepth",mSlotDepth);
103+
99104
Control.addVariable(cryName+"PipeXStep",mPipeXStep);
100105
Control.addVariable(cryName+"PipeYStep",mPipeYStep);
101106
Control.addVariable(cryName+"PipeZStep",mPipeZStep);
107+
102108
Control.addVariable(cryName+"PipeSideRadius",mPipeSideRadius);
103109
Control.addVariable(cryName+"PipeBaseLen",mPipeBaseLen);
104110
Control.addVariable(cryName+"PipeBaseRadius",mPipeBaseRadius);
105111
Control.addVariable(cryName+"PipeOuterLen",mPipeOuterLen);
106112
Control.addVariable(cryName+"PipeOuterRadius",mPipeOuterRadius);
107113

108114
Control.addVariable(cryName+"MirrorMat",mirrorMat);
115+
Control.addVariable(cryName+"WaterMat",waterMat);
116+
Control.addVariable(cryName+"PipeMat",pipeMat);
117+
Control.addVariable(cryName+"OuterMat",outerMat);
109118
Control.addVariable(cryName+"VoidMat",voidMat);
110-
Control.addVariable(cryName+"BaseMat",baseMat);
111-
Control.addVariable(cryName+"PipeMat",plateMat);
112119

113120
return;
114121
}

Model/MaxIV/commonGeneratorInc/M1DetailGenerator.h

+5-4
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ class M1DetailGenerator
3838
private:
3939

4040

41-
double mWidth; ///< Width of mirro
42-
double mHeight; ///< Depth into mirro
41+
double mWidth; ///< Width of mirror
42+
double mHeight; ///< Depth into mirror
4343
double mLength; ///< Length along mirror
4444
double mSlotXStep; ///< Length along mirror
4545
double mSlotWidth; ///< Length along mirror
@@ -57,8 +57,9 @@ class M1DetailGenerator
5757
double mPipeOuterRadius; ///< radius of outer pipe vertical
5858

5959
std::string mirrorMat; ///< XStal material
60-
std::string plateMat; ///< Plate material
61-
std::string baseMat; ///< Base material
60+
std::string waterMat; ///< Plate material
61+
std::string pipeMat; ///< Base material
62+
std::string outerMat; ///< Base material
6263
std::string voidMat; ///< Void material
6364

6465

Model/MaxIV/softimax/M1Mirror.cxx

+46-87
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/*********************************************************************
22
CombLayer : MCNP(X) Input builder
33
4-
* File: commonBeam/M1Mirror.cxx
4+
* File: softimax/M1Mirror.cxx
55
*
6-
* Copyright (c) 2004-2021 by Stuart Ansell
6+
* Copyright (c) 2004-2023 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
@@ -95,14 +95,31 @@ M1Mirror::populate(const FuncDataBase& Control)
9595
FixedRotate::populate(Control);
9696

9797
theta=Control.EvalVar<double>(keyName+"Theta");
98-
phi=Control.EvalDefVar<double>(keyName+"Phi",0.0);
99-
98+
phi=Control.EvalVar<double>(keyName+"Phi");
99+
100100
width=Control.EvalVar<double>(keyName+"Width");
101-
thick=Control.EvalVar<double>(keyName+"Thick");
101+
height=Control.EvalVar<double>(keyName+"Height");
102102
length=Control.EvalVar<double>(keyName+"Length");
103103

104-
mirrMat=ModelSupport::EvalMat<int>(Control,keyName+"M1MirrorMat");
105-
baseMat=ModelSupport::EvalMat<int>(Control,keyName+"BaseMat");
104+
slotXStep=Control.EvalVar<double>(keyName+"SlotXStep");
105+
slotWidth=Control.EvalVar<double>(keyName+"SlotWidth");
106+
slotDepth=Control.EvalVar<double>(keyName+"SlotDepth");
107+
108+
pipeXStep=Control.EvalVar<double>(keyName+"PipeXStep");
109+
pipeYStep=Control.EvalVar<double>(keyName+"PipeYStep");
110+
pipeZStep=Control.EvalVar<double>(keyName+"PipeZStep");
111+
pipeSideRadius=Control.EvalVar<double>(keyName+"PipeSideRadius");
112+
pipeBaseLen=Control.EvalVar<double>(keyName+"PipeBaseLen");
113+
pipeBaseRadius=Control.EvalVar<double>(keyName+"PipeBaseRadius");
114+
pipeOuterLen=Control.EvalVar<double>(keyName+"PipeOuterLen");
115+
pipeOuterRadius=Control.EvalVar<double>(keyName+"PipeOuterRadius");
116+
117+
mirrorMat=ModelSupport::EvalMat<int>(Control,keyName+"MirrorMat");
118+
waterMat=ModelSupport::EvalMat<int>(Control,keyName+"WaterMat");
119+
pipeMat=ModelSupport::EvalMat<int>(Control,keyName+"PipeMat");
120+
outerMat=ModelSupport::EvalMat<int>(Control,keyName+"OuterMat");
121+
voidMat=ModelSupport::EvalMat<int>(Control,keyName+"VoidMat");
122+
106123

107124
return;
108125
}
@@ -118,66 +135,31 @@ M1Mirror::createSurfaces()
118135

119136
// main xstal CENTRE AT ORIGIN
120137
const Geometry::Quaternion QXA
121-
(Geometry::Quaternion::calcQRotDeg(-theta,X));
138+
(Geometry::Quaternion::calcQRotDeg(-theta,Z));
122139

123140
Geometry::Vec3D PX(X);
124141
Geometry::Vec3D PY(Y);
125142
Geometry::Vec3D PZ(Z);
126143

144+
QXA.rotate(PX);
127145
QXA.rotate(PY);
128-
QXA.rotate(PZ);
129-
130-
const Geometry::Quaternion QYA
131-
(Geometry::Quaternion::calcQRotDeg(phi,PY));
132-
133-
QYA.rotate(PX);
134-
QYA.rotate(PZ);
135-
136-
ModelSupport::buildPlane(SMap,buildIndex+101,Origin-PY*(length/2.0),PY);
137-
ModelSupport::buildPlane(SMap,buildIndex+102,Origin+PY*(length/2.0),PY);
138-
ModelSupport::buildPlane(SMap,buildIndex+103,Origin-PX*(width/2.0),PX);
139-
ModelSupport::buildPlane(SMap,buildIndex+104,Origin+PX*(width/2.0),PX);
140-
141-
if (std::abs(radius)>Geometry::zeroTol)
142-
{
143-
// calc edge cut
144-
const double tAngle = length/(2.0*radius); // cos(-a) == cos(a)
145-
const double lift = radius*(1.0-cos(tAngle));
146-
if (radius<0)
147-
ModelSupport::buildPlane(SMap,buildIndex+105,Origin-PZ*lift,-PZ);
148-
else
149-
ModelSupport::buildPlane(SMap,buildIndex+105,Origin-PZ*lift,PZ);
150-
ModelSupport::buildCylinder(SMap,buildIndex+107,
151-
Origin-PZ*radius,PX,std::abs(radius));
152-
ModelSupport::buildCylinder(SMap,buildIndex+117,
153-
Origin-PZ*radius,PX,std::abs(radius)+thick);
154-
}
155-
else
156-
{
157-
ModelSupport::buildPlane(SMap,buildIndex+105,Origin-PZ*thick,PZ);
158-
ModelSupport::buildPlane(SMap,buildIndex+106,Origin,PZ);
159-
}
160-
161-
162-
// support
163-
ModelSupport::buildPlane(SMap,buildIndex+203,
164-
Origin-PX*(baseOutWidth+width/2.0),PX);
165-
ModelSupport::buildPlane(SMap,buildIndex+204,
166-
Origin+PX*(baseOutWidth+width/2.0),PX);
167-
ModelSupport::buildPlane(SMap,buildIndex+205,Origin+PZ*baseTop,PZ);
168-
ModelSupport::buildPlane(SMap,buildIndex+206,Origin-PZ*baseDepth,PZ);
169-
170-
171-
ModelSupport::buildPlane(SMap,buildIndex+216,Origin-PZ*(thick+baseGap),PZ);
172-
173-
/// create the link point towards the reflected beam
174-
// (do it here to avoid re-definition of variables in createLinks()
175-
176-
Geometry::Vec3D Yrefl(PY);
177-
Geometry::Quaternion::calcQRotDeg(-theta,X).rotate(Yrefl);
178-
179-
FixedComp::setConnect(1,Origin+PZ*baseTop,Yrefl);
180-
FixedComp::setLinkSurf(1,-SMap.realSurf(buildIndex+205));
146+
147+
ModelSupport::buildPlane(SMap,buildIndex+1,Origin-PY*(length/2.0),PY);
148+
ModelSupport::buildPlane(SMap,buildIndex+2,Origin+PY*(length/2.0),PY);
149+
ModelSupport::buildPlane(SMap,buildIndex+3,Origin-PX*width,PX);
150+
ModelSupport::buildPlane(SMap,buildIndex+4,Origin,PX);
151+
ModelSupport::buildPlane(SMap,buildIndex+5,Origin-PZ*(height/2.0),PZ);
152+
ModelSupport::buildPlane(SMap,buildIndex+6,Origin+PZ*(height/2.0),PZ);
153+
154+
155+
// support cuts:
156+
Geometry::Vec3D slotOrg=Origin-X*slotXStep;
157+
ModelSupport::buildPlane(SMap,buildIndex+13,slotOrg-PX*(slotWidth/2.0),PX);
158+
ModelSupport::buildPlane(SMap,buildIndex+14,slotOrg+PX*(slotWidth/2.0),PX);
159+
ModelSupport::buildPlane
160+
(SMap,buildIndex+15,slotOrg-PZ*(height/2.0-slotDepth),PZ);
161+
ModelSupport::buildPlane
162+
(SMap,buildIndex+16,slotOrg+PZ*(height/2.0-slotDepth),PZ);
181163

182164
return;
183165
}
@@ -193,35 +175,12 @@ M1Mirror::createObjects(Simulation& System)
193175

194176
HeadRule HR;
195177
// xstal
196-
if (std::abs(radius)<Geometry::zeroTol)
197-
HR=ModelSupport::getHeadRule(SMap,buildIndex,
198-
" 101 -102 103 -104 105 -106 ");
199-
else
200-
HR=ModelSupport::getHeadRule
201-
(SMap,buildIndex," 103 -104 107 -117 105 ");
202-
203-
makeCell("M1Mirror",System,cellIndex++,mirrMat,0.0,HR);
204-
205-
// Make sides
206-
HR=ModelSupport::getHeadRule(SMap,buildIndex," 101 -102 -103 203 -205 206 ");
207-
makeCell("LeftSide",System,cellIndex++,baseMat,0.0,HR);
208-
HR=ModelSupport::getHeadRule(SMap,buildIndex," 101 -102 104 -204 -205 206 ");
209-
makeCell("RightSide",System,cellIndex++,baseMat,0.0,HR);
210-
HR=ModelSupport::getHeadRule(SMap,buildIndex,
211-
" 101 -102 103 -104 -216 206 ");
212-
makeCell("Base",System,cellIndex++,baseMat,0.0,HR);
213-
214-
// vacuum units:
215178
HR=ModelSupport::getHeadRule
216-
(SMap,buildIndex," 101 -102 103 -104 -105 216" );
217-
makeCell("BaseVac",System,cellIndex++,0,0.0,HR);
179+
(SMap,buildIndex,"1 -2 3 -4 5 -6");
180+
makeCell("M1Mirror",System,cellIndex++,mirrorMat,0.0,HR);
218181

219-
HR=ModelSupport::getHeadRule
220-
(SMap,buildIndex," 101 -102 103 -104 -205 106 " );
221-
makeCell("TopVac",System,cellIndex++,0,0.0,HR);
222182

223-
HR=ModelSupport::getHeadRule
224-
(SMap,buildIndex," 101 -102 203 -204 -205 206" );
183+
HR=ModelSupport::getHeadRule(SMap,buildIndex,"1 -2 3 -4 5 -6");
225184
addOuterSurf(HR);
226185

227186
return;

Model/MaxIV/softimaxInc/M1Detail.h

+1-4
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,7 @@ class Simulation;
2727
namespace xraySystem
2828
{
2929

30-
class MLMCrystal;
31-
class MLMRadialSupport;
32-
class MLMSupportWheel;
33-
class MLMWheelPlate;
30+
class M1Mirror;
3431

3532
/*!
3633
\class M1Detail

Model/MaxIV/softimaxInc/M1Mirror.h

+23-12
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*********************************************************************
22
CombLayer : MCNP(X) Input builder
33
4-
* File: commonBeamInc/M1Mirror.h
4+
* File: softimaxInc/M1Mirror.h
55
*
66
* Copyright (c) 2004-2023 by Stuart Ansell
77
*
@@ -46,18 +46,29 @@ class M1Mirror :
4646
double theta; ///< Theta angle
4747
double phi; ///< phi angle
4848

49-
double radius; ///< Radius of surface cylinder
50-
double width; ///< width accross beam
51-
double thick; ///< Thickness in normal direction to reflection
52-
double length; ///< length along beam
53-
54-
double baseTop; ///< Base distance above mirror
55-
double baseDepth; ///< Base distance below mirror
56-
double baseOutWidth; ///< Extra width of base
57-
double baseGap; ///< Base under gap below mirror
49+
double width; ///< Width of mirror
50+
double height; ///< Depth into mirror
51+
double length; ///< Length along mirror
52+
double slotXStep; ///< Length along mirror
53+
double slotWidth; ///< Length along mirror
54+
double slotDepth; ///< Length along mirror
55+
double pipeXStep; ///< step from mirror surface to base join
56+
double pipeYStep; ///< step from mirror end
57+
double pipeZStep; ///< step from lower base up.
58+
59+
double pipeSideRadius; ///< radius at side
60+
61+
double pipeBaseLen; ///< radius at base
62+
double pipeBaseRadius; ///< radius at base
63+
64+
double pipeOuterLen; ///< Length of outer pipe vertical
65+
double pipeOuterRadius; ///< radius of outer pipe vertical
5866

59-
int mirrMat; ///< XStal material
60-
int baseMat; ///< Base material
67+
int mirrorMat; ///< XStal material
68+
int waterMat; ///< material in pipe
69+
int pipeMat; ///< Base material
70+
int outerMat; ///< outer pipe material
71+
int voidMat; ///< outer pipe material
6172

6273
// Functions:
6374

Model/singleItemBuild/makeSingleItem.cxx

+13
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@
164164
#include "PlateUnit.h"
165165
#include "BenderUnit.h"
166166
#include "MLMonoDetail.h"
167+
#include "M1Detail.h"
167168

168169
#include "makeSingleItem.h"
169170

@@ -221,6 +222,7 @@ makeSingleItem::build(Simulation& System,
221222
"ConnectorTube","LocalShield","FlangeDome",
222223
"MonoShutter","RoundMonoShutter","TubeDetBox",
223224
"GuideUnit","PlateUnit","BenderUnit","MLMdetail",
225+
"M1detail",
224226
"Help","help"
225227
});
226228

@@ -308,6 +310,17 @@ makeSingleItem::build(Simulation& System,
308310
MD->addInsertCell(voidCell);
309311
MD->createAll(System,World::masterOrigin(),0);
310312

313+
return;
314+
}
315+
if (item == "M1detail" )
316+
{
317+
std::shared_ptr<xraySystem::M1Detail>
318+
MD(new xraySystem::M1Detail("M1"));
319+
OR.addObject(MD);
320+
321+
MD->addInsertCell(voidCell);
322+
MD->createAll(System,World::masterOrigin(),0);
323+
311324
return;
312325
}
313326
if (item == "GateValveCylinder" )

Model/singleItemBuild/singleItemVariables.cxx

+5-1
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@
132132
#include "MonoShutterGenerator.h"
133133
#include "FocusGenerator.h"
134134
#include "MLMDetailGenerator.h"
135+
#include "M1DetailGenerator.h"
135136

136137
#include "RoundShutterGenerator.h"
137138
#include "TubeDetBoxGenerator.h"
@@ -725,7 +726,10 @@ SingleItemVariables(FuncDataBase& Control)
725726

726727
MLMDetailGenerator MLGen;
727728
MLGen.generateMono(Control,"MLM",0.1,-0.1);
728-
729+
730+
M1DetailGenerator M1DGen;
731+
M1DGen.generateMirror(Control,"M1",2.0,0.0);
732+
729733

730734
TubeDetBoxGenerator TDBGen;
731735
TDBGen.generateBox(Control,"TDetBox",Geometry::Vec3D(0,3.15,0),8);

0 commit comments

Comments
 (0)