Skip to content

Commit

Permalink
Propagate the random-track-seed parameter to Kass and to the truth ou…
Browse files Browse the repository at this point in the history
…tputs. If it is not specified, record its default [unused] value.
  • Loading branch information
pslocum committed Sep 21, 2024
1 parent 278f656 commit 2c5c3a8
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 19 deletions.
1 change: 0 additions & 1 deletion Source/Generators/LMCCavitySignalGenerator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,6 @@ namespace locust
fInterface->aRunParameter->fSamplingRateMHz = fAcquisitionRate;
fInterface->aRunParameter->fDecimationFactor = aSignal->DecimationFactor();
fInterface->aRunParameter->fLOfrequency = fLO_Frequency;
fInterface->aRunParameter->fRandomSeed = fTrackDelaySeed;
#endif
return true;
}
Expand Down
10 changes: 3 additions & 7 deletions Source/IO/LMCEvent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace locust
}
Event::~Event() {}

bool Event::Initialize()
bool Event::Initialize(long int aSeed)
{
time_t rawtime;
struct tm * timeInfo;
Expand All @@ -39,9 +39,8 @@ namespace locust
int tMicrosec = tv.tv_usec;

fEventID = 1e12 + tDay*1e10 + tMonth*1e8 + tYear*1e6 + tMicrosec;
fRandomSeed = -99;
fRandomSeed = aSeed;
fLOFrequency = -99.;
fRandomSeed = -99;
return true;
}

Expand All @@ -65,11 +64,8 @@ namespace locust
fRadii.push_back( aTrack->Radius );
fRadialPhases.push_back( aTrack->RadialPhase );

// Update size. And, record fLOFrequency for compatibility with previous work. The LO frequency is
// now also recorded in the RunParameters Tree.
// Update size.
fNTracks = fStartFrequencies.size();
fLOFrequency = aTrack->LOFrequency;
fRandomSeed = aTrack->RandomSeed;
}

void Event::AddTrack(const Track aTrack) // Phase II structure
Expand Down
4 changes: 2 additions & 2 deletions Source/IO/LMCEvent.hh
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ namespace locust
Event();
virtual ~Event();

bool Initialize();
bool Initialize(long int aSeed);
void AddTrack(const Track* aTrack);
void AddTrack(const Track aTrack);

long int fEventID;
double fLOFrequency;
int fRandomSeed;
long int fRandomSeed;

std::vector<int> fTrackIDs;
std::vector<double> fStartingEnergies_eV;
Expand Down
2 changes: 1 addition & 1 deletion Source/IO/LMCRootTreeWriter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ namespace locust
aTree->Branch("TrackLengths", "std::vector<double>", &anEvent->fTrackLengths);
aTree->Branch("Slopes", "std::vector<double>", &anEvent->fSlopes);
aTree->Branch("LOFrequency", &anEvent->fLOFrequency, "LOFrequency/D");
aTree->Branch("RandomSeed", &anEvent->fRandomSeed, "RandomSeed/I");
aTree->Branch("RandomSeed", &anEvent->fRandomSeed, "RandomSeed/L");
aTree->Branch("TrackPower", "std::vector<double>", &anEvent->fTrackPowers);
aTree->Branch("PitchAngles", "std::vector<double>", &anEvent->fPitchAngles);
aTree->Branch("Radii", "std::vector<double>", &anEvent->fRadii);
Expand Down
1 change: 0 additions & 1 deletion Source/IO/LMCRunParameters.hh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ namespace locust
double fLOfrequency;
double fSamplingRateMHz;
double fDecimationFactor;
int fRandomSeed;

ClassDef(RunParameters,1) // Root syntax.

Expand Down
2 changes: 0 additions & 2 deletions Source/IO/LMCTrack.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ namespace locust
bool Track::Initialize()
{
TrackID += 1;
RandomSeed = -99.;
StartTime = -99.;
EndTime = -99.;
TrackLength = -99.;
Expand All @@ -35,7 +34,6 @@ namespace locust
AvgFrequency = 0.;
OutputAvgFrequency = 0.;
AvgAxialFrequency = 0.;
LOFrequency = -99.;
TrackPower = -99.;
Slope = -99.;
PitchAngle = -99.;
Expand Down
1 change: 0 additions & 1 deletion Source/IO/LMCTrack.hh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ namespace locust
virtual ~Track();
bool Initialize();
int TrackID;
int RandomSeed = -99.;
double StartTime = -99.;
double EndTime = -99.;
double TrackLength = -99.;
Expand Down
2 changes: 0 additions & 2 deletions Source/Kassiopeia/LMCCyclotronRadiationExtractor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,6 @@ 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
}
Expand Down
10 changes: 8 additions & 2 deletions Source/Kassiopeia/LMCEventHold.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ namespace locust
fTruthOutputFilename("LocustEventProperties.root"),
fAccumulateTruthInfo( false ),
fConfigurationComplete( false ),
fEventSeed( 0 ),
fInterface( KLInterfaceBootstrapper::get_instance()->GetInterface() )
{
}
Expand All @@ -26,6 +27,7 @@ namespace locust
fTruthOutputFilename("LocustEventProperties.root"),
fAccumulateTruthInfo( false ),
fConfigurationComplete( false ),
fEventSeed( 0 ),
fInterface( aOrig.fInterface )
{
}
Expand Down Expand Up @@ -71,7 +73,11 @@ namespace locust
{
if ( aParam.has( "random-track-seed" ) )
{
fInterface->anEvent->fRandomSeed = aParam["random-track-seed"]().as_int();
fEventSeed = aParam["random-track-seed"]().as_int();
}
else
{
fEventSeed = -99;
}
if ( aParam.has( "truth-output-filename" ) )
{
Expand All @@ -92,7 +98,7 @@ namespace locust
{
#ifdef ROOT_FOUND
fInterface->anEvent = new Event();
fInterface->anEvent->Initialize();
fInterface->anEvent->Initialize( fEventSeed );
fInterface->aTrack = new Track();
fInterface->aTrack->Initialize();
#endif
Expand Down
2 changes: 2 additions & 0 deletions Source/Kassiopeia/LMCEventHold.hh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "KSEventModifier.h"
#include "KSComponentTemplate.h"


#include "LMCKassLocustInterface.hh"

#ifdef ROOT_FOUND
Expand Down Expand Up @@ -49,6 +50,7 @@ namespace locust

private:
bool fConfigurationComplete;
long int fEventSeed;

};

Expand Down

0 comments on commit 2c5c3a8

Please sign in to comment.