Restored call to CreateDigitizer (F.Prino)
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / macros / test / ConfigTaskRsnTest.C
CommitLineData
2dab9030 1//
2// This function configures the entire task for all resonances the user is interested in.
3// This is done by creating all configuration objects which are defined in the package.
4//
5// Generally speaking, one has to define the following objects for each resonance:
6//
7// 1 - an AliRsnPairDef to define the resonance decay channel to be studied
8// 2 - an AliRsnPair{Ntuple|Functions} where the output is stored
9// 3 - one or more AliRsnCut objects to define track selections
10// which will have then to be organized into AliRsnCutSet objects
11// 4 - an AliRsnCutManager to include all cuts to be applied (see point 3)
12// 5 - definitions to build the TNtuple or histograms which are returned
13//
14// The return value is used to know if the configuration was successful
15//
16Bool_t RsnConfigTask(AliRsnAnalysisSE* &task, const char *dataLabel)
17{
18 // for safety, return if no task is passed
19 if (!task)
20 {
21 Error("ConfigTaskRsn", "Task not found");
22 return kFALSE;
23 }
24
25 // interpret the useful information from second argument
26 TString strDataLabel(dataLabel);
0d73200d 27 Bool_t isESD = strDataLabel.Contains("ESD");
28 Bool_t isAOD = strDataLabel.Contains("AOD");
29 Bool_t isSim = strDataLabel.Contains("sim");
30 Bool_t isData = strDataLabel.Contains("data");
31 Bool_t isPass1 = strDataLabel.Contains("pass1");
32 Bool_t isPass2 = strDataLabel.Contains("pass2");
2dab9030 33
34 //
35 // -- Set cuts for events (applied to all analyses) -----------------------------------------------
36 //
37
38 // primary vertex range
0d73200d 39 AliRsnCutPrimaryVertex *cutVertex = new AliRsnCutPrimaryVertex("cutVertex", 10.0, 0, kFALSE);
2dab9030 40 AliRsnCutSet *cutSetEvent = new AliRsnCutSet("eventCuts", AliRsnCut::kEvent);
10a049e7 41 //cutSetEvent->AddCut(cutVertex);
42 //cutSetEvent->SetCutScheme("cutVertex");
43 //task->SetEventCuts(cutSetEvent);
2dab9030 44
45 //
46 // -- Setup pairs ---------------------------------------------------------------------------------
47 //
48
49 // decay channels
0d73200d 50 AliRsnPairDef *pairDefpm = new AliRsnPairDef(AliPID::kKaon, '+', AliPID::kKaon, '-', 333, 1.019455);
2dab9030 51
52 // computation objects
0d73200d 53 AliRsnPairFunctions *pairPMhist = new AliRsnPairFunctions("pairPMHist", pairDefpm);
0d73200d 54 AliRsnPairNtuple *pairPMntp = new AliRsnPairNtuple ("pairPMNtp" , pairDefpm);
2dab9030 55
56 //
57 // -- Setup cuts ----------------------------------------------------------------------------------
58 //
59
60 // -- track cut --
61 // --> global cuts for 2010 analysis
62 AliRsnCutESD2010 *cuts2010 = new AliRsnCutESD2010("cuts2010");
63 // ----> set the flag for sim/data management
64 cuts2010->SetMC(isSim);
65 // ----> require to check PID
51919bc4 66 cuts2010->SetCheckITS(kFALSE);
67 cuts2010->SetCheckTPC(kFALSE);
68 cuts2010->SetCheckTOF(kFALSE);
2dab9030 69 // ----> set TPC ranges and calibration
70 cuts2010->SetTPCrange(5.0, 3.0);
71 cuts2010->SetTPCpLimit(0.35);
72 cuts2010->SetITSband(4.0);
0d73200d 73 if (isSim) cuts2010->SetTPCpar(2.15898 / 50.0, 1.75295E1, 3.40030E-9, 1.96178, 3.91720);
74 else cuts2010->SetTPCpar(1.41543 / 50.0, 2.63394E1, 5.0411E-11, 2.12543, 4.88663);
2dab9030 75 // ----> set standard quality cuts for TPC global tracks
0d73200d 76 //cuts2010->GetCutsTPC()->SetRequireTPCStandAlone(kTRUE); // require to have the projection at inner TPC wall
2dab9030 77 cuts2010->GetCutsTPC()->SetMinNClustersTPC(70);
78 cuts2010->GetCutsTPC()->SetMaxChi2PerClusterTPC(4);
79 cuts2010->GetCutsTPC()->SetAcceptKinkDaughters(kFALSE);
80 cuts2010->GetCutsTPC()->SetRequireTPCRefit(kTRUE);
81 cuts2010->GetCutsTPC()->SetRequireITSRefit(kTRUE);
82 cuts2010->GetCutsTPC()->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
83 cuts2010->GetCutsTPC()->SetMaxDCAToVertexXYPtDep("0.0350+0.0420/pt^0.9"); // DCA pt dependent: 7*(0.0050+0.0060/pt0.9)
84 cuts2010->GetCutsTPC()->SetMaxDCAToVertexZ(1e6); // disabled
85 cuts2010->GetCutsTPC()->SetDCAToVertex2D(kFALSE); // each DCA is checked separately
86 cuts2010->GetCutsTPC()->SetRequireSigmaToVertex(kFALSE);
87 // ----> set standard quality cuts for ITS standalone tracks
96e9d35d 88 cuts2010->GetCutsITS()->SetRequireITSStandAlone(kTRUE);
2dab9030 89 cuts2010->GetCutsITS()->SetRequireITSRefit(kTRUE);
90 cuts2010->GetCutsITS()->SetMinNClustersITS(4);
91 cuts2010->GetCutsITS()->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
92 cuts2010->GetCutsITS()->SetMaxChi2PerClusterITS(1.);
93 cuts2010->GetCutsITS()->SetMaxDCAToVertexXYPtDep("0.0595+0.0182/pt^1.55"); // DCA pt dependent
94 cuts2010->GetCutsITS()->SetMaxDCAToVertexZ(1e6); // disabled
95 cuts2010->GetCutsITS()->SetDCAToVertex2D(kFALSE); // each DCA is checked separately
2dab9030 96 // ----> set the configuration for TOF PID checks
97 if (isData && (isPass1 || isPass2))
98 {
99 cuts2010->SetTOFcalibrateESD(kTRUE);
100 //if (isPass2) cuts2010->SetTOFcalibrateESD(kFALSE); // potrebbe anche essere kFALSE
101 cuts2010->SetTOFcorrectTExp(kTRUE);
102 cuts2010->SetTOFuseT0(kTRUE);
103 cuts2010->SetTOFtuneMC(kFALSE);
104 cuts2010->SetTOFresolution(100.0);
105 }
106 else if (isSim)
107 {
108 cuts2010->SetTOFcalibrateESD(kFALSE);
109 cuts2010->SetTOFcorrectTExp(kTRUE);
110 cuts2010->SetTOFuseT0(kTRUE);
111 cuts2010->SetTOFtuneMC(kTRUE);
112 cuts2010->SetTOFresolution(100.0);
113 }
2dab9030 114
51919bc4 115 // -- tracks --> PID
116 AliRsnCutPID *cutPID = new AliRsnCutPID("cutPID", AliPID::kKaon, 0.0, kTRUE);
2dab9030 117
2dab9030 118 // cut sets
119 AliRsnCutSet *cutSetDaughterCommon = new AliRsnCutSet("commonDaughterCuts", AliRsnCut::kDaughter);
2dab9030 120
121 // --> add related cuts
45bb0283 122 cutSetDaughterCommon->AddCut(cuts2010);
123 //cutSetDaughterCommon->AddCut(cutPID);
51919bc4 124
2dab9030 125 // --> define schemes
45bb0283 126 cutSetDaughterCommon->SetCutScheme("cuts2010");
2dab9030 127
128 // cut managers
129 // define a proper name for each mult bin, to avoid omonyme output histos
10a049e7 130 pairPMhist->GetCutManager()->SetCommonDaughterCuts(cutSetDaughterCommon);
131 pairPMntp ->GetCutManager()->SetCommonDaughterCuts(cutSetDaughterCommon);
2dab9030 132
133 // function axes
b2b08ca2 134 Double_t ybins[] = {-0.8, -0.7, -0.6, -0.5, 0.5, 0.6, 0.7, 0.8};
45bb0283 135 AliRsnValue *axisIM = new AliRsnValue("IM" , AliRsnValue::kPairInvMass, 50, 0.9, 1.4);
136 AliRsnValue *axisPt = new AliRsnValue("PT" , AliRsnValue::kPairPt, 0.0, 20.0, 0.1);
137 AliRsnValue *axisY = new AliRsnValue("Y" , AliRsnValue::kPairY, sizeof(ybins)/sizeof(ybins[0]), ybins);
138 AliRsnValue *axisQinv = new AliRsnValue("QInv", AliRsnValue::kQInv, 100, 0.0, 10.0);
139 AliRsnValueMult *axisMult = new AliRsnValue("Mult", AliRsnValueMult::kESDcuts, 100, 0.0, 100.0);
2dab9030 140
51919bc4 141 // functions for TH1-like output
2dab9030 142 AliRsnFunction *fcnPt = new AliRsnFunction;
2dab9030 143 // --> add axes
2dab9030 144 fcnPt ->AddAxis(axisIM);
45bb0283 145 //fcnPt ->AddAxis(axisPt);
146 //fcnPt ->AddAxis(axisY);
147 //fcnPt ->AddAxis(axisQinv);
148 //fcnPt ->AddAxis(axisMult);
2dab9030 149
51919bc4 150 // add functions to TH1-like output
2dab9030 151 pairPMhist->AddFunction(fcnPt);
10a049e7 152 //pairPMhist->SetOnlyTrue();
2dab9030 153
51919bc4 154 // add values to TNtuple-like output
155 pairPMntp->AddValue(axisIM);
156 pairPMntp->AddValue(axisPt);
2467e7c3 157 pairPMntp->AddValue(axisY);
158 pairPMntp->AddValue(axisQinv);
45bb0283 159 pairPMntp->AddValue(axisMult);
51919bc4 160
161 // add everything to analysis manager
6256671b 162 task->GetAnalysisManager()->Add(pairPMhist);
2467e7c3 163 task->GetAnalysisManager()->Add(pairPMntp);
2dab9030 164
165 return kTRUE;
166}