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