Skip to content

Commit

Permalink
Merge pull request #309 from project8/feature/truthWriting
Browse files Browse the repository at this point in the history
Record event properties
  • Loading branch information
pslocum authored Mar 22, 2024
2 parents afb71a3 + 0386ff4 commit 2fb94dd
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions Source/IO/LMCEvent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ namespace locust
void Event::AddTrack(const Track aTrack)
{
fStartFrequencies.push_back( aTrack.StartFrequency );
fEndFrequencies.push_back( aTrack.EndFrequency );
fTrackPowers.push_back( aTrack.TrackPower );
fStartTimes.push_back( aTrack.StartTime );
fTrackLengths.push_back( aTrack.TrackLength );
Expand Down
1 change: 1 addition & 0 deletions Source/IO/LMCEvent.hh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ namespace locust
int fRandomSeed;

std::vector<double> fStartFrequencies;
std::vector<double> fEndFrequencies;
std::vector<double> fTrackPowers;
std::vector<double> fStartTimes;
std::vector<double> fEndTimes;
Expand Down
1 change: 1 addition & 0 deletions Source/IO/LMCRootTreeWriter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ namespace locust
aTree->Branch("EventID", &anEvent->fEventID, "EventID/I");
aTree->Branch("ntracks", &anEvent->fNTracks, "ntracks/I");
aTree->Branch("StartFrequencies", "std::vector<double>", &anEvent->fStartFrequencies);
aTree->Branch("EndFrequencies", "std::vector<double>", &anEvent->fEndFrequencies);
aTree->Branch("StartTimes", "std::vector<double>", &anEvent->fStartTimes);
aTree->Branch("EndTimes", "std::vector<double>", &anEvent->fEndTimes);
aTree->Branch("TrackLengths", "std::vector<double>", &anEvent->fTrackLengths);
Expand Down
1 change: 1 addition & 0 deletions Source/IO/LMCTrack.hh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ namespace locust
double EndTime = -99.;
double TrackLength = -99.;
double StartFrequency = -99.;
double EndFrequency = -99.;
double LOFrequency = -99.;
double TrackPower = -99.;
double Slope = -99.;
Expand Down
6 changes: 5 additions & 1 deletion Source/Kassiopeia/LMCCyclotronRadiationExtractor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,12 @@ namespace locust
double tY = aFinalParticle.GetPosition().Y();
fInterface->aTrack.Radius = pow(tX*tX + tY*tY, 0.5);
fInterface->aTrack.RadialPhase = calcOrbitPhase(tX, tY);
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
}
else
{
fInterface->aTrack.EndTime = tTime;
fInterface->aTrack.EndFrequency = aFinalParticle.GetCyclotronFrequency();
}
#endif

Expand Down Expand Up @@ -183,14 +185,16 @@ namespace locust

if (!fInterface->fDoneWithSignalGeneration) // if Locust is still acquiring voltages.
{
if (fInterface->fTOld == 0.)
if (!(fInterface->fTOld > 0.))
{
fPitchAngle = -99.; // new electron needs central pitch angle reset.
double dt = aFinalParticle.GetTime() - anInitialParticle.GetTime();
fFieldCalculator->SetNFilterBinsRequired( dt );
UpdateTrackProperties( aFinalParticle, fInterface->fSampleIndex, 1 );
LPROG(lmclog,"Updated track properties at sample " << fInterface->fSampleIndex );
}


double t_poststep = aFinalParticle.GetTime();
fNewParticleHistory.push_back(ExtractKassiopeiaParticle(anInitialParticle, aFinalParticle));

Expand Down

0 comments on commit 2fb94dd

Please sign in to comment.