Forum: Biasing and Scoring Not Logged In (login)

Biasing and scoring in Geant4

The email gateway for this forum is: biasing_scoring-g4hn@slac.stanford.edu

How to score secondary neutron ??  by Arghya Chattaraj <Arghya Chattaraj>,   Sep 19, 20:16
 Hi, I am beginner in Geant4. I want to get number of secondary neutron due to incident proton beam (250 MeV pencil beam) on a cylindrical target. I used Multifunctional detector and neutron filter like below auto Detector10 = new G4MultiFunctionalDetector("dect_10"); G4SDManager::GetSDMpointer()->AddNewDetector(Detector10); G4VPrimitiveScorer* primitive; //primitive = new G4PSTrackLength("TrackLength"); primitive = new G4PSSphereSurfaceCurrent(psName="Current", fCurrent_In); //primitive = new G4PSPassageCellCurrent(psName="Current", fCurrent_In); primitive ->SetFilter(neutronFilter); Detector10->RegisterPrimitive(primitive); SetSensitiveDetector("detc10LV",Detector10); I am getting some score but with RMS value almost 10 times higher than mean value of neutron . I used "FTFP_BERT" physics. Here I am attaching my Detectorconstuction.cc, eventaction.cc and runaction.cc (Note: I have edited example/basic/B4d according to my requirement.) Kindly give me some suggestion in this regards that where is the problem ? Need your expert opinion on this please.
How to count how many of particles hit my volume?  by Rafaela Ramos <Rafaela Ramos>,   Sep 14, 07:38
 Dear all, I am a beginner in GEANT4 and I would like to know how I can count how many optical photons are hitting my volume? I have a geometry like trapezoid and I generate some number of optical photons and I want to know how many are hitting the base? Any advice would be appreciated. Best regards.
can we define more than one scoring volume in exampleB1?  by masume soleimaninia <masume soleimaninia>,   Sep 13, 00:01
 Dear Experts, Hello I want to define 2 scoring volumes in example B1 separately and I want to calculate energy deposition in each of them. I did it without any errors, but the energy deposition in my code in the two scoring volumes is the same. I mean the code didn't distinguish any difference between the two volumes. if anyone has experience in this work, please help me. thanks
Re: can we define more than one scoring volume in exampleB1?  by michel maire <michel maire>,   Sep 13, 03:50
Re: can we define more than one scoring volume in exampleB1? (masume soleimaninia)
 On Thu, 13 Sep 2018 07:01:48 GMT, masume soleimaninia wrote: > Dear Experts, Hello > > I want to define 2 scoring volumes in example B1 separately and I want > to calculate energy deposition in each of them. I did it without any > errors, but the energy deposition in my code in the two scoring volumes > is the same. I mean the code didn't distinguish any difference between > the two volumes. if anyone has experience in this work, please help me. > > thanks >   In example B4/B4a the scoring method is the same as in B1, but for 2 differents volumes. See B4aSteppingAction. 
Re: can we define more than one scoring volume in exampleB1?  by masume soleimaninia <masume soleimaninia>,   Sep 13, 19:28
Re: Re: can we define more than one scoring volume in exampleB1? (michel maire)
Warning when I use enforced interaction biasing technique  by Ruirui <Ruirui>,   Sep 08, 13:38
 Dear Geant4 experts, I tried to simulate the antigrid shielding of the CT system. The anti-grids are very thin plates for blocking the scattered gamma ray. The thickness of these plates only is 80 microns. So it is hard to capture the interactions inside the plate. I tried to use the enforeced interaction biasing technique to enforce the interaction in the thin plates. I basically copy the idea from example of GB02. But I alawys find a weried warninig as below. Do not know why, anyone has some idea about this warning? -------- WWWW ------- G4Exception-START -------- WWWW ------- *** G4Exception : BIAS.GEN.19 issued by : G4BOptrForceCollisionTrackData::~G4BOptrForceCollisionTrackData() Track deleted while under G4BOptrForceCollision biasing scheme of operator ForceCollisionForgamma'. Will result in inconsistencies. *** This is just a warning message. *** -------- WWWW -------- G4Exception-END --------- WWWW -------
Re: Warning when I use enforced interaction biasing technique  by Marc Verderi <Marc Verderi>,   Sep 08, 22:10
Re: Warning when I use enforced interaction biasing technique (Ruirui)
 Hello,  When this biasing scheme is applied, there is a control to ensure that the two main stages have been completed before the track is killed; these stages are: 1. free flight forcing of the primary (that crosses the volume without interaction) 2. forced interaction of the clone of the primary. This control uses the G4BOptrForceCollisionTrackData object -an extension of the G4Track properties- to store the status of the track under biasing (the primary or the clone of it).  Once 1. or 2. has been completed, the biasing operator G4BOptrForceCollision "releases" the track by calling the Reset() method of the G4BOptrForceCollisionTrackData object. This Reset() happens in one of the OperationApplied(...) methods of the operator, which are methods called after 1. or 2. has been executed.  The "BIAS.GEN.19" exception means that the track has been killed without having the Reset() method of its G4BOptrForceCollisionTrackData object called before. Most likely, this means that the OperationApplied(...) methods have not been properly called, and I would suggest verifying this first.  Please let me know if this fixes the problem ! Cheers, Marc On Sat, 08 Sep 2018 20:38:04 GMT, Ruirui wrote: > Dear Geant4 experts, > > I tried to simulate the antigrid shielding of the CT system. The > anti-grids are very thin plates for blocking the scattered gamma ray. > The thickness of these plates only is 80 microns. So it is hard to > capture the interactions inside the plate. I tried to use the enforeced > interaction biasing technique to enforce the interaction in the thin > plates. I basically copy the idea from example of GB02. But I alawys > find a weried warninig as below. Do not know why, anyone has some idea > about this warning? > > -------- WWWW ------- G4Exception-START -------- WWWW ------- > *** G4Exception : BIAS.GEN.19 > issued by : G4BOptrForceCollisionTrackData::~G4BOptrForceCollisionTrackData() > Track deleted while under G4BOptrForceCollision biasing scheme of operator ForceCollisionForgamma'. Will result in inconsistencies. > *** This is just a warning message. *** > -------- WWWW -------- G4Exception-END --------- WWWW ------- > 
Re: Warning when I use enforced interaction biasing technique  by Ruirui <Ruirui>,   Sep 09, 08:30
Re: Re: Warning when I use enforced interaction biasing technique (Marc Verderi)
 Dear Marc, Thank you very much for your reply.I checked the code in the example of GB02, but I could not find a place that OperationApplied(...) methods are called. So do you know where I should implement this method in the code? Thanks, In the GB02 example, I see these methods are defined as private functions as I copied below. private: // ------------------------------- // -- Optionnal, from base class : // ------------------------------- // -- Here, these are needed implementions to forward calls to the underneath // -- G4BOptrForceCollision biasing operator void OperationApplied( const G4BiasingProcessInterface* callingProcess, G4BiasingAppliedCase biasingCase, G4VBiasingOperation* operationApplied, const G4VParticleChange* particleChangeProduced ) final; void OperationApplied( const G4BiasingProcessInterface* callingProcess, G4BiasingAppliedCase biasingCase, G4VBiasingOperation* occurenceOperationApplied, G4double weightForOccurenceInteraction, G4VBiasingOperation* finalStateOperationApplied, const G4VParticleChange* particleChangeProduced ) final;  void ExitBiasing( const G4Track*, const G4BiasingProcessInterface* ) final; 
Re: Warning when I use enforced interaction biasing technique  by Marc Verderi <Marc Verderi>,   Sep 09, 23:33
Re: Re: Warning when I use enforced interaction biasing technique (Ruirui)
 Hello, These methods are fine, they are overriding the base class virtual ones, and so should be called. So this looks more annoying. Could you tell more about your application and give also some snapshot code ? Cheers, Marc
Re: Warning when I use enforced interaction biasing technique  by Ruirui <Ruirui>,   Sep 10, 07:29
Re: Re: Warning when I use enforced interaction biasing technique (Marc Verderi)
 Hi Marc, Thank you for your reply. So basically I build a simulation for simulating the effectiveness of anti-scatter gird of CT. In the simulation, I collect the deposited energy by X-ray in the detectors. The energy deposited inside the detectors are from two parts, the first one is from the primary photon, and the second one is the from the scattered photon. In the real CT application, we try to reduce the scatter photon as much as possible, so we will use these anti-scatter grid which is usually some thin metal plates. Below are part of the code for the geometry of these thin plates. The attached firgure shows the geometry. / define and place the internal foil  G4double dX_inf = crystalWrap_dX; G4double dY_inf = internalFoilThickness; G4double dZ_inf = internalFoilHeight; G4double dZ_inw = 0.8*mm; G4Box* solidUpperInterFoil = new G4Box("upperInterFoil", dX_inf*8/2, dY_inf/2, dZ_inf/2); G4Box* solidLowerInterFoil = new G4Box("lowerInterFoil", dX_inf/2, dY_inf/2, dZ_inw/2);  G4LogicalVolume* logicalUpperInterFoil = new G4LogicalVolume(solidUpperInterFoil, //its solid edgeMat, //its material "upperInterFoilLV"); //its name  G4Region *regVol; regVol= new G4Region("shieldingPlates"); G4ProductionCuts* cuts = new G4ProductionCuts; cuts->SetProductionCut(0.1*um); regVol->SetProductionCuts(cuts); logicalUpperInterFoil->SetRegion(regVol);  G4LogicalVolume* logicalLowerInterFoil = new G4LogicalVolume(solidLowerInterFoil, //its solid wrap_mat, //its material "lowerInterFoilLV"); //its name // for (G4int icrys = 406; icrys < 407 ; icrys++) for (G4int icrys = 0; icrys < nb_cryst-1 ; icrys++) { G4double phi = icrys*dPhi+initialAngle-arcAngle/2.0+dPhi/2+dPhi/2; // G4double phi = icrys*dPhi; G4RotationMatrix rotm = G4RotationMatrix(); rotm.rotateY(90*deg); // rotating from Y Z plane to X Y plane, that is why rotating with respect to Y axis rotm.rotateZ(phi); G4ThreeVector uz = G4ThreeVector(std::cos(phi), std::sin(phi),0.); G4ThreeVector position = (ring_R1+ crystalWrap_dZ - 0.5* dZ_inw)*uz; G4Transform3D transform = G4Transform3D(rotm,position);  new G4PVPlacement(transform, //rotation,position logicalLowerInterFoil, //its logical volume "lowerInterFoil", //its name logicRing, //its mother volume false, //no boolean operation icrys, //copy number checkOrNotCheckOverlapping); // checking overlaps   G4ThreeVector positionw = (ring_R1+ crystalWrap_dZ - dZ_inw-0.5*internalFoilHeight)*uz; G4Transform3D transformw = G4Transform3D(rotm,positionw); new G4PVPlacement(transformw, //rotation,position logicalUpperInterFoil, //its logical volume "upperInterFoil", //its name logicRing, //its mother volume false, //no boolean operation icrys, //copy number checkOrNotCheckOverlapping); // checking overlaps } Then in the ConstructSDandField() method, I define put the volume of thin plate to the bias volume. Part of the code is as below:  // below we start to add the biasing operator to the volume where we need, in this case we use force interaction operator  // -- Fetch volume for biasing: G4LogicalVolume* logicTest = G4LogicalVolumeStore::GetInstance()->GetVolume("upperInterFoilLV");  // ---------------------------------------------- // --enforce interaction operator creation and attachment to volume: // ---------------------------------------------- GB02BOptrMultiParticleForceCollision* testMany = new GB02BOptrMultiParticleForceCollision(); testMany->AddParticle("gamma"); // we apply this operator to gamma testMany->AttachTo(logicTest);  G4cout << " Attaching biasing operator " << testMany->GetName() << " to logical volume " << logicTest->GetName() << G4endl;  Attachment: http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2018/09/10/07.29-91080-Selection_086.png http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2018/09/10/07.29-32398-Selection_013.png 
Scoring output   by Snezana Petrovic <Snezana Petrovic>,   Jun 13, 23:44
 Hi all, I am scoring neutrons via flatSurfaceCurrent, but I am not sure what my output means. Can somebody please explain me. I am not sure what total(value) , total(val^2) and entry means. # mesh name: boxMesh_1 # primitive scorer name: neutronFlux # iX, iY, iZ, total(value) , total(val^2), entry  Thank you!
Non Ionizing Energy Loss (NIEL) and Displacement Damage  by <jeonyboy@gmail.com>,   May 21, 09:01
 Hello, I am trying to gather information of NIEL and displacement damage from Geant4 simulations. I am trying to shoot neutron particles on a variety of materials such as Hafnium Dioxide and silicon dioxide. From what I've discovered, there is a GetNonIonizingEnergy function which I tried to use in TestEm7. However, for neutrons, I am getting 0 value returned for nonionizing energy deposit. How do I remedy this? Also, when I run example such as Hadr07, I can get a list of secondary particle created along with their min and max energies. Can I understand the secondaries as result of displacement damage? (See attached file). Thank you so much in advance. I couldn't find much information about this matter on geant4 and any help would be much appreciated.  Attachment: http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2018/05/21/08.59-28272-ronOnHfO2_Secondaries.png 
Re: Non Ionizing Energy Loss (NIEL) and Displacement Damage  by Michael H. Kelsey <Michael H. Kelsey>,   May 22, 21:27
Re: Non Ionizing Energy Loss (NIEL) and Displacement Damage
 On Mon, 21 May 2018 16:01:08 GMT, jeonyboy wrote: > Hello, I am trying to gather information of NIEL and displacement damage > from Geant4 simulations. I am trying to shoot neutron particles on a > variety of materials such as Hafnium Dioxide and silicon dioxide.  Geant4 does not include simulation of solids as crystalline structures, per se. In particular, there is no direct simulation of "displacement damage." If you were dealing with atomic beams, I would point you in the direction of SRIM/TRIM as a "better" simulation (one which more directly addresses your question). I don't know if something similar to SRIM exists for neutron beams. One of the Geant4 examples, extended/electromagnetic/TestEm7 (which you already know about), does include physics processes and calculations, such as Lindhard partitioning, relevant to nuclear recoil and non-ionizing energy loss effects. But again, this example is aimed at heavy-ion interactions, and does not include neutrons as relevant particles for those processes. > From what I've discovered, there is a GetNonIonizingEnergy function > which I tried to use in TestEm7. However, for neutrons, I am getting 0 > value returned for nonionizing energy deposit. How do I remedy this?  The special processes in TestEm7 are only applied for GenericIon, not for neutrons. I suspect that even if you tried to simply add the processes to the neutron ProcessManager (and modified them so that IsApplicable() returned true for neutrons) you would not get physically correct results. > Also, when I run example such as Hadr07, I can get a list of secondary > particle created along with their min and max energies. Can I understand > the secondaries as result of displacement damage? (See attached file).  Not really. Neutrons interact internally with individual nuclei, which (or some other transmuted species) will be produced as a recoiling secondary. However, Geant4 treats all materials as simple, uniform volumes of non-interacting particles, essentially an ideal gas with a suspiciously high density :-) Each atom is available for an interaction, but there is no "crystal potential", just as there is no valence or conduction band, or band gap, for electrons in a Geant4 "solid." There are efforts, both within and outside Geant4, to develop additional physics processes, and in some cases, additional particles (non-scalar charge carriers in a crystal, for example), to model some of this very low-energy physics. But even these efforts don't include issues such as displacement damage due to neutrons.  -- Michael Kelsey 
Re: Non Ionizing Energy Loss (NIEL) and Displacement Damage  by <jeonyboy@gmail.com>,   Jun 06, 17:48
Re: Re: Non Ionizing Energy Loss (NIEL) and Displacement Damage (Michael H. Kelsey)
 First, thank you very much for your response. I am curious though, even though Geant4 isn't built to simulate diplacement damage, it still does produce secondary particles through inelastic scattering (nuclear reactions) for neutrons. This is what I found as definition of displacement damage mechanism: Displacement damage occurs through interaction of incident particles with Si atoms by any of the following three processes: 1) Rutherford (i.e., Coulomb) scattering, 2) nuclear elastic scattering, and 3) nuclear inelastic scattering. So couldn't the secondaries created by neutron via Hadr07 example be a indirect way of estimating displacement damage? Maybe not the whole picture, but a part of it. On Wed, 23 May 2018 04:27:32 GMT, Michael H. Kelsey wrote: > On Mon, 21 May 2018 16:01:08 GMT, jeonyboy wrote: > > > Hello, I am trying to gather information of NIEL and displacement damage > > from Geant4 simulations. I am trying to shoot neutron particles on a > > variety of materials such as Hafnium Dioxide and silicon dioxide. > > Geant4 does not include simulation of solids as crystalline structures, > per se. In particular, there is no direct simulation of "displacement > damage." If you were dealing with atomic beams, I would point you in the > direction of SRIM/TRIM as a "better" simulation (one which more directly > addresses your question). I don't know if something similar to SRIM > exists for neutron beams. > > One of the Geant4 examples, extended/electromagnetic/TestEm7 (which you > already know about), does include physics processes and calculations, > such as Lindhard partitioning, relevant to nuclear recoil and > non-ionizing energy loss effects. But again, this example is aimed at > heavy-ion interactions, and does not include neutrons as relevant > particles for those processes. > > > From what I've discovered, there is a GetNonIonizingEnergy function > > which I tried to use in TestEm7. However, for neutrons, I am getting 0 > > value returned for nonionizing energy deposit. How do I remedy this? > > The special processes in TestEm7 are only applied for GenericIon, not > for neutrons. I suspect that even if you tried to simply add the > processes to the neutron ProcessManager (and modified them so that > IsApplicable() returned true for neutrons) you would not get physically > correct results. > > > Also, when I run example such as Hadr07, I can get a list of secondary > > particle created along with their min and max energies. Can I understand > > the secondaries as result of displacement damage? (See attached file). > > Not really. Neutrons interact internally with individual nuclei, which > (or some other transmuted species) will be produced as a recoiling > secondary. However, Geant4 treats all materials as simple, uniform > volumes of non-interacting particles, essentially an ideal gas with a > suspiciously high density :-) Each atom is available for an interaction, > but there is no "crystal potential", just as there is no valence or > conduction band, or band gap, for electrons in a Geant4 "solid." > > There are efforts, both within and outside Geant4, to develop additional > physics processes, and in some cases, additional particles (non-scalar > charge carriers in a crystal, for example), to model some of this very > low-energy physics. But even these efforts don't include issues such as > displacement damage due to neutrons. > > -- Michael Kelsey > 
Re: Non Ionizing Energy Loss (NIEL) and Displacement Damage  by Vladimir Ivanchenko <Vladimir Ivanchenko>,   Jul 04, 05:45
Re: Re: Non Ionizing Energy Loss (NIEL) and Displacement Damage
 Hello, your choice of the forum is not optimal. It is mainly EM physics problem but also hadronic interaction involved. Few comments: 1) Standard nuclear stopping power is computed inside only Option3 (EMY) EM physics constructor 2) in all other constructors single scattering model is used, so some part of nuclear recoil is delivered not as nuclear stopping by as real nucleus with recoil energy (usually small). You need handle recoil nucleus in the analysis. 3) One can define "cut in range for protons" which allows to define energy threshold for nuclear recoil. If the cut is zero, then all nuclear recoil will be tracked by Geant4 and MIEL energy deposition at a step will be zero; if the threshold is high, then in any Physics List nuclear stopping will be computed VI
Scoring using parallel world  by elnaz yazd <elnaz yazd>,   May 09, 06:30
 I am computing dose profile by readout Geometry (G4Parallel world). The mass geometry is a world and phantom and a detector inside phantom. I defined a parallel world and a phantom and detector inside it with dimensions equal with the mass ones. I checked the geometries by /vis/drawVolume worlds command in vis.mac file. They are Ok. Then I define a sensitive and a hit class to score edep and positions in ProcessHits method of sensitive class. Also I assigned the sensitive class to logical volume of detector in ConstructSD() method of parallel world as following: void MRTParallelWorld::ConstructSD() { G4String detectorSDname = "/mydet/dosimeter"; RE05TrackerSD * detectorSD = new RE05TrackerSD(detectorSDname); G4SDManager::GetSDMpointer()->AddNewDetector(detectorSD); SetSensitiveDetector(logicDetectorRO,detectorSD); //G4cout<<" Function ConstructSD() is called edep is: "<
Try to get X ray production direction but angle seem to be wrong  by HuangHong <HuangHong>,   May 03, 15:02
 Dear all, I want simulate the electron bombard the target(tungsten)to produce X ray, I want to get the direction of X ray production.Details are described in the attachment. I use the momentum to get the angle, codes likes blow: G4ThreeVector direction = track->GetMomentumDirection(); G4double theta = direction.theta(); G4double phi = direction.phi(); Question 1: The result of theta is as follows(see attachment), we can see there is no X ray production in the 0 degree and 180 degree. Do I wrong to use the Momentum to get the X ray production direction? Question 2: Where is the reference point for the MomentumDirection? Is it in relation to the interacting electron vector at the point of photon generation or something else entirely?  Attachment: http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2018/05/03/14.50-22901-n_of_X_ray_production.pdf 
Re: Try to get X ray production direction but angle seem to be wrong  by Michael H. Kelsey <Michael H. Kelsey>,   May 04, 12:31
Re: Try to get X ray production direction but angle seem to be wrong (HuangHong)
 On Thu, 03 May 2018 22:02:58 GMT, HuangHong wrote: > Dear all, I want simulate the electron bombard the target(tungsten)to > produce X ray, I want to get the direction of X ray production.Details > are described in the attachment. > > I use the momentum to get the angle, codes likes blow: > > G4ThreeVector direction = track->GetMomentumDirection(); > G4double theta = direction.theta(); G4double phi = direction.phi();  You need to be a little careful about this. The track kinematics (position, direction, energy) are updated with every step the track takes. If you want to get the _production_ kinematics, you should use the "GetVertexXyz" functions (see G4Track.hh). You will also want to have some sort of filter in your stepping action or sensitive detector so that you only do this once per track. > Question 1: The result of theta is as follows(see attachment), we can > see there is no X ray production in the 0 degree and 180 degree. Do I > wrong to use the Momentum to get the X ray production direction?  You're not wrong, it just wasn't answering the question you were asking :-) The instantaneous (at a step) direction may be different from the original production, if the X-ray scattered during its flight. > Question 2: Where is the reference point for the MomentumDirection? Is > it in relation to the interacting electron vector at the point of photon > generation or something else entirely?  The direction, like the position, is expressed in the global coordinate system. If you need the direction or position in the local coordinates of the volume, then you need to apply the coordinate transform from the G4VTouchable associated with the track.  -- Michael Kelsey 
Re: Try to get X ray production direction but angle seem to be wrong  by HuangHong <HuangHong>,   May 04, 17:25
Re: Re: Try to get X ray production direction but angle seem to be wrong (Michael H. Kelsey)
  Dear all, I want simulate the electron bombard the target(tungsten)to produce X ray, I want to get the direction of X ray production.Details are described in the attachment. I use the momentum to get the angle, codes likes blow:  G4ThreeVector direction = track->GetMomentumDirection(); G4double theta = direction.theta(); G4double phi = direction.phi(); >You need to be a little careful about this. The track kinematics (position, direction, energy) are updated with every step the track takes. If you want to get the _production_ kinematics, you should use the "GetVertexXyz" functions (see G4Track.hh). You will also want to have some sort of filter in your stepping action or sensitive detector so that you only do this once per track. >> 1. Thanks for your advice to use vertex (where this track was created) information. I think your advice is right for my simulation. Now I use " G4ThreeVector direction = track->GetVertexMomentumDirection(); G4double theta = direction.theta(); G4double phi = direction.phi();" to get the momentumDirection where this track was created. >> 2. I set my target(tungsten material) as a sensitive detector, and I use a flag to mark the trackID so that I just record once per track.  Question 1: The result of theta is as follows(see attachment), we can see there is no X ray production in the 0 degree and 180 degree. Do I wrong to use the Momentum to get the X ray production direction? >You're not wrong, it just wasn't answering the question you were asking :-) The instantaneous (at a step) direction may be different from the original production, if the X-ray scattered during its flight. >> Thanks for your kind reply. I adopt your advice(using GetVertexMomentumDirection().) to simulate again, but the result is also like before, there is no X ray production in the 0 degree and 180 degree(theta, it respects to the Z axis). Could you please give me some advice if you know? Question 2: Where is the reference point for the MomentumDirection? Is it in relation to the interacting electron vector at the point of photon generation or something else entirely? >The direction, like the position, is expressed in the global coordinate system. If you need the direction or position in the local coordinates of the volume, then you need to apply the coordinate transform from the G4VTouchable associated with the track. >>Thanks for telling me the reference point. I just want to get the global coordinate, and I know how to transform the global coordinate to local.
The concept of voxelization  by Huagang Yan <Huagang Yan>,   May 02, 20:44
 Hi, experts, I constructed the geometry with the built-in functions of Geant4, such as G4Sphere. I scored the dose with a meshbox (a 101x101x101 matrix). Can I say that the model is voxelized? I understand that if I use a DICOM images to build the geometrical volume, it must be voxelized. I just need a clear concept of voxelization. Any comment is greatly appreciated.
scoring particles traversing a plane  by Balder <Balder>,   Apr 23, 14:19
 Hi, I'm trying to score the energy of the particles when they traverse a plane. My geometry consists of a cube of water and I irradiate it using a proton beam. I'd like to score the energy of the electrons at a certain depth of the phantom but as my plane is not at a boundary, I'm not sure how to achieve that goal. I'd really appreciate any help about it. Regards.
Re: scoring particles traversing a plane  by Makoto Asai <Makoto Asai>,   Apr 24, 14:22
Re: scoring particles traversing a plane (Balder)
 Hi, I think the simplest way for you is to use a built-in command-based scorer. You don't need to write any additional C++ code to score a flux on a certain plane. Please refer to, for example, examples/extended/runAndEvent/RE03. Hope this helps, Makoto
Re: scoring particles traversing a plane  by Tom Roberts <Tom Roberts>,   Apr 23, 15:26
Re: scoring particles traversing a plane (Balder)
 There are several ways to do this. 1) The simplest is to partition your cube of water into two boxes such that there is a boundary where you want to sample. Then you can use G4UserSteppingAction to handle scoring whenever a track stops at the desired boundary. 2) In principle you could place a volume into a secondary world such that there is a boundary where you want to sample. This can make the sample plane be independent of the volumes in the mass (default) world. I was not able to get this to work, however (but that was many releases ago and it may well work now). 3) Do it yourself: represent the plane as a point and a 3-vector normal to the plane. In UserSteppingAction determine whether the step crosses the plane by examining step->GetPreStepPoint() and step->GetPostStepPoint(); for steps that cross the plane, linearly interpolate to the plane and do the sampling. For better accuracy (smaller interpolation distance), you could couple this with a process that limits the step size near the plane, or simply limit the step size globally or within the enclosing volume. NOTE: if the sampling plane happens to coincide with a volume boundary, then you must handle the case where both points are on the plane (ignore such steps); you must also handle the case where one of the points is on the plane, taking care to not double count. G4beamline is an open-source program based on Geant4 that has code for (3) in its 'zntuple' command. It can be downloaded from http://g4beamline.muonsinc.com . But be aware it is a large and non-trivial program.
Re: scoring particles traversing a plane  by Balder <Balder>,   Apr 25, 09:48
Re: Re: scoring particles traversing a plane (Tom Roberts)
 Hi Tom, many thanks for your well-explained replay. I think I could use point 3 as the energy in the pre-step point could be a good approximation of the energy when it crosses the plane when my step is small. Regards,
rdecay02 - how to collect energy from gamma rays ?  by Hubert Chiron <Hubert Chiron>,   20 Mar, 2018
 Hello dear workers of Geant4 I wish to use rdecay02 with geant4-10.4. and with G4GeneralParticleSource. But when I am looking for energies from gamma rays in the detector, I never saw them. I simulate 137Cs and never I see the 661 keV. I have noticed that in the Run.cc there is in the EnoOfRun() method, a G4cout to resume the run with the energy of the nucleus but it is not possible to modify the energy in the mac file with /gps/ene/mono or /gps/energy. So I notice that in the same method I have a line "compute mean Energy deposited and rms in detector" and I don't understand how the fEdepDetect is compute. Therefore, with /tracking/verbose 2 I see very well the gammas through the detector. How can I solve this problem ? Best regards Hubert
Re: rdecay02 - how to collect energy from gamma rays ?  by Hubert Chiron <Hubert Chiron>,   21 Mar, 2018
Re: rdecay02 - how to collect energy from gamma rays ? (Hubert Chiron)
 hi dear users it's ok now, I find my little gamma, just a need to go to my ophtalmologist! Best regards Hubert
Forced Collision in daughter volumes  by Youming Yang <Youming Yang>,   01 Mar, 2018
 Hello Geant4 community, I could not find much documentation on forced collisions, so I would just like to inquire here: I am attempting to perform a reweighting of a photon as it flies through a geometry that contains daughter volumes, and utilize the forced collision class to properly calculate the reweighting given interactions that could have occurred. If I apply forced collisions to the mother volume, the particle will: 1. clone when entering biasing volume (one particle will free-flight, other will force collide) 2. Exit biasing when entering daughter volume (do whatever it needs to do in this volume) 3. Clone when re-entering mother volume, again one particle will free-fly and other will collide In the above, ray-tracing cannot be gauranteed in daughter volume at step 2. If I apply forced collision to just the daughter volume, then ray-tracing cannot be gauranteed in the mother volume itself. When I try to apply forced collisions to the mother _and_ daughter volume, I see this warning message:  > ********************************************************************************************************* > * G4Track Information: Particle = gamma, Track ID = 2, Parent ID = 1 > ********************************************************************************************************* > > Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName > 0 0 0 -10 1 0 0 490 > test.phys initStep > Proposing biasing operation SharedForceInteraction > Proposing biasing operation SharedForceInteraction > Operation applied SharedForceInteraction > Operation applied SharedForceInteraction > 1 0 0 -9.9 1 0 0.1 490 test1.phys Transportation > Proposing biasing operation SharedForceInteraction > Proposing biasing operation SharedForceInteraction > Proposing nonphysics biasing operation Cloning > Operation applied Cloning > Operation applied SharedForceInteraction > Operation applied SharedForceInteraction > 2 0 0 -9.9 1 0 0 490 test1.phys biasWrapper(0) > 3 0 0 9.9 1 0 19.8 510 test.phys Transportation > Proposing nonphysics biasing operation Cloning > Operation applied Cloning > 4 0 0 9.9 1 0 0 510 test.phys biasWrapper(0) > Proposing biasing operation FreeFlight-compt > Proposing biasing operation FreeFlight-phot > > -------- WWWW ------- G4Exception-START -------- WWWW ------- > *** G4Exception : BIAS.GEN.05 > issued by : G4BOptnForceFreeFlight::ApplyFinalStateBiasing(...) > Initial track weight is null ! > > *** This is just a warning message. *** > -------- WWWW -------- G4Exception-END --------- WWWW ------- > > Operation applied FreeFlight-phot > > -------- WWWW ------- G4Exception-START -------- WWWW ------- > *** G4Exception : BIAS.GEN.05 > issued by : G4BOptnForceFreeFlight::ApplyFinalStateBiasing(...) > Initial track weight is null ! > > *** This is just a warning message. *** > -------- WWWW -------- G4Exception-END --------- WWWW ------- > > Operation applied FreeFlight-compt > 5 0 0 10 1 0 0.1 510 World Transportation > Exiting Biasing. > Exiting Biasing. > Exiting Biasing. > Exiting Biasing. > Exiting Biasing. > 6 0 0 1e+04 1 0 9.99e+03 1.05e+04 OutOfWorld Transportation > > ********************************************************************************************************* > * G4Track Information: Particle = gamma, Track ID = 16, Parent ID = 2 > ********************************************************************************************************* I am wondering if this behavior is known/intended? thank you in advance. Ming
Re: Forced Collision in daughter volumes  by Marc Verderi <Marc Verderi>,   01 Mar, 2018
Re: Forced Collision in daughter volumes (Youming Yang)
 Hi Ming,  Thank you for your message, at first sight it indeed looks to be an anomaly on Geant4 biasing's side. Can you tell a bit more about your setup ? Do you have a test case ?  Cheers, Marc 
Re: Forced Collision in daughter volumes  by Youming Yang <Youming Yang>,   02 Mar, 2018
Re: Re: Forced Collision in daughter volumes (Marc Verderi)
 On Fri, 02 Mar 2018 05:38:01 GMT, Marc Verderi wrote: > Hi Ming, > > Thank you for your message, at first sight it indeed looks to be an anomaly on > Geant4 biasing's side. > Can you tell a bit more about your setup ? Do you have a test case ? > > Cheers, > Marc >  Hi Marc, Thank you for such a prompt reply. I have simply modified the detector construction for GB02 to include a daughter volume that also intercepts the path of the primary beam. I have attached the DetCon. Thank you, Ming  Attachment: http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2018/03/02/10.26-33183-02DetectorConstruction.cc 
Problem with G4PSPopulation.cc (Population Scorer)  by Michael McManus <Michael McManus>,   01 Mar, 2018
 Hi all, I was wondering if anyone could clarify the definition of "population" as a scoring quantity. I have tried to score the 2D particle position distribution on a square surface from a point source of geantinos with a theta angle set to 10 degrees, but I do not get the expected uniform distribution. However, I get the expected distribution when scoring cellFlux. I have looked at G4PSPopulation.cc although I am not certain what the code is actually producing. Thanks in advance, Michael McManus
defining of the sensitive detectors in SteppingAction  by masume soleimaninia <masume soleimaninia>,   21 Feb, 2018
 Dear Experts, Hello I want to simulate a microelectronic structure and to expose it with protons.It has a region called sensitive region which has two separate sections in my structure. one is a repeated squares filled with Si & SiO2 and bottom of them there is a layer composed of just Si,(both of parts are sensitive regions). there are a number of layers above the sensitive region and I just want to know the deposited energy in sensitive regions. I used example of B1 to make this structure. please tell me what should I put instead of Scoring Volume in Stepping Action? I attached a part of the program in the following which I commented the redundant layers in them. I mean it is just defined for sensitive region. I hope I could clarify the question. Thanks in advance  Attachment: http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2018/02/21/04.22-20075-B1DetectorConstruction.hh http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2018/02/21/04.22-79268-B1SteppingAction.hh http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2018/02/21/04.22-30732-B1DetectorConstruction.cc http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2018/02/21/04.22-2128-B1SteppingAction.cc 
Best way to score radially symmetric quantities  by William Donahue <William Donahue>,   27 Jan, 2018
 Hi, I am embarking on a radial dose model validation study and would like to find the best way to score doses radially. Basically, I want to score in r and z but not theta. I am planning on using the multi-threaded kernel so I can't decide if I want to use the command-based scoring or a sensitive detector. I eventually want to score things like LET and other quantities so I need it to be flexible. Additionally I would like to score the central core of the track separately, preferably only with primaries. If someone could point to a good direction, with a little bit of a starting hint that would be great. I am very comfortable with C++ so the coding shouldn't be an issue. My thoughts so far have been 1) Command based scoring: but the inputs of the command are ambiguous for cylindrical volumes. 2) Construct many ring like geometries in r and depth, and assign each a primitive scorer. This seems a little time consuming, even with replicas. Also keeping track of all the scorers could be a pain. 3) Do a hit collection and post process at end of run. This might be a pain because then I have to deal with the calculations of correctly distributing the dose into my sub-volumes. 4) Step based scoring. Once again need to deal with all the dose distributions in each step across my boundaries. So if you have any suggestions on which way is most efficient please elaborate more. Expanding/explaining techniques to implement one of my thoughts is a good place to start too. Thanks, William Donahue
Re: Best way to score radially symmetric quantities  by michel maire <michel maire>,   28 Jan, 2018
Re: Best way to score radially symmetric quantities (William Donahue)
 On Sat, 27 Jan 2018 17:30:54 GMT, William Donahue wrote: > Hi, > > I am embarking on a radial dose model validation study and would like to > find the best way to score doses radially. > > Basically, I want to score in r and z but not theta. I am planning on > using the multi-threaded kernel so I can't decide if I want to use the > command-based scoring or a sensitive detector. I eventually want to > score things like LET and other quantities so I need it to be flexible. > Additionally I would like to score the central core of the track > separately, preferably only with primaries. > > If someone could point to a good direction, with a little bit of a > starting hint that would be great. I am very comfortable with C++ so the > coding shouldn't be an issue. > > My thoughts so far have been > > 1) Command based scoring: but the inputs of the command are ambiguous > for cylindrical volumes. > > 2) Construct many ring like geometries in r and depth, and assign each a > primitive scorer. This seems a little time consuming, even with > replicas. Also keeping track of all the scorers could be a pain. > > 3) Do a hit collection and post process at end of run. This might be a > pain because then I have to deal with the calculations of correctly > distributing the dose into my sub-volumes. > > 4) Step based scoring. Once again need to deal with all the dose > distributions in each step across my boundaries. > > So if you have any suggestions on which way is most efficient please > elaborate more. Expanding/explaining techniques to implement one of my > thoughts is a good place to start too. > > Thanks, > > William Donahue >   1- You are not obliged to use scorers or hits collections (many examples in electromagnetic or hadronic do not). See TestEm2 (the closest of your geometry) or TestEm3 2- TestEm11 or TestEm12 show option : stepMax versus replica 3- basic/B4 illustrates the different strategies to record informations : user actions, hits collections, scorers. 
Scoring in G4Tubs Cylinder type Volume  by Marian Lückhof <Marian Lückhof>,   24 Jan, 2018
 Hello Everyone, I am new to Geant4 and have a question regarding scoring volumes. I created an example of a photon beam entering a cylinder at one end (front face) and would like to apply a simple scoring task, to count the entering photons on that surface. That brought me to G4PSCylinderSurfaceCurrent. My detector implementation: G4VSolid* tubeSolid = new G4Tubs("scoring tube", 0.*cm, 20.*cm, 25.*cm, 0.*deg, 360.*deg); fScoreLogical = new G4LogicalVolume(tubeSolid, air, "tubLog"); new G4PVPlacement(0, // Rotation of 90 deg G4ThreeVector(0., 0., 35.*cm),// translation fScoreLogical, // its logical volume "tubePhysical", // its name fpWorldLogical, // mother volume false, // 0); // copy number G4SDManager* manager = G4SDManager::GetSDMpointer(); G4MultiFunctionalDetector* detector = new G4MultiFunctionalDetector( "MyDetector" ); manager->AddNewDetector( detector ); fScoreLogical->SetSensitiveDetector( detector ); G4PSCylinderSurfaceCurrent * scorer = new G4PSCylinderSurfaceCurrent( "photonScorer", fCurrent_In ); G4SDParticleFilter * photonFilter = new G4SDParticleFilter( "photonFilter" ); photonFilter->add( "gamma" ); scorer->SetFilter( photonFilter ); detector->RegisterPrimitive( scorer ); And I record the event as such: void BeamTestRun::RecordEvent(const G4Event* anEvent) { numberOfEvent++;   // Get the hits collection G4HCofThisEvent* eventHitCollection = anEvent->GetHCofThisEvent();  if ( !eventHitCollection ) { G4cout << " *** Warning: no hits collection!" << G4endl; return; }  // Update our private fMap // iter is the iterator, starting at the first element of fMap // std::map< G4int, G4THitsMap* >::iterator iter = fMap.begin();  // as long as iterator does not reach the end of fMao //  while ( iter != fMap.end() ) { G4int id = iter->first; G4cout << " * iterating through fMap" << " " << id << G4endl;  // Get the hit collection corresponding to "id" // G4THitsMap* eventHitsMap = dynamic_cast< G4THitsMap* >( eventHitCollection->GetHC(id) );  // Expect this to exist // assert ( 0 != eventHitsMap ); G4cout << " -------- HitsMap SUMMARY -------- " << G4endl; eventHitsMap->PrintAllHits(); G4cout << " -------- --------------- -------- " << G4endl;  // Accumulate event data into our G4THitsMap map // *( iter->second ) += *eventHitsMap;  iter++; } } My naive assumption would be, that if a beam of 10 photons hits the front face of the cylinder, the count would be 10, normalized to the surface area. However, it is 0. The HitsMap summary gives 0 entries. Repeating this example with a box as sensitive detector and G4PSFlatSurfaceCurrent, results in the expected outcome of the counter with an entry in the hitsmap. I hope, that someone can push me into the right direction. Is there something wrong with the setup/readout? Or maybe me understanding of the scorer G4PSCylinderSurfaceCurrent is wrong. Repeated tests with the source inside the cylinder and photons hitting the inner surface (not the front face) also gave a result of 0. If additional code is required to solve this, please ask. Many thanks in advance!
Bias first, but only first, interaction?  by Jason Brodsky <Jason Brodsky>,   18 Jan, 2018
 I would like to simulate a population of MeV-scale gammas that undergo photoelectric effect or Compton scatter at a particular location. In other words, I would like to control the first interaction of these gammas, forcing it to be at a particular location, but would like the simulation to proceed normally after that first interaction. Is there a good way to go about this? Things I have considered: G4PhotoElectricEffect::SetCrossSectionBiasingFactor(1e12); (similar for the Compton process) This will force the gamma to interact essentially instantly. I can generate gammas at the desired location and they will definitely interact there. However, this also affects the physics after the first interaction (relevant for Compton scatters, Bremsstrahlung, etc.). Geometric biasing: kill all gammas that leave the desired interaction location before the first interaction. This has the disadvantage that I will simulate many events and keep few of them. It saves time compared to no biasing, but probably not enough. Custom primary generator: Do not use GPS to make gammas, but instead write a custom generator that will begin the event with the correct products of the first gamma interaction. This would be the most desirable outcome, but my understanding is that I'd have to write my own code for the photoelectric/Compton behavior of the first interaction before letting the existing G4 p.e./Compton processes take over once tracking begins.
Re: Bias first, but only first, interaction?  by Marc Verderi <Marc Verderi>,   02 Feb, 2018
Re: Bias first, but only first, interaction? (Jason Brodsky)
 Hi Jason, Sorry for the slow answer. When you say you want to force the interaction at a given location, is this at a given point or inside a given volume ? If this is inside a given volume, examples/extended/biasing/GB02 should give you something rather close to what you need. This example implements a forced collision in a scheme similar to the MCNP one : when the track enters the volume, one copy is made and is having an interaction forced inside the volume, an other copy is done, flying though the volume without interaction. In your case I understand you are not interested in this second copy. If so, we may iterate to see how to deal with that (the simplest solution would be to kill this second copy).  Cheers, Marc 
Re: Bias first, but only first, interaction?  by Marc Verderi <Marc Verderi>,   02 Feb, 2018
Re: Re: Bias first, but only first, interaction? (Marc Verderi)
 Hi Jason, Yes, G4BOptnForceFreeFlight is implicitly enabled by the biasing operator G4BOptrForceCollision (implemented in geant4/source/processes/biasing/generic). As said in the readme, the logic of this operator is quite complex. This would be possible to define an other and quite simpler biasing operator, making only the force collision part, if you need to always discard the free flight part. Cheers, Marc On 03/02/2018 00:53, Jason Brodsky wrote: > Hi Marc, > > GB02's Readme says that it uses G4OptnForceFreeFlight, but I don't see > that implemented in the actual code (searching the code for that class > name). Is it implicitly enabled by some other step? > > Thanks, > Jason > > On Fri, Feb 2, 2018, 9:41 AM Jason Brodsky > wrote: > > Hi Marc, > > That sounds just like what I'm looking for. I was looking to do > the forced interaction at a given point, but I can of course just > define a small volume and do it that way. Killing the split copy > should be straightfoward; I'll let you know if I can't figure out > how to identify it. > > Thanks, > Jason > > > > On Fri, Feb 2, 2018 at 8:32 AM, Marc Verderi > wrote: > > > *** Discussion title: Biasing and Scoring > > Hi Jason, > > Sorry for the slow answer. > > When you say you want to force the interaction at a given > location, is > this at a given point or inside a given volume ? > > If this is inside a given volume, > examples/extended/biasing/GB02 should > give you something rather close to what you need. This example > implements a forced collision in a scheme similar to the MCNP > one : when > the track enters the volume, one copy is made and is having an > interaction forced inside the volume, an other copy is done, > flying > though the volume without interaction. In your case I > understand you are > not interested in this second copy. If so, we may iterate to > see how to > deal with that (the simplest solution would be to kill this second > copy). > > Â Cheers, > Â Marc > > ------------------------------------------------------------- > Visit this GEANT4 at hypernews.slac.stanford.edu > message (to reply or > unsubscribe) at: > http://hypernews.slac.stanford.edu/HyperNews/geant4/get/biasing_scoring/248/1.html > > [ MIME part of type text/html without a name stripped ] 
Clarification about use of GetPre/Post Step Point at boundaries  by Francesco Collamati <Francesco Collamati>,   09 Dec, 2017
 Hello everybody! I realised I have a simple but deep doubt regarding the difference there is among the quantities related to PreStepPoint and PostStepPoint. I clarify my doubt with a simple example: I have a beta emitting source, and I want to store characteristics( namely: X, Y, Z, Directive cosines XYZ and Energy) of electrons that enter my detector (placed just above the source volume). For this purpose I've developed a UserSteppingAction in which I simply ask "if(ThisVol->GetName()=="Source" && NextVol->GetName()=="Detector") { [store stuff] }" I've red that since the step ends at the boundary of the new volume, for XYZ position I should use GetPostStepPoint.. right. My doubt is instead regarding the cosines: after several trials, I have the "impression" that using step->GetPostStepPoint()->GetMomentumDirection().getX() my particles seem to have already suffered by Multiple Scattering in the detector volume IN THE FOLLOWING INTERACTION, while I am willing to store the angle with which the particles enter the detector itself! Something similar goes on with the energy.. Which point should I use to have the energy my electrons will have available to spend in the detector? thanks!
Re: Clarification about use of GetPre/Post Step Point at boundaries  by Alexey Solovyev <Alexey Solovyev>,   14 Dec, 2017
Re: Clarification about use of GetPre/Post Step Point at boundaries (Francesco Collamati)
 I'm not g4 dev, but at G4SteppingManager.cc on lines 191, 195 and 209 (for 10.4) you can see, that the InvokeAlongStepDoItProcs() followed by fStep->UpdateTrack() and then followed by InvokePostStepDoItProcs(), and Multiple scattering is a subclass of G4VContinuousDiscreteProcess, which has both AlongStep and PostStep. So, if you need you results only here and do not interesting in following other physics in your project, you can just deactivate multiple scattering, how it is done e.g. in examples/extended/TestEm5 (via "/process/inactivate msc" macro). If you need simultaneously calculate both what you need here without msc and all the following project with msc, than I believe you can use Parallel world concept of G4 with separate physics for each world. Or maybe someone more experienced or g4 dev will suggest more. Also it may be safer to use aStep->GetTrack()->GetVolume()/aStep->GetTrack()->GetNextVolume() in general instead of GetPostStepPoint here.
Plot neutron capture Cross Section of He3  by Neo <Neo>,   26 Oct, 2017
 Hello everyone, I want to get neutron capture cross section of He3 from thermal to several MeV by Geant4. I have tried to study for long time but I found no way to resolve that problem. Can you suggest me some ideas or any reference example? Many thanks.
Re: Plot neutron capture Cross Section of He3  by Marc Verderi <Marc Verderi>,   27 Oct, 2017
Re: Plot neutron capture Cross Section of He3 (Neo)
 Hello, You may better post your question to "Hadronic Processes", such cross-section plots are possible, you should find the help there. Marc
Re: Plot neutron capture Cross Section of He3  by Neo <Neo>,   30 Oct, 2017
Re: Re: Plot neutron capture Cross Section of He3 (Marc Verderi)
 Thank you for your recommendation. Sincerely,
Variance reduction  by smr.srsd <smr.srsd>,   11 Oct, 2017
 Hi, I want to apply the variance reduction on particle weight, what should i do ? Who can help me?
Re: Variance reduction  by Marc Verderi <Marc Verderi>,   18 Oct, 2017
Re: Variance reduction (smr.srsd)
 Hello, Your question is very vague, could you tell more about what you want to do ? Marc
Re: Variance reduction  by smr.srsd <smr.srsd>,   19 Oct, 2017
Re: Re: Variance reduction (Marc Verderi)
 Hi Marc verderi ... how can i weight particles? In my work, I compared the results of simulating the eye with experimental data, and because there is a difference, I need to run a lot, but run time is very long. I want to apply reduce the variance. I used cutoff in physics, but I want to weigh the particle. Thanks
Re: Variance reduction  by Marc Verderi <Marc Verderi>,   23 Oct, 2017
Re: Re: Variance reduction (smr.srsd)
 Hello, When you want to score -say the energy deposit in some volume- you will do: E_volume = Sum ( e_deposit(i) * weight(i) ) where the sum runs on "i" and e_deposit(i) is the deposit by some track during a step "i" in which the track had the weight weight(i) . Marc On 19/10/2017 22:13, smr.srsd wrote: > *** Discussion title: Biasing and Scoring > > Hi Marc verderi ... how can i weight particles? In my work, I compared > the results of simulating the eye with experimental data, and because > there is a difference, I need to run a lot, but run time is very long. I > want to apply reduce the variance. I used cutoff in physics, but I want > to weigh the particle. > > Thanks > > ------------------------------------------------------------- > Visit this GEANT4 at hypernews.slac.stanford.edu message (to reply or unsubscribe) at: > http://hypernews.slac.stanford.edu/HyperNews/geant4/get/biasing_scoring/245/1/1.html 
Neutron energy deposit on hafnium dioxide  by <jeonyboy@gmail.com>,   02 Oct, 2017
 Hello all, I am trying to figure out neutron energy deposit for energies from low to high (1~200 MeV) in a hafnium dioxide box the size of 5x10x10 nm^3. I am using a B4d based program, however I get no energy deposits no matter what I try. I tried setting the set/cut to 1um but no changes still. Am I missing something?
Re: Neutron energy deposit on hafnium dioxide  by michel maire <michel maire>,   04 Oct, 2017
Re: Neutron energy deposit on hafnium dioxide
 On Tue, 03 Oct 2017 03:22:57 GMT, jeonyboy wrote: > Hello all, > > I am trying to figure out neutron energy deposit for energies from low > to high (1~200 MeV) in a hafnium dioxide box the size of 5x10x10 nm^3. I > am using a B4d based program, however I get no energy deposits no matter > what I try. I tried setting the set/cut to 1um but no changes still. Am > I missing something? >   Let me try to quantify what Michael said. In example Hadr03, I have defined hafnium dioxide material, and ran the attached macro. As you can see on output, the mean free path ( or interaction length) of neutron (10 MeV) is 4.68 cm. Therefore the probability to have one interaction within 10 nm is 10 nm/4.68 cm = ~2 10^-7  In other words, you must have ~5 10^6 neutrons beam to get one interaction, or 5 10^9 neutrons to get 1000 interactions. Have you such a statistic ?  Attachment: http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2017/10/04/03.40-36421-hafnium.mac.txt http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2017/10/04/03.40-10094-hafnium.out.txt 
Re: Neutron energy deposit on hafnium dioxide  by <jeonyboy@gmail.com>,   07 Oct, 2017
Re: Re: Neutron energy deposit on hafnium dioxide (michel maire)
 On Wed, 04 Oct 2017 10:44:19 GMT, michel maire wrote: > On Tue, 03 Oct 2017 03:22:57 GMT, jeonyboy wrote: > > > Hello all, > > > > I am trying to figure out neutron energy deposit for energies from low > > to high (1~200 MeV) in a hafnium dioxide box the size of 5x10x10 nm^3. I > > am using a B4d based program, however I get no energy deposits no matter > > what I try. I tried setting the set/cut to 1um but no changes still. Am > > I missing something? > > > > Let me try to quantify what Michael said. > In example Hadr03, I have defined hafnium dioxide material, and ran the attached macro. > As you can see on output, the mean free path ( or interaction length) of neutron (10 MeV) is 4.68 cm. > Therefore the probability to have one interaction within 10 nm is 10 nm/4.68 cm = ~2 10^-7 > > In other words, you must have ~5 10^6 neutrons beam to get one interaction, or 5 10^9 neutrons to get 1000 interactions. > Have you such a statistic ? > > Attachment: > http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2017/10/04/03.40-36421-hafnium.mac.txt > http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2017/10/04/03.40-10094-hafnium.out.txt >  Hi, following your helpful and detailed explanation, I have upped the neutron particle shot from 2x10^6 to 2x10^8 but still energy deposits are being observed. Maybe because the B4d example I am basing has default cut range much greater than nm? So I am trying run/setCut 1 nm in my executable file before running the macro file. It takes really long time for it to process, hopefully this will work. I really appreciate your help.  http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2017/10/07/05.00-73673-10MeVNeutron2x10_8.txt 
Re: Neutron energy deposit on hafnium dioxide  by michel maire <michel maire>,   09 Oct, 2017
Re: Re: Neutron energy deposit on hafnium dioxide
 On Sat, 07 Oct 2017 12:09:54 GMT, jeonyboy wrote: > > Hi, following your helpful and detailed explanation, I have upped the > neutron particle shot from 2x10^6 to 2x10^8 but still energy deposits > are being observed. Maybe because the B4d example I am basing has > default cut range much greater than nm? > 1- It is not directly related. Kinetic energy of secondaries which are not generated (e.g. below threshold) are counted in the dE/dx of the primary particle. I would suggest to keep default cut ( ~ 1 mm). Playing with cuts will be a later refinement.  2- Make sure that you have neutronHP in your physics list (compare with hafnium.out.txt).  3- Around 1 eV, neutron capture dominates, cross section increases, mean free path is "only" ~0.5 mm Then ~10^7 events would allow to see few interactions.  4- At most energies, elastic collisions may be important. The recoil nucleus contributes to energy deposition. But, for various reasons, this recoil nucleus is not generated by default. To create it, make sure that your physics list includes the statement setCutValue(0*mm, "proton") Instead, you can use the command /run/setCutForAGivenParticle proton 0. mm (if you do not understand well what I am speaking about, play with Hadr03 ...)  5- I tried your exercice with Hadr07. I attach macro, output and plot. As you will see, there are 94 interactions for 10^7 events.  Attachment: http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2017/10/09/09.47-57787-hafnium.out.txt http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2017/10/09/09.47-61635-hadr07.mac.txt http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2017/10/09/09.47-76278-hadr07.out.txt http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2017/10/09/09.47-48419-edep.gif 
Re: Neutron energy deposit on hafnium dioxide  by <jeonyboy@gmail.com>,   10 Oct, 2017
Re: Re: Neutron energy deposit on hafnium dioxide (michel maire)
 So I created executable file for Hadr07 and ran the identical macro file and I got zero energy deposits unlike your attached files. 0 entries at all actually. I checked and the cut value for proton is 0 mm like you suggested as well. Visual shows that the neutron is going through the absorber. Am I missing something?  Attachment: http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2017/10/10/08.03-36212-hafnium_neutron.PNG http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2017/10/10/07.58-82817-G4Data0.heprep http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2017/10/10/08.09-52436-hf.PNG 
Re: Neutron energy deposit on hafnium dioxide  by michel maire <michel maire>,   10 Oct, 2017
Re: Re: Neutron energy deposit on hafnium dioxide
 On Tue, 10 Oct 2017 15:10:01 GMT, jeonyboy wrote: > So I created executable file for Hadr07 and ran the identical macro file > and I got zero energy deposits unlike your attached files. 0 entries at > all actually. I checked and the cut value for proton is 0 mm like you > suggested as well. Visual shows that the neutron is going through the > absorber. Am I missing something? > Could you send an output of your run ? 
Re: Neutron energy deposit on hafnium dioxide  by <jeonyboy@gmail.com>,   10 Oct, 2017
Re: Re: Neutron energy deposit on hafnium dioxide (michel maire)
 Here are my input and output files.  Attachment: http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2017/10/10/11.28-408-neutron.in http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2017/10/10/11.28-37749-neutron.outOn Tue, 10 Oct 2017 17:27:35 GMT, michel maire wrote: > On Tue, 10 Oct 2017 15:10:01 GMT, jeonyboy wrote: > > So I created executable file for Hadr07 and ran the identical macro file > > and I got zero energy deposits unlike your attached files. 0 entries at > > all actually. I checked and the cut value for proton is 0 mm like you > > suggested as well. Visual shows that the neutron is going through the > > absorber. Am I missing something? > > > Could you send an output of your run ? > 
Re: Neutron energy deposit on hafnium dioxide  by michel maire <michel maire>,   10 Oct, 2017
Re: Re: Neutron energy deposit on hafnium dioxide
 On Tue, 10 Oct 2017 18:29:44 GMT, jeonyboy wrote: > Here are my input and output files. > > Attachment: > http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2017/10/10/11.28-408-neutron.in > http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2017/10/10/11.28-37749-neutron.out   You did not build material HfO2 in DetectorConstruction. By default the absorber is G4_Si 
Re: Neutron energy deposit on hafnium dioxide  by <jeonyboy@gmail.com>,   09 Oct, 2017
Re: Re: Neutron energy deposit on hafnium dioxide (michel maire)
 On Mon, 09 Oct 2017 16:54:32 GMT, michel maire wrote: > 1- It is not directly related. Kinetic energy of secondaries which are not generated (e.g. below threshold) are counted in the dE/dx of the primary particle. I would suggest to keep default cut ( ~ 1 mm). Playing with cuts will be a later refinement. > > 2- Make sure that you have neutronHP in your physics list (compare with hafnium.out.txt). > > 3- Around 1 eV, neutron capture dominates, cross section increases, mean free path is "only" ~0.5 mm > Then ~10^7 events would allow to see few interactions. > > 4- At most energies, elastic collisions may be important. The recoil nucleus contributes to energy deposition. But, for various reasons, this recoil nucleus is not generated by default. > To create it, make sure that your physics list includes the statement setCutValue(0*mm, "proton") > Instead, you can use the command /run/setCutForAGivenParticle proton 0. mm > (if you do not understand well what I am speaking about, play with Hadr03 ...) > > 5- I tried your exercice with Hadr07. I attach macro, output and plot. As you will see, there are 94 interactions for 10^7 events. >  Wow thank you so much for your help. That is exactly what I wanted to see. I tried to replicate your simulation but I did not have hadr07 example because I am using 10.2 so I upgrade to 10.3 (Windows) but now I am having compiling error at ElectromagneticPhysics.cc where it says I am missing two members from G4EmParameters and indentifer "GetParticleIterator" being undefined. I have updated all the data files as well and am downloading the G4TENDL1.3 just in case this data set is needed for Hadr07. I apologize if my questions are incredibly basic c++ language stuff. I am trying to google/search to find answers but running into walls. Thank you again sincerely!  Attachment: http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2017/10/09/23.33-81709-hadr07.PNG 
Re: Neutron energy deposit on hafnium dioxide  by <jeonyboy@gmail.com>,   10 Oct, 2017
Re: Re: Neutron energy deposit on hafnium dioxide
 Scratch my last post please. I recompiled after getting rid of the 10.2 version of Geant4 and it went through without any coding issue. I will attempt running the neutron simulations now. Thank you! If I may ask though what's so different about Hadr07 that it creates neutron energy deposition cases because neither Hadr06 or B4d example gave any returns and I was using the preconstructed physics such as FTFP_BERT_HP which is supposed to target neutron interaction?
Re: Neutron energy deposit on hafnium dioxide  by Michael H. Kelsey <Michael H. Kelsey>,   02 Oct, 2017
Re: Neutron energy deposit on hafnium dioxide
 On Tue, 03 Oct 2017 03:22:57 GMT, jeonyboy wrote: > I am trying to figure out neutron energy deposit for energies from low > to high (1~200 MeV) in a hafnium dioxide box the size of 5x10x10 nm^3. I > am using a B4d based program, however I get no energy deposits no matter > what I try. I tried setting the set/cut to 1um but no changes still. Am > I missing something?  Neutrons themselves do not deposit energy (they're neutral particles, and energy deposits occur due to electromagnetic interactions). If you are doing something like a SteppingAction and only looking for hits from neutrons, you'll get zero. You need to accept energy deposit from _all_ particles (e.g., a neutron is captured on a nucleus, which subsequently emits gammas or electrons or whatever). Is your box really just nanometers on a side? If the cross-sections for your desired interactions are large enough, then you might see hits, but with only a few hundred atoms in your box, it's likely that most of your simulation events are just "pass through", with no interactions. You may need to make your target larger to see anything.  -- Michael Kelsey 
Re: Neutron energy deposit on hafnium dioxide  by <jeonyboy@gmail.com>,   03 Oct, 2017
Re: Re: Neutron energy deposit on hafnium dioxide (Michael H. Kelsey)
 Hi thank you for your response. Yes I am aware that neutrons dont directly deposit energy since they are neutral in charge. From what I gathered hafnium dioxide has high neutron capture cross section which should result in charged secondary particles. I am not too well versed in c++ language and so using example builds with minor revisions in it. Is example B4d not compatible for neutron secondary energy deposits? Can you recommend a code revision in scoring process or another example I may use for neutron simulations? Thank you very much.
Importance store after geometry update  by Michael Carson <Michael Carson>,   28 Sep, 2017
 Following example B01 I create an importance store in DetectorConstruction using AddImportanceGeometryCell() for different physical volumes. The code runs without issue. After changing a physical volume dimension (during run time via a messenger class) and a ReinitializeGeometry(), the code seg faults with: #0 0x00002aaaaed66721 in operator<<(std::ostream&, G4GeometryCell const&) () from ~/geant4/geant4.10.01.p01-install/lib/libG4geometry.so #1 0x00002aaaaed66614 in operator<<(std::ostream&, std::map > > const&) () from ~/geant4/geant4.10.01.p01-install/lib/libG4geometry.so #2 0x00002aaaaed67938 in G4IStore::GetImportance(G4GeometryCell const&) const () from ~/geant4/geant4.10.01.p01-install/lib/libG4geometry.so It looks like the cell importance can't be determined. Do I need to re-build the importance store after a geometry update? If so, how?
Is there a method to format the output from command line scoring  by Huagang Yan <Huagang Yan>,   27 Sep, 2017
 Hi experts, The .csv output from /score/dumpQuantityToFile is quite verbose and consumes large amount of memory. As a result, when I simulate using ~10^7 photons, I cannot output data with 100*100*100 matrix, but can with 100*100*50 matrix. Is there a way to format the data in the .csv file? Thanks. Huagang.
Re: Is there a method to format the output from command line scoring  by Tim Meehan <Tim Meehan>,   28 Sep, 2017
Re: Is there a method to format the output from command line scoring (Huagang Yan)
 I'm not expert in modifying the scoring subsystem, but I have looked at the part you are interested in. The source file that writes out the CSV file is: "geant4.10.03.p02/source/digits_hits/utils/src/G4ScoreWriter.cc" You can probably write a few subclasses and cause Geant to use your own custom class for formatting output.
Re: Is there a method to format the output from command line scoring  by Huagang Yan <Huagang Yan>,   30 Sep, 2017
Re: Re: Is there a method to format the output from command line scoring (Tim Meehan)
 On Thu, 28 Sep 2017 14:29:28 GMT, Tim Meehan wrote: > I'm not expert in modifying the scoring subsystem, but I have looked at > the part you are interested in. The source file that writes out the CSV > file is: > "geant4.10.03.p02/source/digits_hits/utils/src/G4ScoreWriter.cc" > > You can probably write a few subclasses and cause Geant to use your own > custom class for formatting output. >  Ok, I see the relevant code. Thanks a lot.
A simple question: what is meaning of "entry"?  by Huagang Yan <Huagang Yan>,   26 Sep, 2017
 I am using meshBox to score the dose. The result is dumped to a .csv file. I wonder what is the meaning of "entry", i.e., the last column. I assume it is the copy number of the physical volume to which the corresponding cell belongs. The version I am using is Geant4.10.03.p02. Linux platform. Thanks.
Re: A simple question: what is meaning of "entry"  by Tim Meehan <Tim Meehan>,   28 Sep, 2017
Re: A simple question: what is meaning of "entry"? (Huagang Yan)
 I'm just starting to tinker with Geant4, so I'll try to help you as much as I am able. In "G4VScoreWriter.cc" on about line number 130, the code for writing out a line of data references a std::map object. I think that the information you were looking for is in the header file G4StatDouble.hh - the comments are very sparse, but if I had to guess, it simply counts the number of G4doubles that were used in the other statistics. I suppose that would mean if you were using G4StatDouble to average (1, 2, 3, 4), the average would be 2.5, and "N" (i.e. "Events") would be 4. I have not checked this closely though.
Re: A simple question: what is meaning of   by Huagang Yan <Huagang Yan>,   30 Sep, 2017
Re: Re: A simple question: what is meaning of "entry" (Tim Meehan)
Overlapping scoring mesh effects energy deposit?  by David Takacs <David Takacs>,   25 Sep, 2017
 I have a 3 scoring mesh set up in the origin of my world. On the XY, XZ, and YZ planes.They overlap. Initially I thought this would not effect the energy deposited in them but after plotting the results there is a visual cross in the place where the planes overlap. Has anyone encountered such problems before? Screenshot of results: http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2017/09/25/10.31-27986-xy_coll0_C.PNG 
Re: Overlapping scoring mesh effects energy deposit?  by Juliana Cristina Martins <Juliana Cristina Martins>,   05 Feb, 2018
Re: Overlapping scoring mesh effects energy deposit? (David Takacs)
 Hi, I am also trying to find an answer for this. I also have 3 meshes overlapping and it seems that the dose deposit in them is affected by the overlap...I also thought it would not be a problem since the mesh is "a parallel world..." Does anyone has any idea about this? Thanks a lot! Juliana
How to add another sensitive detector type to the command-based scoring system?  by Tim Meehan <Tim Meehan>,   13 Sep, 2017
 Hi - I would like to try to add a new sensitive detector type to the command-based scoring system. I figured that a good place to start would have been G4ScoringManager.cc, but I am only beginning to get familiar with the layout of the source code. I also wasn't sure how to add my sensitive detector class so that the macro command would pick it up, like below (where my type would be "doseInRem"): ... /score/quantity/doseInRem dosemap ... Any advice would be appreciated ... Thanks 
SOLVED: How to add another sensitive detector type to the command-based scoring system?  by Tim Meehan <Tim Meehan>,   21 Sep, 2017
Re: How to add another sensitive detector type to the command-based scoring system? (Tim Meehan)
 For whoever is interested, I figured out what I did wrong. I implemented my sensitive detector class, and the "3D" sensitive detector subclass ... but in G4ScoreQuantityMessenger.cc, in the call "mesh->SetPrimitiveScorer(ps)" my "ps" was an instance of the wrong class.
Re: How to add another sensitive detector type to the command-based scoring system?  by Tim Meehan <Tim Meehan>,   14 Sep, 2017
Re: How to add another sensitive detector type to the command-based scoring system? (Tim Meehan)
 I figured out how to add the command, but the problem I have now is that when I dump the the quantity to file, everything is in the (0, 0) location. I tried follow the form of the existing primitive scorer classes as closely as I could. To summarize what I did, I started with a copy of the existing source tree in my home directory, and added the new primitive scorer classes (a "regular" PS class, and a "3D" PS class) to “~/geant4.10.03.p02_working/source/digits_hits/scorer”. I also needed to modify the “sources.cmake” file there as well. Next, I needed to make the interactive system aware of the new scorer. I had to modify “G4ScoreQuantityMessengerQCmd.cc” (which is the implementation of the function G4ScoreQuantityMessenger::QuantityCommands — I simply added my new command to the end of the function), and “G4ScoreQuantityMessenger.cc”. After that, I was able to compile everything without error, ran “make” and then “make install” and then loaded up my problem. I was able to get the quantity loaded with: /score/quantity/remDose rem_dose I ran some particles through it, and then dumped it to file with: /score/dumpQuantityToFile dose_slab rem_dose dosemap_rem.csv However, the whole file has zeros in it, except for the first line: # mesh name: dose_slab # primitive scorer name: rem_dose # iX, iY, iZ, total(value) [NoUnit], total(val^2), entry 0,0,0,35421788.46339133,6509346278844.741,10013 0,1,0,0,0,0 0,2,0,0,0,0 0,3,0,0,0,0 0,4,0,0,0,0 0,5,0,0,0,0 Any ideas out there? 
Cross-section Biasing Weights  by <ljb>,   17 Aug, 2017
 Hi, I'm interested in cross-section biasing and have been testing it out with the example GB01. I've modified the code slightly; just to record some hit information in the target. The only biasing I'm applying is a 2x scaling of the cross-section, and only for neutrons. When I look at the particle weights (recorded for each particle step in the target), there is a distribution of weights that includes values > 1. This is surprising to me; I thought the weight would be set by (unweighted process cross-section)/(weighted process cross-section). If that's true then there should be events that are weighted by 0.5 (neutron interactions), and events that are weighted by 1 (non-neutron interactions), and any multiple of 0.5 (for successive neutron interactions). So why are there weights > 1? Lindsey.
Re: Cross-section Biasing Weights  by Marc Verderi <Marc Verderi>,   21 Aug, 2017
Re: Cross-section Biasing Weights
 Hello, You may refer to our last general paper for some more details, but, to summarize, when you modify the interaction law (and changing the cross-section falls in this case) you have two types of weight to consider:  - the weight for non-interaction, W_NI, over the step of length l - this the ratio of non-interaction probabilities over the step in the non-biased and biased schemes - in the case of cross-section change this is W_NI = exp[-(s_a-s_b)*l], where s_a and s_b are the analog and biased cross-sections respectively. In your case you have s_b > s_a hence -(s_a-s_b)*l > 0 and W_NI > 1 .  - the weight for interaction at distance l, W_I - this the ratio of interaction probabilities at distance l into the non-biased and biased schemes - in the case of cross-section change this is W_I = s_a / s_b and is 0.5 in your case. Then you have two possible cases :  - a step 0 -> l ending with no interaction (eg : geometry boundary) at distance l : in this case the particle weight is multiplied by W_NI ; always > 1 in your case - a step 0 -> l ending with an interaction at distance l : in this case the particle weight is multiplied by W_NI * W_I ; which can take any positive value, including values above 1. So having weights > 1 is indeed expected.  Cheers, Marc
Re: Cross-section Biasing Weights  by <ljb>,   22 Aug, 2017
Re: Re: Cross-section Biasing Weights (Marc Verderi)
 Great, thanks for the reference, and for your clear explanation! A further question: can you direct me to a good reference for combining weighted interactions at the event level? (For instance, to combine weights correctly to get the weight for the total energy deposit in a volume during an event).
Re: Cross-section Biasing Weights  by Marc Verderi <Marc Verderi>,   23 Aug, 2017
Re: Re: Cross-section Biasing Weights
 Hello, You will not have "the" weight for the total energy deposit, but you will do a weighted sum: E_total_deposit_in_volume = Sum ( E_deposit_by_track_in_volume * weight_of_track ) where the Sum hence runs over all deposits in the volume, each of these being weighted by the track weight at deposit time (ie : weight at PreStepPoint ). Cheers, Marc On 23/08/2017 05:14, lindsey.bignell@anu.edu.au wrote: > *** Discussion title: Biasing and Scoring > > Great, thanks for the reference, and for your clear explanation! A > further question: can you direct me to a good reference for combining > weighted interactions at the event level? (For instance, to combine > weights correctly to get the weight for the total energy deposit in a > volume during an event). > > ------------------------------------------------------------- > Visit this GEANT4 at hypernews.slac.stanford.edu message (to reply or unsubscribe) at: > http://hypernews.slac.stanford.edu/HyperNews/geant4/get/biasing_scoring/238/1/1.html 
Re: Cross-section Biasing Weights  by <ljb>,   28 Aug, 2017
Re: Re: Cross-section Biasing Weights (Marc Verderi)
 OK, that makes sense. I agree there seems to be a lack of solid references: maybe an expert should write a book ;) Thanks again for your help. Lindsey.
Re: Cross-section Biasing Weights  by <ljb>,   28 Aug, 2017
Re: Re: Cross-section Biasing Weights (Marc Verderi)
 OK, that makes sense. I agree there seems to be a lack of solid references: maybe an expert should write a book ;) Thanks again for your help. Lindsey.
Re: Cross-section Biasing Weights  by <ljb>,   28 Aug, 2017
Re: Re: Cross-section Biasing Weights (Marc Verderi)
 I think I am misunderstanding your response, because my naive interpretation doesn't seem right. Consider an event with a single energy deposit in a volume of 1 MeV, given by a particle with a weight of 0.1, are you suggesting to add a count to the bin at 100 keV? I would think the thing to do in this situation would be to add 0.1 counts to the 1 MeV bin. Of course that's a simple case: if there is another particle depositing 1 MeV with a weight of 0.2, or the weight changes during its transport through the volume, it's not clear to me how to accumulate the spectrum. Is there an approach (or reference) that covers this general case?
Re: Cross-section Biasing Weights  by Marc Verderi <Marc Verderi>,   28 Aug, 2017
Re: Re: Cross-section Biasing Weights
 Hello, Yes, you are right for what concerns the histogram. The weight has to be considered "as the probability to observe XX" (compared to the probability in "real life"). Actually it is not a probability as this can take value >> 1 ; so, it is called the weight ;) When you fill an histogram in energy and observe 1 MeV, with a weight 0.1, then this 1 MeV has to be entered in the bin containing 1 MeV but entered with a weight 0.1. In other words, the 1 MeV bin content is augmented by 0.1 . The weight value is the one at the time the track makes the deposit : ie during the last step taken. If the track continues in the same volume and has its weight changing step after step, you should each time consider the energy deposit of the step with the weight of this same step. Now a comment when you compute an energy deposit as E_total = Sum (E_i * w_i ) , with "i" being for each track deposit (ie each step with deposit). If you start from an histogram, with bins labeled by "k", you will compute the total energy in the histogram as E_total = Sum ( E_k * C_k ) where E_k is the central energy of bin k and C_k is the content of this bin. Now if you increase the number of bins to infinity, each bin will contain at most one value (one E_i) and this bin content will be the weight (w_i) for that E_i deposit. Getting the total energy, summing on the "bins", you see you will do E_total = Sum ( E_i * w_i). Q.E.D. ;) I admit I prefer this argument rather than the straight way of saying E_total = Sum (E_i * w_i ) as this may create confusion, as you said, about the fact we may wrongly interpret as a deposit "E_i * w*i". For a total energy deposit one could say "who cares ?" but for physics this is of key importance : assume you are interested in processes with thresholds, or that take place at given energies : eg photo-electric. Saying the energy transfered to the medium is E_i (with "probability w_i) or is E_i*w_i is totally different, and, in the last (and wrong case), one would completely misunderstand the rate of photoelectric emissions for example. (BTW, Geant4 does it right, no worries ;) ). About references, I find this is not so trivial : these sort of "day by day" thinkings are not often exposed (as least from what I saw). I use quite the MCNP reference manual, and the book (but quite more theoretical) "rare event simulation using Monte Carlo methods", G. Rubino & B. Tuffin, where there is a first part more on principles, and then examples of application in various fields, including the particle transport, part which is written by ... one of the MCNP author, Thomas Booth. Certainly a more expanded documentation in Geant4 may help... Marc On 28/08/2017 09:34, lindsey.bignell@anu.edu.au wrote: > *** Discussion title: Biasing and Scoring > > I think I am misunderstanding your response, because my naive > interpretation doesn't seem right. Consider an event with a single > energy deposit in a volume of 1 MeV, given by a particle with a weight > of 0.1, are you suggesting to add a count to the bin at 100 keV? > > I would think the thing to do in this situation would be to add 0.1 > counts to the 1 MeV bin. > > Of course that's a simple case: if there is another particle depositing > 1 MeV with a weight of 0.2, or the weight changes during its transport > through the volume, it's not clear to me how to accumulate the spectrum. > Is there an approach (or reference) that covers this general case? > > ------------------------------------------------------------- > Visit this GEANT4 at hypernews.slac.stanford.edu message (to reply or unsubscribe) at: > http://hypernews.slac.stanford.edu/HyperNews/geant4/get/biasing_scoring/238/1/1/1/1.html 
command based scoring problem  by Huagang Yan <Huagang Yan>,   13 Aug, 2017
 We are using a box mesh (command-based scoring) to calculate the dose distribution of a complex structure, in which there are many irregular volumes and the mesh may cross several volumes. When the number of primary photons was small, everything went well. However, when the number of photons was about 50000 or more, and the bins of boxmesh were something like 100 × 100 × 2, the program cannot output score files, it is like lasting forever. However, the usage of CPU had gone down which indicated that the simulation of physics processes might have ended, but it couldn't completely finish and no score files were generated. We don't think this is a problem of the RAM size or disk space of our computer (64GB RAM), because when we set the number of bins to 100×100×2, it couldn't work, but if we set it to 1000×1000×1, it worked (the overall size of the mesh is the same)! Strangely, when we adjust the size of the mother volume of the structure, the maximum number photons at which the program can run smoothly varies a lot, even not in a monotonous pattern. We noticed an error message: .... G4ScoringMessenger::MeshBinCommand - G4ScoringBox ERROR: No current scene. Please create one. Is the error related to the problem? How to correct it? Any help is greatly appreciated.
Re: command based scoring problem  by Huagang Yan <Huagang Yan>,   13 Aug, 2017
Re: command based scoring problem (Huagang Yan)
Ambiguous hit collection  by Noah Steinberg <Noah Steinberg>,   20 Jun, 2017
 Hello, I have looked through these forums and found several people asking this question but have found no solutions. In my Geant4 simulation I have 2 different types of sensitive detector classes, TgtSD and ScintillatorSD. In my DetectorConstruction file I have created a target and scintillator bars, I attach a TgtSD to my target, and a ScintillatorSD to my scintillator bars like this:  G4String TargetSDname = "g4PSI/" + label_; G4VSensitiveDetector* TargetSD = SDman->FindSensitiveDetector(TargetSDname); if (TargetSD == NULL) { TargetSD = SD_target_ = new g4PSITargetSD(TargetSDname, label_ + "_Collection", min_p_, min_theta_); SDman->AddNewDetector( TargetSD ); };  if (target_log_) target_log_->SetSensitiveDetector( TargetSD );  G4String ScintSDname = "g4PSI/ScintillatorPost" + label_; G4VSensitiveDetector* PostSD = SDman->FindSensitiveDetector(ScintSDname); if (PostSD == NULL) { PostSD = SD_post_ = new g4PSIScintillatorSD(ScintSDname, 4, label_ + "_Collection" ); SDman->AddNewDetector( PostSD ); };  if (scintplane_log_) scintplane_log_->SetSensitiveDetector( SD_post_); Now everything works correctly, my sensitive detector info is correctly written out to a ROOT file with all appropriate information, but I get this message for every single event  is ambiguous. I think this has something to do with me using the same hit_collection for both sensitive detectors, but I am not sure. Any help would be appreciated. Thank you.
Re: Ambiguous hit collection  by Tim Meehan <Tim Meehan>,   20 Sep, 2017
Re: Ambiguous hit collection (Noah Steinberg)
 I'm pretty new to Geant4, but I figured that the string "is ambiguous" would be easy to find in the codebase. As far as I can tell, it shows up in G4SDManager::GetCollectionID(G4String). http://www.apc.univ-paris7.fr/~franco/g4doxy/html/classG4SDManager.html The test performed in that code is comparing a return value from a G4HCTable member of the G4SDManager. It seems that the -2 returned by G4HCtable::GetCollectionID(G4String) happens when the name supplied as the G4String is in the list of names two (or more) times. http://www.apc.univ-paris7.fr/~franco/g4doxy/html/classG4HCtable.html#135a0ac56d7a91fed556962b1267c744 Hope that helps ...
Example B1 scoring volumes  by Tim Fulcher <Tim Fulcher>,   29 May, 2017
 Hi all, is there way to set both volumes in example B1 as separate scoring volumes? TIA Tim
Re: Example B1 scoring volumes  by Tim Meehan <Tim Meehan>,   20 Sep, 2017
Re: Example B1 scoring volumes (Tim Fulcher)
How to calculate the deposited energy in a material of a mixture  by Kevin Fu <Kevin Fu>,   17 May, 2017
 Hi all, Currently I am trying to model a gas detector, which contains a mixture of two gases: a scintillator and hydrogen. If I use the G4MultiFunctionalDetector, it is the energy deposited in the logical volume is calculated, i.e., the energy deposited in the gas mixture. Is there a way to just calculate the deposited energy in the scintillator? Any idea would be appreciated. Thanks.
Re: How to calculate the deposited energy in a material of a mixture  by <Synthex>,   18 May, 2017
Re: How to calculate the deposited energy in a material of a mixture (Kevin Fu)
 Hello; Sensitive Detector is applied to a logical volume, so the energy deposition will be calculated on the registered material (that can be a mixture). Try changing your mixture to low-pressure hydrogen then pure gold to see the difference in recorded energy deposition.
Re: How to calculate the deposited energy in a material of a mixture  by Kevin Fu <Kevin Fu>,   04 Jun, 2017
Re: Re: How to calculate the deposited energy in a material of a mixture
 Thanks for the response. Because I want to model the hydrogen gas at 3 atm, so the hydrogen material in my definition was with density 3*rho and the pressure was explicitly set to 3 atm, where rho is the density of hydrogen at 1 atm. Do you mean I maintain the density of the hydrogen gas as 3*rho but set the pressure to a lower value, say 1e-5 atm? In addition, is there an alternative scoring method to calculate the material-specific energy deposition in my case of a mixture of materials in a volume? Thanks.
G4AnalysisManager -> uneven bins  by <Synthex>,   10 May, 2017
 Dear all; I modified the B3 example so fit my needs, with a SensitiveDetector filling a 1D histogram in RunAction (no HistoManager.cc). The tracked quantities are step lengths and energy at entrance of neutrons. I want to implement uneven bins (for instance using the Buggle energy group), but the following method seems static: (in B3RunAction::BeginOfRunAction)   G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();   analysisManager->SetVerboseLevel(1);   analysisManager->SetFirstHistoId(1);   //Create a 1d histo   analysisManager->CreateH1("1", "Step Lengths", 200, 0., 4.);   analysisManager->CreateH1("2", "Energy distribution",                   100, 0.001, 10000000                   );   // Create a new output file   analysisManager->OpenFile("NS"); The user documentation, chapter 9.2.3.1 mentions log scales and custom bin edges, but the Histogram is invoked in a different procedure: G4int CreateH1(const G4String& name, const G4String& title,                  const std::vector& edges,                  const G4String& unitName = "none",                  const G4String& fcnName = "none");) I cannot find any example using the latter histogram generation method, can anyone send me a .cc or an example? Thank you very much    Attachment:       http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2017/05/10/04.36-42099-B3RunAction.cc
 Hi, I am trying to simulate gamma transfer through water and bone, attached snapshots of the simulation geometrical setup: blue and white boxes are water and bone. Gray panels are x-ray detectors. As seen in snapshot 2 (attached), when generating 100 gamma particles the majority are back-scattered away from the detectors. Clearly a biasing technique should be implemented. Any suggestion or example on how to force these rare events? I read the documentation and the most relevant solution I found was using force-flight, however, I could not find any examples that implement it. Any advise would be very appreciated as I am new to this tool. Thanks, Adam  Attachment: http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2017/03/31/05.51-57477-1.png http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2017/03/31/05.51-83404-2.png 
 Hello G4 Users! I am new to this comprehensive tool and would like to get some advise on the following project: I would like to simulate (in the most simplistic way) a flat panel x-ray detector response to x ray radiation that transports through a certain material. regarding the detector - should I use a mesh scorer and record incoming tracks of gamma particles? or is it better to create replications of sensitive detectors that are constructed in a grid and record hits within them? I am happy to hear other suggestions/ links to helpful examples Thanks a lot, Adam
Splitting problem for secondary generated by RadioactiveDecay process  by Min Cheol Han <Min Cheol Han>,   06 Mar, 2017
 In simulation code, I have used a spitting technique by using USERBiasingOperation and USERBiasingOperator class derived from G4VBiasingOperation and G4VBiasingOperator, respectively. However, when a particle meets RadioactiveDecay process, the weight of secondaries generated by RadioactiveDecay process is initialized, that is, the weight value of secondaries is set to 1, regardless of the perent's weight value. Could you check the source code to address this problem???
Re: Splitting problem for secondary generated by RadioactiveDecay process   by Makoto Asai <Makoto Asai>,   06 Mar, 2017
Re: Splitting problem for secondary generated by RadioactiveDecay process (Min Cheol Han)
 Hi, Thank you for spotting the issue. We do have a bug here. We will open a bug report and track the fix. Kind regards, Makoto Asai On 3/6/17, 5:34 PM, "Min Cheol Han" wrote: > >*** Discussion title: Biasing and Scoring > >In simulation code, I have used a spitting technique by using >USERBiasingOperation and USERBiasingOperator class derived from >G4VBiasingOperation and G4VBiasingOperator, respectively. However, when >a particle meets RadioactiveDecay process, the weight of secondaries >generated by RadioactiveDecay process is initialized, that is, the >weight value of secondaries is set to 1, regardless of the perent's >weight value. > >Could you check the source code to address this problem??? > >------------------------------------------------------------- >Visit this GEANT4 at hypernews.slac.stanford.edu message (to reply or >unsubscribe) at: >http://hypernews.slac.stanford.edu/HyperNews/geant4/get/biasing_scoring/23 >0.html [ MIME part of type application/ms-tnef stripped ] 
Bug report about cylinderMesh  by Huagang Yan <Huagang Yan>,   02 Mar, 2017
 I used cylinderMesh in my simulation. In a uniform field of radiation, when I change /score/mesh/nbin 1 1 1 to /score/mesh/nbin 1 n m, where m is greater than 1 and n can be any positive integer, the scored dose is nearly halved. However, /score/mesh/nbin k n m gives approximate dose to that of /score/mesh/nbin 1 1 1 as long as k is greater than 1.
Scoring electrons depends on StepMax   by Ibrahim <Ibrahim>,   16 Feb, 2017
 Dear geant4 users, Scoring electrons emanating from a sample and reaching a pixelated detector is affected by StepMax and in particular very small StepMax! Why the step limiter or StepMax affect largely the simulation results? And how to find a trustful StepMax in the case of thin targets (e.g. from 200 nm to 1 um)? Thanks in advance. Best regards Brahim
Two questions about biasing  by Huagang Yan <Huagang Yan>,   14 Feb, 2017
 What I want to simulate is the dose deposit of a small volume in a large volume 50000 times bigger in each dimension. I adapted ExampleB01, and used several concentric shells each assigned with different importance(innermost volume has the biggest importance). These shells all have the world as their mother volume. The whole volume is irradiated with X-ray photons. Water is the only material used. Q1: is it possible to kill the secondary electrons using Russian Roulette? When I attempted to increase the importance and the number of irradiating photons, the program can get killed. I think the reason might be too many electrons need to be tracked. Q2: The dose deposit for the inner volumes sometimes is zero, when no photons get there. This is understandable. However, for those volume(shells) that do have dose deposit, the dose values are very strange, basically follow this pattern of magnitude(in terms of approximate ratio) from outer to inner: 1, ..., 1, 3~5, 0.1~0.3, 0,.... This pattern repeats itself when I use another seed of random number engine, so I think it is not due to fluctuation. I wonder what's wrong with my program. Any help is greatly appreciated. Huagang.
Different outputs from same conditions!  by Ali <Ali>,   14 Feb, 2017
 Hello In my simulation setup. i detect the proton population quantity in the different surface detectors (Cubic mesh detectors are perpendicular to the proton source direction). Detectors are at equal distances from one another. I,m using this commands in my macrofile (for example for two detector). ############################################################################  /score/create/boxMesh boxMesh_1  /score/mesh/boxSize 2. 2. .05 cm /score/mesh/nBin 150 150 1 /score/mesh/translate/xyz 0. 0. 69. cm /score/quantity/population protonpopu1 /score/filter/particle protonFilter proton /score/close ##############  /score/create/boxMesh boxMesh_2 /score/mesh/boxSize 2. 2. .05 cm /score/mesh/nBin 150 150 1 /score/mesh/translate/xyz 0. 0. 79. cm /score/quantity/population protonpopu2 /score/filter/particle protonFilter proton /score/close ######################################## /score/list /run/beamOn 200000  /score/dumpQuantityToFile boxMesh_1 protonpopu1 proton1.txt  /score/dumpQuantityToFile boxMesh_2 protonpopu2 proton2.txt ################################################################################ when i run the code just for one the detector (by deleting the other mesh detectors in macro commands), my output is different with output from the ruing code with all detectors!! Is there something wrong in my macro commands for definition and detection the quantity in detectors?? Thanks a lot
Biasing already registered processes (from reference physics)  by Michael H. Kelsey <Michael H. Kelsey>,   10 Feb, 2017
 I would like to apply simple biasing (secondary particle splitting) to processes which have already been registered into the appropriate ProcessManagers. Specifically, my physics list uses G4EmPenelopePhysics to get a proper set of standard, reference processes and models. Then, I want to go through the process lists for gammas and electrons, and replace some of those processes with G4WrapperProcess versions. I've confirmed that I properly instantiate each wrapper process, that it calls "RegisterProcess()" correctly with the underlying "analog" process pointer. Then I try to replace the process pointer with my new wrapper, thus:  // Find the processes which involve atomic de-excitation G4ProcessVector* theProcs = particle->GetProcessManager()->GetProcessList(); for (G4int i=0; isize(); i++) { G4VProcess* aProcess = (*theProcs)[i];  // Look for specific processes, matching types instead of strings if (aProcess->GetProcessType() != fElectromagnetic) continue; if ( (aProcess->GetProcessSubType() == fPhotoElectricEffect) || (aProcess->GetProcessSubType() == fComptonScattering) || (aProcess->GetProcessSubType() == fIonisation) ) { wrapper = new CUG4WrapperFluoSplit(aProcess, FLUO_SPLIT); (*theProcs)[i] = wrapper; // Replace base process with wrapper } } This is done inside ConstructProcess(), immediately after calling back to the base G4VModularPhysicsList::ConstructProcess(). But during the run, my wrapper process never gets called! Instead, the underlying base processes still seem to be there and active. Is what I'm trying to do just not allowed? Do I really have to copy the G4EmPenelopePhysics.cc code and build the physics myself from scratch?  -- Michael Kelsey 
Re: Biasing already registered processes (from reference physics)  by Michael H. Kelsey <Michael H. Kelsey>,   13 Feb, 2017
Re: Biasing already registered processes (from reference physics) (Michael H. Kelsey)
 On Fri, 10 Feb 2017 19:12:51 GMT, Michael H. Kelsey wrote: > I would like to apply simple biasing (secondary particle splitting) to > processes which have already been registered into the appropriate > ProcessManagers. Specifically, my physics list uses G4EmPenelopePhysics > to get a proper set of standard, reference processes and models. Then, I > want to go through the process lists for gammas and electrons, and > replace some of those processes with G4WrapperProcess versions.  Answering my own question: To do this properly, you must call G4ProcessManager::RemoveProcess() and ::AddProcess(), and that must be done outside the loop where you are looking for processes to wrap (otherwise, you will invalidate the iterator!). So I implemented my action in two loops. First, I have an empty std::vector which I fill with the base processes I want to wrap. Once that's finished, I loop over that vector, call procMan->RemoveProcess() for the base process, wrap the base process as desired, then call procMan->AddProcess() with the wrapper. For completeness, I query procMan to get the "position indices" for each base process, and apply those same indices to the wrapper. That way, the process ordering is preserved.  -- Michael Kelsey 
Simulation time/Sensitive scoring  by <jeonyboy@gmail.com>,   06 Feb, 2017
 Hello, I have been trying to get energy deposition in a detector I created (a rectangle box with "sensitive" smaller rectangles inside). I was first using hadr06 example based program but I just could not figure out how to use sensitive scorer in it. I tried learning it by looking at B4d example (geant4 scorer) and tried integrating the code in hadr06 but I was not successful. So I made a program based on B4d example instead and was able to get sensitive scoring but the simulation time is incredibly long. I was wondering if anyone could guide me on how to make it possible to use sensitive scoring in hadr06 example and give me an answer on why the simulating time in B4d example is so much longer and how to make it shorter (I need to run up to 100,000,000 so it's taking +30 minutes). Thank you very much!  Attachment: http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2017/02/06/20.50-41892-4dDetectorConstruction.cc 
Re: Simulation time/Sensitive scoring  by William Donahue <William Donahue>,   27 Jan, 2018
Re: Simulation time/Sensitive scoring
Do I have to take the exception information seriously?  by Huagang Yan <Huagang Yan>,   01 Feb, 2017
 Hi experts, I adapted the exampleB01 of biasing to calculate the dose and ionizations in a small volume(a few nanometers) placed in a large volume(hundreds of micrometers). Below shows the exception message. Do I have to take it seriously? By the way, I cannot find a proper scorer that can count the ionizations properly. Could you advise me on this as well? So far, I cannot succeed in scoring quantities in the small volume. When the importance value is large, or the number of events is large, the program terminates abnormally. Thanks, Huagang. ====================================================================== ++ ConcreteSD/Collisions id 0 ++ ConcreteSD/CollWeight id 1 ++ ConcreteSD/Population id 2 ++ ConcreteSD/TrackEnter id 3 ++ ConcreteSD/SL id 4 ++ ConcreteSD/SLW id 5 ++ ConcreteSD/SLWE id 6 ++ ConcreteSD/SLW_V id 7 ++ ConcreteSD/SLWE_V id 8 ### Run 0 start. -------- WWWW ------- G4Exception-START -------- WWWW ------- *** G4Exception : GeomBias1001 issued by : G4ImportanceAlgorithm::Warning() Calculate() - ipre_over_ipost ! in [0.25, 4]. ipre_over_ipost = 0.02. *** This is just a warning message. *** -------- WWWW -------- G4Exception-END --------- WWWW ------- 
Transmitted Intensity Data from Lead not building correct Linear Attenuation Coefficient  by Sahra <Sahra>,   31 Jan, 2017
 Hi, i would appreciate any help i can get with this, thank you for reading, I have built a simulation of a very thin lead cylinder inside a vacuum. I placed the envelope with the particle gun, behind the lead cylinder, and the idea is to 'count' the number of gamma rays transmitted through this lead. I vary the thickness of the lead, each time, and build a graph of thickness (cm) against Ix/Io(Transmitted Flux/Initial Flux). However, when calculating the function of this curve, the measurements i collected using geant4 do not match the NIST Tables of Linear Attenuation Coefficients listed on the web. I simulate 10,000 gamma rays at 6MeV, and what i should get is a linear Attenuation Coefficient of ~0.505. Instead what i get is -0.022 after three simulations: 6MeV x Incident Intensity Transmitted Intensity Pb. Thickness (cm) I(o) I(x) Ix/Io 0.22 10000 9943 0.9943 0.3125 10000 9908 0.9908 0.625 10000 9849 0.9849 I am using a very simple detector construction, Primary Generator Action and Action Initialization. My first thought was maybe the physics list i was using, which is FTFP_BERT had a significant play on this, but i do not understand physics lists enough to be able to make a judgement. Even a link to a somewhat similar question on this forum would be much appreciated. Thank you so much for your help, Sahra
Re: Transmitted Intensity Data from Lead not building correct Linear Attenuation Coefficient  by michel maire <michel maire>,   01 Feb, 2017
Re: Transmitted Intensity Data from Lead not building correct Linear Attenuation Coefficient (Sahra)
 On Tue, 31 Jan 2017 15:43:18 GMT, Sahra wrote: > Hi, i would appreciate any help i can get with this, thank you for > reading, > > I have built a simulation of a very thin lead cylinder inside a vacuum. > I placed the envelope with the particle gun, behind the lead cylinder, > and the idea is to 'count' the number of gamma rays transmitted through > this lead. > > I vary the thickness of the lead, each time, and build a graph of > thickness (cm) against Ix/Io(Transmitted Flux/Initial Flux). However, > when calculating the function of this curve, the measurements i > collected using geant4 do not match the NIST Tables of Linear > Attenuation Coefficients listed on the web. > > I simulate 10,000 gamma rays at 6MeV, and what i should get is a linear > Attenuation Coefficient of ~0.505. Instead what i get is -0.022 after > three simulations: > > 6MeV x Incident Intensity Transmitted Intensity > Pb. Thickness (cm) I(o) I(x) Ix/Io > 0.22 10000 9943 0.9943 > 0.3125 10000 9908 0.9908 > 0.625 10000 9849 0.9849 > > I am using a very simple detector construction, Primary Generator Action > and Action Initialization. > > My first thought was maybe the physics list i was using, which is > FTFP_BERT had a significant play on this, but i do not understand > physics lists enough to be able to make a judgement. > > Even a link to a somewhat similar question on this forum would be much > appreciated. > > Thank you so much for your help, Sahra >   You may run example TestEm13 with the attached macro. You will see that the cross sections are in agreement with nist-xcom values :  Photon Incoher. Photoel. Nuclear Tot. wo/ Energy Scatter. Absorb. Pr. Prd. Coherent   6.000E+00 1.749E-02 9.894E-04 2.523E-02 4.382E-02   Attachment: http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2017/02/01/13.59-71254-sahra.mac.txt 
Re: Transmitted Intensity Data from Lead not building correct Linear Attenuation Coefficient  by Sahra <Sahra>,   02 Feb, 2017
Re: Re: Transmitted Intensity Data from Lead not building correct Linear Attenuation Coefficient (michel maire)
 Hi Michel,  Thanks a lot! That really helped, it put the data i needed and how to get it, into perspective. Sahra
Forced-flight biasing: Cumulated weight is null !  by Jayson Vavrek <Jayson Vavrek>,   24 Jan, 2017
 I'm running geant4-10-00-patch-02 and attempting to use the G4BOptnForceFreeFlight() class for forced-flight biasing. While I can see in the visualization that my primary gammas are indeed flying freely through the volumes to which I've attached the biasing operator, it appears that the track weights are not being computed under the hood: -------- WWWW ------- G4Exception-START -------- WWWW ------- *** G4Exception : BIAS.GEN.06 issued by : G4BOptnForceFreeFlight::DenyProcessPostStepDoIt(...) Cumulated weight is null ! *** This is just a warning message. *** -------- WWWW -------- G4Exception-END --------- WWWW ------- In my main.cc I have:  physicsList *thePhysics = new physicsList(); G4GenericBiasingPhysics *theBiasingPhysics = new G4GenericBiasingPhysics(); theBiasingPhysics->Bias("gamma"); thePhysics->RegisterPhysics(theBiasingPhysics); runManager->SetUserInitialization(thePhysics); and I have written my own concrete operator class, forcedFlightOperator file forcedFlightOperator.hh: #ifndef forcedFlightOperator_hh #define forcedFlightOperator_hh 1  #include "G4VBiasingOperator.hh" #include "G4BOptnForceFreeFlight.hh"  class forcedFlightOperator : public G4VBiasingOperator { public: forcedFlightOperator(); virtual ~forcedFlightOperator();  G4BOptnForceFreeFlight *GetForceFreeFlightLaw() {return fForceFreeFlightInteractionLaw;}; private: G4BOptnForceFreeFlight *fForceFreeFlightInteractionLaw;  // used for forced flight virtual G4VBiasingOperation *ProposeOccurenceBiasingOperation(const G4Track*, const G4BiasingProcessInterface* );  // unused but required pure virtual functions virtual G4VBiasingOperation *ProposeNonPhysicsBiasingOperation(const G4Track* track, const G4BiasingProcessInterface* callingProcess) { return 0; }; virtual G4VBiasingOperation *ProposeFinalStateBiasingOperation(const G4Track*, const G4BiasingProcessInterface* ) { return 0; }; }; #endif file forcedFlightOperator.cc: #include "forcedFlightOperator.hh" forcedFlightOperator::forcedFlightOperator() : G4VBiasingOperator("forcedFlightOperator") { fForceFreeFlightInteractionLaw = new G4BOptnForceFreeFlight("forcedFlight"); } forcedFlightOperator::~forcedFlightOperator() { delete fForceFreeFlightInteractionLaw; } G4VBiasingOperation *forcedFlightOperator::ProposeOccurenceBiasingOperation(const G4Track*, const G4BiasingProcessInterface*) { return fForceFreeFlightInteractionLaw; } Am I missing something?
Re: Forced-flight biasing: Cumulated weight is null !  by Marc Verderi <Marc Verderi>,   24 Jan, 2017
Re: Forced-flight biasing: Cumulated weight is null ! (Jayson Vavrek)
 Hello Jayson, The behavior you see is indeed correct, this "forced flight" biasing operation is used in the "forced interaction" scheme à la MCNP where one copy of the incoming track is forced to interact in a volume while the other copy is forced to fly through the volume -under a zero weight so that it does not score [in this scheme this would lead to a double counting]- having its weight restored to non-zero (initial weight * weight for free flight) when the volume is crossed. I understand you are interested in having a free flight with the track weight evolving all along the trajectory. Is that correct ? BTW, do you plan to use more recent releases ? (There is no change wrt the free flight, but the underneath biasing code makes the programming of the biasing operations less tricky). Cheers, Marc On Tue, 24 Jan 2017 18:57:05 GMT, Jayson Vavrek wrote: > I'm running geant4-10-00-patch-02 and attempting to use the > G4BOptnForceFreeFlight() class for forced-flight biasing. While I can > see in the visualization that my primary gammas are indeed flying freely > through the volumes to which I've attached the biasing operator, it > appears that the track weights are not being computed under the hood: > > -------- WWWW ------- G4Exception-START -------- WWWW ------- > *** G4Exception : BIAS.GEN.06 > issued by : G4BOptnForceFreeFlight::DenyProcessPostStepDoIt(...) > Cumulated weight is null ! > *** This is just a warning message. *** > -------- WWWW -------- G4Exception-END --------- WWWW ------- > > In my main.cc I have: > > physicsList *thePhysics = new physicsList(); > G4GenericBiasingPhysics *theBiasingPhysics = new G4GenericBiasingPhysics(); > theBiasingPhysics->Bias("gamma"); > thePhysics->RegisterPhysics(theBiasingPhysics); > runManager->SetUserInitialization(thePhysics); > > and I have written my own concrete operator class, forcedFlightOperator > > file forcedFlightOperator.hh: > > #ifndef forcedFlightOperator_hh > #define forcedFlightOperator_hh 1 > > #include "G4VBiasingOperator.hh" > #include "G4BOptnForceFreeFlight.hh" > > class forcedFlightOperator : public G4VBiasingOperator > { > public: > forcedFlightOperator(); > virtual ~forcedFlightOperator(); > > G4BOptnForceFreeFlight *GetForceFreeFlightLaw() {return fForceFreeFlightInteractionLaw;}; > > private: > G4BOptnForceFreeFlight *fForceFreeFlightInteractionLaw; > > // used for forced flight > virtual G4VBiasingOperation *ProposeOccurenceBiasingOperation(const G4Track*, const G4BiasingProcessInterface* ); > > // unused but required pure virtual functions > virtual G4VBiasingOperation *ProposeNonPhysicsBiasingOperation(const G4Track* track, const G4BiasingProcessInterface* callingProcess) { return 0; }; > virtual G4VBiasingOperation *ProposeFinalStateBiasingOperation(const G4Track*, const G4BiasingProcessInterface* ) { return 0; }; > > }; > > #endif > > file forcedFlightOperator.cc: > > #include "forcedFlightOperator.hh" > forcedFlightOperator::forcedFlightOperator() : G4VBiasingOperator("forcedFlightOperator") > { > fForceFreeFlightInteractionLaw = new G4BOptnForceFreeFlight("forcedFlight"); > } > > forcedFlightOperator::~forcedFlightOperator() > { > delete fForceFreeFlightInteractionLaw; > } > > G4VBiasingOperation *forcedFlightOperator::ProposeOccurenceBiasingOperation(const G4Track*, const G4BiasingProcessInterface*) > { > return fForceFreeFlightInteractionLaw; > } > > Am I missing something? > 
Re: Forced-flight biasing: Cumulated weight is null !  by Jayson Vavrek <Jayson Vavrek>,   27 Jan, 2017
Re: Re: Forced-flight biasing: Cumulated weight is null ! (Marc Verderi)
 Hi Marc, That makes sense; thanks for the explanation. What I wanted was for my primaries to penetrate the shielding with 100% probability (but with appropriate weights) so that I didn't spend all my CPU time on attenuation in the shielding. The weight doesn't necessarily need to evolve all along the trajectory. Is forced interaction the way to proceed here? I tried using  G4BOptrForceCollision * fb = new G4BOptrForceCollision("gamma","ForwardBias"); ... fb->AttachTo(...); but it gave similar errors, even on newer versions of Geant4. Thanks, Jayson V.
Re: Forced-flight biasing: Cumulated weight is null !  by Marc Verderi <Marc Verderi>,   28 Jan, 2017
Re: Re: Forced-flight biasing: Cumulated weight is null ! (Jayson Vavrek)
 Hi Jayson, Thank you for the feedback. With the newer G4 version this biasing operation logic is still the same. Let me prepare a sample code that should make what you need (this is more easy to prepare with the newer version).  Cheers, Marc 
Re: Forced-flight biasing: Cumulated weight is null !  by Adam Geva <Adam Geva>,   12 Apr, 2017
Re: Re: Forced-flight biasing: Cumulated weight is null ! (Marc Verderi)
 Hey Marc, Just wondering where can I find that sample code you prepared as it is very similar to a problem I am facing. I am simulating gammas that transport through a water phantom and arrive to the detector. very few gammas actually arrive to the detector so I would like to apply biasing - force-flight. Thanks Adam
simulation gets stuck for small pixel size  by A. Hod <A. Hod>,   18 Jan, 2017
 Dear G4 users, I encountered one problem with scoring mesh. I have the following setup: 10 nm thick SiN layer ( box of 200 nm x 200 nm x 10 nm). This layer is in a vacuum environment. An ideal detector is positioned directly on the bottom of SiN layer and it is divided into 200 x 200 pixels using scoring mesh (pixel size is 1nm x 1nm). An electron beam of 10 keV is used to irradiate the SiN layer. I want to calculate the number of electron reaching the pixels using scoring mesh (e.g. flatSurfaceCurrent. This works nicely for large pixel sizes but using small pixel size as described in this post does not work. The simulation gets stuck after some thousands events. This happen every time when I make the pixel size smaller. Is there a pixel size limit in geant4? Thanks in advance I look forward to receive your helps and suggestions. Cheers A.H.
Re: simulation gets stuck for small pixel size  by Marc Verderi <Marc Verderi>,   31 Jan, 2017
Re: simulation gets stuck for small pixel size (A. Hod)
 Hello, I would suggest to post your message in the "Geometry" forum. Do you have any output (tracking/verbose) when the simulation gets stuck ? Have you seen if this is for example zero length steps occurring ? Cheers, Marc On Wed, 18 Jan 2017 12:41:04 GMT, A. Hod wrote: > Dear G4 users, > > I encountered one problem with scoring mesh. I have the following setup: > > 10 nm thick SiN layer ( box of 200 nm x 200 nm x 10 nm). This layer is > in a vacuum environment. > > An ideal detector is positioned directly on the bottom of SiN layer and > it is divided into 200 x 200 pixels using scoring mesh (pixel size is > 1nm x 1nm). An electron beam of 10 keV is used to irradiate the SiN > layer. I want to calculate the number of electron reaching the pixels > using scoring mesh (e.g. flatSurfaceCurrent. This works nicely for large > pixel sizes but using small pixel size as described in this post does > not work. The simulation gets stuck after some thousands events. This > happen every time when I make the pixel size smaller. Is there a pixel > size limit in geant4? > > Thanks in advance I look forward to receive your helps and suggestions. > > Cheers > > A.H. > 
Primary particle pass through a Cylinder  by Neo <Neo>,   16 Jan, 2017
 Hello everyone, Please help me to resolve a problem, I would like to score all of primaries with its energy that touch a cylinder placed after a target. See below: // sensitive detector "MyDetector" G4MultiFunctionalDetector* detector = new G4MultiFunctionalDetector("MyDetector");  // detector manager G4SDManager* manager = G4SDManager::GetSDMpointer(); manager->AddNewDetector(detector); scoringVolume->SetSensitiveDetector(detector); . . . // primitive Scorer G4PSCylinderSurfaceCurrent* scorer = new G4PSCylinderSurfaceCurrent(name, fCurrent_In);  // filter proton G4SDParticleWithEnergyFilter* filter = new G4SDParticleWithEnergyFilter("Proton Filter"); filter->add("proton"); And the result only be 0 for all energy bin. Do you have any ideal for scoring by using a cylinder? Thank you very much.
Scoring yield of secondary particle  by Neo <Neo>,   10 Jan, 2017
 Dear experts, I have a problem that scoring proton generated in a certain volume when a beam of neutron pass through moderator and interacts with a target. My question: 1. How to define steps inside the target 2. When the neutrons interact with the target. How to get yield proton in the target. Many thanks for any suggestion. Neo.
Filter in Tracking Verbose  by <Synthex>,   09 Jan, 2017
 Hello; As I lack knowledge and time to fully understand Sensitive Detector, I'd like to simply «filter» what the tracking verbose outputs. For instance, I want it to display only information about protons or C12 particles. Is there a way to do so? Thank you and happy new year.
Re: Filter in Tracking Verbose  by michel maire <michel maire>,   09 Jan, 2017
Re: Filter in Tracking Verbose
 On Mon, 09 Jan 2017 11:01:35 GMT, Synthex wrote: > Hello; > > As I lack knowledge and time to fully understand Sensitive Detector, I'd > like to simply �filter� what the tracking verbose outputs. For instance, > I want it to display only information about protons or C12 particles. Is > there a way to do so? > See most of extended/electromagnetic examples 
Re: Filter in Tracking Verbose  by John Apostolakis <John Apostolakis>,   09 Jan, 2017
Re: Filter in Tracking Verbose
 It is possible to substitute the SteppingVerbose class with one of your own -- which would allow you to customise it as you like. John On 09/01/17 12:01, maximelamotte@itn.pt wrote: > *** Discussion title: Biasing and Scoring > > Hello; > > As I lack knowledge and time to fully understand Sensitive Detector, I'd > like to simply «filter» what the tracking verbose outputs. For instance, > I want it to display only information about protons or C12 particles. Is > there a way to do so? > > Thank you and happy new year. > > ------------------------------------------------------------- > Visit this GEANT4 at hypernews.slac.stanford.edu message (to reply or unsubscribe) at: > http://hypernews.slac.stanford.edu/HyperNews/geant4/get/biasing_scoring/217.html 
A naive yet puzzling conceptual question  by Huagang Yan <Huagang Yan>,   07 Jan, 2017
 I have been puzzled with the functionality of SensitiveDetector + Hit Collection(or HitsMap) vs. ordinary Detector + SteppingAction with Ntuple information acquisition. 1. Can the two approaches both collect energy and position information of collisions? 2. Is hit position corresponding to PreStepPoint or PostStepPoint? I am mainly interested in Compton scattering, photoelectric absorption and electronic ionization processes. Any help is greatly appreciated. Huagang.
A problem with exampleGB01.  by Huagang Yan <Huagang Yan>,   01 Jan, 2017
 Hi experts, When I change ParticleGun to GenericParticleSource(GPS), the biasing does not work, even if I specify the particle type in PrimaryGeneratorAction. Generally the details of GPS are specified in command lines. Is there a way to incorporate GPS into volume-specific cross-section biasing? Happy new year! Huagang.
Re: A problem with exampleGB01.  by Marc Verderi <Marc Verderi>,   20 Jan, 2017
Re: A problem with exampleGB01. (Huagang Yan)
 Dear Huagang, Can you tell more about what is not working ? Do you have a problem with the biasing itself or with with something else ? Marc
Re: A problem with exampleGB01.  by Huagang Yan <Huagang Yan>,   22 Jan, 2017
Re: Re: A problem with exampleGB01. (Marc Verderi)
 Marc, My system underwent a crash a few days ago and unfortunately, my trail code was lost. What I can remember is that when I changed the source to GPS, the program terminated unexpectedly. If no others complain about this problems, most probably the cause was that my GPS was not properly used. Thanks, Huagang. On Fri, 20 Jan 2017 12:40:44 GMT, Marc Verderi wrote: > Dear Huagang, > > Can you tell more about what is not working ? Do you have a problem with > the biasing itself or with with something else ? > > Marc >  On Fri, 20 Jan 2017 12:40:44 GMT, Marc Verderi wrote: > Dear Huagang, > > Can you tell more about what is not working ? Do you have a problem with > the biasing itself or with with something else ? > > Marc > 
Energy deposition of backscattered electrons  by A. Hod <A. Hod>,   01 Dec, 2016
 Hi geant4 users, Let assume that I have two volumes. Box1 and Box2. Box1 is pixelated and I want to calculate the accumulated energy deposition, per each pixel, of the electrons entering the Box1 from Box2 as shown in the attached figure using scoring mesh. Do you know how to do it?I studied scoring mesh examples and the geant4 manual without any progress. One can only calculate the number of electrons entering the Box1 from Box2… Thanks and I appreciate your hints. Cheers A.H  Attachment: http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2016/12/01/13.25-92182-Figure.png 
Force radioactive decay  by <anne-catherine.heuskin@unamur.be>,   16 Nov, 2016
 Dear all, I am trying to simulate decay of 137Cs. I would like to match this with experiments from which I know the activity of the source. The idea is to match the number of decaying Cs in experiment to the number of decaying Cs with Geant4. Is there a way to force the decay of a radioactive nuclide, so I don't have to generate non decaying nuclides ? Thanks a lot
Re: Force radioactive decay  by Youming Yang <Youming Yang>,   17 Nov, 2016
 Radioactive isotopes in Geant4 will decay once they reach zero kinetic energy. You should be able to use Geant4 GPS and generate a spatial distribution of the isotope you desire with zero initial kinetic energy, and they will immediately decay into their respective daughter products. See for example:  \examples\extended\radioactivedecay\rdecay01 
Minimum step size for ionization in a gas  by Alfredo Castaneda <Alfredo Castaneda>,   03 Nov, 2016
 Dear experts I am wondering if there is a way to set a minimum step size, I know we can set maximum step size with UserLimits function. I am creating a geant4 simulation that takes into account a muon gun that enters a gas sensitive region and I want to explore the number of primary electrons generated by ionization, As the steps are defined by geant4 I would like to get a handle how to get the number of primary electrons generated? wihtout being affected by the default step selection. Also I am using the following PhysicsList  G4VUserPhysicsList* physics = new FTFP_BERT_HP(); which I am not sure if is ideal for the simulation of ionization processes, or I need to make my custom physics list? Any recommendation on that? Thanks.
looking for a Variance Reduction techique to use with Pencil Beam simulations  by Maura E.M. <Maura E.M.>,   24 Oct, 2016
  I need to find an adequate VR technique to decrease the CPU time of Pencil Beam simulations. The Pencil Beam model couldn't be simpler. It consist of a 6MeV mono-energetic photon point source placed on the top surface of a water cylinder. The goal is to score dose2water in the water cylinder. I tried to use Topas VR technique named "Secondary Biasing. It expects, among the other parameters,the maximum energy, and the name for each process generating the particles to be split. I wish to split ONLY "primary" 6MeV photons into 100 fictitious photons. Therefore I set the MaximumEnergy to 6.18 MeV (nomimal Linac energy). Unluckily this VR technique only filters by an upper energy bound. Thus all photons whose energy is lower than the chosen MaximumEnergy will be split producing replicas of low energy photons which we do not care to track. Furthermore, this VR technique expects the names of the processes that generate the particles to be split (gammas). The problem is to single out the true "primary" photons. In fact the PencilBeam model does NOT include an electron source generating the photons. Geant names the generating process for such 6MeV photons "Primary". To prove it I have added to the PencilBeam model an N-Tuple scorer recording all gammas that hit the water cylinder upper surface, just below the photon source. I am attaching the .header and the .phsp files where you can see (use Excel or MatLab) that most photons are regarded as "Primary" even if their energy is by far lower than 6MeV. The reason is that Geant4 considers photons produced by Compton events as "Primary" regardless of the number of Compton interactions they have had. Is there an appropriate VR technique for the PencilBeam simulations ? In general, is there a VR technique to use whenever the particle source generates gammas rather than electrons ? Any suggestion / comment is greatly appreciated. Thank you in advance. Best regards, Mauede  Attachment: http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2016/10/24/13.23-58559-ROOTOutput.header http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2016/10/24/13.23-82529-ROOTOutput.phsp 
A possible issue associated with cross section biasing  by Huagang Yan <Huagang Yan>,   14 Oct, 2016
 Since it is a bit hard to test, I raise the issue here. I have been wondering if the biasing of cross section will increase the attenuation of incident ray and alter the distribution of its intensity in the medium. I thought there shouldn't be such a problem. But I want to make sure now, because turning on the weighting flag seems to give strange results. Any comment on this issue is highly appreciated.
What is the meaning of the energy deposition of compton scattering?  by chunhui gong <chunhui gong>,   13 Oct, 2016
 Dear All, I am confused with the energy deposition with gamma transportation. I could not understand why do we have the energy deposition during the process of compton scattering process? (using step->GetTotalEnergyDeposit()). Where is this energy from? And what is this meaning?  Also the kinetic energy of secondary electron is not equal to the (PostPoint->KinE- Prepoint->KinE) of the gamma ray. I tried several EM physics, e.g. Standard, Livermore, Penelop, etc. They all have this issue. And also, I was thinking this might because of the secondary production cut. And I tried to set the cut to a very low value, e.g. 0.00001 * nm. But Nothing changed. The step->GetTotalEnergyDeposit() can be up to 1000 eV. Which can not explained by the production cut. Is there anyone have an idea on this? Any help will be very appreciated. Thank you very much. Best, Chunhui
Re: What is the meaning of the energy deposition of compton scattering?  by Daren Sawkey <Daren Sawkey>,   17 Oct, 2016
Re: What is the meaning of the energy deposition of compton scattering? (chunhui gong)
 The difference in the energies is likely the binding energy of the electron. In the LowEPComptonModel, used in emstandard_opt4 for example, the binding energy is accounted for as local energy deposit.
Strange drawProjection  by Huagang Yan <Huagang Yan>,   28 Sep, 2016
 The commands I used to draw the graph are: /score/create/boxMesh boxMesh_1 /score/mesh/boxSize 0.3 0.3 0.3 micrometer /score/mesh/nBin 10 10 10 /score/quantity/energyDeposit eDep /score/close /score/drawProjection boxMesh_1 eDep The box Mesh is small, lying in the center of the cylinder, but the projections extend out of the world! Did I miss something?  Attachment: http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2016/09/28/10.15-17336-snap.jpg 
appropriate biasing method  by Joel Poder <Joel Poder>,   21 Jul, 2016
 Hi, I am performing a simulation with an array of sensitive detectors that are a relatively large distance (~10 cm) away from a brachytherapy source. I need to implement a biasing method to improve the statistics of my simulation. Can anyone recommend an appropriate biasing method for a case like this one? Reverse MC looks promising. Regards, Joel
Weighting and counting of particles in detector  by Steven Walton <Steven Walton>,   14 Jul, 2016
 I'm trying to weight the dosages of radiation by particle type and energy. I found another user that had asked a similar question http://hypernews.slac.stanford.edu/HyperNews/geant4/get/biasing_scoring/164/1/1.html I replicated the code and put it into SteppingAction.cpp The code compiles with no messages but when trying to get the name of the particle I get a seg fault error when a beam hits the detector (in my case the 4th beam. First 3 run fine but don't hit the detector). Running through gdb I get the error 0x000000000040e116 in G4Track::GetDynamicParticle (this=0x5) at /home/steven/.builds/geant4-install/include/Geant4/G4Track.icc:64 64 { return fpDynamicParticle; } Running backtrace I get a lot of errors with QT, G4UIcommand G4RunManager, and the command from main.cpp "ui->SessionStart();" Since I cannot find too much documentation on the subject I want to check the method that I am using to try to accomplish this task. To get the particle name I run G4String particle_name = aStep->GetTrack()->GetDynamicParticle()->GetDefinition()->GetParticleName(); and then I check the volume to see if it is the detector G4VPhysicalVolume *volume = aStep->GetPreStepPoint()->GetTouchableHandle()->GetVolume(); if ( volume == fDetector->GetDet() ) fEventAction->AddAbs(edep); where edep = aStep->GetTotalEnergyDeposit() * weight; fDetector is initialized in the SteppingAction constructor and DetectorConstruction.hh has the line const G4VPhysicalVolume *GetDet() {return TheDetectorIWant'sPhysicalName;} [ MIME part of type text/html without a name stripped ] 
Re: Weighting and counting of particles in detector  by Wesley <Wesley>,   04 Feb, 2017
Re: Weighting and counting of particles in detector (Steven Walton)
 An easier way to check if a particle is in a particular volume is through the volume name. Get the volume name of the current physical volume and check if (name == "DetectorPVname"). In this way, you avoid the stepping action's dependency on your geometry. The seg fault sounds like something wrong in your geometry. Go through it with a fine comb and make sure everything is placed exactly right.
How to replace OGL viewer with HepRepFile viewer for visualization in command based scoring  by Robert Nnaemeka <Robert Nnaemeka>,   09 Jul, 2016
 In runAndEvent RE03, the visualization used is OGL. Unfortunately, I couldn't build the Geant with OGL viewer as all attempts couldn't work. So I settled for HepRepFile. I am trying to modify example RE03 in runAndEvent to visualize flux distribution in my detector volume. All my attempt to replace OGL viewer with HepRepFile viewer couldn't work as nothing was drawn in the generated HepRepFile output. How can I make it use HepRepFile viewer. Thanks very much.
Re: How to replace OGL viewer with HepRepFile viewer for visualization in command based scoring  by Tsukasa Aso <Tsukasa Aso>,   13 Jul, 2016
Re: How to replace OGL viewer with HepRepFile viewer for visualization in command based scoring (Robert Nnaemeka)
 Hi, Please try /vis/open HepRepFile instead of /vis/open OGL. Best regards, 
Scoring mesh causes Step's starting point to move  by Jayson Vavrek <Jayson Vavrek>,   08 Jul, 2016
 Hi all, I'm trying to implement a scoring mesh to tally the passageCellCurrent in a simulation of bremsstrahlung and lead shielding. If I run/beamOn without setting up any scoring, I get the results I expect. However, once I add the scoring mesh, I get approximately one warning on every event: -------- WWWW ------- G4Exception-START -------- WWWW ------- *** G4Exception : GeomNav1002       issued by : G4Navigator::ComputeStep() May lead to a crash or unreliable results.         Position has shifted considerably without notifying the navigator !         Tolerated safety: 1e-06         Computed shift : 1.34858e+07 *** This is just a warning message. *** -------- WWWW -------- G4Exception-END --------- WWWW ------- -------- WWWW ------- G4Exception-START -------- WWWW ------- *** G4Exception : GeomNav1002       issued by : G4Navigator::ComputeStep() Accuracy error or slightly inaccurate position shift.      The Step's starting point has moved 3894.49 mm      since the last call to a Locate method.      This has resulted in moving 3671.88 mm from the last point at which the safety was calculated      which is more than the computed safety= 0 mm at that point.      This difference is 3671.88 mm.      The tolerated accuracy is 1e-06 mm. *** This is just a warning message. *** -------- WWWW -------- G4Exception-END --------- WWWW ------- I know typically these warnings occur via geometry overlaps, but /geometry/test/run still gives the all-clear. I can, however, see a change in the trajectories when I run with the scoring; more trajectories escape from my source shielding, suggesting that their vertices are indeed being displaced. I have also noticed that when running beamOn with scoring, I don't just see the beamOn command, but instead the following: /run/beamOn 1000000 /run/geometryModified More bizarre still, the degree to which the behaviour changes seems to depend on the boxSize of the mesh. Even for similar boxSize parameters, I can get reasonable-looking (but still wrong) results or almost no tallies at all. For reference, here are the relevant lines from the macro: /score/create/boxMesh boxMesh_1 /score/mesh/boxSize 10. 10. 25. cm /score/mesh/nBin 20 20 100 /score/mesh/translate/xyz 56.0876 -4.35 61.5173 cm /score/mesh/rotate/rotateY 55 deg /score/quantity/passageCellCurrent current /score/close /run/beamOn 1000000 /score/dumpQuantityToFile boxMesh_1 current score.txt /score/drawProjection boxMesh_1 current And lastly, here is some output of the recommended /tracking/verbose 1: ********************************************************************************************************* * G4Track Information: Particle = gamma, Track ID = 1, Parent ID = 0 ********************************************************************************************************* Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName     0 2.53 2.55 0.051 1.92 0 0 0 CuPlate initStep     1 13.3 1.41 10.1 1.92 0 14.8 14.8 TheHall Transportation     2 546 -54.8 503 1.92 0 728 743 TheHall boxMesh_1     3 554 -55.6 510 1.92 0 10.3 753 TheHall boxMesh_1     4 555 -55.7 512 1.92 0 2.1 756 TheHall boxMesh_1     5 561 -56.4 517 1.92 0 8.16 764 TheHall boxMesh_1     6 569 -57.2 524 1.92 0 10.3 774 TheHall boxMesh_1     7 573 -57.6 528 1.92 0 5.25 779 TheHall boxMesh_1     8 574 -57.7 529 1.92 0 1.42 781 StainlessSteelHousing1 Transportation     9 576 -57.9 530 1.92 0 2.57 783 TheHall Transportation    10 576 -57.9 530 1.92 0 0 783 TheHall Transportation    11 576 -58 531 1.92 0 1.03 784 TheHall boxMesh_1    12 584 -58.7 538 1.92 0 10.3 794 TheHall boxMesh_1    13 590 -59.4 544 1.92 0 8.41 803 TheHall boxMesh_1    14 591 -59.5 545 1.92 0 1.86 805 TheHall boxMesh_1    15 599 -60.3 552 1.92 0 10.3 815 TheHall boxMesh_1    16 607 -61.1 559 1.92 0 10.3 825 TheHall boxMesh_1    17 607 -61.2 560 1.92 0 1.3 827 TheHall boxMesh_1    18 614 -61.9 566 1.92 0 8.97 836 TheHall boxMesh_1    19 622 -62.7 573 1.92 0 10.3 846 TheHall boxMesh_1    20 625 -63.1 576 1.92 0 4.45 850 TheHall boxMesh_1    21 629 -63.5 580 1.92 0 5.8 856 TheHall boxMesh_1    22 629 -63.5 580 1.92 0 0.0126 856 TheHall boxMesh_1    23 637 -64.3 587 1.92 0 10.3 866 TheHall boxMesh_1    24 642 -64.9 592 1.92 0 7.6 874 TheHall boxMesh_1    25 644 -65.1 594 1.92 0 2.66 877 TheHall boxMesh_1    26 652 -65.9 600 1.92 0 10.3 887 TheHall boxMesh_1    27 659 -66.7 607 1.92 0 10.3 897 TheHall boxMesh_1    28 659 -66.7 608 1.92 0 0.487 898 TheHall boxMesh_1    29 667 -67.5 614 1.92 0 9.78 907 TheHall boxMesh_1    30 667 -67.5 615 1.92 0 1.03 908 StainlessSteelHousing1 Transportation    31 669 -67.7 617 1.92 0 2.57 911 TheHall Transportation    32 674 -68.3 621 1.92 0 6.67 918 TheHall boxMesh_1    33 677 -68.5 624 1.92 0 3.64 921 TheHall boxMesh_1    34 682 -69 628 1.92 0 6.62 928 TheHall boxMesh_1    35 689 -69.8 635 1.92 0 10.3 938 TheHall boxMesh_1    36 694 -70.4 640 1.92 0 6.79 945 TheHall boxMesh_1    37 697 -70.6 642 1.92 0 3.47 948 TheHall boxMesh_1    38 815 -83.1 751 1.92 0 161 1.11e+03 ParallelLayerDet2Extra Transportation    39 817 -83.3 753 1.92 0 2.8 1.11e+03 ParallelLayerDet2Extra compt    40 827 -84.5 763 1.45 0 14.3 1.13e+03 ParallelLayerDet2Extra compt    41 834 -85.8 765 1.22 0 6.69 1.13e+03 ParallelLayerDet2Extra compt    42 851 -90.2 764 0.217 0 18.1 1.15e+03 ParallelLayerDet2Extra compt    43 850 -89.7 764 0 0.088 1.11 1.15e+03 ParallelLayerDet2Extra phot Has anyone observed this behaviour before? Thanks, Jayson V.
Re: Scoring mesh causes Step's starting point to move  by Tsukasa Aso <Tsukasa Aso>,   13 Jul, 2016
Re: Scoring mesh causes Step's starting point to move (Jayson Vavrek)
 Hi, What version of Geant4 are you using? 
Re: Scoring mesh causes Step's starting point to move  by Jayson Vavrek <Jayson Vavrek>,   13 Jul, 2016
Re: Re: Scoring mesh causes Step's starting point to move (Tsukasa Aso)
 geant4-10-00-patch-02 (13-June-2014)
Re: Scoring mesh causes Step's starting point to move  by Jayson Vavrek <Jayson Vavrek>,   11 Jul, 2016
Re: Scoring mesh causes Step's starting point to move (Jayson Vavrek)
 I have also checked out the problem described here: http://hypernews.slac.stanford.edu/HyperNews/geant4/get/biasing_scoring/154.html?inline=-1 The error messages are nearly identical (even down to the "Track stuck, not moving for 25 steps in volume -boxMesh_1_3-") but the solution described therein had no effect on my simulation.
Preferred N-D array in Geant4  by Jan Pipek <Jan Pipek>,   07 Jul, 2016
 Hello, [...no exact forum match, scoring matches only partially...] A couple of times, I had to use a 3D matrix (or 2D, or, in general, an ND-one) of different quantities (for voxel parameters, for field maps, for scoring). Sometimes the matrix item was a G4double, sometimes a G4ThreeVector, but in principle, it can be any other type. In Python world, I would immediately use numpy arrays and would not think a single second. However, when I tried to find a recommended (or at least frequently used) approach to work with N-D data in Geant4 source code (or perhaps CLHEP), I haven't found any. Different components (e.g. scoring meshes, physics tables, ...) use different approaches and many methods repeat the same (index = i*stride[0]*stride[1] + j*stride[0] + k) access to some internal vector again and again (not that it would not be effective, it's only non-DRY). There is an undocumented likely candidate (g4tools/.../array) but it also seems to be specific for the g4tools functionality. So my question is... Is there a generic n-dimensional array/matrix class (ideally templated, accepting any type, efficiently in-lining access) and if not, shouldn't there be? There are many implementations in external libraries (like multi_array in boost, libdynd, ...) and it's not that difficult to write one's own (in fact, an implementation is even described in Stroustrup's C++ book) but perhaps such tool should be a standard part of Geant4/CLHEP for anyone to use without custom coding and external dependencies, like e.g. G4ThreeVector or G4RotationMatrix are? Or is it just that I was not looking carefully? Or that there really is no need? I am sorry, if this is the case :-) Regards,Jan P.S. Once such standard representation exists, more tools (like interpolation, arithmetic operations, geometry-related stuff for 2D/3D case, ...) can be implemented upon it, which, I believe, would save a lot of time for everybody. P.P.S. If there is such interest, I can contribute with some code.
Customize scorer and messenger  by Klas Marcks <Klas Marcks>,   28 Jun, 2016
 I have problems implementing a scorer and a messenger for the scorer. I use Geant4 10.00 under windows 8 and I use Visual Studio 10. Although it I guess it should be possible to do it simpler, I have done the following: I Implemented my own MyOwnRunManager class inheriting from G4RunManager and overrode the methods ContructScoringWorld and UpdateScoring so that they use MyOwnScoringManager and not G4ScoringManager. Implemented MyOwnScoringManager with the members MyOwnScoringMessenger and MyOwnScoreQuantityMessenger. These are almost identical to their G4 counterparts. In MyOwnScoreQuantityMessenger I substitute the G04PSFlatSurfaceFlux3D class with MyOwnPSFlatSurfaceFlux3D class which scores the flux of each side of a box. I have also implemented MyOwnScoringBox since the G4ScoringBox calls methods of the G4ScoringManager. My code compiles but when I run it, I get some strange warnings. Also, only zeroes are scored in the mesh that I set up from my macro-file. The warning(s) look like -------- WWWW ------- G4Exception-START -------- WWWW ------- *** G4Exception : GeomNav1002 issued by : G4Navigator::ComputeStep() Accuracy error or slightly inaccurate position shift. The Step's starting point has moved 149.712 mm since the last call to a Locate method. This has resulted in moving 2.23129 mm from the last point at which the safety was calculated which is more than the computed safety= 0 mm at that point. This difference is 2.23129 mm. The tolerated accuracy is 1e-006 mm.  *** This is just a warning message. *** -------- WWWW -------- G4Exception-END --------- WWWW ------- -------- WWWW ------- G4Exception-START -------- WWWW ------- *** G4Exception : GeomNav1002 issued by : G4Navigator::ComputeStep() May lead to a crash or unreliable results. Position has shifted considerably without notifying the navigator ! Tolerated safety: 1e-006 Computed shift : 4.97866 *** This is just a warning message. *** -------- WWWW -------- G4Exception-END --------- WWWW ------- When I run my example using the G4RunManager and the corresponding call G4ScoringManager::GetScoringManager(); after creating the G4RunManager the example runs without problem. Does any one have any idea of whats going on and how to fix it or any suggestions of alternative methods to go about? Thanks Klas
Re: Customize scorer and messenger  by Makoto Asai <Makoto Asai>,   28 Jun, 2016
Re: Customize scorer and messenger (Klas Marcks)
 Hi, The warning messages you saw are typically issued for volumes that are overlapping. Scorers won't directly cause these warning messages. Thus, I would suggest you to check your geometry definition. I would also suggest you to shoot a simple particle such as geantino and see its steps are limited by the volume boundaries of both the mass world and scoring meshes. Concerning about adding your custom scorers, all you need to add are MyOwnScorer and MyOwnScoreQuantityMessenger, and somewhere in your code (main or detector construction), this messenger has to be instantiated. I don't think you need any other classes. Hope this helps, Makoto
Re: Customize scorer and messenger  by Klas Marcks <Klas Marcks>,   28 Jun, 2016
Re: Re: Customize scorer and messenger (Makoto Asai)
 Hi, Many thanks for the quick response! you mean something like (in main)  G4RunManager* runManager = new G4RunManager; G4ScoringManager *scMan = G4ScoringManager::GetScoringManager(); MyScoreQuantityMessenger *quantMess = new MyOScoreQuantityMessenger(scMan); in main? But How does the program know know about the new messenger? The default messengers and scorers are hardcoded into the G4scoringManager. /Klas
Re: Customize scorer and messenger  by Makoto Asai <Makoto Asai>,   28 Jun, 2016
Re: Re: Customize scorer and messenger (Klas Marcks)
 Hi, Once your messenger instantiates UI commands for your scorer, these commands are automatically available through G4UImanager. In the SetNewValue() method of your messenger class, you firstly have to get the pointer to the "current" mesh, and then instantiate your scorer and assign it to the current mesh. You may refer to this code as a template. Makoto
Re: Customize scorer and messenger  by Klas Marcks <Klas Marcks>,   29 Jun, 2016
Re: Re: Customize scorer and messenger (Makoto Asai)
 Ok! Now I understand. This seems to work! Thank you very much for your quick help! Best regards /Klas
Peculiar problem: Overlapping Voxels in Parallel World affects particle tracks  by Joseph DeCunha <Joseph DeCunha>,   16 Jun, 2016
 I solved a problem that I found peculiar this morning -- and I thought that I'd let members of the community know about it, and also see if anyone has any explanation of what may have caused the problem. I was running the same simulation in two Geant programs, one with no parallel worlds or scoring, and another in my colleague's program with a parallel world scoring class implemented. I thought that I would look at a visualisation of the particle tracks to check that the two simulations were consistent (same GPS source, same detector geometry & random seed) but noticed that the tracks were certainly different. Finding no reason for the discrepancy in results, I moved on to modifying other parts of the program. I noticed that the SphericalParameterisation class that creates scoring spheres in the (non-physical) scoring world, was implemented incorrectly, and had overlapping spheres. As soon as I fixed the scoring spheres the tracks from the two programs were consistent with one another again. I'm having a hard time understanding why overlapping voxels, in a parallel world that should have no interactions with particles in the physical world would yield such results. Has anyone experienced anything similar, or have any ideas on what caused the behaviour I experienced? regards, Joseph
Re: Peculiar problem: Overlapping Voxels in Parallel World affects particle tracks  by Makoto Asai <Makoto Asai>,   28 Jun, 2016
Re: Peculiar problem: Overlapping Voxels in Parallel World affects particle tracks (Joseph DeCunha)
 Hi, Currently, built-in command-based scorer supports box and cylinder meshes only and we do not support spherical mesh. Did you implement sherical mesh by yourself? Could you please explain a bit more detail? Generally speaking, adding a parallel scoring world would make a difference in event-by-event or track-by-track behavior of Geant4 physics simulation, as a step is limited by volume boundaries of not only the mass geometry but also mesh volumes, and thus Geant4 consumes more random numbers for physics such as ionization sampling. Of course statistically saying, the results should not be affected. Makoto
Re: Peculiar problem: Overlapping Voxels in Parallel World affects particle tracks  by Joseph DeCunha <Joseph DeCunha>,   28 Jun, 2016
Re: Re: Peculiar problem: Overlapping Voxels in Parallel World affects particle tracks (Makoto Asai)
 Thank you for your reply! Very interesting. Yes, the code for the spherical mesh was taken from a colleague, the class was derived from G4PVParameterised. That thought had crossed my mind -- that perhaps the tracks themselves might be modified but as high numbers of particles were generated perhaps the results would be statistically indistinguishable. I'm curious about what you've said about the mesh volumes affecting the generation of random numbers. Would the Geant4 Physics Reference manual be a good resource to learn more about that? Thanks again, Joseph
Re: Peculiar problem: Overlapping Voxels in Parallel World affects particle tracks  by Makoto Asai <Makoto Asai>,   28 Jun, 2016
Re: Re: Peculiar problem: Overlapping Voxels in Parallel World affects particle tracks (Joseph DeCunha)
 You may want to try defining your spherical mesh made of G4Orb and place a smaller G4Orb object as a daughter of the mother G4Orb object rather than using parameterized volume and placing G4Sphere touching to each other. Touching surface of the inner surface of the larger spherical shell and the outer surface of the smaller sphere is always a difficult situation for the navigator due to the numerical rounding errors. Fate of a track in terms of which physics process actually happens is determined at the beginning of that track so that number of steps does not affect to it. But for every "along-step" physics processes such as ionization, we use random numbers to fluctuate energy deposition, etc., thus we consume random numbers. Thus, the random numbers used to determine the fate of the next track are affected by the number of steps of the previous track. This part is described in the application developers guide. Physics reference manual describes details of each physics models we use. Makoto
Re: Peculiar problem: Overlapping Voxels in Parallel World affects particle tracks  by Juliana Cristina Martins <Juliana Cristina Martins>,   05 Feb, 2018
Re: Re: Peculiar problem: Overlapping Voxels in Parallel World affects particle tracks (Makoto Asai)
 Hi there, I have a question concerning overlapping voxels in parallel world. I created three command-based scoring meshes that overlap at a certain point with each other. I am scoring Dose Deposit. When I analyze the dose scored by those meshes, I see a strange peak that coincides with the voxel where the meshes overlap! Is it possible that the dose is somehow accumulating in the intersection? Any ideas on that would be helpful... thanks a lot, Juliana
Can components in Parallel Words be used to score in a phase space flle   by Maura E.M. <Maura E.M.>,   08 Jun, 2016
 In my Linac model I had to place the two sections of the Flattening Filter in parallel worlds and declare them as LayeredMassGeometry. In my simulation I defined several phase space files. Each phase space file stores only particles which interacted in a given component. It turns out that all phase space files have some data but the one which is supposed to contain data of particles that interacted in the Flattening Filter. In order to narrow down the problem I have copied to my directory a simple example defining two overlapping boxes of different material which are placed in parallel worlds and declared as Layered Mass Geometry. I added a thin vacuum slab to score a phase space file collecting all particles that interacted in the two boxes and observed that the .phsp file is empty. I wonder whether massive components in parallel worlds can be used to score in phase space files. Thank you in advance for any clarifying answer / comment / suggestion. Best regards, mauede
Geometry Biasing - Daughter Volume  by Andrei Hanu <Andrei Hanu>,   18 May, 2016
 Hi everyone, I am performing a simulation on a gas-based neutron detector and would like to use the geometry biasing scheme from GB02 to boost the interaction rate. However, I would like to know if the geometry biasing is also propagated to the daughter volumes? Thanks, Andrei
neutron flux spectrum produced in a spallation target  by Abdesslam LAMRABET <Abdesslam LAMRABET>,   11 Apr, 2016
 hello dear experts and developers; I am a beginner in GEANT4 use and I have issue to determine the neutron flux spectrum (produced in a spallation target) entering in a small cylindrical detector within the target (in n/cm2/event). But I can't add the appropriate code concerning this aim in my application. Please someone tell me how can I do that. I'll be very grateful for any help. Thank you in advance! -A.LAMRABET-
Importance sampling multiple particle types  by Andy Kubik <Andy Kubik>,   30 Mar, 2016
 Hi, I'm following the general example of extended/biasing/B02 to set up an importance sampling scheme. I would like to be able to apply the importance sampling to both neutrons and gammas at the same time. I tried doing the following in (Geant4-10.1.1):  B02ImportanceDetectorConstruction* pdet = new B02ImportanceDetectorConstruction(parallelName); detector->RegisterParallelWorld(pdet);  G4GeometrySampler pgs1(pdet->GetWorldVolume(),"neutron"); G4GeometrySampler pgs2(pdet->GetWorldVolume(),"gamma");  pgs1.SetParallel(true); pgs2.SetParallel(true);  G4VModularPhysicsList* physicsList = new FTFP_BERT; physicsList->RegisterPhysics(new G4ImportanceBiasing(&pgs1,parallelName)); physicsList->RegisterPhysics(new G4ImportanceBiasing(&pgs2,parallelName)); physicsList->RegisterPhysics(new G4ParallelWorldPhysics(parallelName));  runManager->SetUserInitialization(physicsList); This runs, however it seems the importance sampling is only applied to whichever GeometrySampler I register to the physics list first. I also tried creating a second instance of B02ImportanceDetectorConstruction with it's own GeometrySampler, like this:  B02ImportanceDetectorConstruction* pdet1 = new B02ImportanceDetectorConstruction(parallelName1); detector->RegisterParallelWorld(pdet1);  B02ImportanceDetectorConstruction* pdet2 = new B02ImportanceDetectorConstruction(parallelName2); detector->RegisterParallelWorld(pdet2);  G4GeometrySampler pgs1(pdet1->GetWorldVolume(),"neutron"); G4GeometrySampler pgs2(pdet2->GetWorldVolume(),"gamma");  pgs1.SetParallel(true); pgs2.SetParallel(true);  G4VModularPhysicsList* physicsList = new FTFP_BERT; physicsList->RegisterPhysics(new G4ImportanceBiasing(&pgs1,parallelName1)); physicsList->RegisterPhysics(new G4ImportanceBiasing(&pgs2,parallelName2)); physicsList->RegisterPhysics(new G4ParallelWorldPhysics(parallelName1)); physicsList->RegisterPhysics(new G4ParallelWorldPhysics(parallelName2));  runManager->SetUserInitialization(physicsList);  B02ActionInitialization* actions = new B02ActionInitialization; runManager->SetUserInitialization(actions);  runManager->Initialize();  pdet1->CreateImportanceStore(); pdet2->CreateImportanceStore(); This also compiles ok but crashes on pdet2->CreateImportanceStore(); claiming that the world volume is not found. Is there a way to apply the importance sampling to two different particle types like this? Thanks! - Andy
Re: Importance sampling multiple particle types  by <ACamin>,   06 Oct, 2016
Re: Importance sampling multiple particle types (Andy Kubik)
 Dear Andy, have you found any solution? I have the exact same problem. Cheers, Alessio
Biasing specific volume  by Lin Li <Lin Li>,   30 Mar, 2016
 Dear all, I have a question about how to bias physics process in specific volume. I added a new box in front of the original one in GB01 DetectorConstruction.cc. The code is: // ----------------------------------- // -- volume where biasing is applied: // ----------------------------------- //--add a new box G4double halfZ = 10*cm; G4VSolid* biasTest = new G4Box("test.bias", 1*m, 1*m, halfZ ); G4LogicalVolume* biaslogic = new G4LogicalVolume(biasTest, // its solid defaultMaterial, // its material "bias.logical"); // its name new G4PVPlacement(0, // no rotation G4ThreeVector(0,0, -50*cm), // volume entrance at (0,0,0) biaslogic, // its logical volume "test.bias", // its name logicWorld, // its mother volume false, // no boolean operation 0); // copy number //--the orignal one G4VSolid* solidTest = new G4Box("test.solid", 1*m, 1*m, halfZ ); G4LogicalVolume* logicTest = new G4LogicalVolume(solidTest, // its solid defaultMaterial, // its material "test.logical"); // its name new G4PVPlacement(0, // no rotation G4ThreeVector(0,0, halfZ), // volume entrance at (0,0,0) logicTest, // its logical volume "test.phys", // its name logicWorld, // its mother volume false, // no boolean operation 0); // copy number return physiWorld; } And the biasing volume is the original one "test.logical". // -- Fetch volume for biasing: G4LogicalVolume* logicTest = G4LogicalVolumeStore::GetInstance()->GetVolume("test.logical"); // ---------------------------------------------- // -- operator creation and attachment to volume: // ---------------------------------------------- GB01BOptrMultiParticleChangeCrossSection* testMany = new GB01BOptrMultiParticleChangeCrossSection(); testMany->AddParticle("gamma"); testMany->AddParticle("neutron"); testMany->AttachTo(logicTest); We think the biasing events only could happen in "test.phys" volume. But when we check the result, we can find biasing events in another volume, which is the new one "test.bias". ********************************************************************************************************* * G4Track Information: Particle = gamma, Track ID = 1, Parent ID = 0 ********************************************************************************************************* Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName 0 0 0 -1e+03 100 0 0 0 World initStep 1 0 0 -600 100 0 400 400 test.bias Transportation 2 0 0 -556 6.57 0 43.9 444 test.bias biasWrapper(compt) 3 -0.884 28.5 -485 1.01 0 76.2 520 test.bias biasWrapper(compt) 4 -53.8 135 -453 0.487 0 123 643 test.bias biasWrapper(compt) 5 -60.7 138 -426 0.483 0 28.6 672 test.bias biasWrapper(compt) 6 -66.8 138 -400 0.483 0 26.5 698 World Transportation 7 -161 135 -5.68e-14 0.483 0 411 1.11e+03 test.phys Transportation 8 -179 134 78.1 0.248 0 80.3 1.19e+03 test.phys biasWrapper(compt) 9 -155 185 83.9 0.233 0 56.7 1.25e+03 test.phys biasWrapper(compt) 10 -112 215 93 0.218 0 53.1 1.3e+03 test.phys biasWrapper(compt) 11 -112 216 93.4 0.214 0 0.915 1.3e+03 test.phys biasWrapper(compt) 12 7.18 192 143 0.204 0 131 1.43e+03 test.phys biasWrapper(compt) 13 57.6 206 182 0.204 1.3e-05 65.7 1.5e+03 test.phys biasWrapper(compt) 14 80.4 213 200 0.204 0 29.6 1.53e+03 World Transportation 15 1e+04 3.17e+03 7.86e+03 0.204 0 1.29e+04 1.44e+04 OutOfWorld Transportation Is this reasonable? Is there a way to bias events only in selected volume, like only in "test.phys" ? Any help would be appreciated! Thank you. Best, Lin 
Signal detection with threshold  by A. Hod <A. Hod>,   04 Feb, 2016
 Dear all, I calculated the energy deposition in each pixel using scoring. The scoring calculates the accumulated energy deposition in each pixel. That means, the detector in this case is working in the integrated mode where the total energy deposited in each pixel is summed. How can I calculate the energy deposition in each pixel using scoring in counting mode where a given threshold is assigned to each pixel? Thanks A.H
run time about high precision neutron simulation  by Zhiyi Liu <Zhiyi Liu>,   07 Dec, 2015
 Hi, We are focusing on transportation simulation of fast neutrons in some materials. Information of interests are: global time, momentum and hit positions of inelastic gamma rays, capture neutrons and thermal neutrons. As been warned, we have observed that introducing high precision (HP) physics processes of neutrons significantly increases simulation run time, for example, at least 10 times slower in our case. Without thermal neutron processes on which significant time is spent, run time is acceptable. With thermal neutrons processes, it is too slow. Any good ideas to significantly reduce run time? For example, speeding up G4Step of thermal neutrons? Thanks, Zhiyi
write scoring results at specific time intervals  by matthew <matthew>,   04 Dec, 2015
 I am using a primitive scorer to record energy deposition over a mesh. In order to get energy deposition in specific time increments, t, I'm currently running the simulation at time = t, 2t, 3t, etc and then differencing the results. This is a cumbersome process that involves many runs and a fair bit of matlab code to generate the final, large multi-dimensional array. Question: Is there a good way to include code in one of the user hooks (i.e. EventAction, StepAction, RunAction) that would force the primitive scorer to write results at specific global times within the simulation? thanks for any advice. matt
Force photoelectric over Compton  by Paola Ferrario <Paola Ferrario>,   01 Dec, 2015
 Hi! I'd like to bias my physics in order to have only photoelectric process for a gamma particle (no Compton or pair production), but keeping the correct absorption length of the material, meaning that I want to keep the correct probability of the gamma of not interacting at all in the detector and, if it interacts, of the position where it occurs. Following Chapter 3.7.4 of the geant4 documentation and examples/extended/biasing/GB01, I've built my biasing operator class, called OperatorChangeCrossSection (which I attach), I've added the following lines to the geometry volume affected:  OperatorChangeCrossSection* biasOp = new OperatorChangeCrossSection("gamma","ForcePhotoelectric"); biasOp->AttachTo(active_logic); and I've added to my specific physics list (which I attach) the lines  pmanager = G4Gamma::Definition()->GetProcessManager(); G4BiasingHelper::ActivatePhysicsBiasing(pmanager, "phot"); I'm using both the G4EMStandardPhysics and my specific physics list, through the commands: /PhysicsList/RegisterPhysics G4EmStandardPhysics_option4 /PhysicsList/RegisterPhysics NexusPhysics Which value of the cross section factor should I use in the OperatorChangeCrossSection class to obtain what I want? If I use 1000, for instance, it seems to me that gammas undergo photoelectric process every time they enter the volume, and this is not what I want. O maybe I'm using the wrong operator for my purpose. Any help would be appreciated! Thank you Paola  Attachment: http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/12/01/04.22-37453-atorChangeCrossSection.cc http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/12/01/04.23-87707-NexusPhysics.cc 
mesh in the interface of two volumes  by Sahar <Sahar >,   26 Nov, 2015
 Hello every one I have a question about mesh scoring in order to be sure that my result is correct. I really appreciate your help. If we have two volume with two material (1:CsI 2:Tio2) and using mesh between two volume, is it correct to say that the results belong to the interface between two volume ? Is the definition of mesh correct or I should define it just in one volume ? thanks a lot
Undefined type  by Robert Nnaemeka <Robert Nnaemeka>,   22 Nov, 2015
 I am implementing an array of NaI detector (six in all). So I have a six variable named dEdX1 - dEdX6 for collecting the energy deposit in each detectors in my stepping action header file and a corresponding six function that is called by the event action to get the the value they contain at the end of each event. My stepping action included file is shown below: #ifndef B4aSteppingAction_h #define B4aSteppingAction_h 1  #include "G4UserSteppingAction.hh" /// Stepping action class. /// /// In UserSteppingAction() there are collected the energy deposit and track /// lengths of charged particles in Absober and Gap layers and /// updated in B4aEventAction. class B4aSteppingAction : public G4UserSteppingAction { private: G4double dEdX1; G4double dEdX2; G4double dEdX3; G4double dEdX4; G4double dEdX5; G4double dEdX6; public: B4aSteppingAction(); virtual ~B4aSteppingAction();  virtual void UserSteppingAction(const G4Step* step); G4double GetdEdX1() { return dEdX1; } G4double GetdEdX2() { return dEdX2; } G4double GetdEdX3() { return dEdX3; } G4double GetdEdX4() { return dEdX4; } G4double GetdEdX5() { return dEdX5; } G4double GetdEdX6() { return dEdX6; } void Reset(); }; //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... #endif However, when I ran my simulation I get a complaint that G4double in G4double = dEdX1, etc does not name a type. I even used G4int and G4float to see if I can get around it but it will always complain that those datatypes do not name a type. I am suspecting my compiler is crashing or something connected with it. I would appreciate any help.
problem with size of cylindrical scoring mesh at nanoscale level  by Balder <Balder>,   15 Oct, 2015
 Dear users/experts, I'm working at nanoscale level and I have adapted the microdosimetry example to create parallel scorers and it works fine at micro-scale but when I create cylindrical scoring mesh at nano-scale what I see is that even though the R-dimension is fine, the depth of the scorer (Z-dimension) is always fixed bigger by Geant4. I'm using a Mac and Qt as visualization driver. Can a scoring mesh be used at nanoscale level? Many thanks, Balder.
index of HitMap in primitive scorer different from the copyNumber of the touchable  by Sabrina <Sabrina>,   14 Oct, 2015
 Hello, I'm work with the Dicom example and I'm observing that the index of the hitMap I get when I use a primitive scorer (such G4SDDoseDeposit3D or G4SDEnergyDeposit) is different from the touchable copyNumber I get in the steppingAction. I observed a difference of 10 in the number. Here is a print of the energy deposit for one voxel: *Touchable copy number and energy deposit printed from the steppingAction: 10272 0.529704 MeV *Voxel index and energy deposit from the primitive scorer: 10282 0.529704 MeV For the same energy deposit the voxel number is 10272 in the first case and 10282 in the second case. Checking the voxel number with the position of the voxel, make me thing that the correct number is the one given by the touchable copy number in the stepping action. Any idea why the voxel index given by the primitive scorer is different? thanks in advance.
Gamma ray hit total different from actual hits (tested with muons)  by Josh Flygare <Josh Flygare>,   08 Oct, 2015
 Hello, I am decently experienced with Geant4 and I have a curious problem. I am guessing I missed something obvious. I have a detector with multiple replicated layers. When I pass muons through the layers my output all makes sense, the total energy deposited is less than the original particle energy and the total number of hits in the hits collection matches the # of hits being printed out. However, when I use gammas, of low or high energy, i get an incorrect number of hits, and the total energy deposited in the single event often exceeds the total initial gamma energy. If I print out the number of hits in the hits collection, it is always less than the number of hits it thinks was in the event. Any ideas why this would happen with gammas and not with muons? I am using a separate sensitive detector for both layers. I am using FTFP_BERT physics. Thanks in advance, Josh
Re: Gamma ray hit total different from actual hits (tested with muons)  by Josh Flygare <Josh Flygare>,   09 Oct, 2015
Re: Gamma ray hit total different from actual hits (tested with muons) (Josh Flygare)
 Never mind, I found the answer to my problem. I was not properly requiring coincidence between the layers so neutral particles were much less likely to be printed out than charged particles. Thanks
Using GPS  by Robert Nnaemeka <Robert Nnaemeka>,   27 Sep, 2015
 Hi Geant4 users. I would like to know how to modify example B1 to use GPS(General Particle Source). As for writing the macro, I know how to do it. My only problem is in modifying the source and included files to us GPS rather than the particle gun. Thanks
Re: Using GPS  by Michael H. Kelsey <Michael H. Kelsey>,   27 Sep, 2015
Re: Using GPS (Robert Nnaemeka)
 On Mon, 28 Sep 2015 03:18:46 GMT, Robert Nnaemeka wrote: > Hi Geant4 users. I would like to know how to modify example B1 to use > GPS(General Particle Source). As for writing the macro, I know how to do > it. My only problem is in modifying the source and included files to us > GPS rather than the particle gun. Thanks  Replace "G4ParticleGun" with "G4GeneralParticleSource" everywhere it appears. That's all you should need to do. If you want to modify the example to pre-set GPS with some non-trivial configuration, then you'll have to add that code yourself.  -- Michael Kelsey 
Re: Using GPS  by Robert Nnaemeka <Robert Nnaemeka>,   27 Sep, 2015
Re: Re: Using GPS (Michael H. Kelsey)
 Thanks Mike. I did that and it started complaining during compilation that G4GeneralParticleSource has no member functions named SetParticleMomentumDirection and SetParticleEnergy.
Re: Using GPS  by michel maire <michel maire>,   28 Sep, 2015
Re: Re: Using GPS (Robert Nnaemeka)
 Since you want to use GPS, you have to remove all the code which refer to G4ParticleGun. See examples/extended/eventgenerator/exgps
How do you measure KERMA?  by Patrik Eschle <Patrik Eschle>,   11 Sep, 2015
 Hello I'm interested in your opinion on how to get KERMA. KERMA measures the energy per mass transferred to charged secondary particles by uncharged primary particles. KERMA is used to quantify e.g. x-radiation. To measure KERMA in a sensitve volume, I check in ProcessHits if (1) the particle is charged, (2) is the child of a primary particle (photons are assumed here) and (3) makes its first step. Then I add up the kinetic energy at the vertex divided by the mass (see code below). This gives reasonable results. How do you compute KERMA? Do you take into account e.g. annhiliation photons? Thanks for you input,  Patrik (patrik.eschle@zhaw.ch) == KERMA scorer ProcessHits (as used for Topas)  G4bool IampKermaScorer::ProcessHits(G4Step* aStep,G4TouchableHistory*) { if (!fIsActive) { fSkippedWhileInactive++; return false; } // Geometry G4Track *aTrack = aStep->GetTrack(); G4double charge = aTrack->GetParticleDefinition()->GetPDGCharge(); G4double stepNumber = aTrack->GetCurrentStepNumber(); G4double parentId = aTrack->GetParentID();  if ( (charge != 0) && (parentId == 1)){ // candiate - charged child of primary in volume if (stepNumber == 1){ // charged child of a primary, first step in volume G4double eKinVertex = aTrack->GetVertexKineticEnergy(); // Ekin at vertex G4double mass = aStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetMass(); G4double kerma = eKinVertex / mass; AccumulateHit(aStep, kerma); return true; } } return false; } 
need some advices for geometry importance sampling   by jiawei liu <jiawei liu>,   09 Sep, 2015
 hello everyone, I really need your help for a problem, I wish to add importance to every cell of my geometry, but there is a problem.  *** G4Exception : GeomBias0002 issued by : G4IStore::Error() GetImportance() - Region does not exist! Geometry cell, Volume name = ciblew, Replica number = 0, not found in: Volume name = World, Replica number = 0, importance = 1 Volume name = Det, Replica number = 8, importance = 1e+08 Volume name = evn, Replica number = 7, importance = 1e+07 Volume name = PB, Replica number = 6, importance = 1e+06 Volume name = PB1, Replica number = 5, importance = 100000 Volume name = PB2, Replica number = 4, importance = 10000 Volume name = PB3, Replica number = 3, importance = 1000 Volume name = PB4, Replica number = 2, importance = 100 Volume name = PB5, Replica number = 1, importance = 10 Volume name = Target, Replica number = 10, importance = 1 Volume name = Tracker, Replica number = 9, importance = 1 Volume name = Fe1, Replica number = 11, importance = 1 Volume name = sor, Replica number = 12, importance = 1 Volume name = ciblew, Replica number = 13, importance = 1 Volume name = fenetre, Replica number = 14, importance = 1 Volume name = cible , Replica number = 15, importance = 1 Volume name = cuivre3, Replica number = 17, importance = 1 Volume name = cuivre, Replica number = 16, importance = 1 Volume name = cuivre6, Replica number = 18, importance = 1 Volume name = Al1, Replica number = 19, importance = 1 Volume name = Al3, Replica number = 20, importance = 1 Volume name = Al6, Replica number = 21, importance = 1 . *** Fatal Exception *** core dump *** -------- EEEE -------- G4Exception-END --------- EEEE -------  wait for your advices, thanks a lot in advance! 
How to get projection data using scoring mesh?  by Tenta Sasaya <Tenta Sasaya>,   02 Sep, 2015
 Hi, I'm trying to simulate fluorescent x-ray computed tomography. Attachment shows schematic geometry. I use following code in the macro file to acquire projection data. #------------------------------------------ #Define mesh  /score/create/boxMesh boxMesh_1 /score/mesh/boxSize 6.88 0.16 3.44 mm /score/mesh/nBin 80 1 40 /score/mesh/translate/xyz 0.0 -60.0 0.0 mm #Define filter(20-30 keV means detector's energy range) /score/quantity/passageCellCurrent scoreFluorescense 1 false false /score/filter/particleWithKineticEnergy gammaFilterEnergy 20.0 30.0 keV gamma /score/close #end-------------------------------------- In this case, I think this scoring mesh performs same role as detector which has quantum efficiency of 100%. However, the number of photons in the acquired projection data seems to be less than the actual experimental data. Is there a mistake? Thank you in advance, Ten  Attachment: http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/09/02/19.31-5253-geometry.png 
Biasing neutron interactions  by Francesca <Francesca>,   05 Aug, 2015
 Dear all,  I am trying to get the response of a diamond detector to a neutron beam. The detector is really thin, of the order of micrometers, and the neutrons have energies of the order of 14 MeV to 20 MeV. I have to score both elastic and inelastic processes. Since neutrons do not interct that much in so small thickness I wanted to activate a bias. Could anyone suggest me which is the best biasing technique for such case, please? I am not really good in C++... is there anything not too complicate to reach the goal? Thanks a lot, regards, Francesca
Re: Biasing neutron interactions  by Marc Verderi <Marc Verderi>,   24 Sep, 2015
Re: Biasing neutron interactions (Francesca)
 Dear Francesca, (sorry for very slow response, for unknown reasons, I sometimes don't receive the HN messages). For your case, you can look at example/extended/biasing/GB02, which (re)implement the "force collision" scheme of MCNP. This example is pretty close from what you need. Marc
Biasing elastic scattering cross sections  by Matus Saro <Matus Saro>,   04 Aug, 2015
 Hi, I would like to ask, if there is possibility to change a cross section in (n,p) elastic scattering for Hydrogen? Or just in data file ? Thanks Matus
Re: Biasing elastic scattering cross sections  by Marc Verderi <Marc Verderi>,   24 Sep, 2015
Re: Biasing elastic scattering cross sections (Matus Saro)
 Hi Matus, (sorry for very slow response, for unknown reasons, I sometimes don't receive the HN messages). This would be complicated today with existing biasing classes. Maybe changing the data file would be simplier. But (if not too late...) please give a bit more details on your application. Marc
Re: Biasing elastic scattering cross sections  by Matus Saro <Matus Saro>,   28 Sep, 2015
Re: Re: Biasing elastic scattering cross sections (Marc Verderi)
 Hi Marc, I am observing interaction of Al2O3 with fast neutrons, cross sections are small but in fluxes above pow(10,14) not negligible. Before running it on some simulation server i would like to see the statistics without blowing my PC. By setting this huge number as primary particles. Thanks Best Regards Matus
Re: Biasing elastic scattering cross sections  by Matus Saro <Matus Saro>,   28 Sep, 2015
Re: Re: Biasing elastic scattering cross sections (Marc Verderi)
 Hi Marc, I am observing interaction of Al2O3 with fast neutrons, cross sections are small but in fluxes above pow(10,14) not negligible. Before running it on some simulation server i would like to see the statistics without blowing my PC. By setting this huge number as primary particles. Thanks Best Regards Matus
help me scoring neutron flux  by Amjid Mahmood <Amjid Mahmood>,   23 Jun, 2015
 hi brothers i am doing project on photoneutron flux in medical linac but i am stuck in finding photoneutron flux the command which i am using is not giving any output flux value but when i use neutral filter it gives me flux values but in my openion its wrong please tell me what i am doing wrong in my program /score/create/boxMesh A /score/mesh/boxSize 15 2 15 cm /score/mesh/nBin 10 2 10 /score/mesh/translate/xyz 0 15 0 cm /score/quantity/cellFlux neutronFlux /score/filter/particle neutronFilter neutron /score/close /gun/particle e- /gun/energy 18 MeV /run/beamOn 2000000 the out put file for neutronFlux gives zero but when i use /score/filter/neutral neutronFilter neutron i get values as given in attach file please tell me i am doing it correctly or its wrong also please tell where i am making the mistake hopefully i will get quick feed back from your side Attachment: http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/06/23/00.53-4248-1w1w.txt http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/06/23/00.53-19095-mjg.txt 
Re: help me scoring neutron flux  by Tsukasa Aso <Tsukasa Aso>,   23 Jun, 2015
Re: help me scoring neutron flux (Amjid Mahmood)
 Hi, The filter "neutral" selects neutral tracks including gamma. There is no second argument in the command /score/filter/neutral. Could you check the score with particle filter of gamma track? e.g. /score/filter/particle gammaFilter gamma If you see the same results with that of neutral filter in the gamma filter, the counts in your latter case simulation represents gamma flux. ( It does not come from neutron ). How much neutrons are expected in your simulation? 
Re: help me scoring neutron flux  by Amjid Mahmood <Amjid Mahmood>,   23 Jun, 2015
Re: Re: help me scoring neutron flux (Tsukasa Aso)
 it was very helping reply from your side. sir actually we are studying the photoneutron flux and spectrum in medical linac treatment. please help me what is wrong in my GUI command that output file not giving me any flux value please sir tell me how to correct the error in my GUI command in order to get the flux. actually my supervisor also have no idea about error and correction because he is not specialist in GEANT4 and i am the only person doing project on GEANT4 in my university so its quite difficult to get some assistance from university. hopefully sir you will send me the GUI command to find the flux and spectrum. its quite hopeless situation for me and this forum is only spark of hope for me.
Re: help me scoring neutron flux  by Tsukasa Aso <Tsukasa Aso>,   23 Jun, 2015
Re: Re: help me scoring neutron flux (Amjid Mahmood)
 Hi, The scoring commands you issued are looks OK. I suggest following points: 1) You can check your scorer is working or not by injecting the neutron directly to your scoring geometry instead of electron beam. 2) Does your physics list include photo-nuclear process? ( It is also included in G4EmExtraPhysics ) If you did not include it, gamma/lepton nuclear reaction will not occur in your simulation. For more detail, please post your question to the physics category. 3) Also, you need to know the production rate of neutrons by the reactions. If both the neutron production rate and the geometric acceptance of scorer is very small, the detecting count of neutron might be very rare. Cheers, 
Re: help me scoring neutron flux  by Amjid Mahmood <Amjid Mahmood>,   23 Jun, 2015
Re: Re: help me scoring neutron flux (Tsukasa Aso)
 yes it gives value when i use neutron as incident particle which mean my scorer is ok so i have to include G4EmExtraPhysics class file in order to get the neutron flux i will soon send you my progress and bundle of thanks for your such valuable help thanks brother
Re: help me scoring neutron flux  by Eleni <Eleni>,   02 Aug, 2015
Re: Re: help me scoring neutron flux (Amjid Mahmood)
 Hello, Could you please let me know how to use biasing in the photonuclear cross section to increase the number of the produced neutrons while using the Geant4.10 version? Thank you in advance
Directionality in FlatSurfaceCurrent Scorer  by bilal <bilal>,   22 Jun, 2015
 Hi, I am trying to count the back-scattered particles from different interfaces. Now from another posting i know that the counting is done at the -Z surface and along the +Z direction if the option 1 is selected. My question is; would this scorer count in -Z direction for option 2 or it count in same direction but instead of tracks entering the surface it just counts those that are emerging from surface.  ------------- +Z--> | | <-- -Z ------------- If the option 2 doesn't do what i think (i.e. counting in -Z direction) can you please recommend how to score in the -Z direction.  Thanks Bilal
Re: Directionality in FlatSurfaceCurrent Scorer  by Tsukasa Aso <Tsukasa Aso>,   23 Jun, 2015
Re: Directionality in FlatSurfaceCurrent Scorer (bilal)
 Hi, The direction of FlatSurfaceCurrent is defined as follows: // Surface is defined at the -Z surface. // Direction flag -Z Surface // 0 IN || OUT ->|<- (Both direction) // 1 IN ->| (Entering tracks to the box.) // 2 OUT |<- (Exiting tracks from the box) It counts tracks at -Z surface of the box. If you set the direction to 2 (OUT), it counts tracks which go out from the box though -Z surface. 
Re: Directionality in FlatSurfaceCurrent Scorer  by bilal <bilal>,   23 Jun, 2015
Re: Re: Directionality in FlatSurfaceCurrent Scorer (Tsukasa Aso)
 Thank you so much it helps a lot Bilal
 Dear users i want to add one scorer to B1 example. but when i add one scorer my output is zero. How can i have more than one scorer? my file is attached.    Attachment:       http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/06/21/05.40-48744-B1DetectorConstruction.cc       http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/06/21/05.40-81151-B1SteppingAction.cc       http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/06/21/05.40-7792-B1EventAction.cc       http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/06/21/05.40-62332-B1Run.cc       http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/06/21/05.40-15850-B1RunAction.cc
Re: add scorer to B1 example  by Tsukasa Aso <Tsukasa Aso>,   22 Jun, 2015
Re: add scorer to B1 example
 Hi, Does the code: if (volume != fScoringVolume1 || volume !=fScoringVolume2) return; really work? I think it becomes becomes true. 
Re: Re: add scorer to B1 example (Tsukasa Aso)
 Dear Aso I wrote and added "(volume != fScoringVolume1 || volume !=fScoringVolume2) return" as you can see in my stepping action class. But it didn't work and also my results for that two scorers are 0. Thank you On Mon, 22 Jun 2015 10:36:29 GMT, Tsukasa Aso wrote:
Gamma Counting and Efficiency   by Dylan Pierce <Dylan Pierce>,   19 Jun, 2015
 Good Day, I am trying to detremine the efficiency of a germanium crystal which is a cylinder in shape. I know there are no primitive scorers which handle cylinders. So my question is what is the simplest method of counting gammas in my germanium crystal and how can I calculate the efficiency also as easy and straightforward as possible as I am new to GEANT4. If possible could you provide an example of the .cc and .hh files I need to make, or point me to an existing example which involves these type of things. Regards, Dylan
Re: Gamma Counting and Efficiency   by Ibrahim <Ibrahim>,   22 Jun, 2015
Re: Gamma Counting and Efficiency (Dylan Pierce)
 Hi Dylan , The example TestEm4 can be useful to calculate the efficiency: ~examples/extended/electromagnetic/TestEm4 I hope it helps... Cheers
Re: Gamma Counting and Efficiency   by Dylan Pierce <Dylan Pierce>,   23 Jun, 2015
Re: Re: Gamma Counting and Efficiency (Ibrahim)
 Hi Ibrahim, I appreciate the suggestion, I looked into TestEm4 but it doesn't explicitly calculate efficiency, I am looking for something that counts the number of gammas entering a defined volume and takes that number and divides by the total number of gammas simulated, something like Efficiency(%) = (Number of gammas in crystal/total gamma generated)*100% TestEm4 seems to provide detailed information about tracks and steps but doesn't necessarily count the gammas. Do you happen to know of an example that is more like what I just described above? -Dylan
Re: Gamma Counting and Efficiency   by Ibrahim <Ibrahim>,   23 Jun, 2015
Re: Re: Gamma Counting and Efficiency (Dylan Pierce)
 Hi Dylan, From this example you get the spectrum of energy deposition in your detector. From the spectrum you can easily calculate the efficinecy ( Photopeak efficiency, total efficiency,..). Cheers
Re: Gamma Counting and Efficiency   by Dylan Pierce <Dylan Pierce>,   24 Jun, 2015
Re: Re: Gamma Counting and Efficiency (Ibrahim)
 Hi, Ok that's good but how do I sum up all of the counts in the energy spectrum? Because I want to know the total number of gammas which interact with my crystal. And for that matter where in my code should the function which accumulates the gammas go, this is my main problem. Regards, Dylan
Dose created by usy primary photons not scattered ones  by <ali.khodadadee@gmail.com>,   08 Jun, 2015
 Dear users i have a ir-192 sources(a bare of Ir-192 and stainless steel encapsulation). my dosimeter is located in 1cm far from the center of source and is filled with water. There is just vacuum between dosimeter, and the source.As we know photons and electrons emit from source. when they interact with encapsulation we have scattered photons. but many photons without interaction with encapsulation reach to dosimeters and create Dose. My question is here, how i can calculate Dose created by those photons that without interaction with encapsulation reach to dosimeter. it means i don't want to calculate dose created by scattered photons and i want to calculate imparted dose by just primary photos which without interaction by encapsulation reach to dosimeter. below is my stacking actions. and other classes. With Thanks ... #include "EXStackingAction.hh" #include "G4Track.hh" #include "G4NeutrinoE.hh" EXStackingAction::EXStackingAction() { } EXStackingAction::~EXStackingAction() { } G4ClassificationOfNewTrack EXStackingAction::ClassifyNewTrack(const G4Track* track) {   if (track->GetParentID() == 0) return fUrgent;   if (track->GetParentID() > 0) { G4double charge = track->GetDefinition()->GetPDGCharge();  if (charge == 0.0) return fUrgent;   if (charge != 0.0) return fKill; }   //kill secondary neutrino   if (track->GetDefinition() == G4NeutrinoE::NeutrinoE()) return fKill;   else   return fUrgent; }
Re: Dose created by usy primary photons not scattered ones  by Tsukasa Aso <Tsukasa Aso>,   09 Jun, 2015
Re: Dose created by usy primary photons not scattered ones
 Hi, I think the following logic may be requested to score gammas from a primary, without any interaction during the transportation. (I) Kill tracks except for directly tracks from a primary. ( This is basically same as your code. ) If you use stacking action for this purpose, I think following steps will be requested. (I assume primary (Ir-192) is generated only one in one event.) a) if ( track->GetParentID() == 0 ) return fUrgent; // For Ir-192 b) if ( track->GetParentID() == 1 && track->GetDefinition()->GetPDGEncoding() == 22 ) { // Select only direct gamma (PID = 22 ) from Ir-192 (Primary track ID == 1). return fUrgent; }else{ return fKill; } (II) However, above requirements does not exclude Compton scattered gammas. Therefore, you have to check the gamma has no secondary tracks. This need to be done when you score the track, e.g. SteppingAction or SensitiveDetector etc. This can be done as follows. Here aStep is an object of G4Step. c) const G4TrackVector* secondary = aStep->GetSecondary(); if ( secondary->size() == 0 ) { // to be scored. } else { // Gamma is a scatted via Compton. } I hope it works. 
Re: Dose created by usy primary photons not scattered ones  by <ali.khodadadee@gmail.com>,   11 Jun, 2015
Re: Re: Dose created by usy primary photons not scattered ones (Tsukasa Aso)
 Dear Tsukasa Thank you for your guidance I wrote my program with scoring volume and also i add stepping action to my program but i don't know what i must write instead of"" //tobe scored and //Gamma is a scattered via compton"" at stepping action. i attach my program please if it is possible guide me more. ///////paragraph c is: const G4TrackVector* secondary = //////aStep->GetSecondary(); ////// if ( secondary->size() == 0 ) { ////// // to be scored. ////// } else { ////// // Gamma is a scatted via Compton. /////// } Thank you very much.    Attachment:       http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/06/11/02.01-39108-B1ActionInitialization.cc       http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/06/11/02.01-6682-B1DetectorConstruction.cc       http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/06/11/02.01-4555-B1EventAction.cc       http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/06/11/02.01-91454-B1PhysicsList.cc       http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/06/11/02.01-69274-PrimaryGeneratorAction.cc       http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/06/11/02.01-2936-B1Run.cc       http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/06/11/02.03-14679-B1StackingAction.cc       http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/06/11/02.03-95552-B1SteppingAction.cc       http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/06/11/02.03-31752-B1ActionInitialization.hh       http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/06/11/02.03-5272-B1DetectorConstruction.hh       http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/06/11/02.03-4985-B1EventAction.hh       http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/06/11/02.03-82418-B1PhysicsList.hh       http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/06/11/02.03-91472-PrimaryGeneratorAction.hh       http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/06/11/02.03-29398-B1Run.hh       http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/06/11/02.03-1330-B1RunAction.hh       http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/06/11/02.03-6267-B1StackingAction.hh       http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/06/11/02.04-20840-B1SteppingAction.hh
 Dear users  i have a ir-192 sources(a bare of Ir-192 and stainless steel encapsulation). my dosimeter is located in 1cm far from the center of source and is filled with water. There is just vacuum between dosimeter, and the source.As we know photons and electrons emit from source. when they interact with encapsulation we have scattered photons. but many photons without interaction with encapsulation reach to dosimeters and create Dose. My question is here, how i can calculate Dose created by those photons that without interaction with encapsulation reach to dosimeter. it means i don't want to calculate dose created by scattered photons and i want to calculate imparted dose by just primary photos which without interaction by encapsulation reach to dosimeter. thank you for your help.
Not drawing projection and slices while running RE03 example  by Amit Kumar <Amit Kumar>,   14 May, 2015
 Dear All I am just running RE03 (as it is) using following steps 1. Run1.mac has been registered to main(): UImanager->ApplyCommand("/control/execute run1.mac"); 2. Following lines have been disabled in Run1.mac before invoking /run/beamOn #/score/drawProjection boxMesh_1 eDep #/score/drawProjection boxMesh_1 nOfStepGamma #/score/drawProjection boxMesh_1 nOfStepEMinus #/score/drawProjection boxMesh_1 nOfStepEPlus  and #/vis/scene/create #/vis/sceneHandler/attach scene-2 #/score/colorMap/setMinMax ! 0. 800. #/control/loop drawSlice.mac iColumn 0 29 7  3. /run/beamOn 100 has been invoked through UIcommand on OpenGLStoredQt 4. Then following UIcommands were passed on OpenGLStoredQt one by one to draw projection of eDep but I did not see any projection as it is shown in Figure 4.9 of Users guide Manual for Application developer) /score/drawProjection boxMesh_1 eDep 5. Then following UIcommands were passed on OpenGLStoredQt one by one to draw slices as shown in the figure 4.9 but I get warning massage - "Can not open a macro file /score/drawProjection boxMesh_1 eDep Please suggest me what is the correct way to run and use these commands to draw projection and slices as shown in the Figure4.9
Energy deposition per pixel  by Steinbach <Steinbach>,   12 May, 2015
 Hello! I have working codes to show a histogram of deposited energy in pixelated silicon. Now I want to see a histogram of energy deposition per pixel. What and were I need to change in my code. Thanks in advance! SB.  Attachment: http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/05/12/05.46-16562-ActionInitialization.cc http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/05/12/05.46-89012-ExgpsHit.cc http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/05/12/05.46-10391-ExgpsSD.cc http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/05/12/05.46-71191-GeometryConstruction.cc http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/05/12/05.46-84580-HistoManager.cc http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/05/12/05.46-32655-PhysicsList.cc http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/05/12/05.46-18411-PrimaryGeneratorAction.cc http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/05/12/05.46-59666-RunAction.cc http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/05/12/05.46-74418-TrackingAction.cc 
Re: Energy deposition per pixel  by Tsukasa Aso <Tsukasa Aso>,   09 Jun, 2015
Re: Energy deposition per pixel (Steinbach)
 Hi, Your geometry has been already segmented into pixels. So, you need to pick up the pixel number from Touchable and score a quantity with its pixel number. The detail modifications depend on your code, e.g. how you define the geometry and how you write the sensitive detector. Many examples are available in Geant4 example code and tutorials/documentations on Web sites. Please check those materials. Cheers. 
Spectrum of deposited energy  by Steinbach <Steinbach>,   12 May, 2015
 Hello! I have a piece of pixelated silicon and I want to see the histogram of deposited energy. My codes work and I see a histogram. I am not sure, is it right way to fill histogram with deposited energy from each interaction in ProcessHits method (in ExgpsSD.cc file) or not. Can someone comment on that? Thank you in advance. SB.  Attachment: http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/05/12/05.26-92825-ActionInitialization.cc http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/05/12/05.26-67729-ExgpsHit.cc http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/05/12/05.26-95300-ExgpsSD.cc http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/05/12/05.26-73556-GeometryConstruction.cc http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/05/12/05.26-68058-HistoManager.cc http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/05/12/05.26-96759-PhysicsList.cc http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/05/12/05.26-26023-PrimaryGeneratorAction.cc http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/05/12/05.27-65797-RunAction.cc http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/05/12/05.27-3721-TrackingAction.cc 
Re: Spectrum of deposited energy  by Tsukasa Aso <Tsukasa Aso>,   09 Jun, 2015
Re: Spectrum of deposited energy (Steinbach)
 Hi, If you check the energy distributions in the filling histogram in SD, you get a energy distribution in a step. (This depends on what a user want to score.) AnalysisManager->FillH1(1, edep); Because ProcessHits is called every step, therefore the energy deposit is given in energy/step. If the track is electron and takes two steps in the scoring volume, the H1 counts twice with the energy in each step. i.e. E = E1 + E2 (E is total energy deposit in the scoring volume. E1 and E2 are deposited energy in first and second steps, respectively. ) In usual, the deposited energy distribution is integrated for a event to see the energy deposited associating to a primary particle injection. If you check the energy deposit in "Hit", it will give the integrated energy-deposit. // Add values hit->Add(edep,stepLength); ** The scoring algorithm depends on what a user want to score. Regards, 
How to count optical photons in each pixel of a detector?  by Sahar <Sahar >,   01 May, 2015
 Hello guys       I am new in Geant4. I really appreciate your help in advance.       I am simulating a CsI(Tl) scintillator and for now I have a 3*3*10 mm box of CsI. I've defined a multiple optical source inside this box, I defined 5 faces of lambertian and one face of polished.       I am trying to count the number of optical photons that hit my detector which I've put at 130 cm under the box. I've defined a scoring mesh and I tried observing its quantity, but I think it does not give what I'm really looking for. I am not sure ( for example when the quantity is cell flux or population it doesn't make any sense to me ) , I should pixelate my detector and I want to count how many of the optical photons which were generated inside the box, hit each of the pixels.       I have another question:     Does anybody know how I can get these outputs?     For example, the number of rays attenuated in a crystal, the number of rays absorbed at faces, total number of times the exit face (polished face) was hit. and such these values.     I don't know how to define them in stepping action or maybe another class.       Thank you,     Bests
Can a primitive scorer record energy deposition in specified time slices?  by matthew <matthew>,   01 May, 2015
 I am using a primitive scorer to record total energy deposition in a large volume. It works great, but I would like to have energy deposition in 1 microsecond intervals. Is there a way to set up a primitive scorer to record energy deposition every microsecond? thanks for any advice, matt
Counting secondary electrons escaping a thick target  by Robert Nnaemeka <Robert Nnaemeka>,   30 Apr, 2015
 I have a thick target enclosed by a box filled with low pressure gas. I fire a proton unto the target and it produces electrons. I want to count only those electrons that manages to escape from the target and enter the box. How to I implement it in the stepping action? (or any other ways it could be done)?.
Re: Counting secondary electrons escaping a thick target  by michel maire <michel maire>,   30 Apr, 2015
Re: Counting secondary electrons escaping a thick target (Robert Nnaemeka)
 On Thu, 30 Apr 2015 18:05:22 GMT, Robert Nnaemeka wrote: > I have a thick target enclosed by a box filled with low pressure gas. I > fire a proton unto the target and it produces electrons. I want to count > only those electrons that manages to escape from the target and enter > the box. How to I implement it in the stepping action? (or any other > ways it could be done)?. >   see attached file (a Geant4 FAQ)  Attachment: http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/04/30/12.56-69554-stepInfos.faq.txt 
Re: Counting secondary electrons escaping a thick target  by Robert Nnaemeka <Robert Nnaemeka>,   17 May, 2015
Re: Re: Counting secondary electrons escaping a thick target (michel maire)
 That Geant4 FAQ text file you sent me is invaluable. Thanks for it. I have implemented it sucessfully. On Thu, 30 Apr 2015 19:57:25 GMT, michel maire wrote: > On Thu, 30 Apr 2015 18:05:22 GMT, Robert Nnaemeka wrote: > > > I have a thick target enclosed by a box filled with low pressure gas. I > > fire a proton unto the target and it produces electrons. I want to count > > only those electrons that manages to escape from the target and enter > > the box. How to I implement it in the stepping action? (or any other > > ways it could be done)?. > > > > see attached file (a Geant4 FAQ) > > Attachment: > http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/04/30/12.56-69554-stepInfos.faq.txt > 
Re: Counting secondary electrons escaping a thick target  by Michael H. Kelsey <Michael H. Kelsey>,   30 Apr, 2015
Re: Counting secondary electrons escaping a thick target (Robert Nnaemeka)
 On Thu, 30 Apr 2015 18:05:22 GMT, Robert Nnaemeka wrote: > I have a thick target enclosed by a box filled with low pressure gas. I > fire a proton unto the target and it produces electrons. I want to count > only those electrons that manages to escape from the target and enter > the box. How to I implement it in the stepping action? (or any other > ways it could be done)?.  You can do this in your stepping action, by looking for the PreStepPoint in the target, the PostStepPoint in the gas volume, and the StepStatus _not_ fGeomBoundary. You can also do it by defining a SensitiveDetector attached to the gas volume, and doing the counting there, for particles with PreStepPoint in the target (the rest of the condition above is automatically satisfied if the SD is called). If you just want to count the escapes, and not track them or record energy deposition, then you can use the stepping action approach to kill the track after you count it:  aStep->GetTrack()->SetTrackStatus(fStopAndKill);  -- Michael Kelsey 
Re: Counting secondary electrons escaping a thick target  by Robert Nnaemeka <Robert Nnaemeka>,   17 May, 2015
Re: Re: Counting secondary electrons escaping a thick target (Michael H. Kelsey)
 Thank you Michael. I have implemented it successfully. On Thu, 30 Apr 2015 18:59:31 GMT, Michael H. Kelsey wrote: > On Thu, 30 Apr 2015 18:05:22 GMT, Robert Nnaemeka wrote: > > > I have a thick target enclosed by a box filled with low pressure gas. I > > fire a proton unto the target and it produces electrons. I want to count > > only those electrons that manages to escape from the target and enter > > the box. How to I implement it in the stepping action? (or any other > > ways it could be done)?. > > You can do this in your stepping action, by looking for the PreStepPoint > in the target, the PostStepPoint in the gas volume, and the StepStatus > _not_ fGeomBoundary. > > You can also do it by defining a SensitiveDetector attached to the gas > volume, and doing the counting there, for particles with PreStepPoint in > the target (the rest of the condition above is automatically satisfied > if the SD is called). > > If you just want to count the escapes, and not track them or record > energy deposition, then you can use the stepping action approach to kill > the track after you count it: > > aStep->GetTrack()->SetTrackStatus(fStopAndKill); > > -- Michael Kelsey > 
Selecting initial and final step of a track  by Sourav Tarafdar <Sourav Tarafdar>,   08 Apr, 2015
 Dear experts, I have couple of questions 1) Is there any way to extract only the initial and final stepping point information for a particular track ? 2) Any way in G4UserSteppingAction for extracting the number a steps for a particular track ? Thanks
Not setting a weight window for a given mesh cell in parallel geometry  by John Stenander <John Stenander>,   08 Apr, 2015
 Hello everyone. For my master's thesis I am setting up a weight window algorithm using parallel geometry. The thing is that I need some cells not to have a window set. I will still need to keep the grid as it is as I use it for scoring. I have tried just not to set the window for a cell, this doesn't work. There was also an idea to set the windows to cover all weights, but after setting up the window I only manipulate the placement (not 'size') of the window. My googling tells me that at least one person indicates that s/he has done it, but I don't know how. Any tips on this one?
time of creation of particles  by Asiya <Asiya>,   31 Mar, 2015
 I want to score the number of neutrons generated taking into account the time of creation.Are their any built in filters like G4SDTimeFilter?
Problem with G4PSCellFlux   by Simon Nicolas <Simon Nicolas>,   31 Mar, 2015
 Hi, I use G4PSCellFlux (with neutrons filter) in my simulation to calculate the neutron flux in a cylinder. I have used B4d example to recover the hit collection (G4THitsMap) and I obtain the sum with a GetSum() function in my EventAction class. I compare this result with MCNP (F4:n Talli wich uses TrackLength estimator with a SD card) but there is a 40% difference between the two results. However when I calculate the G4 flux with this formula: Flux = StepLengthSum / CellVolume (I sum the StepLength in my SteppingActionClass) I obtain exactly the same result as MCNP calculation (result normalized for one neutron source). Do you already have a problem with G4PSCellFlux? I also tried to use G4PSFlatSurfaceFlux but it doesn’t work. I don’t understand why I don’t find the same result with G4PSCellFlux. Do you have any idea? Thanks, Best regards, Simon
Re: Problem with G4PSCellFlux   by michel maire <michel maire>,   03 Apr, 2015
Re: Problem with G4PSCellFlux (Simon Nicolas)
 On Tue, 31 Mar 2015 12:23:03 GMT, Simon Nicolas wrote: >However when I calculate the G4 flux with this formula: Flux = StepLengthSum /CellVolume > (I sum the StepLength in my SteppingActionClass) I obtain exactly the > same result as MCNP calculation   If you are able to compute flux by yourself, do you really need to use scorers ? 
Re: Problem with G4PSCellFlux   by Simon Nicolas <Simon Nicolas>,   03 Apr, 2015
Re: Re: Problem with G4PSCellFlux (michel maire)
 I had an error in my SumStepLength() method, I calculated the sum of secondaries and by coincidence the result was the same as MCNP. I find the same result as the scorer with the correction. Sorry for this error. Nicolas.S
Re: Problem with G4PSCellFlux   by Tsukasa Aso <Tsukasa Aso>,   31 Mar, 2015
Re: Problem with G4PSCellFlux (Simon Nicolas)
 Hi We need more information. 1) Is the geometry is a simple bulk box or more complicated one? I want to know it has only one cell or more. 2) Could you check the track-length by using G4PSTrackLength scorer? If the value is same with MCNP, then the problem may be concerning to the calculation of the cell volume. Best regards, T.Aso 
Re: Problem with G4PSCellFlux   by Simon Nicolas <Simon Nicolas>,   02 Apr, 2015
Re: Re: Problem with G4PSCellFlux (Tsukasa Aso)
 Hi, Thank you for your quick answer. My geometry is an aluminum cylinder (internal radius = 36 mm, external radius = 38.25 mm and length = 702.5 mm) which contains three other smaller cylinders (internal radius = 11.5 mm, external radius = 12.7 mm and length = 566 mm). The three smaller cylinders have a thin thickness of boron (1.26 um). I have a simple source of thermal neutrons and I want to compare the (n, alpha) reaction rate and neutron flux in the boron thickness with MCNP. To calculate the reaction rate in the boron with G4, I use this simple definition: Reaction rate = number of (n, alpha) / number of particles simulated. With MCNP I found the same result of reaction rate. But the result of the flux in one boron cylinder is different. I checked the track-length with G4PSTrackLength scorer as you said me and the problem is not the calculation of the cell volume. Maybe the problem is with my PhysicList, I only use QGSP_BERT_HP physicList. Should I create my physicList for thermal neutrons ? Best regards, Nicolas.S
Re: Problem with G4PSCellFlux   by Tsukasa Aso <Tsukasa Aso>,   03 Apr, 2015
Re: Re: Problem with G4PSCellFlux (Simon Nicolas)
 Hi, I think it is better to post your message to Physics Category. ( And, I am not familiar to MCNP. Is the definition is same between MCNP flux and G4 CellFlux? ) Best regards, T.Aso 
Re: Problem with G4PSCellFlux   by Simon Nicolas <Simon Nicolas>,   03 Apr, 2015
Re: Re: Problem with G4PSCellFlux (Tsukasa Aso)
 Yes the definition is exactly the same. Thank you for your help,I post my message to Physics Category. Nicolas.S
Get Particle Name of Energy Deposit for Equivalent Dose Scorer  by Matthew Lund <Matthew Lund>,   18 Mar, 2015
 I've created a primitive equivalent dose scorer; however, the weighting factor is wrong because I'm getting the primary particle name and not the particle that deposited energy. How would I get the particle name and energy that deposited the energy rather than the primary particle. Here is how my code gets the particle name and energy: G4String particleName = aStep->GetTrack()->GetDefinition()->GetParticleName(); G4double kineticEnergy = aStep->GetTrack()->GetKineticEnergy(); Any suggestions?
Re: Get Particle Name of Energy Deposit for Equivalent Dose Scorer  by Tsukasa Aso <Tsukasa Aso>,   18 Mar, 2015
Re: Get Particle Name of Energy Deposit for Equivalent Dose Scorer (Matthew Lund)
 Hi, You are getting the kinetic energy of the particle. You have to get the energy deposited in the volume by: G4double edep = aStep->GetTotalEnergyDeposit(); Best regards, T.A 
Re: Get Particle Name of Energy Deposit for Equivalent Dose Scorer  by Matthew Lund <Matthew Lund>,   19 Mar, 2015
Re: Re: Get Particle Name of Energy Deposit for Equivalent Dose Scorer (Tsukasa Aso)
 I'm using the aStep->GetTotalEnergyDeposit(); to get the energy deposit, the GetKineticEnergy is for the weighting factor to multiple the dose. Attached below is more of the code to see what I'm doing. The scorer is correct for simple volumes with correct weighting factor; however, if there are multiple volumes of shielding, the weighting factor comes out higher than it should be. I assume that I'm getting the primary particle name and energy, not the actual particle name and energy that is doing the energy deposit within the scoring volume. Any ideas of how to correct that. G4double edep = aStep->GetTotalEnergyDeposit(); if ( edep == 0. ) return FALSE;  G4int idx = ((G4TouchableHistory*) (aStep->GetPreStepPoint()->GetTouchable())) ->GetReplicaNumber(indexDepth); G4double cubicVolume = ComputeVolume(aStep, idx);  G4double density = aStep->GetTrack()->GetStep()->GetPreStepPoint()->GetMaterial()->GetDensity(); G4double dose = edep / ( density * cubicVolume );  G4String particleName = aStep->GetTrack()->GetDynamicParticle()->GetDefinition()->GetParticleName(); G4double kineticEnergy = aStep->GetTrack()->GetDynamicParticle()->GetKineticEnergy(); G4double weight = 1.;  // from ICRP Publication 60 (1990) if (particleName == "gamma") { weight = 1.; } else if ((particleName == "e-")||(particleName == "e+")||(particleName == "mu-")||(particleName == "mu+")) { // still to be implemented "Excluding Auger electrons emitted from nuclei bound to DNA" weight = 1.; } else if (particleName == "neutron") { if (kineticEnergy<10*keV) { weight = 5.; } else if (kineticEnergy < 100 * keV) { weight = 10.; } else if (kineticEnergy < 2 * MeV) { weight = 20.; } else if (kineticEnergy < 20 * MeV) { weight = 10.; } else { weight = 5.; } } else if ((particleName == "proton") && (kineticEnergy > 2*MeV)) { // still to be implemented "other than recoil protons" weight = 5.; } else if ((particleName=="alpha") || (particleName=="GenericIon") || (particleName=="He3") || (particleName=="deuteron") || (particleName=="triton") ) { // check how to recognise the ions weight = 20.; } else { weight = 1.; }  dose *= aStep->GetPreStepPoint()->GetWeight(); G4double eqdose = dose*weight; G4int index = GetIndex(aStep); EvtMap->add(index,eqdose); return TRUE;
Re: Get Particle Name of Energy Deposit for Equivalent Dose Scorer  by Daren Sawkey <Daren Sawkey>,   19 Mar, 2015
Re: Re: Get Particle Name of Energy Deposit for Equivalent Dose Scorer (Matthew Lund)
 > I assume that I'm getting the primary particle > name and energy, not the actual particle name and energy that is doing > the energy deposit within the scoring volume. Any ideas of how to > correct that.  Your code will get you the current particle, not the primary. If you are trying to calculate the equivalent dose used in radiation protection, note that the weighting factor is a function of the primary particle, not the secondary. Also note that e.g. gamma don't deposit much energy themselves. Rather it is the secondary charged particles they create that deposit the energy. You can see this by adding a G4cout << edep << " " << particleName << G4endl to your code. -- Daren.
Why cannot proton cross sections with the G4EmLivermorePhysics be biased???  by <LoongDaoo>,   17 Mar, 2015
 Dear experts, I want to bias the proton elastic and inelastic cross sections using the scheme in the example GB01 in Geant4.10.1,and it can be achieved by adding process restrictions in the function GB01BOptrMultiParticleChangeCrossSection::ProposeOccurenceBiasingOperation() when the physicslist is QGSP_BIC_HP.But if I replace the G4EmStandardPhysics included in QGSP_BIC_HP with the more precise G4EmLivermorePhysics, the above function Propose...Operation will not be called in my simulation, so the biasing function can not be realized. And I find that as long as LivermorePhysics or other Em physics except the G4EmStandardPhysics appear in the physicslist, it will not be called. I register the LivermorePhysics through three methods: (1)G4PhysListFactory factory; G4VModularPhysicsList* physicsList = factory.GetReferencePhysList("FTFP_BERT_HP_LIV"); (2)QGSP_BIC_HP* physicsList = new QGSP_BIC_HP; physicsList->ReplacePhysics(new G4EmLivermorePhysics()); (3)using G4VModularPhysicsList to create a physicslist including LivermorePhysics All of them fail to realize the biasing proton cross section function. However, it is ok when biasing the neutron cross sections with the above biasing scheme and physicslist change. So what is the problem? Why neutron is ok, but proton isn't? Why G4EmStandardPhysics is ok, but G4EmLivermorePhysics is not? Any assistance would be greatful! Many thanks in advance!
UserLimits low energy limit  by Robert Schaefer <Robert Schaefer>,   11 Mar, 2015
 Dear G4-communtiy, I'm currently working on a simulation of a gas ionization chamber with an electrical field. My simulation works so far. However the photoelectrons in my chamber get killed before they reach the wire. Is it possible to set a negativ low kinetic energy limit for the electrons? I want to kill the particles only when they've reached the wire, not when their kinetic energy is zero. Is something like this possible, to kill the particles on other conditions than their minimal kinetic energy? I know that this will make my application slow, but I don't need performance.. Cheers, Robert
Re: UserLimits low energy limit  by Daren Sawkey <Daren Sawkey>,   12 Mar, 2015
Re: UserLimits low energy limit (Robert Schaefer)
 Hi, do I understand correctly: an electron in an electric field is killed when its kinetic energy is zero, but it should continue moving due to the electric field? If so please post in Fields forum. Also you may want to read response to bug report 1021 http://bugzilla-geant4.kek.jp/show_bug.cgi?id=1021 On Wed, 11 Mar 2015 12:27:33 GMT, Robert Schaefer wrote: > Dear G4-communtiy, > > I'm currently working on a simulation of a gas ionization chamber with > an electrical field. My simulation works so far. > > However the photoelectrons in my chamber get killed before they reach > the wire. Is it possible to set a negativ low kinetic energy limit for > the electrons? I want to kill the particles only when they've reached > the wire, not when their kinetic energy is zero. > > Is something like this possible, to kill the particles on other > conditions than their minimal kinetic energy? I know that this will make > my application slow, but I don't need performance.. > > Cheers, Robert > 
Bias cross section of neutron capture  by Geng <Geng>,   09 Mar, 2015
 Dear experts, Is there anyone have the idea of how to realize the bias of neutron capture process? Best, geng
Re: Bias cross section of neutron capture  by <LoongDaoo>,   09 Mar, 2015
Re: Bias cross section of neutron capture (Geng)
 See Problem 160, maybe it will help.
Re: Bias cross section of neutron capture  by michel maire <michel maire>,   09 Mar, 2015
Re: Bias cross section of neutron capture (Geng)
 On Mon, 09 Mar 2015 15:37:37 GMT, Geng wrote: > Dear experts, > > Is there anyone have the idea of how to realize the bias of neutron > capture process? > > Best, geng >   Do you mean : to force neutron capture ? A simple way is to add :  /process/list /process/inactivate hadElastic /process/inactivate neutronInelastic /process/inactivate nFission  See example Hadr03 
Re: Bias cross section of neutron capture  by Geng <Geng>,   11 Mar, 2015
Re: Re: Bias cross section of neutron capture (michel maire)
 Thanks very much. Very useful hint. However, I have another problem is: I tried to simulate boron neutron capture therapy, which based on the nuclear capture and fission reactions that occur when non-radioactive boron-10 is irradiated with neutrons of the appropriate energy to yield excited boron-11 (11B*), which in turn decays into high energy alpha particles ("stripped" down 4He nuclei) and high energy lithium-7 (7Li) nuclei. (see: http://en.wikipedia.org/wiki/Neutron_capture_therapy_of_cancer) I output the track information, I found that there is very few neutron capture process with neutron and B10. And most interesting thing is alpha and li7 are generated by inelastic process. Did I misunderstand this definition at all? Thanks, Best regards,
About the warning exGB01.02 in the example GB01  by <LoongDaoo>,   03 Mar, 2015
 Dear all: I am using the scheme presented in the extended example GB01 to bias the Elastic and Inelastic processes induced by protons in silicon, which can be realized by adding the commands:  G4String procname = callingProcess->GetWrappedProcess()->GetProcessName(); if (procname.contains("Elastic") == 0 && procname.contains("Inelastic") == 0) return 0; in the function GB01BOptrMultiParticleChangeCrossSection::ProposeOccurenceBiasingOperation(). But when the hIoni process happens, previousOperation != operation will happen in the function GB01BOptrChangeCrossSection::ProposeOccurenceBiasingOperation(), then the warning exGB01.02 "Logic problem in operation handling !" appears. I want to know what's the problem, and why previousOperation != operation should not happen. I really don't know the meaning of previousOperation, although I see the explanations and the related class G4BiasingProcessInterface. Many thanks for your help in advance! LoongDaoo
Re: About the warning exGB01.02 in the example GB01  by <LoongDaoo>,   05 Mar, 2015
Re: About the warning exGB01.02 in the example GB01
 And why does the warning -------- WWWW ------- G4Exception-START -------- WWWW ------- *** G4Exception : BIAS.GEN.13 issued by : G4InteractionLawPhysical::UpdateInteractionLengthForStep(...) Negative number of interaction length for LawForOperationXSchange-protonInelastic' -1, set it to zero ! *** This is just a warning message. *** -------- WWWW -------- G4Exception-END --------- WWWW ------- appear, when I remove the lines  if ( previousOperation != operation ) { // -- should not happen ! G4ExceptionDescription ed; ed << " Logic problem in operation handling !" << G4endl; G4Exception("GB01BOptrChangeCrossSection::ProposeOccurenceBiasingOperation(...)", "exGB01.02", JustWarning, ed); return 0; } in the the function GB01BOptrMultiParticleChangeCrossSection::ProposeOccurenceBiasingOperation()??? What is the relation between two warnings???
Hadr01 Can't count secondaries at a few hundred keV  by Robert Nnaemeka <Robert Nnaemeka>,   27 Feb, 2015
 Hi all, I am studying the sputtering on Titanium by proton beam with energy in the range 80keV - 150keV. However, example Hadr01 in extended example gives zero counts, although our experiment shows that lots of electrons were liberated when the proton beam hits the Titanium target. However, the example gives counts only at high proton energy, of the order of 12 MeV and above. How can I use it to count liberated electrons at our experimental energies? Thanks.
Re: Hadr01 Can't count secondaries at a few hundred keV  by Daren Sawkey <Daren Sawkey>,   27 Feb, 2015
Re: Hadr01 Can't count secondaries at a few hundred keV (Robert Nnaemeka)
 The electrons are below the default production threshold energy. Lower it by e.g. adding these lines to your macro: /testhadr/CutsAll 1 nm /cuts/setLowEdge 2 eV
Re: Hadr01 Can't count secondaries at a few hundred keV  by Robert Nnaemeka <Robert Nnaemeka>,   27 Feb, 2015
Re: Re: Hadr01 Can't count secondaries at a few hundred keV (Daren Sawkey)
 Also, the computation is interminable.I had to issue abort instruction for it to display the computation. Is this due to infrared divergence? I am guessing I may need to increase the production threshold energy. What do you think? On Fri, 27 Feb 2015 19:15:45 GMT, Daren Sawkey wrote: > The electrons are below the default production threshold energy. Lower > it by e.g. adding these lines to your macro: > > /testhadr/CutsAll 1 nm > > /cuts/setLowEdge 2 eV > 
Re: Hadr01 Can't count secondaries at a few hundred keV  by Daren Sawkey <Daren Sawkey>,   27 Feb, 2015
Re: Re: Hadr01 Can't count secondaries at a few hundred keV (Robert Nnaemeka)
 Yes, that's the reason for the cut in the first place. Many of the electrons are produced by electron ionization, rather than proton. If you turn off electron ionization the code runs much faster (although with dubious physics): /process/inactivate eIoni The DNA physics group is interested in this type of interaction, although maybe not Ti. You could try that forum. Also try hadronics forum.
Re: Hadr01 Can't count secondaries at a few hundred keV  by Robert Nnaemeka <Robert Nnaemeka>,   27 Feb, 2015
Re: Re: Hadr01 Can't count secondaries at a few hundred keV (Daren Sawkey)
 Thanks. The simulation is a part of D-D fusion, a novel High Flux Neutron Generator under construction. The target is inside a high vacuum ~10^-5 torr and I think if I choose the production threshold accordingly, electron ionization would be reduced. So far, simulation of residual gas ionization shows it is very small. So, switching of electron ionization might not affect the result. I will post it in any of the forum. You saved me much hassle. Many thanks. On Fri, 27 Feb 2015 20:28:17 GMT, Daren Sawkey wrote: > Yes, that's the reason for the cut in the first place. > > Many of the electrons are produced by electron ionization, rather than > proton. If you turn off electron ionization the code runs much faster > (although with dubious physics): /process/inactivate eIoni > > The DNA physics group is interested in this type of interaction, > although maybe not Ti. You could try that forum. Also try hadronics > forum. > 
Re: Hadr01 Can't count secondaries at a few hundred keV  by Daren Sawkey <Daren Sawkey>,   27 Feb, 2015
Re: Re: Hadr01 Can't count secondaries at a few hundred keV (Robert Nnaemeka)
 > So far, simulation of > residual gas ionization shows it is very small.  Just to be clear, the ionization occurs in the metal as well. I don't recommend turning off the eIoni process, except as a means to study the problem. You'll have to determine what is physically realistic.
Re: Hadr01 Can't count secondaries at a few hundred keV  by Robert Nnaemeka <Robert Nnaemeka>,   28 Feb, 2015
Re: Re: Hadr01 Can't count secondaries at a few hundred keV (Daren Sawkey)
 Good. Your replies helped me understand the whole process and be ready to apply it to the physical situation at hands. Many thanks.On Sat, 28 Feb 2015 00:58:30 GMT, Daren Sawkey wrote: > > So far, simulation of > > residual gas ionization shows it is very small. > > Just to be clear, the ionization occurs in the metal as well. I don't > recommend turning off the eIoni process, except as a means to study the > problem. You'll have to determine what is physically realistic. > 
Re: Hadr01 Can't count secondaries at a few hundred keV  by Robert Nnaemeka <Robert Nnaemeka>,   01 Mar, 2015
Re: Re: Hadr01 Can't count secondaries at a few hundred keV (Robert Nnaemeka)
 Hi Darren, This is the result so far after setting minimum energy threshold to ~ 50eV and selecting setting the proton cut to about 1keV. Simulation is indicating secondary production in Molybdenum cannot start at proton energy less than ~ 83keV. However, published experimental data indicates significant electron production at proton energy as low as 25keV. Again, as the energy is increased, the average electron produced increased in exponential form to ~44 at 120keV. But experimental data from published works indicated that electron liberation in Molybdenum is about 0.2 at proton energy of 25keV and levels 0ff to ~1.5 at about 120keV. What could be wrong with my simulation? I added the check volume as a sensitive detector in addition to the target, so as to ensure all liberated electrons were detected. Many thanks.
Re: Hadr01 Can't count secondaries at a few hundred keV  by Robert Nnaemeka <Robert Nnaemeka>,   27 Feb, 2015
Re: Re: Hadr01 Can't count secondaries at a few hundred keV (Daren Sawkey)
 Thanks Daren. I did it and it is working as expected. However, the computation time increased in a quantum amount. Is there any way I could speed up the computation? I am using intel i7 core laptop with 8GB RAM.On Fri, 27 Feb 2015 19:15:45 GMT, Daren Sawkey wrote: > The electrons are below the default production threshold energy. Lower > it by e.g. adding these lines to your macro: > > /testhadr/CutsAll 1 nm > > /cuts/setLowEdge 2 eV > 
Sensitive detector doesnt work  by Steinbach <Steinbach>,   24 Feb, 2015
 Dear Geant4 enthusiasts! I am a beginner and I am stuck for a while with this problem. Please help me out. I have a pixelated Silicon absorber (12um thick). I am shooting 5.9 keV gammas using GPS to it. I want to see the detected energy spectrum in a histogram. I defined the Silicon absorber as sensitive detector. But, still I see all the particles in the histogram, all having 5.9 keV energy. Means 100% absorption of 5.9 keV gamma in a 12 um thick Silicon, its not possible. What I am doing wrong or what is missing? Any help or suggestion will be appreciated. /Steinbach.    Attachment:       http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/02/24/01.23-44098-Exgps.cc       http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/02/24/01.23-72454-GeometryConstruction.cc       http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/02/24/01.23-53355-ExgpsHit.cc       http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/02/24/01.23-56593-ExgpsSD.cc       http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/02/24/01.23-9360-TrackingAction.cc       http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/02/24/01.23-52637-PhysicsList.cc       http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/02/24/01.24-26090-HistoManager.cc       http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/02/24/01.24-8197-RunAction.cc       http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/02/24/01.24-29353-PrimaryGeneratorAction.cc       http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/02/24/01.26-61028-ExgpsHit.hh       http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/02/24/01.26-86033-ExgpsSD.hh       http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/02/24/01.26-95125-GeometryConstruction.hh
Re: Sensitive detector doesnt work  by Tsukasa Aso <Tsukasa Aso>,   24 Feb, 2015
Re: Sensitive detector doesnt work (Steinbach)
 Hi, Which histogram did you check for energy deposition in the absorber? T.A. 
Re: Sensitive detector doesnt work  by Steinbach <Steinbach>,   24 Feb, 2015
Re: Re: Sensitive detector doesnt work (Tsukasa Aso)
 Hi Tsukasa, Thanks for your reply and wish to help me. I used histo1D 1: energy spectrum. /Steinbach    Attachment:       http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/02/24/02.06-95443-README       http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/02/24/02.06-57858-vis.mac On Tue, 24 Feb 2015 09:58:38 GMT, Tsukasa Aso wrote: > Hi, > > Which histogram did you check for energy deposition in the absorber? > > T.A. >
Re: Sensitive detector doesnt work  by Tsukasa Aso <Tsukasa Aso>,   24 Feb, 2015
Re: Re: Sensitive detector doesnt work (Steinbach)
 Hi, There are several points you have to care about: 1) PhysicsList Your physics list includes only the transportation process. e.g. no physics interactions. I recommend to use a reference physics-list. Please check examples in Geant4 such as basic or extended/electromagnetic. 2) Scoring The histogram you are checking is for a kinetic energy spectrum of a track. It is not the energy deposit in the Si-plate. It is an initial kinetic energy of a track. Please check the examples in Geant4 such as basic/B4c etc. Basically you need to check ( or do ) a) Define a histogram for energy deposited in RunAction b) Fill the histogram in EventAction by getting the energy deposited from hitscollection. 3) A comment about your ExgpsSD You use "hit" and "hitTotal". But in your code, the only one hit object is registered in the hitscollection. Therefore the "hit" and "hitTotal" is same and it causes double counting. Regards, T.A 
Re: Sensitive detector doesnt work  by Steinbach <Steinbach>,   03 Mar, 2015
Re: Re: Sensitive detector doesnt work (Tsukasa Aso)
 Hi Tsukasa, I have updated my PhysicsList and got the photons to interact with my sensitive detector. Also I have updated my RunAction and TrackingAction according to the example B4c. But, the output shows 0 energy deposition. I will be grateful if you could have a look and give me some suggestions. Thanks.   Attachment:       http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/03/03/00.41-23528-ActionInitialization.cc       http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/03/03/00.41-14380-ExgpsHit.cc       http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/03/03/00.41-39828-ExgpsSD.cc       http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/03/03/00.41-12711-GeometryConstruction.cc       http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/03/03/00.41-4393-HistoManager.cc       http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/03/03/00.41-15550-PhysicsList.cc       http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/03/03/00.42-52770-PrimaryGeneratorAction.cc       http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/03/03/00.42-78232-RunAction.cc       http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/03/03/00.42-10876-TrackingAction.cc       http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/03/03/00.42-27482-vis.mac On Tue, 24 Feb 2015 23:57:18 GMT, Tsukasa Aso wrote: > Hi, > > There are several points you have to care about: > > 1) PhysicsList > Your physics list includes only the transportation process. e.g. no physics interactions. > I recommend to use a reference physics-list. Please check examples in Geant4 such as > basic or extended/electromagnetic. > > 2) Scoring > The histogram you are checking is for a kinetic energy spectrum of a track. > It is not the energy deposit in the Si-plate. It is an initial kinetic energy of a track. > > Please check the examples in Geant4 such as basic/B4c etc. > Basically you need to check ( or do ) > a) Define a histogram for energy deposited in RunAction > b) Fill the histogram in EventAction by getting the energy deposited from hitscollection. > > 3) A comment about your ExgpsSD > You use "hit" and "hitTotal". But in your code, the only one hit object is registered in > the hitscollection. Therefore the "hit" and "hitTotal" is same and it causes double counting. > > Regards, > T.A >
Re: Sensitive detector doesnt work  by Tsukasa Aso <Tsukasa Aso>,   03 Mar, 2015
Re: Re: Sensitive detector doesnt work (Steinbach)
 Hi, You have to attach the SD to LogicAbsorPixel. T.A 
Re: Sensitive detector doesnt work  by Steinbach <Steinbach>,   25 Feb, 2015
Re: Re: Sensitive detector doesnt work (Tsukasa Aso)
 Thank you so much Tsukasa. The PhysicsList is updated and I got the photons to interact with the Si now. Attachment:       http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/02/25/04.43-82478-PhysicsList.cc I have not added any standard physics list yet, since its working, I will play with it later when I have the whole system working. But......but........in the histogram I see all the particles that I am shooting + all the secondary electrons. This will hopefully, probably will be fixed when scoring and ExpoSD is updated as you suggested. Working on it :-) Will be back when I have something to share with you. Thanks. /Steinbach. On Tue, 24 Feb 2015 23:57:18 GMT, Tsukasa Aso wrote: > Hi, > > There are several points you have to care about: > > 1) PhysicsList > Your physics list includes only the transportation process. e.g. no physics interactions. > I recommend to use a reference physics-list. Please check examples in Geant4 such as > basic or extended/electromagnetic. > > 2) Scoring > The histogram you are checking is for a kinetic energy spectrum of a track. > It is not the energy deposit in the Si-plate. It is an initial kinetic energy of a track. > > Please check the examples in Geant4 such as basic/B4c etc. > Basically you need to check ( or do ) > a) Define a histogram for energy deposited in RunAction > b) Fill the histogram in EventAction by getting the energy deposited from hitscollection. > > 3) A comment about your ExgpsSD > You use "hit" and "hitTotal". But in your code, the only one hit object is registered in > the hitscollection. Therefore the "hit" and "hitTotal" is same and it causes double counting. > > Regards, > T.A >
Re: Sensitive detector doesnt work  by C Mos <C Mos>,   24 Feb, 2015
Re: Re: Sensitive detector doesnt work (Tsukasa Aso)
 My apologies.... I posted in the wrong question section. C Mos.
Re: Sensitive detector doesnt work  by C Mos <C Mos>,   24 Feb, 2015
Re: Re: Sensitive detector doesnt work (Tsukasa Aso)
 Ok... so I run B4c with the modified physics list (aka. FTFP_BERT_HP) and this is what I noticed. When I run the executable and I exit right away, I get a core dumped.  Total navigation history collections cleaned: 2 ================== Deleting memory pools =================== Number of memory pools allocated: 3; of which, static: 0 Dynamic pools deleted: 3 / Total memory freed: 0.0029 Mb ============================================================ G4Allocator objects are deleted. UImanager deleted. StateManager deleted. RunManagerKernel is deleted. Good bye :) Segmentation fault (core dumped) [kurama@kurama B4c]$ When I run the executable and then I execute '/run/beamOn 1' and then I exit the program, it finishes normally:  Total navigation history collections cleaned: 8 ================== Deleting memory pools =================== Number of memory pools allocated: 15; of which, static: 0 Dynamic pools deleted: 15 / Total memory freed: 0.037 Mb ============================================================ G4Allocator objects are deleted. UImanager deleted. StateManager deleted. RunManagerKernel is deleted. Good bye :) [kurama@kurama B4c]$ I got the same results with Hadr01 running the following lines:  Hadr01 vis.mac FTFP_BERT_HP --> RunManagerKernel is deleted. Good bye :) Segmentation fault (core dumped) Hadr01 vis.mac FTFP_BERT --> Normal termination! I modified the vis.mac so to include '/run/beamOn 1' and results are the same, as I get a cored dumped with FTFP_BERT_HP physics even when calling '/run/beamOn 1'. Last check of sanity. I run my program and yes, if I do not generate any events via '/run/beamOn' but I exit right away, I get a core dumped. However, I a generate events before exiting, I get a normal termination line:  Idle> exit Graphics systems deleted. Visualization Manager deleting... Total navigation history collections cleaned: 26 Normal termination of ./APIdrdcAppTNAV6-0 at Tue Feb 24 22:22:03 2015 I will try to use gdb. However, it is a learning curve for me using geant4 libraries. One question. With my program when I get a segmentation fault I always get extra debugging lines. However with Hadr01 and B4c I just have a "core dumped" and then exist right away. I did compile my geant 4 engine with  -DCMAKE_BUILD_TYPE=Debug Any ideas why this happen this way? Cheers! C Mos
Scoring energy deposition of both mother and daughter volumes  by Ben Hug <Ben Hug>,   13 Feb, 2015
 Hello.. Just a quick one.. Consider that you have two square voxels where one is the daughter volume of the other volume (i.e. the mother volume). Using a SteppingAction approach to scoring where the G4Track classes are being used to determine what volume the particle is in and score the energy that the particle deposits within that volume (either the mother volume or daughter volume). If a particle is within the mother volume and also within the daughter volume will the sum of the energy deposited within the mother volume be: 1) The total energy deposited within the mother volume but not including that deposited within the daughter volume OR 2) The total energy deposited within the mother volume also including that deposited within the daughter volume? Ive managed to confuse myself while trying to solve this problem... Thanks in advance!! Ben
Re: Scoring energy deposition of both mother and daughter volumes  by Daren Sawkey <Daren Sawkey>,   13 Feb, 2015
Re: Scoring energy deposition of both mother and daughter volumes (Ben Hug)
 Hi, SteppingAction is written by the user so you can score energy deposition however you want! If you follow the example $G4INSTALL/examples/extended/electromagnetic/TestEm9, each energy deposition will be recorded in one volume only (your option 1). Question about the sense of G4PSCylinderSurfaceFlux by Andrea Conti <Andrea Conti>, 21 Jan, 2015  Why is a particle's contribution to the flux in G4PSCylinderSurfaceFlux divided by the cosine of the incident angle of the track ? In principle, I think that, conceptually, in this class one is sitting across a surface and simply counting how many particles are stepping through the surface in. Therefore, I think that each particle should simply be counted as one (multiplied by the weight, clear), indipendently from the direction the particle crosses the surface with. Can anybody give me a conceptual explanation of this ? I have modified G4PSCylinderSurfaceFlux, multiplying each particle's contribution to the flux with an energy-dependent fluence-to-ambient-dose-equivalent coefficient (from ICRP 74) in order to get the ambient dose equivalent H*(d) and I worry that the results could be wrong because the way the flux is tallied is not convincing. Thank you. Andrea Conti Re: Question about the sense of G4PSCylinderSurfaceFlux by Tsukasa Aso <Tsukasa Aso>, 21 Jan, 2015 Re: Question about the sense of G4PSCylinderSurfaceFlux (Andrea Conti)  Hi, If you want to count the number of tracks at the surface, please use G4PSCylinderSurfaceCurrent class. The term "current" and "flux" have different meanings in the definition. Best regards, T.Aso  Re: Question about the sense of G4PSCylinderSurfaceFlux by Andrea Conti <Andrea Conti>, 23 Jan, 2015 Re: Re: Question about the sense of G4PSCylinderSurfaceFlux (Tsukasa Aso)  Ok. Thank you very much. Andrea Conti Command-based Scoring and Filtering for Secondaries by Jonathan Wrobel <Jonathan Wrobel>, 13 Jan, 2015  Hello, Short version: is there a way to use the command-based scoring and filters to measure the flux of secondary particles through a plane/surface? I know that I can set up a filter using the method below, but is there a way to filter/differentiate between primary and secondary protons while using the command-based scoring? /score/quantity/flatSurfaceFlux fluxProtons /score/filter/particle protonFilter proton /score/close Also, is there a way to create a filter for all high-Z ions (Z>proton)? Would GenericIon suffice? Long version: I have set up a Geant4 application where the geometry is defined through GDML input files, and the scoring is defined using command-based scoring and filters that are written in input macros. Additional scripts control the runs and the creation of dump files. This allows my simulation to be iterated without re-compiling my G4 application. Along those lines I am attempting to remain with command-based scoring to track creation of secondaries. Now example RE06DetectorConstruction has the below definition in its DetectorConstruction, and I was wondering if that could be incorporated into a command-based scoring approach? And if so, where/how? primitive = new G4PSNofSecondary("nElectron",j); primitive->SetFilter(electronFilter); det->RegisterPrimitive(primitive); Thanks for any help. Regards, Jonathan Re: Command-based Scoring and Filtering for Secondaries by Tsukasa Aso <Tsukasa Aso>, 13 Jan, 2015 Re: Command-based Scoring and Filtering for Secondaries (Jonathan Wrobel)  Hi, Unfortunately, there is no command in the command-based scoring for 1) filtering only primary tracks 2) filtering ions. (This can be realized by describing a user code like RE06 with G4PSParticleFilter) The command-based scorer has a command for G4PSNofSecondary. Please check the Geant4 manual in: http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/AllResources/Control/UIcommands/_score_quantity_.html It counts the number of secondary particles created in the volume. Regards, Tsukasa Aso  Re: Command-based Scoring and Filtering for Secondaries by Tsukasa Aso <Tsukasa Aso>, 13 Jan, 2015 Re: Re: Command-based Scoring and Filtering for Secondaries (Tsukasa Aso)  For filtering ions by using the command-based scoring, please look at the following link. http://hypernews.slac.stanford.edu:5090/HyperNews/geant4/get/biasing_scoring/7/1.html Best regards, Tsukasa Aso  stuck track and aborted events by matthew <matthew>, 11 Jan, 2015  I am using a primitive scorer to record deposited energy from electrons. the scorer is defined: /score/create/boxMesh boxMesh_1 /score/mesh/boxSize 500. 500. 100. km /score/mesh/nBin 50 50 50 /score/mesh/translate/xyz 0.0 0.0 2185 km The point source is hundreds of km above the scorer. When running this way, I get lots of error messages of the form: -------- EEEE ------- G4Exception-START -------- EEEE ------- *** G4Exception : GeomNav0003 issued by : G4Navigator::ComputeStep() Stuck Track: potential geometry or navigation problem. Track stuck, not moving for 25 steps in volume -boxMesh_1_3- at point (2.6038e+08,-2.48802e+08,2.285e+09) direction: (-0.0719718,-0.585694,0.807331). *** Event Must Be Aborted *** -------- EEEE -------- G4Exception-END --------- EEEE ------- I appear to be losing lots of events. This is not good considering I'm interested in recorded deposited energy from all events. If I change the number of bins in the scorer just slightly to: /score/mesh/nBin 50 50 51 I get a different error message that sometimes causes GEANT to freeze: -------- WWWW ------- G4Exception-START -------- WWWW ------- *** G4Exception : GeomNav1002 issued by : G4Navigator::ComputeStep() May lead to a crash or unreliable results. Position has shifted considerably without notifying the navigator ! Tolerated safety: 19149.9 Computed shift : 1.4749e+12 *** This is just a warning message. *** -------- WWWW -------- G4Exception-END --------- WWWW ------- What am I doing wrong? How should I define the scorer in a way that doesn't drop events or cause GEANT to lock up on me? Any suggestions are greatly appreciated. matt Re: stuck track and aborted events by Reza <Reza>, 06 Oct, 2015 Re: stuck track and aborted events (matthew)  To suppress this warning you should set the verbosity level of G4Navigator class. First inherit your SteppingAction class from G4UserSteppingAction and then set the push verbosity level of G4Navigator to 0. To do that just use the following lines of code in your SteppingAction class: #include "G4TransportationManager.hh" SteppingAction::SteppingAction() { G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->SetPushVerbosity(0); }  Re: stuck track and aborted events by Makoto Asai <Makoto Asai>, 12 Jan, 2015 Re: stuck track and aborted events (matthew)  Hi, Could you please try without scorers to see if it runs without the warning messages? Also, could you explain how your 200 half-sphere atmosphere layers are implemented? Please make sure the center of these half-spheres are not on the boundary of the world volume (boundary of the world volume cannot share a surface with any volume inside). Kind regards, Makoto  Re: stuck track and aborted events by matthew <matthew>, 12 Jan, 2015 Re: Re: stuck track and aborted events (Makoto Asai)  Hello Makato, thanks for getting back to me. I have run the simulation without scorers and that works fine. Scoring was the last thing I implemented specifically to make sure everything was operating as expected. I attached the DetectorConstruction file to this message. The geometry is large, but does not appear to have overlapping layers or anything in contact with the world volume. Could the /vis commands be conflicting with the scorer? in order to visualize smooth surfaces, I'm using the commands: /vis/viewer/set/auxiliaryEdge true /vis/viewer/set/lineSegmentsPerCircle 108 I don't see why that would affect the scorer but I'm open to suggestions. thanks for any advice. Attachment: http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/01/12/09.39-17870-5_DetectorConstruction.cc Re: stuck track and aborted events by Makoto Asai <Makoto Asai>, 12 Jan, 2015 Re: Re: stuck track and aborted events (matthew)  Hi, I looked at your code and confirmed that all half-spheres are sharing the cut surface with the world volume. As written in the user's guide, world volume should not share the surface with any volume inside. Could you change just one line > G4double world_hz = 4186.0*km; // half-length to > G4double world_hz = 4187.0*km; // half-length to see any difference? You don't need to change the locations of half-spheres so that none of then touches to the world volume. Makoto  Re: stuck track and aborted events by matthew <matthew>, 12 Jan, 2015 Re: Re: stuck track and aborted events (Makoto Asai)  Hello Makoto, thank you for taking the time to check my code. I made the change you recommended but that did not change the error/warning messages I get when running the scorer. I've found even numbers of bins such as /score/mesh/boxSize 500. 500. 100. km /score/mesh/nBin 10 10 10 produces *** event aborted *** warnings, but if I use odd numbers of bins such as /score/mesh/boxSize 500. 500. 100. km /score/mesh/nBin 5 5 11 I get this message: -------- WWWW ------- G4Exception-START -------- WWWW ------- *** G4Exception : GeomNav1002 issued by : G4Navigator::ComputeStep() May lead to a crash or unreliable results. Position has shifted considerably without notifying the navigator ! Tolerated safety: 1e-06 Computed shift : 4.92005e+18 *** This is just a warning message. *** -------- WWWW -------- G4Exception-END --------- WWWW ------- how serious is this message? Am I losing particles? Re: stuck track and aborted events by Makoto Asai <Makoto Asai>, 12 Jan, 2015 Re: Re: stuck track and aborted events (matthew)  > -------- WWWW ------- G4Exception-START -------- WWWW ------- > *** G4Exception : GeomNav1002 > issued by : G4Navigator::ComputeStep() > May lead to a crash or unreliable results. > Position has shifted considerably without notifying the > navigator ! > Tolerated safety: 1e-06 > Computed shift : 4.92005e+18 > *** This is just a warning message. *** > -------- WWWW -------- G4Exception-END --------- WWWW ------- > > how serious is this message? Am I losing particles? > Yes, computed shift is a big concern. Its unit is mm, thus this shift is as huge as 5e+12 km!! That is 8 order of magnitude larger than your world volume. Which version of Geant4 are you using? Makoto  Re: stuck track and aborted events by Reza <Reza>, 06 Oct, 2015 Re: Re: stuck track and aborted events (Makoto Asai)  To suppress this warning you should set the verbosity level of G4Navigator class. First inherit your SteppingAction class from G4UserSteppingAction and then set the push verbosity level of G4Navigator to 0. To do that just use the following lines of code in your SteppingAction class: #include "G4TransportationManager.hh" SteppingAction::SteppingAction() { G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->SetPushVerbosity(0); }  Re: stuck track and aborted events by matthew <matthew>, 12 Jan, 2015 Re: Re: stuck track and aborted events (Makoto Asai)  I am using GEANT4-10.0.1 mat Re: stuck track and aborted events by Makoto Asai <Makoto Asai>, 13 Jan, 2015 Re: Re: stuck track and aborted events (matthew)  Thanks. Please upload your main, physics list and primary generator action classes so that we can reproduce your problem. On your side, could you please try one more thing? That is, it seems you are using G4UserSpecialCuts to limit the TOF. Could you remove this G4UserSpecialCuts process if it makes difference? Kind regards, Makoto  Re: stuck track and aborted events by Makoto Asai <Makoto Asai>, 13 Jan, 2015 Re: Re: stuck track and aborted events (Makoto Asai)  Hi, Actually, one more thing you may try. Given the size of your world volume is in the order of 1.e+4 km, the default geometry tolerance of 1.e-9 mm must be too small. Given shape of your solid is sphere, rounding error may easily be much larger than this default tolerance, and that causes intrinsic volume overlaps. Please note that visualization is not sensitive for this kind of overlap. Please add the following line immediately after you define "world_hx" in the Construct() method of your detector construction. G4GeometryManager::GetInstance()->SetWorldMaximumExtent(2.*world_hx); For more detail about this, please refer to section 4.1.8.6. of the application developers guide. Makoto  Re: stuck track and aborted events by matthew <matthew>, 14 Jan, 2015 Re: Re: stuck track and aborted events (Makoto Asai)  Changing the tolerance did the trick! Thank you so much for taking the time to help. I highly doubt I would have found that solution on my own. tolerance ni tsuite oshiete kurete arigatou! very grateful, matt Re: stuck track and aborted events by Tsukasa Aso <Tsukasa Aso>, 11 Jan, 2015 Re: stuck track and aborted events (matthew)  Hi, Could you provide more information for the geometry? What is the size of world volume? Best regards, T. Aso  Re: stuck track and aborted events by matthew <matthew>, 12 Jan, 2015 Re: Re: stuck track and aborted events (Tsukasa Aso)  The world geometry is very large: //------------------------------ World Volume (cube of vacuum) ------------- // // World volume is a cube of extent 8372 km in all three directions G4double world_hx = 8000.0*km; // half-length G4double world_hy = 8000.0*km; // half-length G4double world_hz = 4186.0*km; // half-length // apply cut in time of flight (TOF) to logival volume G4double maxTime = 30*ms; fstepLimit = new G4UserLimits(DBL_MAX,DBL_MAX,maxTime); // Define world logical volume: G4Box* worldBox = new G4Box("World_box",world_hx,world_hy,world_hz); world_log = new G4LogicalVolume(worldBox,vacuum,"world_log",0,0,0); world_log->SetUserLimits(fstepLimit); // Instantiation of a set of visualization attributes with cyan colour G4VisAttributes * worldVisAtt = new G4VisAttributes(G4Colour(1,1,1)); // Set visibility to false worldVisAtt->SetVisibility(false); // Assignment of the visualization attributes to the logical volume world_log->SetVisAttributes(worldVisAtt); Inside the world geometry is a half-sphere of planet earth and two hundred layers of 1km-thick atmosphere. Do you think the size of the geometry is the issue? matt Negative number of interaction length warning with GEANT4.10.1 by Stefan E. Mueller <Stefan E. Mueller>, 07 Jan, 2015  Hi, I have an application in which I bias the cross section for the processes "GammaToMuPair" and "muonNuclear". Running this application with GEANT 4.10.1, I see a lot of warnings in the logfile: -------- WWWW ------- G4Exception-START -------- WWWW ------- *** G4Exception : BIAS.GEN.13 issued by : G4InteractionLawPhysical::UpdateInteractionLengthForStep(...) Negative number of interaction length for LawForOperationXSchange-GammaToMuPair' -0.000202403, set it to zero ! *** This is just a warning message. *** -------- WWWW -------- G4Exception-END --------- WWWW ------- (I get similar warnings for the "muonNuclear"-process). This was not the case when running with GEANT4.10.0-Patch3. It might be just a warning, however, I am a little bit confused about the possibility that an interaction length can become negative at all (and then is set to zero!). The scaling factors which I provide to bias the cross sections are in any case positive. Is this behavior of geant 4.10.1 intended? Best regards, Stefan  Re: Negative number of interaction length warning with GEANT4.10.1 by Marc Verderi <Marc Verderi>, 07 Jan, 2015 Re: Negative number of interaction length warning with GEANT4.10.1 (Stefan E. Mueller)  Hi Stefan, I believe I understand the reason of this. Please try to update your code on the basis on GB01. Best regards, Marc On 01/07/2015 12:14 PM, Stefan E. Mueller wrote: > *** Discussion title: Biasing and Scoring > > Hi, > > I have an application in which I bias the cross section for the processes "GammaToMuPair" and "muonNuclear". > > Running this application with GEANT 4.10.1, I see a lot of warnings in the logfile: > > -------- WWWW ------- G4Exception-START -------- WWWW ------- > *** G4Exception : BIAS.GEN.13 > issued by : G4InteractionLawPhysical::UpdateInteractionLengthForStep(...) > Negative number of interaction length for LawForOperationXSchange-GammaToMuPair' -0.000202403, set it to zero ! > > *** This is just a warning message. *** > -------- WWWW -------- G4Exception-END --------- WWWW ------- > (I get similar warnings for the "muonNuclear"-process). > > This was not the case when running with GEANT4.10.0-Patch3. > > It might be just a warning, however, I am a little bit confused about the possibility that an interaction > length can become negative at all (and then is set to zero!). > > The scaling factors which I provide to bias the cross sections are in any case positive. > > Is this behavior of geant 4.10.1 intended? > > Best regards, > > Stefan > > ------------------------------------------------------------- > Visit this GEANT4 at hypernews.slac.stanford.edu message (to reply or unsubscribe) at: > http://hypernews.slac.stanford.edu/HyperNews/geant4/get/biasing_scoring/153.html  Re: Negative number of interaction length warning with GEANT4.10.1 by Stefan E. Mueller <Stefan E. Mueller>, 09 Jan, 2015 Re: Re: Negative number of interaction length warning with GEANT4.10.1 (Marc Verderi)  OK, I had a look at example GB01, and modified my code accordingly. Apparently, there are some subtle changes when going from GEANT4.10.0 to GEANT4.10.1. Now the warnings disappeared. This is what I did to my BiasingOperator-code used to configure and select the biasing operation (corresponds to GB01BOptrChangeCrossSection.cc in the GB01 example): a) add the "G4InteractionLawPhysical.hh" include file b) moved the "Setup stage" to a dedicated "StartRun" method (and include definition in the .hh-file as "virtual void StartRun();") c) Added the line "operation->UpdateForStep( 0.0 ); " at the end of the "ProposeOccurenceBiasingOperation" method. Thanks for the quick response and the solution. Stefan  ExampleGB01 question by Carlos Ayerbe Gayoso <Carlos Ayerbe Gayoso>, 06 Jan, 2015  Dear GEANTers this is a very simple question. I modified GB01 example to have protons of 1.2GeV over a carbon disk and biasing the production of pi+, mu+ and e+. Since is the first time I'm working wiht the biasing process, I just started quite naive. I changed the gun to have protons of 1.2 GeV, instead of neutrons as was originally. The detector is a carbon disk of 100mm radius and 5mm thickness. In the main file, I started to modify the bias section with: biasingPhysics->Bias("pi+"); biasingPhysics->Bias("mu+"); biasingPhysics->Bias("e+"); and something similar in the DetectorConstruction module: testMany->AddParticle... Just for fun I used the GUI to see the result visually and compare the option ON or OFF, with only pi+ particles visible. The visual output was the same in both cases. In other words, biasing didn't change anything at all. Then I figure out that neutrons were originally listed in the biaisng process, so I introduced the proton in the bias list biasingPhysics->Bias("proton"); and it seems there is a change with the bias ON option comapred with previous runs (the OFF option seems to behave similar as before). Is this the correct way? I mean, should the primary particle be listed in the bias? why? Maybe everything is wrong since in the new one (with protons in the bias) I got the warnings: -------- WWWW ------- G4Exception-START -------- WWWW ------- *** G4Exception : BIAS.GEN.14 issued by : G4InteractionLawPhysical::SetPhysicalCrossSection(..) Cross-section value passed is negative. It is set to zero ! *** This is just a warning message. *** -------- WWWW -------- G4Exception-END --------- WWWW ------- Thank you very much for your feedback Carlos Ayerbe Re: ExampleGB01 question by Marc Verderi <Marc Verderi>, 07 Jan, 2015 Re: ExampleGB01 question (Carlos Ayerbe Gayoso)  Dear Carlos, You should indeed (in principle) bias the proton in your case : as, I understand, the pi+, mu+, etc. are produced by the interaction of the proton. Now, compared to what you want, there are things to work on: - first, the biasing scheme as been essentially tested with neutral incident particles, it might work with charged, but this needs to be studied (and the problem you see BIAS.GEN.14 might be related to this), and is the next development step FY 2015. - I understand you want to bias specifically the production of pi+ etc. If you start with GB01, which is doing a cross-section change, all final states are "biased the same way" : ie the relative amounts of pi+, mu+, etc. stay the same. If you are fine with this then, cross-section biasing is adequate. If you want -say- to enhance pi+ production, then this is a final state biasing which is needed. This is possible today, but needs some extra work. Please provide a bit more information about what you need. Cheers, Marc On 01/07/2015 01:13 AM, Carlos Ayerbe Gayoso wrote: > *** Discussion title: Biasing and Scoring > > Dear GEANTers > > this is a very simple question. I modified GB01 example to have protons > of 1.2GeV over a carbon disk and biasing the production of pi+, mu+ and > e+. Since is the first time I'm working wiht the biasing process, I just > started quite naive. > > I changed the gun to have protons of 1.2 GeV, instead of neutrons as was > originally. > > The detector is a carbon disk of 100mm radius and 5mm thickness. > > In the main file, I started to modify the bias section with: > > biasingPhysics->Bias("pi+"); biasingPhysics->Bias("mu+"); > biasingPhysics->Bias("e+"); > > and something similar in the DetectorConstruction module: > testMany->AddParticle... > > Just for fun I used the GUI to see the result visually and compare the > option ON or OFF, with only pi+ particles visible. The visual output was > the same in both cases. In other words, biasing didn't change anything > at all. > > Then I figure out that neutrons were originally listed in the biaisng > process, so I introduced the proton in the bias list > > biasingPhysics->Bias("proton"); > > and it seems there is a change with the bias ON option comapred with > previous runs (the OFF option seems to behave similar as before). > > Is this the correct way? I mean, should the primary particle be listed > in the bias? why? > > Maybe everything is wrong since in the new one (with protons in the > bias) I got the warnings: > > -------- WWWW ------- G4Exception-START -------- WWWW ------- > *** G4Exception : BIAS.GEN.14 > issued by : G4InteractionLawPhysical::SetPhysicalCrossSection(..) > Cross-section value passed is negative. It is set to zero ! > *** This is just a warning message. *** > -------- WWWW -------- G4Exception-END --------- WWWW ------- > > Thank you very much for your feedback > > Carlos Ayerbe > > ------------------------------------------------------------- > Visit this GEANT4 at hypernews.slac.stanford.edu message (to reply or unsubscribe) at: > http://hypernews.slac.stanford.edu/HyperNews/geant4/get/biasing_scoring/152.html  Re: ExampleGB01 question by Carlos Ayerbe Gayoso <Carlos Ayerbe Gayoso>, 07 Jan, 2015 Re: Re: ExampleGB01 question (Marc Verderi)  Thank you Mark indeed, I want to bias the final states p+C producing pi+, mu+ and e+. I just trying to produce this reaction to simulate a proton beam over a carbon target in order to produce a NTuple in a certain area (phase space) with a sensitive detector or a scorer (this is the next step in the program). With such output, I'll use as an input in G4beamline. In other words, I use Geant4 for the target selecting a space phase region after the p+C reaction and then plug in G4beamline. I guess that with your comment and warning I could continue. The other step is brute force and forgetting about biasing and run a huge number of events (>10^6) and collect the desired particles in the region I want. But it is a nice exercise and saving time. Thank you again, but please, if somebody else have another comment (as Stefan wrote me) I really appreciate Carlos Re: ExampleGB01 question by Tom Roberts <Tom Roberts>, 07 Jan, 2015 Re: Re: ExampleGB01 question (Carlos Ayerbe Gayoso)  There is a whole 'nother way to do this. Start with a simulation of just the target in G4beamline. Use this command:  newparticlentuple First require=ParentID>0 kill=1 format=ascii This writes an NTuple file "First.txt" containing just the secondary particles from beam interactions, killing them after outputting (to not waste time). Now write a filter program to read First.txt and write an NTuple to "Second.txt". In this program you impose whatever constraints and biases you wish. The ASCII NTuple format is documented in the G4beamline Users Guide. Then use Second.txt as input to the second simulation in G4beamline (as you indicated you intend to do). This has the advantage that except for reading and writing the ASCII files, the only code you write is to implement the specific constraints and biases you want -- you have to do that no matter how you implement it. You aren't even limited to C++, as any language can read and write the ASCII NTuple files. The disadvantage is that you have no access to the geometry information, and will have slightly less performance (negligible for any non-trivial simulation). Note that if you don't handle the value of Weight carefully, you will have difficulty unwinding the biasing later in the analysis. Re: ExampleGB01 question by Carlos Ayerbe Gayoso <Carlos Ayerbe Gayoso>, 08 Jan, 2015 Re: Re: ExampleGB01 question (Tom Roberts)  Dear Tom thank you very much for your suggestion. I have some questions, and perhaps they arise due to my lack of description of the problem. What I want to do is study the distribution of the particles (pi, mu, e) at target area in the piM1 beamline at PSI. This is a secondary beam from a proton+C reaction (M target). The beam line entrance is 22 deg respect the proton beam and is ~1m from target. The solid angle is ~6 msr. With your method I understand that I should made a small target simulation saving all the products of the reaction, killing the protons before store the data, and then filter the saved file with the particles I'm interested in the region (phase space) I want. But, I think that it comes the problem of the small cross section and the small number of particles in this phase space, so I must increase the number of events to have considerable statistics, and if I'm not wrong G4BL is limited to ~16M events per run due to Root/Ntuples limits, so it implies several runs, doesn't it? But here is another question I dare to ask here (please activate the G4BL forum!), the beam input file in G4BL gives only the particles listed as input (fixed number) or G4BL uses it as a sample for whatever number of events is requested? ie, if the file/NTuple lists 40 lines of particles, G4BL only processes 40 events/particles or if if request N events, it uses the input file as a model to sample the event generator? As you see, the small number of patticles in certain region, size of the acceptante is what makes me go through secondary frameworks to feed my G4BL simulation. When I tried a là brute force (direct target and collect the secondary particles) I needed 70x16M events in order to collect 300 good particles in my target area (and that was with certain errors in the geometry which favorable to the collection of secondaries). Once again, thank you very much Carlos GDML, Sensitive detectors and primitive scorers by <ZachB>, 05 Jan, 2015  Hello, So right now I am working on a simulation that uses GDML, sensitive detectors and primitive scorers trying to make them all play nicely with each other. So, couple of questions. 1. Is it possible for a primitive scorer to be used when the geometry is defined as a GDML file? Right now I have void ConstructSDandField(){ detect = new G4MultiFunctionalDetector("centerMTC"); G4VPrimitiveScorer* fluxPrimitiveCenter = new G4PSFlatSurfaceFlux("SurfFlux1", 1, 30); detect->RegisterPrimitive(fluxPrimitiveCenter); SetSensitiveDetector("mtcV" , detect); } where mtcV is the auxilirary information attached to the volume I'm interested in. 2. I am using the sensitive detector and as such I needed to define my own hits class. If I am using my own hits class, can I use the primitive scorer class with my own hits class or does this cause other issues? My main issue is that the flux is never accumulating. Particles are passing through the main volume but they are never being counted in the flux scorer. I am implementing my own run class to accumulate the data for the flux scorer. Any help would be greatly appreciated, thank you.  Sensitive detector with G4PSCylinderSurfaceFlux by Andrea Conti <Andrea Conti>, 31 Dec, 2014  I have a cylindrical container having the radioactive source inside and I implemented a ring around it, in order to measure the flux with G4PSCylinderSurfaceFlux. The ring is 20cm high and 10mm (radially) thick. The detector has been implemented this way: G4VPhysicalVolume* DetectorConstruction::Construct() { . . G4Tubs* solidDetector = new G4Tubs("Detector", 600*mm,610*mm,100*mm,0*deg,360*deg); G4LogicalVolume* logicDetector = new G4LogicalVolume(solidDetector,Air,"Detector"); G4VPhysicalVolume* physiDetector = new G4PVPlacement(0, G4ThreeVector(), logicDetector, "Detector", logicWorld, false, 0);  G4String filterName, particleName; G4SDParticleFilter* gammaFilter = new G4SDParticleFilter(filterName="gammaFilter",particleName="gamma"); G4MultiFunctionalDetector* det = new G4MultiFunctionalDetector("Detector"); primitive = new G4PSCylinderSurfaceFlux("eDep",0,0); primitive->SetFilter(gammaFilter); det->RegisterPrimitive(primitive); G4SDManager::GetSDMpointer()->AddNewDetector(det); logicDetector->SetSensitiveDetector(det); . } And then, to retrieve the information, I have: void EventAction::EndOfEventAction(const G4Event* evt) { . G4SDManager* SDMan= G4SDManager::GetSDMpointer(); colID = SDMan->GetCollectionID("Detector/eDep"); G4HCofThisEvent* HCE = evt->GetHCofThisEvent(); G4THitsMap* evtMap = (G4THitsMap*)(HCE->GetHC(colID)); std::map::iterator itr = evtMap->GetMap()->begin(); G4int key = (itr->first); G4double val = *(itr->second);  G4cout << "key = " << key; } But I never get anything, also when I see through visualization that some photons effectively go through the detector belt. The variable "key" always results to be = 0. I am afraid I did something wrong in the construction of the sensitive detector. I always activate the detector through the command line: "/hits/activate Detector". By the way, if I give the command "/hits/activate Detector/eDep" then I get the error message "Detector/ is not found in /". Have I correctly associated the surface detector to my ring ? I am afraid not. Andrea Re: Sensitive detector with G4PSCylinderSurfaceFlux by Tsukasa Aso <Tsukasa Aso>, 31 Dec, 2014 Re: Sensitive detector with G4PSCylinderSurfaceFlux (Andrea Conti)  Hi The "key" is the copy number of the geometry. "key = 0" means the scoring volume with the copy number = 0, which you defined. Please check "val" as well, it should have some quantity. Best regards, T. Aso  Re: Sensitive detector with G4PSCylinderSurfaceFlux by Andrea Conti <Andrea Conti>, 01 Jan, 2015 Re: Re: Sensitive detector with G4PSCylinderSurfaceFlux (Tsukasa Aso)  Tsukasa, you are right: it works ! My problem was that I order the decay of a nucleus of Ne24 one by one through the command "/run/beamOn 1" and at the first try, by chance no photons go through the detector and therefore key = 0, but val is undefined and if I let output val then it gets stuck and I have to abort the execution. But when some photons do go through the detector, then I really get flux and I saw it calling: G4MultiFunctionalDetector::PrintAll(); Thank you Tsukasa! Andrea Measuring H*(d) with the ICRU sphere by Andrea Conti <Andrea Conti>, 09 Dec, 2014  I have a cask containing radioactive scratch material from a BWR core and I have to calculate the ambient equivalent dose rate H*(d) at certain points outside of the cask, for example at 1m from its surface, at middle height. I'm thinking of implementing the ICRU sphere (whose diameter is 30cm) in the geometry and then tallying the dose equivalent rate in a small volume centered around the point pointed to by the radius of the sphere, oriented towards the source (f.e. I would say horizontally if I place the detector at middle height) and at depth d. The dose rate is in principle a point quantity but it's clear that with the Monte Carlo I can only tally the dose in a volume, as small as it can be. So I am thinking of a small sub-sphere centered around the over mentioned point. How large should the sub-sphere be ? In principle it should be as small as possible, but if it is too small then it's going to take too much time in order to obtain a good statistical quality. Does anybody have experience ? Andrea Conti Scoring Dose by Ibrahim <Ibrahim>, 02 Dec, 2014  dear all, I calculated the dose in a given layer using: /score/quantity/doseDeposit Dose1 this calculates dose per event. Is it correct? I calculated also the dose using Stopping powers from NIST. the difference between the results obtained with Geant4 and NIST is large. Example: I irradiated a 100 nm thick Copper layer with an electron beam of Ee=300keV and I obtained: Dose: D1=1.408 mrad/event from NIST stopping power I got: D2=1.754 mrad/event. The relative difference between these two values of the dose is about 24.6 % !! and for 300 nm SiO2 it is 23.6 % !! Why there is such a large difference between Geant4 and NIST data? Additional Info: in my simulation density of SiO2: 2.5 g/cm3 Copper density is 8.94 g/cm3 PhysicsList: Low energy physics: Livermore model cut=0.65 um There is a vacuum in the world volume. If you need additional info, please let me know. I kindly welcome your help. Cheers Re: Scoring Dose by Tsukasa Aso <Tsukasa Aso>, 09 Dec, 2014 Re: Scoring Dose (Ibrahim)  Hi, The doseDeposit corrects the accumulated dose for the all events. And, the dose in the doseDeposit is defined by the energy-deposited divided by the volume of scoring cell. Therefore if you are using very collimated beam, the absolute value of dose depends on the size of the volume. As you know, the definition of dose is rater complicated, it is valid for very small volume like a point, or for under the equilibrium condition. Best regards,  How to add importance to G4PVParameterised volumes by Xiaosong Yan <Xiaosong Yan>, 02 Dec, 2014  Hello everyone: I'm now simulating an X-ray imaging system. Because the the ~MeV X-ray penetrates thick (~1 m) concrete object and then deposites energy in the array detectors, I plan to implement geometry based importance biasing techniques to improve the statistics. However, I'm confronting with problems with AddImportanceGeometryCell() procedures. In my DetectorConstruction class, the following is added:  G4VSolid* calorimeterSolid = new G4Box("Calorimeter_Solid", // Name 2.525*cm, // x half length 0.025*cm, // y half length 2.5*cm) ; // z half length  G4LogicalVolume* calorimeterLogical = new G4LogicalVolume(calorimeterSolid, // Solid si, // Material "Calorimeter_Logical"); // Name fLogicalVolumeVector.push_back(calorimeterLogical);   std::ostringstream os; G4String name; for (G4int i = 0; i < 20; i++) { os.str(""); G4double ypos=i*0.25*cm-2.575*cm; os << "si_layer_"<AddImportanceGeometryCell(imp, *(*(fPhysicalVolumeVector.end()-1)),0);   Though I succeeded compiling my program, the following errors displayed when run it.  ERROR - G4IStore::GetImportance(gCell):Region does not exist ***G4Exception: FataException issued by : G4IStore::Error() GetImportance(gCell): Region does not exist *** Fata Exception *** core dump *** *** G4Exception: Aborting execution *** Besides, there are some other output as: PGeometryCell gCell: Volume name = Cell_Physical, Replica number = 25 Not found in: Volume name = concreteblock, Replica number = 0, importance = 1 ... Volume name = Cell_Physical, Replica number = 0, importance = 100 ...  It's deduced that failure in addimportance to all the G4VPhysicalVolume cellPhysical leads to error, but I don't know how to add importance to them.  Anyone who have idea? I appreciate all your help. Best regards. Xiaosong Yan. Re: How to add importance to G4PVParameterised volumes by jiawei liu <jiawei liu>, 09 Sep, 2015 Re: How to add importance to G4PVParameterised volumes (Xiaosong Yan)  你好， 我现在面临和你同样的问题，但是只有一个部分显示不存在，请问你这个问题后来解决了么？怎么解决的呢？ 期待你的回复。  Re: How to add importance to G4PVParameterised volumes by jiawei liu <jiawei liu>, 09 Sep, 2015 Re: How to add importance to G4PVParameterised volumes (Xiaosong Yan)  你好， 我现在面临和你同样的问题，但是只有一个部分显示不存在，请问你这个问题后来解决了么？怎么解决的呢？ 期待你的回复。  Re: How to add importance to G4PVParameterised volumes by Xiaosong Yan <Xiaosong Yan>, 08 Jan, 2015 Re: How to add importance to G4PVParameterised volumes (Xiaosong Yan)  Please help me. Thanks. Re: How to add importance to G4PVParameterised volumes by jiawei liu <jiawei liu>, 09 Sep, 2015 Re: Re: How to add importance to G4PVParameterised volumes (Xiaosong Yan)  hi, I am confronted with the same problem now, so i would like to ask how you solved it. wait for your response.  Thank you  scoring flux based on process by lalageh <lalageh>, 18 Nov, 2014  Hello all, I am scoring flux in a water phantom for 178 MeV proton beam using Geant4.10 p02. I have filters based on particle type (I am filtering flux for gamma). But I'd like to know how to filter it based on physics processes? Currently I have the following code for "conversion" process. But, it does not give me the flux of gammas that undergo "conversion"! I think it is giving the flux of secondary particles that are produced by conversion. How can I have the flux of particles that undergo a specific physics process? Can anyone help me please Thank you Here is my code: G4bool FluxCell_Gamma_conv::ProcessHits(G4Step* aStep,G4TouchableHistory*) { G4String CPName; if(aStep->GetPostStepPoint()->GetProcessDefinedStep()!=0) CPName = aStep->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName(); if(CPName=="conv") { G4double stepLength = aStep->GetStepLength(); if ( stepLength == 0. ) return FALSE;  G4int idx = ((G4TouchableHistory*) (aStep->GetPreStepPoint()->GetTouchable())) ->GetReplicaNumber(indexDepth); if(idx<0) {idx=0;} G4double cubicVolume = ComputeVolume(aStep, idx); G4double CellFlux1 = stepLength/ cubicVolume; if (weighted) CellFlux1 *= aStep->GetPreStepPoint()->GetWeight(); G4int index = GetIndex(aStep); EvtMap->add(index,CellFlux1); return TRUE; } else return FALSE; }  Scored the wrong angle, really bad thing by Geng <Geng>, 16 Nov, 2014  Dear experts, I am doing a simulation with Geant4.10.p03. I tried to score the particle angles emitted from the upper side of a box. I am using the following code to judge the surface from the upper side of a box. if (aStep->GetPostStepPoint()->GetStepStatus() == fGeomBoundary ){ // Exiting Geometry G4ThreeVector stppos2= aStep->GetPostStepPoint()->GetPosition(); G4ThreeVector localpos2 = theTouchable->GetHistory()->GetTopTransform().TransformPoint(stppos2); if(std::fabs( localpos2.z() + boxSolid->GetZHalfLength())GetPostStepPoint()-> GetMomentumDirection().z())/degree; In my personal sense, the angels should distribute in the range of 90-180 degree, however, the strange thing is, there is a lot of the angles are much less than 90 degree? I cannot figure out where I am wrong, so, could anyone give me some suggestions? Thanks and best regards. Geng Re: Scored the wrong angle, really bad thing by Geng <Geng>, 16 Nov, 2014 Re: Scored the wrong angle, really bad thing (Geng)  oh, I already find my problem. sorry everyone. How to make my own PS in Command-based Scoring? by lcl <lcl>, 16 Nov, 2014  hello I want to make a PS to use like PS in Command-based Scoring. How to make it without modification of G4 source code? just make it in application? I dont find any exmple in runandevent examples. how to integrat my own PS in Command-based Scoring. Re: How to make my own PS in Command-based Scoring? by Volodymyr Morgunov <Volodymyr Morgunov>, 18 Jan, 2016 Re: How to make my own PS in Command-based Scoring? (lcl)  Has this issue been solved? Re: How to make my own PS in Command-based Scoring? by lcl <lcl>, 20 Jan, 2016 Re: Re: How to make my own PS in Command-based Scoring? (Volodymyr Morgunov)  yes Re: How to make my own PS in Command-based Scoring? by lcl <lcl>, 09 Jun, 2015 Re: How to make my own PS in Command-based Scoring? (lcl)  There is nothing improved in user's own primitive scorer from G4.10. All the workshops said you can add a scorer/filter. But it is impossible add any scorer outside the source code in MultiThread mode. The framework of command based scoring is based on G4ScoringManager in MT mode. But G4ScoringManager doesn't have a function to add a scorer. I suggest the developers to make some changes in this area. Make an interface to add a scorer outside the G4 source for some uncommon scorers. Make the tutorial of scoring be true. Re: How to make my own PS in Command-based Scoring? by lcl <lcl>, 11 Jun, 2015 Re: Re: How to make my own PS in Command-based Scoring? (lcl)  add the our own PS's quantitymessenger initialization into UserActionInitialization functions maybe ok.  Build() for worker threads BuildForMaster() for master thread this methed can add our own PS in Command-based Scoring in MT mode. the little problem is quantitymessenger is not a useraction. i did not find a prefect way. Re: How to make my own PS in Command-based Scoring? by Makoto Asai <Makoto Asai>, 11 Jun, 2015 Re: Re: How to make my own PS in Command-based Scoring? (lcl)  Build() and BuildForMaster() in your UserActionInitialization are surely one of the right places to instantiate your messengers. The same messenger has to be instantiated in both master and worker threads. The other place is in your UserDetectorConstruction. In this case Construct() method is invoked from the mater thread and ConstructSDAndField() method is invoked from worker threads. Hope this helps, Makoto Re: How to make my own PS in Command-based Scoring? by lcl <lcl>, 12 Jun, 2015 Re: Re: How to make my own PS in Command-based Scoring? (Makoto Asai)  Thanks for your answer. I have tried other places such as in UserRunAction or UserWorkerInitializtion, but both does not work. Use messenger in UserDetectorConstruction must be a good advice. Thanks again. Re: How to make my own PS in Command-based Scoring? by lcl <lcl>, 17 Nov, 2014 Re: How to make my own PS in Command-based Scoring? (lcl)  I think it doesnot have trouble to make an own PrimitiveScorer. But the messenger i dont know how to make it works. If dont modify G4ScoreQuantityMessenger or G4ScoreQuantityMessengerQCmd, using my own messenger class always make segmentfault when merge data. maybe there is something wrong with multithreads? maybe the Command-based scoring dont let me use it outside its framework? How to use my own PS outside , only in my application ,and purge the Geant4 source code? Could you give me some ideas? G4PSCellFlux Question by Andrew Davis <Andrew Davis>, 12 Nov, 2014  Is there a native way to histogram the G4PSCellFlux into energy dependent particle spectra? I've found several examples of spatial histograming, but not energy dependent histograms for G4PSCellFlux. Production of particles from layers by <ZachB>, 10 Nov, 2014  Hello, I am currently working on a simulation which is basically a multiple boxes inside of each other. I am interested in whether or not box b stops particles that are coming from box a and what particles box a and b produce. Does Geant4 have this kind of capability and if so, where can I find more information on it? I'm not entirely sure what to search for to find this. Thanks. And apologies if this is the wrong sub-forum. Changing geometry between runs with GDML & runtime primitive scorers (the latter is not working) by Jonathan Wrobel <Jonathan Wrobel>, 10 Nov, 2014  Hello, I'm using primitive scoring and GDML-based geometry definition for my Geant4 application in G4v10.00.p03 on Linux. I am attempting to load new geometry between runs, as well as re-set the primitive scorer. However, I am getting segmentation faults and it appears that the primitive scoring is not happy being reset. Can anyone point me in the right direction? Long version: My approach for the primitive scoring is taken directly from Example RE03, where I'm implementing the G4ScoringManager.hh and using run-time definition of the scorers through UI command scripts. This is paired with a GDML load approach adapted from the persistency example G02. I just finished hammering out the GDML portion so that I could successfully load different geometries between runs without restarting Geant4. I know that this portion of the code works because I've been using it and testing it with the reloading. This thread summarizes that accomplishment: http://hypernews.slac.stanford.edu/HyperNews/geant4/get/persistency/45/1/1/1.html For the primitive scorer, I can use the UI-based primitive scorer on my initial geometries, but when I go to initialize the second geometry it will crash. This is my basic UI call order: # First Run ####################### /mydet/readFile test.gdml /run/initialize /vis/open OGL /control/execute scoring_definition_v1.mac /control/execute G4GPS_2Dsource.mac /control/execute vis_settings.mac /control/execute scoring_vis_v1.mac # Second Run ###################### /vis/viewer/clearTransients /persistency/gdml/clear #/run/reinitializeGeometry /run/reinitializeGeometry 1 1 /mydet/readFile test2.gdml /run/initialize <--Seg Fault occurs here /control/execute scoring_definition_v2.mac /control/execute G4GPS_2Dsource.mac /control/execute scoring_vis_v2.mac My understanding of the /run/reinitializeGeometry command is that the two boolean flags at the end when set to true should be purging the parallel world where the primitive scorers are defined. Is that correct? Are there any other "clean" or "reinitialize" commands that I should be using? Thanks for any help. Regards, Jonathan Re: Changing geometry between runs with GDML & runtime primitive scorers (the latter is not working) by Jonathan Wrobel <Jonathan Wrobel>, 11 Nov, 2014 Re: Changing geometry between runs with GDML & runtime primitive scorers (the latter is not working) (Jonathan Wrobel)  A big thanks to Makoto Asai for the answer, relayed below: Unfortunately, changing geometry with GDML *and* using the command-based scorer at the same time is not supported with version 10.0. However, it will be supported in version 10.1 that is scheduled to be released on December 5th. For version 10.01 the UI commands posted previously will be sufficient to clear the command-based scoring as well. The UI command: /persistency/gdml/clear will cleanly delete geometry and G4RunManager will automatically take care of rebuilding scoring geometry. strange energy deposit pattern by <geant4president>, 12 Sep, 2014  Hello, I hope somebody can help me with the following, I have no ideas any more. Scenario: Shooting ~6 MeV photons from the right side to a voxel container read in by the DICOM example (512x512x68 indices in x,y,z, voxel dimensions roughly 1mmx1mmx5mm) and plotting dose deposit, I get a "column-like" substructure, please see the attachment. There is only one material for the irradiated region. Looping over odd and even columns, I get ~40% different cumulated doses. Can this be explained somehow? Stepsizes? Voxel structure optimizations? I am stuck and would be really grateful for the smallest hint or idea. Thanks in advance, Markus  Attachment: http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2014/09/12/06.13-97189-c1_lossy.jpeg  Re: strange energy deposit pattern by <geant4president>, 15 Sep, 2014 Re: strange energy deposit pattern  never mind. this was due to a bug in the ROOT file output routine. Strange anyway. Biasing certain processes by Peter Broere <Peter Broere>, 29 Aug, 2014  Hi, I'm just wondering if there is an easy way to bias certain physical processes in geant4, since the simple way of adding "BiasCrossSectionByFactor(factor)" is only available for a limited selection of processes. What i specifically want is to increase the cross-section of "ionInelastic" by a factor of 100-1000. I have tried to figure out a way to do this with help of the "G4WrapperProcess"-class, but I have had a hard time figuring out how to do this. So any help is of value. regards, Peter Re: Biasing certain processes by <LoongDaoo>, 05 Oct, 2015 Re: Biasing certain processes (Peter Broere)  Hi Peter, I have the same problem now. Have you solved it? If so, please give some help. Many thanks! 2D histograms for ROOT by <Frank>, 31 Jul, 2014  Hello, I'm simulating photons into a scintillator that can be detected by a PMT. I'm recording hits positions in x, y and z separately and export the results to Root with commands like  CreateTree::Instance()->PMTHitPosX[CreateTree::Instance()->PMTNumHits] = thePostPoint->GetPosition().x(); CreateTree::Instance()->PMTHitPosY[CreateTree::Instance()->PMTNumHits] = thePostPoint->GetPosition().y(); CreateTree::Instance()->PMTHitPosZ[CreateTree::Instance()->PMTNumHits] = thePostPoint->GetPosition().z();  Float_t PMTHitPosX[MaxNum]; Float_t PMTHitPosY[MaxNum]; Float_t PMTHitPosZ[MaxNum];  this->GetTree()->Branch("PMTHitPosX",&this->PMTHitPosX,"PMTHitPosX[PMTNumHits]/F"); this->GetTree()->Branch("PMTHitPosY",&this->PMTHitPosY,"PMTHitPosY[PMTNumHits]/F"); this->GetTree()->Branch("PMTHitPosZ",&this->PMTHitPosZ,"PMTHitPosZ[PMTNumHits]/F"); Therefore, after a simulation, I get a Root TTree with 1D histograms for hits in x, y and z. This part works well. As the hits positions are recorded separately in x, y and z, we have marginal histograms and cannot retrieve 2D or 3D histograms (number of hits for a precise XY or XYZ point). Would it be possible to get something like PMTHitPosXY or PMTHitPosXYZ? I tried declaring a PMTHitPosXYZ[ ][ ][ ] and using GetPosition() (without .x() or .y() or .z()) but this is a threevector and cannot associate it a 3D array [ ][ ][ ]. I know TH2 histograms exist in Root, but I just cannot make the link from G4 to Root. Thank you! Clarify the results from Flat Surface Current scorer please. by Aliya Mukanova <Aliya Mukanova>, 28 Jul, 2014  Dear, experts Could you explain more detailed please about "flatSurfaceCurrent" scorer. I wrote scorer this way(as shown in RE03):  /score/create/boxMesh boxMesh_1  /score/mesh/boxSize 0.5 0.5 0.1 cm  /score/mesh/nBin 1 1 1  /score/quantity/flatSurfaceCurrent InCurrentNeutron 1 0  /score/filter/particle neutronFilter neutron  .....  /score/dumpAllQuantitiesToFile boxMesh_1 Out.txt and run  /gun/particle neutron  /run/beamOn 10000 And I get in Out.txt  # mesh name: boxMesh_1 # primitive scorer name: InCurrentNeutron # iX, iY, iZ, value [percm2] 0,0,0,10000.00000000044 Source has direction on the -Z surface directly and doesn't exceed edges of -Z surface (all number of neutrons get surface). From the result It is not clear for me How the flatSurfaceCurrent divided on received surface with area 0.25 cm^2 can be equal to the initial number of neutrons. Where I can look at values of particle weigth(W), which takes place in formula for flatSurfaceCurrent (N*W/A)? It is not related to real particle mass, is it? I am looking forward to hearing from you, Yours sincerely, Aliya Re: Clarify the results from Flat Surface Current scorer please. by Aliya Mukanova <Aliya Mukanova>, 28 Jul, 2014 Re: Clarify the results from Flat Surface Current scorer please. (Aliya Mukanova)  Tsukasa, thank you for your response Yours sincerely, Aliya Re: Clarify the results from Flat Surface Current scorer please. by Tsukasa Aso <Tsukasa Aso>, 28 Jul, 2014 Re: Clarify the results from Flat Surface Current scorer please. (Aliya Mukanova)  Hi, The numbers given in /score/mesh/boxSize 0.5 0.5 0.1 cm specifies its half length of scoring volume. Therefore, "0.5 0.5" means 1.0 x 1.0 cm2 x-y plane. Best regards, T.Aso  problem with command base scorer by Jelena Ilic <Jelena Ilic>, 17 Jul, 2014  Hi, I'm working on a geometry consisting of a metal block filled with quartz straws containing a liquid scintillator. I wanted to use the command base scorer to look at the deposited energy but I'm getting an error message when running the code: /----------------------------- -------- EEEE ------- G4Exception-START -------- EEEE ------- *** G4Exception : OpBoun01 issued by : G4OpBoundaryProcess::PostStepDoIt G4OpBoundaryProcess/PostStepDoIt(): The Navigator reports that it returned an invalid normal Invalid Surface Normal - Geometry must return valid surface normal *** Event Must Be Aborted *** -------- EEEE -------- G4Exception-END --------- EEEE ------- /---------------------- The code runs without problem if I do not invoke G4ScoringManager (please see attached file). My StackingAction class is rudimentary - I just count number of produced optical photons. What could be a problem here? Thanks, Jelena Attachment: http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2014/07/17/13.02-28871-Slide1.gif  Question About Scoring Energy Deposition by A. Hod <A. Hod>, 09 Jul, 2014  Dear all, I would like to know whether the scoring mesh works only in one direction or more than one direction of the incoming particles. Let me detail this issue. I have two layers: Layer 1: A sensitive layer. It is pixelated using scoring mesh and the energy deposition of the incident electrons is calculated in each pixel. Now, If I have another layer2 (layer1 is now on the top of layer 2 ), the backscattered electron from this layer will interact in the layer 1 and thus the energy deposition in each pixel of the layer1 should be increased. Backscattered electrons from layer2 have now a direction opposite to the direction of the incident electrons. If you need further information, feel free to contact me. Best Regards A.H. Queation About Scoring Energy Deposition by A. Hod <A. Hod>, 09 Jul, 2014  Dear all, I would like to know whether the scoring mesh works only in one direction or more than one direction of the incoming particles. Let me detail this issue. I have two layers: Layer 1: A sensitive layer. It is pixilated using scoring mesh and the energy deposition of the incident electrons is calculated in each pixel. Now, If I have another layer2 (layer1 is now on the top of layer 2 ), the backscattered electron from this layer will interact in the layer 1 and thus the energy deposition in each pixel of the layer1 should be increased. Backscattered electrons from layer2 have now a direction opposite to the direction of the incident electrons. If you need further information, feel free to contact me. Best Regards A.H. Re: Queation About Scoring Energy Deposition by Tsukasa Aso <Tsukasa Aso>, 09 Jul, 2014 Re: Queation About Scoring Energy Deposition (A. Hod)  Hi, Only several primitive scorers such as SurfaceCurrent and Flux have an option for the track direction. The other scorers such as the energy deposit scorer do not take into account the track direction. Therefore, the deposited energy is scored in the volume where the track is positioned. Best regards, T.A  Re: Queation About Scoring Energy Deposition by A. Hod <A. Hod>, 10 Jul, 2014 Re: Re: Queation About Scoring Energy Deposition (Tsukasa Aso)  Hi T.A. Thank you very much for this information. Cheers A.H. Voxelized geometry and geometry importance sampling by <geant4president>, 09 Jul, 2014  Hi there, I am working with the DICOM example and would like to implement geometry importance sampling. Is that actually possible for voxelized geometries? What is the best approach - defining the IStore for the mass geometry or add a parallel geometry reflecting the voxels? How would one add a voxel to the importance store? Thanks in advance, Markus B3 Problem with SurfaceCurrent Primitive Scoring by Daniel Shy <Daniel Shy>, 30 Jun, 2014  Hello all, I am attempting to model a PMT and count the number of optical photons hit the PMT window. I therefore use the primitive scorer "G4PSCylinderSurfaceCurrent", however when I run, I get 0 hits even though there is an EnergyDeposited. I attempted to test it on example B3 by changing the EnergyDeposit to the SurfaceCurrent,added the .hh class, but still get 0 hits.  G4MultiFunctionalDetector* patient = new G4MultiFunctionalDetector("patient"); G4VPrimitiveScorer* primitiv2 = new G4PSCylinderSurfaceCurrent("dose", 0 , 0); patient->RegisterPrimitive(primitiv2); SetSensitiveDetector("PatientLV",patient); Any assistance in this would be greatful. Daniel Re: B3 Problem with SurfaceCurrent Primitive Scoring by Tsukasa Aso <Tsukasa Aso>, 30 Jun, 2014 Re: B3 Problem with SurfaceCurrent Primitive Scoring (Daniel Shy)  Hi, G4PSCylinderSurfaceCurrent counts the number of tracks at the side surface of the cylinder. e.g. position == radius of the cylinder && position is inside the cylinder length. I just wondered if you might assume that it scores at the disk surface. Best regards, T.Aso  Re: B3 Problem with SurfaceCurrent Primitive Scoring by Daniel Shy <Daniel Shy>, 01 Jul, 2014 Re: Re: B3 Problem with SurfaceCurrent Primitive Scoring (Tsukasa Aso)  Thanks for the quick response T. You are right, I did assume that the the Current is scored on the disk surface. I guess I would make a thin Box on the PMT window and use FlatSurfaceCurrent. Thanks Again, Daniel. Problem with Importance biasing by Ran Itay <Ran Itay>, 30 Jun, 2014  Hi all I've tried to implement importance biasing in my code I added this lines to my main file // pointers for importance store, weight-window store // and weight-window algorithm // G4VIStore *aIstore = 0; // create sampler for biasing and scoring in the mass geometry // G4GeometrySampler mgs(detCon->GetWorldVolume(),"geantino"); mgs.SetParallel(false); // prepare for importance sampling // aIstore = detCon->CreateImportanceStore(); mgs.PrepareImportanceSampling(aIstore, 0); mgs.Configure(); and to my detectorConstruction I added a function that does G4IStore *istore = new G4IStore(*pWorldVolume); istore->AddImportanceGeometryCell(imp,*PhysicalVolume,n++); // for each physical volume. Although it compiles finally, It gives me an exception first time it has to cross a border between 2 volumes. Anyone knows where am I wrong????? Tnx Ran Generic Biasing for dedicated physics processes by Stefan E. Mueller <Stefan E. Mueller>, 05 Jun, 2014  Dear all, I would like to use the new generic biasing, but unlike example GB01, I would like to bias only some processes for particles, e.g. only "GammaToMuPair" for particle "gamma". To do this, in my main I use the following code:  G4GenericBiasingPhysics* biasingPhysics = new G4GenericBiasingPhysics(); std::vector vBiasProcGamma; vBiasProcGamma.push_back("GammaToMuPair"); biasingPhysics->Bias("gamma",vBiasProcGamma); physics->RegisterPhysics( biasingPhysics ); However, when I run my executable, I get in the output for /process/list: biasWrapper(0) biasWrapper(compt), biasWrapper(phot), biasWrapper(conv), biasWrapper(Rayl) biasWrapper(photonNuclear),biasWrapper(GammaToMuPair) So it seems that all processes for photons are wrapped, not only "GammaToMuPair". I get the same output for /process/list if I do simply  biasingPhysics->Bias("gamma"); so it sems to me at this stage, the second argument is ignored somehow!? Is that to be expected? Stefan Re: Generic Biasing for dedicated physics processes by Marc Verderi <Marc Verderi>, 16 Jun, 2014 Re: Generic Biasing for dedicated physics processes (Stefan E. Mueller)  Hi Stefan, Indeed, this a bug. Thank you for reporting this. Things are aimed at working as you expected. Regards, Marc Error in Accumulating Square of Hits to a G4THitsMap for Precision Calculation by Matthew Lund <Matthew Lund>, 30 May, 2014  I've been using example RE02 as an example of recording hits using 16 different detectors with several primitive scorers. I accumulate hits fine in the hits map; however, I also want to create a G4THitsMap with all the detectors and scorers with the square of each hit so that I can calculate error. I have tried many different ways of recording the data, but I can't figure out how to correctly reference it. Below is the code and the error message, any ideas of how to correctly reference it? Thanks! void Run::RecordEvent(const G4Event* aEvent) { numberOfEvent++; // This is an original line. //============================= // HitsCollection of This Event //============================ G4HCofThisEvent* HCE = aEvent->GetHCofThisEvent(); if (!HCE) return; //======================================================= // Sum up HitsMap of this Event into HitsMap of this RUN //======================================================= G4int nCol = fCollID.size(); for ( G4int i = 0; i < nCol ; i++ ){ // Loop over HitsCollection G4THitsMap* evtMap=0; if ( fCollID[i] >= 0 ){ // Collection is attached to HCE evtMap = (G4THitsMap*)(HCE->GetHC(fCollID[i])); }else{ G4cout <<" Error evtMap Not Found "<< i << G4endl; } if ( evtMap ) { //=== Sum up HitsMap of this event to HitsMap of RUN.=== *fRunMap[i] += *evtMap; //====================================================== // Sum Up Hits Squared for error calculations //======================================================= std::map::iterator itr = evtMap->GetMap()->begin(); for(; itr != evtMap->GetMap()->end(); itr++) { G4int key = (itr->first); fRunMap_Square[key]+=[key](*(itr->second))*(*(itr->second)); } }} Compilation Error: error: invalid operands to binary expression ('value_type' (aka 'G4THitsMap *') and 'double') fRunMap_Square[key]+=(*(itr->second))*(*(itr->second)); ~~~~~~~~~~~~~~~~~~~^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Re: Error in Accumulating Square of Hits to a G4THitsMap for Precision Calculation by Tsukasa Aso <Tsukasa Aso>, 31 May, 2014 Re: Error in Accumulating Square of Hits to a G4THitsMap for Precision Calculation (Matthew Lund)  Hi, The line: fRunMap_Square[key]+=(*(itr->second))*(*(itr->second)); The type in left side is THitsMap, while the type of right side is double. Therefore it means a type mismatch. The right way will be: G4double vsquare = (*(itr->second)) * (*(itr->second)); theRunMap_Square[key]->add(itr->first,vsquare); p.s. A few years before, I created own Run class for this kind of purpose. I attached those files. It takes the EvMap of command line scorer and calculate RMS per event. I am not sure my code works in current geant4 version, but inside of the code may be good for your reference. Best regards, Tsukasa Aso Attachment: http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2014/05/31/03.35-4231-SB03Run.hh http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2014/05/31/03.35-9409-SB03RunAction.hh http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2014/05/31/03.35-32760-SB03RunActionMessenger.hh http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2014/05/31/03.35-41956-SB03Run.cc http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2014/05/31/03.35-76272-SB03RunAction.cc http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2014/05/31/03.35-52451-SB03RunActionMessenger.cc  Statistical error with scoring by <Sarah>, 27 May, 2014  Hello, I was wondering if it is possible to output the statistical error associated with scoring quantities like the energy deposited or the dose? Many thanks Re: Statistical error with scoring by Matthew Lund <Matthew Lund>, 30 May, 2014 Re: Statistical error with scoring  You will have to create code to calculate the error, see http://hypernews.slac.stanford.edu/HyperNews/geant4/get/biasing_scoring/101/2.html and also look at the manual for MCNP chapter 2.VI for details on calculating precision and error in Monte Carlo codes. Particle Source Biasing by Ran Itay <Ran Itay>, 15 May, 2014  Hi all Please I need your help I have an isotropic source and Im actually interested in events that are emitted to a certain solid angle much more then other. I know there is a way to bias the angular distribution of the emitted particles (and compensate someway), but I just cant find how to add it to my code. Take into account that I'm almost not using predefind class and have implemented by myself all Tnx Ran Re: Particle Source Biasing by Daren Sawkey <Daren Sawkey>, 21 May, 2014 Re: Particle Source Biasing (Ran Itay)  You can choose the angle randomly. If it is not within the interesting angle, discard the particle with probability p. If you don't want to bias the result, then multiply the weights of surviving particles (not in the interesting solid angle) by 1/(1-p). To "shoot" the particle: In your  MyUserPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent) calculate particle properties, create a vertex, assign properties, and add it to the event. Here's some of it (reply if you need more):  G4ThreeVector particle_position(x,y,z);  G4ParticleTable* particle_table = G4ParticleTable::GetParticleTable(); G4ParticleDefinition* particle_def = particle_table->FindParticle(type); G4double particle_time = 0.0;  G4PrimaryVertex* vertex = new G4PrimaryVertex(particle_position,particle_time);  G4PrimaryParticle* particle = new G4PrimaryParticle(particle_def,u,v,w); particle->SetWeight(weight); vertex->SetPrimary(particle); anEvent->AddPrimaryVertex(vertex); (Better would be to use G4ParticleGun, but I'm not aware of a way to set the weight using G4ParticleGun.) Scoring particles inside a sensitive volumen by Balder <Balder>, 13 May, 2014  Dear Geant4 experts, I have created a sensitive volume in order to score the particles that interact with it. G4bool CheckVolumeSD::ProcessHits(G4Step* aStep, G4TouchableHistory*) { const G4Track* track = aStep->GetTrack(); G4double e = track->GetKineticEnergy();  if (track->GetDefinition() == G4Gamma::Gamma()) { G4cout << "CheckVolumeSD: gamma final energy = " << e/MeV << G4endl;  }  if (track->GetDefinition() == G4Electron::Electron()) { G4cout << "CheckVolumeSD: e- final energy = " << e/MeV << G4endl; } return true; }  Besides, to get all the picture, I need to score the particles -type and energy, that go through my sensitive volume without interact. Please, Could you advise me about it? Best regards, Arturo.  Re: Scoring particles inside a sensitive volumen by Tsukasa Aso <Tsukasa Aso>, 15 May, 2014 Re: Scoring particles inside a sensitive volumen (Balder)  Hi, Three steps will be needed. 1) Checking the track really passed the scoring volume. The example code is in the source/digits_hits/scorer/src/G4PSPassageCellCurrent.cc in G4 source code. The G4PSPassageCellCurrent::IsPassed() is the method to check a passage of track. The code is rather complicated. We have to continuously check the trackID from entering to exiting of the track through the scoring volume, because the step might be limited several times inside the scoring volume. 2) Checking the track has no interaction inside the scoring volume. This can be done, for example, by checking the energy deposit of the track. This can be obtained by G4double G4Step::GetTotalEnergyDeposit(). If the return value is greater than zero, we can think the interaction has occur. 3) Checking the particle type for all tracks The particle identification number (PID) can be used. This is an integer number. For example, PDG code is usually used in Geant4 to identify the particle. (http://pdg.lbl.gov/2007/reviews/montecarlorpp.pdf) For the object aStep of G4Step, G4int pid = aStep->GetTrack()->GetDefinition()->GetPDGEncoding(); Or you can get the particle name by const G4String& name = aStep->GetTrack()->GetDefinition()->GetParticleName(); Best regards, T.Aso  Geometry Biasing by Ran Itay <Ran Itay>, 13 May, 2014  Hi Im new at this forum, so I hope this is the right place to post. I have a detector which is shielded by many stuff, and I would like to simulate its response to an external source. I saw that there is a way to recorded each gamma that penetrates a specific volume and multiply it by 1000 for an example. (This will allow me to get higher statistic in the regime of interst) Is there a way to do this? Tnx Ran Re: Geometry Biasing by Daren Sawkey <Daren Sawkey>, 21 May, 2014 Re: Geometry Biasing (Ran Itay)  Hi, yes. Please see example extended/biasing/B01. Delay in scoring by <Sarah>, 09 May, 2014  Hi everyone, I have a box of water with a size 50 x 50 x 50 mm with a score mesh of an equal size. Using visualisation I have verified that the mesh is in the correct place and that it covers the region of my volume, however when I look at the projection to see if the scoring has taken place, it doesn't start till halfway through the box. I was wondering if anyone has an idea why this might be happening? Thanks Sarah Re: Delay in scoring by Tsukasa Aso <Tsukasa Aso>, 11 May, 2014 Re: Delay in scoring  Hi, What position are you using in the projection? For example, a command-line scorer uses the index number of the cell. If you could upload the figures, it will be useful to understand your problem for me. Regards, T.Aso  how2 access to G4PSCylinderSurfaceFlux by Aliya Mukanova <Aliya Mukanova>, 29 Apr, 2014  Dear, experts, could you help me I need to get neutron flux on my tube, neutrons fall on tube only from lateral I have used G4PSCylinderSurfaceFlux as follows:  G4MultiFunctionalDetector* reflDet = new G4MultiFunctionalDetector("reflector"); G4SDParticleFilter* neutronFilter = new G4SDParticleFilter(filterName="neutronFilter",particleName="neutron");  G4VPrimitiveScorer* primitive = new G4PSCylinderSurfaceFlux("NeutSurfFlux",1.,0.); primitive-> SetFilter(neutronFilter); reflDet->RegisterPrimitive(primitive);  SetSensitiveDetector("BeRadLV",reflDet); Is it correct to write this way? How can I access to this class, there is no example which uses G4PSCylinderSurfaceFlux Looking forward your response, Aliya Mukanova (participant of Geant4 tutorial cource, Stanford, 2014) Re: how2 access to G4PSCylinderSurfaceFlux by Makoto Asai <Makoto Asai>, 29 Apr, 2014 Re: how2 access to G4PSCylinderSurfaceFlux (Aliya Mukanova)  Hi Aliya, I think the way you define the scorer is correct. Given it's a scorer, it creates a hits map to be associated with G4Event at the end of event. Please use geant4/examples/basic/B3 as a sample code to see how you get an access to a hits map. In particular, B3Run.cc is the class you should look at. Hope this helps, Makoto Re: how2 access to G4PSCylinderSurfaceFlux by Aliya Mukanova <Aliya Mukanova>, 29 Apr, 2014 Re: Re: how2 access to G4PSCylinderSurfaceFlux (Makoto Asai)  Hi, Makoto Thank you for answer I have written MyRun.cc that way  G4double nSf = 0.; G4THitsMap* nsfl = static_cast*>(HCE->GetHC(nSurfID)); for (itr = nsfl->GetMap()->begin(); itr != nsfl->GetMap()->end(); itr++) { nSf = *(itr->second); } nSurf += nSf; and then in Merge()  nSurf += localRun -> nSurf; Also I added GetNeutronSurfFlux in MyRun.hh  G4double GetNeutrSurfFlux() const { return nSurf; } and called it from MyRunAction.cc as follows  G4double neutSurf = run->GetNeutrSurfFlux(); However, it gives me Zero. This is my File.ouput: Primary Neutrons 1000; Neutron SurfFlux 0 /cm2; Tritons in Li 972; Alphas in Li 973; Triton Track Length in Li 117.183 um. Besides as you can see in results I have implemented this way with others scorers and they calculate well. Could you point at the possible causes why it happens Thanks Best regards, Aliya Re: how2 access to G4PSCylinderSurfaceFlux by Makoto Asai <Makoto Asai>, 01 May, 2014 Re: Re: how2 access to G4PSCylinderSurfaceFlux (Aliya Mukanova)  Hi Aliya, Could you please set /tracking/verbose 1 and try some events to see neutrons are really getting through the volume where you define the surface scorer? Makoto Re: how2 access to G4PSCylinderSurfaceFlux by Aliya Mukanova <Aliya Mukanova>, 05 May, 2014 Re: Re: how2 access to G4PSCylinderSurfaceFlux (Makoto Asai)  Hi, Makoto I have attached my log file. Could you look at it  Attachment: http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2014/05/05/00.09-22703-out.log  Re: how2 access to G4PSCylinderSurfaceFlux by Aliya Mukanova <Aliya Mukanova>, 12 May, 2014 Re: Re: how2 access to G4PSCylinderSurfaceFlux (Aliya Mukanova)  Dear, experts Could you help me with some error in my prigram using G4PSCylinderSurfaceFlux. I can't get the calculated flux at the end. Logfile I have attached in the previous message. What should I do? May be you have own examples which can help me to find errors in my program. I am waiting forward your response, Best regard, Aliya Mukanova Set world as scorer by <Sarah>, 25 Apr, 2014  Hi everyone, Random question, but I was wondering if I were to set my world volume as a scorer would that then classify any daughter volumes as scorers too seeing as they are within the mother volume. thank you for any help you can offer! Sarah Re: Set world as scorer by Tsukasa Aso <Tsukasa Aso>, 11 May, 2014 Re: Set world as scorer  Hi, The sensitive detector works only for attached logical volumes. If you want to attach the same sensitive detector to all of daughter logical volumes, you have to attach your SD to those logical volumes by yourself. There are methods for accessing daughter logical volumes in G4VPhysicalVolume and G4LogicalVolume classes. It will be better to hear about the detail from professionals of geometry category. Best regards, T. Aso  how to enable "implicit capture" by Lu, Wei <Lu, Wei>, 24 Apr, 2014  In the manual it says "Weight roulette (also called weight cutoff) is usually applied if importance sampling and implicit capture are used together...". But it mentions nothing about how to enable or perform an "implicit capture". Does it mean that it is enabled as far as I set up the importance sampling? Thanks. Wei question about how to score dose by using a mesh by Balder <Balder>, 17 Apr, 2014  I have read the guide for developers and some info about mesh on the web but I am not sure how the mesh works. The advise from the Geant4 experts will be very helpful to me. I have launched gamma rays inside a water tank and there is a foil inside the tank. I have created a mesh in order to get the dose deposited in the foil. If the mesh overlap the foil, then Will the mesh calculate the dose absorbed by the foil? If so, that imply that the mesh has to know the density of the foil in order to calculate the dose inside the foil and I do not know how the mesh will get that info. Many thanks in advance. Scoring Scatter fractions and Fluence by William Donahue <William Donahue>, 15 Apr, 2014  Hi Everyone, I am new to the simulation process and am looking for input of experts in it to make efficient and logical code. I apologize for the long winded intro but wanted to provide all the background for my questions. I am looking at the shielding of polarized low energy photons. I have a simple geometry where a source of these photons in incident on a box made of my shielding material. I have set up a spherical shell to retrieve the scatter information off of the box's surface. I need to score the energy spectrum of each layer in the wall counting only the first time a particle passes through a layer (ignoring backscatter). I also need to use the spherical shell to measure the energy spectrum and fluence. For accuracy I need to have very thin slices in the box to produce accurate fluence curves. On the sphere I need 5x5 degree solid angles. I have yet to implement this but my current approach would seem to involve having an array of energy region vs depth for my box. This table would then count the number of photons in each region and then add it to the proper row. I would also need to tag the particles with the copy number of the last layer of the box material they passed through. I would then only add the item for the table if the new layer has a larger copy number. This would limit me to only counting the photon if it is the first time it passes through a layer. I expect to use the step information to determine its location in my box but need to know its previous maximum depth. For the scatter fluence I am looking to make a field of 5x5 degree solid angles. I forsee needing a table of energy versus theta angle for each phi angle. So in my hemisphere I would need something like 36 tables. This just does not seem right or logical but it my best current thought process. Now for my questions: 1. Is it possible to add a field to my photon tracks that tracks their progression through my box's layers? 2. Can I use arrays in a thread-safe fashion to allow Geant to run in MT mode? 3. Are there any examples out there where this is done? I have read through the general documentation on the examples but, as it appears when reading through the forum, some of the ideal cases are hidden where you least expect them. 4. Would the surface Flux scorer work? I feel like it would count any particles that backscattered and pass back through a plane in the forward direction. Of course all of these question assume I have the proper thought process and i am not missing useful built in tools for this kind of scoring. Thanks for your help, Will Not continue results in scoring mesh by Yuefeng Qiu <Yuefeng Qiu>, 03 Apr, 2014  Hello! I try to run the example case /extended/runAndEvent/RE03 with neutron. The cell flux score I obtain is quite strange at mid-plane of Y(or Z) cut. In the picture we can find that the values are not continued at the center position. I've attached my macro file. Can any body help me to have a look?  Attachment: http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2014/04/03/05.14-606-run1.mac http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2014/04/03/05.14-26491-CellFlux_box.png  Re: Not continue results in scoring mesh by lcl <lcl>, 04 Apr, 2014 Re: Not continue results in scoring mesh (Yuefeng Qiu)  Hello Yuefeng Qiu In example RE03, your neutrons start point is 0. 0. -1.01*m, and shot along z axes. neutron in water almost do not change its direction, not like gamma. so scoring mesh can't know actualy which box does neutron belong because it goes through along the common edge of four boxes. You can change the start point with 0.01*m 0.01*m -1.01*m, and the result with be good. By the way, i think it is better to have a filter in mac file. Re: Not continue results in scoring mesh by Yuefeng Qiu <Yuefeng Qiu>, 04 Apr, 2014 Re: Re: Not continue results in scoring mesh (lcl)  You are perfectly right! I do samething and the results are perfectly matched now! Thanks a bunch! and wishes you a nice weekend! Best regards, Yuefeng Re: Not continue results in scoring mesh by Yuefeng Qiu <Yuefeng Qiu>, 04 Apr, 2014 Re: Not continue results in scoring mesh (Yuefeng Qiu)  I think there are something wrong (a bug?) in this functionality. I do a comparison by making another "parallel world" with the same amount of box using the same size, and put them into the same run to get the cell flux scoring. The result differences is very small in most of the cells, except the cells along the particle gun direction. I attached the figure of the differences. The value with Blue are below 1e-5, which are almost the same value. The highest differences at the center line, oppositely, has differences 100%~200% in some cells.  Attachment: http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2014/04/04/06.30-17433-_UMesh_comparison_4e5.png  Shark fin in Compton spectrum by Kyle Schmitt <Kyle Schmitt>, 02 Apr, 2014  Hello, I am having trouble with strange features in energy spectra from a germanium detector. I am using a 60 keV gamma source 30cm from the window of a germanium detector with a thin dead layer (varies from 0 to 1000 um). I see a strange fin-shaped hump at around 1/6 of the primary particle energy. Also, the area between 50 and 60 keV is populated. I do not think these two features are physical. It is likely that I am doing something silly, but I do not know what. I am recording the energy using the GetTotalEnergyDeposit and GetNonIonizingEnergyDeposit methods in my stepping action and passing that information to my event action, where the histogram is populated. I will attempt to attach spectra. If I remove the dead layer so that the only material in the envelope is G4_Galactic and the active volume (G4_Ge), I get the latter spectrum. Many thanks, Kyle  Attachment: http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2014/04/02/13.28-56737-Spectrum58.gif http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2014/04/02/13.28-90297-Spectrum59.gif  Command Based Scoring Returning Arbitrary Current by Maxwell Dierken <Maxwell Dierken>, 01 Apr, 2014  Hello Geant4 Users, I am attempting to modify the exGPS example in /extended/eventgenerator to measure the current of gamma rays through a mesh using command based scoring. I am able to write measurements to a CSV file, but the measurements being returned should vary inversely with the square of the mesh's distance from the source, which it does not. From building and launching the application, I enter the following commands: ////To set up the gps /gps/particle gamma /gps/position 0 0 0 m /gps/ang/type iso /gps/energy 661. MeV ////To score the current /score/create/boxMesh boxMesh1 /score/mesh/boxSize 0.02 0.02 0.002 m /score/mesh/nBin 1 1 1 /score/mesh/translate/xyz 0. 0. [arbitrary distance] m /score/quantity/nOfStep nOfStepGamma /score/quantity/flatSurfaceCurrent flatSurfaceCurrent 1 true false ////To write current to a file /score/dumpAllQuantitiesToFile boxMesh1 ScoreFILE /score/close The application writes numbers for flatSurfaceCurrent and nOfStepGamma to the file, but the numbers make no statistical sense. for example in 8 runs of 1000 gammas emitted each, I will get a dataset like 32 19 25 24 40 31 29 26. Additionally, no matter how I change the distance from the mesh to the source, there is no proportional change in the numbers measured. I am quite stumped here and any help at all would be greatly appreciated. Thank you in advance. Regards, M. Dierken LNK2019 error from sensitive detector by RY <RY>, 26 Mar, 2014  Hi, I am getting a strange error that I don't understand when building my application in VC++10: DetectorConstruction.obj : error LNK2019: unresolved external symbol "public: __thiscall He3SD::He3SD(class G4String)" (??0He3SD@@QAE@VG4String@@@Z) referenced in function "public: virtual class G4VPhysicalVolume * __thiscall DetectorConstruction::Construct(void)" (?Construct@DetectorConstruction@@UAEPAVG4VPhysicalVolume@@XZ) 2>C:\g4work\DDAA-build\Release\DDAA.exe : fatal error LNK1120: 1 unresolved externals I've attached the header and source files for my sensitive detector. It is implemented in DetectorConstruction.cc as follows: // Sensitive detector  He3SD* He3 = new He3SD("He3SD");  G4SDManager* SDman = G4SDManager::GetSDMpointer();  SDman->AddNewDetector(He3); logicHe3Layer->SetSensitiveDetector(He3); Any insight would be appreciated. Thanks.  Attachment: http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2014/03/26/10.58-94-He3SD.hh http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2014/03/26/10.58-46665-He3SD.cc http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2014/03/26/10.58-11742-He3Hit.cc http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2014/03/26/10.58-96689-He3Hit.hh  Re: LNK2019 error from sensitive detector by Tsukasa Aso <Tsukasa Aso>, 28 Mar, 2014 Re: LNK2019 error from sensitive detector (RY)  Hi Did you try to change the signature of He3SD constructor from He3SD(G4String name) to He3SD(const G4String& name) ? Regards, T.Aso  Why does my mesh-name show up as ProcName in output? by Stefan E. Mueller <Stefan E. Mueller>, 25 Mar, 2014  In my macro-file, I declare several meshes to score "doseDeposit": /score/create/boxMesh mesh_DA /score/mesh/boxSize 52.5 2.5 0.025 cm /score/mesh/nBin 210 1 1 /score/mesh/translate/xyz 0. 0. 578.445 cm /score/quantity/doseDeposit Dose_A /score/close /score/create/boxMesh mesh_DB /score/mesh/boxSize 52.5 2.5 0.025 cm /score/mesh/nBin 210 1 1 /score/mesh/translate/xyz 0. 0. 652.095 cm /score/quantity/doseDeposit Dose_B /score/close /score/create/boxMesh mesh_DC /score/mesh/boxSize 52.5 2.5 0.025 cm /score/mesh/nBin 210 1 1 /score/mesh/translate/xyz 0. 0. 725.755 cm /score/quantity/doseDeposit Dose_C /score/close To my astonishment, I find the name of the last mesh ("mesh_DC") as the name of the last process (the process after which a particle's track ends) for particles like heavy ions, muons, positrons (particles I'd expect to decay), e.g. ******************************************************************************** * G4Track Information: Particle = Cu64, Track ID = 29105, Parent ID = 29098 ******************************************************************************** Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName 0 -27.3 38.9 204 0.000491 0 0 0 DUMP18 initStep 1 -27.3 38.9 204 0 0.000491 1.1e-05 1.1e-05 DUMP18 ionIoni 2 -27.3 38.9 204 0 0 0 1.1e-05 DUMP18 mesh_DC The coordinates are nowhere I'd expect the mesh to be, nor do the other meshes' names ever appear in the outputfile. Is this the expected behavior of GEANT4.10? Did anybody else observe a similar phenomenon? Stefan  Re: Why does my mesh-name show up as ProcName in output? by Tsukasa Aso <Tsukasa Aso>, 28 Mar, 2014 Re: Why does my mesh-name show up as ProcName in output? (Stefan E. Mueller)  Hi, I am confusing about the matching between the commands and the output of tracking verbose you showed. You are defining thin scorers of dz=0.025 cm and place those at Z=578.445 cm, 652.095 cm, and 725.755 cm. However the output of tracking verbose shows Z = 204 mm where is not in those scoring volume. If I believe the output of tracking verbose, the ion might be almost at rest and did not move long distance. This is just my guess. Best regards, Tsukasa Aso  G4MultiFunctionalDetector assign to more than one logical volume by Yuefeng Qiu <Yuefeng Qiu>, 24 Mar, 2014  Hello everyone, I have a question on using G4MultiFunctionalDetector. In manual section 4.4.4 it said that the G4MultiFunctionalDetector can be assign to more than one G4LogicalVolumes. In my case, I have many G4LogicalVolumes (LV) being assigned to a G4MultiFunctionalDetector (for example 1000 LV which is different from each other). So the question is: How can I get results for each LV ? The manual says that G4VPrimitiveScorer can be registered in G4MultiFunctionalDetector, and G4VPrimitiveScorer has a G4THitsMap. G4THitsMap maps "copy number" of the LV to a double value. If all my LV has no other copy, does it mean that all the results for these 1000 LV will be summed up and assign to value with key=0? Is there any way to separate the results for each LV using the G4MultiFunctionalDetector? Thanks for any hints. Best regards, Yuefeng Re: G4MultiFunctionalDetector assign to more than one logical volume by Tsukasa Aso <Tsukasa Aso>, 24 Mar, 2014 Re: G4MultiFunctionalDetector assign to more than one logical volume (Yuefeng Qiu)   HI, > In my case, I have many G4LogicalVolumes (LV) being assigned to a > G4MultiFunctionalDetector (for example 1000 LV which is different from > each other). So the question is: How can I get results for each LV ? > > The manual says that G4VPrimitiveScorer can be registered in > G4MultiFunctionalDetector, and G4VPrimitiveScorer has a G4THitsMap. > G4THitsMap maps "copy number" of the LV to a double value. If all my LV > has no other copy, does it mean that all the results for these 1000 LV > will be summed up and assign to value with key=0? Yes, the result will be summed up and assigned to value with key=0. If you want to separate the value of each LV with key, you can give a copy number to your LV in the placement. Even if you actually has no copy, you can assign a copy number to each LV to distinguish each LV. The copy number will be referred from MultiFunctionalDetector and used as key number. Best regards, T. Aso  Re: G4MultiFunctionalDetector assign to more than one logical volume by Yuefeng Qiu <Yuefeng Qiu>, 24 Mar, 2014 Re: Re: G4MultiFunctionalDetector assign to more than one logical volume (Tsukasa Aso)  Perfect! That is want I need! Many thanks for you! Best regards, Yuefeng BremssstrahlungSplitting not working in Version 10.0 by <MJM>, 13 Mar, 2014  Hello, While trying to migrate our code from version 9.6-p2 to version 10.0-p1, our BremsstrahlungSplitting has stopped working. We have implemented BremsstrahlungSplitting using G4WrapperProcess - basically as described on the last 6 pages of your EvenBiasing-Tutorial (http://geant4.slac.stanford.edu/SLACTutorial14/EventBiasing.pdf) or shown in this example from another user: http://hypernews.slac.stanford.edu/HyperNews/geant4/get/emprocess/1169.html. However, while it works fine in version 9.6-p2, we get the following error in the 10.0-p1 version: ### === Deexcitation model UAtomDeexcitation is activated for 1 region: DefaultRegionForTheWorld ### === G4UAtomicDeexcitation::InitialiseForNewRun() ### === PIXE model for hadrons: Empirical 1 ### === PIXE model for e+-: Livermore 1   *** Break *** segmentation violation =========================================================== There was a crash. This is the entire stack trace of all threads: =========================================================== Thread 1 (process 6353): #0 0x00007fff842166ac in wait4 () #1 0x00007fff83db4002 in system () #2 0x000000010dd3af49 in TUnixSystem::StackTrace () #3 0x000000010dd38aa4 in TUnixSystem::DispatchSignals () #4 #5 0x000000010c5af903 in G4LossTableBuilder::BuildDEDXTable () #6 0x000000010c5b3fe7 in G4LossTableManager::BuildTables () #7 0x000000010c5b390b in G4LossTableManager::BuildPhysicsTable () #8 0x000000010c5c0b2f in G4VEnergyLossProcess::BuildPhysicsTable () #9 0x000000010c267f02 in G4VUserPhysicsList::BuildPhysicsTable () #10 0x000000010c2672a4 in G4VUserPhysicsList::BuildPhysicsTable () #11 0x000000010c254141 in G4RunManagerKernel::BuildPhysicsTables () #12 0x000000010c253f79 in G4RunManagerKernel::RunInitialization () #13 0x000000010c247f94 in G4RunManager::RunInitialization () #14 0x000000010c247d37 in G4RunManager::BeamOn () #15 0x000000010c25cb2b in G4RunMessenger::SetNewValue () #16 0x000000010db060a7 in G4UIcommand::DoIt () #17 0x000000010db1cfdd in G4UImanager::ApplyCommand () #18 0x000000010dafecad in G4UIbatch::ExecCommand () #19 0x000000010dafeeb8 in G4UIbatch::SessionStart () #20 0x000000010db1a5d9 in G4UImanager::ExecuteMacroFile () #21 0x000000010db165fe in G4UIcontrolMessenger::SetNewValue () #22 0x000000010db060a7 in G4UIcommand::DoIt () #23 0x000000010db1cfdd in G4UImanager::ApplyCommand () #24 0x000000010bacbe6c in main ()  =========================================================== The lines below might hint at the cause of the crash. If they do not help you then please submit a bug report at http://root.cern.ch/bugs. Please post the ENTIRE stack trace from above as an attachment in addition to anything else that might help us fixing this issue. =========================================================== #5 0x000000010c5af903 in G4LossTableBuilder::BuildDEDXTable () #6 0x000000010c5b3fe7 in G4LossTableManager::BuildTables () #7 0x000000010c5b390b in G4LossTableManager::BuildPhysicsTable () #8 0x000000010c5c0b2f in G4VEnergyLossProcess::BuildPhysicsTable () #9 0x000000010c267f02 in G4VUserPhysicsList::BuildPhysicsTable () #10 0x000000010c2672a4 in G4VUserPhysicsList::BuildPhysicsTable () #11 0x000000010c254141 in G4RunManagerKernel::BuildPhysicsTables () #12 0x000000010c253f79 in G4RunManagerKernel::RunInitialization () #13 0x000000010c247f94 in G4RunManager::RunInitialization () #14 0x000000010c247d37 in G4RunManager::BeamOn () #15 0x000000010c25cb2b in G4RunMessenger::SetNewValue () #16 0x000000010db060a7 in G4UIcommand::DoIt () #17 0x000000010db1cfdd in G4UImanager::ApplyCommand () #18 0x000000010dafecad in G4UIbatch::ExecCommand () #19 0x000000010dafeeb8 in G4UIbatch::SessionStart () #20 0x000000010db1a5d9 in G4UImanager::ExecuteMacroFile () #21 0x000000010db165fe in G4UIcontrolMessenger::SetNewValue () #22 0x000000010db060a7 in G4UIcommand::DoIt () #23 0x000000010db1cfdd in G4UImanager::ApplyCommand () #24 0x000000010bacbe6c in main ()  =========================================================== Any help is greatly appreciated, Thank you, MJM Re: BremssstrahlungSplitting not working in Version 10.0 by <MJM>, 19 Mar, 2014 Re: BremssstrahlungSplitting not working in Version 10.0  Hi again! I probably will use the built-in biasing options to implement the simple bremsstrahlung splitting. However, it might be interesting to know why the G4WrapperClass-approach does not work anymore, in case one wants to do more advanced or uncommon physics biasing. Currently it does not even work while simply registering the bremsstrahlung process to it and processing it out without changing the way the physics should function. I've submitted a bug report here: http://bugzilla-geant4.kek.jp/show_bug.cgi?id=1594 . Attached to this bug report you will find a simple program allowing you to reproduce the problem on your own. Cheers, MJM Re: BremssstrahlungSplitting not working in Version 10.0 by Vladimir Ivanchenko <Vladimir Ivanchenko>, 19 Mar, 2014 Re: BremssstrahlungSplitting not working in Version 10.0  Hello, Some comments: 1) bremsstrahlung splitting does work if one uses EM built-in biasing options both in 9.6 and 10.0. To enable these option you need to use EN physics builders or reference Physics Lists and not to use WrapperProcess approach at all. 2) WrapperProcess is the more general approach addressing many biasing methods. This provides several different possibilities which are beyond EM built-in options. With version 10.0 this biasing framework was significantly extended but it is new and may indeed has problems. Concerning your problem I would expect that WrapperProcess is written by you for your application. I do not think that WrapperProcess is optimal for bremsstrahlung splitting - you will have less problems using reference Physics List and existing built-in command. Independently on what you decide further, please, send bug report to Geant4 bug report system, because this crash may happens in other circumstances for other users as well. The trace you have shown gives some hint but is not enough to understand the problem. We know for sure that bremsstrahlung is initialized normally for all other Geant4 tests/examples. So, without looking in all details of an application we cannot conclude. VI Re: BremssstrahlungSplitting not working in Version 10.0 by Daren Sawkey <Daren Sawkey>, 14 Mar, 2014 Re: BremssstrahlungSplitting not working in Version 10.0  It's not clear what is causing the crash. Are you able to build a debug version of Geant4? That will help to narrow it down. It's not clear (to me) from the stack trace that brem splitting is the culprit. Also, it is possible to use brem splitting through command line options, e.g. /process/em/setSecBiasing eBrem target 10 100 MeV Please see section 5.2.1.5 in the Application Developer's Manual Re: BremssstrahlungSplitting not working in Version 10.0 by <MJM>, 16 Mar, 2014 Re: Re: BremssstrahlungSplitting not working in Version 10.0 (Daren Sawkey)  Hi! First of all, thanks for your answer. We are quite sure that this error is caused by BremsstrahlungSplitting. Our PhysicsList looks like this: [...] aParticleIterator->reset(); while((*aParticleIterator)()) { G4ParticleDefinition* particle = aParticleIterator->value(); G4String particleName = particle->GetParticleName(); [...]  BremsstrahlungSplitting* wrapper = new BremsstrahlungSplitting; // G4WrapperClass adapted for BremsstrahlungSplitting G4ProcessManager* pmanager = particle->GetProcessManager(); // This G4ProcessManager instance is being used to implement the wrapped processes  //Bremsstrahlung G4eBremsstrahlung* eBrem = new G4eBremsstrahlung(); G4int prSubType = eBrem->GetProcessSubType(); G4ProcessType prType = eBrem->GetProcessType(); G4PenelopeBremsstrahlungModel* theBremPenelope = new G4PenelopeBremsstrahlungModel(); theBremPenelope->SetHighEnergyLimit(PenelopeHighEnergyLimit); eBrem->AddEmModel(0,theBremPenelope); if(bremsstrahlungSplittingFlag == true) { wrapper->SetProcessSubType(prSubType); wrapper->SetProcessType(prType); wrapper->SetNumberOfSplits(numberOfSplits); wrapper->RegisterProcess(eBrem); pmanager->AddProcess(wrapper); } else { ph->RegisterProcess(eBrem, particle); } [...] } If we set the bremsstrahlungSplittingFlag to true the program crashes with aforementioned error message in version 10.0, if we set it to false the code runs through as it is basically the copied G4EmPenelopePhysics - List. As mentioned, this code worked fine in version 9.6. Cheers, MJM Re: BremssstrahlungSplitting not working in Version 10.0 by Daren Sawkey <Daren Sawkey>, 18 Mar, 2014 Re: Re: BremssstrahlungSplitting not working in Version 10.0  Hi, when I've tried this in the past I've found that my equivalent of this class: > BremsstrahlungSplitting* wrapper = new BremsstrahlungSplitting; // G4WrapperClass adapted for BremsstrahlungSplitting (not part of the Geant4 distribution) needed to be modified to keep up to date with Geant4 versions. Further evidence of this is that you only see the crash on executing this statement, where every line uses that class. > if(bremsstrahlungSplittingFlag == true) > { > wrapper->SetProcessSubType(prSubType); > wrapper->SetProcessType(prType); > wrapper->SetNumberOfSplits(numberOfSplits); > wrapper->RegisterProcess(eBrem); > pmanager->AddProcess(wrapper); > }  It's been a while since I've used this method so can't comment on the state of the art. I would suggest again compiling a debug version of Geant4, which will let you (and us) know exactly which statements are causing the problem. Re: BremssstrahlungSplitting not working in Version 10.0 by <MJM>, 19 Mar, 2014 Re: Re: BremssstrahlungSplitting not working in Version 10.0 (Daren Sawkey)  Hi, Thanks again for your answer. We've compiled Geant4, version 10.0-patch1 as a debug version and were able to see that the error occurs in G4LossTableBuilder.cc at line 119. There, the second element of the std::vector list does not seem to be initialized correctly. We've started to trace back to the creation of this G4PhysicsTable* pointer and the problem seems to be caused by the G4PhysicsTable* theDEDXTable not being properly set in G4VEnergyLossProcess for the bremsstrahlung-process. Regarding the adaptation of the WrapperClass: I think, I agree, that the new Geant4 version requires a change in the WrapperClass. However, we've tried several different methods of registering it with the G4PhysicsListHelper or G4ProcessManager - all to the same result. Additionally, we've tried removing everything not essential from the WrapperClass, so that we would basically, just register the bremsstrahlung-process to it and then return it without the splitting or any other physics changed, but the error would still occur. Cheers, MJM Scoring e- without scoring backscattered by Wal <Wal>, 11 Mar, 2014  Hi everybody, I am scoring the number of particles through a cylindrical volume (shielding) to ensure that no beta particles pass through it. I am using G4PSPassageCellCurrent to check that out but unfortunately I've noticed that backscattered e- are taken into account. I've seen in the documentation that a second parameter can be added to G4PSPassageCellCurrent, which a depth. I though it could solve the problem by specifying the depth a particle as to cover but no. If I put depth to 1.*mm it does not change anything and if I put to to 1.*cm, nothing at all is scored (even with gamma that I used to check the correctness of the method). I am thus wondering, what does the "depth" parameter stand for ? And most important, if the parameter cannot help me that way, how can I count beta particles that goes through a volume without counting backscattered electron ? Big thanks in advance, Walid Re: Scoring e- without scoring backscattered by Wal <Wal>, 02 Apr, 2014 Re: Scoring e- without scoring backscattered (Wal)  Hi, Thank you very much for these information, it unstucks me ;) Walid Re: Scoring e- without scoring backscattered by Daren Sawkey <Daren Sawkey>, 11 Mar, 2014 Re: Scoring e- without scoring backscattered (Wal)   > I am thus wondering, what does the "depth" parameter stand for ? This refers to the hierarchy of touchables, not a length. > how can I > count beta particles that goes through a volume without counting > backscattered electron ?  You could use a G4PSFlatSurfaceCurrent at the back edge of the geometry. The geometry of the flat surface is one side of a G4Box, which is different from your cylinder. If you need a circular scorer you could modify G4PSCylinderSurfaceCurrent (which uses the inside surface of a cylinder) to use the end of the cylinder. Also note that$G4INSTALL/examples/extended/electromagnetic/TestEm5 is useful for transmission studies. A third approach would be to write a UserSteppingAction to check if the particle is on the back surface of the cylinder.
Samll pixel size ----->Simulation Stops  by A. Hod <A. Hod>,   27 Feb, 2014
 Dear Geant4 users, I am scoring the FlatsurfaceCurrent. It works well but when I decrease the size of the detector pixels (e.g. pixel size = 2 nm) and irradiate the pixelated detector with 20 million electrons the simulation stops after 100000 events. Does anybody know why? Does the small pixel size make problems? I highly appreciate your helps. Regards A.H.
Re: Samll pixel size ----->Simulation Stops  by roc <roc>,   17 Jul, 2017
Re: Samll pixel size ----->Simulation Stops (A. Hod)
 you should set G4steplimiter
How to scoring energy spectrum   by Mahdi <Mahdi>,   20 Feb, 2014
 Hi all, I am very new in Geant4, so , excuse me because of my question may be very simple! I have a cube in my simulation that has an alpha source in it. I want to have the energy spectrum of gamma rays after these alpha particle makes some interaction with atoms of materials in the cube. I want to define a small cylinder in the cube and have the energy spectrum of those gamma rays that transmitted within the cylinder.something like F8 tally in mcnp. How can I have such spectrum?
Re: How to scoring energy spectrum   by Mahdi <Mahdi>,   04 May, 2014
Re: How to scoring energy spectrum (Mahdi)
 Dear all; how can I modify RE03 example to have energy spectrum? I can see energy and dose deposited in the /score/quantity/ but how I can have the energy spectrum after all particles transport in run?
Re: How to scoring energy spectrum   by Mahdi <Mahdi>,   23 Feb, 2014
Re: How to scoring energy spectrum (Mahdi)
 Dear adam. thanks alot. I changed my linux distro and now I can use and see testem4 example. it seems to be good for me.but lets simulate a simpler configuration. I want to have a cube and an alpha source in it and have the spectrum of all gamma rays that created in the whole cube. how can I have this spectrum?
Re: How to scoring energy spectrum   by A. Hod <A. Hod>,   20 Feb, 2014
Re: How to scoring energy spectrum (Mahdi)
 Hi Mehid, have a look on /example/electromagnetic/TestEm4. I hope you get from it what you want. regadrs A.H.
Re: How to scoring energy spectrum   by Mahdi <Mahdi>,   20 Feb, 2014
Re: Re: How to scoring energy spectrum (A. Hod)
 Thanks again Adam, I am using geant4.9.6p2 and I think that my qt have bug and I cant run vis macro and cant see anything. however, the output is in root format. These are very bad news for a lazy man! in first example " extended_runAndEvent_RE03", can I have the output spectrum In a file or in root format? And Im not really shure that this output is the energy spectrum of all gamma rays transmitted from that cylinder? is it? in the last example I couldn't find what is the output meaning? 
Re: How to scoring energy spectrum   by A. Hod <A. Hod>,   20 Feb, 2014
Re: How to scoring energy spectrum (Mahdi)
 Hi, In this example you can find what you want: /examples/extended/runAndEvent/RE03. I hope it helps you. Kind regads A.H.
Re: How to scoring energy spectrum   by Mahdi <Mahdi>,   20 Feb, 2014
Re: Re: How to scoring energy spectrum (A. Hod)
 Dear Adam, Thank you for your answer. I saw the example you mentioned but what I want is more simple than run4 macro in that example. I don't want spatial distribution or any thing more! what I want is exactly a cylinder in world that gamma rays are transmitted from it and I want the energy spectrum of these rays and have this spectrum in a file not visual. Can I modify this example for what I want? 
Scoring  by A. Hod <A. Hod>,   12 Feb, 2014
 Hi everybody, I irradiate the detector with an electron beam and I would like to calculate the number of electrons stopped in each pixel of the detector. I did it using scoring : /score/quantity/cellCharge charge But now, I am interested in the calculation of the number of electrons reaching the surface of the detector (number of electrons /pixel). I tried with: /score/quantity/flatSurfaceCurrent current If I irradiate the detector with only 50000 electrons I obtained a huge number (millions) of electrons/surface. What should I use or take into account to calculate the number of electrons (per pixel) reaching the detector surface using scoring? I welcome your discussion Regards Adam
Re: Scoring  by Tsukasa Aso <Tsukasa Aso>,   13 Feb, 2014
Re: Scoring (A. Hod)
 Hi, The FlatSuface uses the -Z plane for the scoring. Please check that the -Z plane is located properly where you want to score. The counts may include secondary particles. So you will need to specify the particle species and the direction of the track. For example, ## To coincide with mass geometry surface /score/mesh/boxSize 100. 100. 1. cm /score/mesh/nBin 1 1 1 /score/mesh/translate/xyz 0. 0. -99 cm ## To score only selected particles and directions /score/quantity/flatSurfaceCurrent fscBoth 0 true false /score/filter/particle gammaFilter e- /score/quantity/flatSurfaceCurrent fscIn 1 true false /score/filter/particle gammaFilter e- /score/quantity/flatSurfaceCurrent fscOut 2 true false /score/filter/particle gammaFilter e- ## ## Arguments in flatSurfaceCurrent # 1. unique name # 2. Direction 0 for both, 1 for incoming track only, 2 for existing track only # 3. track weight flag ( true or false) # 4. Divide by area ( true or false) # 5. unit ( if "Divide by area is false then this is ignored. ) Best regards, T.Aso 
Re: Scoring  by Tsukasa Aso <Tsukasa Aso>,   15 Feb, 2014
Re: Re: Scoring (Tsukasa Aso)
 Hi, >/score/filter/particle gammaFilter e- and not /score/filter/particle eMinusFilter e- which one is correct ? Sorry, it is typo. "gammaFilter" and "eMinusFilter" are for the unique name of the filter. You can choose it in your mean. The last one is the name of particle you want to take. >1-Energy deposition scoring: >To score the energy deposition by electrons in each pixel. I did the following: > >/score/create/boxMesh boxMesh_1 >/score/mesh/boxSize 0.5 0.5 0.05 mm # size of the detector >/score/mesh/nBin 100 100 1 # number of pixels >/score/quantity/energyDeposit eDep >/score/filter/particle eMinusFilter e- >/score/close >/score/list >/run/beamOn 10000 ># drawing projections >/score/drawProjection boxMesh_1 eDep ># Dump scores to a file >######### Output file contains 4 coloumns: X, Y, Z and energy deposition in the corresponding pixel >############## >/score/dumpQuantityToFile boxMesh_1 eDep eDep.txt >Is it correct? I think so. >I would like also to know the difference between the energy depositions calculated by: > >Case1: >/score/quantity/energyDeposit eDep > >Case2: > >G4cout << " Energy deposit: " > << TotalEnergyDeposit/keV<<"keV" << G4endl; > >I compared the sum of energy deposited in the detector in both cases and there is a large difference >between them? I don’t know why? They should be the same! I do not know what "TotalEnergyDeposit" is defined in your code. >2-FlatSurfaceCurrent: > >Concerning the flatSurfaceCurrent (I would like to score only electrons reaching the input surface). I >performed it in the following way: > >/score/create/boxMesh boxMesh_1 >/score/mesh/boxSize 0.5 0.5 0.05 m >/score/mesh/nBin 100 100 1 > >/score/mesh/translate/xyz 0. 0. -0.5 mm (–Z plane for the scoring is taken into account) >/score/quantity/flatSurfaceCurrent fscIn 1 true false (only the number of the electrons at the input surface are calculated and the division by the area is ignored)). > >/score/filter/particle eMinusFilter e- >/score/close >/score/list >/run/beamOn 10000 >/score/drawProjection boxMesh_1 current >/score/dumpQuantityToFile boxMesh_1 fscIn fscIn.txt I checked the result of current with RE03 example. if I shot 100, the incoming current was 100. Best regards, T.Aso 
Question regarding event biasing  by <smharding>,   30 Jan, 2014
 I have a quick question in regards to setting up a bias towards a given spectrum. I posed this question previously on SPENVIS and was given a bit of information before being directed here, so let me recap a bit before I pose my questions: Given a spectrum, let's say: /gps/hist/point 0.1 1.16E+06 /gps/hist/point 0.2 4.78E+05 /gps/hist/point 0.3 2.70E+05 /gps/hist/point 0.4 1.65E+05 /gps/hist/point 0.5 1.09E+05 /gps/hist/point 0.7 5.98E+04 /gps/hist/point 1 3.07E+04 /gps/hist/point 2 3.08E+03 /gps/hist/point 3 5.88E+02 So on and so forth To bias it with regards to energy, we use a /gps/hist/type biase command. Now, here's where it gets a bit fuzzy. I was told on the SPENVIS forums to run something similar to: /gps/hist/type biase Followed by a spectrum, and again following it with two columns. The way I was told to calculate the columns, however, could not be explained as well as I would have preferred, but was was told to me was that following the biase command, I would list a spectrum that followed with two columns that looked something like this /gps/hist/point (calculated probability) (inverse of differential flux) So in a macro file it would look something like: /gps/ene/type blah /gps/hist/type blah /min blah /max blah /primary spectrum /gps/hist/type biase /bias spectrum (normalization factor, etc) And then whatever other options I wanted to include, assuming I am in fact supposed to use BOTH spectrum. My questions are: When calculating the probability given the formula (or technically, approximating the formula provided), a lot of values ended up towards 0.999***. All the way up to one. A few started around 0.2 or some such, but it shot up quickly given that formula. Now, in my mind, these numbers are creating a curve that implies probability, so a point with 0.999 is approximately twice as likely to occur as a point with 0.5 or so. Is this accurate, or am I way off? My second question is in regards to the second column. I don't understand why it was required that I used the inverse of the differential flux, and an answer to that could not be given. Does anyone on here understand what is necessary to use, or why I might use the inverse differential flux? And lastly, is there any literature explaining this better that someone could point me to? The Geant4 manual sparsely covers biasing, and what little it does include doesn't really answer my questions... Thanks so much for any assistance. I realize this is a large multi-part question, and I apologize. But I have so many questions about how to properly use the biasing tool in Geant4 and I cannot seem to find any satisfactory solutions online!
Re: Question regarding event biasing  by <smharding>,   30 Jan, 2014
Re: Question regarding event biasing
 An additional question/more information, as I've received more information from my employer: The spectrum we are using is static. It is a given environment and it cannot be changed, so I cannot simply change the weight value listed after the energy (MeV) values. Yet we still need to get more/better statistics. The maximum number of events isn't providing reasonable values because the lower energy particles don't get much of a chance to interact with our setup and the higher energy particles don't happen often enough. So I need to bias the spectrum towards the higher energy levels without actually touching the original spectrum the environment provides... Any ideas at all on how I might do this, or a workaround?
draw scoring without the command based scoring  by Cristian Bungau <Cristian Bungau>,   30 Jan, 2014
 Hi, I want to record the energy deposition in a certain volume of arbitrary shape and not outside of it. So the command based scoring will not work for me as the available shapes do not match my volume shape. Therefore I have to use the G4MultiFunctionalDetector method. But then my question is: can I draw (at the end of the run) the scoring energy deposition in the same way as it can be done in the command based scoring: /score/drawProjection .... ? Thank you, Cristian
Re: draw scoring without the command based scoring  by John Allison <John Allison>,   30 Jan, 2014
Re: draw scoring without the command based scoring (Cristian Bungau)
 Hi Cristian I don't think there is anything that can handle an arbitrary shape. I guess you will have to either: 1) implement you own hits and implement DrawHits (then use "/vis/scene/add/hits"), or 2) jump into the scoring code and implement a subclass of G4VScoringMesh and implement something like G4ScoringBox::Draw. Good luck.
Re: draw scoring without the command based scoring  by Cristian Bungau <Cristian Bungau>,   06 Feb, 2014
Re: Re: draw scoring without the command based scoring (John Allison)
 Hello John, Thank you very much for your reply. I chose to go via the DrawHits method and it worked. Many thanks, Cristian
Re: draw scoring without the command based scoring  by John Allison <John Allison>,   06 Feb, 2014
Re: Re: draw scoring without the command based scoring (Cristian Bungau)
 Great! Would love to see one of your drawings! :) John
Integration time of detector  by fatin hamimi mustafa <fatin hamimi mustafa>,   15 Jan, 2014
 Hi I am not sure I am posting in the right category. I would like to ask about the integration time, either it is provided in Geant4 or not. Thanks fatin
Primitive Scorer Output Error in MT 10.0  by Matthew Lund <Matthew Lund>,   29 Dec, 2013
 When running a scoring mesh in Geant4 10.0 as a multithread, dumping data to a file results in a csv file with repeats of numbers and no line breaks as shown below. However, when the exact same application is compiled to run on a Geant4 10.0 that is only a single thread, the csv files come out correctly. Any ideas? # mesh name: box # primitive scorer name: eDep # iX, iY, iZ, value [MeV] 0,0,0,0.8460794531511607 ... 1,7,3,0 1,7,4,0.3076904911 1,7,4,1 1,8,0,0.122794357 1,8,0,0. 1,8,1,0.1929819291,8,1,0.1,8,2,2.98386946261,8,2,1,8,3,1.886026472411,8,31,8,4,0.13818003400771,8,1,9,0,0.24805065272991,9,0,0.1414818536883083 1,9,1,0.1110863914426777 1,9,2,1.192699907930878 1,9,3,0.001328198764895205 1,9,4,0.00153431176840968
Re: Primitive Scorer Output Error in MT 10.0  by Akinori Kimura <Akinori Kimura>,   22 Feb, 2014
Re: Primitive Scorer Output Error in MT 10.0 (Matthew Lund)
 I tried to reproduce your situation by using examples/extended/runAndEvent/RE03/. However, it isn’t reproduced by it. It is run on the same configuration and Mac as yours almost all. Akinori Kimura 
Re: Primitive Scorer Output Error in MT 10.0  by Matthew Lund <Matthew Lund>,   14 Apr, 2014
Re: Re: Primitive Scorer Output Error in MT 10.0 (Akinori Kimura)
 The error occurs when running a scoring mesh, dumping results, and then running another run on top of the previous results. With just a single run of the scoring mesh there is no error.
Re: Primitive Scorer Output Error in MT 10.0  by lcl <lcl>,   02 Jan, 2014
Re: Primitive Scorer Output Error in MT 10.0 (Matthew Lund)
 I have met the same.
scoring the metastable states of an isotope produced by (n,g) reaction  by Eleni <Eleni>,   03 Dec, 2013
 Hello all, I am studying the neutron capture reaction in various materials and i want to score the ground and metastable states. For example in a Cd target I want to see the reaction Cd110(n,g)Cd111m. How can I do that? I am using the QSGP_BIC_HP library and when i am running G4 the produces isotopes are the ones in ground state Thank you in advance
Re: scoring the metastable states of an isotope produced by (n,g) reaction  by michel maire <michel maire>,   04 Dec, 2013
Re: scoring the metastable states of an isotope produced by (n,g) reaction (Eleni)
 On Wed, 04 Dec 2013 07:15:35 GMT, Eleni wrote: > Hello all, > > I am studying the neutron capture reaction in various materials and i > want to score the ground and metastable states. For example in a Cd > target I want to see the reaction Cd110(n,g)Cd111m. How can I do that? I > am using the QSGP_BIC_HP library and when i am running G4 the produces > isotopes are the ones in ground state > > Thank you in advance > Here is a run of Hadr03. In attachement macro, log file and gamma plot  Attachment: http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2013/12/04/07.00-19633-eleni.mac.txt http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2013/12/04/07.00-45907-eleni.log.txt http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2013/12/04/07.00-14644-ncapture.gif 
Re: scoring the metastable states of an isotope produced by (n,g) reaction   by John Apostolakis <John Apostolakis>,   04 Dec, 2013
Re: scoring the metastable states of an isotope produced by (n,g) reaction (Eleni)
 Dear Eleni, Are you using Geant 10.0 beta ? Else the isotopes are not available. I am not sure whether the reaction you are interested in is included in the neutron library in the beta release - that is whether the library has it and whether our code is able to do it. My colleague informs me that the Geant4 10.0 full release includes this type of reaction, so we expect that you should be able to see it. The release is planned for this Friday, 6th December. It will be very good if you can prepare a test code, to check the reaction in release 10.0. ( The testing code should be the same between releases. ) How are you scoring ? Have you tried to use the Geant4 sensitive detectors ? I suggest that you look at the relevant chapters in the Geant4 Users Guide for Application developers. If you write your own sensitive detector class (starting from an existing one) it is possible to examine the results of any reaction, but also the full details of any track in flight. A second way, which we recommend less but is useful if you are trying to score in all volumes in the same way: is to use a SteppingAction. It also has access to all information about the primary track and the current step (which includes the secondary.) Best regards, Giannis =================================================== John Apostolakis, PH Department, CERN SFT (SoFTware for Experiments) Group On Dec 4, 2013, at 8:15 AM, Eleni wrote: > > *** Discussion title: Biasing and Scoring > > Hello all, > > I am studying the neutron capture reaction in various materials and i want to score the ground and metastable states. For example in a Cd > target I want to see the reaction Cd110(n,g)Cd111m. How can I do that? I am using the QSGP_BIC_HP library and when i am running G4 the produces > isotopes are the ones in ground state > > Thank you in advance > > ------------------------------------------------------------- > Visit this GEANT4 at hypernews.slac.stanford.edu message (to reply or unsubscribe) at: > http://hypernews.slac.stanford.edu/HyperNews/geant4/get/biasing_scoring/103.html 
Unphysical energy deposition  by Agnieszka Priebe <Agnieszka Priebe>,   09 Oct, 2013
 Hello, I have simulated beam losses on a magnet aperture (beam energy 4 TeV, protons, impacting angle of 200 urad). My SD detector is on magnet coil with binning: rho=4, phi=90 and zet=300. The radial energy distribution (along the most exposed bin) showed that the energy in the last bin (3) is greater than the energy in the previous one (2) which seems to be non-physical. Therefore I have prepared a histogram with a number of entries being in a certain energy range (see attachment). It shows that the last bin scored high energy particles (the energy range almost the same as for bin 0 ). Do you have any idea what could be a reason of that? I would be very grateful for your help. Cheers, Agnieszka  Attachment: http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2013/10/09/11.29-94636-zP300_maxBin_spektrum.png http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2013/10/09/11.29-88797-0_maxBin_spektrum_int.png 
how to get the RMS error of cellFlux scoring by mesh_box?  by lcl <lcl>,   29 Sep, 2013
 hello, I want ot get the cellFlux distribution.Some thing like example RE03,make a box mesh of scoring. use the command libe based scoring. and i get the txt file(like csv file "nOfStepGamma.txt" in RE03). my question is how to get RMS error of cellFlux of each cell? is there some easy way to get this error?
Re: how to get the RMS error of cellFlux scoring by mesh_box?  by lcl <lcl>,   27 May, 2014
Re: how to get the RMS error of cellFlux scoring by mesh_box? (lcl)
 I have found how to calcule error for scoring mesh. x=1.96 void EventAction::EndOfEventAction(const G4Event* evt) { G4HCofThisEvent* HCE = evt->GetHCofThisEvent(); if(!HCE) return; G4SDManager* SDMan = G4SDManager::GetSDMpointer(); G4int colID = SDMan->GetCollectionID("boxMesh_1/trackLengthGamma"); G4THitsMap* evtMap = (G4THitsMap*)(HCE->GetHC(colID)); std::map::iterator itr = evtMap->GetMap()->begin(); for(; itr != evtMap->GetMap()->end(); itr++) { sum[itr->first] += *(itr->second); sum2[itr->first] += (*(itr->second))*(*(itr->second)); } }  void RunAction::EndOfRunAction(const G4Run* aRun) { G4int nofEvents = aRun->GetNumberOfEvent(); if (nofEvents == 0) return; G4double sqrt_n = std::sqrt(nofEvents); std::map Rsum = EventAction::Instance()->sum;// sum in RunAction std::map Rsum2 = EventAction::Instance()->sum2; std::map sigma,error; std::map::iterator itr = Rsum.begin(); std::ofstream ofile("error.txt"); if(!ofile) return; for(; itr != Rsum.end(); itr++) { G4int i = itr->first; sigma[i] = Rsum2[i]/nofEvents-(Rsum[i]/nofEvents)*(Rsum[i]/nofEvents); if (sigma[i] > 0.) sigma[i] = std::sqrt(sigma[i]);else sigma[i] = 0.; error[i] = 1.96*sigma[i]/sqrt_n; ofile << itr->first << " " << error[i]/Rsum[i]*nofEvents << G4endl; } ofile.close(); } 
Re: how to get the RMS error of cellFlux scoring by mesh_box?  by Jessica Garczarczyk <Jessica Garczarczyk>,   15 Nov, 2017
Re: Re: how to get the RMS error of cellFlux scoring by mesh_box? (lcl)
 Hello everybody, I am very interested in that topic and need some help in the implementation. I have pasted the parts of the code into my EventAction.cc and RunAction.cc, add some header-files and added the Instance() code until now. But there appears a "segmentation fault: 11" while running the simulation: is not found. It is part of the code in the EventAction.cc: G4int colID = SDMan->GetCollectionID("boxMesh_1/trackLengthGamma"); I had a look at all possibilities for command scoring and I have not found "trackLengthGamma" but "trackLength". So I changed that but the segmentation fault is still there. Can someone maybe explain, what should I change in the code and why do I need this kind of information? I would like to get the rms of my dose deposition. Thank you in advance, Jessica
Re: how to get the RMS error of cellFlux scoring by mesh_box?  by <Sarah>,   31 May, 2014
Re: Re: how to get the RMS error of cellFlux scoring by mesh_box? (lcl)
 Thank you very much for your reply. I was wondering how did you declare sum in the eventaction? Sorry I'm quite new to programming so I am a bit unsure about this. Many thanks
Re: how to get the RMS error of cellFlux scoring by mesh_box?  by lcl <lcl>,   31 May, 2014
Re: Re: how to get the RMS error of cellFlux scoring by mesh_box?
 in the head file of eventaction sum and sum2 are defined with type std::map.
Re: how to get the RMS error of cellFlux scoring by mesh_box?  by <Sarah>,   08 Jun, 2014
Re: Re: how to get the RMS error of cellFlux scoring by mesh_box? (lcl)
 Thank you very much for all your help! I have tried to run the code now with this, but I get a segmentation fault after it finishes running all of the events, I think it may be the way I have put in the part for the event action instance. If you could kindly have a look at what I did I would really appreciate it in the eventaction.cc i used EventAction* EventAction::fgInstance =0; EventAction* EventAction::Instance() { return fgInstance; } in the event action.hh I used  public: static EventAction* Instance(); private: static EventAction* fgInstance; was there a different way that I should have done this?
Re: how to get the RMS error of cellFlux scoring by mesh_box?  by <Sarah>,   08 Jun, 2014
Re: Re: how to get the RMS error of cellFlux scoring by mesh_box?
 sorry ignore this my browser decided to repost this now
Re: how to get the RMS error of cellFlux scoring by mesh_box?  by <Sarah>,   31 May, 2014
Re: Re: how to get the RMS error of cellFlux scoring by mesh_box? (lcl)
 Thank you very much for all your help! I have tried to run the code now with this, but I get a segmentation fault after it finishes running all of the events, I think it may be the way I have put in the part for the event action instance. If you could kindly have a look at what I did I would really appreciate it in the eventaction.cc i used EventAction* EventAction::fgInstance =0; EventAction* EventAction::Instance() { return fgInstance; } in the event action.hh I used  public: static EventAction* Instance(); private: static EventAction* fgInstance; was there a different way that I should have done this?
Re: how to get the RMS error of cellFlux scoring by mesh_box?  by <Sarah>,   02 Jun, 2014
Re: Re: how to get the RMS error of cellFlux scoring by mesh_box?
 Sorry I just realised I missed out a bit of code, this works perfectly now! Thank you so much for your help!
Re: how to get the RMS error of cellFlux scoring by mesh_box?  by Michael McManus <Michael McManus>,   06 Mar, 2018
Re: Re: how to get the RMS error of cellFlux scoring by mesh_box?
 Solved: In constructor EventAction::EventAction(RunAction* runAction) : { fgInstance = this; } 
Re: how to get the RMS error of cellFlux scoring by mesh_box?  by <Sarah>,   27 May, 2014
Re: how to get the RMS error of cellFlux scoring by mesh_box? (lcl)
 Hi, I was wondering if you found a way to get the RMS error?
How to find physical volumes from a text entered geometry  by sylvian kahane <sylvian kahane>,   26 Sep, 2013
 Hi all I have a simple geometry of 10 slabs of material, defined in an external file as a parametrization of a single logical volume: :VOLU "poly" BOX 10.*cm 10.*cm 0.5*cm G4_POLYETHYLENE :COLOR "poly" 0 1 1 1 :PLACE_PARAM "poly" 1 world LINEAR_Z R00 10 1*cm -4.5*cm  I would like to give increasing importances for each one of the 10 slabs, but to do this I need the physical volume pointer of each slab. How can I get these pointers ? Sylvian K
Re: How to find physical volumes from a text entered geometry  by Pedro Arce <Pedro Arce>,   28 Sep, 2013
Re: How to find physical volumes from a text entered geometry (sylvian kahane)
 You can make a loop to the store of physical volumes  G4PhysicalVolumeStore* pvs = G4PhysicalVolumeStore::GetInstance(); std::vector::iterator cite; for( cite = pvs->begin(); cite != pvs->end(); cite++ ) { G4VPhysicalVolume* pv = *cite;
Is it possible to invoke G4Scintillation process only for specific region ?  by Lafont Fabien <Lafont Fabien>,   29 Jul, 2013
 Hi everyone, My question is quite simple : As the scintillation process is a rather slow process in terms of time of computation, I would like to invoke it only for the real scintillating region. I think it is impossible to do this cause all process are invoked for each event to determine the step length but maybe there is a tricky idea which could help me. Thanks in advance.
scoring flux in a box divided in cells in x-y plane with event biasing  by Cristian Bungau <Cristian Bungau>,   07 Jul, 2013
 Hello, I am trying to score the incoming flux in a box, but have the box divided in x-y plane so I can get the X-Y distribution of incoming particles. So I have a box in my DetectorConstruction:  G4Box* TopDetectorSolid = new G4Box("TopDetector", 125.*cm, 150.*cm, 2.5*cm);  TopDetectorLog = new G4LogicalVolume(TopDetectorSolid, Air,"TopDetector");  TopDetectorPhys = new G4PVPlacement(0,G4ThreeVector(), TopDetectorLog,"TopDetector",logicWorld, false,0); And to get the flux distribution along the x-y plane (250cm * 300cm), I divide daughter volumes along x-y to which I'll assign different flux scorers:  G4Box* TopDetectorScorerSolid = new G4Box("TopDetectorScorer", (10./2.)*cm, (12./2.)*cm, 2.5*cm);  TopDetectorScorerLog = new G4LogicalVolume(TopDetectorScorerSolid, Air,"TopDetectorScorer");  for (int j = 0; j < 50; j++) { for (int i = 0; i < 50; i++) { TopDetectorScorerPhys = new G4PVPlacement(0,  G4ThreeVector((250.-(2.*i+1)/2.)*10.*cm,(300.-(2.*j+1)/2.)*12.*cm,0.), TopDetectorScorerLog,"TopDetectorScorer",TopDetectorLog, false, i+50*j // 2500 copies ); }} So I'll have 2500 scorers each attached to one of the copies above. //---------------------- Also I have to use geometry biasing so I am assigning importance to each volume. For the 2500 copies of the small volumes, I assign the importance like this:  for (int i=0; i<2500; i++) { istore->AddImportanceGeometryCell(std::pow(2., 7), *TopDetectorScorerPhys, i); } But during the run I get a G4Exception abort message, that one of the copies (replica 687 in this case) does not have an importance assigned to it and it is not in the list, and here it gives all the volumes with the replica numbers, including the one it complains about not being in the list. I would be very grateful for any help or suggestion, Thank you very much, Best regards, Cristian
Re: scoring flux in a box divided in cells in x-y plane with event biasing  by Tsukasa Aso <Tsukasa Aso>,   07 Jul, 2013
Re: scoring flux in a box divided in cells in x-y plane with event biasing (Cristian Bungau)
 Hi, First of all, you defined 250 cm x 300 cm plate and divide it in 10 cm x 12 cm pixel. Is it corresponding to 25 x 25 pixles??? Best regards, Tsukasa Aso 
Re: scoring flux in a box divided in cells in x-y plane with event biasing  by Cristian Bungau <Cristian Bungau>,   08 Jul, 2013
Re: Re: scoring flux in a box divided in cells in x-y plane with event biasing (Tsukasa Aso)
 Hello, Thank you very much for your reply. I was trying to simplify the numbers I have in my code just to illustrate the case and I did it wrong. Anyway here are the correct numbers:  G4RotationMatrix* rotDTop = new G4RotationMatrix(); rotDTop->rotateX(90.*deg); // Y<->Z  G4Box* TopDetectorSolid = new G4Box("TopDetector", 120.*cm, 185.*cm, 2.5*cm);  TopDetectorLog = new G4LogicalVolume(TopDetectorSolid, Air,"TopDetector");  fLogicalVolumeVector.push_back(TopDetectorLog);   TopDetectorPhys = new G4PVPlacement(rotDTop,G4ThreeVector(0.,(120.+2.501)*cm,0.), TopDetectorLog,"TopDetector",logicWorld, false,0);  fPhysicalVolumeVector.push_back(TopDetectorPhys);  G4Box* TopDetectorScorerSolid = new G4Box("TopDetectorScorer", (120./50.)*cm, (185./50.)*cm, 2.5*cm);  TopDetectorScorerLog = new G4LogicalVolume(TopDetectorScorerSolid, Air,"TopDetectorScorer");  fLogicalVolumeVector.push_back(TopDetectorScorerLog);   for (int j_coord = 0; j_coord < 50; j_coord++) { for (int i_coord = 0; i_coord < 50; i_coord++) {   TopDetectorScorerPhys = new G4PVPlacement(0,G4ThreeVector( -120.*cm + ((120./50.)*2.*(double(i_coord)+(1./2.)))*cm, -185.*cm + ((185./50.)*2.*(double(j_coord)+(1./2.)))*cm, 0.), TopDetectorScorerLog,"TopDetectorScorer",TopDetectorLog, false, i_coord+(50*j_coord) // 2500 copies );  }}  fPhysicalVolumeVector.push_back(TopDetectorScorerPhys); //*************************----------------- Now for the importance assignments I use:  istore->AddImportanceGeometryCell(std::pow(2., 7), *TopDetectorPhys);  for (int i=0; i<2500; i++) { istore->AddImportanceGeometryCell(std::pow(2., 7), *TopDetectorScorerPhys, i); } and during the run I get: G4Exception: GeomBias0002 issued by G4IStore::Error() GetImportance() - Region does not exist! Geometry cell, Volume name = TopDetectorScorer, Replica number = 1275, not found in: Volume name = World, Replica number = 0, importance = 128 Volume name = TopDetector, Replica number = 0, importance = 128 Volume name = TopDetectorScorer, Replica number = 0, importance = 128 Volume name = TopDetectorScorer, Replica number = 1, importance = 128 Volume name = TopDetectorScorer, Replica number = 2, importance = 128 Volume name = TopDetectorScorer, Replica number = 3, importance = 128 Volume name = TopDetectorScorer, Replica number = 4, importance = 128 Volume name = TopDetectorScorer, Replica number = 5, importance = 128 Volume name = TopDetectorScorer, Replica number = 6, importance = 128 Volume name = TopDetectorScorer, Replica number = 7, importance = 128 ....... Volume name = TopDetectorScorer, Replica number = 1275, importance = 128 Volume name = TopDetectorScorer, Replica number = 1276, importance = 128 ........ This is what I do not understand, as the volume it complains about is actually in the list. Best regards, Cristian
Re: scoring flux in a box divided in cells in x-y plane with event biasing  by Eleni <Eleni>,   01 Aug, 2013
Re: Re: scoring flux in a box divided in cells in x-y plane with event biasing (Cristian Bungau)
 Hello I am copying the same problem here ; G4Exception : GeomBias0002 issued by : G4IStore::Error() GetImportance() - Region does not exist! Geometry cell, Volume name = leafB, Replica number = 23, not found in: Volume name = expHall, Replica number = 0, importance = 1 Did you find the answer?
geometric biasing  by Eleni <Eleni>,   07 Jul, 2013
 Hello all, I am trying to use the geometric biasing with no success so far. Is there any example (simpler than B01)? Thank you
geometric biasing  by Eleni <Eleni>,   07 Jul, 2013
 Hello all, I am trying to use the geometric biasing with no success so far. Is there any example (simpler than B01)? Thank you
geometric biasing  by Eleni <Eleni>,   07 Jul, 2013
 Hello all, I am trying to use the geometric biasing with no success so far. Is there any example (simpler than B01)? Thank you
scoring volume setting  by riazi <riazi>,   01 Jul, 2013
 Dear Geant4 Experts Thank you a lot for your efforts in teaching Geant4 for others. I have a question about the mechanism of setting scoring volume to stepping action class from detector construction class (in Construct() function) for example in Example B1: ( // Set scoring volume to stepping action // (where we will account energy deposit) // B1SteppingAction* steppingAction = B1SteppingAction::Instance(); steppingAction->SetVolume(logicShape2); ) this is the only place in the example that the SetVolume function is called, this function sets the fVolume private variable of B1SteppingAction class. however the variable fVolume is intialized to zero in constructor of B1SteppingAction class and it dosn't change in the B1SteppingAction class elsewhere. Now how the fVolume variable is set to scoring volume to compare with volume of the current step? B1SteppingAction::B1SteppingAction(): G4UserSteppingAction(), fVolume(0), fEnergy(0.) { fgInstance = this; } void B1SteppingAction::UserSteppingAction(const G4Step* step) { // get volume of the current step G4LogicalVolume* volume = step->GetPreStepPoint()->GetTouchableHandle() ->GetVolume()->GetLogicalVolume(); // check if we are in scoring volume if (volume != fVolume ) return;  // collect energy and track length step by step G4double edep = step->GetTotalEnergyDeposit(); fEnergy += edep; } With Best Regards, Riazi
Re: scoring volume setting  by Tsukasa Aso <Tsukasa Aso>,   05 Jul, 2013
Re: scoring volume setting (riazi)
 Hi, >this is the only place in the example that the SetVolume function is called, this function sets the fVolume >private variable of B1SteppingAction class. however the variable fVolume is intialized to zero in >constructor of B1SteppingAction class and it dosn't change in the B1SteppingAction class elsewhere. Now >how the fVolume variable is set to scoring volume to compare with volume of the current step? I do not understand what you are asking. I guess that you are looking for the code where the fVolume is set. The B1SteppingAction::SetVolume() method is implemented in the header file, B1SteppingAction.hh // set methods void SetVolume(G4LogicalVolume* volume) { fVolume = volume; } It set the argument "volume" to "fVolume". Regards, Tsukasa Aso 
Re: scoring volume setting  by riazi <riazi>,   10 Jul, 2013
Re: Re: scoring volume setting (Tsukasa Aso)
 Hi Yes I know that the B1SteppingAction::SetVolume() method is implemented in the header file, B1SteppingAction.hh This function is called only in the detectorconstruction class and It set the argument "volume" to "fVolume". however the variable fVolume is set to zero in constructor of B1SteppingAction class. therefore I think its final value should be zero not the scoring volume. becuase I think that the detectorconstruction class is called before than SteppingAction class. With Best Regards
Re: scoring volume setting  by Tsukasa Aso <Tsukasa Aso>,   10 Jul, 2013
Re: Re: scoring volume setting (riazi)
 Hi, DetectorConstruction::Construct() is called at runManager->Initialize(); in the main program. Best regards, Tsukasa 
Re: scoring volume setting  by riazi <riazi>,   12 Jul, 2013
Re: Re: scoring volume setting (Tsukasa Aso)
 Hi Thank you a lot for your time and considration. Yes I know that the DetectorConstruction::Construct() is called at runManager->Initialize(); in the main program.  I think that the SteppingAction class is constructed after initialization of detector, therefore the variable fVolume is overriden by setting to zero in constructor of SteppingAction class. Best regards, Riazi
2-d and 3-d Dose Tallies  by David <David>,   24 Jun, 2013
 I am looking for recommendations for a geant example or a class for tallying dose in 2-d and 3-d. In the past, I used user action classes to get dose tallies in 1-d, but I think expanding to multi-d dose tallies will become to cumbersome within user actions. Is there an ideal way to do 2-d and 3-d tallies in geant? Thanks, David
help needed with variance reduction method - reposting  by Magda Constantin <Magda Constantin>,   22 May, 2013
 Dear G4 Colleagues, I've posted this message on the Electromagnetic Processes Forum, but I would also like to post the same question in this Forum. I am simulating dose deposited to a water phantom at 1 meter away from a 6MeV medical X-ray source. The beam is transmitted through ~4.5 tenth-value-layer slab (~156 mm of tungsten). The incident radiation intensity decreases by a factor of ~25e-06 after passing through the tungsten slab. Because of this drastic intensity attenuation, I have to simulate a very large (~in the billions) number of incoming 6 MeV electrons on the source target. When I calculate with Geant4 (v9.4.p02 ) the dose is ~10 times larger than the experimental measurement. I suspect that this disagreement is due to limited statistics on the scoring voxels. My intention is to use variance reduction techniques to increase the number of electrons on the X-ray target without increasing the simulation time too much. Could you please advise which variance reduction methods are the most suitable in my case? Is there a working example that I can look at? How about validation studies and/or publications? Are there any other strategies to help me lower the simulation time (i.e. range cuts, other Physics List, etc)? I have been using Opt3 with 10 um range cut for the particles. Thank you in advance for your advice. Magda
Get information about secondaries  by Mikhail <Mikhail>,   21 May, 2013
 Hi all, Can one tell me how can I get information about secondary particles? I have found an example with counting their amount ( http://hypernews.slac.stanford.edu/HyperNews/geant4/get/particles/317/1.html ), but nothing about how to get their type and other parameters. Although I can prit all information in terminal with setting tracking verbose to 3. The worst thing is that I can not find the proper description of the methods like GetCurrentStepNumber or GetProcessDefinedStep and others, they are too brief or absent at all. I apreciate if one can sugest me somethig about proper functions or examples of working with the secondaries.
Segmentation fault (core dumped)  by Kalachov Alex <Kalachov Alex>,   04 May, 2013
 Hello! I try to get name of th process by step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName() and there is an error occured like this : eIoni Transportation ionIoni RadioactiveDecay Transportation Transportation Transportation RadioactiveDecay Transportation Segmentation fault (core dumped) If i will turn off this function the programm will work fine.The same result i have when i turn off one of these function in PhysicsList: 1)... else if (particleName == "GenericIon") { pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1); G4ionIonisation* ionIoni = new G4ionIonisation(); ionIoni->SetEmModel(new G4IonParametrisedLossModel()); ionIoni->SetStepFunction(0.1, 10*um); pmanager->AddProcess(ionIoni,-1, 2, 2); ... <-------- this function 2)... pmanager->AddProcess(theRadioactiveDecay); pmanager->SetProcessOrdering(theRadioactiveDecay,idxPostStep); pmanager->SetProcessOrdering(theRadioactiveDecay, idxAtRest); <--this fucntion But at thirst case a have no gamma in readioctive decay,at second i have no decay in general Please help) Probably the error caused by programm part,but i have no enough information to find where the probleam really is.
neutron step length  by Saman Kiamehr <Saman Kiamehr>,   24 Apr, 2013
 Dear Geant Users, I have a code in geant to count the number of generated electron due to a particle strike in a simple silicon cube. When the particle is neutron, the step length is around 0.5 m which is too large since I want to do the simulation for small dimensions. Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName 0 0 -10 0 100 0 0 0 Fin_place initStep 1 0 550 0 0 0 560 560 Fin_place NeutronInelastic :----- List of 2ndaries - #SpawnInStep= 7(Rest= 0,Along= 0,Post= 7), #SpawnTotal= 7 --------------- : 0 550 0 22 neutron : 0 550 0 16.1 neutron : 0 550 0 13 proton : 0 550 0 2.95 proton : 0 550 0 0.807 neutron : 0 550 0 0.114 gamma : 0 550 0 6.83 Mg24[0.0] :----------------------------------------------------------------- EndOf2ndaries Info --------------- I tried to use G4UserLimits to adjust the step length of neutron, however, the step length of all the other particles have been adjusted except neutron. I was wondering if there is a solution to decrease the step length of neutron to a value smaller than 550 mm as shown in the results. I should mention that I am using QGSP_BERT_HP physic list. regards, Saman
Neutron interaction  by Saman Kiamehr <Saman Kiamehr>,   24 Apr, 2013
 Hello Geant users, I started using Geant recently and I want to do a very simple task with Geant, however I could not do so. I want to count the number of generated electrons due to strike of cosmic rays (such as alpha particle and neutron) in a silicon box. My silicon box dimension is (l=20nm, w=10nm, h=25nm). When the particle is alpha there is no problem and there are electrons which are generated. However, when I change the particle to neutron, there is no generated electron in the box. -I used the QGSP_BERT_HP and my userphysiclist and for both the results were the same (no interaction and no secondary is generated in that small dimensions). - I tried to run the tool for much bigger silicon box (1m*1m*1m), there is no electron generated directly from Neutron. There are other types of generated secondary particles such as gamma and proton. And these secondary particles generate electrons. does it make sense? - What type of physic list is the best choice for me. I really appreciate if you can help with that. regards, Saman
scoring secondary heavy ions  by Kevin Lyons <Kevin Lyons>,   22 Mar, 2013
 Hi, Sorry in advance if I'm missing something very basic- I am trying to use G4PSNofSecondary to count heavy ions created in a run. For example, for F-20 I am using the code ... G4SDParticleFilter* F20Filter = new G4SDParticleFilter(filterName="F20Filter",particleName="F20[0.0]"); G4MultiFunctionalDetector* det = new G4MultiFunctionalDetector(detName="F20Detector"); G4VPrimitiveScorer* primitive; primitive = new G4PSNofSecondary("nF20"); primitive->SetFilter(F20Filter); det->RegisterPrimitive(primitive); ... Everything compiles fine, but when I run the code I get the error message: *** G4Exception : DetPS0101 issued by : G4SDParticleFilter::G4SDParticleFilter Particle not found. In the ConstructParticle() section of my physics list I used the line of code: ... G4ParticleDefinition* f20 = particleTable->GetIon(9,20,0); ... which I thought should register the particle. Perhaps I am doing this step wrong? Many thanks, Kevin
Re: scoring secondary heavy ions  by Tsukasa Aso <Tsukasa Aso>,   24 Mar, 2013
Re: scoring secondary heavy ions (Kevin Lyons)
 Hi, The Ions are created after the beamOn command. It means there is no entry at all for ions when the DetectorConstruction has been called. (The other particles are static object so that they are available after ParticleConsturction, it is basically at the beginning of the program. ) The particle filter has an alternative method for registration of acceptable particles. It can specify particles by Atomic number Z and Mass number A. void G4SDParticleFilter::addIon(G4int Z, G4int A) ** This accepts the particle by its Z and A only. It does not check the other conditions such as charge. For exmaple, G4SDParticleFilter * F20Filter = new G4SDParticleFilter(filterName="F20Filter"); F20Filter->addIon(9,20); ** Also you can add more Ions if you need. Please try it. Best regards, Tsukasa Aso 
Re: scoring secondary heavy ions  by Kevin Lyons <Kevin Lyons>,   24 Mar, 2013
Re: Re: scoring secondary heavy ions (Tsukasa Aso)
 Hi Tsukasa, Thank you very much, that worked perfectly. As an aside, I have routinely come across very helpful presentations and other material on Geant authored by you. Thanks for all your efforts, they have made learning Geant a much easier experience. Cheers, Kevin
Where to access event quantities  by Noa Rensing <Noa Rensing>,   12 Mar, 2013
 This may be a naive question, but I'm confused about what is the recommended way for accessing the information accumulated during events. Some of the examples (e.g. N07) use a RecordEvent method in N07Run.cc to record the energy deposited during the event (or whatever other scoring is implemented), while others (e.g. N04) do this bookkeeping from the EventAction using an EndOfEventAction method. Can anyone explain the rationale of using one approach over the other? Thanks, Noa
Re: Where to access event quantities  by Tsukasa Aso <Tsukasa Aso>,   12 Mar, 2013
Re: Where to access event quantities (Noa Rensing)
 Hi, As you pointed out there are several ways for accessing information during events. When you use Run::RecordEvent() method, it means you use a customized Run class and generate it in y`