int LPCINST::init(double p[], int n_args) { int rval; #ifdef MAXMSP LPCprofile(); #endif if (outputchans != 1) return die(name(), "Output file must have 1 channel only\n"); GetDataSet(&_dataSet); if (_dataSet == NULL) return die(name(), "No open dataset!\n"); _dataSet->ref(); _nPoles = _dataSet->getNPoles(); rval = localInit(p, n_args); if (rval == DONT_SCHEDULE) return die(name(), "LocalInit failed."); // Finish the initialization for (int i=0; i<_nPoles*2; i++) _past[i] = 0; /* nSamps() returns the number of sample frames that will be written to output (dur * SR). */ return nSamps(); }
Bool_t THSRooFit::InitialiseFit(){ cout<<" THSRooFit::InitialiseFit()"<<endl; if(GetDataSet()->numEntries()<2) {return kFALSE;} if(GetPDFs().getSize())0;// TotalPDF(); else { cout<<" THSRooFit::InitialiseFit() no model found for "<<GetName()<<" probably no events kinmatically allowed in this bin" <<endl; return kFALSE; } return kTRUE; }
Bool_t THSEventsFit::InitialiseFit(){ if(GetDataSet()->numEntries()<2) {cout<<" THSEventsFit::InitialiseFit() less than 2 entries in dataset!"<<endl; return kFALSE;} RooAbsPdf* pdf=0; Long64_t PdfN[GetPDFs().getSize()]; Long64_t TotalN=0; for(Int_t ip=0;ip<GetPDFs().getSize();ip++){ pdf=(RooAbsPdf*)&(GetPDFs()[ip]); THSEventsPDF* mpdf=0; cout<<" THSEventsFit::InitialiseFit(); PDFs "<<pdf->GetName()<<endl; if(mpdf=dynamic_cast<THSEventsPDF*>(pdf)){//Only applies to THSEventsPDF if(!(mpdf->GetHistPdf())){ cout<<"Start smeared model "<<gDirectory->GetName()<<endl; PdfN[ip]=mpdf->AddSmearedModel(0,GetAuxVars()); cout<<"Stop smeared model "<<gDirectory->GetName()<<endl; TotalN+=PdfN[ip]; if(PdfN[ip]<10) { cout<<" THSEventsFit::InitialiseFit() no events found for "<<GetName()<<" MODEL: "<<pdf->GetName()<<" probably no events kinmatically allowed in this bin" <<endl; GetPDFsp()->remove(GetPDFs()[ip]); GetYieldsp()->remove(*(GetWorkSpace()->var(fYld+pdf->GetName()))); GetWorkSpace()->removeSet("Yields"); GetWorkSpace()->removeSet("PDFs"); GetWorkSpace()->defineSet("Yields",GetYields()); GetWorkSpace()->defineSet("PDFs",GetPDFs()); } } } } for(Int_t ip=0;ip<GetPDFs().getSize();ip++){ if(PdfN[ip]/TotalN<fAccFrac){ // cout<<" THSEventsFit::InitialiseFit() "<<GetName()<<" MODEL: "<<GetPDFs()[ip]->GetName()<<" N events below acceptance fraction so not considered significant enough background " <<PdfN[ip] <<" out of "<<TotalN<<endl; GetPDFsp()->remove(GetPDFs()[ip]); GetYieldsp()->remove(*(GetWorkSpace()->var(fYld+pdf->GetName()))); GetWorkSpace()->removeSet("Yields"); GetWorkSpace()->removeSet("PDFs"); GetWorkSpace()->defineSet("Yields",GetYields()); GetWorkSpace()->defineSet("PDFs",GetPDFs()); } } if(GetPDFs().getSize()) TotalPDF(); else { cout<<" THSEventsFit::InitialiseFit() no model found for "<<GetName()<<" probably no events kinmatically allowed in this bin" <<endl; return kFALSE; } return kTRUE; }
void CXYChart::LPToNearest( CDC *pDC, LPPOINT point, double *data, int dataID ) { CChartData *dataSet; double *dataVals, minDist = 1e30; int nDims, *dims, i, minIndex = -1; LPToData( pDC, point, data ); if( dataID >= 0 ) { dataSet = GetDataSet( dataID ); if( dataSet == NULL ) return; } else { dataSet = GetAbsoluteDataSet( 0 ); if( dataSet == NULL ) return; } dims = dataSet->GetDimensions(); nDims = dataSet->GetNDimensions(); dataVals = dataSet->GetData(); if( nDims != 2 || dims[0] != 2 ) return; for( i = 0; i < dims[1]; i++ ) { if( fabs( dataVals[i] - data[0] ) < minDist ) { minDist = fabs(dataVals[i] - data[0]); minIndex = i; } } if( minIndex >= 0 ) { data[0] = dataVals[minIndex]; data[1] = dataVals[minIndex + dims[1]]; } }
//Get a set of data from the devices static int _F8_Handler (void) { uint8_t DataSet[18]; uint8_t i; GetDataSet(DataSet); for(i=0;i<19;i++) { printf_P(PSTR("%u: 0x%02X\n"), i, DataSet[i]); } /*uint16_t LS_Data[4]; TimeAndDate CurrentTime; int16_t Pressure_kPa; int16_t TemperatureData; int16_t RHData; //int16_t RecievedData; uint8_t stat; //StartTimer(); GetTime(&CurrentTime); printf_P(PSTR("%02u Days %02u:%02u:%02u\n"), CurrentTime.day, CurrentTime.hour, CurrentTime.min, CurrentTime.sec); //Read temperature stat = SHT25_ReadTemp(&TemperatureData); if(stat == SHT25_RETURN_STATUS_OK) { printf_P(PSTR("Temp %d.%02u C\n"), TemperatureData/100, TemperatureData%100); } else if(stat == SHT25_RETURN_STATUS_CRC_ERROR) { printf_P(PSTR("CRC Error\n")); } else { printf_P(PSTR("Timeout\n")); } //Read RH stat = SHT25_ReadRH(&RHData); if(stat == SHT25_RETURN_STATUS_OK) { printf_P(PSTR("RH: %u.%02u%%\n"), RHData/100, RHData%100); } else if(stat == SHT25_RETURN_STATUS_CRC_ERROR) { printf_P(PSTR("CRC Error\n")); } else { printf_P(PSTR("Timeout\n")); } //Current barometric pressure MPL115A1_GetPressure(&Pressure_kPa); printf_P(PSTR("Pressure: %u.%u kPa\n"), ((int16_t)Pressure_kPa)>>4, ((((int16_t)Pressure_kPa)&0x000F)*1000)/(16) ); if(tcs3414_GetData(&LS_Data[0], &LS_Data[1], &LS_Data[2], &LS_Data[3]) == 0) { printf_P(PSTR("red: 0x%04X\n"), LS_Data[0]); printf_P(PSTR("green: 0x%04X\n"), LS_Data[1]); printf_P(PSTR("blue: 0x%04X\n"), LS_Data[2]); printf_P(PSTR("clear: 0x%04X\n"), LS_Data[3]); } //StopTimer(); */ return 0; }