ROOT logo
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();


}
 UpdateWithRCT.C:1
 UpdateWithRCT.C:2
 UpdateWithRCT.C:3
 UpdateWithRCT.C:4
 UpdateWithRCT.C:5
 UpdateWithRCT.C:6
 UpdateWithRCT.C:7
 UpdateWithRCT.C:8
 UpdateWithRCT.C:9
 UpdateWithRCT.C:10
 UpdateWithRCT.C:11
 UpdateWithRCT.C:12
 UpdateWithRCT.C:13
 UpdateWithRCT.C:14
 UpdateWithRCT.C:15
 UpdateWithRCT.C:16
 UpdateWithRCT.C:17
 UpdateWithRCT.C:18
 UpdateWithRCT.C:19
 UpdateWithRCT.C:20
 UpdateWithRCT.C:21
 UpdateWithRCT.C:22
 UpdateWithRCT.C:23
 UpdateWithRCT.C:24
 UpdateWithRCT.C:25
 UpdateWithRCT.C:26
 UpdateWithRCT.C:27
 UpdateWithRCT.C:28
 UpdateWithRCT.C:29
 UpdateWithRCT.C:30
 UpdateWithRCT.C:31
 UpdateWithRCT.C:32
 UpdateWithRCT.C:33
 UpdateWithRCT.C:34
 UpdateWithRCT.C:35
 UpdateWithRCT.C:36
 UpdateWithRCT.C:37
 UpdateWithRCT.C:38
 UpdateWithRCT.C:39
 UpdateWithRCT.C:40
 UpdateWithRCT.C:41
 UpdateWithRCT.C:42