Beispiel #1
0
/**
 * \brief This function interprets <FIOReponse> Code
 *
 * \param[in]	pCode - Start of code to interpret
 * \return		STATUS_PASS - Test conformance (PASS)
 * 				STATUS_FAIL - Test nonconformance (FAIL)
 */
static
int16_t
interpretFIOR(P_CODE *pCode)
{
	char            file[OUTPUT_STRING_MAX];
	char            frame[OUTPUT_STRING_MAX];
	char            delaystr[OUTPUT_STRING_MAX];
	unsigned char   *pBuf;
	unsigned int    size;
	int		delay = 0;

	sprintf(file, "%s%s", configFileGetFIORFP(),
		pCode->code.cFIOR.pFile->arg.data.value.pCharValue);
	sprintf(frame, "%d", pCode->code.cFIOR.pFrame->arg.data.value.intValue);
	if (pCode->code.cFIOR.pDelay) {
		delay = pCode->code.cFIOR.pDelay->arg.data.value.intValue;
		sprintf(delaystr, "%d", delay);
	}

	// Complete FIOR format processing
	outputXmlAttrAddCommon(LEVEL_TRACE, &pCode->common, A_VAR);
	outputXmlAttrAdd(A_FILE, file);
	outputXmlAttrAdd(A_FRAME, frame);
	if (pCode->code.cFIOR.pDelay) {
		outputXmlAttrAdd(A_DELAY, delaystr);	
	}
	outputXmlTagCurrent(LEVEL_TRACE, P_FIOR, outputXmlAttrGet());

	if (STATUS_FAIL == argSet(pCode->common.lineNumber,
					configFileGetFIORFP(),
					pCode->code.cFIOR.pFile->arg.data.value.pCharValue,
					&pBuf,
					&size))
	{
		return(STATUS_FAIL);
	}

	if (emfio_setResponse(pCode->code.cFIOR.pFrame->arg.data.value.intValue,
				pBuf, (uint32_t)size, (uint32_t)delay) != 0)
	{
		// Could not load response
		char string[OUTPUT_STRING_MAX];
		sprintf(string, "interpretFIOR(): Could not load response frame [%s]",
			frame);
		OUTPUT_ERR(pCode->common.lineNumber, string, emfio_getErrorText(), NULL);
		free(pBuf);
		return(STATUS_FAIL);
	}

	free(pBuf);
	return(STATUS_PASS);
}
Beispiel #2
0
RooDataSet *th22dataset(TH2F *hist){
  RooRealVar *v1 = new RooRealVar("constTerm","",0.01,0,0.02);
  RooRealVar *v2 = new RooRealVar("alpha","",0.0,0,0.2);
  RooRealVar *nll = new RooRealVar("nll",0,0,1e20);
  RooArgSet argSet(*v1,*v2, *nll);
  RooDataSet *dataset = new RooDataSet(TString(hist->GetName())+"_dataset", "", argSet,"nll");
  
  for(Int_t iBinX=1; iBinX <= hist->GetNbinsX(); iBinX++){
    for(Int_t iBinY=1; iBinY <= hist->GetNbinsY(); iBinY++){
      Double_t binContent=hist->GetBinContent(iBinX, iBinY);
      if(binContent!=0){
	v1->setVal(hist->GetXaxis()->GetBinCenter(iBinX));
	v2->setVal(hist->GetYaxis()->GetBinCenter(iBinY));
	nll->setVal(binContent);
	dataset->add(argSet);
      }
    }
  }
  return dataset;
}
Beispiel #3
0
void TIsrRequeArgsSet::SelfTest()
	{
	test.Start(_L("Selftest of TIsrRequeArgsSet"));

	TUint size = 0x1000;
	TDmaTransferArgs tferArgs(0, 1*size, size, KDmaMemAddr, KDmaSyncAuto, KDmaRequestCallbackFromIsr);

	TIsrRequeArgs requeArgArray[] = {
		TIsrRequeArgs(),									// Repeat
		TIsrRequeArgs(KPhysAddrInvalidUser, 2*size, 0),		// Change destination
		TIsrRequeArgs(),									// Repeat
		TIsrRequeArgs(3*size, KPhysAddrInvalidUser, 0),		// Change source
		TIsrRequeArgs(),									// Repeat
	};
	TIsrRequeArgsSet argSet(requeArgArray, ARRAY_LENGTH(requeArgArray));

	test.Next(_L("Test that Substitute updates transfer args in order"));
	argSet.Substitute(tferArgs);

	TAddressParms expectedFinal(3*size, 2*size, size);
	if(!(expectedFinal == argSet.iRequeArgs[4]))
		{
		TBuf<0x100> out;

		out += _L("substitue: ");
		GetAddrParms(tferArgs).AppendString(out);
		test.Printf(out);

		out.Zero();
		out += _L("\nexpected final: ");
		expectedFinal.AppendString(out);
		test.Printf(out);

		out.Zero();
		out += _L("\nactual: ");
		argSet.iRequeArgs[4].AppendString(out);
		test.Printf(out);

		test(EFalse);
		}

	TIsrRequeArgs requeArgArray2[] = {
		TIsrRequeArgs(),									// Repeat
		TIsrRequeArgs(KPhysAddrInvalidUser, 2*size, 0),		// Change destination
		TIsrRequeArgs(KPhysAddrInvalidUser, 1*size, 0),		// Change destination back
	};
	argSet = TIsrRequeArgsSet(requeArgArray2, ARRAY_LENGTH(requeArgArray2));

	test.Next(_L("CheckRange(), negative"));

	test(!argSet.CheckRange(0, (2 * size) - 1, tferArgs));
	test(!argSet.CheckRange(0, (2 * size) + 1, tferArgs));
	test(!argSet.CheckRange(0, (2 * size), tferArgs));

	test(!argSet.CheckRange(1 ,(3 * size), tferArgs));
	test(!argSet.CheckRange(1 ,(3 * size) + 1, tferArgs));

	test(!argSet.CheckRange(1 * size , 2 * size, tferArgs));

	test.Next(_L("CheckRange(), positive"));
	test(argSet.CheckRange(0, 3 * size, tferArgs));
	test(argSet.CheckRange(0, 3 * size+1, tferArgs));
	test(argSet.CheckRange(0, 4 * size, tferArgs));


	test.End();
	}
Beispiel #4
0
/**
 * \brief This function interprets <Load> Code
 *
 * \param[in]	pCode - Start of code to interpret
 * \return		STATUS_PASS - Test conformance (PASS)
 * 				STATUS_FAIL - Test nonconformance (FAIL)
 */
static
int16_t
interpretLoad(P_CODE *pCode)
{
	int16_t	status = STATUS_PASS;
	char	frame[OUTPUT_STRING_MAX];

	if (pCode->code.cLoad.pFrame)
	{
		sprintf(frame, "%d", pCode->code.cLoad.pFrame->arg.data.value.intValue);
	}

	// Complete LOAD format processing
	outputXmlAttrAddCommon(LEVEL_SUMMARY, &pCode->common, A_FILE);
	outputXmlAttrAdd(A_LOAD, s_dumpType_string[pCode->code.cLoad.type]);
	if (pCode->code.cLoad.pFrame)
	{
		outputXmlAttrAdd(A_FRAME, frame);
	}
	outputXmlTagOpen(LEVEL_SUMMARY, P_LOAD, outputXmlAttrGet());

	switch (pCode->code.cLoad.type)
	{
		case DUMP_VD:
		{
			char	file[OUTPUT_STRING_MAX];
			sprintf(file,
					"%s%s",
					configFileGetFPUIDFP(),
					pCode->code.cLoad.pFile->arg.data.value.pCharValue);
			if (vt100_fromDumpToVD(file))
			{
				OUTPUT_ERR(pCode->common.lineNumber,
						   "interpretLoad(): Could not load VD",
						   vt100_get_errorText(),
						   NULL);
				status = STATUS_FAIL;
			}
		}
		break;

		case DUMP_CMDMSG:
		{
			unsigned char	*pBuf;
			unsigned int	size;

			if (STATUS_FAIL == argSet(pCode->common.lineNumber,
									  configFileGetFIODFP(),
									  pCode->code.cLoad.pFile->arg.data.value.pCharValue,
									  &pBuf,
									  &size))
			{
				status = STATUS_FAIL;
				break;
			}

			if (emfio_loadCommand(
						pCode->code.cLoad.pFrame->arg.data.value.intValue,
						pBuf,
						(uint32_t)size))
			{
				OUTPUT_ERR(pCode->common.lineNumber,
						   "interpretLoad(): Could not load CMD",
						   emfio_getErrorText(),
						   NULL);
				status = STATUS_FAIL;
				free(pBuf);
			}
		}
		break;

		default:
		{
			OUTPUT_ERR(pCode->common.lineNumber,
					   "interpretLoad(): Unknown load type requested",
					   NULL,
					   NULL);
			status = STATUS_FAIL;
		}
		break;
	}

	outputXmlTagClose(LEVEL_SUMMARY, P_LOAD);

	return(status);
}