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