]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ESDCheck/ana.C
Added log outputs
[u/mrichter/AliRoot.git] / ESDCheck / ana.C
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("libRAliEn.so");
41     gSystem->Load("libESD.so") ;
42     //gSystem->Load("libProof.so") ;
43   }
44
45   if ( strstr(pararchivename, "AnalysisCheck") ) {
46     gSystem->Load("libSpectrum.so");
47   }
48   
49   printf("lib%s done\n", pararchivename);
50
51   gSystem->ChangeDirectory(cdir);
52
53   gIsAnalysisLoaded = kTRUE ; 
54   return rv ; 
55 }
56
57 //______________________________________________________________________
58 void ana() 
59 {  
60   if (! gIsAnalysisLoaded ) {
61     LoadLib("ESD") ; 
62     LoadLib("ANALYSIS") ; 
63     LoadLib("AnalysisCheck") ; 
64   }
65   
66   // create the analysis goodies object
67   AliAnalysisGoodies * ag = new AliAnalysisGoodies() ; 
68
69   // definition of analysis tasks
70  
71   const Int_t knumberOfTasks = 10 ; 
72   AliAnalysisTask * taskList[knumberOfTasks] ; 
73   TClass * taskInputList[knumberOfTasks]  ; 
74   TClass * taskOutputList[knumberOfTasks] ; 
75
76   taskList[0]       = new AliPHOSQATask("PHOS") ;
77   taskInputList[0]  = TChain::Class() ; 
78   taskOutputList[0] = TObjArray::Class() ; 
79
80   taskList[1]       = new AliEMCALQATask("EMCal") ;
81   taskInputList[1]  = taskInputList[0] ; // only one top input container allowed 
82   taskOutputList[1] = TObjArray::Class() ; 
83
84   taskList[2]       = new AliPMDQATask("PMD") ;
85   taskInputList[2]  = taskInputList[0] ; // only one top input container allowed 
86   taskOutputList[2] = TObjArray::Class() ; 
87
88   taskList[3]       = new AliAnalysisTaskPt("Pt") ;
89   taskInputList[3]  = taskInputList[0] ; // only one top input container allowed 
90   taskOutputList[3] = TObjArray::Class() ; 
91   
92   taskList[4]       = new AliHMPIDQATask("HMPID") ;
93   taskInputList[4]  = taskInputList[0] ; // only one top input container allowed 
94   taskOutputList[4] = TObjArray::Class() ; 
95
96   taskList[5]       = new AliT0QATask("T0") ;
97   taskInputList[5]  = taskInputList[0] ; // only one top input container allowed 
98   taskOutputList[5] = TObjArray::Class() ; 
99
100   taskList[6]       = new AliMUONQATask("MUON") ;
101   taskInputList[6]  = taskInputList[0] ; // only one top input container allowed 
102   taskOutputList[6] = TObjArray::Class() ; 
103   
104   taskList[7]       = new AliTRDQATask("TRD") ;
105   taskInputList[7]  = taskInputList[0] ; // only one top input container allowed 
106   taskOutputList[7] = TObjArray::Class() ; 
107
108   taskList[8]       = new AliTOFQATask("TOF") ;
109   taskInputList[8]  = taskInputList[0] ; // only one top input container allowed 
110   taskOutputList[8] = TObjArray::Class() ; 
111
112   taskList[9]       = new AliVZEROQATask("VZERO") ;
113   taskInputList[9]  = taskInputList[0] ; // only one top input container allowed 
114   taskOutputList[9] = TObjArray::Class() ; 
115
116 //   taskList[8]       = new AliFMDQATask("FMD") ;
117 //   taskInputList[8]  = taskInputList[0] ; // only one top input container allowed 
118 //   taskOutputList[8] = TObjArray::Class() ; 
119   
120   ag->SetTasks(knumberOfTasks, taskList, taskInputList, taskOutputList) ; 
121
122   // get the data to analyze
123
124   // definition of Tag cuts 
125   const char * runCuts = 0x0 ; 
126   const char * evtCuts = 0x0 ; 
127   const char * lhcCuts = 0x0 ; 
128   const char * detCuts = 0x0 ; 
129   
130 //"fEventTag.fNPHOSClustersMin == 1 && fEventTag.fNEMCALClustersMin == 1" ; 
131
132   
133   TString input = gSystem->Getenv("ANA_INPUT") ; 
134   if ( input != "") {
135     char argument[1024] ;  
136     if ( input.Contains("tag?") ) {
137       //create the ESD collection from the tag collection 
138       input.ReplaceAll("tag?", "") ; 
139       const char * collESD = "esdCollection.xml" ;
140       ag->MakeEsdCollectionFromTagCollection(runCuts, lhcCuts, detCuts, evtCuts, input.Data(), collESD) ;
141       sprintf(argument, "esd?%s", collESD) ; 
142     } else if ( input.Contains("esd?") ) 
143       sprintf(argument, "%s", input.Data()) ; 
144     ag->Process(argument) ;
145
146   } else {
147
148     TChain* analysisChain = new TChain("esdTree") ;
149     //   input = "alien:///alice/cern.ch/user/a/aliprod/prod2006_2/output_pp/105/411/AliESDs.root" ; 
150     //   analysisChain->AddFile(input);
151     input = "AliESDs.root" ; 
152     analysisChain->AddFile(input);
153     ag->Process(analysisChain) ; 
154   }
155   return ;
156 }
157
158 //______________________________________________________________________
159 void Merge(const char * xml, const char * sub, const char * out) 
160 {
161   if (! gIsAnalysisLoaded ) 
162     LoadLib("ESD") ; 
163   
164   AliAnalysisGoodies * ag = new AliAnalysisGoodies() ; 
165   ag->Merge(xml, sub, out) ;
166 }
167