1 //--------------------------------------------------------------------------
2 // Base macro for submitting single muon analysis.
4 // In case it is not run with full aliroot, it needs to have in the working directory:
9 // The macro reads AODs and outputs file:
10 // - outputDir/singleMuAnalysis.root
11 //--------------------------------------------------------------------------
13 void runSingleMuAnalysis(Char_t *inputDir=".", Char_t *outputDir=".") {
16 gSystem->Load("libTree");
17 gSystem->Load("libGeom");
18 gSystem->Load("libVMC");
19 gSystem->Load("libANALYSIS");
20 gSystem->Load("libSTEERBase");
21 gSystem->Load("libAOD");
22 gSystem->Load("libESD");
23 gSystem->Load("libPWG3base.so");
25 TString outFileName("singleMuAnalysis.root");
26 outFileName.Prepend(Form("%s/",outputDir));
28 //____________________________________________//
29 AliTagAnalysis *TagAna = new AliTagAnalysis("AOD");
31 AliRunTagCuts *runCuts = new AliRunTagCuts();
32 AliLHCTagCuts *lhcCuts = new AliLHCTagCuts();
33 AliDetectorTagCuts *detCuts = new AliDetectorTagCuts();
34 AliEventTagCuts *evCuts = new AliEventTagCuts();
36 TagAna->ChainLocalTags(inputDir);
39 // Temporary workaround to avoid problems with AOD tags.
40 TChain* chain = new TChain("aodTree");
41 TString inFileName("AliAOD.root");
42 inFileName.Prepend(Form("%s/",inputDir));
43 chain->Add(inFileName);
44 // When problems will be solved and/or you manage in getting a
45 // Run*.Merged.AOD.tag.root, substitute with the following lines:
47 //TChain* chain = 0x0;
48 //chain = TagAna->QueryTags(runCuts,lhcCuts,detCuts,evCuts);
51 //____________________________________________//
52 // Make the analysis manager
53 AliAnalysisManager *mgr = new AliAnalysisManager("TestManager");
54 AliVEventHandler* aodH = new AliAODInputHandler;
55 mgr->SetInputEventHandler(aodH);
56 //____________________________________________//
58 AliAnalysisTaskSingleMu *task1 = new AliAnalysisTaskSingleMu("SingleMu");
60 // Create containers for input/output
61 AliAnalysisDataContainer *cinput1 = mgr->CreateContainer("cchain1",TChain::Class(),AliAnalysisManager::kInputContainer);
62 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("cobjArray1", TObjArray::Class(),AliAnalysisManager::kOutputContainer,outFileName.Data());
64 //____________________________________________//
65 mgr->ConnectInput(task1,0,cinput1);
66 mgr->ConnectOutput(task1,0,coutput1);
67 if (!mgr->InitAnalysis()) return;
69 mgr->StartAnalysis("local",chain);