AliPhysics  2c6b7ad (2c6b7ad)
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  Bool_t fCheckInjected = 1,
18  Int_t fRemoveInjected = 1
19  )
20 {
21  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
22 
23  // gDebug = 1;
24  if (!mgr) {
25  ::Error("AddTaskB0toDStarPi", "No analysis manager to connect to.");
26  return NULL;
27  }
28 
29  if(nUseQuickSignalAnalysis != 0 && !bUseMCInfo){
30  ::Error("AddTaskB0toDStarPi", "Quick signal analysis only works for Monte Carlo.");
31  return NULL;
32  }
33 
34  // cuts are stored in a TFile generated by makeTFile4CutsB0toDStarPi.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  AliRDHFCutsB0toDStarPi* RDHFB0toDStarPi=new AliRDHFCutsB0toDStarPi();
48  RDHFB0toDStarPi = (AliRDHFCutsB0toDStarPi*)filecuts->Get("B0toDStarPiCuts");
49  if(!RDHFB0toDStarPi){
50  cout<<"Specific AliRDHFCutsB0toDStarPi not found"<<endl;
51  return 0;
52  }
53 
54 
55  RDHFB0toDStarPi->SetName("B0toDStarPiCuts");
56 
57  RDHFB0toDStarPi->SetGetCutInfo(bGetCutInfo);
58 
59  //CREATE THE TASK
60  printf("CREATE TASK\n");
61 
62  // create the task
63  AliAnalysisTaskSEB0toDStarPi *task = new AliAnalysisTaskSEB0toDStarPi("AliAnalysisTaskSEB0toDStarPi",RDHFB0toDStarPi);
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);
72  task->SetCheckBackground(bCheckBackground);
73  task->SetUpgradeSetting(nUpgradeSetting);
74  task->SetHistMassWindow(fHistMassWindow);
75  task->SetDegreePerRotation(nDegreePerRotation);
76  task->SetNumberOfRotations(nNumberOfRotations);
77  task->SetCheckInjected(fCheckInjected);
78  task->SetRemoveInjected(fRemoveInjected);
79 
80 
81  mgr->AddTask(task);
82 
83  // Create and connect containers for input/output
84  usercomment = "_" + usercomment;
85 
86  TString outputfile = AliAnalysisManager::GetCommonFileName();
87 
88  outputfile += ":PWG3_D2H_B0toDStarPi";
89  outputfile += usercomment;
90 
91  // ------ input data ------
92  TString input = "input";
93  input += usercomment;
94  TString output1 = "chist1";
95  output1 += usercomment;
96  TString output2 = "cuts";
97  output2 += usercomment;
98  TString output3 = "D0FirstDaughter";
99  output3 += usercomment;
100  TString output4 = "D0SecondDaughter";
101  output4 += usercomment;
102  TString output5 = "DStarPion";
103  output5 += usercomment;
104  TString output6 = "B0Pion";
105  output6 += usercomment;
106  TString output7 = "D0";
107  output7 += usercomment;
108  TString output8 = "DStar";
109  output8 += usercomment;
110  TString output9 = "B0";
111  output9 += usercomment;
112  TString output10 = "D0_D0Pt";
113  output10 += usercomment;
114  TString output11 = "D0_DStarPt";
115  output11 += usercomment;
116  TString output12 = "DStar_DStarPt";
117  output12 += usercomment;
118  TString output13 = "B0MC";
119  output13 += usercomment;
120 
121 
122  AliAnalysisDataContainer *cinput0 = mgr->CreateContainer(input,TChain::Class(), AliAnalysisManager::kInputContainer);
123 
124  // ----- output data -----
125  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(output1,TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
126  AliAnalysisDataContainer *coutputCuts = mgr->CreateContainer(output2,TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data()); //cuts
127  AliAnalysisDataContainer *coutputD0FirstDaughter = mgr->CreateContainer(output3,TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
128  AliAnalysisDataContainer *coutputD0SecondDaughter = mgr->CreateContainer(output4,TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
129  AliAnalysisDataContainer *coutputDStarPion = mgr->CreateContainer(output5,TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
130  AliAnalysisDataContainer *coutputB0Pion = mgr->CreateContainer(output6,TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
131  AliAnalysisDataContainer *coutputD0 = mgr->CreateContainer(output7,TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
132  AliAnalysisDataContainer *coutputDStar = mgr->CreateContainer(output8,TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
133  AliAnalysisDataContainer *coutputB0 = mgr->CreateContainer(output9,TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
134  AliAnalysisDataContainer *coutputD0_D0Pt = mgr->CreateContainer(output10,TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
135  AliAnalysisDataContainer *coutputD0_DStarPt = mgr->CreateContainer(output11,TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
136  AliAnalysisDataContainer *coutputDStar_DStarPt = mgr->CreateContainer(output12,TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
137  AliAnalysisDataContainer *coutputB0MC = mgr->CreateContainer(output13,TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
138 
139 
140  mgr->ConnectInput(task,0,mgr->GetCommonInputContainer());
141  mgr->ConnectOutput(task,1,coutput1);
142  mgr->ConnectOutput(task,2,coutputCuts);
143  mgr->ConnectOutput(task,3,coutputD0FirstDaughter);
144  mgr->ConnectOutput(task,4,coutputD0SecondDaughter);
145  mgr->ConnectOutput(task,5,coutputDStarPion);
146  mgr->ConnectOutput(task,6,coutputB0Pion);
147  mgr->ConnectOutput(task,7,coutputD0);
148  mgr->ConnectOutput(task,8,coutputDStar);
149  mgr->ConnectOutput(task,9,coutputB0);
150  mgr->ConnectOutput(task,10,coutputD0_D0Pt);
151  mgr->ConnectOutput(task,11,coutputD0_DStarPt);
152  mgr->ConnectOutput(task,12,coutputDStar_DStarPt);
153  mgr->ConnectOutput(task,13,coutputB0MC);
154 
155 
156  return task;
157 }
158 
159 
160 
void SetUpgradeSetting(Int_t nUpgradeSetting)
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, Bool_t fCheckInjected=1, Int_t fRemoveInjected=1)
double Double_t
Definition: External.C:58
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