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) BDSIM Collaboration, 2001 - 2026.
3
4This file is part of BDSIM.
5
6BDSIM is free software: you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published
8by the Free Software Foundation version 3 of the License.
9
10BDSIM is distributed in the hope that it will be useful, but
11WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with BDSIM. If not, see <http://www.gnu.org/licenses/>.
17*/
18#ifndef BDSMUONCOOLERBUILDER_H
19#define BDSMUONCOOLERBUILDER_H
20
21#include <vector>
22
23class BDSBeamPipeInfo;
24class BDSMuonCooler;
25namespace GMAD
26{
27 class CoolingChannel;
28 struct Element;
29}
30
31namespace BDS
32{
33 struct MuonCoolerCoilInfo; // forward declaration
34 struct MuonCoolerDipoleInfo;
35 struct MuonCoolerCavityInfo;
36 struct MuonCoolerAbsorberInfo;
37 struct SquareCheck;
38
43 BDSMuonCooler* BuildMuonCooler(const G4String& elementName,
44 G4double chordLength,
45 G4double horizontalWidth,
46 const GMAD::CoolingChannel& definition,
47 BDSBeamPipeInfo* beamPipeInfo,
48 G4double designRigidity);
49
53 std::vector<BDS::MuonCoolerCoilInfo> BuildMuonCoolerCoilInfos(const GMAD::CoolingChannel& definition);
54
58 void CheckMuonCoolerCoilInfosForOverlaps(const G4String& definitionName,
59 const G4String& elementName,
60 const std::vector<BDS::SquareCheck>& coilSquares,
61 G4double elementChordLength,
62 G4double elementRadius);
63
64 std::vector<BDS::MuonCoolerDipoleInfo> BuildMuonCoolerDipoleInfos(const GMAD::CoolingChannel& definition);
66
67 std::vector<BDS::MuonCoolerAbsorberInfo> BuildMuonCoolerAbsorberInfo(const GMAD::CoolingChannel& definition);
68 void CheckMuonCoolerAbsorberInfoForOverlaps(const G4String& definitionName,
69 const G4String& elementName,
70 const std::vector<BDS::MuonCoolerAbsorberInfo>& absorberInfos,
71 const std::vector<BDS::SquareCheck>& cavitySquares,
72 const std::vector<BDS::SquareCheck>& coilSquares,
73 G4double elementChordLength,
74 G4double elementRadius);
75
76 std::vector<BDS::MuonCoolerCavityInfo> BuildMuonCoolerCavityInfos(const GMAD::CoolingChannel& definition);
77 void CheckMuonCoolerCavityInfosForOverlaps(const G4String& definitionName,
78 const G4String& elementName,
79 const std::vector<BDS::SquareCheck>& cavitySquares,
80 const std::vector<BDS::SquareCheck>& coilSquares,
81 G4double elementChordLength,
82 G4double elementRadius);
83
89 {
90 G4double z1;
91 G4double z2;
92 G4double r1;
93 G4double r2;
94
95 G4bool Overlaps(const SquareCheck& o) const
96 {
97 G4bool zOK = (o.z1 > z2 || o.z1 < z1) && (o.z2 > z2 || o.z2 < z1) && (o.z2 > o.z1);
98 G4bool rOK = (o.r1 > r2 || o.r1 < r1) && (o.r2 > r2 || o.r2 < r1) && (o.r2 > o.r1);
99 return !zOK && !rOK;
100 }
101 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)";}
102 };
103
105 std::vector<BDS::SquareCheck> MuonCoolerSquaresFromCoils(const std::vector<BDS::MuonCoolerCoilInfo>& coilInfos);
107 std::vector<BDS::SquareCheck> MuonCoolerSquaresFromCavities(const std::vector<BDS::MuonCoolerCavityInfo>& cavityInfos);
110 void MuonParamsToVector(const G4String& definitionName,
111 const std::vector<const std::list<double>*>& params,
112 const std::vector<std::string>& paramNames,
113 G4int nExpectedParams,
114 std::vector<std::vector<double>>& paramsV);
115
119 void MuonParamsToMaterials(const G4String& definitionName,
120 const G4String& variableName,
121 const std::list<std::string>& materialNames,
122 G4int nExpectedParams,
123 std::vector<G4Material*>& materials);
124
125 BDSFieldInfo* BuildMuonCoolerFieldRecipe(const G4String& definitionName,
126 G4double designRigidity,
127 const G4String& integrator,
128 const G4String& magneticFieldModel,
129 const G4String& electricFieldModel,
130 const G4String& dipoleFieldModel,
131 const std::vector<BDS::MuonCoolerCoilInfo>& coilInfos,
132 const std::vector<BDS::MuonCoolerDipoleInfo>& dipoleInfos,
133 const std::vector<BDS::MuonCoolerCavityInfo>& cavityInfos);
134}
135
136#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.