]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
new macro for merging sets of runs, GoodTpc, SemiGoodTpc, etc.
authorhqvigsta <hqvigsta@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 19 Dec 2012 10:33:00 +0000 (10:33 +0000)
committerhqvigsta <hqvigsta@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 19 Dec 2012 10:33:00 +0000 (10:33 +0000)
PWGGA/PHOSTasks/PHOS_PbPb/macros/LEGO/MergeSet.C [new file with mode: 0644]
PWGGA/PHOSTasks/PHOS_PbPb/macros/LEGO/runsBadTpcLHC11h.txt [new file with mode: 0644]
PWGGA/PHOSTasks/PHOS_PbPb/macros/LEGO/runsGoodTpcLHC11h.txt [new file with mode: 0644]
PWGGA/PHOSTasks/PHOS_PbPb/macros/LEGO/runsSemiGoodTpcLHC11h.txt [new file with mode: 0644]

diff --git a/PWGGA/PHOSTasks/PHOS_PbPb/macros/LEGO/MergeSet.C b/PWGGA/PHOSTasks/PHOS_PbPb/macros/LEGO/MergeSet.C
new file mode 100644 (file)
index 0000000..8d1bdc6
--- /dev/null
@@ -0,0 +1,72 @@
+#include "TFileMerger.h"
+#include "TSystem.h"
+#include <TString.h>
+
+#include <map>
+#include <iostream>
+#include <fstream>
+#include <string>
+
+void MergeSet(const TString mergeFileName,
+             const TString runSetName = "runSet.txt",
+             const TString runFileName = "runFile.txt")
+{
+  // Author: Henrik.Qvigstad@cern.ch, 2012
+  //
+  // Use to merge sets of runs defined by file by name of 'runSetName'
+  //
+  // For some reason, it does not work without compiling:
+  //
+  // .L MergeSet.C+g
+  // MergeSet()
+
+  // Make runToFill map
+  std::ifstream runFile;
+  runFile.open(runFileName.Data());
+  
+  std::map<int, std::string> runToFile; // maps: run -> fill
+  while (1) {
+    int run=0;
+    std::string file;
+    runFile >> run >> file;
+    if (!runFile.good()) break;
+    runToFile[run] = file;
+  }
+
+
+  // Make FillMergers and add run files to them.
+  std::ifstream runSet;
+  TFileMerger* fileMerger = new TFileMerger(); // create merger
+  fileMerger->OutputFile(mergeFileName.Data());
+  runSet.open(runSetName.Data());
+  Int_t runNumber=0;
+  while (1) {
+    runSet >> runNumber;
+    if (!runSet.good()) break;
+
+//     if(169553 == runNumber ) //169094 
+//       continue;
+    
+    if( ! runToFile.count(runNumber) ) {
+      Printf("can't map run %d to file", runNumber);
+      continue;
+    }
+   
+    std::string file = runToFile[runNumber];
+    printf("adding %s: ", file.data());
+    fileMerger->AddFile(file.data());
+  }
+  
+  Printf("Merging %s...", mergeFileName.Data());
+  fileMerger->Merge();
+  Printf("Merging %s... done! \n", mergeFileName.Data());
+  delete fileMerger;
+}
+
+
+void MergeTpcSets()
+{
+  MergeSet("AnalysisResults_GoodTpc.root", "../runsGoodTpcLHC11h.txt", "runFile.txt");
+  MergeSet("AnalysisResults_SemiGoodTpc.root", "../runsSemiGoodTpcLHC11h.txt", "runFile.txt");
+  MergeSet("AnalysisResults_BadTpc.root", "../runsBadTpcLHC11h.txt", "runFile.txt");
+}
diff --git a/PWGGA/PHOSTasks/PHOS_PbPb/macros/LEGO/runsBadTpcLHC11h.txt b/PWGGA/PHOSTasks/PHOS_PbPb/macros/LEGO/runsBadTpcLHC11h.txt
new file mode 100644 (file)
index 0000000..05d3625
--- /dev/null
@@ -0,0 +1 @@
+167693 167706 167711 167713 167806 167807 167808 167814 167818 167902 167903 167915 167920 167921 167985 167986 167987 168103 168105 168107 168108 168115 168171 168172 168173 168175 168181 168203 168204 168205 168206 168207 168208 168213 168310 168318 168342 168356 168464 168467 168511 168512 168514 168777 168826 168984 168988 169035 169040 169044 169045 169099 169144 169145 169148 169156 169160 169238 169411 169415 169418 169419 169420 169475 169498 169504 169506 169512 169515 169550 169553 169554 169555 169557 169584 169586 169587 169588 169590 169591 169628 169918 169919 169920 169922 169961 169965 169969 170027 170036 170081 170267 170311 170312 170313 170315 170387 170388 170389 170390 170546 170552 170556 170572 170593
diff --git a/PWGGA/PHOSTasks/PHOS_PbPb/macros/LEGO/runsGoodTpcLHC11h.txt b/PWGGA/PHOSTasks/PHOS_PbPb/macros/LEGO/runsGoodTpcLHC11h.txt
new file mode 100644 (file)
index 0000000..b256924
--- /dev/null
@@ -0,0 +1 @@
+167813 167988 168066 168068 168069 168076 168104 168212 168311 168322 168325 168341 168361 168362 168458 168460 168461 168992 169091 169094 169138 169143 169167 169417 169835 169837 169838 169846 169855 169858 169859 169923 169956 170027 170036 170081
diff --git a/PWGGA/PHOSTasks/PHOS_PbPb/macros/LEGO/runsSemiGoodTpcLHC11h.txt b/PWGGA/PHOSTasks/PHOS_PbPb/macros/LEGO/runsSemiGoodTpcLHC11h.txt
new file mode 100644 (file)
index 0000000..880908f
--- /dev/null
@@ -0,0 +1 @@
+169975 169981 170038 170040 170083 170084 170085 170088 170089 170091 170152 170155 170159 170163 170193 170195 170203 170204 170205 170228 170230 170264 170268 170269 170270 170306 170308 170309