45 using namespace triplets;
53 if (type==TripletType::_comoving_theta_)
return move(unique_ptr<Triplet1D_comoving_theta>{
new Triplet1D_comoving_theta(r12, r12_binSize, r13, r13_binSize, nbins)});
54 else if (type==TripletType::_comoving_side_)
return move(unique_ptr<Triplet1D_comoving_side>{
new Triplet1D_comoving_side(r12, r12_binSize, r13, r13_binSize, nbins)});
55 else if (type==TripletType::_comoving_costheta_)
return move(unique_ptr<Triplet1D_comoving_costheta>{
new Triplet1D_comoving_costheta(r12, r12_binSize, r13, r13_binSize, nbins)});
56 else if (type==TripletType::_multipoles_direct_)
return move(unique_ptr<Triplet1D_multipoles_direct>{
new Triplet1D_multipoles_direct(r12, r12_binSize, r13, r13_binSize, nbins)});
58 else ErrorCBL(
"no such type of object!",
"Create",
"Triple.cpp");
70 for (
size_t i=0; i<m_TT1D.size(); i++)
71 m_TT1D[i] += ww*tt->TT1D(i);
81 m_min = (m_r13-0.5*m_r13_binSize)-(m_r12+0.5*m_r12_binSize);
82 m_max = (m_r13+0.5*m_r13_binSize)+(m_r12+0.5*m_r12_binSize);
83 m_binSize = (m_max-m_min)/m_nbins;
85 m_scale.resize(m_nbins);
86 for (
int i=0; i<m_nbins; i++)
87 m_scale[i] = m_min+(i+0.5)*m_binSize;
98 klin = int((r23-m_min)/m_binSize);
114 (void)r12; (void)r13;
116 int klin = int((r23-m_min)/m_binSize);
129 double x2 = obj2->xx(), y2 = obj2->yy(), z2 = obj2->zz(), w2 = obj2->weight();
130 double x3 = obj3->xx(), y3 = obj3->yy(), z3 = obj3->zz(), w3 = obj3->weight();
136 int klin = int((r23-m_min)/m_binSize);
150 m_scale.resize(m_nbins);
151 for (
int i=0; i<m_nbins; i++)
152 m_scale[i] = (i+0.5)*m_binSize/
par::pi;
161 double shift_angle = ((((r12*r12)+(r13*r13)-(r23*r23))/(2*r12*r13))<0.) ? 0.00000001 : -0.00000001;
162 double angle = (abs((((r12*r12)+(r13*r13)-(r23*r23))/(2*r12*r13)))>0.99999999) ? acos((((r12*r12)+(r13*r13)-(r23*r23))/(2*r12*r13))+shift_angle) : acos(((r12*r12)+(r13*r13)-(r23*r23))/(2*r12*r13));
164 klin = int(angle/m_binSize);
183 double shift_angle = ((((r12*r12)+(r13*r13)-(r23*r23))/(2*r12*r13))<0.) ? 0.00000001 : -0.00000001;
184 double angle = (abs((((r12*r12)+(r13*r13)-(r23*r23))/(2*r12*r13)))>0.99999999) ? acos((((r12*r12)+(r13*r13)-(r23*r23))/(2*r12*r13))+shift_angle) : acos(((r12*r12)+(r13*r13)-(r23*r23))/(2*r12*r13));
186 int klin = int(angle/m_binSize);
197 double x1 = obj1->xx(), y1 = obj1->yy(), z1 = obj1->zz(), w1 = obj1->weight();
198 double x2 = obj2->xx(), y2 = obj2->yy(), z2 = obj2->zz(), w2 = obj2->weight();
199 double x3 = obj3->xx(), y3 = obj3->yy(), z3 = obj3->zz(), w3 = obj3->weight();
205 double ww = w1*w2*w3;
207 double shift_angle = ((((r12*r12)+(r13*r13)-(r23*r23))/(2*r12*r13))<0.) ? 0.00000001 : -0.00000001;
208 double angle = (abs((((r12*r12)+(r13*r13)-(r23*r23))/(2*r12*r13)))>0.99999999) ? acos((((r12*r12)+(r13*r13)-(r23*r23))/(2*r12*r13))+shift_angle) : acos(((r12*r12)+(r13*r13)-(r23*r23))/(2*r12*r13));
210 int klin = int(angle/m_binSize);
222 m_binSize = 2./m_nbins;
224 m_scale.resize(m_nbins);
225 for (
int i=0; i<m_nbins; i++)
226 m_scale[i] = (i+0.5)*m_binSize-1;
235 double shift_angle = ((((r12*r12)+(r13*r13)-(r23*r23))/(2*r12*r13))<0.) ? 0.00000001 : -0.00000001;
236 double cos_angle = (abs((((r12*r12)+(r13*r13)-(r23*r23))/(2*r12*r13)))>0.99999999) ? (((r12*r12)+(r13*r13)-(r23*r23))/(2*r12*r13))+shift_angle : ((r12*r12)+(r13*r13)-(r23*r23))/(2*r12*r13);
238 klin = int((cos_angle+1)/m_binSize);
257 double shift_angle = ((((r12*r12)+(r13*r13)-(r23*r23))/(2*r12*r13))<0.) ? 0.00000001 : -0.00000001;
258 double cos_angle = (abs((((r12*r12)+(r13*r13)-(r23*r23))/(2*r12*r13)))>0.99999999) ? (((r12*r12)+(r13*r13)-(r23*r23))/(2*r12*r13))+shift_angle : ((r12*r12)+(r13*r13)-(r23*r23))/(2*r12*r13);
260 int klin = int((cos_angle+1)/m_binSize);
271 double x1 = obj1->xx(), y1 = obj1->yy(), z1 = obj1->zz(), w1 = obj1->weight();
272 double x2 = obj2->xx(), y2 = obj2->yy(), z2 = obj2->zz(), w2 = obj2->weight();
273 double x3 = obj3->xx(), y3 = obj3->yy(), z3 = obj3->zz(), w3 = obj3->weight();
279 double ww = w1*w2*w3;
281 double shift_angle = ((((r12*r12)+(r13*r13)-(r23*r23))/(2*r12*r13))<0.) ? 0.00000001 : -0.00000001;
282 double cos_angle = (abs((((r12*r12)+(r13*r13)-(r23*r23))/(2*r12*r13)))>0.99999999) ? (((r12*r12)+(r13*r13)-(r23*r23))/(2*r12*r13))+shift_angle : ((r12*r12)+(r13*r13)-(r23*r23))/(2*r12*r13);
284 int klin = int((cos_angle+1)/m_binSize);
295 m_scale.resize(m_nbins);
296 for (
int i=0; i<m_nbins; i++)
308 double cos_angle = ((r12*r12)+(r13*r13)-(r23*r23))/(2*r12*r13);
310 for(
int i=0; i<m_nbins; i++)
321 double x1 = obj1->xx(), y1 = obj1->yy(), z1 = obj1->zz(), w1 = obj1->weight();
322 double x2 = obj2->xx(), y2 = obj2->yy(), z2 = obj2->zz(), w2 = obj2->weight();
323 double x3 = obj3->xx(), y3 = obj3->yy(), z3 = obj3->zz(), w3 = obj3->weight();
329 double ww = w1*w2*w3;
334 double cos_angle = ((r12*r12)+(r13*r13)-(r23*r23))/(2*r12*r13);
336 for(
int i=0; i<m_nbins; i++)
The class Triplet1D_comoving_costheta.
void put(const double r12, const double r13, const double r23, const double ww=1.) override
estimate the distance between three objects and update the triplet vectors accordingly
void set_parameters() override
set the binning parameters
void set_triplet(const int klin, const double ww=1.) override
update the triplet
void get_triplet(const double r12, const double r13, const double r23, int &klin) override
estimate the distance between two objects and update the triplet vectors accordingly
The class Triplet1D_comoving_side.
void set_triplet(const int klin, const double ww=1.) override
update the triplet
void put(const double r12, const double r13, const double r23, const double ww=1.) override
estimate the distance between three objects and update the triplet vectors accordingly
void set_parameters() override
set the binning parameters
void get_triplet(const double r12, const double r13, const double r23, int &klin) override
estimate the distance between two objects and update the triplet vectors accordingly
The class Triplet1D_comoving_theta.
void set_triplet(const int klin, const double ww=1.) override
update the triplet
void get_triplet(const double r12, const double r13, const double r23, int &klin) override
estimate the distance between two objects and update the triplet vectors accordingly
void set_parameters() override
set the binning parameters
void put(const double r12, const double r13, const double r23, const double ww=1.) override
estimate the distance between three objects and update the triplet vectors accordingly
The class Triplet1D_multipoles_direct.
void set_parameters() override
set the binning parameters
void put(const double r12, const double r13, const double r23, const double ww=1.) override
estimate the distance between three objects and update the triplet vectors accordingly
void Sum(const std::shared_ptr< Triplet > tt, const double ww=1) override
sum the number of triplets
static std::shared_ptr< Triplet > Create(const TripletType type, const double r12, const double r12_binSize, const double r13, const double r13_binSize, const int nbins)
static factory used to construct triplets of any type
static const double pi
: the ratio of a circle's circumference to its diameter
TripletType
the triplet type
The global namespace of the CosmoBolognaLib
double Euclidean_distance(const double x1, const double x2, const double y1, const double y2, const double z1, const double z2)
the Euclidean distance in 3D relative to the origin (0,0,0), i.e. the Euclidean norm
int ErrorCBL(const std::string msg, const std::string functionCBL, const std::string fileCBL, const cbl::glob::ExitCode exitCode=cbl::glob::ExitCode::_error_)
throw an exception: it is used for handling exceptions inside the CosmoBolognaLib
double legendre_polynomial(const double mu, const int l)
the order l Legendre polynomial