예제 #1
0
    DataObjects::TableWorkspace_sptr  ConvertToMDParent::runPreprocessDetectorsToMDChildUpdatingMasks(Mantid::API::MatrixWorkspace_const_sptr InWS2D,
      const std::string &OutWSName,const std::string &dEModeRequested,Kernel::DeltaEMode::Type &Emode)
    {
      // prospective result
      DataObjects::TableWorkspace_sptr TargTableWS;

      // if input workspace does not exist in analysis data service, we have to add it there to work with the Child Algorithm 
      std::string InWSName = InWS2D->getName();
      if(!API::AnalysisDataService::Instance().doesExist(InWSName))
      {
        throw std::runtime_error("Can not retrieve input matrix workspace "+InWSName+" from the analysis data service");
      }

      Mantid::API::Algorithm_sptr childAlg = createChildAlgorithm("PreprocessDetectorsToMD",0.,1.);
      if(!childAlg)throw(std::runtime_error("Can not create child ChildAlgorithm to preprocess detectors"));
      childAlg->setProperty("InputWorkspace",InWSName);
      childAlg->setProperty("OutputWorkspace",OutWSName);
      childAlg->setProperty("GetMaskState",true);
      childAlg->setProperty("UpdateMasksInfo",true);
      childAlg->setProperty("OutputWorkspace",OutWSName);

      // check and get energy conversion mode to define additional ChildAlgorithm parameters
      Emode = Kernel::DeltaEMode().fromString(dEModeRequested);
      if(Emode == Kernel::DeltaEMode::Indirect) 
        childAlg->setProperty("GetEFixed",true); 


      childAlg->execute();
      if(!childAlg->isExecuted())throw(std::runtime_error("Can not properly execute child algorithm PreprocessDetectorsToMD"));

      TargTableWS = childAlg->getProperty("OutputWorkspace");
      if(!TargTableWS)throw(std::runtime_error("Can not retrieve results of child algorithm PreprocessDetectorsToMD"));

      return TargTableWS;
    }