QAbstractItemModel *prepareQuickSelectDialogData() { // GIVEN // a model with items auto model = new QStandardItemModel(this); auto inbox = new QStandardItem(QStringLiteral("Inbox")); auto workday = new QStandardItem(QStringLiteral("Workday")); auto projects= new QStandardItem(QStringLiteral("Projects")); auto contexts = new QStandardItem(QStringLiteral("Contexts")); auto structureNodeFlags = Qt::NoItemFlags; projects->setFlags(structureNodeFlags); contexts->setFlags(structureNodeFlags); // with items children auto projectChildOne = new QStandardItem(QStringLiteral("ProjectOne")); auto projectChildTwo = new QStandardItem(QStringLiteral("ProjectTwo")); projects->setChild(0, 0, projectChildOne); projects->setChild(1, 0,projectChildTwo); auto contextChildOne = new QStandardItem(QStringLiteral("ContextOne")); auto contextChildTwo = new QStandardItem(QStringLiteral("ContextTwo")); contexts->setChild(0, 0, contextChildOne); contexts->setChild(1, 0, contextChildTwo); auto items = QVector<QStandardItem*>(); items << inbox << workday << projects << contexts; for (int i = 0; i < items.size(); ++i) model->setItem(i, items.at(i)); return model; }
void ElemDDLList::initializeDataMembers(ElemDDLNode * commaExpr, ElemDDLNode * otherExpr) { pParentListNode_ = NULL; setChild(INDEX_ELEM_DDL_LIST_CHILD, commaExpr); setChild(INDEX_ELEM_DDL_NODE_CHILD, otherExpr); // Besides pointing to a list node (a non-leaf node in // the left linear tree), commaExpr may also point to // a leaf node (which is the first element in the list) ComASSERT(commaExpr NEQ NULL); // Link the child list node (pointed by the pointer commaExpr with // the parent list node (this node). The method traverseList will // use this link (in upward direction) to traverse the leaf nodes // of the left linear tree more efficiently. // // Only link the child list node to this node if both parent node // (this node) and child node represent the same kind of list node // (both nodes are instantiated from the same class; for example, // class ElemDDLPartitionList). Note that class ElemDDLList and // class ElemDDLPartitionList represent two different kinds of list // nodes (even though class ElemDDLPartitionList is derived from // class ElemDDLList). ElemDDLList * pChildListNode = commaExpr->castToElemDDLList(); if (pChildListNode NEQ NULL AND getOperatorType() EQU pChildListNode->getOperatorType()) pChildListNode->setParentListNode(this); }
// // constructor // StmtDDLInitializeSQL::StmtDDLInitializeSQL( ElemDDLNode *pCreateRoleList, ElemDDLNode *pRegisterUserList, CollHeap *heap) : StmtDDLNode(DDL_INITIALIZE_SQL) , registerUserArray_(heap) , createRoleArray_(heap) { setChild(INDEX_REGISTER_USER_LIST, pRegisterUserList); setChild(INDEX_CREATE_ROLE_LIST, pCreateRoleList); }
/* * @brief Reset the data to be displayed. Remove model evaluation curves */ void DisplayControl::updateSliceForFitting() { try { // check the workspace is registered in the Analysis Data Service auto workspace = Mantid::API::AnalysisDataService::Instance() .retrieveWS<Mantid::API::MatrixWorkspace>(m_dataShownName); // delete the workspace being shown auto deleteWsAlg = Mantid::API::AlgorithmManager::Instance().create("DeleteWorkspace"); deleteWsAlg->initialize(); deleteWsAlg->setChild(true); deleteWsAlg->setLogging(false); deleteWsAlg->setProperty("Workspace", m_dataShownName); deleteWsAlg->execute(); } catch (Mantid::Kernel::Exception::NotFoundError &) { } if (m_displayModelFit->hasCurve(curveType::fit)) { m_displayModelFit->removeSpectrum(curveType::fit); m_displayModelFit->removeSpectrum(curveType::residuals); } // create the data workspace to be shown auto dataX = m_inputDataControl->selectedDataX(); auto dataY = m_inputDataControl->selectedDataY(); auto dataE = m_inputDataControl->selectedDataE(); auto energy = m_inputDataControl->getSelectedEnergy(); std::ostringstream energyLabelStream; energyLabelStream << energy; // create internal workspace containing the non-zero signal auto createWsAlg = Mantid::API::AlgorithmManager::Instance().create("CreateWorkspace"); createWsAlg->initialize(); createWsAlg->setChild(true); createWsAlg->setLogging(false); createWsAlg->setProperty("OutputWorkspace", m_dataShownName); createWsAlg->setProperty("NSpec", 1); createWsAlg->setProperty("DataX", dataX); createWsAlg->setProperty("DataY", dataY); createWsAlg->setProperty("DataE", dataE); createWsAlg->setProperty("UnitX", "MomentumTransfer"); createWsAlg->setProperty("VerticalAxisUnit", "DeltaE"); createWsAlg->setProperty("VerticalAxisValues", energyLabelStream.str()); createWsAlg->execute(); Mantid::API::MatrixWorkspace_sptr m_dataShown = createWsAlg->getProperty("OutputWorkspace"); Mantid::API::AnalysisDataService::Instance().add(m_dataShownName, m_dataShown); // show the workspace with appropriate range selector m_displayModelFit->addSpectrum(curveType::data, m_dataShown); auto curveRange = m_displayModelFit->getCurveRange(curveType::data); auto rangeSelectorFit = m_displayModelFit->m_rangeSelector.at(dcRange::fit); rangeSelectorFit->setRange(curveRange.first, curveRange.second); rangeSelectorFit->setMinimum(curveRange.first); rangeSelectorFit->setMaximum(curveRange.second); // emit signalRangeSelectorFitUpdated(); }
ElemDDLPartitionSystem::ElemDDLPartitionSystem() : ElemDDLPartition(ELM_PARTITION_SYSTEM_ELEM), option_(ADD_OPTION), locationName_(PARSERHEAP()), guardianLocation_(PARSERHEAP()), partitionName_(PARSERHEAP()) { setChild(INDEX_LOCATION, NULL); setChild(INDEX_PARTITION_ATTR_LIST, NULL); initializeDataMembers(); }
/*插入内部结点*/ void InternalNode::insert(int keyIndex, int childIndex, KeyType key, FatherNode* childNode) { int i; for (i = getKeyNum(); i > keyIndex; --i) { setChild(i + 1, m_Childs[i]); setKeyValue(i, m_KeyValues[i - 1]); } //将父节点的childIndex后所有键值对后移一个单位 if (i == childIndex) { setChild(i + 1, m_Childs[i]); } setChild(childIndex, childNode); //插入新结点 setKeyValue(keyIndex, key); setKeyNum(m_KeyNum + 1); }
ElemDDLPartitionSystem::ElemDDLPartitionSystem( ElemDDLPartition::optionEnum option, ElemDDLNode * pLocation, ElemDDLNode * pPartitionAttrList) : ElemDDLPartition(ELM_PARTITION_SYSTEM_ELEM), option_(option), locationName_(PARSERHEAP()), guardianLocation_(PARSERHEAP()), partitionName_(PARSERHEAP()) { setChild(INDEX_LOCATION, pLocation); setChild(INDEX_PARTITION_ATTR_LIST, pPartitionAttrList); initializeDataMembers(); }
void CInternalNode::insert(int keyIndex, int childIndex, KeyType key, CNode* childNode) { int i; for (i=getKeyNum(); i>keyIndex; --i)//将父节点中的childIndex后的所有关键字的值和子树指针向后移一位 { setChild(i+1,m_Childs[i]); setKeyValue(i,m_KeyValues[i-1]); } if (i==childIndex) { setChild(i+1, m_Childs[i]); } setChild(childIndex, childNode); setKeyValue(keyIndex, key); setKeyNum(m_KeyNum+1); }
ElemDDLPartitionRange::ElemDDLPartitionRange( ElemDDLPartition::optionEnum option, ElemDDLNode * pKeyValueList, ElemDDLNode * pLocation, ElemDDLNode * pPartitionOptionList, CollHeap * heap) : ElemDDLPartitionSystem(ELM_PARTITION_RANGE_ELEM, option, pLocation, pPartitionOptionList), keyValueArray_(heap) { setChild(INDEX_KEY_VALUE_LIST, pKeyValueList); // Traverses the parse sub-tree containing the list of key values. // Copies pointers to these key values to keyValueArray_ for // easier access. for (CollIndex i = 0; i < pKeyValueList->entries(); i++) { ComASSERT((*pKeyValueList)[i]->castToElemDDLKeyValue() NEQ NULL); keyValueArray_.insert((*pKeyValueList)[i]->castToElemDDLKeyValue() ->getKeyValue()); } }
ITableWorkspace_sptr ReflCatalogSearcher::search(const std::string &text) { auto sessions = CatalogManager::Instance().getActiveSessions(); if (sessions.empty()) throw std::runtime_error("You are not logged into any catalogs."); const std::string sessionId = sessions.front()->getSessionId(); auto algSearch = AlgorithmManager::Instance().create("CatalogGetDataFiles"); algSearch->initialize(); algSearch->setChild(true); algSearch->setLogging(false); algSearch->setProperty("Session", sessionId); algSearch->setProperty("InvestigationId", text); algSearch->setProperty("OutputWorkspace", "_ReflSearchResults"); algSearch->execute(); ITableWorkspace_sptr results = algSearch->getProperty("OutputWorkspace"); // Now, tidy up the data std::set<size_t> toRemove; for (size_t i = 0; i < results->rowCount(); ++i) { std::string &run = results->String(i, 0); // Too short to be more than ".raw or .nxs" if (run.size() < 5) { toRemove.insert(i); } } // Sets are sorted so if we go from back to front we won't trip over ourselves for (auto row = toRemove.rbegin(); row != toRemove.rend(); ++row) results->removeRow(*row); return results; }
/** * Sum over transmission group workspaces to produce one * workspace. * @param transGroup : The transmission group to be processed * @return A workspace pointer containing the sum of transmission workspaces. */ Mantid::API::Workspace_sptr ReflectometryReductionOneAuto::sumOverTransmissionGroup( WorkspaceGroup_sptr &transGroup) { // Handle transmission runs // we clone the first member of transmission group as to // avoid addition in place which would affect the original // workspace member. // // We used .release because clone() will return a unique_ptr. // we need to release the ownership of the pointer so that it // can be cast into a shared_ptr of type Workspace. Workspace_sptr transmissionRunSum(transGroup->getItem(0)->clone().release()); // make a variable to store the overall total of the summation MatrixWorkspace_sptr total; // set up and initialize plus algorithm. auto plusAlg = this->createChildAlgorithm("Plus"); plusAlg->setChild(true); // plusAlg->setRethrows(true); plusAlg->initialize(); // now accumalate the group members for (size_t item = 1; item < transGroup->size(); ++item) { plusAlg->setProperty("LHSWorkspace", transmissionRunSum); plusAlg->setProperty("RHSWorkspace", transGroup->getItem(item)); plusAlg->setProperty("OutputWorkspace", transmissionRunSum); plusAlg->execute(); total = plusAlg->getProperty("OutputWorkspace"); } return total; }
/** * Create an output histo workspace filled with data simulated with the fitting * function. * @param baseName :: The base name for the workspace * @param function :: The function used for the calculation * @param inputWorkspace :: The input workspace * @param outputWorkspacePropertyName :: The property name */ boost::shared_ptr<API::Workspace> FitMD::createHistoOutputWorkspace( const std::string &baseName, API::IFunction_sptr function, API::IMDHistoWorkspace_const_sptr inputWorkspace, const std::string &outputWorkspacePropertyName) { // have to cast const away to be able to pass the workspace to the algorithm API::IMDHistoWorkspace_sptr nonConstInputWS = boost::const_pointer_cast<API::IMDHistoWorkspace, const API::IMDHistoWorkspace>(inputWorkspace); // evaluate the function on the input workspace auto alg = API::AlgorithmFactory::Instance().create("EvaluateMDFunction", -1); alg->setChild(true); alg->setRethrows(true); alg->initialize(); alg->setProperty("Function", function); alg->setProperty("InputWorkspace", nonConstInputWS); alg->setProperty("OutputWorkspace", "__FitMD_createHistoOutputWorkspace_outputWorkspace"); alg->execute(); // get the result API::IMDHistoWorkspace_sptr outputWorkspace = alg->getProperty("OutputWorkspace"); // Store it if (!outputWorkspacePropertyName.empty()) { declareProperty( new API::WorkspaceProperty<API::IMDHistoWorkspace>( outputWorkspacePropertyName, "", Direction::Output), "Name of the output Workspace holding resulting simulated spectrum"); m_manager->setPropertyValue(outputWorkspacePropertyName, baseName + "Workspace"); m_manager->setProperty(outputWorkspacePropertyName, outputWorkspace); } return outputWorkspace; }
void ElemDDLConstraintRI::setReferencingColumnNameList( ElemDDLNode * pReferencingColumnNameList) { setChild(INDEX_REFERENCING_COLUMN_NAME_LIST, pReferencingColumnNameList); // // copies the information to referencingColumnNameArray_ // so the user can access the information easier. This // method should not be called more than once. // if (pReferencingColumnNameList) { for (CollIndex i = 0; i < pReferencingColumnNameList->entries(); i++) { ComASSERT((*pReferencingColumnNameList)[i] AND (*pReferencingColumnNameList)[i] ->castToElemDDLColName()); referencingColumnNameArray_.insert((*pReferencingColumnNameList)[i] ->castToElemDDLColName()); } } } // ElemDDLConstraintRI::setReferencingColumnNameList()
void CalculateCarpenterSampleCorrection::deleteWorkspace( MatrixWorkspace_sptr workspace) { auto alg = this->createChildAlgorithm("DeleteWorkspace"); alg->initialize(); alg->setChild(true); alg->setLogging(false); alg->setProperty("Workspace", workspace); alg->execute(); }
void CInternalNode::removeKey(int keyIndex, int childIndex) { for (int i=0; i<getKeyNum()-keyIndex-1; ++i) { setKeyValue(keyIndex+i, getKeyValue(keyIndex+i+1)); setChild(childIndex+i, getChild(childIndex+i+1)); } setKeyNum(getKeyNum()-1); }
ElemDDLPartitionRange::ElemDDLPartitionRange(CollHeap * heap) : ElemDDLPartitionSystem(ELM_PARTITION_RANGE_ELEM, ADD_OPTION, NULL /*location*/, NULL /*partition option list*/), keyValueArray_(heap) { setChild(INDEX_KEY_VALUE_LIST, NULL); }
ElemDDLSGOptions::ElemDDLSGOptions() : ElemDDLNode(ELM_SG_OPTS_DEFAULT_ELEM), ieType_(SG_UNKNOWN), cdType_(CD_UNKNOWN) { setChild(INDEX_SG_OPT_LIST, NULL); initializeDataMembers(); }
ElemDDLSGOptions::ElemDDLSGOptions(OperatorTypeEnum operType) : ElemDDLNode(operType), ieType_(SG_UNKNOWN), cdType_(CD_UNKNOWN) { setChild(INDEX_SG_OPT_LIST, NULL); initializeDataMembers(); }
ITableWorkspace_sptr ReflCatalogSearcher::search(const std::string& text, const std::string& instrument) { auto sessions = CatalogManager::Instance().getActiveSessions(); if(sessions.empty()) throw std::runtime_error("You are not logged into any catalogs."); const std::string sessionId = sessions.front()->getSessionId(); auto algSearch = AlgorithmManager::Instance().create("CatalogGetDataFiles"); algSearch->initialize(); algSearch->setChild(true); algSearch->setLogging(false); algSearch->setProperty("Session", sessionId); algSearch->setProperty("InvestigationId", text); algSearch->setProperty("OutputWorkspace", "_ReflSearchResults"); algSearch->execute(); ITableWorkspace_sptr results = algSearch->getProperty("OutputWorkspace"); //Now, tidy up the data std::set<size_t> toRemove; for(size_t i = 0; i < results->rowCount(); ++i) { std::string& run = results->String(i,0); //Too short to be more than ".raw" if(run.size() < 5) { toRemove.insert(i); } //If this isn't the right instrument, remove it else if(run.substr(0, instrument.size()) != instrument) { toRemove.insert(i); } //If it's not a raw file, remove it else if(run.substr(run.size() - 4, 4) != ".raw") { toRemove.insert(i); } //It's a valid run, so let's trim the instrument prefix and ".raw" suffix run = run.substr(instrument.size(), run.size() - (instrument.size() + 4)); //Let's also get rid of any leading zeros size_t numZeros = 0; while(run[numZeros] == '0') numZeros++; run = run.substr(numZeros, run.size() - numZeros); } //Sets are sorted so if we go from back to front we won't trip over ourselves for(auto row = toRemove.rbegin(); row != toRemove.rend(); ++row) results->removeRow(*row); return results; }
// ----------------------------------------------------------------------- // member functions for class StmtDDLRoleGrant // ----------------------------------------------------------------------- // constructor for GRANT /REVOKE ROLE StmtDDLRoleGrant::StmtDDLRoleGrant(ElemDDLNode * pRolesList, ElemDDLNode * pGranteeList, NABoolean withAdmin, ElemDDLNode * pOptionalGrantedBy, ComDropBehavior dropBehavior, NABoolean isGrantRole, CollHeap * heap) : StmtDDLNode(DDL_GRANT_ROLE), withAdmin_(withAdmin), isGrantRole_(isGrantRole), dropBehavior_(dropBehavior), grantedBy_(NULL) { setChild(INDEX_ROLES_LIST, pRolesList); setChild(INDEX_GRANTEE_LIST, pGranteeList); setChild(INDEX_GRANTED_BY_OPTION, pOptionalGrantedBy); // // copies pointers to parse nodes representing grantee // to granteeArray_ so the user can access the information // easier. // ComASSERT(pGranteeList NEQ NULL); for (CollIndex i = 0; i < pGranteeList->entries(); i++) { granteeArray_.insert((*pGranteeList)[i]->castToElemDDLGrantee()); } ComASSERT(pRolesList NEQ NULL); for (CollIndex i = 0; i < pRolesList->entries(); i++) { rolesArray_.insert((*pRolesList)[i]->castToElemDDLGrantee()); } if ( pOptionalGrantedBy NEQ NULL ) { grantedBy_ = pOptionalGrantedBy->castToElemDDLGrantee(); } } // StmtDDLRoleGrant::StmtDDLRoleGrant()
/*删除内部结点的键值*/ void InternalNode::removeKey(int keyIndex, int childIndex) { for (int i = 0; i < getKeyNum() - childIndex; i++) { setChild(childIndex + i, getChild(childIndex + i + 1)); } for (int i = 0; i < getKeyNum() - keyIndex - 1; ++i) { setKeyValue(keyIndex + i, getKeyValue(keyIndex + i + 1)); }//键值对依次向前移动 setKeyNum(getKeyNum() - 1); }
void set_instrument(Mantid::API::MatrixWorkspace_sptr workspace, const std::string &instrumentName) { auto instAlg = Mantid::API::AlgorithmManager::Instance().createUnmanaged( "LoadInstrument"); instAlg->initialize(); instAlg->setChild(true); instAlg->setProperty("Workspace", workspace); instAlg->setProperty("InstrumentName", instrumentName); instAlg->setProperty("RewriteSpectraMap", "False"); instAlg->execute(); }
void add_sample_log(Mantid::API::MatrixWorkspace_sptr workspace, const std::string &logName, const std::string &logValue) { auto logAlg = Mantid::API::AlgorithmManager::Instance().createUnmanaged("AddSampleLog"); logAlg->initialize(); logAlg->setChild(true); logAlg->setProperty("Workspace", workspace); logAlg->setProperty("LogName", logName); logAlg->setProperty("LogText", logValue); logAlg->execute(); }
ElemDDLSGOptions::ElemDDLSGOptions(Int32 ieType, ElemDDLNode * pSGOptList) : ElemDDLNode(ELM_SG_OPTS_DEFAULT_ELEM) { setChild(INDEX_SG_OPT_LIST, pSGOptList); if (ieType == 1) ieType_= SG_INTERNAL; else if (ieType == 2) ieType_ = SG_EXTERNAL; else if (ieType == 3) ieType_ = SG_INTERNAL_COMPUTED; else ieType_ = SG_UNKNOWN; initializeDataMembers(); }
// constructor ElemDDLColViewDef::ElemDDLColViewDef(const NAString & columnName, ElemDDLNode * pColAttrList) : ElemDDLNode(ELM_COL_VIEW_DEF_ELEM), columnName_(columnName, PARSERHEAP()), heading_(PARSERHEAP()), isHeadingSpec_(FALSE) { setChild(INDEX_ELEM_DDL_COL_ATTR_LIST, pColAttrList); // Traverse the list of column attributes to check for // duplicate HEADING clause if (pColAttrList NEQ NULL) { for (CollIndex index = 0; index < pColAttrList->entries(); index++) { setColumnAttribute((*pColAttrList)[index]); } } } // ElemDDLColViewDef()
/*! \brief Constructor * * The StatusTestResNormOutput requires an OutputManager for printing the underlying StatusTest on * calls to checkStatus(), as well as an underlying StatusTest. * * The last two parameters, described below, in addition to the verbosity level of the OutputManager, control when printing is * called. When both the \c mod criterion and the \c printStates criterion are satisfied, the status test will be printed to the * OutputManager with ::MsgType of ::StatusTestDetails. * * @param[in] test A reference-counted pointer to an object that combines Belos::StatusTestMaxIters and a set of Belos::StatusTestResNorm * @param[in] mod A positive number describes how often the output should be printed. On every call to checkStatus(), an internal counter * is incremented. Printing may only occur when this counter is congruent to zero modulo \c mod. Default: 1 (attempt to print on every call to checkStatus()) * @param[in] printStates A combination of ::StatusType values for which the output may be printed. Default: ::Passed (attempt to print whenever checkStatus() will return ::Passed) * */ StatusTestResNormOutput(const Teuchos::RCP<OutputManager<ScalarType> > &printer, Teuchos::RCP<StatusTest<ScalarType,MV,OP> > test, int mod = 1, int printStates = Passed) : printer_(printer), state_(Undefined), headerPrinted_(false), stateTest_(printStates), modTest_(mod), lastNumIters_(-1), comboType_(0), numResTests_(0), blockSize_(1), currNumRHS_(0), currLSNum_(0), numLSDgts_(1), numIterDgts_(1) { // Set the input test. setChild(test); }
void ElemDDLConstraintUnique::setColumnRefList(ElemDDLNode * pColumnRefList) { setChild(INDEX_COLUMN_NAME_LIST, pColumnRefList); if (getColumnRefList()) { // // Copies information about the key column list to keyColumnArray_ // so the user can access the information easier. (Assumes that // keyColumnArray_ is still empty.) // for (CollIndex i = 0; i < getColumnRefList()->entries(); i++) { ComASSERT((*getColumnRefList())[i] AND (*getColumnRefList())[i]->castToElemDDLColRef()); keyColumnArray_.insert((*getColumnRefList())[i]->castToElemDDLColRef()); } } } // ElemDDLConstraintUnique::setColumnRefList()
ElemDDLPartitionByColumnList::ElemDDLPartitionByColumnList( ElemDDLNode * partitionKeyColumnList, CollHeap * heap) : ElemDDLPartitionByOpt(ELM_PARTITION_BY_COLUMN_LIST_ELEM), partitionKeyColumnArray_(heap) { setChild(INDEX_PARTITION_KEY_COLUMN_LIST, partitionKeyColumnList); // // copies pointers to parse nodes representing // column names (appearing in a partition by option) // to partitionKeyColumnArray_ so the user can access // this information easier. // ComASSERT(partitionKeyColumnList NEQ NULL); for (CollIndex i = 0; i < partitionKeyColumnList->entries(); i++) { partitionKeyColumnArray_.insert((*partitionKeyColumnList)[i]-> castToElemDDLColRef()); } }
/** * Sum transmission workspaces that belong to a workspace group * @param transGroup : The transmission group containing the transmission runs * @return :: A workspace pointer containing the sum of transmission workspaces */ MatrixWorkspace_sptr ReflectometryReductionOneAuto2::sumTransmissionWorkspaces( WorkspaceGroup_sptr &transGroup) { const std::string transSum = "trans_sum"; Workspace_sptr sumWS = transGroup->getItem(0)->clone(); /// For this step to appear in the history of the output workspaces I need to /// set child to false and work with the ADS auto plusAlg = createChildAlgorithm("Plus"); plusAlg->setChild(false); plusAlg->initialize(); for (size_t item = 1; item < transGroup->size(); item++) { plusAlg->setProperty("LHSWorkspace", sumWS); plusAlg->setProperty("RHSWorkspace", transGroup->getItem(item)); plusAlg->setProperty("OutputWorkspace", transSum); plusAlg->execute(); sumWS = AnalysisDataService::Instance().retrieve(transSum); } MatrixWorkspace_sptr result = boost::dynamic_pointer_cast<MatrixWorkspace>(sumWS); AnalysisDataService::Instance().remove(transSum); return result; }
Mantid::API::MatrixWorkspace_sptr provide1DWorkspace(NXcanSASTestParameters ¶meters) { Mantid::API::MatrixWorkspace_sptr ws; if (parameters.hasDx) { ws = WorkspaceCreationHelper::create1DWorkspaceConstantWithXerror( parameters.size, parameters.value, parameters.error, parameters.xerror); } else { ws = WorkspaceCreationHelper::create1DWorkspaceConstant( parameters.size, parameters.value, parameters.error); } ws->setTitle(parameters.workspaceTitle); ws->getAxis(0)->unit() = Mantid::Kernel::UnitFactory::Instance().create("MomentumTransfer"); // Add sample logs set_logs(ws, parameters.runNumber, parameters.userFile); // Set instrument set_instrument(ws, parameters.instrumentName); // Set to point data or histogram data if (parameters.isHistogram) { const std::string outName = "convert_to_histo_out_name"; auto toHistAlg = Mantid::API::AlgorithmManager::Instance().createUnmanaged( "ConvertToHistogram"); toHistAlg->initialize(); toHistAlg->setChild(true); toHistAlg->setProperty("InputWorkspace", ws); toHistAlg->setProperty("OutputWorkspace", outName); toHistAlg->execute(); ws = toHistAlg->getProperty("OutputWorkspace"); } return ws; }