1 Bool_t gIsAnalysisLoaded = kFALSE ;
3 //______________________________________________________________________
4 Bool_t LoadLib( const char* pararchivename)
6 // Loads the AliRoot required libraries from a tar file
11 sprintf(cdir, "%s", gSystem->WorkingDirectory() ) ;
16 sprintf(parpar, "%s.par", pararchivename) ;
17 if ( gSystem->AccessPathName(parpar) ) {
18 gSystem->ChangeDirectory(gSystem->Getenv("ALICE_ROOT")) ;
19 char processline[1024];
20 sprintf(processline, ".! make %s", parpar) ;
21 cout << processline << endl ;
22 gROOT->ProcessLine(processline) ;
23 gSystem->ChangeDirectory(cdir) ;
24 sprintf(processline, ".! mv /tmp/%s .", parpar) ;
25 gROOT->ProcessLine(processline) ;
26 sprintf(processline,".! tar xvzf %s",parpar);
27 gROOT->ProcessLine(processline);
29 gSystem->ChangeDirectory(pararchivename);
31 // check for BUILD.sh and execute
32 if (!gSystem->AccessPathName("PROOF-INF/BUILD.sh")) {
33 printf("*** Building PAR archive %s ***\n", pararchivename);
35 if (gSystem->Exec("PROOF-INF/BUILD.sh")) {
36 AliError(Form("Cannot Build the PAR Archive %s! - Abort!", pararchivename) );
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");
48 if ( strstr(pararchivename, "AnalysisCheck") ) {
49 gSystem->Load("libSpectrum.so");
52 printf("lib%s done\n", pararchivename);
54 gSystem->ChangeDirectory(cdir);
56 gIsAnalysisLoaded = kTRUE ;
60 //________________________________ana______________________________________
62 void ana(const Int_t kEvent=10)
65 //AliLog::SetGlobalDebugLevel(5);
66 gSystem->AddIncludePath("-I\"$ALICE_ROOT/include\"");
67 gSystem->Load("libANALYSIS.so");
68 gSystem->Load("libANALYSISRL.so");
70 if (! gIsAnalysisLoaded ) {
73 // LoadLib("ANALYSIS") ;
74 LoadLib("PWG4Gamma") ;
77 // create the analysis goodies object
78 AliAnalysisGoodies * ag = new AliAnalysisGoodies() ;
80 AliAnalysisTaskGamma * task = new AliAnalysisTaskGamma ("GammaCorrelations");
81 ag->ConnectInput(task, TChain::Class(), 0) ;
82 ag->ConnectOuput(task, TList::Class(), 0) ;
83 //ag->ConnectOuput(task, TTree::Class(), 0, "AOD") ;
85 // get the data to analyze
87 // definition of Tag cuts
88 const char * runCuts = 0x0 ;
89 const char * evtCuts = 0x0 ;
90 const char * lhcCuts = 0x0 ;
91 const char * detCuts = 0x0 ;
93 //"fEventTag.fNPHOSClustersMin == 1 && fEventTag.fNEMCALClustersMin == 1" ;
95 TString input = gSystem->Getenv("ANA_INPUT") ;
96 cout<<"ANA_INPUT >>> "<<input<<endl;
98 cout<<"ANALYSIS 1"<<endl;
100 char argument[1024] ;
102 if ( input.Contains("tag?") ) {
103 //create the ESD collection from the tag collection
104 input.ReplaceAll("tag?", "") ;
106 const char * collESD = "esdCollection.xml" ;
107 ag->MakeEsdCollectionFromTagCollection(runCuts, lhcCuts, detCuts, evtCuts, input.Data(), collESD) ;
108 sprintf(argument, "esd?%s", collESD) ;
109 cout<<"TAG collection >> "<<argument<<endl;
112 else if ( input.Contains("esd?") ){
113 sprintf(argument, "%s", input.Data()) ;
114 cout<<"ESD collection >> "<<argument<<endl;
117 ag->Process(argument) ;
121 cout<<"ANALYSIS 2"<<endl;
122 TChain* analysisChain = new TChain("esdTree") ;
123 // input = "alien:///alice/cern.ch/user/a/aliprod/prod2006_2/output_pp/105/411/AliESDs.root" ;
124 // analysisChain->AddFile(input);
125 input = "AliESDs.root" ;
126 const char * kInDir = gSystem->Getenv("OUTDIR") ;
128 if ( ! gSystem->cd(kInDir) ) {
129 printf("%s does not exist\n", kInDir) ;
132 Int_t event, skipped=0 ;
134 for (event = 0 ; event < kEvent ; event++) {
135 sprintf(file, "%s/%d/AliESDs.root", kInDir,event) ;
137 if ( fESD = TFile::Open(file))
138 if ( fESD->Get("esdTree") ) {
139 printf("++++ Adding %s\n", file) ;
140 analysisChain->AddFile(file);
143 printf("---- Skipping %s\n", file) ;
147 printf("number of entries # %lld, skipped %d\n", analysisChain->GetEntries(), skipped*100) ;
150 analysisChain->AddFile(input);
152 ag->Process(analysisChain) ;
157 //______________________________________________________________________
158 void Merge(const char * xml, const char * sub, const char * out)
160 if (! gIsAnalysisLoaded )
163 AliAnalysisGoodies * ag = new AliAnalysisGoodies() ;
164 ag->Merge(xml, sub, out) ;