AliPhysics  29d4213 (29d4213)
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros
AddTaskLc2V0bachpA_TMVA.C
Go to the documentation of this file.
1 AliAnalysisTaskSELc2V0bachelorTMVA* AddTaskLc2V0bachpA_TMVA(TString finname="Lc2V0bachelorCuts.root",
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="";
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 
63  mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
64  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(output1name, TList::Class(), AliAnalysisManager::kOutputContainer, outputfile.Data()); // trees
65  mgr->ConnectOutput(task, 1, coutput1);
66 
67  AliAnalysisDataContainer *coutputLc2 = mgr->CreateContainer(output2name, AliNormalizationCounter::Class(), AliAnalysisManager::kOutputContainer, outputfile.Data()); //counter
68  mgr->ConnectOutput(task, 2, coutputLc2);
69 
70  AliAnalysisDataContainer *coutputLc3 = mgr->CreateContainer(output3name, TList::Class(), AliAnalysisManager::kOutputContainer, outputfile.Data()); // cuts
71  mgr->ConnectOutput(task, 3, coutputLc3);
72 
73  AliAnalysisDataContainer *coutput4 = mgr->CreateContainer(output4name, TTree::Class(), AliAnalysisManager::kOutputContainer, outputfile.Data()); // trees
74  mgr->ConnectOutput(task, 4, coutput4);
75 
76  AliAnalysisDataContainer *coutput5 = mgr->CreateContainer(output5name, TTree::Class(), AliAnalysisManager::kOutputContainer, outputfile.Data()); // trees
77  mgr->ConnectOutput(task, 5, coutput5);
78 
79  AliAnalysisDataContainer *coutput6 = mgr->CreateContainer(output6name, TList::Class(), AliAnalysisManager::kOutputContainer, outputfile.Data()); // trees
80  mgr->ConnectOutput(task, 6, coutput6);
81 
82  return task;
83 
84 }
virtual void SetStandardCutsPP2010()
void SetMaxPtCandidate(Double_t ptCand=1000.)
Definition: AliRDHFCuts.h:216
void SetMinPtCandidate(Double_t ptCand=-1.)
Definition: AliRDHFCuts.h:215
AliAnalysisTaskSELc2V0bachelorTMVA * AddTaskLc2V0bachpA_TMVA(TString finname="Lc2V0bachelorCuts.root", Bool_t theMCon=kTRUE, Bool_t onTheFly=kFALSE, Bool_t keepingOnlyHIJINGbkd=kFALSE, TString suffixName="")