analysis/makeRunList.cxx
00001 00002 00003 00004 00005 00006 00007 00008 00009 //Includes 00010 #include <iostream> 00011 00012 //AraRoot Includes 00013 #include "RawAraEvent.h" 00014 00015 //ROOT Includes 00016 #include "TTree.h" 00017 #include "TFile.h" 00018 #include "TTimeStamp.h" 00019 00020 00021 int main(int argc, char **argv) 00022 { 00023 00024 if(argc<4) { 00025 std::cout << "Usage\n" << argv[0] << " <input file> <output file>\n"; 00026 std::cout << "e.g.\n" << argv[0] << " http://www.hep.ucl.ac.uk/uhen/ara/monitor/root minRun maxRun output.txt\n"; 00027 return -1; 00028 } 00029 00030 00031 int minRun = atoi(argv[2]); 00032 int maxRun = atoi(argv[3]); 00033 00034 char fileName[260]; 00035 TFile *fpIn; 00036 TTree *evTree; 00037 RawAraEvent *evPtr=0; 00038 00039 00040 for(int run=minRun; run<=maxRun;run+=100){ 00041 sprintf(fileName, "%s/run%06i/event%06i.root", argv[1], run, run); 00042 //printf("A\n"); 00043 fpIn = TFile::Open(fileName); 00044 if(fpIn==0) continue; 00045 //printf("B\n"); 00046 evTree = (TTree*) fpIn->Get("eventTree"); 00047 //printf("C\n"); 00048 if(evTree==0) continue; 00049 //printf("D\n"); 00050 evTree->SetBranchAddress("event", &evPtr); 00051 //printf("E\n"); 00052 00053 //printf("entries %i\n", evTree->GetEntries()); 00054 evTree->GetEntry(0); 00055 TTimeStamp *time = new TTimeStamp(evPtr->head.unixTime); 00056 printf("run #\t%i\tdate\t%s\n", run, time->AsString()); 00057 00058 // printf("run #\t%i\tdate\t%i\n", run, evPtr->head.unixTime); 00059 00060 //printf("F\n"); 00061 00062 delete time; 00063 00064 evTree->ResetBranchAddresses(); 00065 //printf("G\n"); 00066 fpIn->Close(); 00067 //printf("H\n"); 00068 00069 } 00070 return 0; 00071 00072 00073 } 00074
Generated on Wed Aug 8 16:18:55 2012 for ARA ROOT Test Bed Software by
