AliPhysics  9fe175b (9fe175b)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AddTaskDStarCharmFraction.C
Go to the documentation of this file.
1 AliAnalysisTaskSEDStarCharmFraction *AddTaskDStarCharmFraction(TString cutsFileName, Bool_t readMC = kFALSE, TString suffix = "", Double_t peakSigmaCut = 3., Double_t sidebandSigmaCut = 6., Double_t sidebandSigmaWidth = 9., Bool_t singleSideband = kFALSE, Double_t impParMin = 0., TString fileOut = "AnalysisResults.root") {
2  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
3  if (!mgr) {
4  AliFatal("No analysis manager to connect to");
5  return NULL;
6  }
7 
8  Bool_t standardCuts = kFALSE;
9 
10  TFile *cutsFile;
11  if (cutsFileName.EqualTo("")) {
12  standardCuts = kTRUE;
13  }
14  else {
15  cutsFile = TFile::Open(cutsFileName.Data());
16  if (!cutsFile || (cutsFile && !cutsFile->IsOpen())) {
17  AliFatal("Input cut file not found");
18  return NULL;
19  }
20  }
21 
22 
24  if (standardCuts) {
25  cuts = new AliRDHFCutsDStartoKpipi();
26  cuts->SetStandardCutsPP2010();
27  }
28  else {
29  cuts = (AliRDHFCutsDStartoKpipi*) cutsFile->Get("DStartoKpipiCuts");
30  }
31  cuts->SetName("DStartoKpipiCuts");
32 
33  if (!cuts) {
34  AliFatal("Cut object not found");
35  return NULL;
36  }
37 
38  printf("CREATE TASK\n");
39 
40  AliAnalysisTaskSEDStarCharmFraction *task = new AliAnalysisTaskSEDStarCharmFraction("AliAnalysisTaskSEDStarSpectra", cuts);
41  task->SetReadMC(readMC);
42  task->SetSingleSideband(singleSideband);
43  task->SetImpParCut(impParMin);
44 
45  /* 1., 2., 3., 4., 5., 6., 7., 8., 10., 12., 16., 20., 24., 36. */
46  /* 1., 2., 3., 4., 5., 6., 7., 8., 12., 16., 24. */
47 
48  /*
49  1- 2: 0.000701202
50  2- 3: 0.000630536
51  3- 4: 0.000558947
52  4- 5: 0.000559443
53  5- 6: 0.000562800
54  6- 7: 0.000552661
55  7- 8: 0.000552661
56  8-10: 0.000578663
57  10-12: 0.000578663
58  12-16: 0.000650723
59  16-20: 0.000755267
60  20-24: 0.000755267
61  24-36: 0.000755267
62  */
63  // 1-2 2-3 3-4 4-5 5-6 6-7 7-8 8-10 10-12 12-16 16-20 20-24 24-36
64  Double_t sigmas[13] = {0.00070, 0.00063, 0.00056, 0.00056, 0.00056, 0.00055, 0.00055, 0.00058, 0.00058, 0.00065, 0.00076, 0.00076, 0.00076};
65  Double_t peakCuts[13];
66  Double_t sidebandCuts[13];
67  Double_t sidebandWindows[13];
68 
69  for (Int_t i=0;i<13;i++) {
70  peakCuts[i] = peakSigmaCut*sigmas[i];
71  sidebandCuts[i] = sidebandSigmaCut*sigmas[i]; //sideband selection starts at "sidebandSigmaCut" (default: 6) sigma from PDG mass
72  sidebandWindows[i] = sidebandSigmaWidth*sigmas[i]; //sideband selection has width of "sidebandSigmaWidth" (default: 9) sigma (so stops at sidebandSigmaCut+sidebandSigmaWidth sigma from PDG mass)
73 
74  cout << "peakCuts[" << i << "]=" << peakCuts[i] << endl;
75  }
76 
77  /*Double_t sigma = 0.0005;
78  task->SetPeakCut(3.*sigma);
79  task->SetSidebandCut(6.*sigma);
80  task->SetSidebandWindow(9.*sigma);*/
81 
82  task->SetPeakCut(peakCuts);
83  task->SetSidebandCut(sidebandCuts);
84  task->SetSidebandWindow(sidebandWindows);
85 
86  mgr->AddTask(task);
87 
88  AliAnalysisDataContainer *cInput = mgr->GetCommonInputContainer();
89  mgr->ConnectInput(task, 0, cInput);
90 
91  AliAnalysisDataContainer *cOutputNEvents = mgr->CreateContainer(Form("cNEvents%s", suffix.Data()), TH1D::Class(), AliAnalysisManager::kOutputContainer, fileOut.Data());
92  AliAnalysisDataContainer *cOutputListCandidate = mgr->CreateContainer(Form("cListCandidate%s", suffix.Data()), TList::Class(), AliAnalysisManager::kOutputContainer, fileOut.Data());
93  AliAnalysisDataContainer *cOutputListSignal = mgr->CreateContainer(Form("cListSignal%s", suffix.Data()), TList::Class(), AliAnalysisManager::kOutputContainer, fileOut.Data());
94  AliAnalysisDataContainer *cOutputListSignalPrompt = mgr->CreateContainer(Form("cListSignalPrompt%s", suffix.Data()), TList::Class(), AliAnalysisManager::kOutputContainer, fileOut.Data());
95  AliAnalysisDataContainer *cOutputListSignalFromB = mgr->CreateContainer(Form("cListSignalFromB%s", suffix.Data()), TList::Class(), AliAnalysisManager::kOutputContainer, fileOut.Data());
96  AliAnalysisDataContainer *cOutputListBackground = mgr->CreateContainer(Form("cListBackground%s", suffix.Data()), TList::Class(), AliAnalysisManager::kOutputContainer, fileOut.Data());
97  AliAnalysisDataContainer *cOutputCuts = mgr->CreateContainer(Form("cCuts%s", suffix.Data()), AliRDHFCutsDStartoKpipi::Class(), AliAnalysisManager::kOutputContainer, fileOut.Data());
98  AliAnalysisDataContainer *cOutputNormCount = mgr->CreateContainer(Form("cNormCount%s", suffix.Data()), AliNormalizationCounter::Class(), AliAnalysisManager::kOutputContainer, fileOut.Data());
99  AliAnalysisDataContainer *cOutputTreeCandidate = mgr->CreateContainer(Form("cTreeCandidate%s", suffix.Data()), TTree::Class(), AliAnalysisManager::kOutputContainer, fileOut.Data());
100 
101  mgr->ConnectOutput(task, 1, cOutputNEvents);
102  mgr->ConnectOutput(task, 2, cOutputListCandidate);
103  mgr->ConnectOutput(task, 3, cOutputListSignal);
104  mgr->ConnectOutput(task, 4, cOutputListSignalPrompt);
105  mgr->ConnectOutput(task, 5, cOutputListSignalFromB);
106  mgr->ConnectOutput(task, 6, cOutputListBackground);
107  mgr->ConnectOutput(task, 7, cOutputCuts);
108  mgr->ConnectOutput(task, 8, cOutputNormCount);
109  mgr->ConnectOutput(task, 9, cOutputTreeCandidate);
110 
111  return task;
112 }
Double_t sigmas[nPtBins]
void SetSingleSideband(Bool_t singleSideband=kTRUE)
AliAnalysisTaskSEDStarCharmFraction * AddTaskDStarCharmFraction(TString cutsFileName, Bool_t readMC=kFALSE, TString suffix="", Double_t peakSigmaCut=3., Double_t sidebandSigmaCut=6., Double_t sidebandSigmaWidth=9., Bool_t singleSideband=kFALSE, Double_t impParMin=0., TString fileOut="AnalysisResults.root")