From 43070846f06210d16e22f06c23cd3f58ec6288a7 Mon Sep 17 00:00:00 2001 From: Penny Slocum Date: Tue, 23 Apr 2024 21:51:34 -0400 Subject: [PATCH 1/8] Make minimum track length fraction a class variable. --- Source/Kassiopeia/LMCRunPause.cc | 9 +++++---- Source/Kassiopeia/LMCRunPause.hh | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Source/Kassiopeia/LMCRunPause.cc b/Source/Kassiopeia/LMCRunPause.cc index 5ce29c20..9f551da5 100644 --- a/Source/Kassiopeia/LMCRunPause.cc +++ b/Source/Kassiopeia/LMCRunPause.cc @@ -24,6 +24,7 @@ namespace locust RunPause::RunPause() : fToolbox(KToolbox::GetInstance()), KSComponent(), + fMinTrackLengthFraction(0.1), fInterface( KLInterfaceBootstrapper::get_instance()->GetInterface() ) { } @@ -31,6 +32,7 @@ namespace locust RunPause::RunPause( const RunPause& aCopy ) : fToolbox(KToolbox::GetInstance()), KSComponent(), + fMinTrackLengthFraction(0.1), fInterface( aCopy.fInterface ) { } @@ -272,13 +274,12 @@ namespace locust { double tMaxTrackLength = 0.; - double tMinTrackLengthFraction = 0.1; fLocustMaxTimeTerminator = new Kassiopeia::KSTermMaxTime(); if ( aParam.has( "min-track-length-fraction" ) ) { - tMinTrackLengthFraction = aParam["min-track-length-fraction"]().as_double(); - LPROG(lmclog,"Setting minimum track length fraction to " << tMinTrackLengthFraction); + fMinTrackLengthFraction = aParam["min-track-length-fraction"]().as_double(); + LPROG(lmclog,"Setting minimum track length fraction to " << fMinTrackLengthFraction); } if ( aParam.has( "track-length" ) ) @@ -300,7 +301,7 @@ namespace locust default_setting.add("name","uniform"); fTrackLengthDistribution = fDistributionInterface.get_dist(default_setting); fDistributionInterface.SetSeed( GetSeed(aParam) ); - double tMinTrackLength = tMaxTrackLength * tMinTrackLengthFraction; + double tMinTrackLength = tMaxTrackLength * fMinTrackLengthFraction; double tRandomTime = tMinTrackLength + (tMaxTrackLength - tMinTrackLength) * fTrackLengthDistribution->Generate(); fLocustMaxTimeTerminator->SetTime( tRandomTime ); LPROG(lmclog,"Randomizing the track length to " << tRandomTime); diff --git a/Source/Kassiopeia/LMCRunPause.hh b/Source/Kassiopeia/LMCRunPause.hh index 366e30b1..8fc80b28 100644 --- a/Source/Kassiopeia/LMCRunPause.hh +++ b/Source/Kassiopeia/LMCRunPause.hh @@ -82,6 +82,7 @@ namespace locust std::shared_ptr< BaseDistribution> fTrackLengthDistribution; DistributionInterface fDistributionInterface; + double fMinTrackLengthFraction; From 2cc9b419d7bcf10ad6e80c4236e5a7b76fab97dc Mon Sep 17 00:00:00 2001 From: Penny Slocum Date: Tue, 23 Apr 2024 21:53:01 -0400 Subject: [PATCH 2/8] If seed is specified as a parameter, offset track delay seed from track length seed. --- Source/Generators/LMCCavitySignalGenerator.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Source/Generators/LMCCavitySignalGenerator.cc b/Source/Generators/LMCCavitySignalGenerator.cc index 7ff2c4ea..26061e75 100644 --- a/Source/Generators/LMCCavitySignalGenerator.cc +++ b/Source/Generators/LMCCavitySignalGenerator.cc @@ -262,7 +262,9 @@ namespace locust } if ( aParam.has( "random-track-seed" ) ) { - SetSeed( aParam["random-track-seed"]().as_int() ); + // Offset event-spacing seed from track-length seed. + int tSeed = aParam["random-track-seed"]().as_int() + 1; + SetSeed( tSeed ); } else { @@ -302,11 +304,12 @@ namespace locust bool CavitySignalGenerator::RecordRunParameters( Signal* aSignal ) { +#ifdef ROOT_FOUND fInterface->aRunParameter = new RunParameters(); fInterface->aRunParameter->fSamplingRateMHz = fAcquisitionRate; fInterface->aRunParameter->fDecimationFactor = aSignal->DecimationFactor(); fInterface->aRunParameter->fLOfrequency = fLO_Frequency; - +#endif return true; } From 38a0231065161b2eaab44090727d29f7bd31fa9f Mon Sep 17 00:00:00 2001 From: Penny Slocum Date: Tue, 23 Apr 2024 21:55:40 -0400 Subject: [PATCH 3/8] Add output start frequency to event properties tree, in addition to existing RF start frequency. --- Source/IO/LMCEvent.cc | 1 + Source/IO/LMCEvent.hh | 1 + Source/IO/LMCRootTreeWriter.cc | 1 + Source/IO/LMCTrack.hh | 1 + Source/Kassiopeia/LMCCyclotronRadiationExtractor.cc | 7 +++++++ 5 files changed, 11 insertions(+) diff --git a/Source/IO/LMCEvent.cc b/Source/IO/LMCEvent.cc index dd4be47b..c824da46 100644 --- a/Source/IO/LMCEvent.cc +++ b/Source/IO/LMCEvent.cc @@ -22,6 +22,7 @@ namespace locust void Event::AddTrack(const Track aTrack) { + fOutputStartFrequencies.push_back( aTrack.OutputStartFrequency ); fStartFrequencies.push_back( aTrack.StartFrequency ); fEndFrequencies.push_back( aTrack.EndFrequency ); fAvgFrequencies.push_back( aTrack.AvgFrequency ); diff --git a/Source/IO/LMCEvent.hh b/Source/IO/LMCEvent.hh index afe16c27..0f17d355 100644 --- a/Source/IO/LMCEvent.hh +++ b/Source/IO/LMCEvent.hh @@ -33,6 +33,7 @@ namespace locust double fLOFrequency; int fRandomSeed; + std::vector fOutputStartFrequencies; std::vector fStartFrequencies; std::vector fEndFrequencies; std::vector fAvgFrequencies; diff --git a/Source/IO/LMCRootTreeWriter.cc b/Source/IO/LMCRootTreeWriter.cc index 5ad80b91..43acd546 100644 --- a/Source/IO/LMCRootTreeWriter.cc +++ b/Source/IO/LMCRootTreeWriter.cc @@ -56,6 +56,7 @@ namespace locust TTree *aTree = new TTree(treename,"Locust Tree"); aTree->Branch("EventID", &anEvent->fEventID, "EventID/I"); aTree->Branch("ntracks", &anEvent->fNTracks, "ntracks/I"); + aTree->Branch("OutputStartFrequencies", "std::vector", &anEvent->fOutputStartFrequencies); aTree->Branch("StartFrequencies", "std::vector", &anEvent->fStartFrequencies); aTree->Branch("EndFrequencies", "std::vector", &anEvent->fEndFrequencies); aTree->Branch("AvgFrequencies", "std::vector", &anEvent->fAvgFrequencies); diff --git a/Source/IO/LMCTrack.hh b/Source/IO/LMCTrack.hh index da4a450f..18c4fde9 100644 --- a/Source/IO/LMCTrack.hh +++ b/Source/IO/LMCTrack.hh @@ -32,6 +32,7 @@ namespace locust double StartTime = -99.; double EndTime = -99.; double TrackLength = -99.; + double OutputStartFrequency = -99.; double StartFrequency = -99.; double EndFrequency = -99.; double AvgFrequency = -99.; diff --git a/Source/Kassiopeia/LMCCyclotronRadiationExtractor.cc b/Source/Kassiopeia/LMCCyclotronRadiationExtractor.cc index 6f04af21..1a3a2a2e 100644 --- a/Source/Kassiopeia/LMCCyclotronRadiationExtractor.cc +++ b/Source/Kassiopeia/LMCCyclotronRadiationExtractor.cc @@ -132,12 +132,19 @@ namespace locust if (fPitchAngle == -99.) // first crossing of center { fPitchAngle = aFinalParticle.GetPolarAngleToB(); +#ifdef ROOT_FOUND fInterface->aTrack.PitchAngle = aFinalParticle.GetPolarAngleToB(); fInterface->aTrack.StartFrequency = aFinalParticle.GetCyclotronFrequency(); + double tLOfrequency = fInterface->aRunParameter->fLOfrequency; // Hz + double tSamplingRate = fInterface->aRunParameter->fSamplingRateMHz; // MHz + fInterface->aTrack.OutputStartFrequency = fInterface->aTrack.StartFrequency - tLOfrequency + tSamplingRate * 1.e6 / 2.; +#endif } else { +#ifdef ROOT_FOUND fInterface->aTrack.EndFrequency = aFinalParticle.GetCyclotronFrequency(); +#endif } } aNewParticle.SetPitchAngle(fPitchAngle); From bf390e69afd7e830640a70fde975d2fbfda180df Mon Sep 17 00:00:00 2001 From: Penny Slocum Date: Tue, 23 Apr 2024 21:56:01 -0400 Subject: [PATCH 4/8] Edit a comment. --- Source/Kassiopeia/LMCEventHold.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Kassiopeia/LMCEventHold.cc b/Source/Kassiopeia/LMCEventHold.cc index 4beab0c2..013d3932 100644 --- a/Source/Kassiopeia/LMCEventHold.cc +++ b/Source/Kassiopeia/LMCEventHold.cc @@ -102,7 +102,7 @@ namespace locust aRootTreeWriter->SetFilename(sFileName); if (fAccumulateTruthInfo) { - // This option should be used when running pileup. We will need to + // TO-DO: This option should be used when running pileup. We will need to // figure out how to explicitly increment the event ID, given that the // same (identical) simulation is being run multiple times in this case. aRootTreeWriter->OpenFile("UPDATE"); From 064563f20beb6f77d5292dcdcd81c8ff0355d2f8 Mon Sep 17 00:00:00 2001 From: Penny Slocum Date: Tue, 23 Apr 2024 21:57:28 -0400 Subject: [PATCH 5/8] Build on push to feature branch. --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 592aedda..302ca300 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -3,7 +3,7 @@ name: Build and Test Locust on: pull_request: push: - branches: [master, develop] + branches: [master, develop, feature/eventRecording] tags: ['*'] workflow_dispatch: From 6b7991c29fe91a0c35b255d2704cac90808ac178 Mon Sep 17 00:00:00 2001 From: Penny Slocum Date: Wed, 24 Apr 2024 09:51:10 -0400 Subject: [PATCH 6/8] Populate LMCEvent Tree structure with selected run parameter info, for convenience and compatibility with previous work. Also continue to build up LMCRunParameter Tree structure. --- Source/Generators/LMCCavitySignalGenerator.cc | 1 + Source/IO/LMCEvent.cc | 5 ++++- Source/IO/LMCRunParameters.hh | 1 + Source/IO/LMCTrack.hh | 1 + Source/Kassiopeia/LMCCyclotronRadiationExtractor.cc | 2 ++ 5 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Source/Generators/LMCCavitySignalGenerator.cc b/Source/Generators/LMCCavitySignalGenerator.cc index 26061e75..50ab9052 100644 --- a/Source/Generators/LMCCavitySignalGenerator.cc +++ b/Source/Generators/LMCCavitySignalGenerator.cc @@ -309,6 +309,7 @@ namespace locust fInterface->aRunParameter->fSamplingRateMHz = fAcquisitionRate; fInterface->aRunParameter->fDecimationFactor = aSignal->DecimationFactor(); fInterface->aRunParameter->fLOfrequency = fLO_Frequency; + fInterface->aRunParameter->fRandomSeed = fTrackDelaySeed; #endif return true; } diff --git a/Source/IO/LMCEvent.cc b/Source/IO/LMCEvent.cc index c824da46..e34a24d2 100644 --- a/Source/IO/LMCEvent.cc +++ b/Source/IO/LMCEvent.cc @@ -35,7 +35,10 @@ namespace locust fRadii.push_back( aTrack.Radius ); fRadialPhases.push_back( aTrack.RadialPhase ); - //update size + // Update size. And, record fLOFrequency for compatibility with previous work. The LO frequency is + // now also recorded in the RunParameters Tree. fNTracks = fStartFrequencies.size(); + fLOFrequency = aTrack.LOFrequency; + fRandomSeed = aTrack.RandomSeed; } } diff --git a/Source/IO/LMCRunParameters.hh b/Source/IO/LMCRunParameters.hh index 867202de..d7301ed4 100644 --- a/Source/IO/LMCRunParameters.hh +++ b/Source/IO/LMCRunParameters.hh @@ -30,6 +30,7 @@ namespace locust double fLOfrequency; double fSamplingRateMHz; double fDecimationFactor; + int fRandomSeed; ClassDef(RunParameters,1) // Root syntax. diff --git a/Source/IO/LMCTrack.hh b/Source/IO/LMCTrack.hh index 18c4fde9..15263179 100644 --- a/Source/IO/LMCTrack.hh +++ b/Source/IO/LMCTrack.hh @@ -29,6 +29,7 @@ namespace locust Track(); virtual ~Track(); int EventID = -99; + int RandomSeed = -99.; double StartTime = -99.; double EndTime = -99.; double TrackLength = -99.; diff --git a/Source/Kassiopeia/LMCCyclotronRadiationExtractor.cc b/Source/Kassiopeia/LMCCyclotronRadiationExtractor.cc index 1a3a2a2e..9ebbb7fc 100644 --- a/Source/Kassiopeia/LMCCyclotronRadiationExtractor.cc +++ b/Source/Kassiopeia/LMCCyclotronRadiationExtractor.cc @@ -137,6 +137,8 @@ namespace locust fInterface->aTrack.StartFrequency = aFinalParticle.GetCyclotronFrequency(); double tLOfrequency = fInterface->aRunParameter->fLOfrequency; // Hz double tSamplingRate = fInterface->aRunParameter->fSamplingRateMHz; // MHz + fInterface->aTrack.LOFrequency = tLOfrequency; + fInterface->aTrack.RandomSeed = fInterface->aRunParameter->fRandomSeed; fInterface->aTrack.OutputStartFrequency = fInterface->aTrack.StartFrequency - tLOfrequency + tSamplingRate * 1.e6 / 2.; #endif } From 15f7e3baebe5154c458f73d9fd31730820d49091 Mon Sep 17 00:00:00 2001 From: Penny Slocum Date: Wed, 24 Apr 2024 10:12:29 -0400 Subject: [PATCH 7/8] Remove build on push to feature branch. --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 302ca300..592aedda 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -3,7 +3,7 @@ name: Build and Test Locust on: pull_request: push: - branches: [master, develop, feature/eventRecording] + branches: [master, develop] tags: ['*'] workflow_dispatch: From ba510c9a2cd217ef3e5b7d17979a2ff92a4767a4 Mon Sep 17 00:00:00 2001 From: Penny Slocum Date: Wed, 24 Apr 2024 10:13:33 -0400 Subject: [PATCH 8/8] Bump version to 2.8.2. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8289672f..0707fde0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ cmake_minimum_required( VERSION 3.1 ) # Define the project cmake_policy( SET CMP0048 NEW ) # version in project() -project( locust_mc VERSION 2.8.1) +project( locust_mc VERSION 2.8.2) list( APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/Scarab/cmake )