Beispiel #1
0
void threadExp(char *asciiSize, char *asciiJobCount, char *asciiThreadCount)
/* threadExp - Some pthread experiments. */
{
int size = atoi(asciiSize);
int jobCount = atoi(asciiJobCount);
int threadCount = atoi(asciiThreadCount);
pthread_t *threads;
int i;

double *results;
double sumErr = 0;
struct calcJob *jobList, *job;
if (size <= 0)
   usage();
AllocArray(results, size);
AllocArray(threads, threadCount);
toDo = cacheQueueAlloc();
done = cacheQueueAlloc();
jobList = makeJobs(results, size, jobCount);
uglyTime("To init and alloc %d\n", size);
for (i=0; i<threadCount; ++i)
    pthreadCreate(&threads[i], NULL, workerBee, NULL);
uglyTime("Thread spwan time");
doJobs(jobList);
uglyTime("job time");
for (i=0; i<size; ++i)
    sumErr += (results[i]-i);
uglyTime("summing err");
printf("Total error = %e\n", sumErr);
printf("Total incer = %d\n", incer);
}
void makePtHatAnalyzers(Int_t mode = 1, Int_t pthatmin = 0, Int_t pthatmax = 100,Int_t maxRuns = 50,const char* folder="recent")
{
  // Check for valid mode 1 = CC, 2 = BB
  if(mode < 1 || mode > 2)
    {
      cout << "Not a valid mode. Choose 1=ccbar, or 2==bbar\n";
      exit(1);
    }
  
  /// Make the directory system
  gSystem->mkdir(folder);
  char temp[100];
  sprintf(temp,"%s/script",folder);
  gSystem->mkdir(temp);
  sprintf(temp,"%s/cards",folder);
  gSystem->mkdir(temp);
  sprintf(temp,"%s/jobs",folder);
  gSystem->mkdir(temp);

  // Create the files (cards, job list, execution scripts) using
  // each function.
  Int_t ms=0,mc=0,mj=0;
  ms = makeScripts(mode,pthatmin,pthatmax,maxRuns,folder);
  mc = makeCards(mode,(Float_t)pthatmin,(Float_t)pthatmax,maxRuns,folder);
  mj = makeJobs(mode,pthatmin,pthatmax,maxRuns,folder);

  // Check for proper completion and print Success or Fail
  if(ms && mc && mj)
    cout << "\n!! Analyzer succesfully created. !!\n"
	 << "move to RCF with: scp filename [email protected]:/star/u/zamiller/directory\n" << endl;
  else
    cout << "\n?? Failed, Debug Codes: ??\n"
	 << "ms: " << ms << " mc: " << mc << " mj: " << mj << endl << endl;

}