]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Macro to update the existing run tag with the RCT information
authorakisiel <akisiel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 10 Sep 2010 09:09:04 +0000 (09:09 +0000)
committerakisiel <akisiel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 10 Sep 2010 09:09:04 +0000 (09:09 +0000)
ANALYSIS/TagMacros/UpdateWithRCT.C [new file with mode: 0644]

diff --git a/ANALYSIS/TagMacros/UpdateWithRCT.C b/ANALYSIS/TagMacros/UpdateWithRCT.C
new file mode 100644 (file)
index 0000000..3ad1c3c
--- /dev/null
@@ -0,0 +1,41 @@
+void UpdateWithRCT(const char *inrun, const char *inrct)
+{
+  TFile *inrunfile = new TFile(inrun);
+  TTree *runtree = (TTree *) inrunfile->Get("T");
+  AliRunTag *runt = new AliRunTag();
+  runtree->SetBranchAddress("AliTAG", &runt);
+
+  TFile *inrctfile = new TFile(inrct);
+  TTree *rcttree = (TTree *) inrctfile->Get("T");
+  AliRunTag *rctt = new AliRunTag();
+  rcttree->SetBranchAddress("AliTAG", &rctt);
+
+  runtree->GetEntry(0);
+
+  cout << "Looking for RCT match for run " << runt->GetRunId() << endl;
+
+  for (int iter=0; iter<rcttree->GetEntries(); iter++) {
+    rcttree->GetEntry(iter);
+    if (rctt->GetRunId() == runt->GetRunId()) {
+      cout << "Found match in RCT for run " << rctt->GetRunId() << endl;
+      cout << "Updating " << endl;
+
+      runt->UpdateFromRunTable(rctt);
+    }
+
+  }
+
+  TFile* ftag = TFile::Open("Updated.root", "recreate");
+
+  TTree * ttag = new TTree("T","A Tree with event tags");
+  TBranch * btag = ttag->Branch("AliTAG", &runt);
+  ttag->Fill();
+  
+  btag->SetCompressionLevel(9);
+
+  ftag->cd();
+  ttag->Write();
+  ftag->Close();
+
+
+}