Skip to content

Commit

Permalink
Merge pull request #317 from project8/feature/testScattering
Browse files Browse the repository at this point in the history
multi-track event recording
  • Loading branch information
pslocum authored Jun 5, 2024
2 parents 0724acf + 4cd2682 commit f57e319
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 14 deletions.
3 changes: 3 additions & 0 deletions Config/LocustKass_Cavity_1GHz.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,8 @@
<cycl_rad_extr name="rad_extr" P8Phase="4" />
<mod_run_pause name="run_pause"/>
<mod_event_hold name="event_hold"/>
<mod_track_hold name="track_hold"/>


<!-- writers -->

Expand Down Expand Up @@ -461,6 +463,7 @@
writer="write_root"
add_static_run_modifier="run_pause"
add_static_event_modifier="event_hold"
add_static_track_modifier="track_hold"
add_static_step_modifier="rad_extr"
/>

Expand Down
20 changes: 12 additions & 8 deletions Config/LocustKass_Cavity_CCA.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -304,23 +304,25 @@

<!-- space interactions -->

<!--
<ksint_scattering name="int_scattering" split="true">
<density_constant temperature="300." pressure="3.e-10"/>
<calculator_constant cross_section="1.e-18"/>
</ksint_scattering>
-->

<!-- surface interactions -->

<ksint_surface_diffuse name="int_surface_diffuse" probability=".3" reflection_loss="0." transmission_loss="1."/>



<!--

<ksint_scattering name="int_hydrogen" split="true">
<density_constant name="density_constant" temperature="300." pressure="[pressure]"/>
<calculator_hydrogen name="calculator_hydrogen" elastic="true" excitation="true" ionisation="true"/>
<density_constant name="density_constant" temperature="300." pressure="3.e-2"/>
<calculator_hydrogen name="calculator_hydrogen" elastic="false" excitation="true" ionisation="true"/>
</ksint_scattering>
-->


<!-- navigators -->

Expand All @@ -331,7 +333,7 @@

<!-- terminators -->
<ksterm_max_steps name="term_max_steps" steps="10000"/>
<ksterm_min_energy name="term_min_energy" energy="0."/>
<ksterm_min_energy name="term_min_energy" energy="17500."/>
<ksterm_max_energy name="term_max_energy" energy="30430."/>
<ksterm_min_z name="term_min_z" z="-4.0"/>
<ksterm_max_z name="term_max_z" z="4.0"/>
Expand All @@ -342,6 +344,7 @@
<cycl_rad_extr name="rad_extr" P8Phase="4" />
<mod_run_pause name="run_pause"/>
<mod_event_hold name="event_hold"/>
<mod_track_hold name="track_hold"/>

<!-- writers -->

Expand Down Expand Up @@ -427,9 +430,9 @@




<!-- <command parent="root_space_interaction" field="add_space_interaction" child="int_scattering"/> -->

<!--
<command parent="root_space_interaction" field="add_space_interaction" child="int_hydrogen"/>
-->
<!--
<command parent="trajectory_exact" field="remove_control" child="control_cyclotron_1_16"/>
<command parent="trajectory_exact" field="add_control" child="control_cyclotron_1_64"/>
Expand Down Expand Up @@ -458,6 +461,7 @@
writer="write_root"
add_static_run_modifier="run_pause"
add_static_event_modifier="event_hold"
add_static_track_modifier="track_hold"
add_static_step_modifier="rad_extr"
/>

Expand Down
4 changes: 4 additions & 0 deletions Config/LocustKass_FreeSpace_Template.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,9 @@
<cycl_rad_extr name="rad_extr" P8Phase="0" />
<mod_run_pause name="run_pause"/>
<mod_event_hold name="event_hold"/>
<mod_track_hold name="track_hold"/>




<!-- writers -->
Expand Down Expand Up @@ -452,6 +455,7 @@
writer="write_root"
add_static_run_modifier="run_pause"
add_static_event_modifier="event_hold"
add_static_track_modifier="track_hold"
add_static_step_modifier="rad_extr"
/>

Expand Down
22 changes: 22 additions & 0 deletions Source/IO/LMCTrack.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,28 @@ namespace locust
{
}

bool Track::Initialize()
{
EventID = -99;
RandomSeed = -99.;
StartTime = -99.;
EndTime = -99.;
TrackLength = -99.;
OutputStartFrequency = -99.;
StartFrequency = -99.;
EndFrequency = -99.;
AvgFrequency = -99.;
LOFrequency = -99.;
TrackPower = -99.;
Slope = -99.;
PitchAngle = -99.;
Radius = -99.;
RadialPhase = -99.;

return true;

}


} /* namespace locust */

1 change: 1 addition & 0 deletions Source/IO/LMCTrack.hh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ namespace locust
public:
Track();
virtual ~Track();
bool Initialize();
int EventID = -99;
int RandomSeed = -99.;
double StartTime = -99.;
Expand Down
12 changes: 8 additions & 4 deletions Source/Kassiopeia/LMCCyclotronRadiationExtractor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ namespace locust
fNewParticleHistory(),
fFieldCalculator( NULL ),
fPitchAngle( -99. ),
fLMCTrackID( -2 ),
fT0trapMin( 0. ),
fNCrossings( 0 ),
fSampleIndex( 0 ),
Expand All @@ -25,6 +26,7 @@ namespace locust
fNewParticleHistory(),
fFieldCalculator( NULL ),
fPitchAngle( aCopy.fPitchAngle ),
fLMCTrackID( aCopy.fLMCTrackID ),
fT0trapMin( aCopy.fT0trapMin ),
fNCrossings( aCopy.fNCrossings ),
fSampleIndex( aCopy.fSampleIndex ),
Expand Down Expand Up @@ -209,13 +211,15 @@ namespace locust

if (!fInterface->fDoneWithSignalGeneration) // if Locust is still acquiring voltages.
{
if (!(fInterface->fTOld > 0.))

if ( aFinalParticle.GetParentTrackId() > fLMCTrackID ) // check for new track
{
fPitchAngle = -99.; // new electron needs central pitch angle reset.
double dt = aFinalParticle.GetTime() - anInitialParticle.GetTime();
fLMCTrackID = aFinalParticle.GetParentTrackId();
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 recorded track properties at sample " << fInterface->fSampleIndex );
LPROG(lmclog,"Updated recorded track properties at sample " << fInterface->fSampleIndex );
}


Expand Down
1 change: 1 addition & 0 deletions Source/Kassiopeia/LMCCyclotronRadiationExtractor.hh
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ namespace locust
private:
std::deque<locust::Particle> fNewParticleHistory;
double fPitchAngle;
int fLMCTrackID;
double fT0trapMin;
int fNCrossings;
FieldCalculator* fFieldCalculator;
Expand Down
1 change: 0 additions & 1 deletion Source/Kassiopeia/LMCEventHold.cc
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ namespace locust
{
aRootTreeWriter->OpenFile("RECREATE");
}
fInterface->anEvent->AddTrack( fInterface->aTrack );
aRootTreeWriter->WriteEvent( fInterface->anEvent );
aRootTreeWriter->WriteRunParameters(fInterface->aRunParameter);
aRootTreeWriter->CloseFile();
Expand Down
7 changes: 6 additions & 1 deletion Source/Kassiopeia/LMCTrackHold.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,18 @@ namespace locust

bool TrackHold::ExecutePreTrackModification(Kassiopeia::KSTrack &aTrack)
{
fInterface->aTrack.Initialize();
double tTime = aTrack.GetInitialParticle().GetTime();

double tPitchAngle = aTrack.GetInitialParticle().GetPolarAngleToB();
LWARN(lmclog,"LMCTrack " << fTrackCounter << " is starting, with instantaneous pitch angle " << tPitchAngle);
LWARN(lmclog,"LMCTrack " << fTrackCounter << " is starting at Kass time " << tTime << " with instantaneous pitch angle " << tPitchAngle);
return true;
}

bool TrackHold::ExecutePostTrackModification(Kassiopeia::KSTrack &aTrack)
{
fInterface->anEvent->AddTrack( fInterface->aTrack );

double tPitchAngle = aTrack.GetFinalParticle().GetPolarAngleToB();
double tTime = aTrack.GetFinalParticle().GetTime();
LWARN(lmclog,"LMCTrack " << fTrackCounter << " is complete at Kass time " << tTime << ", with instantaneous pitch angle " << tPitchAngle);
Expand Down

0 comments on commit f57e319

Please sign in to comment.