]>
Commit | Line | Data |
---|---|---|
e66ef583 | 1 | void runBatch() { |
2 | TStopwatch timer; | |
3 | timer.Start(); | |
4 | ||
5 | printf("*** Connect to AliEn ***\n"); | |
6 | TGrid::Connect("alien://"); | |
7 | gSystem->Load("libProofPlayer.so"); | |
8 | ||
9 | //____________________________________________________// | |
10 | //_____________Setting up STEERBase.par_______________// | |
11 | //____________________________________________________// | |
12 | setupPar("STEERBase"); | |
13 | gSystem->Load("libSTEERBase.so"); | |
14 | ||
15 | //____________________________________________________// | |
16 | //_____________Setting up ESD.par_____________________// | |
17 | //____________________________________________________// | |
18 | setupPar("ESD"); | |
19 | gSystem->Load("libVMC.so"); | |
20 | gSystem->Load("libESD.so"); | |
21 | ||
22 | //____________________________________________________// | |
23 | //_____________Setting up AOD.par_____________________// | |
24 | //____________________________________________________// | |
25 | setupPar("AOD"); | |
26 | gSystem->Load("libAOD.so"); | |
27 | ||
28 | //_____________________________________________________________// | |
29 | //_____________Setting up ANALYSIS_NEW.par_____________________// | |
30 | //_____________________________________________________________// | |
31 | setupPar("ANALYSIS"); | |
32 | gSystem->Load("libANALYSIS.so"); | |
33 | ||
34 | gROOT->LoadMacro("AliAnalysisTaskPt.cxx+"); | |
35 | ||
36 | //CreateXML(); | |
37 | ||
38 | //ANALYSIS PART | |
39 | const char *collectionfile = "wn.xml"; | |
40 | ||
41 | //____________________________________________// | |
42 | //Usage of event tags | |
43 | AliTagAnalysis *analysis = new AliTagAnalysis(); | |
44 | TChain *chain = 0x0; | |
45 | chain = analysis->GetChainFromCollection(collectionfile,"esdTree"); | |
46 | chain->SetBranchStatus("*Calo*",0); | |
47 | ||
48 | //____________________________________________// | |
49 | // Make the analysis manager | |
50 | AliAnalysisManager *mgr = new AliAnalysisManager("TestManager"); | |
51 | AliVEventHandler* esdH = new AliESDInputHandler; | |
52 | mgr->SetInputEventHandler(esdH); | |
53 | //____________________________________________// | |
54 | // 1st Pt task | |
55 | AliAnalysisTaskPt *task1 = new AliAnalysisTaskPt("TaskPt"); | |
56 | mgr->AddTask(task1); | |
57 | // Create containers for input/output | |
58 | AliAnalysisDataContainer *cinput1 = mgr->CreateContainer("cchain1",TChain::Class(),AliAnalysisManager::kInputContainer); | |
59 | AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("chist1", TH1::Class(),AliAnalysisManager::kOutputContainer,"Pt.ESD.root"); | |
60 | ||
61 | //____________________________________________// | |
62 | mgr->ConnectInput(task1,0,cinput1); | |
63 | mgr->ConnectOutput(task1,0,coutput1); | |
64 | if (!mgr->InitAnalysis()) return; | |
65 | mgr->PrintStatus(); | |
66 | mgr->StartAnalysis("local",chain); | |
67 | ||
68 | timer.Stop(); | |
69 | timer.Print(); | |
70 | } | |
71 | ||
72 | void CreateXML() { | |
73 | // Create A tag analysis object and impose some selection criteria | |
74 | AliTagAnalysis *tagAna = new AliTagAnalysis(); | |
75 | ||
76 | //Case where the tag files are stored locally | |
77 | //TagAna->ChainLocalTags("."); | |
78 | ||
79 | //Case where the tag files are stored in the file catalog | |
80 | //pp.xml is the xml collection of tag files that was produced | |
81 | //by querying the file catalog. | |
82 | TAlienCollection* coll = TAlienCollection::Open("tag.xml"); | |
83 | TGridResult* tagResult = coll->GetGridResult("",0,0); | |
84 | tagAna->ChainGridTags(tagResult); | |
85 | ||
86 | //__________________________// | |
87 | //Usage of string statements// | |
88 | //__________________________// | |
89 | /*const char* fRunCuts = "fAliceRunId == 340"; | |
90 | const char* fEventCuts = "(fEventTag.fTopPtMin >= 1.0)&&(fEventTag.fNumberOfTracks >= 11)&&(fEven | |
91 | tTag.fNumberOfTracks <= 12)"; | |
92 | tagAna->CreateXMLCollection("global",fRunCuts,fEventCuts);*/ | |
93 | ||
94 | //________________________________________________// | |
95 | // Usage of Ali*TagCuts classes // | |
96 | //________________________________________________// | |
97 | // create a RunTagCut object | |
98 | AliRunTagCuts *runCuts = new AliRunTagCuts(); | |
99 | // create a LHCTagCut object | |
100 | AliLHCTagCuts *lhcCuts = new AliLHCTagCuts(); | |
101 | // create a DetectorTagCut object | |
102 | AliDetectorTagCuts *detCuts = new AliDetectorTagCuts(); | |
103 | // create an EventTagCut object | |
104 | AliEventTagCuts *evCuts = new AliEventTagCuts(); | |
105 | evCuts->SetMultiplicityRange(11,12); | |
106 | tagAna->CreateXMLCollection("global",runCuts,lhcCuts,detCuts,evCuts); | |
107 | } | |
108 | ||
109 | Int_t setupPar(const char* pararchivename) { | |
110 | /////////////////// | |
111 | // Setup PAR File// | |
112 | /////////////////// | |
113 | if (pararchivename) { | |
114 | char processline[1024]; | |
115 | sprintf(processline,".! tar xvzf %s.par",pararchivename); | |
116 | gROOT->ProcessLine(processline); | |
117 | const char* ocwd = gSystem->WorkingDirectory(); | |
118 | gSystem->ChangeDirectory(pararchivename); | |
119 | ||
120 | // check for BUILD.sh and execute | |
121 | if (!gSystem->AccessPathName("PROOF-INF/BUILD.sh")) { | |
122 | printf("*******************************\n"); | |
123 | printf("*** Building PAR archive ***\n"); | |
124 | printf("*******************************\n"); | |
125 | ||
126 | if (gSystem->Exec("PROOF-INF/BUILD.sh")) { | |
127 | Error("runProcess","Cannot Build the PAR Archive! - Abort!"); | |
128 | return -1; | |
129 | } | |
130 | } | |
131 | // check for SETUP.C and execute | |
132 | if (!gSystem->AccessPathName("PROOF-INF/SETUP.C")) { | |
133 | printf("*******************************\n"); | |
134 | printf("*** Setup PAR archive ***\n"); | |
135 | printf("*******************************\n"); | |
136 | gROOT->Macro("PROOF-INF/SETUP.C"); | |
137 | } | |
138 | ||
139 | gSystem->ChangeDirectory("../"); | |
140 | } | |
141 | ||
142 | return 1; | |
143 | } |