]> git.uio.no Git - u/mrichter/AliRoot.git/blob - JETAN/demoJETAN.C
Several updates for grid running (B. Bathen and J. Klein)
[u/mrichter/AliRoot.git] / JETAN / demoJETAN.C
1 //####################################################//
2 //###           To execute the macro:              ###//
3 //###      $ALIEN/globus/bin/grid-proxy-init       ###//
4 //###   $ALIEN/api/bin/alien-token-init pchrista   ###//
5 //###            root.exe -q DemoTags             ###//
6 //####################################################//
7
8 Int_t demoJETAN() {
9   TStopwatch timer;
10   timer.Start();
11
12   const char* pararchiveJETAN = "JETAN";
13   const char* pararchiveESD   = "ESD";
14   //////////////////////////////////////////
15   // Libraries required to load
16   //////////////////////////////////////////
17
18   //////////////////////////////////////////////////////////////////
19   // Setup PAR File
20   if (pararchiveJETAN) {
21     char processline[1024];
22     sprintf(processline,".! tar xvzf %s.par",pararchiveJETAN);
23     gROOT->ProcessLine(processline);
24     const char* ocwd = gSystem->WorkingDirectory();
25     gSystem->ChangeDirectory(pararchiveJETAN);
26
27     // check for BUILD.sh and execute
28     if (!gSystem->AccessPathName("PROOF-INF/BUILD.sh")) {
29       printf("**************************************\n");
30       printf("*** Building PAR archive for JETAN ***\n");
31       printf("**************************************\n");
32
33       if (gSystem->Exec("PROOF-INF/BUILD.sh")) {
34         Error("batchSelector","Cannot Build the PAR Archive! - Abort!");
35         return -1;
36       }
37     }
38     // check for SETUP.C and execute
39     if (!gSystem->AccessPathName("PROOF-INF/SETUP.C")) {
40       printf("*******************************\n");
41       printf("*** Setup PAR archive       ***\n");
42       printf("*******************************\n");
43       gROOT->Macro("PROOF-INF/SETUP.C");
44     }
45     
46     gSystem->ChangeDirectory("../");
47   }
48
49
50   if (pararchiveESD) {
51     char processline[1024];
52     sprintf(processline,".! tar xvzf %s.par",pararchiveESD);
53     gROOT->ProcessLine(processline);
54     const char* ocwd = gSystem->WorkingDirectory();
55     gSystem->ChangeDirectory(pararchiveESD);
56
57     // check for BUILD.sh and execute
58     if (!gSystem->AccessPathName("PROOF-INF/BUILD.sh")) {
59       printf("**************************************\n");
60       printf("*** Building PAR archive for JETAN ***\n");
61       printf("**************************************\n");
62
63       if (gSystem->Exec("PROOF-INF/BUILD.sh")) {
64         Error("batchSelector","Cannot Build the PAR Archive! - Abort!");
65         return -1;
66       }
67     }
68     // check for SETUP.C and execute
69     if (!gSystem->AccessPathName("PROOF-INF/SETUP.C")) {
70       printf("*******************************\n");
71       printf("*** Setup PAR archive       ***\n");
72       printf("*******************************\n");
73       gROOT->Macro("PROOF-INF/SETUP.C");
74     }
75     
76     gSystem->ChangeDirectory("../");
77   }
78
79   gSystem->Load("libVMC.so");
80   gSystem->Load("libESD.so"); 
81   gSystem->Load("libJETAN.so");
82   
83   
84
85   printf("*** Connect to AliEn ***\n");
86   TGrid::Connect("alien://"); 
87
88   //////////////////////////////////////////////////////////////////
89   // Create A tag analysis object and impose some selection criteria
90   AliTagAnalysis *TagAna = new AliTagAnalysis(); 
91   // create an EventTagCut object
92   AliEventTagCuts *EvCuts = new AliEventTagCuts();
93   AliRunTagCuts   *RuCuts = new AliRunTagCuts();
94   //EvCuts->SetNChargedAbove1GeVRange(1, 1000);
95   //EvCuts->SetMultiplicityRange(11,120);
96   //EvCuts->SetNPionRange(2,10000);
97
98   printf("*******************************\n");
99   printf("*** Querying the tags       ***\n");
100   printf("*******************************\n");
101   
102   //grid tags
103   TAlienCollection* coll = TAlienCollection::Open("tag100.xml");
104   TGridResult* TagResult = coll->GetGridResult("");
105   TagAna->ChainGridTags(TagResult);
106
107   //////////////////////////////////////////////////////////////////
108   //Get the chain
109   printf("*******************************\n");
110   printf("*** Getting the Chain       ***\n");
111   printf("*******************************\n");
112   TChain* analysischain = 0x0;
113   analysischain = TagAna->QueryTags(RuCuts, EvCuts);
114
115   /////////////////////////////////////////////////////////////////
116   // Run the Analysis Selector
117   const char *selectorfile = "AliJetSelector.C";
118   printf("*******************************\n");
119   printf("*** Run Analysis Selector %s\n",selectorfile);
120   printf("*******************************\n");
121   analysischain->ls();
122   
123   analysischain->Process(selectorfile);
124
125   timer.Stop();
126   timer.Print();
127
128   return 0;
129 }