]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG/muon/RunMuonAODfromGeneral.C
Transition PWG3 --> PWGHF
[u/mrichter/AliRoot.git] / PWG / muon / RunMuonAODfromGeneral.C
1 // 19 Nov 2007
2 // Macro for the running of the AliAnalysisTaskMuonAODfromGeneral
3 //
4
5 void RunMuonAODfromGeneral(char* filein = "../FromESDToGenAOD/AliAOD.root", char* fileout = "AliMuonAOD.root" ){
6      
7     gSystem->Load("libTree");
8     gSystem->Load("libGeom");
9     gSystem->Load("libSTEERBase");
10     gSystem->Load("libAOD");
11     gSystem->Load("libANALYSIS");                       
12     gSystem->Load("libPWGHFbase.so");
13              
14     // Input AOD file
15     TChain* chain = new TChain("aodTree");
16     chain->Add(filein);
17
18     // Make aod output handler
19     AliAODHandler* aodHandler = new AliAODHandler();
20     aodHandler->SetOutputFileName(fileout);
21     
22     // Make the analysis manager
23     AliAnalysisManager *mgr  = new AliAnalysisManager("AOD Manager", "AOD Manager");
24     mgr->SetOutputEventHandler(aodHandler);
25     mgr-> SetDebugLevel(10);
26     
27     // Task for AOD generation from PWG0base directory
28     AliAnalysisTaskMuonAODfromGeneral *aodfilter = new AliAnalysisTaskMuonAODfromGeneral("AOD Filter",7000.);
29     mgr->AddTask(aodfilter);
30   
31     // Create containers for input/output
32     AliAnalysisDataContainer *cinput1 = mgr->CreateContainer("cchain",TChain::Class(), 
33                                                              AliAnalysisManager::kInputContainer);
34     AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("tree", TTree::Class(),
35                                                               AliAnalysisManager::kOutputContainer, "default");
36     AliAnalysisDataContainer *coutput2 = mgr->CreateContainer("histo", TH1F::Class(),
37                                                               AliAnalysisManager::kOutputContainer, "default");
38
39     mgr->ConnectInput  (aodfilter,  0, cinput1  );
40     mgr->ConnectOutput (aodfilter,  0, coutput1 );
41     
42     // Run the analysis    
43     mgr->InitAnalysis();
44     mgr->PrintStatus();
45     mgr->StartAnalysis("local",chain);
46 }
47
48
49 Int_t setupPar(const char* pararchivename) {
50   ///////////////////
51   // Setup PAR File//
52   ///////////////////
53   if (pararchivename) {
54     char processline[1024];
55     sprintf(processline,".! tar xvzf %s.par",pararchivename);
56     gROOT->ProcessLine(processline);
57     const char* ocwd = gSystem->WorkingDirectory();
58     gSystem->ChangeDirectory(pararchivename);
59
60     // check for BUILD.sh and execute
61     if (!gSystem->AccessPathName("PROOF-INF/BUILD.sh")) {
62       printf("*******************************\n");
63       printf("*** Building PAR archive    ***\n");
64       printf("*******************************\n");
65
66       if (gSystem->Exec("PROOF-INF/BUILD.sh")) {
67         Error("runAnalysis","Cannot Build the PAR Archive! - Abort!");
68         return -1;
69       }
70     }
71     // check for SETUP.C and execute
72     if (!gSystem->AccessPathName("PROOF-INF/SETUP.C")) {
73       printf("*******************************\n");
74       printf("*** Setup PAR archive       ***\n");
75       printf("*******************************\n");
76       gROOT->Macro("PROOF-INF/SETUP.C");
77     }
78
79     gSystem->ChangeDirectory("../");
80   }
81
82   return 1;
83 }