]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/macros/train/RsnConfig.C
Update on config macro for analysis task
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / macros / train / RsnConfig.C
1 //
2 // This is an example macro for creation of a pair manager
3 // for a resonance analysis with the PWG2/RESONANCES package.
4 // Its output is an AliRsnPairManager which will be added to the task.
5 // It will contain:
6 // - signal (inv. mass)
7 // - true pairs (inv. mass)
8 // - like-sign (inv. mass)
9 // - true pairs (inv. mass, resolution)
10 // All histogram are done w.r. to Pt or Eta and w.r. to multiplicity.
11 // The binnings are hard-coded. Change them according to your preferences.
12 //
13 // Arguments:
14 // -- pairMgrName : a name for the pair manager which must contain
15 //                  some keywords to choose amond the available cuts
16 //                  and PID selection available here (this is a personal customization)
17 // -- resonancePDG: PDG code of resonance (for true pairs)
18 // -- type1, type2: particle species for track 1 and 2 in the pair (using AliPID enumeration)
19 //
20 // NOTE:
21 // the keyword available here are the following:
22 // -- "NOPID": completely no PID analysis (only primary track cuts are applied)
23 // -- "BB"   : all tracks are used, but the TPC Bethe-Bloch cut is applied (cut value = 0.2)
24 // -- "PID"  : realistic PID is used
25 //
26 AliRsnPairManager* RsnConfig
27 (
28   const char            *pairMgrName,    // name for the pair manager
29   Int_t                  resonancePDG,   // PDG code of resonance (for true pairs)
30   AliPID::EParticleType  type1,          // PID of one member of decay (+)
31   AliPID::EParticleType  type2           // PID of other member of decay (-)
32 )
33 {
34   // === NAME DEFINITIONS =========================================================================
35
36   AliRsnPairManager  *pairMgr  = new AliRsnPairManager(pairMgrName);
37
38   // examines the given name to define details about track selection and cuts
39   TString               str(pairMgrName);
40   AliRsnPair::EPairType pidType;
41   Bool_t                useBBCut;
42   if (str.Contains("NOPID"))
43   {
44     pidType  = AliRsnPair::kNoPID;
45     useBBCut = kFALSE;
46     Info("RsnConfig", "PID TYPE = No PID        -- BB CUT: not used");
47   }
48   else if (str.Contains("BB"))
49   {
50     pidType  = AliRsnPair::kNoPID;
51     useBBCut = kTRUE;
52     Info("RsnConfig", "PID TYPE = No PID        -- BB CUT: used");
53   }
54   else if (str.Contains("PID"))
55   {
56     pidType  = AliRsnPair::kRealisticPID;
57     useBBCut = kFALSE;
58     Info("RsnConfig", "PID TYPE = Realistic PID -- BB CUT: not used");
59   }
60   else
61   {
62     Error("RsnConfig", "Unrecognized keywords in the name. Can't continue");
63     return 0x0;
64   }
65
66   // === PAIR DEFINITIONS =========================================================================
67
68   // if particle #1 and #2 are different, two histograms must be built
69   // for each scheme (signal, true, mixed, like-sign) exchanging both particles and signs
70   Int_t i, j, nArray = 1;
71   if (type1 != type2) nArray = 2;
72
73   AliRsnPairDef *defUnlike[2] = {0, 0};
74   AliRsnPairDef *defLikePP[2] = {0, 0};
75   AliRsnPairDef *defLikeMM[2] = {0, 0};
76
77   defUnlike[0] = new AliRsnPairDef(type1, '+', type2, '-', resonancePDG);
78   defLikePP[0] = new AliRsnPairDef(type1, '+', type2, '+', resonancePDG);
79   defLikeMM[0] = new AliRsnPairDef(type1, '-', type2, '-', resonancePDG);
80
81   defUnlike[1] = new AliRsnPairDef(type2, '+', type1, '-', resonancePDG);
82   defLikePP[1] = new AliRsnPairDef(type2, '+', type1, '+', resonancePDG);
83   defLikeMM[1] = new AliRsnPairDef(type2, '-', type1, '-', resonancePDG);
84
85   // === PAIR ANALYSIS ENGINES ====================================================================
86
87   // define null (dummy) objects and initialize only the ones which are needed,
88   // depending again on particle types;
89   // array is organized as follows:
90   // [0] - true pairs
91   // [1] - signal
92   // [2] - like PP
93   // [3] - like MM
94   AliRsnPair *pair[2][4] = {0,0,0,0,0,0,0,0};
95
96   for (i = 0; i < nArray; i++) {
97     pair[i][0] = new AliRsnPair(pidType, defUnlike[i]);
98     pair[i][1] = new AliRsnPair(pidType, defUnlike[i]);
99     pair[i][2] = new AliRsnPair(pidType, defLikePP[i]);
100     pair[i][3] = new AliRsnPair(pidType, defLikeMM[i]);
101   }
102
103   // === CUTS =====================================================================================
104
105   // cuts for tracks:
106   // -- primary track quality
107   AliRsnCutESDPrimary *cutESDPrimary = new AliRsnCutESDPrimary("cutESDPrimary");
108   cutESDPrimary->GetCuts()->SetMaxCovDiagonalElements(2.0, 2.0, 0.5, 0.5, 2.0);
109   cutESDPrimary->GetCuts()->SetRequireSigmaToVertex(kTRUE);
110   cutESDPrimary->GetCuts()->SetMaxNsigmaToVertex(3.0);
111   cutESDPrimary->GetCuts()->SetRequireTPCRefit(kTRUE);
112   cutESDPrimary->GetCuts()->SetAcceptKinkDaughters(kFALSE);
113   cutESDPrimary->GetCuts()->SetMinNClustersTPC(50);
114   cutESDPrimary->GetCuts()->SetMaxChi2PerClusterTPC(3.5);
115   // -- Bethe-Bloch with kaon mass hypothesis
116   Double_t sigmaTPC = 0.065;
117   AliRsnCutBetheBloch *cutKaonBB = new AliRsnCutBetheBloch("cutKaonBB", 3.0 * sigmaTPC, AliPID::kKaon);
118   cutKaonBB->SetCalibConstant(0, 0.76176e-1);
119   cutKaonBB->SetCalibConstant(1, 10.632);
120   cutKaonBB->SetCalibConstant(2, 0.13279e-4);
121   cutKaonBB->SetCalibConstant(3, 1.8631);
122   cutKaonBB->SetCalibConstant(4, 1.9479);
123
124   // cuts on pairs:
125   // -- true daughters of a phi resonance (only for true pairs histogram)cutSetPairTrue->AddCut(cutTrue);
126   AliRsnCutStd *cutTruePair = new AliRsnCutStd("cutTrue", AliRsnCutStd::kTruePair, resonancePDG);
127
128   // cuts on event:
129   // -- none (specified for whole task)
130
131   // cut set definition for all pairs
132   AliRsnCutSet *cutSetParticle = new AliRsnCutSet("trackCuts");
133   cutSetParticle->AddCut(cutESDPrimary);
134   if (useBBCut)
135   {
136     cutSetParticle->AddCut(cutKaonBB);
137     cutSetParticle->SetCutScheme("cutKaonBB&cutESDPrimary");
138   }
139   else {
140     cutSetParticle->SetCutScheme("cutESDPrimary");
141   }
142
143   // cut set definition for true pairs
144   AliRsnCutSet *cutSetPairTrue = new AliRsnCutSet("truePairs");
145   cutSetPairTrue->AddCut(cutTruePair);
146   cutSetPairTrue->SetCutScheme("cutTrue");
147
148   // cut manager for all pairs
149   AliRsnCutMgr *cutMgrAll = new AliRsnCutMgr("std", "All");
150   cutMgrAll->SetCutSet(AliRsnCut::kParticle, cutSetParticle);
151
152   // cut manager for all pairs
153   AliRsnCutMgr *cutMgrTrue = new AliRsnCutMgr("true", "True");
154   cutMgrTrue->SetCutSet(AliRsnCut::kParticle, cutSetParticle);
155   cutMgrTrue->SetCutSet(AliRsnCut::kPair, cutSetPairTrue);
156
157   for (i = 0; i < nArray; i++) {
158     pair[i][0]->SetCutMgr(cutMgrTrue);
159     pair[i][0]->SetOnlyTrue();
160     for (j = 1; j < 4; j++) {
161       pair[i][j]->SetCutMgr(cutMgrAll);
162     }
163   }
164
165   // === FUNCTIONS ================================================================================
166
167   // define all binnings
168   AliRsnFunctionAxis *axisIM   = new AliRsnFunctionAxis(AliRsnFunctionAxis::kPairInvMass,    1000,  0.0,   2.0);
169   AliRsnFunctionAxis *axisPt   = new AliRsnFunctionAxis(AliRsnFunctionAxis::kPairPt,           50,  0.0,  10.0);
170   AliRsnFunctionAxis *axisEta  = new AliRsnFunctionAxis(AliRsnFunctionAxis::kPairEta,          15, -1.5,   1.5);
171   AliRsnFunctionAxis *axisMult = new AliRsnFunctionAxis(AliRsnFunctionAxis::kEventMult,         8,  0.0, 200.0);
172
173   AliRsnFunction *fcn = new AliRsnFunction;
174   fcn->AddAxis(axisIM);
175   fcn->AddAxis(axisPt);
176   fcn->AddAxis(axisEta);
177   fcn->AddAxis(axisMult);
178
179   // add functions to pairs
180   for (i = 0; i < nArray; i++) {
181     for (j = 0; j < 4; j++) {
182       pair[i][j]->AddFunction(fcn);
183     }
184   }
185
186   // === ADD TO PAIR MANAGER ======================================================================
187
188   for (i = 0; i < nArray; i++) {
189     for (j = 0; j < 4; j++) {
190       pairMgr->AddPair(pair[i][j]);
191     }
192   }
193
194   return pairMgr;
195 }