]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ANALYSIS/TagMacros/ReMakeTagsFullRun.C
First Tag macro - to recreate the tag file for a full run from ESDs and the GRP
[u/mrichter/AliRoot.git] / ANALYSIS / TagMacros / ReMakeTagsFullRun.C
1 // Macro to make a tag file for a full run directly from ESDs and the GRP
2 // Takes as parameters a text file with the location of all ESD files
3 // for a given run (can be modified to work on any chain of ESDs)
4 // Second argument is the run number, for which the GRP will be retrieved
5 // Suitable for a GRID job - runs with pure ROOT to minimize memory 
6 // consumption but needs ALIROOT package location to load only necessary
7 // AliRoot libraries.
8 //
9 // Author: Adam.Kisiel@cern.ch
10
11 AliGRPObject *GetGRPForRun(Int_t runno) {
12   AliCDBManager* man = AliCDBManager::Instance();
13   man->SetDefaultStorage("raw://");
14   man->SetRun(runno);
15   AliCDBEntry* e = man->Get("GRP/GRP/Data");
16   AliGRPObject* o = (AliGRPObject*)e->GetObject();
17   
18   return o;
19 }
20
21 void ReMakeTagsFullRun(const char *esdfile, Int_t runno)
22 {
23   gSystem->Load("libProofPlayer.so");
24   gSystem->Load("libVMC.so");  
25   gSystem->Load("libSTEERBase.so");
26   gSystem->Load("libESD.so");
27   gSystem->Load("libAOD.so");
28   gSystem->Load("libANALYSIS.so");  
29   gSystem->Load("libANALYSISalice.so");
30   gSystem->Load("libGui.so");
31   gSystem->Load("libCDB.so");
32
33   gSystem->Load("libMinuit.so");
34   gSystem->Load("libRAWDatabase.so");
35
36   gSystem->Load("libSTEER.so");  
37   gSystem->Load("libXMLParser.so");
38
39   TGrid::Connect("alien://");
40
41
42   AliGRPObject *grpo = GetGRPForRun(runno);
43   
44   AliESDTagCreator *tagCre = new AliESDTagCreator();
45   tagCre->SetStorage(0);
46
47
48   TChain *chain = new TChain("esdTree");;
49   ifstream *istr = new ifstream(esdfile);
50
51   char fname[2000];
52   char pname[2000];
53   while (!istr->eof()) {
54     fname[0] = '\0';
55     (*istr) >> fname;
56     if (strlen(fname) > 10) {
57       sprintf(pname, "alien://%s", fname);
58       chain->Add(pname);
59     }
60   }
61
62   tagCre->CreateESDTagsFullRun(chain, grpo, 0, 0, 0, 0);  
63 }