]>
Commit | Line | Data |
---|---|---|
0bca1a77 | 1 | #if !defined(__CINT__) || defined(__MAKECINT__) |
2 | #include <TFile.h> | |
3 | #include <TFileMerger.h> | |
4 | #include <TAlienFile.h> | |
5 | //#include <TExec.h> | |
6 | #include <TSystem.h> | |
7 | #include <TGrid.h> | |
8 | #include <TGridResult.h> | |
9 | #include <Riostream.h> | |
10 | #include <TObjArray.h> | |
11 | #include <TClass.h> | |
12 | #endif | |
13 | void ReadQASDD(Int_t runNb = 101498,Int_t year=2009,Char_t period[10]="LHC09c",Char_t pass[8]="pass1",Char_t filetosearch[50]="Merged.QA.Data.root",Char_t initfileout[50]="File.QA") | |
14 | { | |
15 | ||
16 | //****************** Connection to alien ***************************************** | |
17 | TGrid::Connect("alien://",0,0,"t"); | |
18 | //TGrid *gGrid = TGrid::Connect("alien"); | |
19 | if(!gGrid||!gGrid->IsConnected()) { | |
20 | printf("gGrid not found! exit macro\n"); | |
21 | return; | |
22 | } | |
23 | ||
24 | TFileMerger merger; | |
25 | merger.SetFastMethod(kTRUE); | |
26 | Char_t fileName[100]; | |
27 | Char_t directory[100]; | |
28 | sprintf(fileName,"%s.%i.%s.%s.Run.%i.root",initfileout,year,period,pass,runNb); | |
29 | merger.OutputFile(fileName);//metto il nome del file QA | |
30 | //sprintf(directory,"local://%s",gSystem->pwd()); | |
31 | Char_t path[200]; | |
32 | ||
33 | sprintf(path,"/alice/data/%04i/%s/%09i/ESDs/%s/%02i%09i*.*",year,period,runNb,pass,year-2000,runNb); | |
34 | printf("path %s\n",path); | |
35 | ||
36 | TGridResult *gr = gGrid->Query(path,filetosearch); | |
37 | if (gr->GetEntries() < 1) { | |
38 | printf("In this run there are not QA files: Exit macro\n"); | |
39 | return; | |
40 | } | |
41 | else{printf("================>%d files found\n", gr->GetEntries());} | |
42 | ||
43 | Int_t mergedFiles = 0; | |
44 | Int_t nFiles = gr->GetEntries(); | |
45 | for (Int_t i = 0; i <nFiles ; i++) { | |
46 | printf("File %i/%i\n",i,nFiles); | |
47 | sprintf(directory,"%s",gr->GetKey(i,"turl")); | |
48 | if (merger.AddFile(directory)) | |
49 | mergedFiles++; | |
50 | } | |
51 | //printf("Add done\n"); | |
52 | if(merger.Merge()==kTRUE){ | |
53 | printf("merged %d files\n", mergedFiles); | |
54 | printf("output written on %s\n", fileName); | |
55 | printf("Merge done!\n"); | |
56 | } | |
57 | else{printf("no files merged\n");return;} | |
58 | ||
59 | } |