]>
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) { | |
398a3deb | 15 | char parpar[80] ; |
16 | sprintf(parpar, "%s.par", pararchivename) ; | |
17 | if ( gSystem->AccessPathName(parpar) ) { | |
18 | gSystem->ChangeDirectory(gSystem->Getenv("ALICE_ROOT")) ; | |
1dfe075f | 19 | char processline[1024]; |
398a3deb | 20 | sprintf(processline, ".! make %s", parpar) ; |
21 | cout << processline << endl ; | |
22 | gROOT->ProcessLine(processline) ; | |
23 | gSystem->ChangeDirectory(cdir) ; | |
24 | sprintf(processline, ".! mv %s/%s .", gSystem->Getenv("ALICE_ROOT"), parpar) ; | |
25 | gROOT->ProcessLine(processline) ; | |
26 | sprintf(processline,".! tar xvzf %s",parpar); | |
381c19ed | 27 | gROOT->ProcessLine(processline); |
398a3deb | 28 | } |
29 | gSystem->ChangeDirectory(pararchivename); | |
30 | ||
1dfe075f | 31 | // check for BUILD.sh and execute |
32 | if (!gSystem->AccessPathName("PROOF-INF/BUILD.sh")) { | |
33 | printf("*** Building PAR archive %s ***\n", pararchivename); | |
34 | ||
35 | if (gSystem->Exec("PROOF-INF/BUILD.sh")) { | |
36 | AliError(Form("Cannot Build the PAR Archive %s! - Abort!", pararchivename) ); | |
37 | ||
38 | return kFALSE ; | |
39 | } | |
40 | } | |
41 | ||
42 | // check for SETUP.C and execute | |
43 | if (!gSystem->AccessPathName("PROOF-INF/SETUP.C")) { | |
44 | printf("*** Setup PAR archive %s ***\n", pararchivename); | |
45 | gROOT->Macro("PROOF-INF/SETUP.C"); | |
46 | } | |
47 | } | |
48 | ||
49 | if ( strstr(pararchivename, "ESD") ) { | |
84eb42a1 | 50 | //gSystem->Load("libVMC.so"); |
2704006a | 51 | //gSystem->Load("libRAliEn.so"); |
52 | gSystem->Load("libESD.so") ; | |
84eb42a1 | 53 | //gSystem->Load("libProof.so") ; |
1dfe075f | 54 | } |
55 | ||
2704006a | 56 | if ( strstr(pararchivename, "AnalysisCheck") ) { |
57 | gSystem->Load("libSpectrum.so"); | |
58 | } | |
59 | ||
60 | printf("lib%s done\n", pararchivename); | |
1dfe075f | 61 | |
62 | gSystem->ChangeDirectory(cdir); | |
63 | ||
64 | gIsAnalysisLoaded = kTRUE ; | |
2704006a | 65 | return rv ; |
1dfe075f | 66 | } |
67 | ||
68 | //______________________________________________________________________ | |
398a3deb | 69 | void ana(const Int_t kEvent=100) |
70 | { | |
1dfe075f | 71 | if (! gIsAnalysisLoaded ) { |
72 | LoadLib("ESD") ; | |
b0ce88ad | 73 | LoadLib("AOD") ; |
c52c2132 | 74 | LoadLib("ANALYSIS") ; |
1dfe075f | 75 | LoadLib("AnalysisCheck") ; |
76 | } | |
77 | ||
78 | // create the analysis goodies object | |
79 | AliAnalysisGoodies * ag = new AliAnalysisGoodies() ; | |
80 | ||
81 | // definition of analysis tasks | |
82 | ||
b0ce88ad | 83 | |
84 | AliPHOSQATask * phos = new AliPHOSQATask("PHOS") ; | |
85 | AliAnalysisDataContainer * phosIn = ag->ConnectInput(phos, TChain::Class(), 0) ; | |
86 | ag->ConnectOuput(phos, TObjArray::Class(), 0) ; | |
1dfe075f | 87 | |
b0ce88ad | 88 | AliEMCALQATask *emcal = new AliEMCALQATask("EMCal") ; |
89 | ag->ConnectInput(emcal, phosIn, 0) ; | |
90 | ag->ConnectOuput(emcal, TObjArray::Class(), 0) ; | |
1dfe075f | 91 | |
b0ce88ad | 92 | AliPMDQATask * pmd = new AliPMDQATask("PMD") ; |
93 | ag->ConnectInput(pmd, phosIn, 0) ; | |
94 | ag->ConnectOuput(pmd, TObjArray::Class(), 0) ; | |
398a3deb | 95 | |
b0ce88ad | 96 | AliAnalysisTaskPt * pt = new AliAnalysisTaskPt("Pt") ; |
97 | ag->ConnectInput(pt, phosIn, 0) ; | |
98 | ag->ConnectOuput(pt, TObjArray::Class(), 0) ; | |
1dfe075f | 99 | |
b0ce88ad | 100 | AliHMPIDQATask * hmpid= new AliHMPIDQATask("HMPID") ; |
101 | ag->ConnectInput(hmpid, phosIn, 0) ; | |
102 | ag->ConnectOuput(hmpid, TObjArray::Class(), 0) ; | |
1dfe075f | 103 | |
b0ce88ad | 104 | AliT0QATask * t0 = new AliT0QATask("T0") ; |
105 | ag->ConnectInput(t0, phosIn, 0) ; | |
106 | ag->ConnectOuput(t0, TObjArray::Class(), 0) ; | |
398a3deb | 107 | |
b0ce88ad | 108 | AliMUONQATask * muon = new AliMUONQATask("MUON") ; |
109 | ag->ConnectInput(muon, phosIn, 0) ; | |
110 | ag->ConnectOuput(muon, TObjArray::Class(), 0) ; | |
1dfe075f | 111 | |
b0ce88ad | 112 | AliTRDQATask * trd = new AliTRDQATask("TRD") ; |
113 | ag->ConnectInput(trd, phosIn, 0) ; | |
114 | ag->ConnectOuput(trd, TObjArray::Class(), 0) ; | |
98c8c1f8 | 115 | |
b0ce88ad | 116 | AliTOFQATask * tof = new AliTOFQATask("TOF") ; |
117 | ag->ConnectInput(tof, phosIn, 0) ; | |
118 | ag->ConnectOuput(tof, TObjArray::Class(), 0) ; | |
98c8c1f8 | 119 | |
b0ce88ad | 120 | AliVZEROQATask * vzero = new AliVZEROQATask("VZERO") ; |
121 | ag->ConnectInput(vzero, phosIn, 0) ; | |
122 | ag->ConnectOuput(vzero, TObjArray::Class(), 0) ; | |
398a3deb | 123 | |
b0ce88ad | 124 | AliFMDQATask * fmd = new AliFMDQATask("FMD") ; |
125 | ag->ConnectInput(fmd, phosIn, 0) ; | |
126 | ag->ConnectOuput(fmd, TObjArray::Class(), 0) ; | |
1dfe075f | 127 | |
128 | // get the data to analyze | |
129 | ||
130 | // definition of Tag cuts | |
131 | const char * runCuts = 0x0 ; | |
84eb42a1 | 132 | const char * evtCuts = 0x0 ; |
133 | const char * lhcCuts = 0x0 ; | |
134 | const char * detCuts = 0x0 ; | |
135 | ||
136 | //"fEventTag.fNPHOSClustersMin == 1 && fEventTag.fNEMCALClustersMin == 1" ; | |
1dfe075f | 137 | |
138 | ||
139 | TString input = gSystem->Getenv("ANA_INPUT") ; | |
140 | if ( input != "") { | |
141 | char argument[1024] ; | |
142 | if ( input.Contains("tag?") ) { | |
143 | //create the ESD collection from the tag collection | |
144 | input.ReplaceAll("tag?", "") ; | |
145 | const char * collESD = "esdCollection.xml" ; | |
84eb42a1 | 146 | ag->MakeEsdCollectionFromTagCollection(runCuts, lhcCuts, detCuts, evtCuts, input.Data(), collESD) ; |
1dfe075f | 147 | sprintf(argument, "esd?%s", collESD) ; |
148 | } else if ( input.Contains("esd?") ) | |
98c8c1f8 | 149 | sprintf(argument, "%s", input.Data()) ; |
1dfe075f | 150 | ag->Process(argument) ; |
151 | ||
152 | } else { | |
153 | ||
154 | TChain* analysisChain = new TChain("esdTree") ; | |
155 | // input = "alien:///alice/cern.ch/user/a/aliprod/prod2006_2/output_pp/105/411/AliESDs.root" ; | |
156 | // analysisChain->AddFile(input); | |
84eb42a1 | 157 | input = "AliESDs.root" ; |
398a3deb | 158 | const char * kInDir = gSystem->Getenv("OUTDIR") ; |
159 | if ( kInDir ) { | |
160 | if ( ! gSystem->cd(kInDir) ) { | |
161 | printf("%s does not exist\n", kInDir) ; | |
162 | return ; | |
163 | } | |
164 | Int_t event, skipped=0 ; | |
165 | char file[120] ; | |
166 | for (event = 0 ; event < kEvent ; event++) { | |
167 | sprintf(file, "%s/%d/AliESDs.root", kInDir,event) ; | |
168 | TFile * fESD = 0 ; | |
169 | if ( fESD = TFile::Open(file)) | |
170 | if ( fESD->Get("esdTree") ) { | |
171 | printf("++++ Adding %s\n", file) ; | |
172 | analysisChain->AddFile(file); | |
173 | } | |
174 | else { | |
175 | printf("---- Skipping %s\n", file) ; | |
176 | skipped++ ; | |
177 | } | |
178 | } | |
179 | printf("number of entries # %lld, skipped %d\n", analysisChain->GetEntries(), skipped*100) ; | |
180 | } | |
181 | else | |
182 | analysisChain->AddFile(input); | |
183 | ||
1dfe075f | 184 | ag->Process(analysisChain) ; |
185 | } | |
2704006a | 186 | return ; |
1dfe075f | 187 | } |
188 | ||
189 | //______________________________________________________________________ | |
190 | void Merge(const char * xml, const char * sub, const char * out) | |
191 | { | |
192 | if (! gIsAnalysisLoaded ) | |
193 | LoadLib("ESD") ; | |
194 | ||
195 | AliAnalysisGoodies * ag = new AliAnalysisGoodies() ; | |
196 | ag->Merge(xml, sub, out) ; | |
197 | } | |
198 |