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

#include <ML2WorldConstruction.hh>

Inheritance diagram for CML2WorldConstruction:
G4VUserDetectorConstruction

Public Member Functions

 CML2WorldConstruction (void)
 
 ~CML2WorldConstruction (void)
 
G4VPhysicalVolumeConstruct ()
 
bool create (SInputData *inputData, bool bOnlyVisio)
 
G4int getNParticleBackScattered ()
 
G4int getNParticlePhaseSpace ()
 
G4int getTotalNumberOfEventsInPhantom ()
 
CML2AcceleratorConstructiongetCML2AcceleratorConstruction ()
 
bool newGeometry ()
 
bool getWorldCreated ()
 
void savePhantomData ()
 
void savePhaseSpaceData ()
 
CML2PhantomConstructiongetPhantomWorld ()
 
CML2AcceleratorConstructiongetAcceleratorWorld ()
 
void checkVolumeOverlap ()
 
G4bool getbOnlyVisio ()
 
- Public Member Functions inherited from G4VUserDetectorConstruction
 G4VUserDetectorConstruction ()
 
virtual ~G4VUserDetectorConstruction ()
 
virtual void ConstructSDandField ()
 
virtual void CloneSD ()
 
virtual void CloneF ()
 
void RegisterParallelWorld (G4VUserParallelWorld *)
 
G4int ConstructParallelGeometries ()
 
void ConstructParallelSD ()
 
G4int GetNumberOfParallelWorld () const
 
G4VUserParallelWorldGetParallelWorld (G4int i) const
 

Static Public Member Functions

static CML2WorldConstructionGetInstance (void)
 

Additional Inherited Members

- Protected Member Functions inherited from G4VUserDetectorConstruction
void SetSensitiveDetector (const G4String &logVolName, G4VSensitiveDetector *aSD, G4bool multi=false)
 
void SetSensitiveDetector (G4LogicalVolume *logVol, G4VSensitiveDetector *aSD)
 

Detailed Description

Definition at line 73 of file ML2WorldConstruction.hh.

Constructor & Destructor Documentation

CML2WorldConstruction::CML2WorldConstruction ( void  )

Definition at line 46 of file ML2WorldConstruction.cc.

References CML2PhantomConstruction::GetInstance(), and CML2AcceleratorConstruction::GetInstance().

Referenced by GetInstance().

46  :acceleratorEnv(0),phantomEnv(0),PVWorld(0),phaseSpace(0),backScatteredPlane(0)
47 {
50  bWorldCreated=false;
51 }
static CML2AcceleratorConstruction * GetInstance(void)
static CML2PhantomConstruction * GetInstance(void)
CML2WorldConstruction::~CML2WorldConstruction ( void  )

Definition at line 53 of file ML2WorldConstruction.cc.

54 {
55  delete PVWorld;
56  delete phantomEnv;
57  delete acceleratorEnv;
58  delete phaseSpace;
59  delete backScatteredPlane;
60 }

Member Function Documentation

void CML2WorldConstruction::checkVolumeOverlap ( )

Definition at line 122 of file ML2WorldConstruction.cc.

References G4VPhysicalVolume::CheckOverlaps(), G4endl, G4LogicalVolume::GetDaughter(), G4VPhysicalVolume::GetLogicalVolume(), G4LogicalVolume::GetNoDaughters(), and int().

Referenced by main().

123 {
124  // loop inside all the daughters volumes
125  std::cout<< G4endl;
126  // bool bCheckOverlap;
127  // bCheckOverlap=false;
128 
129  int nSubWorlds, nSubWorlds2;
130  for (int i=0; i<(int) PVWorld->GetLogicalVolume()->GetNoDaughters(); i++)
131  {
132  PVWorld->GetLogicalVolume()->GetDaughter(i)->CheckOverlaps();
133  nSubWorlds=(int) PVWorld->GetLogicalVolume()->GetDaughter(i)->GetLogicalVolume()->GetNoDaughters();
134  for (int j=0; j<nSubWorlds; j++)
135  {
138  for (int k=0; k<nSubWorlds2; k++)
139  {
141  }
142  }
143  }
144  std::cout<< G4endl;
145 }
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
G4VPhysicalVolume * GetDaughter(const G4int i) const
G4int GetNoDaughters() const
G4LogicalVolume * GetLogicalVolume() const
#define G4endl
Definition: G4ios.hh:61
virtual G4bool CheckOverlaps(G4int res=1000, G4double tol=0., G4bool verbose=true, G4int errMax=1)
G4VPhysicalVolume * CML2WorldConstruction::Construct ( void  )
virtual

Implements G4VUserDetectorConstruction.

Definition at line 73 of file ML2WorldConstruction.cc.

74 {
75  return PVWorld;
76 }
bool CML2WorldConstruction::create ( SInputData inputData,
bool  bOnlyVisio 
)

Definition at line 78 of file ML2WorldConstruction.cc.

References SGeneralData::bForcePhaseSpaceBeforeJaws, G4Colour::Black(), SGeneralData::bSavePhaseSpace, SGeneralData::bSaveROG, SGeneralData::bStopAtPhaseSpace, SGeneralData::centrePhaseSpace, CML2PhantomConstruction::Construct(), CML2AcceleratorConstruction::Construct(), CML2PhaseSpaces::createPlane(), G4NistManager::FindOrBuildMaterial(), G4endl, SInputData::generalData, CML2AcceleratorConstruction::getAcceleratorIsoCentre(), CML2AcceleratorConstruction::getAcceleratorName(), CML2PhantomConstruction::getPhantomName(), CML2AcceleratorConstruction::getPhysicalVolume(), CML2AcceleratorConstruction::getZ_Value_PhaseSpaceBeforeJaws(), SGeneralData::halfSizePhaseSpace, idSD_PhaseSpace, G4NistManager::Instance(), SGeneralData::max_N_particles_in_PhSp_File, python.hepunit::mm, SGeneralData::nMaxParticlesInRamPlanePhaseSpace, SGeneralData::PhaseSpaceOutFile, SInputData::primaryParticleData, SGeneralData::ROGOutFile, SGeneralData::saving_in_ROG_Voxels_every_events, SGeneralData::seed, G4LogicalVolume::SetVisAttributes(), G4VisAttributes::SetVisibility(), CLHEP::Hep3Vector::setZ(), and SGeneralData::StartFileInputData.

Referenced by main().

79 {
80  // create the world box
81  bOnlyVisio=bOV;
82  G4double halfSize=3000.*mm;
83  G4Material *Vacuum=G4NistManager::Instance()->FindOrBuildMaterial("G4_Galactic");
84  G4Box *worldB = new G4Box("worldG", halfSize, halfSize, halfSize);
85  G4LogicalVolume *worldLV = new G4LogicalVolume(worldB, Vacuum, "worldL", 0, 0, 0);
86  G4VisAttributes* simpleWorldVisAtt= new G4VisAttributes(G4Colour::Black());
87  simpleWorldVisAtt->SetVisibility(false);
88  // simpleWorldVisAtt->SetForceSolid(false);
89  worldLV->SetVisAttributes(simpleWorldVisAtt);
90  PVWorld= new G4PVPlacement(0, G4ThreeVector(0.,0.,0.), "worldPV", worldLV, 0, false, 0);
91 
92  // create the accelerator-world box
93  if (!acceleratorEnv->Construct(PVWorld, bOV))
94  {
95  std::cout <<"\n\n The macro file '"<<inputData->generalData.StartFileInputData<<"' refers to a not defined accelerator.\n"<< acceleratorEnv->getAcceleratorName()<<"\n\nSTOP\n\n" << G4endl;
96  return false;
97  }
98 
99  // create the phantom-world box
100  if (!phantomEnv->Construct(PVWorld, inputData->generalData.saving_in_ROG_Voxels_every_events, inputData->generalData.seed, inputData->generalData.ROGOutFile, inputData->generalData.bSaveROG, bOV))
101  {
102  std::cout <<"\n\n The macro file '"<<inputData->generalData.StartFileInputData<<"' refers to a not defined phantom.\n"<< phantomEnv->getPhantomName()<<"\n\nSTOP\n\n" << G4endl;
103  return false;
104  }
105 
106  // if the bSavePhaseSpace flag is true create a phase plane
107  if (inputData->generalData.bSavePhaseSpace)
108  {
109  phaseSpace=new CML2PhaseSpaces();
111  {inputData->generalData.centrePhaseSpace.setZ(acceleratorEnv->getZ_Value_PhaseSpaceBeforeJaws());}
113  }
114 
115  // create a killer plane to destroy the particles back scattered from the target
116  backScatteredPlane=new CML2PhaseSpaces();
117  backScatteredPlane->createPlane(acceleratorEnv->getPhysicalVolume(), "killerPlane", G4ThreeVector(0, 0, -50*mm), G4ThreeVector(200*mm, 200*mm, 1*mm));
118 
119  bWorldCreated=true;
120  return true;
121 }
G4ThreeVector centrePhaseSpace
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
G4int nMaxParticlesInRamPlanePhaseSpace
CLHEP::Hep3Vector G4ThreeVector
bool Construct(G4VPhysicalVolume *PVWorld, G4int saving_in_ROG_Voxels_every_events, G4int seed, G4String ROGOutFile, G4bool bSaveROG, G4bool bOnlyVisio)
Definition: G4Box.hh:63
G4VPhysicalVolume * getPhysicalVolume(void)
void SetVisibility(G4bool)
static G4NistManager * Instance()
static G4Colour Black()
Definition: G4Colour.hh:146
void setZ(double)
G4String StartFileInputData
G4bool bStopAtPhaseSpace
G4bool bForcePhaseSpaceBeforeJaws
G4bool bSavePhaseSpace
SPrimaryParticle primaryParticleData
bool Construct(G4VPhysicalVolume *PVWorld, G4bool bOnlyVisio)
SGeneralData generalData
int max_N_particles_in_PhSp_File
int saving_in_ROG_Voxels_every_events
G4ThreeVector halfSizePhaseSpace
G4String ROGOutFile
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
bool createPlane(G4VPhysicalVolume *PVWorld, G4String name, G4ThreeVector centre, G4ThreeVector halfSize)
void SetVisAttributes(const G4VisAttributes *pVA)
G4String PhaseSpaceOutFile
CML2AcceleratorConstruction* CML2WorldConstruction::getAcceleratorWorld ( )
inline

Definition at line 92 of file ML2WorldConstruction.hh.

92 {return acceleratorEnv;}
G4bool CML2WorldConstruction::getbOnlyVisio ( )
inline

Definition at line 95 of file ML2WorldConstruction.hh.

95 {return bOnlyVisio;}
CML2AcceleratorConstruction* CML2WorldConstruction::getCML2AcceleratorConstruction ( )
inline

Definition at line 84 of file ML2WorldConstruction.hh.

Referenced by main().

84 {return acceleratorEnv;}
CML2WorldConstruction * CML2WorldConstruction::GetInstance ( void  )
static

Definition at line 64 of file ML2WorldConstruction.cc.

References CML2WorldConstruction().

Referenced by CML2RunAction::EndOfRunAction(), and main().

65 {
66  if (instance == 0)
67  {
68  instance = new CML2WorldConstruction();
69  }
70  return instance;
71 }
G4int CML2WorldConstruction::getNParticleBackScattered ( )
inline

Definition at line 81 of file ML2WorldConstruction.hh.

References CML2PhaseSpaces::getCML2SensDetNParticle().

81 {return backScatteredPlane->getCML2SensDetNParticle();}
G4int getCML2SensDetNParticle()
G4int CML2WorldConstruction::getNParticlePhaseSpace ( )
inline

Definition at line 82 of file ML2WorldConstruction.hh.

References CML2PhaseSpaces::getCML2SensDetNParticle().

82 {return phaseSpace->getCML2SensDetNParticle();}
G4int getCML2SensDetNParticle()
CML2PhantomConstruction* CML2WorldConstruction::getPhantomWorld ( )
inline

Definition at line 91 of file ML2WorldConstruction.hh.

91 {return phantomEnv;}
G4int CML2WorldConstruction::getTotalNumberOfEventsInPhantom ( )
inline

Definition at line 83 of file ML2WorldConstruction.hh.

References CML2PhantomConstruction::getTotalNumberOfEvents().

83 {return phantomEnv->getTotalNumberOfEvents();}
bool CML2WorldConstruction::getWorldCreated ( )
inline

Definition at line 87 of file ML2WorldConstruction.hh.

87 {return bWorldCreated;}
bool CML2WorldConstruction::newGeometry ( )

Definition at line 146 of file ML2WorldConstruction.cc.

References CML2PhantomConstruction::applyNewCentre(), CML2PrimaryGenerationAction::GetInstance(), CML2AcceleratorConstruction::rotateAccelerator(), and CML2PrimaryGenerationAction::setRotation().

Referenced by main().

147 {
148  G4bool bNewRotation=false;
149  G4bool bNewCentre=false;
150  G4bool bNewGeometry=false;
151  bNewCentre=phantomEnv->applyNewCentre();
152  G4RotationMatrix *rmInv=acceleratorEnv->rotateAccelerator();
153  if (rmInv!=0)
154  {
156  bNewRotation=true;
157  }
158  if (bNewRotation || bNewCentre){bNewGeometry=true;}
159  return bNewGeometry;
160 }
bool G4bool
Definition: G4Types.hh:79
void setRotation(G4RotationMatrix *val)
static CML2PrimaryGenerationAction * GetInstance(void)
void applyNewCentre(G4ThreeVector val)
void CML2WorldConstruction::savePhantomData ( )
inline

Definition at line 89 of file ML2WorldConstruction.hh.

References CML2PhantomConstruction::saveData().

Referenced by CML2RunAction::EndOfRunAction().

89 {if (phantomEnv!=0){phantomEnv->saveData();}}
void CML2WorldConstruction::savePhaseSpaceData ( )
inline

Definition at line 90 of file ML2WorldConstruction.hh.

References CML2PhaseSpaces::save().

Referenced by CML2RunAction::EndOfRunAction().

90 {if (phaseSpace!=0){phaseSpace->save();}}

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