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

#include <ML2PhantomConstruction.hh>

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)
 

Detailed Description

Definition at line 60 of file ML2PhantomConstruction.hh.

Constructor & Destructor Documentation

CML2PhantomConstruction::CML2PhantomConstruction ( void  )

Definition at line 47 of file ML2PhantomConstruction.cc.

Referenced by GetInstance().

47  : PVPhmWorld(0), sensDet(0)
48 {
49  phantomContstructionMessenger=new CML2PhantomConstructionMessenger(this);
50  idCurrentCentre=0;
51 }
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

void CML2PhantomConstruction::addNewCentre ( G4ThreeVector  val)
inline

Definition at line 79 of file ML2PhantomConstruction.hh.

Referenced by CML2PhantomConstructionMessenger::SetNewValue().

79 {centre.push_back(val);}
void CML2PhantomConstruction::applyNewCentre ( G4ThreeVector  val)

Definition at line 208 of file ML2PhantomConstruction.cc.

References G4GeometryManager::CloseGeometry(), G4RunManager::GeometryHasBeenModified(), G4LogicalVolume::GetDaughter(), G4GeometryManager::GetInstance(), G4VPhysicalVolume::GetLogicalVolume(), G4VSensitiveDetector::GetROgeometry(), G4VReadOutGeometry::GetROWorld(), G4RunManager::GetRunManager(), G4GeometryManager::OpenGeometry(), CML2SDWithVoxels::resetVoxelsSingle(), and G4VPhysicalVolume::SetTranslation().

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

209 {
210  if (sensDet!=0)
211  {
212  currentCentre=ctr;
214  PVPhmWorld->SetTranslation(ctr);
216  sensDet->resetVoxelsSingle();
219  }
220 }
void GeometryHasBeenModified(G4bool prop=true)
G4VPhysicalVolume * GetDaughter(const G4int i) const
void SetTranslation(const G4ThreeVector &v)
G4VReadOutGeometry * GetROgeometry() const
static G4GeometryManager * GetInstance()
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:74
G4LogicalVolume * GetLogicalVolume() const
void OpenGeometry(G4VPhysicalVolume *vol=0)
G4bool CloseGeometry(G4bool pOptimise=true, G4bool verbose=false, G4VPhysicalVolume *vol=0)
G4VPhysicalVolume * GetROWorld() const
bool CML2PhantomConstruction::applyNewCentre ( )

Definition at line 191 of file ML2PhantomConstruction.cc.

192 {
193  if (idCurrentCentre <(int) centre.size())
194  {
195  currentCentre=centre[idCurrentCentre];
196  applyNewCentre(currentCentre);
197  idCurrentCentre++;
198  return true;
199  }
200  return false;
201 }
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.

References CML2Ph_FullWater::Construct(), CML2Ph_BoxInBox::Construct(), G4NistManager::FindOrBuildMaterial(), CML2Ph_FullWater::getPhysicalVolume(), CML2Ph_BoxInBox::getPhysicalVolume(), CML2Ph_FullWater::getSensDet(), CML2Ph_BoxInBox::getSensDet(), CLHEP::Hep3Vector::getX(), CLHEP::Hep3Vector::getY(), CLHEP::Hep3Vector::getZ(), G4NistManager::Instance(), CML2PhantomConstructionMessenger::SetReferenceWorld(), G4VisAttributes::SetVisibility(), CML2SDWithVoxels::setVolumeNameIdLink(), G4Colour::White(), CML2Ph_FullWater::writeInfo(), and CML2Ph_BoxInBox::writeInfo().

Referenced by CML2WorldConstruction::create().

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 
119  G4Box *phmWorldB = new G4Box("phmWorldG", halfPhantomInsideSize.getX(), halfPhantomInsideSize.getY(), halfPhantomInsideSize.getZ());
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);
133  sensDet=Ph_fullWater->getSensDet();
134  createPhysicalVolumeNamesList(Ph_fullWater->getPhysicalVolume());
135  Ph_fullWater->writeInfo();
136  }
137  else if (phantomName=="boxInBox")
138  {
139  Ph_BoxInBox->Construct(PVPhmWorld, saving_in_ROG_Voxels_every_events, seed, ROGOutFile, bSaveROG);
140  sensDet=Ph_BoxInBox->getSensDet();
141  createPhysicalVolumeNamesList(Ph_BoxInBox->getPhysicalVolume());
142  Ph_BoxInBox->writeInfo();
143  }
144  // I create the data base volumeName-volumeID in the sensitive detector
145 
146  sensDet->setVolumeNameIdLink(volumeNameIdLink);
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:63
void SetVisibility(G4bool)
double getY() const
G4VPhysicalVolume * getPhysicalVolume()
static G4NistManager * Instance()
double getX() const
G4VPhysicalVolume * getPhysicalVolume()
CML2SDWithVoxels * getSensDet()
bool Construct(G4VPhysicalVolume *PVWorld, G4int saving_in_ROG_Voxels_every_events, G4int seed, G4String ROGOutFile, G4bool bSaveROG)
double getZ() const
bool Construct(G4VPhysicalVolume *PVWorld, G4int saving_in_ROG_Voxels_every_events, G4int seed, G4String ROGOutFile, G4bool bSaveROG)
static G4Colour White()
Definition: G4Colour.hh:143
G4String CML2PhantomConstruction::getCurrentTranslationString ( )

Definition at line 221 of file ML2PhantomConstruction.cc.

References CLHEP::Hep3Vector::getX(), CLHEP::Hep3Vector::getY(), CLHEP::Hep3Vector::getZ(), and python.hepunit::mm.

Referenced by CML2RunAction::BeginOfRunAction().

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 }
double getY() const
int G4int
Definition: G4Types.hh:78
double getX() const
double getZ() const
CML2PhantomConstruction * CML2PhantomConstruction::GetInstance ( void  )
static

Definition at line 67 of file ML2PhantomConstruction.cc.

References CML2PhantomConstruction().

Referenced by CML2RunAction::BeginOfRunAction(), CML2WorldConstruction::CML2WorldConstruction(), main(), and CML2AcceleratorConstructionMessenger::SetNewValue().

68 {
69  if (instance == 0)
70  {
71  instance = new CML2PhantomConstruction();
72 
73  }
74  return instance;
75 }
G4String CML2PhantomConstruction::getPhantomName ( )
inline

Definition at line 68 of file ML2PhantomConstruction.hh.

Referenced by CML2WorldConstruction::create().

68 {return phantomName;}
G4int CML2PhantomConstruction::getTotalNumberOfEvents ( )

Definition at line 98 of file ML2PhantomConstruction.cc.

References CML2Ph_FullWater::getTotalNumberOfEvents(), and CML2Ph_BoxInBox::getTotalNumberOfEvents().

Referenced by CML2WorldConstruction::getTotalNumberOfEventsInPhantom().

99 {
100  if (phantomName=="fullWater")
101  {return Ph_fullWater->getTotalNumberOfEvents();}
102  else if (phantomName=="boxInBox")
103  {return Ph_BoxInBox->getTotalNumberOfEvents();}
104  return 0;
105 }
G4int getTotalNumberOfEvents()
G4int getTotalNumberOfEvents()
void CML2PhantomConstruction::resetSensDet ( )
inline
void CML2PhantomConstruction::saveData ( )
inline

Definition at line 77 of file ML2PhantomConstruction.hh.

References CML2SDWithVoxels::save().

Referenced by CML2WorldConstruction::savePhantomData().

77 {sensDet->save();}
void CML2PhantomConstruction::setNewName ( )
inline

Definition at line 71 of file ML2PhantomConstruction.hh.

References CML2SDWithVoxels::setFullOutFileDataSingle().

Referenced by CML2RunAction::BeginOfRunAction().

71 {sensDet->setFullOutFileDataSingle("");}
void setFullOutFileDataSingle(G4String val)
void CML2PhantomConstruction::setNewName ( G4String  val)
inline

Definition at line 72 of file ML2PhantomConstruction.hh.

References CML2SDWithVoxels::setFullOutFileDataSingle().

72 {sensDet->setFullOutFileDataSingle(val);}
void setFullOutFileDataSingle(G4String val)
void CML2PhantomConstruction::setPhantomFileName ( G4String  val)
inline
void CML2PhantomConstruction::setPhantomName ( G4String  val)
inline
void CML2PhantomConstruction::writeInfo ( )

Definition at line 202 of file ML2PhantomConstruction.cc.

References G4endl.

Referenced by CML2RunAction::BeginOfRunAction().

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

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