Changes to run also without reading the MC (Chiara B)
[u/mrichter/AliRoot.git] / PWG3 / vertexingHF / AddTaskD0Mass.C
CommitLineData
ce39f0ac 1AliAnalysisTaskSED0Mass *AddTaskD0Mass(Int_t flag=0/*0 = D0,1 = LS*/,Bool_t readMC=kTRUE)
49061176 2{
3 //
a41f6fad 4 // AddTask for the AliAnalysisTaskSE for D0 candidates
49061176 5 // invariant mass histogram and association with MC truth
a41f6fad 6 // (using MC info in AOD) and cut variables distributions
49061176 7 // C.Bianchin chiara.bianchin@pd.infn.it
8 //
9
10
11 // Get the pointer to the existing analysis manager via the static access method.
12 //==============================================================================
13 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
14 if (!mgr) {
feb73eca 15 ::Error("AddTaskD0Distr", "No analysis manager to connect to.");
49061176 16 return NULL;
17 }
18
9de8c723 19 TString filename="",out1name="",out2name="",out3name="",out4name="",inname="";
feb73eca 20 if(flag==0){
21 filename="D0InvMass.root";
6306c90b 22 out1name="coutputmassD01";
23 out2name="coutputmassD02";
24 out3name="nEntriesD0";
25 out4name="coutputmassD0distr";
9de8c723 26 inname="cinputmassD0_0";
6306c90b 27 } else {
9de8c723 28 filename="D0InvMassLikeSign.root";
6306c90b 29 out1name="coutputmassLS1";
30 out2name="coutputmassLS2";
31 out3name="nEntriesLS";
32 out4name="coutputmassLSdistr";
9de8c723 33 inname="cinputmassD0_1";
6306c90b 34 }
feb73eca 35
49061176 36 // Aanalysis task
4464ce7e 37 AliAnalysisTaskSED0Mass *massD0Task = new AliAnalysisTaskSED0Mass("D0MassAndDistrAnalysis");
6306c90b 38 massD0Task->SetDebugLevel(0);
feb73eca 39 massD0Task->SetArray(flag);
ce39f0ac 40 massD0Task->SetReadMC(readMC);
49061176 41 mgr->AddTask(massD0Task);
42
43 //
44 // Create containers for input/output
9de8c723 45 AliAnalysisDataContainer *cinputmassD0 = mgr->CreateContainer(inname,TChain::Class(),
49061176 46 AliAnalysisManager::kInputContainer);
a4ae02cd 47
6306c90b 48 AliAnalysisDataContainer *coutputmassD01 = mgr->CreateContainer(out1name,TList::Class(),
a4ae02cd 49 AliAnalysisManager::kOutputContainer,
feb73eca 50 filename.Data());
6306c90b 51 AliAnalysisDataContainer *coutputmassD02 = mgr->CreateContainer(out2name,TList::Class(),
49061176 52 AliAnalysisManager::kOutputContainer,
feb73eca 53 filename.Data());
6306c90b 54 AliAnalysisDataContainer *coutputmassD03 = mgr->CreateContainer(out3name,TH1F::Class(),
a41f6fad 55 AliAnalysisManager::kOutputContainer,
feb73eca 56 filename.Data());
6306c90b 57 AliAnalysisDataContainer *coutputmassD04 = mgr->CreateContainer(out4name,TList::Class(),
a4ae02cd 58 AliAnalysisManager::kOutputContainer,
feb73eca 59 filename.Data());
a4ae02cd 60
49061176 61 mgr->ConnectInput(massD0Task,0,mgr->GetCommonInputContainer());
62
a4ae02cd 63 mgr->ConnectOutput(massD0Task,1,coutputmassD01);
64 mgr->ConnectOutput(massD0Task,2,coutputmassD02);
65 mgr->ConnectOutput(massD0Task,3,coutputmassD03);
a41f6fad 66 mgr->ConnectOutput(massD0Task,4,coutputmassD04);
49061176 67
6306c90b 68
49061176 69 return massD0Task;
70}