AliPhysics  64f4410 (64f4410)
AddTaskB0toDStarPi.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("AddTaskB0toDStarPi", "No analysis manager to connect to.");
24  return NULL;
25  }
26 
27  if(nUseQuickSignalAnalysis != 0 && !bUseMCInfo){
28  ::Error("AddTaskB0toDStarPi", "Quick signal analysis only works for Monte Carlo.");
29  return NULL;
30  }
31 
32  // cuts are stored in a TFile generated by makeTFile4CutsB0toDStarPi.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  AliRDHFCutsB0toDStarPi* RDHFB0toDStarPi=new AliRDHFCutsB0toDStarPi();
46  RDHFB0toDStarPi = (AliRDHFCutsB0toDStarPi*)filecuts->Get("B0toDStarPiCuts");
47  if(!RDHFB0toDStarPi){
48  cout<<"Specific AliRDHFCutsB0toDStarPi not found"<<endl;
49  return 0;
50  }
51 
52 
53  RDHFB0toDStarPi->SetName("B0toDStarPiCuts");
54 
55  RDHFB0toDStarPi->SetGetCutInfo(bGetCutInfo);
56 
57  //CREATE THE TASK
58  printf("CREATE TASK\n");
59 
60  // create the task
61  AliAnalysisTaskSEB0toDStarPi *task = new AliAnalysisTaskSEB0toDStarPi("AliAnalysisTaskSEB0toDStarPi",RDHFB0toDStarPi);
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_B0toDStarPi";
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 = "DStarPion";
98  output5 += usercomment;
99  TString output6 = "B0Pion";
100  output6 += usercomment;
101  TString output7 = "D0";
102  output7 += usercomment;
103  TString output8 = "DStar";
104  output8 += usercomment;
105  TString output9 = "B0";
106  output9 += usercomment;
107  TString output10 = "D0_D0Pt";
108  output10 += usercomment;
109  TString output11 = "D0_DStarPt";
110  output11 += usercomment;
111  TString output12 = "DStar_DStarPt";
112  output12 += usercomment;
113  TString output13 = "B0MC";
114  output13 += usercomment;
115 
116 
117  AliAnalysisDataContainer *cinput0 = mgr->CreateContainer(input,TChain::Class(), AliAnalysisManager::kInputContainer);
118 
119  // ----- output data -----
120  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(output1,TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
121  AliAnalysisDataContainer *coutputCuts = mgr->CreateContainer(output2,TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data()); //cuts
122  AliAnalysisDataContainer *coutputD0FirstDaughter = mgr->CreateContainer(output3,TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
123  AliAnalysisDataContainer *coutputD0SecondDaughter = mgr->CreateContainer(output4,TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
124  AliAnalysisDataContainer *coutputDStarPion = mgr->CreateContainer(output5,TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
125  AliAnalysisDataContainer *coutputB0Pion = mgr->CreateContainer(output6,TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
126  AliAnalysisDataContainer *coutputD0 = mgr->CreateContainer(output7,TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
127  AliAnalysisDataContainer *coutputDStar = mgr->CreateContainer(output8,TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
128  AliAnalysisDataContainer *coutputB0 = mgr->CreateContainer(output9,TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
129  AliAnalysisDataContainer *coutputD0_D0Pt = mgr->CreateContainer(output10,TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
130  AliAnalysisDataContainer *coutputD0_DStarPt = mgr->CreateContainer(output11,TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
131  AliAnalysisDataContainer *coutputDStar_DStarPt = mgr->CreateContainer(output12,TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
132  AliAnalysisDataContainer *coutputB0MC = mgr->CreateContainer(output13,TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
133 
134 
135  mgr->ConnectInput(task,0,mgr->GetCommonInputContainer());
136  mgr->ConnectOutput(task,1,coutput1);
137  mgr->ConnectOutput(task,2,coutputCuts);
138  mgr->ConnectOutput(task,3,coutputD0FirstDaughter);
139  mgr->ConnectOutput(task,4,coutputD0SecondDaughter);
140  mgr->ConnectOutput(task,5,coutputDStarPion);
141  mgr->ConnectOutput(task,6,coutputB0Pion);
142  mgr->ConnectOutput(task,7,coutputD0);
143  mgr->ConnectOutput(task,8,coutputDStar);
144  mgr->ConnectOutput(task,9,coutputB0);
145  mgr->ConnectOutput(task,10,coutputD0_D0Pt);
146  mgr->ConnectOutput(task,11,coutputD0_DStarPt);
147  mgr->ConnectOutput(task,12,coutputDStar_DStarPt);
148  mgr->ConnectOutput(task,13,coutputB0MC);
149 
150 
151  return task;
152 }
153 
154 
155 
void SetUpgradeSetting(Int_t nUpgradeSetting)
double Double_t
Definition: External.C:58
AliAnalysisTaskSEB0toDStarPi * AddTaskB0toDStarPi(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)
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