Reintroduces AliAnalysisGoodies in par file
[u/mrichter/AliRoot.git] / ESDCheck / ana.C
CommitLineData
1dfe075f 1Bool_t gIsAnalysisLoaded = kFALSE ;
2
3//______________________________________________________________________
4Bool_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);
381c19ed 17 gROOT->ProcessLine(processline);
1dfe075f 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//______________________________________________________________________
54void ana()
55{
56 if (! gIsAnalysisLoaded ) {
57 LoadLib("ESD") ;
c52c2132 58 LoadLib("ANALYSIS") ;
1dfe075f 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
98c8c1f8 68 const Int_t knumberOfTasks = 10 ;
1dfe075f 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
98c8c1f8 101 taskList[7] = new AliTRDQATask("TRD") ;
1dfe075f 102 taskInputList[7] = taskInputList[0] ; // only one top input container allowed
103 taskOutputList[7] = TObjArray::Class() ;
104
98c8c1f8 105 taskList[8] = new AliTOFQATask("TOF") ;
106 taskInputList[8] = taskInputList[0] ; // only one top input container allowed
107 taskOutputList[8] = TObjArray::Class() ;
108
109 taskList[9] = new AliVZEROQATask("VZERO") ;
110 taskInputList[9] = taskInputList[0] ; // only one top input container allowed
111 taskOutputList[9] = TObjArray::Class() ;
112
113// taskList[8] = new AliFMDQATask("FMD") ;
114// taskInputList[8] = taskInputList[0] ; // only one top input container allowed
115// taskOutputList[8] = TObjArray::Class() ;
116
1dfe075f 117 ag->SetTasks(knumberOfTasks, taskList, taskInputList, taskOutputList) ;
118
119 // get the data to analyze
120
121 // definition of Tag cuts
122 const char * runCuts = 0x0 ;
98c8c1f8 123 const char * evtCuts = 0x0 ; //"fEventTag.fNPHOSClustersMin == 1 && fEventTag.fNEMCALClustersMin == 1" ;
1dfe075f 124
125
126 TString input = gSystem->Getenv("ANA_INPUT") ;
127 if ( input != "") {
128 char argument[1024] ;
129 if ( input.Contains("tag?") ) {
130 //create the ESD collection from the tag collection
131 input.ReplaceAll("tag?", "") ;
132 const char * collESD = "esdCollection.xml" ;
133 ag->MakeEsdCollectionFromTagCollection(runCuts, evtCuts, input.Data(), collESD) ;
134 sprintf(argument, "esd?%s", collESD) ;
135 } else if ( input.Contains("esd?") )
98c8c1f8 136 sprintf(argument, "%s", input.Data()) ;
1dfe075f 137 ag->Process(argument) ;
138
139 } else {
140
141 TChain* analysisChain = new TChain("esdTree") ;
142 // input = "alien:///alice/cern.ch/user/a/aliprod/prod2006_2/output_pp/105/411/AliESDs.root" ;
143 // analysisChain->AddFile(input);
98c8c1f8 144 input = "/home/schutz/group/schutz/work/analysis/QA/HEAD/RunV0/AliESDs.root" ;
1dfe075f 145 analysisChain->AddFile(input);
146 ag->Process(analysisChain) ;
147 }
148}
149
150//______________________________________________________________________
151void Merge(const char * xml, const char * sub, const char * out)
152{
153 if (! gIsAnalysisLoaded )
154 LoadLib("ESD") ;
155
156 AliAnalysisGoodies * ag = new AliAnalysisGoodies() ;
157 ag->Merge(xml, sub, out) ;
158}
159
160//______________________________________________________________________
161void test(const char * fcollection1)
162{
163 AliXMLCollection collection1(fcollection1);
164 TChain* analysisChain = new TChain("esdTree");
165
166 collection1.Reset();
167 while (collection1.Next()) {
168 cout<<"Adding "<<collection1.GetTURL()<<endl;
169 analysisChain->Add(collection1.GetTURL());
170 }
171
172 return ;
173}