Improved quitting Event Display with close button.
[u/mrichter/AliRoot.git] / TRD / AliTRDrecoParam.cxx
CommitLineData
e4f2f73d 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16/* $Id$ */
17
18///////////////////////////////////////////////////////////////////////////////
19// //
20// Parameter class for the TRD reconstruction //
21// //
22// Authors: //
23// Alex Bercuci <A.Bercuci@gsi.de> //
24// Markus Fasel <M.Fasel@gsi.de> //
25// //
26///////////////////////////////////////////////////////////////////////////////
27
8df1f8f5 28#include "AliLog.h"
29
e4f2f73d 30#include "AliTRDrecoParam.h"
31
32ClassImp(AliTRDrecoParam)
33
a2fbb6ec 34
e4f2f73d 35//______________________________________________________________
36AliTRDrecoParam::AliTRDrecoParam()
37 :AliDetectorRecoParam()
8ae98148 38 ,fkdNchdy(12.)
91834b8d 39 ,fkMaxTheta(1.0)
40 ,fkMaxPhi(2.0)
e4f2f73d 41 ,fkRoad0y(6.0)
42 ,fkRoad0z(8.5)
43 ,fkRoad1y(2.0)
44 ,fkRoad1z(20.0)
45 ,fkRoad2y(3.0)
46 ,fkRoad2z(20.0)
b06a50a5 47 ,fkPtThreshold(2.0)
e4f2f73d 48 ,fkPlaneQualityThreshold(5.0)// 4.2? under Investigation
566bf887 49 ,fkRoadzMultiplicator(1.5)
e4f2f73d 50 ,fkFindable(.333)
eb38ed55 51 ,fkChi2Z(30./*14.*//*12.5*/)
e4f2f73d 52 ,fkChi2Y(.25)
5a2e200c 53 ,fkChi2YSlope(7.73)
54 ,fkChi2ZSlope(0.069)
39d9c03c 55 ,fChi2Cut(25)
8c499dbf 56 ,fkChi2YCut(0.5)
5a2e200c 57 ,fkPhiSlope(10.6)
8ae98148 58 ,fkNMeanClusters(20.)
59 ,fkNSigmaClusters(2.)
60 ,fkNClusterNoise(0.)
61 ,fkNMeanTracklets(5.5)
e4f2f73d 62 ,fkTrackLikelihood(-15.)
8c499dbf 63 ,fNumberOfConfigs(3)
a2fbb6ec 64 ,fFlags(0)
9dcc64cc 65 ,fRawStreamVersion("DEFAULT")
86a261ed 66 ,fdzdxXcrossFactor(0.)
df83a620 67 ,fMinMaxCutSigma(4.)
68 ,fMinLeftRightCutSigma(8.)
fc546d21 69 ,fClusMaxThresh(4.5)
70 ,fClusSigThresh(3.5)
56b32fd7 71 ,fTCnexp(1)
8c499dbf 72 ,fRecEveryNTB(1)
4e459a9d 73 ,fNumberOfPresamples(0)
74 ,fNumberOfPostsamples(0)
e4f2f73d 75{
76 //
77 // Default constructor
78 //
d937ad7a 79 fSysCovMatrix[0] = 0.; // y direction (1 cm)
80 fSysCovMatrix[1] = 0.; // z direction (1 cm)
3afdab72 81 fSysCovMatrix[2] = 0.; // snp
82 fSysCovMatrix[3] = 0.; // tgl
83 fSysCovMatrix[4] = 0.; // 1/pt
22a4ab0c 84
a2fbb6ec 85 // Xe tail cancellation parameters
86 fTCParams[0] = 1.156; // r1
87 fTCParams[1] = 0.130; // r2
88 fTCParams[2] = 0.114; // c1
89 fTCParams[3] = 0.624; // c2
90 // Ar tail cancellation parameters
91 fTCParams[4] = 6.; // r1
92 fTCParams[5] = 0.62; // r2
93 fTCParams[6] = 0.0087;// c1
94 fTCParams[7] = 0.07; // c2
95
22a4ab0c 96 memset(fPIDThreshold, 0, AliTRDCalPID::kNMom*sizeof(Double_t));
a2fbb6ec 97 memset(fStreamLevel, 0, kTRDreconstructionTasks * sizeof(Int_t));
98
9dcc64cc 99 SetPIDmethod(AliTRDPIDResponse::kLQ1D);
a2fbb6ec 100 SetEightSlices();
101 SetImproveTracklets();
102 SetLUT();
103 SetTailCancelation();
86a261ed 104 SetTrackletParams();
e4f2f73d 105}
106
107//______________________________________________________________
a7ac01d2 108AliTRDrecoParam::AliTRDrecoParam(const AliTRDrecoParam &ref)
109 :AliDetectorRecoParam(ref)
8ae98148 110 ,fkdNchdy(ref.fkdNchdy)
a7ac01d2 111 ,fkMaxTheta(ref.fkMaxTheta)
112 ,fkMaxPhi(ref.fkMaxPhi)
113 ,fkRoad0y(ref.fkRoad0y)
d6171f43 114 ,fkRoad0z(ref.fkRoad0z)
a7ac01d2 115 ,fkRoad1y(ref.fkRoad1y)
d6171f43 116 ,fkRoad1z(ref.fkRoad1z)
a7ac01d2 117 ,fkRoad2y(ref.fkRoad2y)
118 ,fkRoad2z(ref.fkRoad2z)
d6171f43 119 ,fkPtThreshold(ref.fkPtThreshold)
a7ac01d2 120 ,fkPlaneQualityThreshold(ref.fkPlaneQualityThreshold)
566bf887 121 ,fkRoadzMultiplicator(ref.fkRoadzMultiplicator)
a7ac01d2 122 ,fkFindable(ref.fkFindable)
123 ,fkChi2Z(ref.fkChi2Z)
124 ,fkChi2Y(ref.fkChi2Y)
5a2e200c 125 ,fkChi2YSlope(ref.fkChi2YSlope)
126 ,fkChi2ZSlope(ref.fkChi2ZSlope)
39d9c03c 127 ,fChi2Cut(ref.fChi2Cut)
8c499dbf 128 ,fkChi2YCut(ref.fkChi2YCut)
5a2e200c 129 ,fkPhiSlope(ref.fkPhiSlope)
8ae98148 130 ,fkNMeanClusters(ref.fkNMeanClusters)
131 ,fkNSigmaClusters(ref.fkNSigmaClusters)
132 ,fkNClusterNoise(ref.fkNClusterNoise)
133 ,fkNMeanTracklets(ref.fkNMeanTracklets)
a7ac01d2 134 ,fkTrackLikelihood(ref.fkTrackLikelihood)
8c499dbf 135 ,fNumberOfConfigs(ref.fNumberOfConfigs)
a2fbb6ec 136 ,fFlags(ref.fFlags)
137 ,fRawStreamVersion(ref.fRawStreamVersion)
86a261ed 138 ,fdzdxXcrossFactor(ref.fdzdxXcrossFactor)
a7ac01d2 139 ,fMinMaxCutSigma(ref.fMinMaxCutSigma)
140 ,fMinLeftRightCutSigma(ref.fMinLeftRightCutSigma)
141 ,fClusMaxThresh(ref.fClusMaxThresh)
142 ,fClusSigThresh(ref.fClusSigThresh)
143 ,fTCnexp(ref.fTCnexp)
8c499dbf 144 ,fRecEveryNTB(ref.fRecEveryNTB)
4e459a9d 145 ,fNumberOfPresamples(ref.fNumberOfPresamples)
146 ,fNumberOfPostsamples(ref.fNumberOfPostsamples)
a7ac01d2 147{
148 //
149 // Copy constructor
150 //
a7ac01d2 151 memcpy(fSysCovMatrix, ref.fSysCovMatrix, 5*sizeof(Double_t));
a2fbb6ec 152 memcpy(fTCParams, ref.fTCParams, 8*sizeof(Double_t));
22a4ab0c 153 memcpy(fPIDThreshold, ref.fPIDThreshold, AliTRDCalPID::kNMom*sizeof(Double_t));
a2fbb6ec 154 memcpy(fStreamLevel, ref.fStreamLevel, kTRDreconstructionTasks * sizeof(Int_t));
86a261ed 155
156 // tracklet params
157 memcpy(fdzdxCorrFactor, ref.fdzdxCorrFactor, 2*sizeof(Double_t));
158 memcpy(fdzdxCorrRCbias, ref.fdzdxCorrRCbias, 2*sizeof(Double_t));
cb29fcbf 159 memcpy(fYcorrTailCancel, ref.fdzdxCorrRCbias, 12*sizeof(Double_t));
160 memcpy(fS2Ycorr, ref.fS2Ycorr, 4*sizeof(Double_t));
a7ac01d2 161}
162
163//______________________________________________________________
f09f3167 164AliTRDrecoParam& AliTRDrecoParam::operator=(const AliTRDrecoParam &ref)
d6171f43 165{
166 //
167 // assignment operator
168 //
169
170 if(this == &ref) return *this;
171 AliDetectorRecoParam::operator=(ref);
172 fkdNchdy = ref.fkdNchdy;
173 fkMaxTheta = ref.fkMaxTheta;
174 fkMaxPhi = ref.fkMaxPhi;
175 fkRoad0y = ref.fkRoad0y;
176 fkRoad0z = ref.fkRoad0z;
177 fkRoad1y = ref.fkRoad1y;
178 fkRoad1z = ref.fkRoad1z;
179 fkRoad2y = ref.fkRoad2y;
180 fkRoad2z = ref.fkRoad2z;
181 fkPtThreshold = ref.fkPtThreshold;
182 fkPlaneQualityThreshold= ref.fkPlaneQualityThreshold;
183 fkRoadzMultiplicator = ref.fkRoadzMultiplicator;
184 fkFindable = ref.fkFindable;
185 fkChi2Z = ref.fkChi2Z;
186 fkChi2Y = ref.fkChi2Y;
187 fkChi2YSlope = ref.fkChi2YSlope;
188 fkChi2ZSlope = ref.fkChi2ZSlope;
39d9c03c 189 fChi2Cut = ref.fChi2Cut;
d6171f43 190 fkChi2YCut = ref.fkChi2YCut;
191 fkPhiSlope = ref.fkPhiSlope;
192 fkNMeanClusters = ref.fkNMeanClusters;
193 fkNSigmaClusters = ref.fkNSigmaClusters;
194 fkNClusterNoise = ref.fkNClusterNoise;
195 fkNMeanTracklets = ref.fkNMeanTracklets;
196 fkTrackLikelihood = ref.fkTrackLikelihood;
197 fNumberOfConfigs = ref.fNumberOfConfigs;
198 fFlags = ref.fFlags;
199 fRawStreamVersion = ref.fRawStreamVersion;
86a261ed 200 fdzdxXcrossFactor = ref.fdzdxXcrossFactor;
d6171f43 201 fMinMaxCutSigma = ref.fMinMaxCutSigma;
202 fMinLeftRightCutSigma = ref.fMinLeftRightCutSigma;
203 fClusMaxThresh = ref.fClusMaxThresh;
204 fClusSigThresh = ref.fClusSigThresh;
205 fTCnexp = ref.fTCnexp;
206 fRecEveryNTB = ref.fRecEveryNTB;
207 fNumberOfPresamples = ref.fNumberOfPresamples;
208 fNumberOfPostsamples = ref.fNumberOfPostsamples;
209
210 memcpy(fSysCovMatrix, ref.fSysCovMatrix, 5*sizeof(Double_t));
211 memcpy(fTCParams, ref.fTCParams, 8*sizeof(Double_t));
212 memcpy(fPIDThreshold, ref.fPIDThreshold, AliTRDCalPID::kNMom*sizeof(Double_t));
213 memcpy(fStreamLevel, ref.fStreamLevel, kTRDreconstructionTasks * sizeof(Int_t));
86a261ed 214
215 // tracklet params
216 memcpy(fdzdxCorrFactor, ref.fdzdxCorrFactor, 2*sizeof(Double_t));
217 memcpy(fdzdxCorrRCbias, ref.fdzdxCorrRCbias, 2*sizeof(Double_t));
cb29fcbf 218 memcpy(fYcorrTailCancel, ref.fdzdxCorrRCbias, 12*sizeof(Double_t));
219 memcpy(fS2Ycorr, ref.fS2Ycorr, 4*sizeof(Double_t));
d6171f43 220 return *this;
221}
222
223//______________________________________________________________
e4f2f73d 224AliTRDrecoParam *AliTRDrecoParam::GetLowFluxParam()
225{
226 //
227 // Parameters for the low flux environment
228 //
229
8ae98148 230 AliTRDrecoParam *rec = new AliTRDrecoParam();
231 rec->fkdNchdy = 12.; // pp in TRD
a2fbb6ec 232 rec->SetVertexConstrained();
828c6f80 233 rec->SetCheckTimeConsistency();
8ae98148 234 return rec;
e4f2f73d 235
236}
237
238//______________________________________________________________
8c499dbf 239AliTRDrecoParam *AliTRDrecoParam::GetLowFluxHLTParam()
240{
241 //
242 // Parameters for the high flux environment in HLT
243 //
244
245 AliTRDrecoParam *rec = GetLowFluxParam();
82ddb093 246 rec->fNumberOfConfigs = 2;
8c499dbf 247 return rec;
248
249}
250
251//______________________________________________________________
e4f2f73d 252AliTRDrecoParam *AliTRDrecoParam::GetHighFluxParam()
253{
254 //
255 // Parameters for the high flux environment
256 //
257
fb872574 258 AliTRDrecoParam *rec = new AliTRDrecoParam();
8ae98148 259 rec->fkdNchdy = 4000.; // PbPb in TRD
a2fbb6ec 260 rec->SetVertexConstrained();
828c6f80 261 rec->SetCheckTimeConsistency();
fb872574 262 return rec;
e4f2f73d 263
264}
9716329b 265
266//______________________________________________________________
8c499dbf 267AliTRDrecoParam *AliTRDrecoParam::GetHighFluxHLTParam()
268{
269 //
270 // Parameters for the high flux environment in HLT
271 //
272
273 AliTRDrecoParam *rec = GetHighFluxParam();
274 rec->fNumberOfConfigs = 1;
8c499dbf 275 return rec;
276
277}
278
279//______________________________________________________________
9716329b 280AliTRDrecoParam *AliTRDrecoParam::GetCosmicTestParam()
281{
282 //
283 // Parameters for the cosmics data
284 //
285
9716329b 286 AliTRDrecoParam *par = new AliTRDrecoParam();
6e39bde4 287 par->fSysCovMatrix[0] = 2.; // y direction (1 cm)
288 par->fSysCovMatrix[1] = 2.; // z direction (1 cm)
b72f4eaf 289 par->fkChi2YSlope = 0.11853;
290 par->fkChi2ZSlope = 0.04527;
39d9c03c 291 par->fkChi2YCut = 25.;
b72f4eaf 292 par->fkChi2YCut = 1.;
6e39bde4 293 par->fkPhiSlope = 10.; //3.17954;
8ae98148 294 par->fkMaxTheta = 2.1445;
295 par->fkMaxPhi = 2.7475;
5a2e200c 296 par->fkNMeanClusters = 12.89;
297 par->fkNSigmaClusters = 2.095;
566bf887 298 par->fkRoadzMultiplicator = 3.;
a2fbb6ec 299 par->fStreamLevel[kTracker] = 1;
828c6f80 300 par->SetCheckTimeConsistency();
9716329b 301 return par;
302
303}
8ae98148 304
305
306//______________________________________________________________
307Float_t AliTRDrecoParam::GetNClusters() const
308{
309 // Estimate the number of clusters in the TRD detector
310
311 Float_t nclusters = (fkNMeanClusters + 2*fkNSigmaClusters)*fkNMeanTracklets*fkdNchdy;
312 nclusters *= 1.+fkNClusterNoise;
313 return nclusters;
314}
11d80e40 315
316//______________________________________________________________
317void AliTRDrecoParam::SetPIDLQslices(Int_t s)
318{
319// Setting number of slices used by the PID LQ method s={1, 2}
320// If PID NN is set this function will change to PID LQ.
321
322 if(IsPIDNeuralNetwork()){
323 AliWarning("PID set to NN. Changing to LQ.");
324 SetPIDNeuralNetwork(kFALSE);
325 }
326
327 switch(s){
328 case 1:
329 if(TESTBIT(fFlags, kLQ2D)) CLRBIT(fFlags, kLQ2D);
330 break;
331 case 2:
332 SETBIT(fFlags, kLQ2D);
333 break;
334 default:
335 AliWarning(Form("N[%d] PID LQ slices not implemented. Using default 2.", s));
336 SETBIT(fFlags, kLQ2D);
337 break;
338 }
339}
340
86a261ed 341//___________________________________________________
342void AliTRDrecoParam::SetTrackletParams(Double_t *par)
343{
344 // Load tracklet reconstruction parameters. If none are set use defaults
345 if(par){
346 // correct dzdx for the bias in z
347 fdzdxCorrFactor[0] = par[0]; // !RC
348 fdzdxCorrFactor[1] = par[1]; // RC
349 // correct dzdx in RC tracklets for the bias in cluster attachment
350 fdzdxCorrRCbias[0] = par[2]; // dz/dx > 0
351 fdzdxCorrRCbias[1] = par[3]; // dz/dx < 0
352 /// correct x_cross for the bias in dzdx
353 fdzdxXcrossFactor = par[4];
cb29fcbf 354 // y correction due to wrong tail cancellation.
355 fYcorrTailCancel[0][0] = par[5];fYcorrTailCancel[0][1] = par[6];fYcorrTailCancel[0][2] = par[7];
356 fYcorrTailCancel[1][0] = par[8];fYcorrTailCancel[1][1] = par[9];fYcorrTailCancel[1][2] = par[10];
2e351ca7 357 fYcorrTailCancel[2][0] = par[11];fYcorrTailCancel[2][1] = par[12];fYcorrTailCancel[2][2] = par[13];
358 fYcorrTailCancel[3][0] = par[14];fYcorrTailCancel[3][1] = par[15];fYcorrTailCancel[3][2] = par[16];
86a261ed 359 // inflation factor of error parameterization in r-phi due to wrong estimation of residuals.
cb29fcbf 360 fS2Ycorr[0] = par[17];
361 fS2Ycorr[1] = par[18];
362 fS2Ycorr[2] = par[19];
363 fS2Ycorr[3] = par[20];
86a261ed 364
365 } else {
366 // correct dzdx for the bias in z
367 fdzdxCorrFactor[0] = 1.09; // !RC
368 fdzdxCorrFactor[1] = 1.05; // RC
369 // correct dzdx in RC tracklets for the bias in cluster attachment
370 fdzdxCorrRCbias[0] = 0.; // dz/dx > 0
371 fdzdxCorrRCbias[1] = -0.012; // dz/dx < 0
372 /// correct x_cross for the bias in dzdx
373 fdzdxXcrossFactor = 0.14;
cb29fcbf 374 // y correction due to wrong tail cancellation.
375 // bz<0 && !RC
376 fYcorrTailCancel[0][0] = 0.04; fYcorrTailCancel[0][1] = 2.151; fYcorrTailCancel[0][2] = 0.013;
377 // bz>0 && !RC
378 fYcorrTailCancel[1][0] = 0.034; fYcorrTailCancel[1][1] = 1.817; fYcorrTailCancel[1][2] = -0.01;
379 // bz<0 && RC
380 fYcorrTailCancel[2][0] = 0.04; fYcorrTailCancel[2][1] = 2.513; fYcorrTailCancel[2][2] = 0.015;
381 // bz>0 && RC
382 fYcorrTailCancel[3][0] = 0.034; fYcorrTailCancel[3][1] = 2.476; fYcorrTailCancel[3][2] = -0.01;
86a261ed 383 // inflation factor of error parameterization in r-phi due to wrong estimation of residuals.
cb29fcbf 384 // chg<0 && !RC
385 fS2Ycorr[0] = 5.52;
386 // chg>0 && !RC
387 fS2Ycorr[1] = 3.61;
388 // chg<0 && RC
389 fS2Ycorr[2] = 4.84;
390 // chg>0 && RC
391 fS2Ycorr[3] = 3.24;
86a261ed 392 }
393}