Target temperature

Hello, is there a function in Geant4 to get information about the temperature of the target when the beam goes through it?

You can set the temperature of a material as part of the material definition. This is really only relevant for materials specified as gases (where you also specify a material pressure).

Temperature or pressure are not properties associated with volumes, nor are they properties which are computed dynamically for the simulation. It is possible for your job to change things like material properties between (maybe even during) runs, for example, based the data collected during the event. I’m pretty sure there are examples that demonstrate how to do this, but I don’t recall which ones off the top of my head.

Thank you @mkelsey I was interested in target temperature, because we want be sure that the target has a good thermo-mechanical resistence… I store the released energy, but I wanted to know if there is also other function for that…is there anyone?

No. I think you’d need to use something like COMSOL, or some other “multiphysics” program, to model heat flow and mechanical properties. You can use Geant4 for the particle-physics part (how much energy does the beam deposit in your target, over what area/volume), but you’d have to feed that to some other modelling code for the thermal physics.

Thank you @mkelsey then it will be just the work of the engineers of the group (I’ve just to do Particle physics simulation and give the risults to the engineers).
One more question. You said that I can get l’information abou the area in which the beam deposits the energy…do you mean that I can get l’information about the party of the target where the energy is stored? I’ve 2 targets, and I store the energy, but I store the energy in all the target…did you mean it is also possibile to know the area of the target where the beam deposits energy?

Certainly! If you are using a simple “scorer”, you can create one binned in spatial coordinates and get the energy deposit distribution that way. If you wrote something more complex, like a SteppingAction or a SensitiveDetector, you can store the hit coordinates along with the energy deposit.

See the section in the G4 Developer’s Guide on Command based scoring.

Thank you @mkelsey. I’ve the SteppingAction, because I modified the B1 example. Yes, I think it would be great to get 2 plots (one for each target) like this one


to show the area in which the target releases the energy.

I was looking \examples\advanced\hadrontherapy\src\HadrontherapyEventAction and examples\extended\parallel\TopC\ParN04\ but they are hard for me…isn’t there an easier way to store the hit point and the released energy in that hit in a ROOT ntupla?

If you have a stepping action, then you already know how to do it. Read the application developer’s guide. The energy deposit is a data member of G4Step (read G4Step.hh), and the position at the endpoint of the step is a data member of G4StepPoint, accessed as step->GetPostStepPoint() (read G4StepPoint.hh).

Thank you @mkelsey.
Currently I store the energy in my 2 targets in the B1SteppingAction.cc by the code

 // collect energy deposited in this step
	if (volume == fScoringVolume) {
  G4double edepStep = step->GetTotalEnergyDeposit();
  fEventAction->AddEdep(edepStep);
	}
	if (volume == fScoringVolume2) {
  G4double edepStep2 = step->GetTotalEnergyDeposit();
  fEventAction->AddEdep2(edepStep2);
	}

and in the B1EventAction I’ve the code to fill the 2 Root Ntuples (one for each target)

analysisManager->FillNtupleDColumn(0,8, fEdep);
analysisManager->FillNtupleDColumn(1,8, fEdep2Tar);

Now I added the code to store the position at the endpoint of the step that is

double EndStepPosx2 = step->GetPostStepPoint()->GetPosition().x();
			 analysisManager->FillNtupleDColumn(1,8, EndStepPosx2); 
			 double EndStepPosy2 = step->GetPostStepPoint()->GetPosition().y();
			 analysisManager->FillNtupleDColumn(1,9, EndStepPosy2); 
			 double EndStepPosz2 = step->GetPostStepPoint()->GetPosition().z();
			 analysisManager->FillNtupleDColumn(1,10, EndStepPosz2); 

Now do i have just plot the releasedenergy brach in function of the end step position branch? For example a TH2F filled by the relaes energy step->GetTotalEnergyDeposit() and the end step position step->GetPostStepPoint()->GetPosition().x()

 TH2F *myplot = new TH2F("myplot", "", 500, 0., 0.,5000, 0.,0.);
  TString myvar = TString::Format("ReleasedEnergy: EndStepPos.x>> myplot");

Or do I’ve to use other code for the relaesed energy in a single hit??

A follow on point to this question.

Wouldn’t it be possible to adjust for temperature effects in solids via the Geant4 Crystal Object method, given crystal property information from say NIST?

@faca87 Yes, make a 2D, or 3D, or 4D histogram of energy vs. position, using the contents of your Ntuples. That’s an analysis task, which you would do after running the simulation. The scorers that are discussed in the Developer’s Guide will do it for you, but the N-tuple you’re creating gives you more flexibility (you can make cuts, etc.).

Hi @marmolRBG regarding of your question, I’m not a Geant4 expert…so let reply by an expert

Thank you @mkelsey yes, I want just to store data in ROOT Ntuples, so that I can use ROOT to analyse them. Unfortunately, yesterday while I was writing the ROOT macro to read the hit coordinates stored in the Ntuples, I noticed i.e. my second target is positioned at (0,0,2.3 cm) and it has a 0.3 cm thickness (so its range along the z-axiz should be [2.3cm-2.6cm], but looking for hits position in that target, I get some hits in the range 22cm-25cm. I discussed about my problem in this topic Position problem in targets Do you know what is the problem?

When you fill your Ntuple, do you explicitly divide out the units? Or do you just save the numerical quantity in the variable. As discussed very early in the Geant4 documentation (Application Developer’s Guide) the “internal” units for Geant4 are millimeters.

Thank you @mkelsey yes maybe they are mm ! But I also noticed that in the target 2 (that is centered at z=2.3 cm) I get hits at z=0 (out of the z range even if the unita are mm)

then you should check your code and see how you’re doing your selection. Are you using the prestep point or the poststep point? Do the target volumes have different names, or did you use the same name and different copy numbers? You need to become proficient in debugging your own code.