AliPhysics  e6c8d43 (e6c8d43)
AddTaskB0toDStarPi.C
Go to the documentation of this file.
1 
3  TString cutsfile="",
4  TString usercomment = "doremalen",
5  Bool_t bUseMCInfo=kFALSE,
6  Bool_t bUseQuickSignalAnalysis=kFALSE,
7  Bool_t bGetCutInfo=kTRUE,
8  Bool_t bShowRejection=kFALSE,
9  Bool_t bShowMask=kFALSE,
10  Int_t nDebugLevel=0)
11 {
12  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
13 
14  if (!mgr) {
15  ::Error("AddTaskB0toDStarPi", "No analysis manager to connect to.");
16  return NULL;
17  }
18 
19  if(bUseQuickSignalAnalysis && !bUseMCInfo){
20  ::Error("AddTaskB0toDStarPi", "Quick signal analysis only works for Monte Carlo.");
21  return NULL;
22  }
23  // cuts are stored in a TFile generated by makeTFile4CutsB0toDStarPi.C in ./macros/
24  // set the cuts there!
25 
26  TFile* filecuts;
27  if( cutsfile.EqualTo("") ) {
28  ::Error("Input file not found : add a cut object","");
29  } else {
30  filecuts=TFile::Open(cutsfile.Data());
31  if(!filecuts ||(filecuts && !filecuts->IsOpen())){
32  ::Error("Input file not found : check your cut object","");
33  }
34  }
35 
36  AliRDHFCutsB0toDStarPi* RDHFB0toDStarPi=new AliRDHFCutsB0toDStarPi();
37  RDHFB0toDStarPi = (AliRDHFCutsB0toDStarPi*)filecuts->Get("B0toDStarPiCuts");
38  if(!RDHFB0toDStarPi){
39  cout<<"Specific AliRDHFCutsB0toDStarPi not found"<<endl;
40  return 0;
41  }
42 
43  RDHFB0toDStarPi->SetName("B0toDStarPiCuts");
44 
45  RDHFB0toDStarPi->SetGetCutInfo(bGetCutInfo);
46 
47 
48  //CREATE THE TASK
49  printf("CREATE TASK\n");
50 
51  // create the task
52  AliAnalysisTaskSEB0toDStarPi *task = new AliAnalysisTaskSEB0toDStarPi("AliAnalysisTaskSEB0toDStarPi",RDHFB0toDStarPi);
53 
54  task->SetMC(bUseMCInfo);
55 
56  task->SetQuickSignalAnalysis(bUseQuickSignalAnalysis);
57 
58  task->SetGetCutInfo(bGetCutInfo);
59 
60  task->SetDebugLevel(nDebugLevel);
61 
62  task->SetShowRejection(bShowRejection);
63  task->SetShowMask(bShowMask);
64 
65  mgr->AddTask(task);
66 
67  // Create and connect containers for input/output
68  usercomment = "_" + usercomment;
69 
70  TString outputfile = AliAnalysisManager::GetCommonFileName();
71 
72  outputfile += ":PWG3_D2H_B0toDStarPi";
73  outputfile += usercomment;
74 
75  // ------ input data ------
76  TString input = "input";
77  input += usercomment;
78  TString output1 = "chist1";
79  output1 += usercomment;
80  // TString output2 = "coutputNormalization";
81  // output2 += usercomment;
82  TString output2 = "cuts";
83  output2 += usercomment;
84  TString output3 = "D0Pion";
85  output3 += usercomment;
86  TString output4 = "D0Kaon";
87  output4 += usercomment;
88  TString output5 = "DStarPion";
89  output5 += usercomment;
90  TString output6 = "B0Pion";
91  output6 += usercomment;
92  TString output7 = "D0";
93  output7 += usercomment;
94  TString output8 = "DStar";
95  output8 += usercomment;
96  TString output9 = "B0";
97  output9 += usercomment;
98  TString output10 = "D0_D0Pt";
99  output10 += usercomment;
100  TString output11 = "D0_DStarPt";
101  output11 += usercomment;
102  TString output12 = "DStar_DStarPt";
103  output12 += usercomment;
104  TString output13 = "B0MC";
105  output13 += usercomment;
106 
107 
108  AliAnalysisDataContainer *cinput0 = mgr->CreateContainer(input,TChain::Class(), AliAnalysisManager::kInputContainer);
109 
110  // ----- output data -----
111  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(output1,TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
112 
113  // AliAnalysisDataContainer *coutputNormalization = mgr->CreateContainer(output2,AliNormalizationCounter::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
114  AliAnalysisDataContainer *coutputCuts = mgr->CreateContainer(output2,TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data()); //cuts
115  AliAnalysisDataContainer *coutputD0Pion = mgr->CreateContainer(output3,TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
116  AliAnalysisDataContainer *coutputD0Kaon = mgr->CreateContainer(output4,TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
117  AliAnalysisDataContainer *coutputDStarPion = mgr->CreateContainer(output5,TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
118  AliAnalysisDataContainer *coutputB0Pion = mgr->CreateContainer(output6,TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
119  AliAnalysisDataContainer *coutputD0 = mgr->CreateContainer(output7,TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
120  AliAnalysisDataContainer *coutputDStar = mgr->CreateContainer(output8,TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
121  AliAnalysisDataContainer *coutputB0 = mgr->CreateContainer(output9,TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
122  AliAnalysisDataContainer *coutputD0_D0Pt = mgr->CreateContainer(output10,TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
123  AliAnalysisDataContainer *coutputD0_DStarPt = mgr->CreateContainer(output11,TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
124  AliAnalysisDataContainer *coutputDStar_DStarPt = mgr->CreateContainer(output12,TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
125  AliAnalysisDataContainer *coutputB0MC = mgr->CreateContainer(output13,TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
126 
127 
128  mgr->ConnectInput(task,0,mgr->GetCommonInputContainer());
129  mgr->ConnectOutput(task,1,coutput1);
130  // mgr->ConnectOutput(task,2,coutputNormalization);
131  mgr->ConnectOutput(task,2,coutputCuts);
132  mgr->ConnectOutput(task,3,coutputD0Pion);
133  mgr->ConnectOutput(task,4,coutputD0Kaon);
134  mgr->ConnectOutput(task,5,coutputDStarPion);
135  mgr->ConnectOutput(task,6,coutputB0Pion);
136  mgr->ConnectOutput(task,7,coutputD0);
137  mgr->ConnectOutput(task,8,coutputDStar);
138  mgr->ConnectOutput(task,9,coutputB0);
139  mgr->ConnectOutput(task,10,coutputD0_D0Pt);
140  mgr->ConnectOutput(task,11,coutputD0_DStarPt);
141  mgr->ConnectOutput(task,12,coutputDStar_DStarPt);
142  mgr->ConnectOutput(task,13,coutputB0MC);
143 
144  return task;
145 }
146 
147 
148 
void SetMC(Bool_t bUseMCInfo)
set MC usage
void SetGetCutInfo(Bool_t value)
int Int_t
Definition: External.C:63
void SetShowRejection(Bool_t bShowRejection)
AliAnalysisTaskSEB0toDStarPi * AddTaskB0toDStarPi(TString cutsfile="", TString usercomment="doremalen", Bool_t bUseMCInfo=kFALSE, Bool_t bUseQuickSignalAnalysis=kFALSE, Bool_t bGetCutInfo=kTRUE, Bool_t bShowRejection=kFALSE, Bool_t bShowMask=kFALSE, Int_t nDebugLevel=0)
bool Bool_t
Definition: External.C:53