AliPhysics  1168478 (1168478)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AddTaskDstoK0sK.C
Go to the documentation of this file.
1 #include <algorithm>
2 
3 
5  Bool_t fReadMC,
6  Bool_t fFillNtuple,
7  Bool_t fUseSelectionBit,
8  Int_t AODProtection = 0,
9  TString suffixName = "")
10 {
11  //
12  // AddTask for the AliAnalysisTaskSE for the D+ full resolution:
13  // loop on V0s and bachelors, then on-the-fly D+ reconstruction and analysis
14  // Authors: J.Hamon, julien.hamon@cern.ch
15  //
16 
17 
18  // Get the pointer to the existing analysis manager via the static access method.
19  //==============================================================================
20  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
21  if (!mgr) {
22  ::Error("AddTaskResolutionK0sReco", "No analysis manager to connect to.");
23  return NULL;
24  }
25 
26 
27 
28  // Create the analysis cuts.
29  //==============================================================================
30  TFile *filecuts = new TFile(cutFileName.Data());
31  if (!filecuts || (filecuts && !(filecuts->IsOpen())))
32  AliFatal("Cut object not found: analysis will not start!\n");
33 
34  AliRDHFCutsDstoK0sK* analysiscuts = new AliRDHFCutsDstoK0sK();
35  analysiscuts = (AliRDHFCutsDstoK0sK*) filecuts->Get("AnalysisCuts");
36 
37 
38 
39  // Create the analysis task.
40  //==============================================================================
41  const Int_t nCutsTuple = 34;
42  Float_t minCutsTuple[nCutsTuple]={0.}; std::fill_n(minCutsTuple, nCutsTuple, -1000.);
43  Float_t maxCutsTuple[nCutsTuple]={0.}; std::fill_n(maxCutsTuple, nCutsTuple, 1000.);
44  if (fFillNtuple) {
45  Float_t massK0 = TDatabasePDG::Instance()->GetParticle(310)->Mass();
46  Float_t massDs = TDatabasePDG::Instance()->GetParticle(431)->Mass();
47  Float_t massDp = TDatabasePDG::Instance()->GetParticle(411)->Mass();
48 
49  minCutsTuple[ 0] = massK0-0.05; maxCutsTuple[ 0] = massK0+0.05; // "K0sInvMass"
50  minCutsTuple[ 1] = 0.; maxCutsTuple[ 1] = 40.; // "K0sPt"
51  minCutsTuple[ 2] = 0.; maxCutsTuple[ 2] = 140.; // "K0sRxy"
52  minCutsTuple[ 3] = 0.; maxCutsTuple[ 3] = 20.; // "K0sCTau"
53  minCutsTuple[ 4] = 0.99; maxCutsTuple[ 4] = 1.; // "K0sCosPA"
54  minCutsTuple[ 5] = 0.; maxCutsTuple[ 5] = 1000.; // "K0sd0"
55  minCutsTuple[ 6] = -40.; maxCutsTuple[ 6] = 40.; // "K0sd0DauPos"
56  minCutsTuple[ 7] = -40.; maxCutsTuple[ 7] = 40.; // "K0sd0DauNeg"
57  minCutsTuple[ 8] = 0.; maxCutsTuple[ 8] = 3.; // "K0sDCAdau"
58  minCutsTuple[ 9] = 0.1; maxCutsTuple[ 9] = 40.; // "K0sPtDauPos"
59  minCutsTuple[10] = 0.1; maxCutsTuple[10] = 40.; // "K0sPtDauNeg"
60  minCutsTuple[11] = 0.3; maxCutsTuple[11] = 40.; // "BachPt"
61  minCutsTuple[12] = -3.; maxCutsTuple[12] = 3.; // "Bachd0"
62  minCutsTuple[13] = -1000.; maxCutsTuple[13] = 1000.; // "BachNsigmaTPCpion"
63  minCutsTuple[14] = -1000.; maxCutsTuple[14] = 1000.; // "BachNsigmaTPCkaon"
64  minCutsTuple[15] = -1000.; maxCutsTuple[15] = 1000.; // "BachNsigmaTPCproton"
65  minCutsTuple[16] = -1000.; maxCutsTuple[16] = 1000.; // "BachNsigmaTOFpion"
66  minCutsTuple[17] = -1000.; maxCutsTuple[17] = 1000.; // "BachNsigmaTOFkaon"
67  minCutsTuple[18] = -1000.; maxCutsTuple[18] = 1000.; // "BachNsigmaTOFproton"
68  minCutsTuple[19] = massDs-0.2; maxCutsTuple[19] = massDs+0.2; // "CanInvMassDs"
69  minCutsTuple[20] = massDp-0.2; maxCutsTuple[20] = massDp+0.2; // "CanInvMassDplus"
70  minCutsTuple[21] = 1.; maxCutsTuple[21] = 24.; // "CanPt"
71  minCutsTuple[22] = 0.; maxCutsTuple[22] = 8.; // "CanDCAProngToProng"
72  minCutsTuple[23] = -1.; maxCutsTuple[23] = 1.; // "CanCosThetaStarK0s"
73  minCutsTuple[24] = -1.; maxCutsTuple[24] = 1.; // "CanCosThetaStarBach"
74  minCutsTuple[25] = 0.; maxCutsTuple[25] = 1.; // "CanCosPA"
75  minCutsTuple[26] = -1.; maxCutsTuple[26] = 1.; // "CanCosPAxy"
76  minCutsTuple[27] = 0.; maxCutsTuple[27] = 3.; // "CanDLengthXY"
77  minCutsTuple[28] = 0.; maxCutsTuple[28] = 1000.; // "CanNormDLengthXY"
78  minCutsTuple[29] = 0.; maxCutsTuple[29] = 3.; // "CanDLength3D"
79  minCutsTuple[30] = 0.; maxCutsTuple[30] = 1000.; // "CanNormDLength3D"
80  minCutsTuple[31] = 0.; maxCutsTuple[31] = 1000.; // "CanSigmaVtx"
81  minCutsTuple[32] = -1000.; maxCutsTuple[32] = 1000.; // "CanNormTopoBach"
82  minCutsTuple[33] = -1000.; maxCutsTuple[33] = 1000.; // "CanNormTopoK0s"
83  }
84 
85 
86  AliAnalysisTaskSEDstoK0sK *task = new AliAnalysisTaskSEDstoK0sK("AnalysisDs", analysiscuts, fReadMC, fFillNtuple, nCutsTuple, minCutsTuple, maxCutsTuple);
87  if (!task)
88  AliFatal("Analysis task AliAnalysisTaskSEDstoK0sK not found (NULL pointer)");
89  task->SetAODMismatchProtection(AODProtection);
90  task->SetUseSelectionBit(fUseSelectionBit);
91  mgr->AddTask(task);
92 
93 
94 
95  // Create the input/output containers.
96  //==============================================================================
97  mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
98 
99 
100  // Output slots #0 already used by the base class
101  TString commonOutputName = AliAnalysisManager::GetCommonFileName();
102  commonOutputName += ":PWGHF_D2H_AnalysisDstoK0sK";
103  commonOutputName += suffixName;
104 
105 
106  AliAnalysisDataContainer *outputCuts = mgr->CreateContainer("AnalysisCuts", TList::Class(),
107  AliAnalysisManager::kOutputContainer, commonOutputName.Data());
108  mgr->ConnectOutput(task, 1, outputCuts);
109 
110  AliAnalysisDataContainer *outputNorm = mgr->CreateContainer("NormalisationCounter", AliNormalizationCounter::Class(),
111  AliAnalysisManager::kOutputContainer, commonOutputName.Data());
112  mgr->ConnectOutput(task, 2, outputNorm);
113 
114  AliAnalysisDataContainer *outputSele = mgr->CreateContainer("DstoK0sSelections", TList::Class(),
115  AliAnalysisManager::kOutputContainer, commonOutputName.Data());
116  mgr->ConnectOutput(task, 3, outputSele);
117 
118 
119  if (!fFillNtuple) {
120  AliAnalysisDataContainer *outputCand = mgr->CreateContainer("DstoK0sVariablesCandidates", TList::Class(),
121  AliAnalysisManager::kOutputContainer, commonOutputName.Data());
122  mgr->ConnectOutput(task, 4, outputCand);
123 
124  AliAnalysisDataContainer *outputPIDs = mgr->CreateContainer("DstoK0sVariablesPID", TList::Class(),
125  AliAnalysisManager::kOutputContainer, commonOutputName.Data());
126  mgr->ConnectOutput(task, 5, outputPIDs);
127 
128  if (fReadMC) {
129  AliAnalysisDataContainer *outputMC = mgr->CreateContainer("DstoK0sMonteCarlo", TList::Class(),
130  AliAnalysisManager::kOutputContainer, commonOutputName.Data());
131  mgr->ConnectOutput(task, 6, outputMC);
132  }
133  } else {
134  AliAnalysisDataContainer *outputTupl = mgr->CreateContainer("DstoK0sKTuple", TNtuple::Class(),
135  AliAnalysisManager::kOutputContainer, commonOutputName.Data());
136  mgr->ConnectOutput(task, 4, outputTupl);
137  }
138 
139 
140  return task;
141 }
int Int_t
Definition: External.C:63
float Float_t
Definition: External.C:68
Class for cuts on AOD reconstructed Ds->K0S+K.
AliAnalysisTaskSE to produce Ds->K0S+K invariant mass spectra and THnSparse for cut optimisations...
AliAnalysisTaskSEDstoK0sK * AddTaskDstoK0sK(TString cutFileName, Bool_t fReadMC, Bool_t fFillNtuple, Bool_t fUseSelectionBit, Int_t AODProtection=0, TString suffixName="")
bool Bool_t
Definition: External.C:53