AliPhysics  vAN-20150924 (e816f45)
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros
AddTaskLc2pK0sfromAODtracks.C
Go to the documentation of this file.
2  Bool_t theMCon=kFALSE,
3  Bool_t writeVariableTree=kTRUE,
4  Bool_t reconstructPrimVert=kFALSE,
5  Int_t nTour=0
6  )
7 
8 {
9 
10  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
11  if (!mgr) {
12  ::Error("AddTaskLc2V0YW", "No analysis manager to connect to.");
13  return NULL;
14  }
15 
16  Bool_t stdcuts=kFALSE;
17  TFile* filecuts;
18  if( finname.EqualTo("") ) {
19  stdcuts=kTRUE;
20  } else {
21  filecuts=TFile::Open(finname.Data());
22  if(!filecuts ||(filecuts&& !filecuts->IsOpen())){
23  AliFatal("Input file not found : check your cut object");
24  }
25  }
26 
28  if (stdcuts) RDHFCutsLc2pK0sanal->SetStandardCutsPP2010();
29  else RDHFCutsLc2pK0sanal = (AliRDHFCutsLctopK0sfromAODtracks*)filecuts->Get("LcAnalysisCuts");
30  RDHFCutsLc2pK0sanal->SetName("LcAnalysisCuts");
31  RDHFCutsLc2pK0sanal->SetMinPtCandidate(-1.);
32  RDHFCutsLc2pK0sanal->SetMaxPtCandidate(10000.);
33  if (!RDHFCutsLc2pK0sanal) {
34  cout << "Specific AliRDHFCutsLc2pK0sanal not found\n";
35  return;
36  }
37 
38 
39  //CREATE THE TASK
40 
41  printf("CREATE TASK\n");
42  AliAnalysisTaskSELc2pK0sfromAODtracks *task = new AliAnalysisTaskSELc2pK0sfromAODtracks("AliAnalysisTaskSELc2pK0sfromAODtracks",RDHFCutsLc2pK0sanal,writeVariableTree);
43  task->SetMC(theMCon);
44  task->SetDebugLevel(1);
45  task->SetReconstructPrimVert(reconstructPrimVert);
46 
47  mgr->AddTask(task);
48 
49  // Create and connect containers for input/output
50  TString outputfile = AliAnalysisManager::GetCommonFileName();
51  outputfile += ":PWG3_D2H_Lc2pK0s_";
52  outputfile += nTour;
53 
54  mgr->ConnectInput(task,0,mgr->GetCommonInputContainer());
55 
56  // ----- output data -----
57  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(Form("Lchist%1d",nTour),TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // general histos
58  mgr->ConnectOutput(task,1,coutput1);
59  AliAnalysisDataContainer *coutputLc2 = mgr->CreateContainer(Form("Lc2pK0sCuts%1d",nTour),TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // cuts
60  mgr->ConnectOutput(task,2,coutputLc2);
61 
62  if (writeVariableTree) {
63  AliAnalysisDataContainer *coutputLc3 = mgr->CreateContainer(Form("Lc2pK0svariables%1d",nTour),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
64  mgr->ConnectOutput(task,3,coutputLc3);
65  } else {
66  AliAnalysisDataContainer *coutputLc3 = mgr->CreateContainer(Form("LcAll%1d",nTour),TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
67  mgr->ConnectOutput(task,3,coutputLc3);
68  }
69 
70  return task;
71 
72 }
void SetMaxPtCandidate(Double_t ptCand=1000.)
Definition: AliRDHFCuts.h:216
AliAnalysisTaskSELc2pK0sfromAODtracks * AddTaskLc2pK0sfromAODtracks(TString finname="", Bool_t theMCon=kFALSE, Bool_t writeVariableTree=kTRUE, Bool_t reconstructPrimVert=kFALSE, Int_t nTour=0)
virtual void SetStandardCutsPP2010()
Definition: AliRDHFCuts.h:46
void SetMinPtCandidate(Double_t ptCand=-1.)
Definition: AliRDHFCuts.h:215