BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSMuonCoolerBuilder.hh
1/*
2Beam Delivery Simulation (BDSIM) Copyright (C) Royal Holloway,
3University of London 2001 - 2022.
4
5This file is part of BDSIM.
6
7BDSIM is free software: you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published
9by the Free Software Foundation version 3 of the License.
10
11BDSIM is distributed in the hope that it will be useful, but
12WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with BDSIM. If not, see <http://www.gnu.org/licenses/>.
18*/
19#ifndef BDSMUONCOOLERBUILDER_H
20#define BDSMUONCOOLERBUILDER_H
21
22#include <vector>
23
24class BDSBeamPipeInfo;
25class BDSMuonCooler;
26namespace GMAD
27{
28 class CoolingChannel;
29 struct Element;
30}
31
32namespace BDS
33{
34 struct MuonCoolerCoilInfo; // forward declaration
35 struct MuonCoolerDipoleInfo;
36 struct MuonCoolerCavityInfo;
37 struct MuonCoolerAbsorberInfo;
38 struct SquareCheck;
39
44 BDSMuonCooler* BuildMuonCooler(const G4String& elementName,
45 G4double chordLength,
46 G4double horizontalWidth,
47 const GMAD::CoolingChannel& definition,
48 BDSBeamPipeInfo* beamPipeInfo,
49 G4double designRigidity);
50
54 std::vector<BDS::MuonCoolerCoilInfo> BuildMuonCoolerCoilInfos(const GMAD::CoolingChannel& definition);
55
59 void CheckMuonCoolerCoilInfosForOverlaps(const G4String& definitionName,
60 const G4String& elementName,
61 const std::vector<BDS::SquareCheck>& coilSquares,
62 G4double elementChordLength,
63 G4double elementRadius);
64
65 std::vector<BDS::MuonCoolerDipoleInfo> BuildMuonCoolerDipoleInfos(const GMAD::CoolingChannel& definition);
67
68 std::vector<BDS::MuonCoolerAbsorberInfo> BuildMuonCoolerAbsorberInfo(const GMAD::CoolingChannel& definition);
69 void CheckMuonCoolerAbsorberInfoForOverlaps(const G4String& definitionName,
70 const G4String& elementName,
71 const std::vector<BDS::MuonCoolerAbsorberInfo>& absorberInfos,
72 const std::vector<BDS::SquareCheck>& cavitySquares,
73 const std::vector<BDS::SquareCheck>& coilSquares,
74 G4double elementChordLength,
75 G4double elementRadius);
76
77 std::vector<BDS::MuonCoolerCavityInfo> BuildMuonCoolerCavityInfos(const GMAD::CoolingChannel& definition);
78 void CheckMuonCoolerCavityInfosForOverlaps(const G4String& definitionName,
79 const G4String& elementName,
80 const std::vector<BDS::SquareCheck>& cavitySquares,
81 const std::vector<BDS::SquareCheck>& coilSquares,
82 G4double elementChordLength,
83 G4double elementRadius);
84
90 {
91 G4double z1;
92 G4double z2;
93 G4double r1;
94 G4double r2;
95
96 G4bool Overlaps(const SquareCheck& o) const
97 {
98 G4bool zOK = (o.z1 > z2 || o.z1 < z1) && (o.z2 > z2 || o.z2 < z1) && (o.z2 > o.z1);
99 G4bool rOK = (o.r1 > r2 || o.r1 < r1) && (o.r2 > r2 || o.r2 < r1) && (o.r2 > o.r1);
100 return !zOK && !rOK;
101 }
102 G4String Str() const {return "z1: " + std::to_string(z1) + ", z2: " + std::to_string(z2) + ", r1: " + std::to_string(r1) + ", r2: " + std::to_string(r2) + " (mm)";}
103 };
104
106 std::vector<BDS::SquareCheck> MuonCoolerSquaresFromCoils(const std::vector<BDS::MuonCoolerCoilInfo>& coilInfos);
108 std::vector<BDS::SquareCheck> MuonCoolerSquaresFromCavities(const std::vector<BDS::MuonCoolerCavityInfo>& cavityInfos);
111 void MuonParamsToVector(const G4String& definitionName,
112 const std::vector<const std::list<double>*>& params,
113 const std::vector<std::string>& paramNames,
114 G4int nExpectedParams,
115 std::vector<std::vector<double>>& paramsV);
116
120 void MuonParamsToMaterials(const G4String& definitionName,
121 const G4String& variableName,
122 const std::list<std::string>& materialNames,
123 G4int nExpectedParams,
124 std::vector<G4Material*>& materials);
125
126 BDSFieldInfo* BuildMuonCoolerFieldRecipe(const G4String& definitionName,
127 G4double designRigidity,
128 const G4String& integrator,
129 const G4String& magneticFieldModel,
130 const G4String& electricFieldModel,
131 const G4String& dipoleFieldModel,
132 const std::vector<BDS::MuonCoolerCoilInfo>& coilInfos,
133 const std::vector<BDS::MuonCoolerDipoleInfo>& dipoleInfos,
134 const std::vector<BDS::MuonCoolerCavityInfo>& cavityInfos);
135}
136
137#endif
Holder class for all information required to describe a beam pipe model.
All info required to build complete field of any type.
A muon cooling module.
Cooling channel parameters.
Return either G4Tubs or G4CutTubs depending on flat face.
void MuonParamsToMaterials(const G4String &definitionName, const G4String &variableName, const std::list< std::string > &materialNames, G4int nExpectedParams, std::vector< G4Material * > &materials)
BDSMuonCooler * BuildMuonCooler(const G4String &elementName, G4double chordLength, G4double horizontalWidth, const GMAD::CoolingChannel &definition, BDSBeamPipeInfo *beamPipeInfo, G4double designRigidity)
void CheckMuonCoolerCoilInfosForOverlaps(const G4String &definitionName, const G4String &elementName, const std::vector< BDS::SquareCheck > &coilSquares, G4double elementChordLength, G4double elementRadius)
std::vector< BDS::MuonCoolerCoilInfo > BuildMuonCoolerCoilInfos(const GMAD::CoolingChannel &definition)
void MuonParamsToVector(const G4String &definitionName, const std::vector< const std::list< double > * > &params, const std::vector< std::string > &paramNames, G4int nExpectedParams, std::vector< std::vector< double > > &paramsV)
std::vector< BDS::SquareCheck > MuonCoolerSquaresFromCoils(const std::vector< BDS::MuonCoolerCoilInfo > &coilInfos)
Utility function to make SquareCheck instances from coil info.
std::vector< BDS::MuonCoolerAbsorberInfo > BuildMuonCoolerAbsorberInfo(const GMAD::CoolingChannel &definition)
No checks for overlaps for dipoles as we don't physically build them yet.
std::vector< BDS::SquareCheck > MuonCoolerSquaresFromCavities(const std::vector< BDS::MuonCoolerCavityInfo > &cavityInfos)
Utility function to make SquareCheck instances from cavity info.
Parser namespace for GMAD language. Combination of Geant4 and MAD.
A very simple struct to permit checking un-rotated (i.e. axis-aligned) square overlaps.