Pedestals in OCDB + minors
[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") ) {
84eb42a1 39 //gSystem->Load("libVMC.so");
1dfe075f 40 gSystem->Load("libESD.so");
84eb42a1 41 //gSystem->Load("libRAliEn.so") ;
42 //gSystem->Load("libProof.so") ;
1dfe075f 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 LoadLib("AnalysisCheck") ;
60 }
61
62 // create the analysis goodies object
63 AliAnalysisGoodies * ag = new AliAnalysisGoodies() ;
64
65 // definition of analysis tasks
66
98c8c1f8 67 const Int_t knumberOfTasks = 10 ;
1dfe075f 68 AliAnalysisTask * taskList[knumberOfTasks] ;
69 TClass * taskInputList[knumberOfTasks] ;
70 TClass * taskOutputList[knumberOfTasks] ;
71
72 taskList[0] = new AliPHOSQATask("PHOS") ;
73 taskInputList[0] = TChain::Class() ;
74 taskOutputList[0] = TObjArray::Class() ;
75
76 taskList[1] = new AliEMCALQATask("EMCal") ;
77 taskInputList[1] = taskInputList[0] ; // only one top input container allowed
78 taskOutputList[1] = TObjArray::Class() ;
79
80 taskList[2] = new AliPMDQATask("PMD") ;
81 taskInputList[2] = taskInputList[0] ; // only one top input container allowed
82 taskOutputList[2] = TObjArray::Class() ;
83
84 taskList[3] = new AliAnalysisTaskPt("Pt") ;
85 taskInputList[3] = taskInputList[0] ; // only one top input container allowed
86 taskOutputList[3] = TObjArray::Class() ;
87
88 taskList[4] = new AliHMPIDQATask("HMPID") ;
89 taskInputList[4] = taskInputList[0] ; // only one top input container allowed
90 taskOutputList[4] = TObjArray::Class() ;
91
92 taskList[5] = new AliT0QATask("T0") ;
93 taskInputList[5] = taskInputList[0] ; // only one top input container allowed
94 taskOutputList[5] = TObjArray::Class() ;
95
96 taskList[6] = new AliMUONQATask("MUON") ;
97 taskInputList[6] = taskInputList[0] ; // only one top input container allowed
98 taskOutputList[6] = TObjArray::Class() ;
99
98c8c1f8 100 taskList[7] = new AliTRDQATask("TRD") ;
1dfe075f 101 taskInputList[7] = taskInputList[0] ; // only one top input container allowed
102 taskOutputList[7] = TObjArray::Class() ;
103
98c8c1f8 104 taskList[8] = new AliTOFQATask("TOF") ;
105 taskInputList[8] = taskInputList[0] ; // only one top input container allowed
106 taskOutputList[8] = TObjArray::Class() ;
107
108 taskList[9] = new AliVZEROQATask("VZERO") ;
109 taskInputList[9] = taskInputList[0] ; // only one top input container allowed
110 taskOutputList[9] = TObjArray::Class() ;
111
112// taskList[8] = new AliFMDQATask("FMD") ;
113// taskInputList[8] = taskInputList[0] ; // only one top input container allowed
114// taskOutputList[8] = TObjArray::Class() ;
115
1dfe075f 116 ag->SetTasks(knumberOfTasks, taskList, taskInputList, taskOutputList) ;
117
118 // get the data to analyze
119
120 // definition of Tag cuts
121 const char * runCuts = 0x0 ;
84eb42a1 122 const char * evtCuts = 0x0 ;
123 const char * lhcCuts = 0x0 ;
124 const char * detCuts = 0x0 ;
125
126//"fEventTag.fNPHOSClustersMin == 1 && fEventTag.fNEMCALClustersMin == 1" ;
1dfe075f 127
128
129 TString input = gSystem->Getenv("ANA_INPUT") ;
130 if ( input != "") {
131 char argument[1024] ;
132 if ( input.Contains("tag?") ) {
133 //create the ESD collection from the tag collection
134 input.ReplaceAll("tag?", "") ;
135 const char * collESD = "esdCollection.xml" ;
84eb42a1 136 ag->MakeEsdCollectionFromTagCollection(runCuts, lhcCuts, detCuts, evtCuts, input.Data(), collESD) ;
1dfe075f 137 sprintf(argument, "esd?%s", collESD) ;
138 } else if ( input.Contains("esd?") )
98c8c1f8 139 sprintf(argument, "%s", input.Data()) ;
1dfe075f 140 ag->Process(argument) ;
141
142 } else {
143
144 TChain* analysisChain = new TChain("esdTree") ;
145 // input = "alien:///alice/cern.ch/user/a/aliprod/prod2006_2/output_pp/105/411/AliESDs.root" ;
146 // analysisChain->AddFile(input);
84eb42a1 147 input = "AliESDs.root" ;
1dfe075f 148 analysisChain->AddFile(input);
149 ag->Process(analysisChain) ;
150 }
151}
152
153//______________________________________________________________________
154void Merge(const char * xml, const char * sub, const char * out)
155{
156 if (! gIsAnalysisLoaded )
157 LoadLib("ESD") ;
158
159 AliAnalysisGoodies * ag = new AliAnalysisGoodies() ;
160 ag->Merge(xml, sub, out) ;
161}
162
163//______________________________________________________________________
164void test(const char * fcollection1)
165{
166 AliXMLCollection collection1(fcollection1);
167 TChain* analysisChain = new TChain("esdTree");
168
169 collection1.Reset();
170 while (collection1.Next()) {
171 cout<<"Adding "<<collection1.GetTURL()<<endl;
172 analysisChain->Add(collection1.GetTURL());
173 }
174
175 return ;
176}