/** Executes the algorithm
   *
   *  @throw Exception::FileError If the grouping file cannot be opened or read
  *successfully
   */
void GetDetOffsetsMultiPeaks::exec() {
  // Process input information
  processProperties();

  // Create information workspaces
  createInformationWorkspaces();

  // Calculate offset of each detector
  calculateDetectorsOffsets();

  // Return the output
  setProperty("OutputWorkspace", m_outputW);
  setProperty("NumberPeaksWorkspace", m_outputNP);
  setProperty("MaskWorkspace", m_maskWS);
  setProperty("FittedResolutionWorkspace", m_resolutionWS);
  setProperty("SpectraFitInfoTableWorkspace", m_infoTableWS);
  setProperty("PeaksOffsetTableWorkspace", m_peakOffsetTableWS);

  // Also save to .cal file, if requested
  std::string filename = getProperty("GroupingFileName");
  if (!filename.empty()) {
    progress(0.9, "Saving .cal file");
    IAlgorithm_sptr childAlg = createChildAlgorithm("SaveCalFile");
    childAlg->setProperty("OffsetsWorkspace", m_outputW);
    childAlg->setProperty("MaskWorkspace", m_maskWS);
    childAlg->setPropertyValue("Filename", filename);
    childAlg->executeAsChildAlg();
  }

  // Make summary
  progress(0.92, "Making summary");
  makeFitSummary();

  return;
}
Beispiel #2
0
 int main(int argc, char **argv) 
 {
 					if (argc <= 2)		
 					{ 
 						
 							
 								//nothing was entered to start the application correctly
 								fputs(USAGE, stderr); //shows application usage	
 								exit(EXIT_FAILURE); // exit the application
 								
 								
 					}
 
 
 				//The ranges, add this into cerebro
 				uint *rangeArray, range; //for the ranges
 				range = (uint) returnLineCountOfFile(argv[1]); //geting the line count of the file
 				rangeArray = (uint *) alloca(sizeof(uint) * range); //allocating the array for functions
 
 				if (grabRangesFromFile(argv[1], rangeArray) < 0)
 				{
 						
 						
 							exit(EXIT_FAILURE);
 					
 				}
 				
 				
 				crealInit(); //initialize the creal properties
 				
 
 	
 		crealTime = atoi(argv[2]);
 		
 
  		for (count = 0; count < crealTime; count++)
  		{
 				memset(sumVector,0,1000*sizeof(creal_t)); //set the memory to zero
 				
  				srand(time(0)); //allowing the application to generate a random seed
  								
  				processSelectedActionsAndConditions(crealNodes, crealProperties, sumVector,rangeArray, range);
  				
  				processProperties(sumVector,crealProperties);
  				
  				writeOutDataFileFor(crealNodes, rangeArray, range, &count);
  				
  		}
 
 
 
 
 
 		exit(EXIT_SUCCESS);	
}void printOutDataInCrealNodes(struct crealNodeStruct nodes[])
Beispiel #3
0
bool MDSCHEMA_LEVELS::processValue(Restrictions restrictions,Properties properties){
	processProperties(properties);

	vector<MeasureList> measures;
	string catalogn="";
	string cuben="";

	//properties有指定Catalog
	if(this->Catalog!="")
		catalogn=Catalog;
	else{
		Restrictions::iterator catalognIt=restrictions.find(CATALOG_NAME);
		//有CATALOG_NAME约束
		if(catalognIt!= restrictions.end()){
			catalogn=catalognIt->second;
		}
	}
 	
	Restrictions::iterator cubenIt=restrictions.find(CUBE_NAME);
	//有CUBE_NAME约束
	if(cubenIt!=restrictions.end()){
		cuben=cubenIt->second;
	}

	
	measures=XSchemas::instance().getMeasures(catalogn,cuben);
	for(int j=0;j<measures.size();j++){
		Row measureRow=getRowM(measures[j]);
		if(isConsistent(measureRow,restrictions))
			rows.push_back(measureRow);
	}

	vector<Level*> levels=this->getRestrictLevel(restrictions);
	
	for(int i=0;i<levels.size();i++){
		Row row=getRow(levels[i]);
		if(isConsistent(row,restrictions))
			rows.push_back(row);
	}
	return true;
}
Beispiel #4
0
bool MDSCHEMA_MEMBERS::processValue(Restrictions restrictions,Properties properties){
	processProperties(properties);
	
	vector<MeasureList> measures;
	string catalogn="";
	string cuben="";

	//properties有指定Catalog
	if(this->Catalog!="")
		catalogn=Catalog;
	else{
		Restrictions::iterator catalognIt=restrictions.find(CATALOG_NAME);
		//有CATALOG_NAME约束
		if(catalognIt!= restrictions.end()){
			catalogn=catalognIt->second;
		}
	}
	
	Restrictions::iterator cubenIt=restrictions.find(CUBE_NAME);
	//有CUBE_NAME约束
	if(cubenIt!=restrictions.end()){
		cuben=cubenIt->second;
	}
	
	measures=XSchemas::instance().getMeasures(catalogn,cuben);
	
	for(int i=0;i<measures.size();i++){
		MeasureList mlist=measures[i];
		cout<<mlist.size();
		for(int j=0;j<mlist.size();j++){	
			Row measureRow=getRowM(mlist[j],j);
			if(isConsistent(measureRow,restrictions))
			rows.push_back(measureRow);
		}
	}

	vector<Member*> members=this->getRestrictMembers(restrictions);
	
	Restrictions::iterator MemberUN_It=restrictions.find(MEMBER_UNIQUE_NAME);
	Restrictions::iterator TREE_OP_It=restrictions.find("TREE_OP");
	//有MEMBER_UNIQUE_NAME约束并且有TREE_OP约束
	if(MemberUN_It!=restrictions.end()&&TREE_OP_It!=restrictions.end()){
		if(TREE_OP_It->second=="1"){
 			
			for(int a=0;a<members.size();a++){
				Row row=getRow(members[a]);
				if(isConsistent(row,restrictions)){
					vector<Member *> m_children=members[a]->getChildrenMember();
					for(int j=0;j<m_children.size();j++){
						Row row=getRow(m_children[j]);
						rows.push_back(row);
					}
					break;
				}
			}
			
			return true;
		}
		if(TREE_OP_It->second=="0"){
			for(int a=0;a<members.size();a++){
				Row row=getRow(members[a]);
				if(isConsistent(row,restrictions))
					rows.push_back(row);
			}
			return true;
		}
		else
			return true;
		return true;
	}
	
	else{	
		for(int a=0;a<members.size();a++){
			Row row=getRow(members[a]);
			if(isConsistent(row,restrictions))
				rows.push_back(row);
		}
		return true;
	}
}