AliPhysics  64f4410 (64f4410)
AddTaskBPlustoD0Pi.C
Go to the documentation of this file.
1 
3  TString cutsfile="",
4  TString usercomment = "doremalen",
5  Bool_t bUseMCInfo=kFALSE,
6  Int_t nUseQuickSignalAnalysis=0,
7  Bool_t bGetCutInfo=kTRUE,
8  Bool_t bShowRejection=kFALSE,
9  Bool_t bShowMask=kFALSE,
10  Bool_t bUse3DHistograms=kFALSE,
11  Bool_t bCheckBackground=kFALSE,
12  Int_t nDebugLevel=0,
13  Int_t nUpgradeSetting=0,
14  Int_t nDegreePerRotation=3,
15  Int_t nNumberOfRotations=0,
16  Double_t fHistMassWindow=0.125
17  )
18 {
19  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
20 
21  // gDebug = 1;
22  if (!mgr) {
23  ::Error("AddTaskBPlustoD0Pi", "No analysis manager to connect to.");
24  return NULL;
25  }
26 
27  if(nUseQuickSignalAnalysis != 0 && !bUseMCInfo){
28  ::Error("AddTaskBPlustoD0Pi", "Quick signal analysis only works for Monte Carlo.");
29  return NULL;
30  }
31 
32  // cuts are stored in a TFile generated by makeTFile4CutsBPlustoD0Pi.C in ./macros/
33  // set the cuts there!
34 
35  TFile* filecuts;
36  if( cutsfile.EqualTo("") ) {
37  ::Error("Input file not found : add a cut object","");
38  } else {
39  filecuts=TFile::Open(cutsfile.Data());
40  if(!filecuts ||(filecuts && !filecuts->IsOpen())){
41  ::Error("Input file not found : check your cut object","");
42  }
43  }
44 
45  AliRDHFCutsBPlustoD0Pi* RDHFBPlustoD0Pi=new AliRDHFCutsBPlustoD0Pi();
46  RDHFBPlustoD0Pi = (AliRDHFCutsBPlustoD0Pi*)filecuts->Get("BPlustoD0PiCuts");
47  if(!RDHFBPlustoD0Pi){
48  cout<<"Specific AliRDHFCutsBPlustoD0Pi not found"<<endl;
49  return 0;
50  }
51 
52 
53  RDHFBPlustoD0Pi->SetName("BPlustoD0PiCuts");
54 
55  RDHFBPlustoD0Pi->SetGetCutInfo(bGetCutInfo);
56 
57  //CREATE THE TASK
58  printf("CREATE TASK\n");
59 
60  // create the task
61  AliAnalysisTaskSEBPlustoD0Pi *task = new AliAnalysisTaskSEBPlustoD0Pi("AliAnalysisTaskSEBPlustoD0Pi",RDHFBPlustoD0Pi);
62 
63  task->SetMC(bUseMCInfo);
64  task->SetQuickSignalAnalysis(nUseQuickSignalAnalysis);
65  task->SetGetCutInfo(bGetCutInfo);
66  task->SetDebugLevel(nDebugLevel);
67  task->SetShowRejection(bShowRejection);
68  task->SetShowMask(bShowMask);
69  // task->SetUse3DHistograms(bUse3DHistograms);
70  task->SetCheckBackground(bCheckBackground);
71  task->SetUpgradeSetting(nUpgradeSetting);
72  task->SetHistMassWindow(fHistMassWindow);
73  task->SetDegreePerRotation(nDegreePerRotation);
74  task->SetNumberOfRotations(nNumberOfRotations);
75 
76  mgr->AddTask(task);
77 
78  // Create and connect containers for input/output
79  usercomment = "_" + usercomment;
80 
81  TString outputfile = AliAnalysisManager::GetCommonFileName();
82 
83  outputfile += ":PWG3_D2H_BPlustoD0Pi";
84  outputfile += usercomment;
85 
86  // ------ input data ------
87  TString input = "input";
88  input += usercomment;
89  TString output1 = "chist1";
90  output1 += usercomment;
91  TString output2 = "cuts";
92  output2 += usercomment;
93  TString output3 = "D0FirstDaughter";
94  output3 += usercomment;
95  TString output4 = "D0SecondDaughter";
96  output4 += usercomment;
97  TString output5 = "BPlusPion";
98  output5 += usercomment;
99  TString output6 = "D0";
100  output6 += usercomment;
101  TString output7 = "BPlus";
102  output7 += usercomment;
103  TString output8 = "D0_D0Pt";
104  output8 += usercomment;
105  TString output9 = "BPlusMC";
106  output9 += usercomment;
107 
108 
109  AliAnalysisDataContainer *cinput0 = mgr->CreateContainer(input,TChain::Class(), AliAnalysisManager::kInputContainer);
110 
111  // ----- output data -----
112  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(output1,TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
113  AliAnalysisDataContainer *coutputCuts = mgr->CreateContainer(output2,TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data()); //cuts
114  AliAnalysisDataContainer *coutputD0FirstDaughter = mgr->CreateContainer(output3,TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
115  AliAnalysisDataContainer *coutputD0SecondDaughter = mgr->CreateContainer(output4,TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
116  AliAnalysisDataContainer *coutputBPlusPion = mgr->CreateContainer(output5,TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
117  AliAnalysisDataContainer *coutputD0 = mgr->CreateContainer(output6,TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
118  AliAnalysisDataContainer *coutputBPlus = mgr->CreateContainer(output7,TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
119  AliAnalysisDataContainer *coutputD0_D0Pt = mgr->CreateContainer(output8,TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
120  AliAnalysisDataContainer *coutputBPlusMC = mgr->CreateContainer(output9,TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
121 
122 
123  mgr->ConnectInput(task,0,mgr->GetCommonInputContainer());
124  mgr->ConnectOutput(task,1,coutput1);
125  mgr->ConnectOutput(task,2,coutputCuts);
126  mgr->ConnectOutput(task,3,coutputD0FirstDaughter);
127  mgr->ConnectOutput(task,4,coutputD0SecondDaughter);
128  mgr->ConnectOutput(task,5,coutputBPlusPion);
129  mgr->ConnectOutput(task,6,coutputD0);
130  mgr->ConnectOutput(task,7,coutputBPlus);
131  mgr->ConnectOutput(task,8,coutputD0_D0Pt);
132  mgr->ConnectOutput(task,9,coutputBPlusMC);
133 
134 
135  return task;
136 }
137 
138 
139 
void SetShowRejection(Bool_t bShowRejection)
double Double_t
Definition: External.C:58
int Int_t
Definition: External.C:63
void SetMC(Bool_t bUseMCInfo)
set MC usage
void SetGetCutInfo(Bool_t value)
AliAnalysisTaskSEBPlustoD0Pi * AddTaskBPlustoD0Pi(TString cutsfile="", TString usercomment="doremalen", Bool_t bUseMCInfo=kFALSE, Int_t nUseQuickSignalAnalysis=0, Bool_t bGetCutInfo=kTRUE, Bool_t bShowRejection=kFALSE, Bool_t bShowMask=kFALSE, Bool_t bUse3DHistograms=kFALSE, Bool_t bCheckBackground=kFALSE, Int_t nDebugLevel=0, Int_t nUpgradeSetting=0, Int_t nDegreePerRotation=3, Int_t nNumberOfRotations=0, Double_t fHistMassWindow=0.125)
bool Bool_t
Definition: External.C:53
void SetUpgradeSetting(Int_t nUpgradeSetting)