]>
Commit | Line | Data |
---|---|---|
1dfe075f | 1 | Bool_t gIsAnalysisLoaded = kFALSE ; |
2 | ||
3 | //______________________________________________________________________ | |
4 | Bool_t LoadLib( const char* pararchivename) | |
5 | { | |
6 | // Loads the AliRoot required libraries from a tar file | |
7 | ||
8 | Bool_t rv = kTRUE ; | |
9 | ||
10 | char cdir[1024] ; | |
11 | sprintf(cdir, "%s", gSystem->WorkingDirectory() ) ; | |
12 | ||
13 | // Setup par File | |
14 | if (pararchivename) { | |
15 | char processline[1024]; | |
16 | sprintf(processline,".! tar xvzf %s.par",pararchivename); | |
17 | gROOT->ProcessLine(processline); | |
18 | gSystem->ChangeDirectory(pararchivename); | |
19 | ||
20 | // check for BUILD.sh and execute | |
21 | if (!gSystem->AccessPathName("PROOF-INF/BUILD.sh")) { | |
22 | printf("*** Building PAR archive %s ***\n", pararchivename); | |
23 | ||
24 | if (gSystem->Exec("PROOF-INF/BUILD.sh")) { | |
25 | AliError(Form("Cannot Build the PAR Archive %s! - Abort!", pararchivename) ); | |
26 | ||
27 | return kFALSE ; | |
28 | } | |
29 | } | |
30 | ||
31 | // check for SETUP.C and execute | |
32 | if (!gSystem->AccessPathName("PROOF-INF/SETUP.C")) { | |
33 | printf("*** Setup PAR archive %s ***\n", pararchivename); | |
34 | gROOT->Macro("PROOF-INF/SETUP.C"); | |
35 | } | |
36 | } | |
37 | ||
38 | if ( strstr(pararchivename, "ESD") ) { | |
39 | gSystem->Load("libVMC.so"); | |
40 | gSystem->Load("libESD.so"); | |
41 | gSystem->Load("libRAliEn.so") ; | |
42 | gSystem->Load("libProof.so") ; | |
43 | } | |
44 | ||
45 | printf("*** %s library loaded *** %s **\n", pararchivename); | |
46 | ||
47 | gSystem->ChangeDirectory(cdir); | |
48 | ||
49 | gIsAnalysisLoaded = kTRUE ; | |
50 | return rv ; ; | |
51 | } | |
52 | ||
53 | //______________________________________________________________________ | |
54 | void ana() | |
55 | { | |
56 | if (! gIsAnalysisLoaded ) { | |
57 | LoadLib("ESD") ; | |
58 | LoadLib("ANALYSIS_NEW") ; | |
59 | printf("Include path = %s\n", gSystem->GetIncludePath()) ; | |
60 | LoadLib("AnalysisCheck") ; | |
61 | } | |
62 | ||
63 | // create the analysis goodies object | |
64 | AliAnalysisGoodies * ag = new AliAnalysisGoodies() ; | |
65 | ||
66 | // definition of analysis tasks | |
67 | ||
68 | const Int_t knumberOfTasks = 8 ; | |
69 | AliAnalysisTask * taskList[knumberOfTasks] ; | |
70 | TClass * taskInputList[knumberOfTasks] ; | |
71 | TClass * taskOutputList[knumberOfTasks] ; | |
72 | ||
73 | taskList[0] = new AliPHOSQATask("PHOS") ; | |
74 | taskInputList[0] = TChain::Class() ; | |
75 | taskOutputList[0] = TObjArray::Class() ; | |
76 | ||
77 | taskList[1] = new AliEMCALQATask("EMCal") ; | |
78 | taskInputList[1] = taskInputList[0] ; // only one top input container allowed | |
79 | taskOutputList[1] = TObjArray::Class() ; | |
80 | ||
81 | taskList[2] = new AliPMDQATask("PMD") ; | |
82 | taskInputList[2] = taskInputList[0] ; // only one top input container allowed | |
83 | taskOutputList[2] = TObjArray::Class() ; | |
84 | ||
85 | taskList[3] = new AliAnalysisTaskPt("Pt") ; | |
86 | taskInputList[3] = taskInputList[0] ; // only one top input container allowed | |
87 | taskOutputList[3] = TObjArray::Class() ; | |
88 | ||
89 | taskList[4] = new AliHMPIDQATask("HMPID") ; | |
90 | taskInputList[4] = taskInputList[0] ; // only one top input container allowed | |
91 | taskOutputList[4] = TObjArray::Class() ; | |
92 | ||
93 | taskList[5] = new AliT0QATask("T0") ; | |
94 | taskInputList[5] = taskInputList[0] ; // only one top input container allowed | |
95 | taskOutputList[5] = TObjArray::Class() ; | |
96 | ||
97 | taskList[6] = new AliMUONQATask("MUON") ; | |
98 | taskInputList[6] = taskInputList[0] ; // only one top input container allowed | |
99 | taskOutputList[6] = TObjArray::Class() ; | |
100 | ||
101 | taskList[7] = new AliFMDQATask("FMD") ; | |
102 | taskInputList[7] = taskInputList[0] ; // only one top input container allowed | |
103 | taskOutputList[7] = TObjArray::Class() ; | |
104 | ||
105 | ag->SetTasks(knumberOfTasks, taskList, taskInputList, taskOutputList) ; | |
106 | ||
107 | // get the data to analyze | |
108 | ||
109 | // definition of Tag cuts | |
110 | const char * runCuts = 0x0 ; | |
111 | const char * evtCuts = "fEventTag.fNPHOSClustersMin == 1 && fEventTag.fNEMCALClustersMin == 1" ; | |
112 | ||
113 | ||
114 | TString input = gSystem->Getenv("ANA_INPUT") ; | |
115 | if ( input != "") { | |
116 | char argument[1024] ; | |
117 | if ( input.Contains("tag?") ) { | |
118 | //create the ESD collection from the tag collection | |
119 | input.ReplaceAll("tag?", "") ; | |
120 | const char * collESD = "esdCollection.xml" ; | |
121 | ag->MakeEsdCollectionFromTagCollection(runCuts, evtCuts, input.Data(), collESD) ; | |
122 | sprintf(argument, "esd?%s", collESD) ; | |
123 | } else if ( input.Contains("esd?") ) | |
124 | argument = input.Data() ; | |
125 | ag->Process(argument) ; | |
126 | ||
127 | } else { | |
128 | ||
129 | TChain* analysisChain = new TChain("esdTree") ; | |
130 | // input = "alien:///alice/cern.ch/user/a/aliprod/prod2006_2/output_pp/105/411/AliESDs.root" ; | |
131 | // analysisChain->AddFile(input); | |
132 | input = "AliESDs.root" ; | |
133 | analysisChain->AddFile(input); | |
134 | ag->Process(analysisChain) ; | |
135 | } | |
136 | } | |
137 | ||
138 | //______________________________________________________________________ | |
139 | void Merge(const char * xml, const char * sub, const char * out) | |
140 | { | |
141 | if (! gIsAnalysisLoaded ) | |
142 | LoadLib("ESD") ; | |
143 | ||
144 | AliAnalysisGoodies * ag = new AliAnalysisGoodies() ; | |
145 | ag->Merge(xml, sub, out) ; | |
146 | } | |
147 | ||
148 | //______________________________________________________________________ | |
149 | void test(const char * fcollection1) | |
150 | { | |
151 | AliXMLCollection collection1(fcollection1); | |
152 | TChain* analysisChain = new TChain("esdTree"); | |
153 | ||
154 | collection1.Reset(); | |
155 | while (collection1.Next()) { | |
156 | cout<<"Adding "<<collection1.GetTURL()<<endl; | |
157 | analysisChain->Add(collection1.GetTURL()); | |
158 | } | |
159 | ||
160 | return ; | |
161 | } |