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