]>
Commit | Line | Data |
---|---|---|
581ebeaa | 1 | /* |
2 | Macro for merging of the calibration classes: | |
3 | marain.ivanov@cern.ch | |
4 | // | |
5 | // | |
6 | Example usage: | |
7 | 1. Make a list of the calibration files | |
8 | 2. Load libraries | |
9 | 3. Merge - the output is stored in the current directory | |
10 | // | |
11 | gSystem->Load("libANALYSIS"); | |
12 | gSystem->Load("libTPCcalib"); | |
13 | .L $ALICE_ROOT/TPC/macros/CalibFileMerger.C | |
14 | CalibFileMerger(); | |
15 | */ | |
16 | ||
17 | void CalibFileMerger(const char* filename = "mergelist.txt") { | |
18 | ||
19 | ||
20 | TObjArray * mergeArray= 0; | |
21 | ||
22 | // Open the input stream | |
23 | ifstream in; | |
24 | in.open(filename); | |
25 | ||
26 | // Read the input list of files | |
27 | TString objfile; | |
28 | Int_t counter=0; | |
29 | while(in.good()) { | |
30 | in >> objfile; | |
31 | if (!objfile.Contains("root")) continue; // protection | |
32 | TFile currentFile(objfile.Data()); | |
33 | TObjArray * carray = (TObjArray*)currentFile.Get("TPCCalib"); | |
34 | if (!carray) continue; | |
35 | if (!mergeArray) { mergeArray = carray; continue;} | |
36 | printf("Counter\t%d\tMerging file %s\n",counter,objfile.Data()); | |
37 | for (Int_t icalib=0; icalib<mergeArray->GetEntries(); icalib++){ | |
38 | AliTPCcalibBase *calib = ( AliTPCcalibBase *)mergeArray->At(icalib); | |
39 | //disable calib align | |
40 | //if (calib->InheritsFrom("AliTPCcalibAlign")) continue; | |
41 | if (calib) calib->Merge(carray); | |
42 | } | |
43 | AliSysInfo::AddStamp(objfile->Data(),counter,counter,counter); | |
44 | //currentFile.Close(); | |
45 | carray->SetOwner(kTRUE); | |
46 | carray->Delete(); | |
47 | delete carray; | |
48 | counter++; | |
49 | //if (counter>10) break; | |
50 | } | |
51 | ||
52 | in.close(); | |
53 | TFile * output = new TFile("CalibObjects.root", "RECREATE"); | |
54 | mergeArray->Write("TPCCalib",TObject::kSingleKey); | |
55 | output->Close(); | |
56 | ||
57 | // | |
58 | ||
59 | } | |
60 | ||
61 | /* | |
62 | // | |
63 | TFile * output = new TFile("CalibObjects0.root", "RECREATE"); | |
64 | mergeArray->At(0)->Write(); | |
65 | output->Close(); | |
66 | ||
67 | TFile * output = new TFile("CalibObjects1.root", "RECREATE"); | |
68 | mergeArray->At(1)->Write(); | |
69 | output->Close(); | |
70 | ||
71 | TFile * output = new TFile("CalibObjects2.root", "RECREATE"); | |
72 | mergeArray->At(2)->Write(); | |
73 | output->Close(); | |
74 | ||
75 | TFile * output = new TFile("CalibObjects3.root", "RECREATE"); | |
76 | mergeArray->At(3)->Write(); | |
77 | output->Close(); | |
78 | ||
79 | TFile * output = new TFile("CalibObjects4.root", "RECREATE"); | |
80 | mergeArray->At(4)->Write(); | |
81 | output->Close(); | |
82 | ||
83 | TFile * output = new TFile("CalibObjects5.root", "RECREATE"); | |
84 | mergeArray->At(5)->Write(); | |
85 | output->Close(); | |
86 | ||
87 | TFile * output = new TFile("CalibObjects6.root", "RECREATE"); | |
88 | mergeArray->At(6)->Write(); | |
89 | output->Close(); | |
90 | */ | |
91 | ||
92 |