-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/MultiMode #295
Feature/MultiMode #295
Changes from 14 commits
d69cf54
c88ee74
1743c65
5f73abc
85c2aef
7303aae
71da8b9
fd8ca02
19a1961
6088ddf
5bd2e9e
b5b06eb
63c980d
f08add2
6604446
1d41169
cbc6972
6eb2ab2
2b1154c
ee9d18d
1ee6098
17d7202
f3b99c2
88b6450
8348ca3
27572c8
f32ab0f
f0aed56
5b79c08
9c9c928
8a45856
c737172
bc6710e
a74cd41
71235ce
faa4ee9
36934d9
cb78ed1
f90cf37
c807034
5f0eefe
6b3bb6b
e9fb4fe
4dcc358
9b5382b
a2203da
7f4ee49
d418b59
a77629f
ecb8557
0c84c22
5549561
7215706
8dfc701
c573f1a
ca1b1ba
169b745
c4b5da9
f47adbb
b047513
f685054
8eeafad
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,29 +32,36 @@ namespace locust | |
virtual bool Configure( const scarab::param_node& aNode); | ||
virtual bool ReadHFSSFile(); | ||
virtual double ConvolveWithFIRFilter(std::deque<double>);// Convolve input signal (voltage or field) with FIR | ||
virtual std::pair<double,double> ConvolveWithComplexFIRFilterArray(int bTE, int l, int m, int n, std::deque<double> inputBuffer); | ||
virtual std::pair<double,double> ConvolveWithComplexFIRFilter(std::deque<double> inputBuffer); | ||
int GetFilterSize() const;//Number of entries in the filter | ||
int GetFilterSizeArray(int bTE, int l, int m, int n) const;//Number of entries in the filter | ||
double GetFilterResolution() const;//Get the resolution of the filter | ||
double GetFilterResolutionArray(int bTE, int l, int m, int n) const;//Get the resolution of the filter | ||
void PrintFIR( std::vector<double>, int nBins, std::string filename ); | ||
void PrintFIR( fftw_complex* aFilter, int nBins, std::string filename ); | ||
bool WriteRootHisto( std::vector<double> aFilter, int nBins, bool bIQ ); | ||
|
||
|
||
protected: | ||
|
||
// Member variables | ||
std::string fHFSSFilename; | ||
std::vector<double> fFilter; | ||
fftw_complex* fFilterComplex; | ||
std::vector< std::vector< std::vector < std::vector< fftw_complex*>>>> fFilterComplexArray; | ||
int fTFNBins; | ||
int fFIRNBins; | ||
int fCropIndex; | ||
std::vector < std::vector < std::vector < std::vector < int >>>> fFIRNBinsArray; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is fFIRNBins allowed to be different for each mode lmn? if not, I am wondering if we could use fFIRNBins to replace fFIRNBinsArray. |
||
int fNModes; | ||
double fResolution; | ||
std::vector < std::vector < std::vector < std::vector < double >>>> fResolutionArray; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is fResolution allowed to be different for each mode lmn? if not, I am wondering if we could use fResolution to replace fResolutionArray. |
||
int fCropIndex; | ||
double fCharacteristicImpedance; | ||
int fNSkips; | ||
bool fHFSSFiletype; | ||
ComplexFFT fComplexFFT; | ||
bool fIsFIRCreated; | ||
std::vector < std::vector < std::vector < std::vector < bool >>>> fIsFIRCreatedArray; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is fIsFIRCreated allowed to be different for each mode lmn? if not, I am wondering if we could use fIsFIRCreated to replace fFIRCreatedArray. |
||
std::string fWindowName; | ||
double fWindowParam; | ||
bool fPrintFIR; | ||
|
@@ -74,11 +81,20 @@ namespace locust | |
return fFIRNBins; | ||
} | ||
|
||
inline int HFSSResponseFileHandlerCore::GetFilterSizeArray(int bTE, int l, int m, int n) const | ||
{ | ||
return fFIRNBinsArray[bTE][l][m][n]; | ||
} | ||
|
||
inline double HFSSResponseFileHandlerCore::GetFilterResolution() const | ||
{ | ||
return fResolution; | ||
} | ||
|
||
inline double HFSSResponseFileHandlerCore::GetFilterResolutionArray(int bTE, int l, int m, int n) const | ||
{ | ||
return fResolutionArray[bTE][l][m][n]; | ||
} | ||
|
||
/*! | ||
@class TFFileHandlerCore | ||
|
@@ -97,7 +113,7 @@ namespace locust | |
virtual bool Configure( const scarab::param_node& aNode) override; | ||
bool ReadHFSSFile() override; | ||
bool ConvertAnalyticTFtoFIR(double initialFreq, std::vector<std::complex<double>> tfArray); | ||
bool ConvertAnalyticGFtoFIR(std::vector<std::pair<double,std::pair<double,double> > > gfArray); | ||
bool ConvertAnalyticGFtoFIR(int bTE, int l, int m, int n, std::vector<std::pair<double,std::pair<double,double> > > gfArray); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. similar to the above, can we just upgrade to your new implementation, and remove the old implementation altogether? |
||
|
||
|
||
private: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -218,14 +218,18 @@ namespace locust | |
return tIntegral; | ||
} | ||
|
||
std::vector<double> CylindricalCavity::GetDopplerFrequency(int l, int m, int n, std::vector<double> tKassParticleXP) | ||
std::vector<double> CylindricalCavity::GetDopplerFrequency(int bTE, int l, int m, int n, std::vector<double> tKassParticleXP) | ||
{ | ||
std::vector<double> freqPrime; | ||
double vz = tKassParticleXP[5]; | ||
double term1 = fFieldCore->GetBesselNKPrimeZeros(l,m) / GetDimR(); | ||
double term1 = 0; | ||
if(bTE==1) term1 = fFieldCore->GetBesselNKPrimeZeros(l,m) / GetDimR(); | ||
else term1 = fFieldCore->GetBesselNKZeros(l,m) / GetDimR(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we add the full |
||
double term2 = n * LMCConst::Pi() / GetDimL(); | ||
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 lambda_c = 0.; | ||
if(bTE==1)lambda_c = 2 * LMCConst::Pi() * GetDimR() / fFieldCore->GetBesselNKPrimeZeros(l,m); | ||
else lambda_c = 2 * LMCConst::Pi() * GetDimR() / fFieldCore->GetBesselNKZeros(l,m); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we add the full {} syntax for the if () {} else {} ? |
||
double vp = LMCConst::C() / pow( 1. - lambda*lambda/lambda_c/lambda_c, 0.5 ); | ||
double dopplerShift = 0.; | ||
if (vp > 0.) dopplerShift = vz / vp; | ||
|
@@ -362,12 +366,25 @@ namespace locust | |
return tField; // return normalized field. | ||
} | ||
|
||
double CylindricalCavity::CalculateDotProductFactor(int l, int m, int n, std::vector<double> tKassParticleXP, std::vector<double> anE_normalized, double tThisEventNSamples) | ||
/* | ||
double CylindricalCavity::TotalFieldNorm(std::vector<double> field) | ||
{ | ||
double norm = 0; | ||
auto it = field.begin(); | ||
while (it != field.end()) | ||
{ | ||
if (!isnan(*it)) norm += (*it)*(*it); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is TotalFieldNorm not needed any more? |
||
*it++; | ||
} | ||
return sqrt(norm); | ||
} | ||
*/ | ||
double CylindricalCavity::CalculateDotProductFactor(int bTE, int l, int m, int n, std::vector<double> tKassParticleXP, std::vector<double> anE_normalized, double tThisEventNSamples) | ||
{ | ||
std::vector<std::vector<std::vector<double>>> tAvgDotProductFactor = GetAvgDotProductFactor(); | ||
tAvgDotProductFactor[l][m][n] = 1. / ( tThisEventNSamples + 1 ) * ( tAvgDotProductFactor[l][m][n] * tThisEventNSamples + GetDotProductFactor(tKassParticleXP, anE_normalized, 0) ); // unit velocity \dot unit theta | ||
std::vector<std::vector<std::vector<std::vector<double>>>> tAvgDotProductFactor = GetAvgDotProductFactor(); | ||
tAvgDotProductFactor[bTE][l][m][n] = 1. / ( tThisEventNSamples + 1 ) * ( tAvgDotProductFactor[bTE][l][m][n] * tThisEventNSamples + GetDotProductFactor(tKassParticleXP, anE_normalized, 0) ); // unit velocity \dot unit theta | ||
SetAvgDotProductFactor(tAvgDotProductFactor); | ||
return tAvgDotProductFactor[l][m][n]; | ||
return tAvgDotProductFactor[bTE][l][m][n]; | ||
} | ||
|
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,13 +74,13 @@ namespace locust | |
virtual double Z_TM(int l, int m, int n, double fcyc) const {return {0.};}; | ||
virtual double Z_TE(int l, int m, int n, double fcyc) const {return {0.};}; | ||
virtual double Integrate(int l, int m, int n, bool teMode, bool eField){return 0.;}; | ||
virtual std::vector<double> GetDopplerFrequency(int l, int m, int n, std::vector<double> tKassParticleXP) {return {0.};}; | ||
virtual std::vector<double> GetDopplerFrequency(int bTE, int l, int m, int n, std::vector<double> tKassParticleXP) {return {0.};}; | ||
virtual std::vector<double> GetNormalizedModeField(int l, int m, int n, std::vector<double> tKassParticleXP, bool includeOtherPols, bool teMode) {return {0.};}; | ||
double NormalizedEFieldMag(std::vector<double> field); | ||
virtual std::vector<std::vector<std::vector<double>>> CalculateNormFactors(int nModes, bool bTE) {return {{{0.}}};}; | ||
virtual std::vector<double> GetTE_E(int l, int m, int n, double r, double theta, double z, bool includeOtherPols) {return {0.};}; | ||
virtual std::vector<double> GetTM_E(int l, int m, int n, double r, double theta, double z, bool includeOtherPols) {return {0.};}; | ||
virtual double CalculateDotProductFactor(int l, int m, int n, std::vector<double> tKassParticleXP, std::vector<double> aTE_E_normalized, double tThisEventNSamples) {return {0.};}; | ||
virtual double CalculateDotProductFactor(int bTE, int l, int m, int n, std::vector<double> tKassParticleXP, std::vector<double> aTE_E_normalized, double tThisEventNSamples) {return {0.};}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is the bTE required for the dot product calculation, given that the E-field and e- velocity are inputs? lmk your thoughts. |
||
virtual double GetDotProductFactor(std::vector<double> tKassParticleXP, std::vector<double> aTE_E_normalized, bool IntermediateFile) {return {0.};}; | ||
virtual bool InVolume(std::vector<double> tKassParticleXP){return false;}; | ||
virtual void CheckNormalization(int nModes){}; | ||
|
@@ -92,8 +92,8 @@ namespace locust | |
void SetNormFactorsTE(std::vector<std::vector<std::vector<double>>> aNormFactor); | ||
std::vector<std::vector<std::vector<double>>> GetNormFactorsTM(); | ||
void SetNormFactorsTM(std::vector<std::vector<std::vector<double>>> aNormFactor); | ||
std::vector<std::vector<std::vector<double>>> GetAvgDotProductFactor(); | ||
void SetAvgDotProductFactor(std::vector<std::vector<std::vector<double>>> aFactor); | ||
std::vector<std::vector<std::vector<std::vector<double>>>> GetAvgDotProductFactor(); | ||
void SetAvgDotProductFactor(std::vector<std::vector<std::vector<std::vector<double>>>> aFactor); | ||
double GetCentralFrequency(); | ||
void SetCentralFrequency( double aCentralFrequency ); | ||
int GetNPixels(); | ||
|
@@ -129,7 +129,7 @@ namespace locust | |
double fY; | ||
double fCENTER_TO_SHORT; | ||
double fCENTER_TO_ANTENNA; | ||
std::vector<std::vector<std::vector<double>>> fAvgDotProductFactor; | ||
std::vector<std::vector<std::vector<std::vector<double>>>> fAvgDotProductFactor; | ||
bool fPlotModeMaps; | ||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is where I am wondering if we could possibly just upgrade to your fFilterComplexArray, and delete references to the existing fFilterComplex.