44 using namespace catalogue;
45 using namespace chainmesh;
46 using namespace pairs;
47 using namespace measure;
48 using namespace twopt;
56 vector<double> rad(m_d1d2->nbins()), xi(m_d1d2->nbins(), -1.), error(m_d1d2->nbins(), 1000.);
59 int nD1 = (nData1>0) ? nData1 : m_data->nObjects();
62 int nD2 = (nData2>0) ? nData2 : m_data2->nObjects();
65 double nD1w = (nData1_weighted>0) ? nData1_weighted : m_data->weightedN();
68 double nD2w = (nData2_weighted>0) ? nData2_weighted : m_data2->weightedN();
71 int nR = (nRandom>0) ? nRandom : m_random->nObjects();
74 double nRw = (nRandom_weighted>0) ? nRandom_weighted : m_random->weightedN();
77 double nD1D2i = 1./(nD1w*nD2w);
80 double nRRi = 1./(nRw*m_random_dilution_fraction*(nRw*m_random_dilution_fraction-1.)*0.5);
83 double nD1Ri = 1./(nD1w*nRw);
86 double nD2Ri = 1./(nD2w*nRw);
88 for (
int i=0; i<d1d2->nbins(); i++) {
90 rad[i] = d1d2->scale(i);
92 if (d1d2->PP1D_weighted(i)>0) {
94 if (rr->PP1D_weighted(i)<1.e-30)
95 ErrorCBL(
"there are no random objects in the bin "+
conv(i,
par::fINT)+
"; please, either increase the total number of random objects or enlarge the bin size!",
"correlation_SzapudiSzalayEstimator",
"TwoPointCorrelationCross1D.cpp");
98 double D1D2_norm = d1d2->PP1D_weighted(i)*nD1D2i;
101 double RR_norm = rr->PP1D_weighted(i)*nRRi;
104 double D1R_norm = d1r->PP1D_weighted(i)*nD1Ri;
107 double D2R_norm = d2r->PP1D_weighted(i)*nD2Ri;
110 xi[i] = max(-1., (D1D2_norm-D1R_norm-D2R_norm+RR_norm)/RR_norm);
113 error[i] = PoissonError(Estimator::_SzapudiSzalay_, d1d2->PP1D(i), rr->PP1D(i), d1r->PP1D(i), d2r->PP1D(i), nD1, nD2, nR);
118 return (!m_compute_extra_info) ? move(unique_ptr<data::Data1D>(
new data::Data1D(rad, xi, error))) : data_with_extra_info(d1d2, rad, xi, error);
The class TwoPointCorrelationCross1D.
std::shared_ptr< data::Data > correlation_SzapudiSzalayEstimator(const std::shared_ptr< pairs::Pair > d1d2, const std::shared_ptr< pairs::Pair > rr, const std::shared_ptr< pairs::Pair > d1r, const std::shared_ptr< pairs::Pair > d2r, const int nData1=0, const double nData1_weighted=0., const int nData2=0, const double nData2_weighted=0., const int nRandom=0, const double nRandom_weighted=0.) override
get a dataset containing the two-point cross correlation function measured with the Szapudi-Szalay es...
static const char fINT[]
conversion symbol for: int -> std::string
The global namespace of the CosmoBolognaLib
std::string conv(const T val, const char *fact)
convert a number to a std::string
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