From 3ebbf77e374cb48b2c96b215cd0f49f0a9b90306 Mon Sep 17 00:00:00 2001 From: Penny Slocum Date: Mon, 11 Nov 2024 21:12:06 -0500 Subject: [PATCH 1/5] Adjust readout and Doppler shift for etalon cavity. --- Source/Fields/LMCCylindricalCavity.cc | 30 +++++++++++++++++++++++++-- Source/Fields/LMCCylindricalCavity.hh | 1 + Source/Fields/LMCField.cc | 3 ++- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/Source/Fields/LMCCylindricalCavity.cc b/Source/Fields/LMCCylindricalCavity.cc index 7f1864d4..b3265d85 100644 --- a/Source/Fields/LMCCylindricalCavity.cc +++ b/Source/Fields/LMCCylindricalCavity.cc @@ -17,7 +17,8 @@ namespace locust fProbeGain( {1., 1., 1.}), fCavityProbeZ( {0., 0., 0.} ), fCavityProbeRFrac( {0.5, 0.5, 0.5} ), - fCavityProbeTheta( {0.0, 0.0, 0.0} ) + fCavityProbeTheta( {0.0, 0.0, 0.0} ), + fCaterpillarCavity( false ) {} CylindricalCavity::~CylindricalCavity() {} @@ -33,6 +34,11 @@ namespace locust return false; } + if( aParam.has( "caterpillar-cavity" ) ) + { + fCaterpillarCavity = aParam["caterpillar-cavity"]().as_bool(); + } + if( aParam.has( "cavity-radius" ) ) { SetDimR( aParam["cavity-radius"]().as_double() ); @@ -227,6 +233,10 @@ namespace locust double vz = tKassParticleXP[5]; double term1 = fFieldCore->GetBesselNKPrimeZeros(l,m) / GetDimR(); double term2 = n * LMCConst::Pi() / GetDimL(); + if ( fCaterpillarCavity ) + { + term2 *= GetNChannels(); + } double lambda = 1. / pow( 1. / 4. / LMCConst::Pi() / LMCConst::Pi() * ( term1*term1 + term2*term2 ), 0.5); double lambda_c = 2 * LMCConst::Pi() * GetDimR() / fFieldCore->GetBesselNKPrimeZeros(l,m); double vp = LMCConst::C() / pow( 1. - lambda*lambda/lambda_c/lambda_c, 0.5 ); @@ -325,7 +335,23 @@ namespace locust std::vector tEFieldAtProbe; for (unsigned index=0; index fCavityProbeRFrac; std::vector fCavityProbeTheta; std::vector fProbeGain; + bool fCaterpillarCavity; }; diff --git a/Source/Fields/LMCField.cc b/Source/Fields/LMCField.cc index 8fab166c..420ef717 100644 --- a/Source/Fields/LMCField.cc +++ b/Source/Fields/LMCField.cc @@ -16,8 +16,9 @@ namespace locust fCentralFrequency(1.63e11), fAvgDotProductFactor( 0. ), fNModes( 2 ), + fNChannels( 1 ), fbMultiMode( false ), - fTM111( false ), + fTM111( false ), fR( 0.18 ), fL( 3.0 ), fX( 0.010668 ), From b30a0e0a15b791ae498e6795b005eda37c6c13f3 Mon Sep 17 00:00:00 2001 From: Penny Slocum Date: Tue, 12 Nov 2024 08:37:11 -0500 Subject: [PATCH 2/5] 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 0cecfc97..775a146f 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/metadata] tags: ['*'] workflow_dispatch: From 0e81db4d8237443a5d7426ed570597cfeb5bfa36 Mon Sep 17 00:00:00 2001 From: Penny Slocum Date: Tue, 12 Nov 2024 08:40:54 -0500 Subject: [PATCH 3/5] Add a comment and remove build on push to feature branch. --- .github/workflows/build.yaml | 2 +- Source/Fields/LMCCylindricalCavity.cc | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 775a146f..0cecfc97 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/metadata] + branches: [master, develop] tags: ['*'] workflow_dispatch: diff --git a/Source/Fields/LMCCylindricalCavity.cc b/Source/Fields/LMCCylindricalCavity.cc index b3265d85..d5cdbafb 100644 --- a/Source/Fields/LMCCylindricalCavity.cc +++ b/Source/Fields/LMCCylindricalCavity.cc @@ -235,6 +235,7 @@ namespace locust double term2 = n * LMCConst::Pi() / GetDimL(); if ( fCaterpillarCavity ) { + // Assume n-channels is the same as the number of etalon sections: term2 *= GetNChannels(); } double lambda = 1. / pow( 1. / 4. / LMCConst::Pi() / LMCConst::Pi() * ( term1*term1 + term2*term2 ), 0.5); From 2f589a4d24244255542ef504218b5578308b155a Mon Sep 17 00:00:00 2001 From: Penny Slocum Date: Sun, 24 Nov 2024 21:02:44 -0500 Subject: [PATCH 4/5] Optionally disable Doppler shift. --- Source/Fields/LMCCylindricalCavity.cc | 10 ++++++++-- Source/Fields/LMCCylindricalCavity.hh | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Source/Fields/LMCCylindricalCavity.cc b/Source/Fields/LMCCylindricalCavity.cc index d5cdbafb..6a645fdc 100644 --- a/Source/Fields/LMCCylindricalCavity.cc +++ b/Source/Fields/LMCCylindricalCavity.cc @@ -18,7 +18,8 @@ namespace locust fCavityProbeZ( {0., 0., 0.} ), fCavityProbeRFrac( {0.5, 0.5, 0.5} ), fCavityProbeTheta( {0.0, 0.0, 0.0} ), - fCaterpillarCavity( false ) + fCaterpillarCavity( false ), + fApplyDopplerShift( true ) {} CylindricalCavity::~CylindricalCavity() {} @@ -39,6 +40,11 @@ namespace locust fCaterpillarCavity = aParam["caterpillar-cavity"]().as_bool(); } + if( aParam.has( "apply-doppler-shift" ) ) + { + fApplyDopplerShift = aParam["apply-doppler-shift"]().as_bool(); + } + if( aParam.has( "cavity-radius" ) ) { SetDimR( aParam["cavity-radius"]().as_double() ); @@ -242,7 +248,7 @@ namespace locust double lambda_c = 2 * LMCConst::Pi() * GetDimR() / fFieldCore->GetBesselNKPrimeZeros(l,m); double vp = LMCConst::C() / pow( 1. - lambda*lambda/lambda_c/lambda_c, 0.5 ); double dopplerShift = 0.; - if (vp > 0.) dopplerShift = vz / vp; + if ((vp > 0.) && (fApplyDopplerShift)) dopplerShift = vz / vp; freqPrime.push_back( ( 1. + dopplerShift ) * tKassParticleXP[7] ); return freqPrime; } diff --git a/Source/Fields/LMCCylindricalCavity.hh b/Source/Fields/LMCCylindricalCavity.hh index 231b5a91..89a7f65f 100644 --- a/Source/Fields/LMCCylindricalCavity.hh +++ b/Source/Fields/LMCCylindricalCavity.hh @@ -87,6 +87,7 @@ namespace locust std::vector fCavityProbeTheta; std::vector fProbeGain; bool fCaterpillarCavity; + bool fApplyDopplerShift; }; From 5083b1d08175f5a572eacae903c2f9c4e33f1fd1 Mon Sep 17 00:00:00 2001 From: Penny Slocum Date: Sun, 24 Nov 2024 21:15:38 -0500 Subject: [PATCH 5/5] Fix some indenting. --- Source/Fields/LMCModeMapCavity.cc | 53 ++++++++++++++++--------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/Source/Fields/LMCModeMapCavity.cc b/Source/Fields/LMCModeMapCavity.cc index 3ab5455d..1d00c877 100644 --- a/Source/Fields/LMCModeMapCavity.cc +++ b/Source/Fields/LMCModeMapCavity.cc @@ -116,7 +116,7 @@ namespace locust std::string token; std::stringstream ss(lineContent); int wordCount = 0; - double r, theta, z; + double r, theta, z; int i,j,k; double Erho,Etheta; double Ex, Ey, Ez; @@ -124,19 +124,19 @@ namespace locust { if (wordCount == 0) { - r = std::stod(token); + r = std::stod(token); i = (int)((r-fDim1_min)/(fDim1_max-fDim1_min)*(fnPixel1)); // var1 position - } + } else if (wordCount == 1) - { - theta = std::stod(token); - j = (int)((theta-fDim2_min)/(fDim2_max-fDim2_min)*(fnPixel2)); // var2 position - } + { + theta = std::stod(token); + j = (int)((theta-fDim2_min)/(fDim2_max-fDim2_min)*(fnPixel2)); // var2 position + } else if (wordCount == 2) - { - z = std::stod(token); - k = (int)((z-fDim3_min)/(fDim3_max-fDim3_min)*(fnPixel3)); // var3 position - } + { + z = std::stod(token); + k = (int)((z-fDim3_min)/(fDim3_max-fDim3_min)*(fnPixel3)); // var3 position + } else if (wordCount == 3) Ex = std::stod(token); // mode E field value else if (wordCount == 4) Ey = std::stod(token); // mode E field value else if (wordCount == 5) Ez = std::stod(token); // mode E field value @@ -148,10 +148,10 @@ namespace locust ++wordCount; } - if ((i==fnPixel1) or (j==fnPixel2) or (k==fnPixel3)) - { - continue; - } + if ((i==fnPixel1) or (j==fnPixel2) or (k==fnPixel3)) + { + continue; + } if ((i>=fnPixel1) or (j>=fnPixel2) or (k>=fnPixel3)) { LERROR(lmclog,"Imported mode map dimensions don't agree with those in \"" << aFilename <<".\" Double check dim[1,2,3]-max."); @@ -159,26 +159,27 @@ namespace locust } //Must convert E field from cartesian coordinates to cylindrical coordinates - if(r<1.e-10) - { - Erho = 0.; - Etheta = 0.; - } - else - { + if(r<1.e-10) + { + Erho = 0.; + Etheta = 0.; + } + else + { Erho = ((Ex * r*cos(theta)) + Ey * r*sin(theta)) / r; - Etheta = ((Ey * r*cos(theta)) - Ex * r*sin(theta)) / r; - } + Etheta = ((Ey * r*cos(theta)) - Ex * r*sin(theta)) / r; + } std::vector E_input = {Erho,Etheta,Ez}; fModeMapTE_E[i][j][k] = E_input; -// printf("read var1 is %g, var2 is %g, E is %g\n", fModeMapTE_E.back()[0], fModeMapTE_E.back()[1], fModeMapTE_E.back()[2]); + //printf("read var1 is %g, var2 is %g, E is %g\n", fModeMapTE_E.back()[0], fModeMapTE_E.back()[1], fModeMapTE_E.back()[2]); + } } modeMapFile.close(); - //Reset dimensions from import file to actual cavity dimensions in case they don't match up + //Reset dimensions from import file to actual cavity dimensions in case they don't match up MatchCavityDimensions(aParam); return true;