本文整理汇总了C++中EventWorkspace_sptr::constInstrumentParameters方法的典型用法代码示例。如果您正苦于以下问题:C++ EventWorkspace_sptr::constInstrumentParameters方法的具体用法?C++ EventWorkspace_sptr::constInstrumentParameters怎么用?C++ EventWorkspace_sptr::constInstrumentParameters使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventWorkspace_sptr
的用法示例。
在下文中一共展示了EventWorkspace_sptr::constInstrumentParameters方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: execEvent
void CorrectKiKf::execEvent()
{
g_log.information("Processing event workspace");
const MatrixWorkspace_const_sptr matrixInputWS = this->getProperty("InputWorkspace");
EventWorkspace_const_sptr inputWS= boost::dynamic_pointer_cast<const EventWorkspace>(matrixInputWS);
// generate the output workspace pointer
API::MatrixWorkspace_sptr matrixOutputWS = this->getProperty("OutputWorkspace");
EventWorkspace_sptr outputWS;
if (matrixOutputWS == matrixInputWS)
outputWS = boost::dynamic_pointer_cast<EventWorkspace>(matrixOutputWS);
else
{
//Make a brand new EventWorkspace
outputWS = boost::dynamic_pointer_cast<EventWorkspace>(
API::WorkspaceFactory::Instance().create("EventWorkspace", inputWS->getNumberHistograms(), 2, 1));
//Copy geometry over.
API::WorkspaceFactory::Instance().initializeFromParent(inputWS, outputWS, false);
//You need to copy over the data as well.
outputWS->copyDataFrom( (*inputWS) );
//Cast to the matrixOutputWS and save it
matrixOutputWS = boost::dynamic_pointer_cast<MatrixWorkspace>(outputWS);
this->setProperty("OutputWorkspace", matrixOutputWS);
}
const std::string emodeStr = getProperty("EMode");
double efixedProp = getProperty("EFixed"),efixed;
if( efixedProp == EMPTY_DBL() )
{
if (emodeStr == "Direct")
{
// Check if it has been store on the run object for this workspace
if( this->inputWS->run().hasProperty("Ei"))
{
Kernel::Property* eiprop = this->inputWS->run().getProperty("Ei");
efixedProp = boost::lexical_cast<double>(eiprop->value());
g_log.debug() << "Using stored Ei value " << efixedProp << "\n";
}
else
{
throw std::invalid_argument("No Ei value has been set or stored within the run information.");
}
}
else
{
// If not specified, will try to get Ef from the parameter file for indirect geometry,
// but it will be done for each spectrum separately, in case of different analyzer crystals
}
}
// Get the parameter map
const ParameterMap& pmap = outputWS->constInstrumentParameters();
int64_t numHistograms = static_cast<int64_t>(inputWS->getNumberHistograms());
API::Progress prog = API::Progress(this, 0.0, 1.0, numHistograms);
PARALLEL_FOR1(outputWS)
for (int64_t i=0; i < numHistograms; ++i)
{
PARALLEL_START_INTERUPT_REGION
double Efi = 0;
// Now get the detector object for this histogram to check if monitor
// or to get Ef for indirect geometry
if (emodeStr == "Indirect")
{
if ( efixedProp != EMPTY_DBL()) Efi = efixedProp;
else try
{
IDetector_const_sptr det = inputWS->getDetector(i);
if (!det->isMonitor())
{
try
{
Parameter_sptr par = pmap.getRecursive(det.get(),"Efixed");
if (par)
{
Efi = par->value<double>();
g_log.debug() << "Detector: " << det->getID() << " EFixed: " << Efi << "\n";
}
}
catch (std::runtime_error&) { /* Throws if a DetectorGroup, use single provided value */ }
}
}
catch(std::runtime_error&) { g_log.information() << "Workspace Index " << i << ": cannot find detector" << "\n"; }
}
if (emodeStr == "Indirect") efixed=Efi;
else efixed=efixedProp;
//Do the correction
EventList *evlist=outputWS->getEventListPtr(i);
switch (evlist->getEventType())
{
case TOF:
//Switch to weights if needed.
evlist->switchTo(WEIGHTED);
//.........这里部分代码省略.........