#include #include #include #include #include #include #include #include #include #include using namespace std; TString INPUTFILE = "RunAndEventTree.root"; TString TREENAME = "GoodEventList"; const Int_t NTHREADS = 4; TFile *inFile; TTree *inTree; TEventList *eventList[NTHREADS]; Float_t runNumber, eventNumber; void *threadFunction(void *a){ Int_t *args = (Int_t*)a; Int_t threadIndex = args[0]; Int_t rNum = args[1]; TThread::Lock(); cout <<"This is thread: " <Draw(Form(">>elist_%d",threadIndex),Form("RunNum==%d",rNum)); //____________________________________________________________________ eventList[threadIndex] = (TEventList*)gDirectory->Get(Form("elist_%d",threadIndex)); eventList[threadIndex]->Print(); return 0; } void drawFromThreads(){ inFile = new TFile(INPUTFILE,"READ"); inTree = (TTree*)inFile->Get(TREENAME); inTree->SetBranchAddress("RunNum",&runNumber); inTree->SetBranchAddress("EventNum",&eventNumber); //First create a vector of all the run numbers std::vector runNumberVec; Long64_t nEntries = inTree->GetEntries(); for (Int_t i=0; iGetEntry(i); runNumberVec.push_back((long)runNumber); } //Each entry in the input tree has a run number and event number //so there will be duplicate run numbers in the run vector //thus sort the run vector and remove duplicates std::vector::iterator it; std::sort(runNumberVec.begin(),runNumberVec.end()); it = std::unique(runNumberVec.begin(),runNumberVec.end()); runNumberVec.resize(std::distance(runNumberVec.begin(),it)); cout <<"The Number of Unique RUN NUMBERS is: " <Run(); } for (Int_t i=0; iJoin(); }