Single muon analysis from ESD using for the production PDC08/LHC08t (Bogdan, Nicole)
[u/mrichter/AliRoot.git] / PWG3 / muon / RunSingleMuonAnalysisFromESD.C
CommitLineData
509204ee 1//--------------------------------------------------------------------------
2// Base macro for submitting single muon analysis.
3//
4// In case it is not run with full aliroot, it needs to have in the working directory:
5// - STEERBase.par
6// - AOD.par
7// - ESD.par
8// - ANALYSIS.par
9// - ANALYSISalice.par
10// - PWG3muon.par
11//
12// The macro reads ESDs and outputs file:
13// - SingleMuESD.root
14//--------------------------------------------------------------------------
15
16void RunSingleMuonAnalysisFromESD(Bool_t local = kFALSE) {
17
18 TStopwatch timer;
19 timer.Start();
20
21 gSystem->Load("libTree");
22 gSystem->Load("libGeom");
23 gSystem->Load("libVMC");
24 gSystem->Load("libANALYSIS");
25 gSystem->Load("libSTEERBase");
26 gSystem->Load("libAOD");
27 gSystem->Load("libESD");
28 gSystem->Load("libPWG3muon.so");
29
30 TChain* chain = new TChain("esdTree");
31
32 if (!local) {
33 printf("*** Connect to AliEn ***\n");
34 TGrid::Connect("alien://");
35 TAlienCollection* coll = TAlienCollection::Open("wn.xml");
36 TGridResult* result = coll->GetGridResult("",0,0);
37 for(Int_t i = 0; i < result->GetEntries(); i++) {
38 printf("TURL = %s \n",result->GetKey(i,"turl"));
39 chain->Add(result->GetKey(i,"turl"));
40 }
41 } else {
42 chain->Add("/path_1_to/AliESDs.root");
43 chain->Add("/path_2_to/AliESDs.root");
44 chain->Add("/path_3_to/AliESDs.root");
45 }
46
47 //____________________________________________//
48 // Make the analysis manager
49 AliAnalysisManager *mgr = new AliAnalysisManager("TestManager");
50 AliVEventHandler* esdH = new AliESDInputHandler;
51 mgr->SetInputEventHandler(esdH);
52
53 //____________________________________________//
54 // ntuple task
55 AliAnalysisTaskSingleMuESD *task = new AliAnalysisTaskSingleMuESD("TaskSingleMuESD");
56 // force values for the trigger mask, for version where
57 // GetFiredTriggerClasses() does not work
58 //task->SetTriggerType("MUON");
59 mgr->AddTask(task);
60
61 // Create containers for input/output
62
63 // input
64 AliAnalysisDataContainer *cinput = mgr->CreateContainer("cchain",TChain::Class(),AliAnalysisManager::kInputContainer);
65
66 // output
67 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("ctree", TNtuple::Class(),AliAnalysisManager::kOutputContainer,"SingleMuESD.root");
68 AliAnalysisDataContainer *coutput2 = mgr->CreateContainer("chist", TH1F::Class(),AliAnalysisManager::kOutputContainer,"SingleMuESD.root");
69
70 //____________________________________________//
71 mgr->ConnectInput(task,0,cinput);
72 mgr->ConnectOutput(task,0,coutput1);
73 mgr->ConnectOutput(task,1,coutput2);
74
75 if (mgr->InitAnalysis()) {
76 mgr->PrintStatus();
77 mgr->StartAnalysis("local",chain);
78 }
79
80 timer.Stop();
81 timer.Print();
82}
83