From cfb61922c9313a88db3af1f7a9c4aec3983bfe2d Mon Sep 17 00:00:00 2001 From: morfouace <pierre.morfouace@cea.fr> Date: Thu, 16 Jan 2025 14:07:01 +0100 Subject: [PATCH] new option to kill parentID>n with n given by option --cut-parent-id n --- NPLib/Core/NPOptionManager.cxx | 3 ++ NPLib/Core/NPOptionManager.h | 2 ++ NPLib/Detectors/PISTA/TPISTAPhysics.cxx | 12 ++++---- NPSimulation/Core/SteppingAction.cc | 7 +++++ NPSimulation/Core/SteppingAction.hh | 1 + NPSimulation/Detectors/PISTA/PISTA.cc | 38 +++++++++++++++++++++---- 6 files changed, 51 insertions(+), 12 deletions(-) diff --git a/NPLib/Core/NPOptionManager.cxx b/NPLib/Core/NPOptionManager.cxx index 75c36f225..2c22cd485 100644 --- a/NPLib/Core/NPOptionManager.cxx +++ b/NPLib/Core/NPOptionManager.cxx @@ -130,6 +130,7 @@ void NPOptionManager::ReadTheInputArgument(int argc, char** argv){ fSpectraServerPort = 9092; fRandomSeed = -1; fRecordTrack = 0; + fCutParentID = 1000; fDisableAllBranchOption = false; fInputPhysicalTreeOption = false; fGenerateHistoOption = false ; @@ -211,6 +212,8 @@ void NPOptionManager::ReadTheInputArgument(int argc, char** argv){ else if (argument == "--record-track") fRecordTrack = true ; + else if (argument == "--cut-parent-id" && argc >= i + 1) fCutParentID = atoi(argv[++i]) ; + else if (argument == "-F") fFirstEntryToAnalyse = atoi(argv[++i]); else if (argument == "--last-sim") fLastSimFile = true ; diff --git a/NPLib/Core/NPOptionManager.h b/NPLib/Core/NPOptionManager.h index dc7973fe8..c83050842 100644 --- a/NPLib/Core/NPOptionManager.h +++ b/NPLib/Core/NPOptionManager.h @@ -120,6 +120,7 @@ class NPOptionManager{ int GetSpectraServerPort() {return fSpectraServerPort;} int GetRandomSeed() {return fRandomSeed;} int GetRecordTrack() {return fRecordTrack;} + int GetCutParentID() {return fCutParentID;} std::string GetSharedLibExtension() {return fSharedLibExtension;} std::string GetLastFile(); std::string GetAnalysisOutputPath(){return m_AnalysisOutputPath;}; @@ -182,6 +183,7 @@ class NPOptionManager{ int fSpectraServerPort; int fRandomSeed; int fRecordTrack; + int fCutParentID; std::string fSharedLibExtension; // lib extension is platform dependent std::string fG4MacroPath; // Path to a geant4 macro to execute at start of nps bool fG4BatchMode; // Execute geant4 in batch mode, running the given macro diff --git a/NPLib/Detectors/PISTA/TPISTAPhysics.cxx b/NPLib/Detectors/PISTA/TPISTAPhysics.cxx index 01002b4e5..738830201 100644 --- a/NPLib/Detectors/PISTA/TPISTAPhysics.cxx +++ b/NPLib/Detectors/PISTA/TPISTAPhysics.cxx @@ -82,9 +82,9 @@ void TPISTAPhysics::AddDetector(TVector3 A, TVector3 B, TVector3 C, TVector3 D, if(version==2){ Height= 27; - LongBase= 53; - m_NumberOfStripsX= 45; - m_NumberOfStripsY= 49; + LongBase= 56; + m_NumberOfStripsX= 64; + m_NumberOfStripsY= 64; } double StripPitchY = Height/m_NumberOfStripsY; // mm double StripPitchX = LongBase/m_NumberOfStripsX; // mm @@ -159,9 +159,9 @@ void TPISTAPhysics::AddDetector(double R, double Theta, double Phi, int version) if(version==2){ Height= 27; - LongBase= 53; - m_NumberOfStripsX= 45; - m_NumberOfStripsY= 49; + LongBase= 56; + m_NumberOfStripsX= 64; + m_NumberOfStripsY= 64; } double StripPitchY = Height/m_NumberOfStripsY; // mm diff --git a/NPSimulation/Core/SteppingAction.cc b/NPSimulation/Core/SteppingAction.cc index d82804352..a2dd14105 100644 --- a/NPSimulation/Core/SteppingAction.cc +++ b/NPSimulation/Core/SteppingAction.cc @@ -29,6 +29,7 @@ //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... SteppingAction::SteppingAction() { m_record_track = NPOptionManager::getInstance()->GetRecordTrack(); + m_cut_parent_id = NPOptionManager::getInstance()->GetCutParentID(); m_tree = RootOutput::getInstance()->GetTree(); m_First = true; @@ -68,6 +69,12 @@ void SteppingAction::AttachTrackInfo() { //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void SteppingAction::UserSteppingAction(const G4Step* step) { + m_record_track = true; + G4Track* track = step->GetTrack(); + if(track->GetParentID()> m_cut_parent_id) { + m_record_track = false; + track->SetTrackStatus(fKillTrackAndSecondaries); + } if (m_record_track) { TrackRecording(step); } diff --git a/NPSimulation/Core/SteppingAction.hh b/NPSimulation/Core/SteppingAction.hh index 73ab8a184..c70282273 100644 --- a/NPSimulation/Core/SteppingAction.hh +++ b/NPSimulation/Core/SteppingAction.hh @@ -70,6 +70,7 @@ private: // tree private: bool m_record_track; + int m_cut_parent_id; public: // Attach the TrackInfo object to the tree diff --git a/NPSimulation/Detectors/PISTA/PISTA.cc b/NPSimulation/Detectors/PISTA/PISTA.cc index f7ebec47f..2669db035 100644 --- a/NPSimulation/Detectors/PISTA/PISTA.cc +++ b/NPSimulation/Detectors/PISTA/PISTA.cc @@ -75,8 +75,8 @@ namespace PISTA_NS{ double SecondStageNbrOfStrips = 57; // Trapezoid dimension PISTA2 - //double TrapezoidBaseLarge = 53*mm; - //double TrapezoidBaseSmall = 34.0*mm; + //double TrapezoidBaseLarge = 56*mm; + //double TrapezoidBaseSmall = 36.0*mm; //double TrapezoidHeight = 27*mm; //double TrapezoidLength = 1*cm; //double FirstStageThickness = 0.3*mm; @@ -125,15 +125,15 @@ void PISTA::AddDetector(G4ThreeVector A, G4ThreeVector B, G4ThreeVector C, G4Thr SecondStageNbrOfStrips = 57; } else if(m_version==2){ - TrapezoidBaseLarge = 53*mm; - TrapezoidBaseSmall = 34.0*mm; + TrapezoidBaseLarge = 56*mm; + TrapezoidBaseSmall = 36.0*mm; TrapezoidHeight = 27*mm; TrapezoidLength = 1*cm; FirstStageThickness = 0.3*mm; SecondStageThickness = 1.5*mm; DistanceBetweenSi = 3*mm; - FirstStageNbrOfStrips = 49; - SecondStageNbrOfStrips = 45; + FirstStageNbrOfStrips = 64; + SecondStageNbrOfStrips = 64; } } @@ -151,6 +151,30 @@ void PISTA::AddDetector(double R, double Theta, double Phi){ m_B.push_back(empty); m_C.push_back(empty); m_D.push_back(empty); + + if(m_version==1){ + TrapezoidBaseLarge = 72.3*mm; + TrapezoidBaseSmall = 41.0*mm; + TrapezoidHeight = 57.7*mm; + TrapezoidLength = 1*cm; + FirstStageThickness = 300*um; + SecondStageThickness = 1.5*mm; + DistanceBetweenSi = 4*mm; + FirstStageNbrOfStrips = 91; + SecondStageNbrOfStrips = 57; + } + else if(m_version==2){ + TrapezoidBaseLarge = 56.0*mm; + TrapezoidBaseSmall = 36.0*mm; + TrapezoidHeight = 27.0*mm; + TrapezoidLength = 1*cm; + FirstStageThickness = 0.3*mm; + SecondStageThickness = 1.5*mm; + DistanceBetweenSi = 3*mm; + FirstStageNbrOfStrips = 64; + SecondStageNbrOfStrips = 64; + } + } @@ -259,6 +283,8 @@ void PISTA::ReadConfiguration(NPL::InputParser parser){ else if(blocks[i]->HasTokenList(sphe)){ if(NPOptionManager::getInstance()->GetVerboseLevel()) cout << endl << "//// PISTA " << i+1 << endl; + + m_version = blocks[i]->GetInt("VERSION"); double R = blocks[i]->GetDouble("R","mm"); double Theta = blocks[i]->GetDouble("Theta","deg"); double Phi = blocks[i]->GetDouble("Phi","deg"); -- GitLab