#include "stressThreads.h" ClassImp(stressThreads); TFile** stressThreads::files=NULL; TTree** stressThreads::trees=NULL; int* stressThreads::thedata=NULL; int** stressThreads::threadInstructions=NULL; int stressThreads::loopsPerThread=0; TThread** stressThreads::threads=NULL; stressThreads::stressThreads(int nThreads, int loopsPerThread_){ loopsPerThread = loopsPerThread_; files = new TFile*[nThreads]; trees = new TTree*[nThreads]; thedata = new int[nThreads]; threads = new TThread*[nThreads]; threadInstructions = new int*[nThreads]; // create the files, trees, threads etc for (int i=0; iSetDirectory(files[i]); trees[i]->Branch("data", &thedata, "data/I"); threadInstructions[i] = new int[1]; threadInstructions[i][0] = i;// just the thread index threads[i] = new TThread(Form("thread_%d", i), loop, (void*)threadInstructions[i]); } cout<<"running"<Run(); for (int i=0; iJoin(); cout<<"done"<Fill(); } //write and close trees[threadIndex]->Write(); files[threadIndex]->Close(); return 0; }