Skip to content

Commit

Permalink
Re #7452 Use duration for normalisation
Browse files Browse the repository at this point in the history
  • Loading branch information
mdoucet authored and Ricardo Leal committed Feb 3, 2014
1 parent d2d2042 commit 89d9ee4
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 15 deletions.
3 changes: 3 additions & 0 deletions Code/Mantid/Framework/DataHandling/src/LoadILLSANS.cpp
Expand Up @@ -487,6 +487,9 @@ void LoadILLSANS::loadMetaData(const NeXus::NXEntry &entry, const std::string &i
end_time = m_loader.dateTimeInIsoFormat(end_time);
runDetails.addProperty("run_end", end_time);

double duration = entry.getFloat("duration");
runDetails.addProperty("timer", duration);

double wavelength = entry.getFloat(instrumentNamePath + "/selector/wavelength");
g_log.debug()<< "Wavelength found in the nexus file: " << wavelength << std::endl;

Expand Down
Expand Up @@ -151,14 +151,34 @@ void EQSANSDarkCurrentSubtraction::exec()
progress.report(3, "Loaded dark current");

// Normalize the dark current and data to counting time
Mantid::Kernel::Property* prop = inputWS->run().getProperty("proton_charge");
Mantid::Kernel::TimeSeriesProperty<double>* dp = dynamic_cast<Mantid::Kernel::TimeSeriesProperty<double>* >(prop);
double duration = dp->getStatistics().duration;

prop = darkWS->run().getProperty("proton_charge");
dp = dynamic_cast<Mantid::Kernel::TimeSeriesProperty<double>* >(prop);
double dark_duration = dp->getStatistics().duration;
double scaling_factor = duration/dark_duration;
double scaling_factor = 1.0;
if (inputWS->run().hasProperty("proton_charge"))
{
Mantid::Kernel::Property* prop = inputWS->run().getProperty("proton_charge");
Mantid::Kernel::TimeSeriesProperty<double>* dp = dynamic_cast<Mantid::Kernel::TimeSeriesProperty<double>* >(prop);
double duration = dp->getStatistics().duration;

prop = darkWS->run().getProperty("proton_charge");
dp = dynamic_cast<Mantid::Kernel::TimeSeriesProperty<double>* >(prop);
double dark_duration = dp->getStatistics().duration;
scaling_factor = duration/dark_duration;
}
else if (inputWS->run().hasProperty("timer"))
{
Mantid::Kernel::Property* prop = inputWS->run().getProperty("timer");
Mantid::Kernel::PropertyWithValue<double>* dp = dynamic_cast<Mantid::Kernel::PropertyWithValue<double>* >(prop);
double duration = *dp;

prop = darkWS->run().getProperty("timer");
dp = dynamic_cast<Mantid::Kernel::PropertyWithValue<double>* >(prop);
double dark_duration = *dp;
scaling_factor = duration/dark_duration;
}
else
{
output_message += "\n Could not find proton charge or duration in sample logs";
g_log.error() << "ERROR: Could not find proton charge or duration in sample logs" << std::endl;
};

progress.report("Scaling dark current");

Expand Down
Expand Up @@ -101,7 +101,7 @@ void SetupILLD33Reduction::init()
// The data will be normalised to the monitor counts
incidentBeamNormOptions.push_back("Monitor");
// The data will be normalised to the total charge only (no beam profile)
incidentBeamNormOptions.push_back("Charge");
incidentBeamNormOptions.push_back("Timer");
this->declareProperty("Normalisation", "None",
boost::make_shared<StringListValidator>(incidentBeamNormOptions),
"Options for data normalisation");
Expand Down Expand Up @@ -454,12 +454,9 @@ void SetupILLD33Reduction::exec()

if (!boost::contains(normalization, "None")) {
// If we normalize to monitor, force the loading of monitor data
IAlgorithm_sptr normAlg = createChildAlgorithm("EQSANSNormalise");
if (boost::contains(normalization, "Charge"))
{
normAlg->setProperty("NormaliseToBeam", false);
}
normAlg->setPropertyValue("ReductionProperties", reductionManagerName);
IAlgorithm_sptr normAlg = createChildAlgorithm("HFIRSANSNormalise");
normAlg->setProperty("NormalisationType", normalization);
//normAlg->setPropertyValue("ReductionProperties", reductionManagerName);
AlgorithmProperty *algProp = new AlgorithmProperty("NormaliseAlgorithm");
algProp->setValue(normAlg->toString());
reductionManager->declareProperty(algProp);
Expand Down

0 comments on commit 89d9ee4

Please sign in to comment.