Introducing a new AOD class: AliAODcascade (A.Maire)
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / macros / AliRsnReadTask.C
CommitLineData
2e1ebf1a 1//=========================================================================
2// This macro loops on the entries of a TChain (argument) containing ESDs
3// and saves a file containing a TTree of AliRsnEvents.
4//=========================================================================
5
6void AliRsnReadTask(TChain *analysisChain)
7{
8 // load libraries
9 gSystem->Load("libANALYSIS");
10 gSystem->Load("libANALYSISalice.so");
11 gSystem->Load("libPWG2resonances.so");
12
13 // instantiate the analysis manager
14 AliAnalysisManager *mgr = new AliAnalysisManager("TestManager");
15
16 // create and connect containers for input/output
17 AliAnalysisDataContainer *input = mgr->CreateContainer("in", TChain::Class(), AliAnalysisManager::kInputContainer);
18 AliAnalysisDataContainer *output = mgr->CreateContainer("out", TTree::Class(), AliAnalysisManager::kOutputContainer, "default");
19 input->SetData(analysisChain);
20
21 // add interface to MC
22 AliMCEventHandler* mcHandler = new AliMCEventHandler();
23 mgr->SetMCtruthEventHandler(mcHandler);
24
25 // add interface to ESD
26 AliESDInputHandler *esdHandler = new AliESDInputHandler();
27 esdHandler->SetInactiveBranches("*Calo*");
28 esdHandler->SetInactiveBranches("*V0*");
29 mgr->SetInputEventHandler(esdHandler);
30
31 // output
32 AliAODHandler* aodHandler = new AliAODHandler();
33 aodHandler->SetOutputFileName("AliRsnEvents.root");
34 aodHandler->SetCreateNonStandardAOD();
35 mgr->SetOutputEventHandler(aodHandler);
36
37 /*
38 // standard track cuts for primaries
39 AliESDtrackCuts* esdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts", "Standard");
40 esdTrackCutsL->SetMinNClustersTPC(50);
41 esdTrackCutsL->SetMaxChi2PerClusterTPC(3.5);
42 esdTrackCutsL->SetMaxCovDiagonalElements(2, 2, 0.5, 0.5, 2);
43 esdTrackCutsL->SetRequireTPCRefit(kTRUE);
44 esdTrackCutsL->SetMinNsigmaToVertex(3);
45 esdTrackCutsL->SetRequireSigmaToVertex(kTRUE);
46 esdTrackCutsL->SetAcceptKingDaughters(kFALSE);
47
48 // create filter for tracks and add to analysis
49 AliAnalysisFilter* trackFilter = new AliAnalysisFilter("trackFilter");
50 trackFilter->AddCuts(esdTrackCuts);
51 AliAnalysisTaskESDfilter *esdfilter = new AliAnalysisTaskESDfilter("ESD Filter");
52 esdfilter->SetTrackFilter(trackFilter);
53 //esdfilter->SetDebugLevel(10);
54 mgr->AddTask(esdfilter);
55 */
56
57 // create readerTask
58 AliRsnReaderTask *task = new AliRsnReaderTask("AliRsnReaderTask");
59
60 // Reader settings
61 AliRsnReader *reader = new AliRsnReader();
62 task->SetReader(reader);
63
64 // PID settings
65 AliRsnPID *pid = new AliRsnPID;
66 pid->SetMethod(AliRsnPID::kPerfect);
67 pid->SetPriorProbability(AliRsnPID::kElectron, 0.20);
68 pid->SetPriorProbability(AliRsnPID::kMuon, 0.20);
69 pid->SetPriorProbability(AliRsnPID::kPion, 0.83);
70 pid->SetPriorProbability(AliRsnPID::kKaon, 0.07);
71 pid->SetPriorProbability(AliRsnPID::kProton, 0.06);
72 pid->SetMaxPt(10.0);
73 pid->SetMinProb(0.5);
74 task->SetPID(pid);
75
76 // connect containers to AnalysisManager
77 mgr->AddTask(task);
78 mgr->ConnectInput(task, 0, input);
79 mgr->ConnectOutput(task, 0, output);
80
81 // run analysis
82 if (mgr->InitAnalysis()) {
83 mgr->PrintStatus();
84 mgr->StartAnalysis("rsnEvents", analysisChain);
85 }
86}