Geant4  10.02.p03
CML2AcceleratorConstruction Class Reference

#include <ML2AcceleratorConstruction.hh>

Collaboration diagram for CML2AcceleratorConstruction:

Public Member Functions

 CML2AcceleratorConstruction (void)
 
 ~CML2AcceleratorConstruction (void)
 
bool Construct (G4VPhysicalVolume *PVWorld, G4bool bOnlyVisio)
 
G4VPhysicalVolumegetPhysicalVolume (void)
 
void resetAccelerator ()
 
void setAcceleratorName (G4String val)
 
void setAcceleratorMacFileName (G4String val)
 
G4String getCurrentRotationString ()
 
G4String getNextAcceleratorXRotationName ()
 
void setIsoCentre (G4double val)
 
void setRotation90Y (G4bool val)
 
void addAcceleratorRotationsX (G4double val)
 
G4double getAcceleratorIsoCentre ()
 
G4String getAcceleratorName ()
 
G4String getAcceleratorMacFileName ()
 
G4double getZ_Value_PhaseSpaceBeforeJaws ()
 
G4bool getRotation90Y ()
 
void writeInfo ()
 
G4RotationMatrixrotateAccelerator ()
 
G4RotationMatrixrotateAccelerator (G4double angleX)
 

Static Public Member Functions

static CML2AcceleratorConstructionGetInstance (void)
 

Private Member Functions

bool design (void)
 

Private Attributes

CML2AcceleratorConstructionMessengeracceleratorConstructionMessenger
 
G4String AcceleratorName
 
G4String AcceleratorMacFileName
 
G4String nextAcceleratorXRotationName
 
G4VPhysicalVolumePVAccWorld
 
G4int idCurrentRotationX
 
G4double currentRotationX
 
G4double isoCentre
 
G4double Z_Value_PhaseSpaceBeforeJaws
 
std::vector< G4doublerotationsX
 
G4ThreeVector initialCentre
 
G4bool bRotate90Y
 
G4bool bOnlyVisio
 
CML2Acc1accelerator1
 

Static Private Attributes

static CML2AcceleratorConstructioninstance = 0
 

Detailed Description

Definition at line 61 of file ML2AcceleratorConstruction.hh.

Constructor & Destructor Documentation

◆ CML2AcceleratorConstruction()

CML2AcceleratorConstruction::CML2AcceleratorConstruction ( void  )

Definition at line 47 of file ML2AcceleratorConstruction.cc.

Here is the caller graph for this function:

◆ ~CML2AcceleratorConstruction()

CML2AcceleratorConstruction::~CML2AcceleratorConstruction ( void  )

Definition at line 53 of file ML2AcceleratorConstruction.cc.

54 {
55  if (AcceleratorName=="acc1")
56  {delete accelerator1;}
57 
58  delete PVAccWorld;
60 }
CML2AcceleratorConstructionMessenger * acceleratorConstructionMessenger

Member Function Documentation

◆ addAcceleratorRotationsX()

void CML2AcceleratorConstruction::addAcceleratorRotationsX ( G4double  val)
inline

Definition at line 80 of file ML2AcceleratorConstruction.hh.

80 {rotationsX.push_back(val);}
Here is the caller graph for this function:

◆ Construct()

bool CML2AcceleratorConstruction::Construct ( G4VPhysicalVolume PVWorld,
G4bool  bOnlyVisio 
)

Definition at line 102 of file ML2AcceleratorConstruction.cc.

103 {
104 // a call to select the right accelerator
105  bOnlyVisio=bOV;
106  if (design())
107  {
109  // create the accelerator-world box
110  G4Material *Vacuum=G4NistManager::Instance()->FindOrBuildMaterial("G4_Galactic");
111  G4ThreeVector halfSize;
112  initialCentre.set(0.*mm, 0.*mm, -isoCentre);
113  halfSize.set(600.*mm, 600.*mm, 600.*mm);
114  G4Box *accWorldB = new G4Box("accWorldG", halfSize.getX(), halfSize.getY(), halfSize.getZ());
115  G4LogicalVolume *accWorldLV = new G4LogicalVolume(accWorldB, Vacuum, "accWorldL", 0, 0, 0);
116  G4VisAttributes* simpleAlSVisAtt= new G4VisAttributes(G4Colour::White());
117  simpleAlSVisAtt->SetVisibility(false);
118 // simpleAlSVisAtt->SetForceWireframe(false);
119  accWorldLV->SetVisAttributes(simpleAlSVisAtt);
120 
121  PVAccWorld= new G4PVPlacement(0, initialCentre, "acceleratorBox", accWorldLV, PVWorld, false, 0);
122 
123  // create the actual accelerator
124  if (AcceleratorName=="acc1")
125  {
129  }
130  }
131  else
132  {
133  return false;
134  }
135  return true;
136 }
void set(double x, double y, double z)
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
CML2AcceleratorConstructionMessenger * acceleratorConstructionMessenger
Definition: G4Box.hh:64
void SetVisibility(G4bool)
static G4NistManager * Instance()
void Construct(G4VPhysicalVolume *PVWorld, G4double isoCentre)
Definition: ML2Acc1.cc:156
double getY() const
double getX() const
double getZ() const
void writeInfo()
Definition: ML2Acc1.cc:66
G4double getBeforeJaws_Z_PhaseSpacePosition()
Definition: ML2Acc1.hh:81
static const double mm
Definition: G4SIunits.hh:114
static G4Colour White()
Definition: G4Colour.hh:143
Here is the call graph for this function:
Here is the caller graph for this function:

◆ design()

bool CML2AcceleratorConstruction::design ( void  )
private

Definition at line 81 of file ML2AcceleratorConstruction.cc.

82 {
83 // switch between different accelerators according to the main macro selection (actually only one accelerator is available)
84  std::cout << "I'm building "<< AcceleratorName<<" accelerator"<< G4endl;
85  bool bAccExists=false;
86  if (AcceleratorName=="acc1")
87  {accelerator1=CML2Acc1::GetInstance();bAccExists=true;}
88 
89  if (bAccExists && AcceleratorMacFileName!="")
90  {
91  // read the messenger data related to the accelerator selected
93  G4String command = "/control/execute ";
95  }
96 
97  if (rotationsX.size()<1)
99 
100  return bAccExists;
101 }
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
#define G4endl
Definition: G4ios.hh:61
static CML2Acc1 * GetInstance(void)
Definition: ML2Acc1.cc:58
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:446
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAcceleratorIsoCentre()

G4double CML2AcceleratorConstruction::getAcceleratorIsoCentre ( )
inline

Definition at line 82 of file ML2AcceleratorConstruction.hh.

Here is the caller graph for this function:

◆ getAcceleratorMacFileName()

G4String CML2AcceleratorConstruction::getAcceleratorMacFileName ( )
inline

◆ getAcceleratorName()

G4String CML2AcceleratorConstruction::getAcceleratorName ( )
inline

Definition at line 83 of file ML2AcceleratorConstruction.hh.

Here is the caller graph for this function:

◆ getCurrentRotationString()

G4String CML2AcceleratorConstruction::getCurrentRotationString ( )

Definition at line 177 of file ML2AcceleratorConstruction.cc.

178 {
179  char cR[5];
180  G4int cRI=(G4int)((currentRotationX/deg)+.5);
181  sprintf(cR,"%d",cRI);
182  G4String rotationName=G4String(cR);
183  if (bRotate90Y)
184  {rotationName="_Ro90Y"+rotationName;}
185  else
186  {rotationName="_Ro"+rotationName;}
187  return rotationName;
188 }
int G4int
Definition: G4Types.hh:78
static const double deg
Definition: G4SIunits.hh:151
Here is the caller graph for this function:

◆ GetInstance()

CML2AcceleratorConstruction * CML2AcceleratorConstruction::GetInstance ( void  )
static

Definition at line 63 of file ML2AcceleratorConstruction.cc.

64 {
65  if (instance == 0)
66  {
68  }
69  return instance;
70 }
static CML2AcceleratorConstruction * instance
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getNextAcceleratorXRotationName()

G4String CML2AcceleratorConstruction::getNextAcceleratorXRotationName ( )
inline

◆ getPhysicalVolume()

G4VPhysicalVolume* CML2AcceleratorConstruction::getPhysicalVolume ( void  )
inline

Definition at line 68 of file ML2AcceleratorConstruction.hh.

68 {return PVAccWorld;}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getRotation90Y()

G4bool CML2AcceleratorConstruction::getRotation90Y ( )
inline

Definition at line 86 of file ML2AcceleratorConstruction.hh.

Here is the call graph for this function:

◆ getZ_Value_PhaseSpaceBeforeJaws()

G4double CML2AcceleratorConstruction::getZ_Value_PhaseSpaceBeforeJaws ( )
inline

Definition at line 85 of file ML2AcceleratorConstruction.hh.

Here is the caller graph for this function:

◆ resetAccelerator()

void CML2AcceleratorConstruction::resetAccelerator ( )

Definition at line 72 of file ML2AcceleratorConstruction.cc.

73 {
74  if (AcceleratorName=="acc1")
75  {
77  }
78 
79 }
void reset()
Definition: ML2Acc1.cc:172
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rotateAccelerator() [1/2]

G4RotationMatrix * CML2AcceleratorConstruction::rotateAccelerator ( )

Definition at line 145 of file ML2AcceleratorConstruction.cc.

146 {
147  G4RotationMatrix *rmInv=new G4RotationMatrix();
148  if (idCurrentRotationX <(int) rotationsX.size())
149  {
153  }
154  else
155  {rmInv=0;}
156  return rmInv;
157 }
CLHEP::HepRotation G4RotationMatrix
Here is the caller graph for this function:

◆ rotateAccelerator() [2/2]

G4RotationMatrix * CML2AcceleratorConstruction::rotateAccelerator ( G4double  angleX)

Definition at line 158 of file ML2AcceleratorConstruction.cc.

159 {
160  currentRotationX=angleX;
162  G4ThreeVector NewCentre;
164  G4RotationMatrix *rmInv=new G4RotationMatrix();
166  PVAccWorld->SetRotation(rm);
167  if (bRotate90Y) {rm->rotateY(90.*deg);}
168  rm->rotateX(-angleX);
169  PVAccWorld->SetRotation(rm);
170  *rmInv=CLHEP::inverseOf(*rm);
171  NewCentre=*rmInv*initialCentre;
172  PVAccWorld->SetTranslation(NewCentre);
175  return rmInv;
176 }
void GeometryHasBeenModified(G4bool prop=true)
HepRotation & rotateX(double delta)
Definition: Rotation.cc:66
CLHEP::HepRotation G4RotationMatrix
HepRotation & rotateY(double delta)
Definition: Rotation.cc:79
void SetRotation(G4RotationMatrix *)
HepBoost inverseOf(const HepBoost &lt)
static const double deg
Definition: G4SIunits.hh:151
void SetTranslation(const G4ThreeVector &v)
static G4GeometryManager * GetInstance()
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:79
void OpenGeometry(G4VPhysicalVolume *vol=0)
G4bool CloseGeometry(G4bool pOptimise=true, G4bool verbose=false, G4VPhysicalVolume *vol=0)
Here is the call graph for this function:

◆ setAcceleratorMacFileName()

void CML2AcceleratorConstruction::setAcceleratorMacFileName ( G4String  val)
inline

Definition at line 72 of file ML2AcceleratorConstruction.hh.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setAcceleratorName()

void CML2AcceleratorConstruction::setAcceleratorName ( G4String  val)
inline

Definition at line 71 of file ML2AcceleratorConstruction.hh.

Here is the caller graph for this function:

◆ setIsoCentre()

void CML2AcceleratorConstruction::setIsoCentre ( G4double  val)
inline

Definition at line 77 of file ML2AcceleratorConstruction.hh.

Here is the caller graph for this function:

◆ setRotation90Y()

void CML2AcceleratorConstruction::setRotation90Y ( G4bool  val)
inline

Definition at line 78 of file ML2AcceleratorConstruction.hh.

Here is the caller graph for this function:

◆ writeInfo()

void CML2AcceleratorConstruction::writeInfo ( )

Definition at line 138 of file ML2AcceleratorConstruction.cc.

139 {
140  if (!bOnlyVisio)
141  {std::cout <<"Actual rotation: "<<idCurrentRotationX<<"/"<<rotationsX.size() <<" "<< G4endl;}
142  std::cout <<"Accelerator angle: "<< currentRotationX/deg << " [deg]"<< G4endl;
143 }
static const double deg
Definition: G4SIunits.hh:151
#define G4endl
Definition: G4ios.hh:61
Here is the caller graph for this function:

Member Data Documentation

◆ accelerator1

CML2Acc1* CML2AcceleratorConstruction::accelerator1
private

Definition at line 106 of file ML2AcceleratorConstruction.hh.

◆ acceleratorConstructionMessenger

CML2AcceleratorConstructionMessenger* CML2AcceleratorConstruction::acceleratorConstructionMessenger
private

Definition at line 94 of file ML2AcceleratorConstruction.hh.

◆ AcceleratorMacFileName

G4String CML2AcceleratorConstruction::AcceleratorMacFileName
private

Definition at line 96 of file ML2AcceleratorConstruction.hh.

◆ AcceleratorName

G4String CML2AcceleratorConstruction::AcceleratorName
private

Definition at line 96 of file ML2AcceleratorConstruction.hh.

◆ bOnlyVisio

G4bool CML2AcceleratorConstruction::bOnlyVisio
private

Definition at line 103 of file ML2AcceleratorConstruction.hh.

◆ bRotate90Y

G4bool CML2AcceleratorConstruction::bRotate90Y
private

Definition at line 103 of file ML2AcceleratorConstruction.hh.

◆ currentRotationX

G4double CML2AcceleratorConstruction::currentRotationX
private

Definition at line 100 of file ML2AcceleratorConstruction.hh.

◆ idCurrentRotationX

G4int CML2AcceleratorConstruction::idCurrentRotationX
private

Definition at line 99 of file ML2AcceleratorConstruction.hh.

◆ initialCentre

G4ThreeVector CML2AcceleratorConstruction::initialCentre
private

Definition at line 102 of file ML2AcceleratorConstruction.hh.

◆ instance

CML2AcceleratorConstruction * CML2AcceleratorConstruction::instance = 0
staticprivate

Definition at line 95 of file ML2AcceleratorConstruction.hh.

◆ isoCentre

G4double CML2AcceleratorConstruction::isoCentre
private

Definition at line 100 of file ML2AcceleratorConstruction.hh.

◆ nextAcceleratorXRotationName

G4String CML2AcceleratorConstruction::nextAcceleratorXRotationName
private

Definition at line 96 of file ML2AcceleratorConstruction.hh.

◆ PVAccWorld

G4VPhysicalVolume* CML2AcceleratorConstruction::PVAccWorld
private

Definition at line 98 of file ML2AcceleratorConstruction.hh.

◆ rotationsX

std::vector<G4double> CML2AcceleratorConstruction::rotationsX
private

Definition at line 101 of file ML2AcceleratorConstruction.hh.

◆ Z_Value_PhaseSpaceBeforeJaws

G4double CML2AcceleratorConstruction::Z_Value_PhaseSpaceBeforeJaws
private

Definition at line 100 of file ML2AcceleratorConstruction.hh.


The documentation for this class was generated from the following files: