Hello! In Hadr04, I want to save some extra output. I don’t think this is the smartest way to do it but I want to record the time and positions of the neutron captures, and was thinking of a text based output (I do not know how to add an additional histogram to Hadr04 but if that could be explained that would be awesome!).
How do I allow the user to set the <some_file_name> equal some some string.
I.e., for a given run, all steps for all events will add to the same run file called <some_file_name>? Thanks!
Thanks for the reply and the advice! Just to clarify, I should add the
analysisManager->SetNtupleMerging(true);
to make sure that the Ntuple sits in one file? If so, where to add? E.g. If I define for example in the HistoManager.cc (it appears analysisManager is already in there)
I guess this should be in the UserSteppingAction? Not sure how to get each run ID though
// if it is a capture, get the step end time
G4double t_finish = aStep->GetPostStepPoint()->GetGlobalTime();
G4ThreeVector position_finish = aStep->GetPostStepPoint()->GetPosition();
G4int eventid = G4RunManager::GetRunManager()->GetCurrentEvent()->GetEventID();
//Fill the Run ID column
G4AnalysisManager::Instance()->FillNtupleIColumn(0,);
//Fill the event column for the run
G4AnalysisManager::Instance()->FillNtupleIColumn(1,eventid);
//Fill the capture time
G4AnalysisManager::Instance()->FillNtupleDColumn(2,t_finish);
//Fill the x position of the Capture
G4AnalysisManager::Instance()->FillNtupleDColumn(3,position_finish[0]);
//Fill the y position of the capture
G4AnalysisManager::Instance()->FillNtupleDColumn(4,position_finish[1]);
//Fill the z position of the capture
G4AnalysisManager::Instance()->FillNtupleDColumn(5,position_finish[2]);
//Fill the energy of the capture
G4AnalysisManager::Instance()->FillNtupleDColumn(6,ekin);
yes, I believe so. Try what happens if you dont add this line
I have placed it into the constructor of the G4UserRunAction.
does it?
your next post answers this, but don’t forget the line
G4AnalysisManager* man = G4AnalysisManager::Instance();
...
man->AddNtupleRow();
and the first column is missing the runid.
Also it could improve the code to store the G4AnalysisManager::Instance() like in the example as you access it multiple times in a row. Don’t know if that makes a difference in performance, but it is more aesthetically, codewise
or something like this? I read in the manual it looks like the user can set it but it wasn’t clear how to do this in the C++ or via macro (Sorry for my confusion! )
Since the Geant4 units are not carried into the N-tuple, you might find it convenient to explicitly choose units for storing the values. In our experiment (a low-energy dark matter search), we have decided that our analysis code will use units of eV for energy, m for length, and ns for timestamps. So in our N-tuples, we save out
So I gave it a go (and in Hadr04.cc I added the line G4VModularPhysicsList* phys = new FTFP_BERT_HP; to try and include high energy neutron beam) and I got this… it looks kinda weird
It gave messages appearing like it couldn’t find carbon scattering data for FTFP_BERT_HP (i changed my detector to include some fraction of carbon)
NeutronHP: /Capture file for Z = 6, A = 12 is not found and NeutronHP will use BLAH
NeutronHP: /Elastic file for Z = 6, A = 12 is not found and NeutronHP will use BLAH
NeutronHP: /Inelastic file for Z = 6, A = 12 is not found and NeutronHP will use BLAH
etc
where BLAH just refers to my directory variables (geant found them ok )
Those messages mean it didn’t find separate specific-isotope files (for C-12, in this case). I believe it falls back to using the generic “natural mix” files, which should have been mentioned in the BLAH strings.
You had asked earlier
and your plot shows that it’s identically zero, not just “small.” If you’re filling it with
where “endPoint” is the PostStepPoint, then I think it will always be zero for a capture (capture means “stopped and killed”). If you want to know the energy it came into the nucleus with, use the preStepPoint.