Skip to content
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

Develop #25

Open
wants to merge 16 commits into
base: develop
Choose a base branch
from
5 changes: 3 additions & 2 deletions examples/phys/FlatteLineShape.inl
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ public:
Flatte() = delete;

Flatte(hydra::Parameter const& c_re, hydra::Parameter const& c_im, hydra::Parameter const& mean,
std::vector<std::vector<double>> const& params,double mother_mass, double daugther1_mass, double daugther2_mass,
std::array<std::array<double,3>,2> const &params,double mother_mass, double daugther1_mass, double daugther2_mass,
double daugther3_mass, double radi):
hydra::BaseFunctor<Flatte<CHANNEL,L>, hydra::complex<double>, 3>{c_re, c_im, mean},
fLineShape(mean,params,mother_mass,daugther1_mass,daugther2_mass,daugther3_mass,radi)
Expand Down Expand Up @@ -360,7 +360,8 @@ int main(int argv, char** argc)

//Flatté
double pi_MASS = 0.13957018;
std::vector<std::vector<double>> params = {{pi_MASS,pi_MASS,f0_rho1},{Kplus_MASS,Kplus_MASS,f0_rho2}};
std::array<std::array<double,3>,2> params = {{{pi_MASS,pi_MASS,f0_rho1},{Kplus_MASS,Kplus_MASS,f0_rho2}}};
//std::vector<std::vector<double>> params = {{pi_MASS,pi_MASS,f0_rho1},{Kplus_MASS,Kplus_MASS,f0_rho2}};

//======================================================
//Phi
Expand Down
38 changes: 20 additions & 18 deletions hydra/functions/FlatteLineShape.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ namespace hydra {
* @param radi decay vertex radio.
*/
FlatteLineShape(hydra::Parameter const& mean,
std::vector<std::vector<double>> params,
std::array<std::array<double,3>,2> params,
double mother_mass,
double daugther1_mass, double daugther2_mass, double daugther3_mass,
double radi) :
Expand Down Expand Up @@ -121,12 +121,12 @@ namespace hydra {
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

L.110 : BaseFunctor<FlatteLineShape<CHANNEL, ArgIndex>, hydra::complex, 7>::operator=(other);**
This should be 1 -------------------------------------------------------------------------------------------^^^

This assignment operator can't compile either.


__hydra_host__ __hydra_device__ inline
std::vector<std::vector<double>>GetParams() const {
std::array<std::array<double,3>,2> GetParams() const {
return fParams;
}

__hydra_host__ __hydra_device__ inline
void SetDaughter1Mass(std::vector<std::vector<double>> _params) {
void SetDaughter1Mass(std::array<std::array<double,3>,2> _params) {
fParams = _params;
}

Expand Down Expand Up @@ -204,32 +204,34 @@ namespace hydra {
}

private:

__hydra_host__ __hydra_device__ inline
hydra::complex<double>
sqrtCplx(const double in) const { return (in > 0) ? hydra::complex<double>(::sqrt(in), 0.0) : hydra::complex<double>(0.0, ::sqrt(-in)); }

__hydra_host__ __hydra_device__ inline
hydra::complex<double>
LineShape(const double s, const double resonance_mass) const {

hydra::complex<double> w;
__hydra_host__ __hydra_device__ inline hydra::complex<double> LineShape(const double s, const double resonance_mass) const {

for(size_t i = 0; i < fParams.size() ; i++) {
hydra::complex<double> w;

double m1a = fParams[i][0];
double m1b = fParams[i][1];
double g = fParams[i][2];

w += g * g * sqrtCplx((1 - (m1a - m1b) * (m1a - m1b) / s*s ) *
(1 - (m1a + m1b) * (m1a + m1b) / s*s ));

}
for(size_t i = 0; i < fParams.size() ; i++) {

double m1a = fParams[i][0];
double m1b = fParams[i][1];
double g = fParams[i][2];

w += g * g * sqrtCplx((1 - (m1a - m1b) * (m1a - m1b) / s*s ) *
(1 - (m1a + m1b) * (m1a + m1b) / s*s ));

}

hydra::complex<double> denom = resonance_mass - s*s - hydra::complex<double>(0.0,1.0)*w;
hydra::complex<double> denom = resonance_mass - s*s - hydra::complex<double>(0.0,1.0)*w;

hydra::complex<double> ampl = hydra::complex<double>(1.0,0.0)/denom;
hydra::complex<double> ampl = hydra::complex<double>(1.0,0.0)/denom;

return ampl;
return ampl;

}

Expand All @@ -238,7 +240,7 @@ for(size_t i = 0; i < fParams.size() ; i++) {
double fBachelorMass;
double fMotherMass;
double fRadi;
std::vector<std::vector<double>> fParams;
std::array<std::array<double,3>,2> fParams;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This member, std::array<std::array<double,3>,2> fParams; is not copyable in CUDA. AFAIK, there is no implementation of std::array in CUDA. Please, use double fParams[6]


};

Expand Down