114 #include "TRestWimpSensitivity.h"
115 #include "TRestWimpUtils.h"
164 TiXmlElement* ElementDef =
GetElement(
"addElement");
181 const double crossSection) {
182 std::map<std::string, TH1D*> recoilMap;
187 std::string histName =
"RecoilSpc_" + std::string(nucl.fNucleusName);
190 for (
int i = 1; i < recoilSpc->GetNbinsX(); i++) {
191 const double recoilEnergy = recoilSpc->GetBinCenter(i);
192 const double recoilRate =
193 TRestWimpUtils::GetRecoilRate(wimpMass, crossSection, recoilEnergy, nucl.fAnum,
fLabVelocity,
195 recoilSpc->SetBinContent(i, recoilRate);
197 recoilMap[std::string(nucl.fNucleusName)] = recoilSpc;
208 RESTError <<
"Please add at least one element to the rml file" <<
RESTendl;
217 double bckCounts = 0;
219 for (
int i = 1; i < recoilSpc.GetNbinsX(); i++) {
220 const double en = recoilSpc.GetBinCenter(i);
226 double signalCounts = 0, prob = 0;
230 for (
int mu = signalCounts; mu < (signalCounts + bckCounts + 10000); mu++) {
231 if (bckCounts <= 1.e3)
232 prob += TMath::Poisson(mu + bckCounts, bckCounts);
233 else if (bckCounts > 1.e3)
234 prob += TMath::Gaus(mu + bckCounts, bckCounts, TMath::Sqrt(bckCounts),
true);
237 }
while (fabs(prob - 0.1) > 0.01 && signalCounts < 1E6);
240 const double crossSection = 1E-45;
245 for (
int i = 1; i < recoilSpc.GetNbinsX(); i++) {
246 const double recoilEnergy = recoilSpc.GetBinCenter(i);
247 const double recoilRate =
248 TRestWimpUtils::GetRecoilRate(wimpMass, crossSection, recoilEnergy, nucl.fAnum,
fLabVelocity,
250 recoilSpc.SetBinContent(i, recoilRate);
253 for (
int i = 1; i < recoilSpc.GetNbinsX(); i++) {
254 double recoilEnergy = recoilSpc.GetBinCenter(i);
257 recoilEnergy *=
quenchingFactor[std::string(nucl.fNucleusName)]->GetBinContent(i);
264 if (nMeas == 0)
return 0;
266 const double sensitivity = signalCounts * 1E-45 / (nMeas *
fExposure);
278 std::cout <<
"Calculating quenching factor " << std::endl;
283 std::string histName =
"QF_" + std::string(nucl.fNucleusName);
286 for (
int i = 1; i < QF->GetNbinsX(); i++) {
287 const double recoilEnergy = QF->GetBinCenter(i);
288 const double qF = TRestWimpUtils::GetQuenchingFactor(recoilEnergy, nucl.fAnum, nucl.fZnum);
289 if (!isnan(qF) && qF > 0)
290 QF->SetBinContent(i, 1. / qF);
292 QF->SetBinContent(i, 0);
303 std::stringstream ss;
304 ss <<
"WimpSensitivity_";
306 for (
auto& nucl :
fNuclei) ss << nucl.fNucleusName <<
"_" << nucl.fAbundance <<
"_";
321 std::cout <<
"Output File " << ss.str() << std::endl;
331 std::map<std::string, TH1D*> formFactor;
336 std::string histName =
"FF_" + std::string(nucl.fNucleusName);
339 for (
int i = 1; i < FF->GetNbinsX(); i++) {
340 const double recoilEnergy = FF->GetBinCenter(i);
341 const double helmFF = TRestWimpUtils::GetHelmFormFactor(recoilEnergy, nucl.fAnum);
342 FF->SetBinContent(i, helmFF * helmFF);
344 formFactor[std::string(nucl.fNucleusName)] = FF;
357 for (
auto& nucl :
fNuclei) nucl.PrintNucleus();
369 RESTMetadata <<
"+++++" <<
RESTendl;
A class to store different nucleus parameters.
Double_t fAnum
Atomic number in amus.
TString fNucleusName
Nucleus name.
Double_t fAbundance
Abundance, in mass percentage.
Int_t fZnum
Number of protons.
void Initialize() override
Initialization of TRestWimpSensitivity members.
Double_t fExposure
Detector exposure in kg*day.
~TRestWimpSensitivity()
Default destructor.
void InitFromConfigFile() override
Initialization of TRestWimpSensitivity members through a RML file.
std::map< std::string, TH1D * > GetRecoilSpectra(const double wimpMass, const double crossSection)
Get recoil spectra for a given WIMP mass and cross section.
Double_t fEscapeVelocity
WIMP escape velocity (km/s)
TVector2 fEnergySpectra
Energy range for the recoil spectra in keV.
Double_t fEnergySpectraStep
Energy step for the recoil spectra in keV.
void PrintMetadata() override
Prints on screen the details about WIMP parameters, stored in TRestWimpSensitivity.
const Double_t GetSensitivity(const double wimpMass)
Get sensitivity for a give WIMP mass.
TVector2 fEnergyRange
Energy range for the sensitivity prospects in keV.
Double_t fBackground
Detector background level in c/keV/day.
std::map< std::string, TH1D * > quenchingFactor
Map containing quenching factor for a nucleus.
void CalculateQuenchingFactor()
Calculate Quenching factor and stores in a map.
Bool_t fUseQuenchingFactor
Use or not quenching factor.
Double_t fRmsVelocity
WIMP RMS velocity (km/s)
Double_t fWimpDensity
WIMP density in GeV/cm3.
Double_t fLabVelocity
WIMP velocity in the lab (Earth) frame reference in km/s.
void ReadNuclei()
Initialization of TRestWimpSensitivity members through a RML file.
TRestWimpSensitivity(const char *configFilename, const std::string &name="")
Constructor loading data from a config file.
std::map< std::string, TH1D * > GetFormFactor()
Return a map of histograms with the Form Factor of the different elements.
const std::string BuildOutputFileName(const std::string &extension=".txt")
Return output file format with different parameters used in the calculation.
std::vector< TRestWimpNucleus > fNuclei
A vector containing TRestWimpNucleus with different nucleus parameters.
Double_t StringToDouble(std::string in)
Gets a double from a string.
Int_t StringToInteger(std::string in)
Gets an integer from a string.