]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ANALYSIS/TagMacros/UpdateWithRCT.C
Coding rule violations corrected.
[u/mrichter/AliRoot.git] / ANALYSIS / TagMacros / UpdateWithRCT.C
CommitLineData
b637c01f 1void UpdateWithRCT(const char *inrun, const char *inrct)
2{
3 TFile *inrunfile = new TFile(inrun);
4 TTree *runtree = (TTree *) inrunfile->Get("T");
5 AliRunTag *runt = new AliRunTag();
6 runtree->SetBranchAddress("AliTAG", &runt);
7
8 TFile *inrctfile = new TFile(inrct);
9 TTree *rcttree = (TTree *) inrctfile->Get("T");
10 AliRunTag *rctt = new AliRunTag();
11 rcttree->SetBranchAddress("AliTAG", &rctt);
12
13 runtree->GetEntry(0);
14
15 cout << "Looking for RCT match for run " << runt->GetRunId() << endl;
16
17 for (int iter=0; iter<rcttree->GetEntries(); iter++) {
18 rcttree->GetEntry(iter);
19 if (rctt->GetRunId() == runt->GetRunId()) {
20 cout << "Found match in RCT for run " << rctt->GetRunId() << endl;
21 cout << "Updating " << endl;
22
23 runt->UpdateFromRunTable(rctt);
24 }
25
26 }
27
28 TFile* ftag = TFile::Open("Updated.root", "recreate");
29
30 TTree * ttag = new TTree("T","A Tree with event tags");
31 TBranch * btag = ttag->Branch("AliTAG", &runt);
32 ttag->Fill();
33
34 btag->SetCompressionLevel(9);
35
36 ftag->cd();
37 ttag->Write();
38 ftag->Close();
39
40
41}