AliPhysics  9b6b435 (9b6b435)
AddTaskDStarSpectra.C
Go to the documentation of this file.
1 //if like define a different number of signal for TPC PID
2 
3 //by default the task is anyway computing 1, 2 and 3 sigmas
4 
5 const Bool_t theRareOn = kFALSE;
6 
7 const Bool_t anaType = 1;//0 HD; 1 UU;
8 
9 const Bool_t doImp = kFALSE;// imp par studies
10 
11 //----------------------------------------------------
12 
13 
14 
16 
17  Float_t minC=0, Float_t maxC=100,
18 
19  TString cutsfile="", TString usercomment = "username",
20 
21  Bool_t theMCon=kFALSE, Bool_t doDStarVsY=kFALSE)
22 
23 {
24 
25 
26 
27  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
28 
29  if (!mgr) {
30 
31  ::Error("AddTaskDStarSpectra", "No analysis manager to connect to.");
32 
33  return NULL;
34 
35  }
36 
37 
38 
39  // cuts are stored in a TFile generated by makeTFile4CutsDStartoKpipi.C in ./macros/
40 
41  // set there the cuts!!!!!
42 
43  Bool_t stdcuts=kFALSE;
44 
45  TFile* filecuts;
46  if( cutsfile.EqualTo("") ) {
47  stdcuts=kTRUE;
48  } else {
49  filecuts=TFile::Open(cutsfile.Data());
50  if(!filecuts ||(filecuts&& !filecuts->IsOpen())){
51  ::Fatal("AddTaskDStarSpectra", "Input file not found : check your cut object");
52  }
53  }
54 
55 
56 
57 
58 
59  AliRDHFCutsDStartoKpipi* RDHFDStartoKpipi=new AliRDHFCutsDStartoKpipi();
60 
61  if(stdcuts) {
62 
63  if(system==0) RDHFDStartoKpipi->SetStandardCutsPP2010();
64 
65  else if(system==1) {
66 
67  RDHFDStartoKpipi->SetStandardCutsPbPb2010();
68 
69  RDHFDStartoKpipi->SetMinCentrality(minC);
70 
71  RDHFDStartoKpipi->SetMinCentrality(maxC);
72 
73  RDHFDStartoKpipi->SetUseAOD049(kTRUE);
74 
75  RDHFDStartoKpipi->SetUseCentrality(AliRDHFCuts::kCentV0M);
76 
77  }
78 
79  }
80 
81  else {
82  RDHFDStartoKpipi = (AliRDHFCutsDStartoKpipi*)filecuts->Get("DStartoKpipiCuts");
83  if(minC!=0 && maxC!=0) { //if centrality 0 and 0 leave the values in the cut object
84  RDHFDStartoKpipi->SetMinCentrality(minC);
85  RDHFDStartoKpipi->SetMaxCentrality(maxC);
86  }
87 
88  }
89 
90  RDHFDStartoKpipi->SetName("DStartoKpipiCuts");
91 
92 
93 
94  // mm let's see if everything is ok
95 
96  if(!RDHFDStartoKpipi){
97 
98  cout<<"Specific AliRDHFCuts not found"<<endl;
99 
100  return NULL;
101 
102  }
103 
104 
105 
106  //CREATE THE TASK
107 
108  printf("CREATE TASK\n");
109 
110  // create the task
111 
112  AliAnalysisTaskSEDStarSpectra *task = new AliAnalysisTaskSEDStarSpectra("AliAnalysisTaskSEDStarSpectra",RDHFDStartoKpipi);
113 
114  task->SetAnalysisType(anaType);
115 
116  task->SetMC(theMCon);
117 
118  task->SetRareSearch(theRareOn);
119 
121 
122  task->SetDebugLevel(0);
123 
124  task->SetDoDStarVsY(doDStarVsY);
125 
126  mgr->AddTask(task);
127 
128 
129 
130  // Create and connect containers for input/output
131 
132  usercomment = "_" + usercomment;
133 
134  TString outputfile = AliAnalysisManager::GetCommonFileName();
135 
136  outputfile += ":PWG3_D2H_DStarSpectra";
137  outputfile += usercomment;
138 
139 
140  // ------ input data ------
141  TString input = "indstar";
142  input += usercomment;
143  TString output1 = "chist1";
144  output1 += usercomment;
145  TString output2 = "DStarAll";
146  output2 += usercomment;
147  TString output3 = "DStarPID";
148  output3 += usercomment;
149  TString output4 = "cuts";
150  output4 += usercomment;
151  TString output5 = "coutputDstarNorm";
152  output5 += usercomment;
153 
154  //AliAnalysisDataContainer *cinput0 = mgr->GetCommonInputContainer();
155 
156  AliAnalysisDataContainer *cinput0 = mgr->CreateContainer(input,TChain::Class(),
157 
158  AliAnalysisManager::kInputContainer);
159 
160  // ----- output data -----
161 
162  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(output1,TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
163 
164  AliAnalysisDataContainer *coutputDStar1 = mgr->CreateContainer(output2,TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
165 
166  AliAnalysisDataContainer *coutputDStar2 = mgr->CreateContainer(output3,TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
167 
168  AliAnalysisDataContainer *coutputDStar3 = mgr->CreateContainer(output4,AliRDHFCutsDStartoKpipi::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data()); //cuts
169 
170  AliAnalysisDataContainer *coutputDstarNorm = mgr->CreateContainer(output5,AliNormalizationCounter::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
171 
172 
173 
174  mgr->ConnectInput(task,0,mgr->GetCommonInputContainer());
175 
176  mgr->ConnectOutput(task,1,coutput1);
177 
178  mgr->ConnectOutput(task,2,coutputDStar1);
179 
180  mgr->ConnectOutput(task,3,coutputDStar2);
181 
182  mgr->ConnectOutput(task,4,coutputDStar3);
183 
184  mgr->ConnectOutput(task,5,coutputDstarNorm);
185 
186 
187 
188  return task;
189 
190 }
191 
192 
193 
void SetUseAOD049(Bool_t flag=kTRUE)
Definition: AliRDHFCuts.h:211
void SetUseCentrality(Int_t flag=1)
void SetMC(Bool_t theMCon)
set MC usage
int Int_t
Definition: External.C:63
void SetMinCentrality(Float_t minCentrality=0.)
Definition: AliRDHFCuts.h:52
float Float_t
Definition: External.C:68
void SetDoImpactParameterHistos(Bool_t doImp=kTRUE)
impact par study
const Bool_t doImp
const Bool_t anaType
void SetMaxCentrality(Float_t maxCentrality=100.)
Definition: AliRDHFCuts.h:53
const Bool_t theRareOn
void SetAnalysisType(Int_t anaType)
set analysis type
void SetRareSearch(Bool_t theRareOn)
set rare mesons
AliAnalysisTaskSEDStarSpectra * AddTaskDStarSpectra(Int_t system=0, Float_t minC=0, Float_t maxC=100, TString cutsfile="", TString usercomment="username", Bool_t theMCon=kFALSE, Bool_t doDStarVsY=kFALSE)
bool Bool_t
Definition: External.C:53