AliPhysics  97344c9 (97344c9)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AddTaskLc2V0bachpA_TMVA.C
Go to the documentation of this file.
2  Bool_t theMCon=kTRUE,
3  Bool_t onTheFly=kFALSE,
4  Bool_t keepingOnlyHIJINGbkd=kFALSE,
5  TString suffixName=""){
6 
7  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
8  if (!mgr) {
9  ::Error("AddTaskLc2V0bachelor", "No analysis manager to connect to.");
10  return NULL;
11  }
12 
13  // cuts are stored in a TFile generated by makeTFile4CutsLc2V0bachelor.C in ./macros/
14  // set there the cuts!!!!!
15  Bool_t stdcuts=kFALSE;
16  TFile* filecuts;
17  if( finname.EqualTo("") ) {
18  stdcuts=kTRUE;
19  } else {
20  filecuts=TFile::Open(finname.Data());
21  if(!filecuts ||(filecuts&& !filecuts->IsOpen())){
22  AliFatal("Input file not found : check your cut object");
23  }
24  }
25 
26  AliRDHFCutsLctoV0* RDHFCutsLctoV0anal = new AliRDHFCutsLctoV0();
27  if (stdcuts) RDHFCutsLctoV0anal->SetStandardCutsPP2010();
28  else RDHFCutsLctoV0anal = (AliRDHFCutsLctoV0*)filecuts->Get("LctoV0AnalysisCuts");
29  RDHFCutsLctoV0anal->SetName("LctoV0AnalysisCuts");
30  RDHFCutsLctoV0anal->SetMinPtCandidate(-1.);
31  RDHFCutsLctoV0anal->SetMaxPtCandidate(10000.);
32 
33 
34  // mm let's see if everything is ok
35  if (!RDHFCutsLctoV0anal) {
36  cout << "Specific AliRDHFCutsLctoV0 not found\n";
37  return;
38  }
39 
40 
41  //CREATE THE TASK
42  printf("CREATE TASK\n");
43  AliAnalysisTaskSELc2V0bachelorTMVA *task = new AliAnalysisTaskSELc2V0bachelorTMVA("AliAnalysisTaskSELc2V0bachelorTMVA", RDHFCutsLctoV0anal, onTheFly);
44  task->SetIspA(kTRUE);
45  task->SetMC(theMCon);
46  task->SetKeepingKeepingOnlyHIJINGBkg(keepingOnlyHIJINGbkd);
47  task->SetK0sAnalysis(kTRUE);
48  task->SetDebugLevel(0);
49  mgr->AddTask(task);
50 
51  // Create and connect containers for input/output
52  //TString outputfile = AliAnalysisManager::GetCommonFileName();
53  TString outputfile = Form("Lc2K0Sp_tree_pA%s.root", suffixName.Data());
54  TString output1name="", output2name="", output3name="", output4name="", output5name="", output6name="", output7name="";
55 
56  output1name = Form("treeList%s", suffixName.Data());
57  output2name = Form("Lc2pK0Scounter%s", suffixName.Data());
58  output3name = Form("Lc2pK0SCuts%s", suffixName.Data());
59  output4name = Form("treeSgn%s", suffixName.Data());
60  output5name = Form("treeBkg%s", suffixName.Data());
61  output6name = Form("listHistoKF%s", suffixName.Data());
62  output7name = Form("weights%s", suffixName.Data());
63 
64  mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
65  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(output1name, TList::Class(), AliAnalysisManager::kOutputContainer, outputfile.Data()); // trees
66  mgr->ConnectOutput(task, 1, coutput1);
67 
68  AliAnalysisDataContainer *coutputLc2 = mgr->CreateContainer(output2name, AliNormalizationCounter::Class(), AliAnalysisManager::kOutputContainer, outputfile.Data()); //counter
69  mgr->ConnectOutput(task, 2, coutputLc2);
70 
71  AliAnalysisDataContainer *coutputLc3 = mgr->CreateContainer(output3name, TList::Class(), AliAnalysisManager::kOutputContainer, outputfile.Data()); // cuts
72  mgr->ConnectOutput(task, 3, coutputLc3);
73 
74  AliAnalysisDataContainer *coutput4 = mgr->CreateContainer(output4name, TTree::Class(), AliAnalysisManager::kOutputContainer, outputfile.Data()); // trees
75  mgr->ConnectOutput(task, 4, coutput4);
76 
77  AliAnalysisDataContainer *coutput5 = mgr->CreateContainer(output5name, TTree::Class(), AliAnalysisManager::kOutputContainer, outputfile.Data()); // trees
78  mgr->ConnectOutput(task, 5, coutput5);
79 
80  AliAnalysisDataContainer *coutput6 = mgr->CreateContainer(output6name, TList::Class(), AliAnalysisManager::kOutputContainer, outputfile.Data()); // trees
81  mgr->ConnectOutput(task, 6, coutput6);
82 
83  AliAnalysisDataContainer *coutput7 = mgr->CreateContainer(output7name, TList::Class(), AliAnalysisManager::kOutputContainer, outputfile.Data()); // weights
84  mgr->ConnectOutput(task, 7, coutput7);
85 
86  return task;
87 
88 }
virtual void SetStandardCutsPP2010()
void SetMaxPtCandidate(Double_t ptCand=1000.)
Definition: AliRDHFCuts.h:218
void SetMinPtCandidate(Double_t ptCand=-1.)
Definition: AliRDHFCuts.h:217
bool Bool_t
Definition: External.C:53
AliAnalysisTaskSELc2V0bachelorTMVA * AddTaskLc2V0bachpA_TMVA(TString finname="Lc2V0bachelorCuts.root", Bool_t theMCon=kTRUE, Bool_t onTheFly=kFALSE, Bool_t keepingOnlyHIJINGbkd=kFALSE, TString suffixName="")