New class for normalization studies (Giacomo)
[u/mrichter/AliRoot.git] / PWG3 / vertexingHF / macros / AddTaskDplus.C
CommitLineData
fad29dfd 1AliAnalysisTaskSEDplus *AddTaskDplus(TString filename="./DplustoKpipiCuts.root",Bool_t storeNtuple=kFALSE,
73173a6a 2 Bool_t readMC=kFALSE)
95e5b6b5 3{
4 //
5 // Test macro for the AliAnalysisTaskSE for D+ candidates
6
7 //Invariant mass histogram and
8 // association with MC truth (using MC info in AOD)
9 // R. Bala, bala@to.infn.it
10 // Get the pointer to the existing analysis manager via the static access method.
11 //==============================================================================
12 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
13 if (!mgr) {
14 ::Error("AddTaskDplus", "No analysis manager to connect to.");
15 return NULL;
16 }
17
fad29dfd 18 TFile* filecuts=new TFile(filename.Data());
19 if(!filecuts->IsOpen()){
20 cout<<"Input file not found: exit"<<endl;
21 return;
95e5b6b5 22 }
fad29dfd 23
24
25 //Analysis Task
95e5b6b5 26
fad29dfd 27
28 AliRDHFCutsDplustoKpipi* analysiscuts=new AliRDHFCutsDplustoKpipi();
29 analysiscuts = (AliRDHFCutsDplustoKpipi*)filecuts->Get("AnalysisCuts");
95e5b6b5 30
fad29dfd 31 AliRDHFCutsDplustoKpipi* prodcuts=new AliRDHFCutsDplustoKpipi();
32 prodcuts = (AliRDHFCutsDplustoKpipi*)filecuts->Get("ProdCuts");
73173a6a 33
fad29dfd 34 //AliRDHFCutsDplustoKpipi *prodcuts = (AliRDHFCutsDplustoKpipi*)fileCuts->Get("ProdCuts");
35 //AliRDHFCutsDplustoKpipi *analysiscuts = (AliRDHFCutsDplustoKpipi*)fileCuts->Get("AnalysisCuts");
95e5b6b5 36
fad29dfd 37
95e5b6b5 38 AliAnalysisTaskSEDplus *dplusTask = new AliAnalysisTaskSEDplus("DplusAnalysis",analysiscuts,prodcuts,storeNtuple);
39 dplusTask->SetReadMC(readMC);
40 dplusTask->SetDoLikeSign(kTRUE);
73173a6a 41 // dplusTask->SetUseTPCpid(kTRUE);
42 //dplusTask->SetUseTOFpid(kTRUE);
95e5b6b5 43 dplusTask->SetDebugLevel(0);
fad29dfd 44 dplusTask->SetMassLimits(0.2);
95e5b6b5 45 mgr->AddTask(dplusTask);
fad29dfd 46
47 // Create containers for input/output
48
95e5b6b5 49 AliAnalysisDataContainer *cinputDplus = mgr->CreateContainer("cinputDplus",TChain::Class(),
fad29dfd 50 AliAnalysisManager::kInputContainer);
95e5b6b5 51 TString outputfile = AliAnalysisManager::GetCommonFileName();
52 outputfile += ":PWG3_D2H_InvMassDplus";
fad29dfd 53
54 AliAnalysisDataContainer *coutputDplusCuts = mgr->CreateContainer("coutputDplusCuts",TList::Class(),
55 AliAnalysisManager::kOutputContainer,
56 outputfile.Data());
57
95e5b6b5 58 AliAnalysisDataContainer *coutputDplus = mgr->CreateContainer("coutputDplus",TList::Class(),
fad29dfd 59 AliAnalysisManager::kOutputContainer,
95e5b6b5 60 outputfile.Data());
a96083b9 61 AliAnalysisDataContainer *coutputDplusNorm = mgr->CreateContainer("coutputDplusNorm",AliNormalizationCounter::Class(),
62 AliAnalysisManager::kOutputContainer,
63 outputfile.Data());
fad29dfd 64
95e5b6b5 65 if(storeNtuple){
66 AliAnalysisDataContainer *coutputDplus2 = mgr->CreateContainer("coutputDplus2",TNtuple::Class(),
fad29dfd 67 AliAnalysisManager::kOutputContainer,
68 "InvMassDplus_nt1.root");
69
95e5b6b5 70 coutputDplus2->SetSpecialOutput();
71 }
72 mgr->ConnectInput(dplusTask,0,mgr->GetCommonInputContainer());
fad29dfd 73
95e5b6b5 74 mgr->ConnectOutput(dplusTask,1,coutputDplus);
fad29dfd 75
95e5b6b5 76 mgr->ConnectOutput(dplusTask,2,coutputDplusCuts);
a96083b9 77
78 mgr->ConnectOutput(dplusTask,3,coutputDplusNorm);
95e5b6b5 79 if(storeNtuple){
a96083b9 80 mgr->ConnectOutput(dplusTask,4,coutputDplus2);
95e5b6b5 81 }
82 return dplusTask;
83}