49 G4String FileExperimentalData,
G4String FileExperimentalDataOut):startCurve(0),
50 stopCurve(0),chi2Factor(0)
53 sprintf(a,
"%d", seed);
66 maxZone.set(-extr, -extr, -extr);
92 in.getline(a,1000,
'\n');
104 in.getline(a,1000,
'\n');
130 if (
minZone.getX()>pos.getX()-halfSize.getX())
131 {
minZone.setX(pos.getX()-halfSize.getX());}
132 if (
maxZone.getX()<pos.getX()+halfSize.getX())
133 {
maxZone.setX(pos.getX()+halfSize.getX());}
135 if (
minZone.getY()>pos.getY()-halfSize.getY())
136 {
minZone.setY(pos.getY()-halfSize.getY());}
137 if (
maxZone.getY()<pos.getY()+halfSize.getY())
138 {
maxZone.setY(pos.getY()+halfSize.getY());}
140 if (
minZone.getZ()>pos.getZ()-halfSize.getZ())
141 {
minZone.setZ(pos.getZ()-halfSize.getZ());}
142 if (
maxZone.getZ()<pos.getZ()+halfSize.getZ())
143 {
maxZone.setZ(pos.getZ()+halfSize.getZ());}
149 std::cout <<
"ERROR I can't find the experimental data file" <<
G4endl;
161 for (
int i=0; i<(int)
voxels.size(); i++ )
184 for (
int i=0; i<(int)
voxels.size(); i++)
188 if (minPos.getX()<= pos.getX() && pos.getX()<maxPos.getX() &&
189 minPos.getY()<= pos.getY() && pos.getY()<maxPos.getY() &&
190 minPos.getZ()<= pos.getZ() && pos.getZ()<maxPos.getZ())
192 voxelVolume=
voxels[i].halfSize.getX()*
voxels[i].halfSize.getY()*
voxels[i].halfSize.getZ()*8.;
193 voxelMass=density*voxelVolume;
198 voxels[i].depEnergy+=dose;
199 voxels[i].depEnergy2+=dose*dose;
228 for (
int i=0;i<(int)
voxels.size();i++)
237 for (
int i=0;i<(int)
voxels.size();i++)
257 out <<
"% x [mm], y [mm], z [mm], Dx [mm], Dy [mm], Dz [mm], expDose [Gy], Calculated dose [Gy], Calculated dose2 [Gy^2], nEvents, normDose [Gy], normDoseError [Gy]";
271 for (
int i=0; i<(int)
voxels.size(); i++)
296 cs+=vox[i].depEnergy*vox[i].expDose;
297 cc+=vox[i].depEnergy*vox[i].depEnergy;
305 dd=vox[i].depEnergy*vox[i].depEnergy;
306 d2=vox[i].depEnergy2;
308 vox[i].depEnergyNorm=
chi2Factor[j]*vox[i].depEnergy;
311 if (n>1){vox[i].depEnergyNormError=
chi2Factor[j]*std::sqrt(v/(n-1));}
312 if (n==1){vox[i].depEnergyNormError=vox[i].depEnergyNorm;}
G4ParticleDefinition * GetDefinition() const
CLHEP::Hep3Vector G4ThreeVector
G4Material * GetMaterial() const
void calculateNormalizedEd(std::vector< Svoxel > &voxels)
G4double GetDensity() const
G4int GetPDGEncoding() const
static const double joule
G4int saving_in_Selected_Voxels_every_events
G4int getMinNumberOfEvents()
G4bool bHasExperimentalData
G4StepPoint * GetPreStepPoint() const
const G4ThreeVector & GetMomentumDirection() const
void resetNEventsInVoxels()
G4VPhysicalVolume * GetPhysicalVolume() const
G4int primaryParticlePDGE
const G4ThreeVector & GetPosition() const
G4double depEnergyNormError
G4double GetTotalEnergyDeposit() const
G4LogicalVolume * GetLogicalVolume() const
G4int getMaxNumberOfEvents()
std::vector< Svoxel > voxels
CML2ExpVoxels(G4bool bHasExperimentalData, G4int saving_in_Selected_Voxels_every_events, G4int seed, G4String FileExperimentalData, G4String FileExperimentalDataOut)
void add(G4ThreeVector pos, G4double depEnergy, G4double density)
G4Track * GetTrack() const
static const G4double pos