fix error in setting the number of dEdx slices to be saved in ESD
[u/mrichter/AliRoot.git] / TRD / AliTRDrecoParam.cxx
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
28 #include "AliLog.h"
29
30 #include "AliTRDrecoParam.h"
31
32 ClassImp(AliTRDrecoParam)
33
34
35 //______________________________________________________________
36 AliTRDrecoParam::AliTRDrecoParam()
37   :AliDetectorRecoParam()
38   ,fkdNchdy(12.)
39   ,fkMaxTheta(1.0)      
40   ,fkMaxPhi(2.0) 
41   ,fkRoad0y(6.0)
42   ,fkRoad0z(8.5) 
43   ,fkRoad1y(2.0)
44   ,fkRoad1z(20.0)       
45   ,fkRoad2y(3.0)
46   ,fkRoad2z(20.0)
47   ,fkPtThreshold(2.0) 
48   ,fkPlaneQualityThreshold(5.0)// 4.2? under Investigation
49   ,fkRoadzMultiplicator(1.5)
50   ,fkFindable(.333)
51   ,fkChi2Z(30./*14.*//*12.5*/)
52   ,fkChi2Y(.25)
53   ,fkChi2YSlope(7.73)
54   ,fkChi2ZSlope(0.069)
55   ,fkChi2YCut(0.5)
56   ,fkPhiSlope(10.6)
57   ,fkNMeanClusters(20.)
58   ,fkNSigmaClusters(2.)
59   ,fkNClusterNoise(0.)
60   ,fkNMeanTracklets(5.5)
61   ,fkTrackLikelihood(-15.)
62   ,fNumberOfConfigs(3)
63   ,fFlags(0)
64   ,fRawStreamVersion("DEFAULT")
65   ,fMinMaxCutSigma(4.)
66   ,fMinLeftRightCutSigma(8.)
67   ,fClusMaxThresh(4.5)
68   ,fClusSigThresh(3.5)
69   ,fTCnexp(1)
70   ,fRecEveryNTB(1)
71   ,fNumberOfPresamples(0)
72   ,fNumberOfPostsamples(0)
73 {
74   //
75   // Default constructor
76   //
77   fSysCovMatrix[0] = 0.; // y direction (1 cm)
78   fSysCovMatrix[1] = 0.; // z direction (1 cm)
79   fSysCovMatrix[2] = 0.; // snp
80   fSysCovMatrix[3] = 0.; // tgl
81   fSysCovMatrix[4] = 0.; // 1/pt
82
83   // Xe tail cancellation parameters
84   fTCParams[0] = 1.156; // r1
85   fTCParams[1] = 0.130; // r2
86   fTCParams[2] = 0.114; // c1
87   fTCParams[3] = 0.624; // c2
88   // Ar tail cancellation parameters
89   fTCParams[4] = 6.;    // r1
90   fTCParams[5] = 0.62;  // r2
91   fTCParams[6] = 0.0087;// c1
92   fTCParams[7] = 0.07;  // c2
93
94   memset(fPIDThreshold, 0, AliTRDCalPID::kNMom*sizeof(Double_t));
95   memset(fStreamLevel, 0, kTRDreconstructionTasks * sizeof(Int_t));
96
97   SetPIDmethod(AliTRDPIDResponse::kLQ1D);
98   SetEightSlices();
99   SetImproveTracklets();
100   SetLUT();
101   SetTailCancelation();
102 }
103
104 //______________________________________________________________
105 AliTRDrecoParam::AliTRDrecoParam(const AliTRDrecoParam &ref)
106   :AliDetectorRecoParam(ref)
107   ,fkdNchdy(ref.fkdNchdy)
108   ,fkMaxTheta(ref.fkMaxTheta)
109   ,fkMaxPhi(ref.fkMaxPhi)
110   ,fkRoad0y(ref.fkRoad0y)
111   ,fkRoad0z(ref.fkRoad0z) 
112   ,fkRoad1y(ref.fkRoad1y)
113   ,fkRoad1z(ref.fkRoad1z)       
114   ,fkRoad2y(ref.fkRoad2y)
115   ,fkRoad2z(ref.fkRoad2z)
116   ,fkPtThreshold(ref.fkPtThreshold) 
117   ,fkPlaneQualityThreshold(ref.fkPlaneQualityThreshold)
118   ,fkRoadzMultiplicator(ref.fkRoadzMultiplicator)
119   ,fkFindable(ref.fkFindable)
120   ,fkChi2Z(ref.fkChi2Z)
121   ,fkChi2Y(ref.fkChi2Y)
122   ,fkChi2YSlope(ref.fkChi2YSlope)
123   ,fkChi2ZSlope(ref.fkChi2ZSlope)
124   ,fkChi2YCut(ref.fkChi2YCut)
125   ,fkPhiSlope(ref.fkPhiSlope)
126   ,fkNMeanClusters(ref.fkNMeanClusters)
127   ,fkNSigmaClusters(ref.fkNSigmaClusters)
128   ,fkNClusterNoise(ref.fkNClusterNoise)
129   ,fkNMeanTracklets(ref.fkNMeanTracklets)
130   ,fkTrackLikelihood(ref.fkTrackLikelihood)
131   ,fNumberOfConfigs(ref.fNumberOfConfigs)
132   ,fFlags(ref.fFlags)
133   ,fRawStreamVersion(ref.fRawStreamVersion)
134   ,fMinMaxCutSigma(ref.fMinMaxCutSigma)
135   ,fMinLeftRightCutSigma(ref.fMinLeftRightCutSigma)
136   ,fClusMaxThresh(ref.fClusMaxThresh)
137   ,fClusSigThresh(ref.fClusSigThresh)
138   ,fTCnexp(ref.fTCnexp)
139   ,fRecEveryNTB(ref.fRecEveryNTB)
140   ,fNumberOfPresamples(ref.fNumberOfPresamples)
141   ,fNumberOfPostsamples(ref.fNumberOfPostsamples)
142 {
143   //
144   // Copy constructor
145   //
146   memcpy(fSysCovMatrix, ref.fSysCovMatrix, 5*sizeof(Double_t));
147   memcpy(fTCParams, ref.fTCParams, 8*sizeof(Double_t));
148   memcpy(fPIDThreshold, ref.fPIDThreshold, AliTRDCalPID::kNMom*sizeof(Double_t));
149   memcpy(fStreamLevel, ref.fStreamLevel, kTRDreconstructionTasks * sizeof(Int_t));
150 }
151
152 //______________________________________________________________
153 AliTRDrecoParam *AliTRDrecoParam::GetLowFluxParam()
154 {
155   //
156   // Parameters for the low flux environment
157   //
158
159   AliTRDrecoParam *rec = new AliTRDrecoParam();
160   rec->fkdNchdy = 12.; // pp in TRD
161   rec->SetVertexConstrained();
162   rec->SetCheckTimeConsistency();
163   return rec;
164
165 }
166
167 //______________________________________________________________
168 AliTRDrecoParam *AliTRDrecoParam::GetLowFluxHLTParam()
169 {
170   //
171   // Parameters for the high flux environment in HLT
172   //
173
174   AliTRDrecoParam *rec = GetLowFluxParam();
175   rec->fNumberOfConfigs = 2;
176   return rec;
177
178 }
179
180 //______________________________________________________________
181 AliTRDrecoParam *AliTRDrecoParam::GetHighFluxParam()
182 {
183   //
184   // Parameters for the high flux environment
185   //
186
187   AliTRDrecoParam *rec = new AliTRDrecoParam();
188   rec->fkdNchdy = 4000.; // PbPb in TRD
189   rec->SetVertexConstrained();
190   rec->SetCheckTimeConsistency();
191   return rec;
192
193 }
194
195 //______________________________________________________________
196 AliTRDrecoParam *AliTRDrecoParam::GetHighFluxHLTParam()
197 {
198   //
199   // Parameters for the high flux environment in HLT
200   //
201
202   AliTRDrecoParam *rec = GetHighFluxParam();
203   rec->fNumberOfConfigs = 1;
204   return rec;
205
206 }
207
208 //______________________________________________________________
209 AliTRDrecoParam *AliTRDrecoParam::GetCosmicTestParam()
210 {
211   //
212   // Parameters for the cosmics data
213   //
214
215   AliTRDrecoParam *par = new AliTRDrecoParam();
216   par->fSysCovMatrix[0] = 2.; // y direction (1 cm)
217   par->fSysCovMatrix[1] = 2.; // z direction (1 cm)
218   par->fkChi2YSlope     = 0.11853;
219   par->fkChi2ZSlope     = 0.04527;
220   par->fkChi2YCut       = 1.;
221   par->fkPhiSlope       = 10.; //3.17954;
222   par->fkMaxTheta       = 2.1445;
223   par->fkMaxPhi         = 2.7475;
224   par->fkNMeanClusters  = 12.89;
225   par->fkNSigmaClusters = 2.095;
226   par->fkRoadzMultiplicator = 3.;
227   par->fStreamLevel[kTracker] = 1;
228   par->SetCheckTimeConsistency();
229   return par;
230
231 }
232
233
234 //______________________________________________________________
235 Float_t AliTRDrecoParam::GetNClusters() const
236 {
237   // Estimate the number of clusters in the TRD detector
238   
239   Float_t nclusters = (fkNMeanClusters + 2*fkNSigmaClusters)*fkNMeanTracklets*fkdNchdy;
240   nclusters *= 1.+fkNClusterNoise;
241   return nclusters;
242 }
243
244 //______________________________________________________________
245 void AliTRDrecoParam::SetPIDLQslices(Int_t s)
246 {
247 // Setting number of slices used by the PID LQ method s={1, 2}
248 // If PID NN is set this function will change to PID LQ.
249  
250   if(IsPIDNeuralNetwork()){
251     AliWarning("PID set to NN. Changing to LQ.");
252     SetPIDNeuralNetwork(kFALSE);
253   } 
254
255   switch(s){
256   case 1: 
257     if(TESTBIT(fFlags, kLQ2D)) CLRBIT(fFlags, kLQ2D);
258     break;
259   case 2:
260     SETBIT(fFlags, kLQ2D);
261     break;
262   default:
263     AliWarning(Form("N[%d] PID LQ slices not implemented. Using default 2.", s));
264     SETBIT(fFlags, kLQ2D);
265     break;
266   }
267 }
268