Geant4  10.02.p03
CML2PhantomConstruction Class Reference

#include <ML2PhantomConstruction.hh>

Collaboration diagram for CML2PhantomConstruction:

Public Member Functions

 CML2PhantomConstruction (void)
 
 ~CML2PhantomConstruction (void)
 
bool Construct (G4VPhysicalVolume *PVWorld, G4int saving_in_ROG_Voxels_every_events, G4int seed, G4String ROGOutFile, G4bool bSaveROG, G4bool bOnlyVisio)
 
G4int getTotalNumberOfEvents ()
 
G4String getPhantomName ()
 
void setPhantomName (G4String val)
 
void setPhantomFileName (G4String val)
 
void setNewName ()
 
void setNewName (G4String val)
 
void applyNewCentre (G4ThreeVector val)
 
bool applyNewCentre ()
 
void saveData ()
 
void addNewCentre (G4ThreeVector val)
 
void writeInfo ()
 
G4String getCurrentTranslationString ()
 
void resetSensDet ()
 

Static Public Member Functions

static CML2PhantomConstructionGetInstance (void)
 

Private Member Functions

bool design (void)
 
void createPhysicalVolumeNamesList (G4String *matNames, G4int nMatNames)
 
void createPhysicalVolumeNamesList (G4VPhysicalVolume *PV)
 

Private Attributes

CML2PhantomConstructionMessengerphantomContstructionMessenger
 
G4String phantomName
 
G4String PhantomFileName
 
G4VPhysicalVolumePVPhmWorld
 
CML2SDWithVoxelssensDet
 
std::vector< SvolumeNameIdvolumeNameIdLink
 
G4int idVolumeName
 
G4ThreeVector halfPhantomInsideSize
 
G4ThreeVector currentCentre
 
std::vector< G4ThreeVectorcentre
 
G4int idCurrentCentre
 
CML2Ph_FullWaterPh_fullWater
 
CML2Ph_BoxInBoxPh_BoxInBox
 
G4bool bOnlyVisio
 

Static Private Attributes

static CML2PhantomConstructioninstance = 0
 

Detailed Description

Definition at line 60 of file ML2PhantomConstruction.hh.

Constructor & Destructor Documentation

◆ CML2PhantomConstruction()

CML2PhantomConstruction::CML2PhantomConstruction ( void  )

Definition at line 47 of file ML2PhantomConstruction.cc.

Here is the caller graph for this function:

◆ ~CML2PhantomConstruction()

CML2PhantomConstruction::~CML2PhantomConstruction ( void  )

Definition at line 53 of file ML2PhantomConstruction.cc.

54 {
55  if (phantomName=="fullWater")
56  {
57  delete Ph_fullWater;
58  }
59  else if (phantomName=="boxInBox")
60  {
61  delete Ph_BoxInBox;
62  }
63 }

Member Function Documentation

◆ addNewCentre()

void CML2PhantomConstruction::addNewCentre ( G4ThreeVector  val)
inline

Definition at line 79 of file ML2PhantomConstruction.hh.

79 {centre.push_back(val);}
std::vector< G4ThreeVector > centre
Here is the call graph for this function:
Here is the caller graph for this function:

◆ applyNewCentre() [1/2]

void CML2PhantomConstruction::applyNewCentre ( G4ThreeVector  val)

Definition at line 208 of file ML2PhantomConstruction.cc.

209 {
210  if (sensDet!=0)
211  {
212  currentCentre=ctr;
219  }
220 }
void GeometryHasBeenModified(G4bool prop=true)
void SetTranslation(const G4ThreeVector &v)
static G4GeometryManager * GetInstance()
G4VPhysicalVolume * GetROWorld() const
G4VPhysicalVolume * PVPhmWorld
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:79
G4VPhysicalVolume * GetDaughter(const G4int i) const
void OpenGeometry(G4VPhysicalVolume *vol=0)
G4VReadOutGeometry * GetROgeometry() const
G4LogicalVolume * GetLogicalVolume() const
G4bool CloseGeometry(G4bool pOptimise=true, G4bool verbose=false, G4VPhysicalVolume *vol=0)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ applyNewCentre() [2/2]

bool CML2PhantomConstruction::applyNewCentre ( )

Definition at line 191 of file ML2PhantomConstruction.cc.

192 {
193  if (idCurrentCentre <(int) centre.size())
194  {
197  idCurrentCentre++;
198  return true;
199  }
200  return false;
201 }
std::vector< G4ThreeVector > centre
Here is the caller graph for this function:

◆ Construct()

bool CML2PhantomConstruction::Construct ( G4VPhysicalVolume PVWorld,
G4int  saving_in_ROG_Voxels_every_events,
G4int  seed,
G4String  ROGOutFile,
G4bool  bSaveROG,
G4bool  bOnlyVisio 
)

Definition at line 107 of file ML2PhantomConstruction.cc.

110 {
111  idVolumeName=0;
112  bOnlyVisio=bOV;
113 // a call to select the right phantom
114  if(design())
115  {
116  phantomContstructionMessenger->SetReferenceWorld(bOV); // create the phantom-world box
117  G4Material *Vacuum=G4NistManager::Instance()->FindOrBuildMaterial("G4_Galactic");
118 
120  G4LogicalVolume *phmWorldLV = new G4LogicalVolume(phmWorldB, Vacuum, "phmWorldL", 0, 0, 0);
121  G4VisAttributes* simpleAlSVisAtt= new G4VisAttributes(G4Colour::White());
122  simpleAlSVisAtt->SetVisibility(false);
123 // simpleAlSVisAtt->SetForceWireframe(false);
124  phmWorldLV->SetVisAttributes(simpleAlSVisAtt);
125 
126 
127  PVPhmWorld= new G4PVPlacement(0, G4ThreeVector(0.,0.,0.), "phmWorldPV", phmWorldLV, PVWorld, false, 0);
128 
129  // create the actual phantom
130  if (phantomName=="fullWater")
131  {
132  Ph_fullWater->Construct(PVPhmWorld, saving_in_ROG_Voxels_every_events, seed, ROGOutFile, bSaveROG);
136  }
137  else if (phantomName=="boxInBox")
138  {
139  Ph_BoxInBox->Construct(PVPhmWorld, saving_in_ROG_Voxels_every_events, seed, ROGOutFile, bSaveROG);
143  }
144  // I create the data base volumeName-volumeID in the sensitive detector
145 
147  }
148  else
149  {
150  return false;
151  }
152  return true;
153 }
CML2SDWithVoxels * getSensDet()
void setVolumeNameIdLink(std::vector< SvolumeNameId > volNameIdLink)
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
CLHEP::Hep3Vector G4ThreeVector
Definition: G4Box.hh:64
void SetVisibility(G4bool)
G4VPhysicalVolume * getPhysicalVolume()
static G4NistManager * Instance()
double getY() const
double getX() const
double getZ() const
G4VPhysicalVolume * getPhysicalVolume()
G4VPhysicalVolume * PVPhmWorld
CML2SDWithVoxels * getSensDet()
bool Construct(G4VPhysicalVolume *PVWorld, G4int saving_in_ROG_Voxels_every_events, G4int seed, G4String ROGOutFile, G4bool bSaveROG)
void createPhysicalVolumeNamesList(G4String *matNames, G4int nMatNames)
bool Construct(G4VPhysicalVolume *PVWorld, G4int saving_in_ROG_Voxels_every_events, G4int seed, G4String ROGOutFile, G4bool bSaveROG)
std::vector< SvolumeNameId > volumeNameIdLink
CML2PhantomConstructionMessenger * phantomContstructionMessenger
static G4Colour White()
Definition: G4Colour.hh:143
Here is the call graph for this function:
Here is the caller graph for this function:

◆ createPhysicalVolumeNamesList() [1/2]

void CML2PhantomConstruction::createPhysicalVolumeNamesList ( G4String matNames,
G4int  nMatNames 
)
private

Definition at line 154 of file ML2PhantomConstruction.cc.

155 {
156  SvolumeNameId svnid;
157  for (int i=0;i< nMatNames; i++)
158  {
159  svnid.volumeId=i;
160  svnid.volumeName=matNames[i];
161  volumeNameIdLink.push_back(svnid);
162  }
163 }
G4String volumeName
std::vector< SvolumeNameId > volumeNameIdLink
Here is the caller graph for this function:

◆ createPhysicalVolumeNamesList() [2/2]

void CML2PhantomConstruction::createPhysicalVolumeNamesList ( G4VPhysicalVolume PV)
private

Definition at line 164 of file ML2PhantomConstruction.cc.

165 {
166  int nLVD1;
167  nLVD1=(int) PV->GetLogicalVolume()->GetNoDaughters();
168  SvolumeNameId svnid;
169  std::cout << "PV in name: " <<PV->GetName() << G4endl;
170  if (nLVD1>0)
171  {
172  for (int i=0; i <nLVD1; i++)
173  {
175  }
176  idVolumeName++;
177  svnid.volumeId=idVolumeName;
179  volumeNameIdLink.push_back(svnid);
180  std::cout << "physical volume name: " <<svnid.volumeName << G4endl;
181  }
182  else
183  {
184  idVolumeName++;
185  svnid.volumeId=idVolumeName;
187  volumeNameIdLink.push_back(svnid);
188  std::cout << "physical volume name: " <<svnid.volumeName << G4endl;
189  }
190 }
G4int GetNoDaughters() const
G4Material * GetMaterial() const
G4String volumeName
const G4String & GetName() const
void createPhysicalVolumeNamesList(G4String *matNames, G4int nMatNames)
std::vector< SvolumeNameId > volumeNameIdLink
#define G4endl
Definition: G4ios.hh:61
G4VPhysicalVolume * GetDaughter(const G4int i) const
G4LogicalVolume * GetLogicalVolume() const
const G4String & GetName() const
Definition: G4Material.hh:178
Here is the call graph for this function:

◆ design()

bool CML2PhantomConstruction::design ( void  )
private

Definition at line 76 of file ML2PhantomConstruction.cc.

77 {
78 // switch between two different phantoms according to the main macro selection
79  bool bPhanExists=false;
80 
81  std::cout << "I'm building "<< phantomName<<" phantom"<< G4endl;
82 
83  if (phantomName=="fullWater")
84  {
85  Ph_fullWater=new CML2Ph_FullWater();bPhanExists=true;
87  }
88  else if (phantomName=="boxInBox")
89  {
90  Ph_BoxInBox=new CML2Ph_BoxInBox();bPhanExists=true;
92  }
93 
94  if (centre.size()<1)
95  {addNewCentre(G4ThreeVector(0.,0.,0.));}
96  return bPhanExists;
97 }
G4ThreeVector getHalfContainerSize()
G4ThreeVector getHalfContainerSize()
CLHEP::Hep3Vector G4ThreeVector
void addNewCentre(G4ThreeVector val)
#define G4endl
Definition: G4ios.hh:61
std::vector< G4ThreeVector > centre
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCurrentTranslationString()

G4String CML2PhantomConstruction::getCurrentTranslationString ( )

Definition at line 221 of file ML2PhantomConstruction.cc.

222 {
223  char cT[5];
224  G4int cTI;
225  G4String translationName;
226  cTI=(G4int)((currentCentre.getX()/mm));
227  sprintf(cT,"%d",cTI);
228  translationName="_TrX"+G4String(cT)+"_";
229  cTI=(G4int)((currentCentre.getY()/mm));
230  sprintf(cT,"%d",cTI);
231  translationName+="Y"+G4String(cT)+"_";
232  cTI=(G4int)((currentCentre.getZ()/mm));
233  sprintf(cT,"%d",cTI);
234  translationName+="Z"+G4String(cT);
235  return translationName;
236 }
int G4int
Definition: G4Types.hh:78
double getY() const
double getX() const
double getZ() const
static const double mm
Definition: G4SIunits.hh:114
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetInstance()

CML2PhantomConstruction * CML2PhantomConstruction::GetInstance ( void  )
static

Definition at line 67 of file ML2PhantomConstruction.cc.

68 {
69  if (instance == 0)
70  {
72 
73  }
74  return instance;
75 }
static CML2PhantomConstruction * instance
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPhantomName()

G4String CML2PhantomConstruction::getPhantomName ( )
inline

Definition at line 68 of file ML2PhantomConstruction.hh.

Here is the caller graph for this function:

◆ getTotalNumberOfEvents()

G4int CML2PhantomConstruction::getTotalNumberOfEvents ( )

Definition at line 98 of file ML2PhantomConstruction.cc.

99 {
100  if (phantomName=="fullWater")
102  else if (phantomName=="boxInBox")
104  return 0;
105 }
G4int getTotalNumberOfEvents()
G4int getTotalNumberOfEvents()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ resetSensDet()

void CML2PhantomConstruction::resetSensDet ( )
inline

Definition at line 83 of file ML2PhantomConstruction.hh.

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

◆ saveData()

void CML2PhantomConstruction::saveData ( )
inline

Definition at line 77 of file ML2PhantomConstruction.hh.

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

◆ setNewName() [1/2]

void CML2PhantomConstruction::setNewName ( )
inline

Definition at line 71 of file ML2PhantomConstruction.hh.

void setFullOutFileDataSingle(G4String val)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setNewName() [2/2]

void CML2PhantomConstruction::setNewName ( G4String  val)
inline

Definition at line 72 of file ML2PhantomConstruction.hh.

void setFullOutFileDataSingle(G4String val)
Here is the call graph for this function:

◆ setPhantomFileName()

void CML2PhantomConstruction::setPhantomFileName ( G4String  val)
inline

Definition at line 70 of file ML2PhantomConstruction.hh.

Here is the caller graph for this function:

◆ setPhantomName()

void CML2PhantomConstruction::setPhantomName ( G4String  val)
inline

Definition at line 69 of file ML2PhantomConstruction.hh.

Here is the caller graph for this function:

◆ writeInfo()

void CML2PhantomConstruction::writeInfo ( )

Definition at line 202 of file ML2PhantomConstruction.cc.

203 {
204  if (!bOnlyVisio)
205  {std::cout <<"Actual centre: "<<idCurrentCentre<<"/"<<centre.size() <<" "<< G4endl;}
206  std::cout <<"Phantom and its ROG centre: " << currentCentre<< G4endl;
207 }
#define G4endl
Definition: G4ios.hh:61
std::vector< G4ThreeVector > centre
Here is the caller graph for this function:

Member Data Documentation

◆ bOnlyVisio

G4bool CML2PhantomConstruction::bOnlyVisio
private

Definition at line 105 of file ML2PhantomConstruction.hh.

◆ centre

std::vector<G4ThreeVector> CML2PhantomConstruction::centre
private

Definition at line 100 of file ML2PhantomConstruction.hh.

◆ currentCentre

G4ThreeVector CML2PhantomConstruction::currentCentre
private

Definition at line 99 of file ML2PhantomConstruction.hh.

◆ halfPhantomInsideSize

G4ThreeVector CML2PhantomConstruction::halfPhantomInsideSize
private

Definition at line 99 of file ML2PhantomConstruction.hh.

◆ idCurrentCentre

G4int CML2PhantomConstruction::idCurrentCentre
private

Definition at line 101 of file ML2PhantomConstruction.hh.

◆ idVolumeName

G4int CML2PhantomConstruction::idVolumeName
private

Definition at line 97 of file ML2PhantomConstruction.hh.

◆ instance

CML2PhantomConstruction * CML2PhantomConstruction::instance = 0
staticprivate

Definition at line 89 of file ML2PhantomConstruction.hh.

◆ Ph_BoxInBox

CML2Ph_BoxInBox* CML2PhantomConstruction::Ph_BoxInBox
private

Definition at line 104 of file ML2PhantomConstruction.hh.

◆ Ph_fullWater

CML2Ph_FullWater* CML2PhantomConstruction::Ph_fullWater
private

Definition at line 103 of file ML2PhantomConstruction.hh.

◆ phantomContstructionMessenger

CML2PhantomConstructionMessenger* CML2PhantomConstruction::phantomContstructionMessenger
private

Definition at line 88 of file ML2PhantomConstruction.hh.

◆ PhantomFileName

G4String CML2PhantomConstruction::PhantomFileName
private

Definition at line 90 of file ML2PhantomConstruction.hh.

◆ phantomName

G4String CML2PhantomConstruction::phantomName
private

Definition at line 90 of file ML2PhantomConstruction.hh.

◆ PVPhmWorld

G4VPhysicalVolume* CML2PhantomConstruction::PVPhmWorld
private

Definition at line 92 of file ML2PhantomConstruction.hh.

◆ sensDet

CML2SDWithVoxels* CML2PhantomConstruction::sensDet
private

Definition at line 95 of file ML2PhantomConstruction.hh.

◆ volumeNameIdLink

std::vector<SvolumeNameId> CML2PhantomConstruction::volumeNameIdLink
private

Definition at line 96 of file ML2PhantomConstruction.hh.


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