Commit ad2e4305 authored by Adrien Matta's avatar Adrien Matta
Browse files

* Moving track recording to stepping info

parent 5bc3a9a4
Pipeline #133030 passed with stages
in 10 minutes and 3 seconds
add_library(NPSCore SHARED $<TARGET_OBJECTS:NPSEventGenerator> $<TARGET_OBJECTS:NPSProcess> EventAction.cc PrimaryGeneratorAction.cc Target.cc Chamber.cc PrimaryGeneratorActionMessenger.cc NPSVDetector.cc DetectorConstruction.cc MaterialManager.cc DetectorMessenger.cc MyMagneticField.cc SteppingVerbose.cc NPSDetectorFactory.cc RunAction.cc Particle.cc ParticleStack.cc NPSFunction.cc)
add_library(NPSCore SHARED $<TARGET_OBJECTS:NPSEventGenerator> $<TARGET_OBJECTS:NPSProcess> SteppingAction.cc EventAction.cc PrimaryGeneratorAction.cc Target.cc Chamber.cc PrimaryGeneratorActionMessenger.cc NPSVDetector.cc DetectorConstruction.cc MaterialManager.cc DetectorMessenger.cc MyMagneticField.cc SteppingVerbose.cc NPSDetectorFactory.cc RunAction.cc Particle.cc ParticleStack.cc NPSFunction.cc)
target_link_libraries(NPSCore ${ROOT_LIBRARIES} ${Geant4_LIBRARIES} ${NPLib_LIBRARIES} NPSScorers NPInitialConditions NPInteractionCoordinates NPReactionConditions NPFissionConditions )
/*****************************************************************************
* Copyright (C) 2009-2016 this file is part of the NPTool Project *
* Copyright (C) 2009-2021 this file is part of the NPTool Project *
* *
* For the licensing terms see $NPTOOL/Licence/NPTool_Licence *
* For the list of contributors see $NPTOOL/Licence/Contributors *
......@@ -31,7 +31,6 @@
#include "DetectorConstruction.hh"
#include "RootOutput.h"
#include "ParticleStack.hh"
#include "NPOptionManager.h"
#include<iostream>
......@@ -45,8 +44,7 @@ EventAction::EventAction(){
total=0;
mean_rate=0;
displayed=0;
m_record_track=NPOptionManager::getInstance()->GetRecordTrack();
m_tree = RootOutput::getInstance()->GetTree();
m_tree = RootOutput::getInstance()->GetTree();
// m_tree->Branch("Geant4RandomState",&m_G4State );
}
......@@ -65,9 +63,6 @@ void EventAction::BeginOfEventAction(const G4Event* event){
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void EventAction::EndOfEventAction(const G4Event* event){
m_detector->ReadAllSensitive(event) ;
if(m_record_track)
TrackRecording(event);
m_tree->Fill();
m_detector->ClearInteractionCoordinates();
// if(treated%10000==0){
......@@ -92,21 +87,7 @@ void EventAction::SaveRandomGeneratorInitialState(){
m_Geant4RandomFullState.clear();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void EventAction::TrackRecording(const G4Event* event){
// Clear the tracks class
// m_Tracks->Clear();
TrajectoryVector* traj = event->GetTrajectoryContainer()->GetVector();
unsigned int size = traj->size();
for(unsigned int i = 0 ; i < size ; i++){
// FILL
// Particle name
// Interaction points
// Initial Momentum
// Particles.insert( (*traj)[i]->GetParticleName());
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void EventAction::ProgressDisplay(){
if(treated==0){
......
......@@ -47,7 +47,6 @@ class EventAction : public G4UserEventAction{
void BeginOfEventAction(const G4Event*);
void EndOfEventAction(const G4Event*);
void SetDetector(DetectorConstruction* detector);
void TrackRecording(const G4Event* event);
void ProgressDisplay();
void SaveRandomGeneratorInitialState();
void SetRunLength(int);
......@@ -55,9 +54,6 @@ class EventAction : public G4UserEventAction{
private: // tree
TTree* m_tree;
private:
bool m_record_track;
private: // Progress Display
clock_t begin;
clock_t end;
......
/*****************************************************************************
* Copyright (C) 2009-2021 this file is part of the NPTool Project *
* *
* For the licensing terms see $NPTOOL/Licence/NPTool_Licence *
* For the list of contributors see $NPTOOL/Licence/Contributors *
*****************************************************************************/
/*****************************************************************************
* Original Author: Adrien MATTA contact address: matta@lpccaen.in2p3.fr *
* *
* Creation Date : January 2021 *
* Last update : *
*---------------------------------------------------------------------------*
* Decription: *
* A quite Standard Geant4 EventAction class. *
* Call the Fill method of the output tree. *
*---------------------------------------------------------------------------*
* Comment: *
* *
* *
*****************************************************************************/
#include "SteppingAction.hh"
#include "NPOptionManager.h"
#include "RootOutput.h"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SteppingAction::SteppingAction(){
m_record_track=NPOptionManager::getInstance()->GetRecordTrack();
m_tree = RootOutput::getInstance()->GetTree();
// Attach track info class to m_tree
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SteppingAction::UserSteppingAction (const G4Step* /*step*/){
if(m_record_track){
//TrackRecording(step);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SteppingAction::TrackRecording(const G4Step* /*step*/){
// Clear the tracks class
// m_Tracks->Clear();
// unsigned int size = traj->size();
// for(unsigned int i = 0 ; i < size ; i++){
// FILL
// Particle name
// Interaction points
// Momentum
// Kinetic energy
// Volume Name
// }
}
#ifndef SteppingAction_h
#define SteppingAction_h 1
/*****************************************************************************
* Copyright (C) 2009-2021 this file is part of the NPTool Project *
* *
* For the licensing terms see $NPTOOL/Licence/NPTool_Licence *
* For the list of contributors see $NPTOOL/Licence/Contributors *
*****************************************************************************/
/*****************************************************************************
* Original Author: Adrien MATTA contact address: matta@lpccaen.in2p3.fr *
* *
* Creation Date : January 2021 *
* Last update : *
*---------------------------------------------------------------------------*
* Decription: *
* A quite Standard Geant4 SteppingAction class. *
* Call the Fill method of the output tree. *
*---------------------------------------------------------------------------*
* Comment: *
* *
* *
*****************************************************************************/
// G4 header defining G4 types
#include "globals.hh"
// G4 header
#include "G4UserSteppingAction.hh"
//Root
#include "TTree.h"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class SteppingAction : public G4UserSteppingAction{
public:
SteppingAction();
~SteppingAction(){};
public:
void TrackRecording(const G4Step* step);
void UserSteppingAction (const G4Step* step);
private: // tree
TTree* m_tree;
private:
bool m_record_track;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
......@@ -29,6 +29,7 @@
#include "TRandom.h"
// NPS headers
#include "SteppingAction.hh"
#include "EventAction.hh"
#include "RunAction.hh"
#include "NPSimulationVersion.hh"
......@@ -109,6 +110,12 @@ int main(int argc, char** argv){
///////////////////////////////////////////////////////////////
primary->ReadEventGeneratorFile(EventGeneratorFileName);
runManager->SetUserAction(primary);
///////////////////////////////////////////////////////////////
///////////////// Starting the Stepping Action ////////////////
///////////////////////////////////////////////////////////////
SteppingAction* stepping_action = new SteppingAction() ;
runManager->SetUserAction(stepping_action) ;
///////////////////////////////////////////////////////////////
////////////////// Starting the Event Action //////////////////
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment