AliPhysics  608b256 (608b256)
AddTaskXicZero2XiPifromAODtracks.C
Go to the documentation of this file.
2  TString outputFileName="",
3  Bool_t theMCon=kFALSE,
4  Bool_t writeVariableTree=kTRUE,
5  Bool_t reconstructPrimVert=kFALSE,
6  Bool_t fillOnlySig = kFALSE,
7  Bool_t fillOnlyBkg = kFALSE
8  )
9 
10 {
11 
12  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
13  if (!mgr) {
14  ::Error("AddTaskLc2V0YW", "No analysis manager to connect to.");
15  return NULL;
16  }
17 
18  Bool_t stdcuts=kFALSE;
19  TFile* filecuts;
20  if( finname.EqualTo("") ) {
21  stdcuts=kTRUE;
22  } else {
23  filecuts=TFile::Open(finname.Data());
24  if(!filecuts ||(filecuts&& !filecuts->IsOpen())){
25  cout << "Input file not found : check your cut object" << endl;
26  return 0x0;
27  // AliFatal("Input file not found : check your cut object");
28  }
29  }
30 
32  if (stdcuts) RDHFCutsXic2XiPianal->SetStandardCutsPP2010();
33  else RDHFCutsXic2XiPianal = (AliRDHFCutsXicZerotoXiPifromAODtracks*)filecuts->Get("XicZeroAnalysisCuts");
34  RDHFCutsXic2XiPianal->SetName("XicZeroAnalysisCuts");
35  RDHFCutsXic2XiPianal->SetMinPtCandidate(2.);
36  RDHFCutsXic2XiPianal->SetMaxPtCandidate(10000.);
37 
38 
39  // mm let's see if everything is ok
40  if (!RDHFCutsXic2XiPianal) {
41  cout << "Specific AliRDHFCutsXic2XiPianal not found\n";
42  return 0x0;
43  }
44 
45 
46  //CREATE THE TASK
47 
48  printf("CREATE TASK\n");
49  AliAnalysisTaskSEXicZero2XiPifromAODtracks *task = new AliAnalysisTaskSEXicZero2XiPifromAODtracks("AliAnalysisTaskSEXicZero2XiPifromAODtracks",RDHFCutsXic2XiPianal,writeVariableTree);
50  task->SetMC(theMCon);
51  task->SetFillSignalOnly(fillOnlySig);
52  task->SetFillBkgOnly(fillOnlyBkg);
53  if ((!theMCon && fillOnlySig) || (!theMCon && fillOnlyBkg) || (fillOnlySig && fillOnlyBkg)) {cout<< "Wrong settings for MC" << endl; return 0x0;}
54  task->SetDebugLevel(1);
55  task->SetReconstructPrimVert(reconstructPrimVert);
56 
57  mgr->AddTask(task);
58 
59  // Create and connect containers for input/output
60  TString outputfile = AliAnalysisManager::GetCommonFileName();
61  outputfile += ":PWG3_D2H_XicZero2XiPi_";
62  outputfile += outputFileName.Data();
63 
64  mgr->ConnectInput(task,0,mgr->GetCommonInputContainer());
65 
66  // ----- output data -----
67  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(Form("chist%s", outputFileName.Data()),TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // general histos
68  mgr->ConnectOutput(task,1,coutput1);
69  AliAnalysisDataContainer *coutputXic2 = mgr->CreateContainer(Form("XicZero2XiPiCuts%s", outputFileName.Data()),TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // cuts
70  mgr->ConnectOutput(task,2,coutputXic2);
71  if (writeVariableTree) {
72  AliAnalysisDataContainer *coutputXic3 = mgr->CreateContainer(Form("XicZerovariables%s", outputFileName.Data()),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
73  mgr->ConnectOutput(task,3,coutputXic3);
74  }else{
75  AliAnalysisDataContainer *coutputXic3 = mgr->CreateContainer(Form("XicZeroAll%s", outputFileName.Data()),TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // general histos
76  mgr->ConnectOutput(task,3,coutputXic3);
77  }
78 
79  return task;
80 
81 }
void SetMaxPtCandidate(Double_t ptCand=1000.)
Definition: AliRDHFCuts.h:231
AliAnalysisTaskSEXicZero2XiPifromAODtracks * AddTaskXicZero2XiPifromAODtracks(TString finname="", TString outputFileName="", Bool_t theMCon=kFALSE, Bool_t writeVariableTree=kTRUE, Bool_t reconstructPrimVert=kFALSE, Bool_t fillOnlySig=kFALSE, Bool_t fillOnlyBkg=kFALSE)
virtual void SetStandardCutsPP2010()
Definition: AliRDHFCuts.h:48
void SetMinPtCandidate(Double_t ptCand=-1.)
Definition: AliRDHFCuts.h:230
bool Bool_t
Definition: External.C:53