void AX12::setEndlessTurnMode (bool endless) { // prende o apaga el modo "endless turn" writeInfo (CW_ANGLE_LIMIT, 0); if (endless) { writeInfo (CCW_ANGLE_LIMIT, 0); } else { writeInfo (CCW_ANGLE_LIMIT, 1023); } }
void CodeLog::recordLog(char* log) { tail++; QString tmpLog = log; writeInfo(dealInfo(tmpLog)); }
void CodeLog::operator <<(char* log) { tail++; QString tmpLog = log; writeInfo(dealInfo(tmpLog)); }
void Server::printResponseError() { /*SET COOKIES*/ // std::cout << "Set-Cookie:UserID=XYZ;\r\n"; // std::cout << "Set-Cookie:Password=XYZ123;\r\n"; // std::cout << "Set-Cookie:Domain=localhost;\r\n"; // std::cout << "Set-Cookie:Path=/;\n"; std::cout << "Content-type:text/html\r\n\r\n"; std::cout << "{\"error\": \"Image not found.\"}" << std::endl; writeInfo(); }
static void gtfGroupToGenePred(struct gffFile *gtf, struct gffGroup *group, FILE *gpFh, FILE *infoFh) /* convert one gtf group to a genePred */ { unsigned optFields = (clGenePredExt ? genePredAllFlds : 0); struct errCatch *errCatch = errCatchNew(); if (errCatchStart(errCatch)) { struct genePred *gp = genePredFromGroupedGtf(gtf, group, group->name, optFields, clGxfOptions); if (gp == NULL) { if (!clIgnoreGroupsWithoutExons) { char *msg = "no exons defined for group %s, feature %s (perhaps try -ignoreGroupsWithoutExons)"; if (clAllErrors) { fprintf(stderr, msg, group->name, group->lineList->feature); fputc('\n', stderr); badGroupCount++; } else errAbort(msg, group->name, group->lineList->feature); } } else { genePredTabOut(gp, gpFh); genePredFree(&gp); } } errCatchEnd(errCatch); if (errCatch->gotError) { // drop trailing newline in caught message if (endsWith(errCatch->message->string, "\n")) dyStringResize(errCatch->message, dyStringLen(errCatch->message)-1); if (clAllErrors) { fprintf(stderr, "%s\n", errCatch->message->string); badGroupCount++; } else errAbort("%s", errCatch->message->string); } else { if (infoFh != NULL) writeInfo(infoFh, group); } errCatchFree(&errCatch); }
bool LogType::validate() { writeInfo ( "config FILE = %s", getConfigFile().c_str()); // check if config file exists if( !fileExists(getConfigFile()) ) { writeError ("Can't find config FILE = %s", getConfigFile().c_str()); return false; } // check if config file can read if( !fileReadable(getConfigFile()) ) { writeError ("Can't read from config FILE = %s", getConfigFile().c_str()); return false; } // check if config file exists if( !iniParse(getConfigFile()) ) { writeError ("Can't parse config FILE = %s", getConfigFile().c_str()); return false; } bool result = parseStorageType() && parseIpAddress() && parseRemotePort() && parseSourcePort() && parseUdpBufferSize(); if (result) { __udp_socket = new boost::asio::ip::udp::socket( __io_service, boost::asio::ip::udp::endpoint( boost::asio::ip::address::from_string(getIpAddress()), getSourcePort())); __udp_remote_endpoint = new boost::asio::ip::udp::endpoint( boost::asio::ip::udp::endpoint( boost::asio::ip::address::from_string(getIpAddress()), getRemotePort())); } return result; }
void tarch::logging::CommandLineLogger::info(const long int& timestampMS, const std::string& timestampHumanReadable, const std::string& machineName, const std::string& trace, const std::string& message) { if (writeInfo(trace)) { std::string outputMessage = constructMessageString( "info", timestampMS, timestampHumanReadable, machineName, trace, message ); tarch::multicore::Lock lockCout( _semaphore ); out() << outputMessage; if (out()!=std::cout) { std::cout << outputMessage; } } }
retorno * obteneridcliente_1_svc(void *argp, struct svc_req *rqstp) { static retorno result; ClientesInfo* numeradorInfo; int numero = 0; char exito = 0; int i = 0; initIPC(); printf("Intentando obtener un cliente libre.\n"); wait(0); { numeradorInfo = (ClientesInfo*)data; while ((exito == 0) && (i < MAX_CLIENTES)) { printf("Verificando cliente numero: %d: %d.\n",i+1, numeradorInfo->idClientes[i]); if (numeradorInfo->idClientes[i] == 0) { printf("Cliente libre: %d.\n",i+1); numero = i+1; exito = 1; numeradorInfo->idClientes[i] = 1; } ++i; } if (exito == 1) { writeInfo(numeradorInfo); } } signal(0); result.retorno_u.numero = numero; if (exito == 1) { result.cod_ret = 1; printf("Cliente libre obtenido: %d.\n", numero); } else { result.cod_ret = 2; printf("No hay clientes libres disponibles.\n"); } return &result; }
retorno * numeradorvendedor_2_svc(void *argp, struct svc_req *rqstp) { printf("Intentando obtener un vendedor libre.\n"); static retorno result; initIPC(); NumeradorInfo* numeradorInfo; int numero = 0; char exito = 0; wait(0); { numeradorInfo = (NumeradorInfo*)data; int i = 0; while ((exito == 0) && (i < MAX_VENDEDORES)) { if (numeradorInfo->numerosVendedores[i] == 0) { numero = i+1; exito = 1; numeradorInfo->numerosVendedores[i] = 1; } ++i; } if (exito == 1) { writeInfo(numeradorInfo); } } signal(0); result.retorno_u.numero = numero; if (exito == 1) { result.cod_ret = 1; printf("Vendedor libre obtenido: %d.", numero); } else { result.cod_ret = 2; printf("No hay vendedores libres disponibles."); } result.retorno_u.numero = 8; result.cod_ret = 1; return &result; }
void * devolveridcliente_1_svc(int *argp, struct svc_req *rqstp) { static char * result; ClientesInfo* numeradorInfo; printf("Devolviendo el cliente: %d.\n", (*argp)); initIPC(); wait(0); { numeradorInfo = (ClientesInfo*)data; numeradorInfo->idClientes[(*argp)-1] = 0; writeInfo(numeradorInfo); } signal(0); return (void *) &result; }
void * devolvervendedor_2_svc(int *argp, struct svc_req *rqstp) { printf("Devolviendo el vendedor: %d.\n", (*argp)); static char * result; initIPC(); NumeradorInfo* numeradorInfo; wait(0); { numeradorInfo = (NumeradorInfo*)data; numeradorInfo->numerosVendedores[(*argp)-1] = 0; writeInfo(numeradorInfo); } signal(0); return (void *) &result; }
bool LogType::parseIpAddress() { setIpAddress ( iniGetValue( ini::SECTION, ini::VAR_SWA_IP, ini::settings::ipAddress ) ); if (iniGetError()) { writeError( "Can't get 'IP Address'" ); return false; } if( getIpAddress().empty() ) { writeError( "'IP Address' invalid" ); return false; } writeInfo ( "IP Address = %s", getIpAddress().c_str()); return true; }
bool LogType::parseSourcePort() { setSourcePort( iniGetValue( ini::SECTION, ini::VAR_SWA_SOURCEPORT, ini::settings::sourcePort )); if (iniGetError()) { writeError( "Can't get 'Source Port'" ); return false; } if (getSourcePort() == UINT16_MAX) { writeError( "'Source Port' invalid" ); return false; } writeInfo ( "Source Port = %d", getSourcePort()); return true; }
bool LogType::parseStorageType() { setStorageType( iniGetValue( ini::SECTION, ini::VAR_SWA_STORAGETYPE, ini::settings::storageType )); if (iniGetError()) { writeError( "Can't get 'Storage Type'" ); return false; } if ((getStorageType() == LOG_STORAGETYPE_UNKNOWN) || (getStorageType() > LOG_STORAGETYPE_LAST)) { writeError( "'Storage Type' invalid" ); return false; } writeInfo ( "Storage Type = %d (%s)", getStorageType(), getStorageTypeAsString().c_str()); return true; }
bool LogType::parseRemotePort() { setRemotePort( iniGetValue( ini::SECTION, ini::VAR_SWA_REMOTEPORT, ini::settings::remotePort )); if (iniGetError()) { writeError( "Can't get 'Remote Port'" ); return false; } if ((getRemotePort() == 0) || (getRemotePort() == UINT16_MAX)) { writeError( "'Remote Port' invalid" ); return false; } writeInfo ( "Remote Port = %d", getRemotePort()); return true; }
bool LogType::parseUdpBufferSize() { setUdpBufferSize( human2size( iniGetValue( ini::SECTION, ini::VAR_SWA_UDPBUFFERSIZE, size2human(ini::settings::udpBufferSize) ))); if (iniGetError()) { writeError( "Can't get 'UDP Buffer Size'" ); return false; } if ( getUdpBufferSize() == 0 ) { writeError( "'UDP Buffer Size' invalid" ); return false; } writeInfo ( "UDP Buffer Size = %s (%lu bytes)", size2human(getUdpBufferSize()).c_str(), getUdpBufferSize()); return true; }
void * resetearclientes_1_svc(void *argp, struct svc_req *rqstp) { static char * result; ClientesInfo* numeradorInfo; int i; printf("Reseteando clientes...\n"); initIPC(); wait(0); { numeradorInfo = (ClientesInfo*)data; for (i = 0; i < MAX_CLIENTES; ++i) { numeradorInfo->idClientes[i] = 0; } writeInfo(numeradorInfo); } signal(0); return (void *) &result; }
void * resetearvendedores_2_svc(void *argp, struct svc_req *rqstp) { static char * result; printf("Reseteando vendedores...\n"); initIPC(); NumeradorInfo* numeradorInfo; wait(0); { numeradorInfo = (NumeradorInfo*)data; int i; for (i = 0; i < MAX_CLIENTES; ++i) { numeradorInfo->numerosVendedores[i] = 0; } writeInfo(numeradorInfo); } signal(0); return (void *) &result; }
void TDiagnostics::print(ID id, const pp::SourceLocation& loc, const std::string& text) { writeInfo(severity(id), loc, message(id), text, ""); }
double RateFree::optimizeWithEM() { size_t ptn, c; size_t nptn = phylo_tree->aln->getNPattern(); size_t nmix = ncategory; const double MIN_PROP = 1e-4; // double *lk_ptn = aligned_alloc<double>(nptn); double *new_prop = aligned_alloc<double>(nmix); PhyloTree *tree = new PhyloTree; // attach memory to save space // tree->central_partial_lh = phylo_tree->central_partial_lh; // tree->central_scale_num = phylo_tree->central_scale_num; // tree->central_partial_pars = phylo_tree->central_partial_pars; tree->copyPhyloTree(phylo_tree); tree->optimize_by_newton = phylo_tree->optimize_by_newton; tree->setParams(phylo_tree->params); tree->setLikelihoodKernel(phylo_tree->sse); tree->setNumThreads(phylo_tree->num_threads); // initialize model ModelFactory *model_fac = new ModelFactory(); model_fac->joint_optimize = phylo_tree->params->optimize_model_rate_joint; // model_fac->unobserved_ptns = phylo_tree->getModelFactory()->unobserved_ptns; RateHeterogeneity *site_rate = new RateHeterogeneity; tree->setRate(site_rate); site_rate->setTree(tree); model_fac->site_rate = site_rate; tree->model_factory = model_fac; tree->setParams(phylo_tree->params); double old_score = 0.0; // EM algorithm loop described in Wang, Li, Susko, and Roger (2008) for (int step = 0; step < ncategory; step++) { // first compute _pattern_lh_cat double score; score = phylo_tree->computePatternLhCat(WSL_RATECAT); if (score > 0.0) { phylo_tree->printTree(cout, WT_BR_LEN+WT_NEWLINE); writeInfo(cout); } ASSERT(score < 0); if (step > 0) { if (score <= old_score-0.1) { phylo_tree->printTree(cout, WT_BR_LEN+WT_NEWLINE); writeInfo(cout); cout << "Partition " << phylo_tree->aln->name << endl; cout << "score: " << score << " old_score: " << old_score << endl; } ASSERT(score > old_score-0.1); } old_score = score; memset(new_prop, 0, nmix*sizeof(double)); // E-step // decoupled weights (prop) from _pattern_lh_cat to obtain L_ci and compute pattern likelihood L_i for (ptn = 0; ptn < nptn; ptn++) { double *this_lk_cat = phylo_tree->_pattern_lh_cat + ptn*nmix; double lk_ptn = phylo_tree->ptn_invar[ptn]; for (c = 0; c < nmix; c++) { lk_ptn += this_lk_cat[c]; } ASSERT(lk_ptn != 0.0); lk_ptn = phylo_tree->ptn_freq[ptn] / lk_ptn; // transform _pattern_lh_cat into posterior probabilities of each category for (c = 0; c < nmix; c++) { this_lk_cat[c] *= lk_ptn; new_prop[c] += this_lk_cat[c]; } } // M-step, update weights according to (*) int maxpropid = 0; double new_pinvar = 0.0; for (c = 0; c < nmix; c++) { new_prop[c] = new_prop[c] / phylo_tree->getAlnNSite(); if (new_prop[c] > new_prop[maxpropid]) maxpropid = c; } // regularize prop bool zero_prop = false; for (c = 0; c < nmix; c++) { if (new_prop[c] < MIN_PROP) { new_prop[maxpropid] -= (MIN_PROP - new_prop[c]); new_prop[c] = MIN_PROP; zero_prop = true; } } // break if some probabilities too small if (zero_prop) break; bool converged = true; double sum_prop = 0.0; for (c = 0; c < nmix; c++) { // new_prop[c] = new_prop[c] / phylo_tree->getAlnNSite(); // check for convergence sum_prop += new_prop[c]; converged = converged && (fabs(prop[c]-new_prop[c]) < 1e-4); prop[c] = new_prop[c]; new_pinvar += new_prop[c]; } new_pinvar = 1.0 - new_pinvar; if (new_pinvar > 1e-4 && getPInvar() != 0.0) { converged = converged && (fabs(getPInvar()-new_pinvar) < 1e-4); if (isFixPInvar()) outError("Fixed given p-invar is not supported"); setPInvar(new_pinvar); // setOptimizePInvar(false); phylo_tree->computePtnInvar(); } ASSERT(fabs(sum_prop+new_pinvar-1.0) < MIN_PROP); // now optimize rates one by one double sum = 0.0; for (c = 0; c < nmix; c++) { tree->copyPhyloTree(phylo_tree); ModelMarkov *subst_model; if (phylo_tree->getModel()->isMixture() && phylo_tree->getModelFactory()->fused_mix_rate) subst_model = (ModelMarkov*)phylo_tree->getModel()->getMixtureClass(c); else subst_model = (ModelMarkov*)phylo_tree->getModel(); tree->setModel(subst_model); subst_model->setTree(tree); model_fac->model = subst_model; if (subst_model->isMixture() || subst_model->isSiteSpecificModel() || !subst_model->isReversible()) tree->setLikelihoodKernel(phylo_tree->sse); // initialize likelihood tree->initializeAllPartialLh(); // copy posterior probability into ptn_freq tree->computePtnFreq(); double *this_lk_cat = phylo_tree->_pattern_lh_cat+c; for (ptn = 0; ptn < nptn; ptn++) tree->ptn_freq[ptn] = this_lk_cat[ptn*nmix]; double scaling = rates[c]; tree->scaleLength(scaling); tree->optimizeTreeLengthScaling(MIN_PROP, scaling, 1.0/prop[c], 0.001); converged = converged && (fabs(rates[c] - scaling) < 1e-4); rates[c] = scaling; sum += prop[c] * rates[c]; // reset subst model tree->setModel(NULL); subst_model->setTree(phylo_tree); } phylo_tree->clearAllPartialLH(); if (converged) break; } // sort the rates in increasing order if (sorted_rates) quicksort(rates, 0, ncategory-1, prop); // deattach memory // tree->central_partial_lh = NULL; // tree->central_scale_num = NULL; // tree->central_partial_pars = NULL; delete tree; aligned_free(new_prop); return phylo_tree->computeLikelihood(); }
void AX12::endlessTurn (int velocidad) { // setea la velocidad, en el modo "endless turn" bool direccion = sign2bin (velocidad); writeInfo (MOVING_SPEED, abs(velocidad)|((direccion^inverse)<<10)); }
int main(int argc,char ** argv) { int N,NEV,MAXEVENTS,II,J; double cs; FILE *lun1=NULL; long posNevents, posSize; int SLHA=0; double Lumi; if(argc<4){ printf("%s needs arguments: Luminosity[1/fb] nEvents event_directories ...\n",argv[0]); exit(1); } if(sscanf(argv[1],"%lf",&Lumi)!=1) { printf("Can not read first argument. It should be luminosity in [1/fb] units.\n"); exit(1); } srand48(time(NULL)); if(argv[2][0]=='?') NEV=-1; else { if(sscanf(argv[2],"%d",&NEV)!=1 || NEV<0) {printf("Can not read second argument. Number of events is expected.\n"); exit(1);} } if(access("decaySLHA.txt", R_OK)==0){ readslha_(); SLHA=1;} for(II=3;II<argc;II++) scandir_(argv[II],strlen(argv[II])); if( Lumi <= 0 && NEV <=0 ) { writeInfo(); exit(0);} eventstat_(&cs, &MAXEVENTS); if(cs==0) { printf("There are no events \n"); exit(1); } printf("%.3E -total cross section[pb]\n", cs); printf("%d -maximum number of events\n", MAXEVENTS); if(Lumi >0 && (NEV<=0 || NEV> 1000*Lumi*cs)) NEV=1000*Lumi*cs; lun1=fopen("event_mixer.lhe","w"); upinit_(); if(lun1) { fprintf(lun1,"<LesHouchesEvents version=\"1.0\">\n"); fprintf(lun1,"<!--\n"); fprintf(lun1,"File generated with CalcHEP-PYTHIA interface\n"); fprintf(lun1,"-->\n"); fprintf(lun1,"<header>\n"); #ifdef HEPML fprintf(lun1,"<hepml>\n"); fprintf(lun1,"<samples xmlns=\"http://mcdb.cern.ch/hepml/0.2/\"\n"); fprintf(lun1," xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"); fprintf(lun1," xsi:schemaLocation=\"http://mcdb.cern.ch/hepml/0.2/ http://mcdb.cern.ch/hepml/0.2/hepml.xsd\">\n"); fprintf(lun1," <files>\n"); fprintf(lun1," <file>\n"); fprintf(lun1," <eventsNumber> "); posNevents=ftell(lun1); fprintf(lun1," </eventsNumber>\n"); fprintf(lun1," <crossSection unit=\"pb\">%.4E</crossSection>\n",cs); fprintf(lun1," <fileSize> "); posSize=ftell(lun1); fprintf(lun1," </fileSize>\n"); // fprintf(lun1," <checksum type=\"md5\">d7722af9e2886fa465e3f7b786c3e6e6</checksum>\n"); fprintf(lun1," <comments> </comments>\n"); fprintf(lun1," <location>\n"); // fprintf(lun1," <path/>\n"); fprintf(lun1," </location>\n"); fprintf(lun1," </file>\n"); fprintf(lun1," </files>\n"); fprintf(lun1," <description>\n"); fprintf(lun1," <title> </title>\n"); fprintf(lun1," <abstract> </abstract>\n"); fprintf(lun1," <authorComments> </authorComments>\n"); fprintf(lun1," <experimentGroup>\n"); fprintf(lun1," <experiment> </experiment>\n"); fprintf(lun1," <group> </group>\n"); fprintf(lun1," <responsiblePerson> </responsiblePerson>\n"); fprintf(lun1," <description> </description>\n"); fprintf(lun1," </experimentGroup>\n"); fprintf(lun1," <generator>\n"); fprintf(lun1," <name>CalcHEP</name>\n"); fprintf(lun1," <version> %s </version>\n",VERSION); fprintf(lun1," <homepage>http://theory.sinp.msu.ru/~pukhov/calchep.html</homepage>\n"); fprintf(lun1," <description>\n"); fprintf(lun1," CalcHEP - a package for calculation of Feynman diagrams\n" " integration over multi-particle phase space,\n" " generation of events and application of decay processes\n"); fprintf(lun1," </description>\n"); fprintf(lun1," </generator>\n"); fprintf(lun1," <model>\n"); // fprintf(lun1," <name> %s </name>\n",getField("run_details.txt","Model:")); fprintf(lun1," <name> </name>\n"); fprintf(lun1," <description>%s</description>\n",getField("run_details.txt","Model:")); fprintf(lun1," <parameters>\n"); if(SLHA) { int i,j; char name[50]; double complex val; for(i=1; allBlocks(i,0,name,NULL,NULL,NULL);i++) if(strcmp(name,"MODELPARAMETERS")==0) { for(j=1;allBlocks(i,j,name,NULL,NULL,&val);j++) { fprintf(lun1," <parameter>\n"); fprintf(lun1," <name>%s</name>\n",slhaComment); fprintf(lun1," <value>%f</value>\n",creal(val) ); fprintf(lun1," <notation>\n"); fprintf(lun1," <plain> </plain>\n"); fprintf(lun1," <Latex> </Latex>\n"); fprintf(lun1," </notation>\n"); fprintf(lun1," <description> </description>\n"); fprintf(lun1," </parameter>\n"); } } } fprintf(lun1," </parameters>\n"); fprintf(lun1," </model>\n"); fprintf(lun1," <process>\n"); fprintf(lun1," <beam1>\n"); fprintf(lun1," <particle KFcode=\"%d\">%s</particle>\n",R_.IDBMUP[0],pdg2name(R_.IDBMUP[0])); fprintf(lun1," <energy unit=\"GeV\">%.3E</energy>\n",R_.EBMUP[0]); fprintf(lun1," <pdf name= \"%s\"> </pdf>\n", getField("run_details.txt","pdf1 :")); // fprintf(lun1," <QCDCoupling>\n"); // fprintf(lun1," <Lambda unit=\"GeV\">0.226200</Lambda>\n"); // fprintf(lun1," <NFlavours>6</NFlavours>\n"); // fprintf(lun1," <NLoopsAlphaS>2</NLoopsAlphaS>\n"); // fprintf(lun1," </QCDCoupling>\n"); fprintf(lun1," </beam1>\n"); fprintf(lun1," <beam2>\n"); fprintf(lun1," <particle KFcode=\"%d\">%s</particle>\n",R_.IDBMUP[1],pdg2name(R_.IDBMUP[0])); fprintf(lun1," <energy unit=\"GeV\">%.3E</energy>\n",R_.EBMUP[1]); fprintf(lun1," <pdf name= \"%s\"> </pdf>\n", getField("run_details.txt","pdf2 :")); // fprintf(lun1," <QCDCoupling>\n"); // fprintf(lun1," <Lambda unit=\"GeV\">0.226200</Lambda>\n"); // fprintf(lun1," <NFlavours>6</NFlavours>\n"); // fprintf(lun1," <NLoopsAlphaS>2</NLoopsAlphaS>\n"); // fprintf(lun1," </QCDCoupling>\n"); fprintf(lun1," </beam2>\n"); //All Final state tags are required!!! fprintf(lun1," <finalState>\n"); { char*out=getField("run_details.txt","Process :"); out=strstr(out,"->"); if(out)out+=2; else out=""; fprintf(lun1," <state>%s\n",out); fprintf(lun1," </state>\n"); fprintf(lun1," <notation>\n"); fprintf(lun1," <plain>%s\n",out); } fprintf(lun1," </plain>\n"); fprintf(lun1," <Latex> </Latex>\n"); fprintf(lun1," </notation>\n"); fprintf(lun1," </finalState>\n"); fprintf(lun1," <crossSection unit=\"pb\">%.3E</crossSection>\n",cs); fprintf(lun1," <subprocesses>\n"); printProcInfo(lun1); // fprintf(lun1," <FactorisationScale>\n"); // fprintf(lun1," <plain> </plain>\n"); // fprintf(lun1," <Latex> </Latex>\n"); // fprintf(lun1," </FactorisationScale>\n"); fprintf(lun1," </subprocesses>\n"); fprintf(lun1," </process>\n"); fprintf(lun1," <cuts>\n"); fprintf(lun1," <cutSet cutset_id=\"1\">\n"); fprintf(lun1," <cut>\n"); fprintf(lun1," <object>\n"); fprintf(lun1," <name> </name>\n"); fprintf(lun1," <notation>\n"); fprintf(lun1," <plain> </plain>\n"); fprintf(lun1," <Latex> </Latex>\n"); fprintf(lun1," </notation>\n"); fprintf(lun1," </object>\n"); fprintf(lun1," <minValue> </minValue>\n"); fprintf(lun1," <maxValue> </maxValue>\n"); fprintf(lun1," <logic> </logic>\n"); fprintf(lun1," </cut>\n"); fprintf(lun1," </cutSet>\n"); fprintf(lun1," </cuts>\n"); fprintf(lun1," <authors>\n"); fprintf(lun1," <author>\n"); fprintf(lun1," <firstName>CalcHEP</firstName>\n"); fprintf(lun1," <lastName> </lastName>\n"); fprintf(lun1," <email>calchep[at]goolegroups.com</email> \n"); fprintf(lun1," <experiment> </experiment>\n"); fprintf(lun1," <group> </group>\n"); fprintf(lun1," <organization> </organization>\n"); fprintf(lun1," </author>\n"); fprintf(lun1," </authors>\n"); // fprintf(lun1," <relatedPapers> </relatedPapers>\n"); fprintf(lun1," </description>\n"); fprintf(lun1,"</samples>\n"); fprintf(lun1,"</hepml>\n"); #endif fprintf(lun1,"<slha>\n"); if(SLHA) { int i,j,k,pIn,pOut[20],len; int SM[16]={1,2,3,4,5,6,11,12,13,14,15,16,21,22,23,24}; double width,br; int pdg, eQ3, spinDim, cDim,neutral; for(i=1;allQnumbers(i, &pdg,&eQ3,&spinDim,&cDim,&neutral);i++) { for(k=0;k<16;k++) if(pdg==SM[k]) break; if(k==16 && pdg!=25) fprintf(lun1,"BLOCK QNUMBERS %d # %s\n" " 1 %d\n 2 %d\n 3 %d\n 4 %d\n\n" , pdg,slhaComment,eQ3,spinDim,cDim,neutral); } { char blkName[100]; int key[100]; double complex val; int first=1; for(i=1;allBlocks(i, 0 , blkName, NULL ,NULL, NULL);i++) if(strcmp(blkName,"MASS")==0) { for(j=1; allBlocks(i,j, blkName, &len,key, &val);j++) if(len==1) { for(k=0;k<16;k++) if(key[0]==SM[k]) break; if(k==16) { if(first) { fprintf(lun1,"BLOCK MASS\n"); first=0;} fprintf(lun1," %d %E # \n", key[0], creal(val)); } } break; } if(!first) fprintf(lun1,"\n"); } for(i=1; allDecays(i,0,&pIn, &len,pOut,&width,&br);i++) { for(k=0;k<16;k++) if(pIn==SM[k]) break; if(k==16) { fprintf(lun1,"DECAY %d %E # %s \n",pIn,width,slhaComment); for(j=1; allDecays(i,j,&pIn, &len,pOut,&width,&br);j++) { fprintf(lun1," %E %d ",br, len); for(k=0;k<len;k++) fprintf(lun1," %d ",pOut[k]); fprintf(lun1," # %s \n",slhaComment); } } } } fprintf(lun1,"</slha>\n"); #ifdef RUN_DETAILS if(access("run_details.txt", R_OK)==0) { FILE * f=fopen("run_details.txt","r"); int ch; for(;;) { ch=fgetc(f); if(ch== EOF) break; fputc(ch,lun1); } fclose(f); } #endif fprintf(lun1,"</header>\n"); fprintf(lun1,"<init>\n"); fprintf(lun1," %5d %5d %18.11E %18.11E %5d %5d %5d %5d %5d %5d\n", R_.IDBMUP[0],R_.IDBMUP[1],R_.EBMUP[0], R_.EBMUP[1], R_.PDFGUP[0],R_.PDFGUP[1],R_.PDFSUP[0],R_.PDFSUP[1], R_.IDWTUP,R_.NPRUP); fprintf(lun1," %18.11E %18.11E %18.11E %3d\n", cs,R_.XERRUP[0],R_.XMAXUP[0], R_.LPRUP[0]); fprintf(lun1,"</init>\n"); } for(N=1;N<=NEV;N++) { while(upevnt_()); if(E_.NUP==0){printf("Only %d events are generated\n", N-1); break;} if(lun1) { fprintf(lun1,"<event>\n"); fprintf(lun1,"%2d %4d %15.7E %15.7E %15.7E %15.7E\n", E_.NUP,E_.IDPRUP,E_.XWGTUP,E_.SCALUP,E_.AQEDUP,E_.AQCDUP); for(II=0;II<E_.NUP;II++) { double s; fprintf(lun1," %8d %4d", E_.IDUP[II],E_.ISTUP[II]); for(J=0;J<2;J++) fprintf(lun1," %4d", E_.MOTHUP[II][J]); for(J=0;J<2;J++) fprintf(lun1," %4d", E_.ICOLUP[II][J]); for(J=0;J<4;J++) fprintf(lun1," %18.11E",E_.PUP[II][J]); if(E_.ISTUP[II]==2) { s= E_.PUP[II][3]*E_.PUP[II][3] - E_.PUP[II][0]*E_.PUP[II][0] -E_.PUP[II][1]*E_.PUP[II][1]-E_.PUP[II][2]*E_.PUP[II][2]; if(s<0) s=-sqrt(-s); else s=sqrt(s); } else s=E_.PUP[II][4]; fprintf(lun1," %18.11E",s); fprintf(lun1," %11.4E %4.1f\n",E_.VTIMUP[II],E_.SPINUP[II]); } fprintf(lun1,"</event>\n"); } } if(lun1) { long size; fprintf(lun1,"</LesHouchesEvents>\n"); #ifdef HEPML size=ftell(lun1); fseek(lun1, posNevents,SEEK_SET); fprintf(lun1,"%d",N-1); fseek(lun1,posSize,SEEK_SET); fprintf(lun1,"%ld", size); #endif fclose(lun1); } closeevents_(); return 0; }
// nota: si no coincide el SRL declarado con el del motor, los mensajes de respuesta son malinterpretados void AX12::setSRL (byte _srl) { SRL = _srl; writeInfo (STATUS_RETURN_LEVEL, SRL); }
byte AX12::changeID (byte newID) { if (newID > 253) {return id;} writeInfo (ID, newID); id = newID; return id; }
void Store( pwr_tBoolean *firstTime, pwr_tUInt32 *nrOfEvents, pwr_tUInt32 *nrOfKeys ) { char msg[80]; pwr_tInt32 ret = 0; DBT key; sKey skey; /*flush the cache to the DB-file*/ dataBaseP->sync(dataBaseP, 0); /*check if it's time to clean the DB*/ if( *firstTime || ((*nrOfEvents + nrOfInsertsSinceLastTime) > lHelCB.MaxCardinality ) ) { *firstTime = FALSE; if(nrOfInsertsSinceLastTime > 0) { nrOfInsertsSinceLastTime--; *nrOfEvents = *nrOfEvents + 1; } if( *nrOfKeys <= 0) { ret = GetOldestEvents(nrOfEvents, nrOfKeys); nrOfInsertsSinceLastTime = 0; switch(ret) { case RT_ELOG_UNKNOWN_ERROR: errh_Error("RT_ELOG_UNKNOWN_ERROR"); break; case RT_ELOG_OK: break; case RT_ELOG_DB_EMPTY: break; default: errh_Error("Undefined return: %d", ret); break; } } else { lanklank = firstlink(listhead); skey = getlink(lanklank); memset(&key, 0, sizeof(key)); key.data = &skey; key.size = sizeof(sKey); if( (ret = dataBaseP->del(dataBaseP, NULL, &key, 0)) != 0 ) { sprintf(msg, "Error deleting Record in HistDB nrOfKeys = %d Errmess=%s\n", *nrOfKeys, db_strerror(ret)); Log(msg); } else { *nrOfEvents = *nrOfEvents - 1; } elimlink(&lanklank); *nrOfKeys = *nrOfKeys - 1; } } if(*nrOfKeys > 0) { lanklank = firstlink(listhead); if(lanklank != 0) { writeInfo(*nrOfEvents+nrOfInsertsSinceLastTime, 0, &lanklank->data.EventTime); } else { writeInfo(*nrOfEvents+nrOfInsertsSinceLastTime, 0, NULL); } } else { writeInfo(*nrOfEvents+nrOfInsertsSinceLastTime, 0, NULL); } }
void Server::printResponse(roiHandler* roiHandler) { int x = 0; int y = 0; serverSendResponseTime = timestamp_usec(); //Server::getServer()->setCookie("key", "value"); // srand((unsigned)timestamp_usec()); // x = (rand()%(screenWidthPixel+1)); // y = (rand()%(screenHeightPixel+1)); // cv::Point watchingPoint = paul.getWatchingPoint(); // x = watchingPoint.x; // y = watchingPoint.y; x = watchingPoint.x; y = watchingPoint.y; /*SET COOKIES*/ // std::cout << "Set-Cookie:UserID=XYZ;\r\n"; // std::cout << "Set-Cookie:Password=XYZ123;\r\n"; // std::cout << "Set-Cookie:Domain=localhost;\r\n"; // std::cout << "Set-Cookie:Path=/;\n"; // saveCookies(); // std::cout << "Content-type:text/html\r\n\r\n"; std::cout << "{"; std::cout << "\"x\": " << x; std::cout << ", \"y\": " << y; std::cout << ", \"numSnapshot\": " << numSnapshot; if (roiHandler->hasFace()) { std::cout << ", \"face\": {\"x\": " << roiHandler->getFace().x << ", \"y\": " << roiHandler->getFace().y << ", \"width\": " << roiHandler->getFace().width << ", \"height\": " << roiHandler->getFace().height << "}"; } else { std::cout << ", \"face\": null"; } if (roiHandler->hasLeftEye()) { std::cout << ", \"leftEye\": {\"x\": " << roiHandler->getFace().x + roiHandler->getLeftEye().x << ", \"y\": " << roiHandler->getFace().y + roiHandler->getLeftEye().y << ", \"width\": " << roiHandler->getLeftEye().width << ", \"height\": " << roiHandler->getLeftEye().height << "}"; } else { std::cout << ", \"leftEye\": null"; } if (roiHandler->hasRightEye()) { std::cout << ", \"rightEye\": {\"x\": " << roiHandler->getFace().x + roiHandler->getRightEye().x << ", \"y\": " << roiHandler->getFace().y + roiHandler->getRightEye().y << ", \"width\": " << roiHandler->getRightEye().width << ", \"height\": " << roiHandler->getRightEye().height << "}"; } else { std::cout << ", \"rightEye\": null"; } if (roiHandler->hasMouth()) { std::cout << ", \"mouth\": {\"x\": " << roiHandler->getFace().x + roiHandler->getMouth().x << ", \"y\": " << roiHandler->getFace().y + roiHandler->getMouth().y << ", \"width\": " << roiHandler->getMouth().width << ", \"height\": " << roiHandler->getMouth().height << "}"; } else { std::cout << ", \"mouth\": null"; } std::cout << ", \"snapshotType\": \"" << snapshotType << "\"" << std::endl; if (snapshotType.compare("training") == 0) { if ((roiHandler->hasFace()) && (roiHandler->hasLeftEye()) && (roiHandler->hasRightEye()) && (roiHandler->hasMouth())) { std::cout << ", \"train\": { \"isDone\": true }" << std::endl; } } std::cout << ", \"ip\": \"" << ip << "\"" << std::endl; std::cout << ", \"timeTable\": { \"times\": { \"serverReceiveImage\": \"" << serverReceiveImageTime << "\", \"serverSendResponse\": \"" << serverSendResponseTime << "\" } } " << std::endl; std::cout << "}" << std::endl; writeInfo(); return; }
void CodeLog::recordLog(QString log) { tail++; writeInfo(dealInfo(log)); }
void CodeLog::recordLog(double log) { tail++; writeInfo(dealInfo(QString::number(log))); }
void CodeLog::operator <<(QString log) { tail++; writeInfo(dealInfo(log)); }
void CodeLog::operator <<(double log) { tail++; writeInfo(dealInfo(QString::number(log))); }