Skip to content

Commit

Permalink
Merge pull request #198 from paolafer/root-free-validation
Browse files Browse the repository at this point in the history
Using different files formats in the output histogram of the validation tracking action
  • Loading branch information
paolafer authored Feb 28, 2023
2 parents 2503c8d + d991fa7 commit e9aeec7
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 107 deletions.
31 changes: 0 additions & 31 deletions macros/validation/NEW_valid_Bi214.config.mac

This file was deleted.

31 changes: 0 additions & 31 deletions macros/validation/NEW_valid_Co60.config.mac

This file was deleted.

31 changes: 0 additions & 31 deletions macros/validation/NEW_valid_Tl208.config.mac

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## ----------------------------------------------------------------------------
## nexus | NEW_valid_K40.config.mac
## nexus | NEW_valid_isotope.config.mac
##
## Configuration macro to simulate K-40 decays to test gamma
## production in different versions of GEANT4.
## Configuration macro to simulate K-40, Co-60, Bi214 and Tl-208
## decays to test gamma production in different versions of GEANT4.
##
## The NEXT Collaboration
## ----------------------------------------------------------------------------
Expand All @@ -18,16 +18,29 @@
/Geometry/NextNew/pressure 15. bar
/Geometry/NextNew/elfield false

# GENERATION
# GENERATION - K40
/Generator/IonGenerator/atomic_number 19
/Generator/IonGenerator/mass_number 40
/Generator/IonGenerator/region DICE_BOARD

# Co-60
#/Generator/IonGenerator/atomic_number 27
#/Generator/IonGenerator/mass_number 60
# Bi-214
#/Generator/IonGenerator/atomic_number 83
#/Generator/IonGenerator/mass_number 214
# Tl-208
#/Generator/IonGenerator/atomic_number 81
#/Generator/IonGenerator/mass_number 208

# PHYSICS
/PhysicsList/Nexus/clustering false
/PhysicsList/Nexus/drift false
/PhysicsList/Nexus/electroluminescence false

# ACTIONS
/Actions/ValidationTrackingAction/valid_file NEW_valid.isotope.DICE_BOARD.csv

# PERSISTENCY
/nexus/persistency/eventType background
/nexus/persistency/outputFile NEW_valid.K40.DICE_BOARD.next
/nexus/persistency/outputFile NEW_valid.isotope.DICE_BOARD.next
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## ----------------------------------------------------------------------------
## nexus | NEW_valid_K40.init.mac
## nexus | NEW_valid_isotope.init.mac
##
## Initialization macro to simulate K-40 decays to test gamma
## production in different versions of GEANT4.
## Initialization macro to simulate K-40, Co-60, Bi214 and Tl-208
## decays to test gamma production in different versions of GEANT4.
##
## The NEXT Collaboration
## ----------------------------------------------------------------------------
Expand All @@ -24,5 +24,6 @@
/nexus/RegisterTrackingAction ValidationTrackingAction
/nexus/RegisterEventAction DefaultEventAction

/nexus/RegisterMacro macros/validation/NEW_valid_K40.config.mac
/nexus/RegisterMacro macros/validation/NEW_valid_isotope.config.mac

#/nexus/RegisterDelayedMacro macros/physics/Bi214.mac
12 changes: 8 additions & 4 deletions source/actions/ValidationTrackingAction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// nexus | ValidationTrackingAction.cc
//
// This class is based on DefaultTrackinAction.
// In addition, it creates and saves ROOT histograms with the energy
// In addition, it creates and saves files with the energy
// of the gammas produced in the simulation. Its purpose is to produce
// histograms to be compared across different versions of GEANT4,
// before changing version.
Expand All @@ -22,16 +22,20 @@
#include <G4Trajectory.hh>
#include <G4OpticalPhoton.hh>
#include <G4Gamma.hh>
#include <G4GenericMessenger.hh>



using namespace nexus;

REGISTER_CLASS(ValidationTrackingAction, G4UserTrackingAction)

ValidationTrackingAction::ValidationTrackingAction(): G4UserTrackingAction()
ValidationTrackingAction::ValidationTrackingAction():
G4UserTrackingAction(), fname_("ValidationFile.csv")
{

msg_ = new G4GenericMessenger(this, "/Actions/ValidationTrackingAction/");
msg_->DeclareProperty("valid_file", fname_,
"Name of the file with the info for the validation histograms");
// Get analysis manager
fG4AnalysisMan_ = G4AnalysisManager::Instance();

Expand All @@ -47,7 +51,7 @@ ValidationTrackingAction::~ValidationTrackingAction()
{

// Open an output file and write histogram to file
fG4AnalysisMan_->OpenFile("GammaEnergy.root");
fG4AnalysisMan_->OpenFile(fname_);
fG4AnalysisMan_->Write();
fG4AnalysisMan_->CloseFile();
}
Expand Down
5 changes: 4 additions & 1 deletion source/actions/ValidationTrackingAction.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// nexus | ValidationTrackingAction.h
//
// This class is based on DefaultTrackinAction.
// In addition, it creates and saves ROOT histograms with the energy
// In addition, it creates and saves files with the energy
// of the gammas produced in the simulation. Its purpose is to produce
// histograms to be compared across different versions of GEANT4,
// before changing version.
Expand All @@ -17,6 +17,7 @@
#include <G4AnalysisManager.hh>

class G4Track;
class G4GenericMessenger;

namespace nexus {

Expand All @@ -34,6 +35,8 @@ namespace nexus {
virtual void PostUserTrackingAction(const G4Track*);

private:
G4GenericMessenger* msg_;
G4String fname_;
G4AnalysisManager* fG4AnalysisMan_; ///< Pointer to the Analysis Manager
};

Expand Down

0 comments on commit e9aeec7

Please sign in to comment.