AliPhysics  63e47e1 (63e47e1)
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;
31  filecuts = TFile::Open(cutFileName.Data());
32  if (!filecuts || (filecuts && !(filecuts->IsOpen())))
33  AliFatal("Cut object not found: analysis will not start!\n");
34 
35  AliRDHFCutsDstoK0sK* analysiscuts = new AliRDHFCutsDstoK0sK();
36  analysiscuts = (AliRDHFCutsDstoK0sK*) filecuts->Get("AnalysisCuts");
37 
38 
39 
40  // Create the analysis task.
41  //==============================================================================
42  const Int_t nCutsTuple = 28;
43  Float_t minCutsTuple[nCutsTuple]={0.}; std::fill_n(minCutsTuple, nCutsTuple, -1000.);
44  Float_t maxCutsTuple[nCutsTuple]={0.}; std::fill_n(maxCutsTuple, nCutsTuple, 1000.);
45  if (fFillNtuple) {
46  Float_t massK0 = TDatabasePDG::Instance()->GetParticle(310)->Mass();
47  Float_t massDs = TDatabasePDG::Instance()->GetParticle(431)->Mass();
48  Float_t massDp = TDatabasePDG::Instance()->GetParticle(411)->Mass();
49 
50  minCutsTuple[ 0] = massK0-0.05; maxCutsTuple[ 0] = massK0+0.05; // "K0sInvMass"
51  minCutsTuple[ 1] = 0.; maxCutsTuple[ 1] = 40.; // "K0sPt"
52  minCutsTuple[ 2] = 0.; maxCutsTuple[ 2] = 140.; // "K0sRxy"
53  minCutsTuple[ 3] = 0.; maxCutsTuple[ 3] = 20.; // "K0sCTau"
54  minCutsTuple[ 4] = 0.99; maxCutsTuple[ 4] = 1.; // "K0sCosPA"
55  minCutsTuple[ 5] = 0.; maxCutsTuple[ 5] = 1000.; // "K0sd0"
56  minCutsTuple[ 6] = -40.; maxCutsTuple[ 6] = 40.; // "K0sd0DauPos"
57  minCutsTuple[ 7] = -40.; maxCutsTuple[ 7] = 40.; // "K0sd0DauNeg"
58  minCutsTuple[ 8] = 0.; maxCutsTuple[ 8] = 3.; // "K0sDCAdau"
59  minCutsTuple[ 9] = 0.1; maxCutsTuple[ 9] = 40.; // "K0sPtDauPos"
60  minCutsTuple[10] = 0.1; maxCutsTuple[10] = 40.; // "K0sPtDauNeg"
61  minCutsTuple[11] = 0.3; maxCutsTuple[11] = 40.; // "BachPt"
62  minCutsTuple[12] = -3.; maxCutsTuple[12] = 3.; // "Bachd0"
63  minCutsTuple[13] = massDs-0.2; maxCutsTuple[13] = massDs+0.2; // "CanInvMassDs"
64  minCutsTuple[14] = massDp-0.2; maxCutsTuple[14] = massDp+0.2; // "CanInvMassDplus"
65  minCutsTuple[15] = 1.; maxCutsTuple[15] = 24.; // "CanPt"
66  minCutsTuple[16] = 0.; maxCutsTuple[16] = 8.; // "CanDCAProngToProng"
67  minCutsTuple[17] = -1.; maxCutsTuple[17] = 1.; // "CanCosThetaStarK0s"
68  minCutsTuple[18] = -1.; maxCutsTuple[18] = 1.; // "CanCosThetaStarBach"
69  minCutsTuple[19] = 0.; maxCutsTuple[19] = 1.; // "CanCosPA"
70  minCutsTuple[20] = -1.; maxCutsTuple[20] = 1.; // "CanCosPAxy"
71  minCutsTuple[21] = 0.; maxCutsTuple[21] = 3.; // "CanDLengthXY"
72  minCutsTuple[22] = 0.; maxCutsTuple[22] = 1000.; // "CanNormDLengthXY"
73  minCutsTuple[23] = 0.; maxCutsTuple[23] = 3.; // "CanDLength3D"
74  minCutsTuple[24] = 0.; maxCutsTuple[24] = 1000.; // "CanNormDLength3D"
75  minCutsTuple[25] = 0.; maxCutsTuple[25] = 1000.; // "CanSigmaVtx"
76  minCutsTuple[26] = -1000.; maxCutsTuple[26] = 1000.; // "CanNormTopoBach"
77  minCutsTuple[27] = -1000.; maxCutsTuple[27] = 1000.; // "CanNormTopoK0s"
78  }
79 
80 
81  AliAnalysisTaskSEDstoK0sK *task = new AliAnalysisTaskSEDstoK0sK("AnalysisDs", analysiscuts, fReadMC, fFillNtuple, nCutsTuple, minCutsTuple, maxCutsTuple);
82  if (!task)
83  AliFatal("Analysis task AliAnalysisTaskSEDstoK0sK not found (NULL pointer)");
84  task->SetAODMismatchProtection(AODProtection);
85  task->SetUseSelectionBit(fUseSelectionBit);
86  mgr->AddTask(task);
87 
88 
89 
90  // Create the input/output containers.
91  //==============================================================================
92  mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
93 
94 
95  // Output slots #0 already used by the base class
96  TString commonOutputName = AliAnalysisManager::GetCommonFileName();
97  commonOutputName += ":PWGHF_D2H_AnalysisDstoK0sK";
98  commonOutputName += suffixName;
99 
100 
101  AliAnalysisDataContainer *outputCuts = mgr->CreateContainer("AnalysisCuts", TList::Class(),
102  AliAnalysisManager::kOutputContainer, commonOutputName.Data());
103  mgr->ConnectOutput(task, 1, outputCuts);
104 
105  AliAnalysisDataContainer *outputNorm = mgr->CreateContainer("NormalisationCounter", AliNormalizationCounter::Class(),
106  AliAnalysisManager::kOutputContainer, commonOutputName.Data());
107  mgr->ConnectOutput(task, 2, outputNorm);
108 
109  AliAnalysisDataContainer *outputSele = mgr->CreateContainer("DstoK0sSelections", TList::Class(),
110  AliAnalysisManager::kOutputContainer, commonOutputName.Data());
111  mgr->ConnectOutput(task, 3, outputSele);
112 
113 
114  if (!fFillNtuple) {
115  AliAnalysisDataContainer *outputCand = mgr->CreateContainer("DstoK0sVariablesCandidates", TList::Class(),
116  AliAnalysisManager::kOutputContainer, commonOutputName.Data());
117  mgr->ConnectOutput(task, 4, outputCand);
118 
119  AliAnalysisDataContainer *outputPIDs = mgr->CreateContainer("DstoK0sVariablesPID", TList::Class(),
120  AliAnalysisManager::kOutputContainer, commonOutputName.Data());
121  mgr->ConnectOutput(task, 5, outputPIDs);
122 
123  if (fReadMC) {
124  AliAnalysisDataContainer *outputMC = mgr->CreateContainer("DstoK0sMonteCarlo", TList::Class(),
125  AliAnalysisManager::kOutputContainer, commonOutputName.Data());
126  mgr->ConnectOutput(task, 6, outputMC);
127  }
128  } else {
129  AliAnalysisDataContainer *outputTupl = mgr->CreateContainer("DstoK0sKTuple", TNtuple::Class(),
130  AliAnalysisManager::kOutputContainer, commonOutputName.Data());
131  mgr->ConnectOutput(task, 4, outputTupl);
132  }
133 
134 
135  return task;
136 }
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