Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions
CML2AcceleratorConstruction Class Reference

#include <ML2AcceleratorConstruction.hh>

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
CML2AcceleratorConstruction
GetInstance (void)
 

Detailed Description

Definition at line 61 of file ML2AcceleratorConstruction.hh.

Constructor & Destructor Documentation

CML2AcceleratorConstruction::CML2AcceleratorConstruction ( void  )

Definition at line 47 of file ML2AcceleratorConstruction.cc.

Referenced by GetInstance().

48 {
49  acceleratorConstructionMessenger=new CML2AcceleratorConstructionMessenger(this);
50  idCurrentRotationX=0;
51 }
CML2AcceleratorConstruction::~CML2AcceleratorConstruction ( void  )

Definition at line 53 of file ML2AcceleratorConstruction.cc.

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

Member Function Documentation

void CML2AcceleratorConstruction::addAcceleratorRotationsX ( G4double  val)
inline

Definition at line 80 of file ML2AcceleratorConstruction.hh.

Referenced by CML2AcceleratorConstructionMessenger::SetNewValue().

80 {rotationsX.push_back(val);}
bool CML2AcceleratorConstruction::Construct ( G4VPhysicalVolume PVWorld,
G4bool  bOnlyVisio 
)

Definition at line 102 of file ML2AcceleratorConstruction.cc.

References CML2Acc1::Construct(), G4NistManager::FindOrBuildMaterial(), CML2Acc1::getBeforeJaws_Z_PhaseSpacePosition(), CLHEP::Hep3Vector::getX(), CLHEP::Hep3Vector::getY(), CLHEP::Hep3Vector::getZ(), G4NistManager::Instance(), python.hepunit::mm, CLHEP::Hep3Vector::set(), CML2AcceleratorConstructionMessenger::SetReferenceWorld(), G4VisAttributes::SetVisibility(), G4Colour::White(), and CML2Acc1::writeInfo().

Referenced by CML2WorldConstruction::create().

103 {
104 // a call to select the right accelerator
105  bOnlyVisio=bOV;
106  if (design())
107  {
108  acceleratorConstructionMessenger->SetReferenceWorld(bOnlyVisio);
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  {
126  accelerator1->Construct(PVAccWorld, isoCentre);
127  Z_Value_PhaseSpaceBeforeJaws=accelerator1->getBeforeJaws_Z_PhaseSpacePosition();
128  accelerator1->writeInfo();
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)
Definition: G4Box.hh:63
void SetVisibility(G4bool)
double getY() const
static G4NistManager * Instance()
double getX() const
void Construct(G4VPhysicalVolume *PVWorld, G4double isoCentre)
Definition: ML2Acc1.cc:156
void writeInfo()
Definition: ML2Acc1.cc:66
double getZ() const
G4double getBeforeJaws_Z_PhaseSpacePosition()
Definition: ML2Acc1.hh:81
static G4Colour White()
Definition: G4Colour.hh:143
G4double CML2AcceleratorConstruction::getAcceleratorIsoCentre ( )
inline

Definition at line 82 of file ML2AcceleratorConstruction.hh.

Referenced by CML2WorldConstruction::create(), and main().

82 {return isoCentre;}
G4String CML2AcceleratorConstruction::getAcceleratorMacFileName ( )
inline

Definition at line 84 of file ML2AcceleratorConstruction.hh.

84 {return AcceleratorMacFileName;}
G4String CML2AcceleratorConstruction::getAcceleratorName ( )
inline

Definition at line 83 of file ML2AcceleratorConstruction.hh.

Referenced by CML2WorldConstruction::create().

83 {return AcceleratorName;}
G4String CML2AcceleratorConstruction::getCurrentRotationString ( )

Definition at line 177 of file ML2AcceleratorConstruction.cc.

References python.hepunit::deg.

Referenced by CML2RunAction::BeginOfRunAction().

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
CML2AcceleratorConstruction * CML2AcceleratorConstruction::GetInstance ( void  )
static

Definition at line 63 of file ML2AcceleratorConstruction.cc.

References CML2AcceleratorConstruction().

Referenced by CML2RunAction::BeginOfRunAction(), CML2WorldConstruction::CML2WorldConstruction(), CML2SDWithParticle::ProcessHits(), and CML2SDWithParticle::save().

64 {
65  if (instance == 0)
66  {
67  instance = new CML2AcceleratorConstruction();
68  }
69  return instance;
70 }
G4String CML2AcceleratorConstruction::getNextAcceleratorXRotationName ( )
inline

Definition at line 76 of file ML2AcceleratorConstruction.hh.

76 {return nextAcceleratorXRotationName;}
G4VPhysicalVolume* CML2AcceleratorConstruction::getPhysicalVolume ( void  )
inline

Definition at line 68 of file ML2AcceleratorConstruction.hh.

Referenced by CML2WorldConstruction::create().

68 {return PVAccWorld;}
G4bool CML2AcceleratorConstruction::getRotation90Y ( )
inline

Definition at line 86 of file ML2AcceleratorConstruction.hh.

86 {return bRotate90Y;}
G4double CML2AcceleratorConstruction::getZ_Value_PhaseSpaceBeforeJaws ( )
inline

Definition at line 85 of file ML2AcceleratorConstruction.hh.

Referenced by CML2WorldConstruction::create().

85 {return Z_Value_PhaseSpaceBeforeJaws;}
void CML2AcceleratorConstruction::resetAccelerator ( )

Definition at line 72 of file ML2AcceleratorConstruction.cc.

References CML2Acc1::reset().

73 {
74  if (AcceleratorName=="acc1")
75  {
76  accelerator1->reset();
77  }
78 
79 }
void reset()
Definition: ML2Acc1.cc:172
G4RotationMatrix * CML2AcceleratorConstruction::rotateAccelerator ( )

Definition at line 145 of file ML2AcceleratorConstruction.cc.

Referenced by CML2WorldConstruction::newGeometry(), and CML2AcceleratorConstructionMessenger::SetNewValue().

146 {
147  G4RotationMatrix *rmInv=new G4RotationMatrix();
148  if (idCurrentRotationX <(int) rotationsX.size())
149  {
150  currentRotationX=rotationsX[idCurrentRotationX];
151  rmInv=rotateAccelerator(currentRotationX);
152  idCurrentRotationX++;
153  }
154  else
155  {rmInv=0;}
156  return rmInv;
157 }
CLHEP::HepRotation G4RotationMatrix
G4RotationMatrix * CML2AcceleratorConstruction::rotateAccelerator ( G4double  angleX)

Definition at line 158 of file ML2AcceleratorConstruction.cc.

References G4GeometryManager::CloseGeometry(), python.hepunit::deg, G4RunManager::GeometryHasBeenModified(), G4GeometryManager::GetInstance(), G4RunManager::GetRunManager(), CLHEP::inverseOf(), G4GeometryManager::OpenGeometry(), CLHEP::HepRotation::rotateX(), CLHEP::HepRotation::rotateY(), G4VPhysicalVolume::SetRotation(), and G4VPhysicalVolume::SetTranslation().

159 {
160  currentRotationX=angleX;
162  G4ThreeVector NewCentre;
164  G4RotationMatrix *rmInv=new G4RotationMatrix();
165  PVAccWorld->SetTranslation(initialCentre);
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)
void SetTranslation(const G4ThreeVector &v)
static G4GeometryManager * GetInstance()
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:74
void OpenGeometry(G4VPhysicalVolume *vol=0)
G4bool CloseGeometry(G4bool pOptimise=true, G4bool verbose=false, G4VPhysicalVolume *vol=0)
void CML2AcceleratorConstruction::setAcceleratorMacFileName ( G4String  val)
inline
void CML2AcceleratorConstruction::setAcceleratorName ( G4String  val)
inline
void CML2AcceleratorConstruction::setIsoCentre ( G4double  val)
inline
void CML2AcceleratorConstruction::setRotation90Y ( G4bool  val)
inline
void CML2AcceleratorConstruction::writeInfo ( )

Definition at line 138 of file ML2AcceleratorConstruction.cc.

References python.hepunit::deg, and G4endl.

Referenced by CML2RunAction::BeginOfRunAction().

139 {
140  if (!bOnlyVisio)
141  {std::cout <<"Actual rotation: "<<idCurrentRotationX<<"/"<<rotationsX.size() <<" "<< G4endl;}
142  std::cout <<"Accelerator angle: "<< currentRotationX/deg << " [deg]"<< G4endl;
143 }
#define G4endl
Definition: G4ios.hh:61

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