// maxProgress >=0, <= 1; ==2; void affine_propagator::prune(const affine r[], affine vars[], const int num_of_vars, bool& toDelete, double& maxProgress) { assert ( num_of_vars == n_vars ) ; maxProgress = 0.0; if (!affine::isValid) { //cout << "Deleted" << endl; toDelete = true; return; } reset_arrays(); bool to_discard = process_all_eqs(r, vars, maxProgress); if (to_discard) { affine::isValid = false; toDelete = true; return; } if (!check_for_zero(r, 0, n_vars-1)) { //cout << "Deleted" << endl; affine::isValid = false; toDelete = true; return; } bool has_changed = write_back(vars, maxProgress); if (!has_changed) maxProgress = 0.0; }
/** * should read command line options to set the pt bin size and the dy window * for now we'll fix this to being < 1 */ int main (int argc, char* argv[]){ int i; double rapcutFlow = 1.0; int ptCount[MAXPTBINS]; int evCount[MAXPTBINS]; double ptArray[MAXPARTS][MAXPTBINS]; double phiArray[MAXPARTS][MAXPTBINS]; double rapArray[MAXPARTS][MAXPTBINS]; int chArray[MAXPARTS][MAXPTBINS]; int nparts = 0; int nevents = 0; double meanV2, varV2; double nev; double binCent = 0.0; /* histogram stuff */ double dpt = 0.4; double ptmin = 0.0; double ptmax = 4.0; double v2MeanHist[MAXPTBINS]; double v2SqHist[MAXPTBINS]; for(i = 0; i < MAXPTBINS; i++){ v2MeanHist[i] = 0.0; v2SqHist[i] = 0.0; evCount[i] = 0.0; } char * buffer = NULL; size_t linecap = 0; size_t linelen; size_t retval; double EventBinFlow[2] = {0.0, 0.0}; /* get the first line, which is always an evt line, so we can ignore */ getline(&buffer, &linecap, stdin); do { reset_arrays(ptCount, ptArray, phiArray, rapArray, chArray); retval = read_event(stdin, dpt, &nparts, ptCount, ptArray, phiArray, rapArray, chArray); //printf("# %d %d\n\r", nevents, nparts); nevents++; for(i = 0; i < MAXPTBINS; i++){ compute_flow_contrib_naiive(i, ptCount, evCount, EventBinFlow, ptArray, phiArray, rapArray, chArray); v2MeanHist[i] += EventBinFlow[0]; v2SqHist[i] += EventBinFlow[1]; } } while (retval != EOF); /* we finished the stream */ for(i = 0; i < MAXPTBINS; i++){ if(evCount[i] > 0){ v2MeanHist[i] /= (double)evCount[i]; v2SqHist[i] /= (double)evCount[i]; } } /* finally we can print everything out */ for( i = 0 ; i < MAXPTBINS; i++){ binCent = (double)i*dpt + ptmin + (dpt)/2; nev = (double)evCount[i]; if(evCount[i] > 1 && binCent <= (ptmax+0.5)){ meanV2 = v2MeanHist[i]; varV2 = ((v2SqHist[i])-meanV2*meanV2); /* include the v3 columns just to make reading the data a little simpler */ printf("%lf %d %lf %lf 0.0 0.0\n", binCent, evCount[i], meanV2, sqrt(varV2)/(nev-1)); } } free(buffer); return EXIT_SUCCESS; }