]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG4/anaCorr.C
Rewritten using new VDigitStore, VDigit and VTriggerStore interfaces (Laurent)
[u/mrichter/AliRoot.git] / PWG4 / anaCorr.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   // Setup par File
13   if (pararchivename) {
14     char processline[1024];
15     sprintf(processline,".! tar xvzf %s.par",pararchivename);
16     gROOT->ProcessLine(processline);
17     gSystem->ChangeDirectory(pararchivename);
18
19     // check for BUILD.sh and execute
20     if (!gSystem->AccessPathName("PROOF-INF/BUILD.sh")) {
21       printf("*** Building PAR archive  %s  ***\n", pararchivename);
22
23       if (gSystem->Exec("PROOF-INF/BUILD.sh")) {
24         AliError(Form("Cannot Build the PAR Archive %s! - Abort!", pararchivename) );
25
26         return kFALSE ;
27       }
28     }
29
30     // check for SETUP.C and execute
31     if (!gSystem->AccessPathName("PROOF-INF/SETUP.C")) {
32       printf("*** Setup PAR archive  %s     ***\n", pararchivename);
33       gROOT->Macro("PROOF-INF/SETUP.C");
34     }    
35   }
36
37   if ( strstr(pararchivename, "ESD") ) {
38     gSystem->Load("libVMC.so");
39     gSystem->Load("libESD.so");
40     gSystem->Load("libRAliEn.so") ;
41     gSystem->Load("libProof.so") ;
42   }
43
44   printf("*** %s library loaded *** %s **\n", pararchivename);
45
46   gSystem->ChangeDirectory(cdir);
47
48   gIsAnalysisLoaded = kTRUE ; 
49   return rv ;  
50 }
51
52 //______________________________________________________________________
53 void anaCorr() 
54 {  
55
56   if (! gIsAnalysisLoaded ) {
57     cout<<"Load ESD"<<endl;  
58     LoadLib("ESD") ;   
59     cout<<"Load ANALYSIS"<<endl;  
60     LoadLib("ANALYSIS") ; 
61     printf("Include path = %s\n", gSystem->GetIncludePath()) ; 
62     LoadLib("PWG4Gamma") ; 
63   }
64   //AliLog::SetGlobalDebugLevel(3);
65   
66   // create the analysis goodies object
67   AliAnalysisGoodies * ag = new AliAnalysisGoodies() ; 
68
69   // definition of analysis tasks
70   const Int_t knumberOfTasks = 4 ; 
71   AliAnalysisTask * taskList[knumberOfTasks] ; 
72   TClass * taskInputList[knumberOfTasks]  ; 
73   TClass * taskOutputList[knumberOfTasks] ; 
74
75 //   taskList[0]       = new AliAnaGammaHadron("GammaTest") ;
76 //   taskInputList[0]  = TChain::Class() ; 
77 //   taskOutputList[0] = TObjArray::Class() ; 
78
79 //   AliAnaGammaDirect * gd = new AliAnaGammaDirect("GammaDirect") ;
80 //   gd->SetMinGammaPt(1.);
81 //   taskList[0]       = gd ;
82   taskList[0]          = new AliAnaGammaDirect("GammaDirect") ;
83   taskInputList[0]  = TChain::Class() ; 
84   taskOutputList[0] = TObjArray::Class() ; 
85
86   taskList[1]       = new AliAnaGammaIsolCut("GammaIC") ;
87   taskInputList[1]  = TChain::Class() ; 
88   taskOutputList[1] = TObjArray::Class() ; 
89
90   taskList[2]       = new AliAnaGammaHadron("GammaHadron") ;
91   taskInputList[2]  = TChain::Class() ; 
92   taskOutputList[2] = TObjArray::Class() ; 
93
94  taskList[3]       = new AliAnaGammaJet("GammaJet") ;
95   taskInputList[3]  = TChain::Class() ; 
96   taskOutputList[3] = TObjArray::Class() ; 
97
98   ag->SetTasks(knumberOfTasks, taskList, taskInputList, taskOutputList) ; 
99
100   // get the data to analyze
101
102   // definition of Tag cuts 
103   const char * runCuts = 0x0 ; 
104   const char * evtCuts = "fEventTag.fNPHOSClustersMin == 1 && fEventTag.fNEMCALClustersMin == 1" ; 
105
106   
107   TString input = gSystem->Getenv("ANA_INPUT") ; 
108   cout<<"INPUT 0"<<input<<endl;
109   if ( input != "") {
110     char argument[1024] ;  
111     if ( input.Contains("tag?") ) {
112       //create the ESD collection from the tag collection 
113       input.ReplaceAll("tag?", "") ; 
114       const char * collESD = "esdCollection.xml" ;
115       ag->MakeEsdCollectionFromTagCollection(runCuts, evtCuts, input.Data(), collESD) ;
116       sprintf(argument, "esd?%s", collESD) ; 
117     } else if ( input.Contains("esd?") ) 
118       //argument = input.Data() ; 
119       sprintf(argument, "%s", input.Data()) ;
120     printf("................ %s", input.Data()) ;
121     ag->Process(argument) ;
122
123   } else {
124
125     TChain* analysisChain = new TChain("esdTree") ;
126     input = "AliESDs.root" ; 
127     analysisChain->AddFile(input);
128     ag->Process(analysisChain) ; 
129   }
130 }
131
132 //______________________________________________________________________
133 void Merge(const char * xml, const char * sub, const char * out) 
134 {
135   if (! gIsAnalysisLoaded ) 
136     LoadLib("ESD") ; 
137   
138   AliAnalysisGoodies * ag = new AliAnalysisGoodies() ; 
139   ag->Merge(xml, sub, out) ;
140 }
141
142 //______________________________________________________________________
143 void test(const char * fcollection1) 
144 {
145   AliXMLCollection collection1(fcollection1);
146  TChain* analysisChain = new TChain("esdTree");
147  
148  collection1.Reset();
149  while (collection1.Next()) {
150    cout<<"Adding "<<collection1.GetTURL()<<endl;
151    analysisChain->Add(collection1.GetTURL());
152  }
153  
154  return ;
155 }