diff --git a/inc/TRestAxionField.h b/inc/TRestAxionField.h index 7f13ed46..83cd950c 100644 --- a/inc/TRestAxionField.h +++ b/inc/TRestAxionField.h @@ -80,7 +80,9 @@ class TRestAxionField : public TObject { Double_t GammaTransmissionFWHM(Double_t step = 0.00001); - std::vector> GetMassDensityScanning(std::string gasName = "He", Double_t maMax = 0.15, Double_t rampDown = 5.0); + std::vector> GetMassDensityScanning(std::string gasName = "He", + Double_t maMax = 0.15, + Double_t rampDown = 5.0); TRestAxionField(); ~TRestAxionField(); diff --git a/src/TRestAxionField.cxx b/src/TRestAxionField.cxx index 5e473c7b..e5de78e4 100644 --- a/src/TRestAxionField.cxx +++ b/src/TRestAxionField.cxx @@ -483,41 +483,42 @@ Double_t TRestAxionField::GammaTransmissionFWHM(Double_t step) { /// /// For additional info see PR: https://github.com/rest-for-physics/axionlib/pull/78 /// -std::vector> TRestAxionField::GetMassDensityScanning(std::string gasName, double maMax, double rampDown) { +std::vector> TRestAxionField::GetMassDensityScanning(std::string gasName, + double maMax, + double rampDown) { std::vector> massDensityPairs; - // Storing the gas pointer, if there was one - TRestAxionBufferGas *previousGas = nullptr; - if( fBufferGas ) - { - previousGas = fBufferGas; - fBufferGas = nullptr; - } + // Storing the gas pointer, if there was one + TRestAxionBufferGas* previousGas = nullptr; + if (fBufferGas) { + previousGas = fBufferGas; + fBufferGas = nullptr; + } - // We are in vacuum now - double firstMass = GammaTransmissionFWHM()/2; + // We are in vacuum now + double firstMass = GammaTransmissionFWHM() / 2; TRestAxionBufferGas gas; - gas.SetGasDensity(gasName, 0); - AssignBufferGas(&gas); // We are in gas now + gas.SetGasDensity(gasName, 0); + AssignBufferGas(&gas); // We are in gas now - Double_t ma = firstMass; - Double_t density = gas.GetDensityForMass(firstMass); + Double_t ma = firstMass; + Double_t density = gas.GetDensityForMass(firstMass); - /// Setting mass-density pair for the first step - massDensityPairs.push_back(std::make_pair(ma, density ) ); + /// Setting mass-density pair for the first step + massDensityPairs.push_back(std::make_pair(ma, density)); - while (ma < maMax) - { - Double_t factor = TMath::Exp( - ma*rampDown ) + 1; - gas.SetGasDensity(gasName, density); + while (ma < maMax) { + Double_t factor = TMath::Exp(-ma * rampDown) + 1; + gas.SetGasDensity(gasName, density); - ma += GammaTransmissionFWHM()/factor; - std::cout << "Mass : " << ma << " Factor : " << factor << " FWHM: " << GammaTransmissionFWHM()/factor << std::endl; - density = gas.GetDensityForMass(ma); + ma += GammaTransmissionFWHM() / factor; + std::cout << "Mass : " << ma << " Factor : " << factor + << " FWHM: " << GammaTransmissionFWHM() / factor << std::endl; + density = gas.GetDensityForMass(ma); - massDensityPairs.push_back(std::make_pair(ma, density )); - } + massDensityPairs.push_back(std::make_pair(ma, density)); + } // Recovering back the gas that was defined before calling this method fBufferGas = previousGas;