-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from dglazier/ampblend
Ampblend
- Loading branch information
Showing
4 changed files
with
99 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Class to sum up any number of generic amplitudes and build observables. | ||
// Amplitudes are loaded up in a vector and summed incoherently | ||
// | ||
// Author: Daniel Winney (2020) | ||
// Affiliation: Joint Physics Analysis Center (JPAC) | ||
// Email: [email protected] | ||
// --------------------------------------------------------------------------- | ||
|
||
#include "amplitude_blend.hpp" | ||
|
||
// Evaluate the sum for given set of helicites, and mandelstam invariant s and t | ||
std::complex<double> jpacPhoto::amplitude_blend::helicity_amplitude(std::array<int, 4> helicities, double s, double t) | ||
{ | ||
|
||
int index = find_helicity(helicities, _kinematics->_jp[0], _kinematics->_mB); | ||
|
||
if(s<_low_max){ | ||
_amp_low->check_cache(s, t); | ||
return _amp_low->_cached_helicity_amplitude[index]; | ||
} | ||
else if(s>_high_min){ | ||
_amp_high->check_cache(s, t); | ||
return _amp_high->_cached_helicity_amplitude[index]; | ||
} | ||
else{ | ||
|
||
_amp_low->check_cache(s, t); | ||
_amp_high->check_cache(s, t); | ||
|
||
double blend_range= _high_min - _low_max; | ||
double fraction_low = 1 - (s-_low_max)/blend_range; | ||
|
||
auto low_contrib = _amp_low->_cached_helicity_amplitude[index] * fraction_low; | ||
auto high_contrib = _amp_high->_cached_helicity_amplitude[index] * (1 - fraction_low); | ||
|
||
return low_contrib + high_contrib ; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// Class to sum up any number of generic amplitudes and build observables. | ||
// Amplitudes are loaded up in a vector and summed incoherently | ||
// | ||
// Author: Daniel Winney (2020) | ||
// Affiliation: Joint Physics Analysis Center (JPAC) | ||
// Email: [email protected] | ||
// --------------------------------------------------------------------------- | ||
#pragma once | ||
|
||
#include "amplitudes/amplitude.hpp" | ||
|
||
// --------------------------------------------------------------------------- | ||
// The amplitude_blend class can take a vector of the above amplitude objects | ||
// and add them together to get observables! | ||
// --------------------------------------------------------------------------- | ||
|
||
namespace jpacPhoto | ||
{ | ||
class amplitude_blend : public amplitude | ||
{ | ||
private: | ||
// Store a vector of all the amplitudes you want to sum incoherently | ||
amplitude* _amp_low={nullptr}; | ||
amplitude* _amp_high={nullptr}; | ||
|
||
double _low_max = {0}; | ||
double _high_min = {0}; | ||
|
||
public: | ||
// Empty constructor | ||
amplitude_blend(reaction_kinematics * xkinem, amplitude* amp_low, double lowTo, amplitude* amp_high,double highFrom,std::string identifer = "amplitude_blend") | ||
: amplitude(xkinem, identifer), | ||
_amp_low{amp_low},_amp_high{amp_high}, | ||
_low_max{lowTo},_high_min{highFrom} | ||
{ | ||
if(lowTo>highFrom){ | ||
std::cerr<<"Error : amplitude_blend low limit "<<lowTo<<" greater then high"<<highFrom<<std::endl; | ||
exit(0); | ||
} | ||
_isSum = true; //kind of. Actually for cache purposes. | ||
}; | ||
|
||
//assume low amp allowedJP, | ||
inline std::vector<std::array<int,2>> allowedJP() | ||
{ | ||
return _amp_low->allowedJP(); | ||
}; | ||
|
||
// TODO: Add a set_params which timesi in one vector and allocates approriaten number of | ||
// params to each sub amplitude | ||
|
||
// Evaluate the sum for given set of helicites, energy, and cos | ||
std::complex<double> helicity_amplitude(std::array<int, 4> helicities, double s, double t); | ||
|
||
}; | ||
} | ||
|