2 Bug fix
[u/mrichter/AliRoot.git] / TPC / AliTPCseed.cxx
CommitLineData
81e97e0d 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
17
18
19//-----------------------------------------------------------------
20// Implementation of the TPC seed class
21// This class is used by the AliTPCtrackerMI class
22// Origin: Marian Ivanov, CERN, Marian.Ivanov@cern.ch
23//-----------------------------------------------------------------
24#include "TClonesArray.h"
25#include "AliTPCseed.h"
3f82c4f2 26#include "AliTPCReconstructor.h"
0a65832b 27#include "AliTPCClusterParam.h"
7cd8ac3f 28#include "AliTPCCalPad.h"
29#include "AliTPCCalROC.h"
37540068 30#include "AliTPCcalibDB.h"
d080e4a4 31#include "AliTPCParam.h"
7cd8ac3f 32
33
81e97e0d 34
35ClassImp(AliTPCseed)
36
37
38
32fab534 39AliTPCseed::AliTPCseed():
40 AliTPCtrack(),
41 fEsd(0x0),
2928bdf0 42 fClusterOwner(kFALSE),
32fab534 43 fRow(0),
44 fSector(-1),
45 fRelativeSector(-1),
46 fCurrentSigmaY2(1e10),
47 fCurrentSigmaZ2(1e10),
e0e13b88 48 fCMeanSigmaY2p30(-1.), //! current mean sigma Y2 - mean30%
49 fCMeanSigmaZ2p30(-1.), //! current mean sigma Z2 - mean30%
c07cb486 50 fCMeanSigmaY2p30R(-1.), //! current mean sigma Y2 - mean2%
51 fCMeanSigmaZ2p30R(-1.), //! current mean sigma Z2 - mean2%
e0e13b88 52 //
32fab534 53 fErrorY2(1e10),
54 fErrorZ2(1e10),
55 fCurrentCluster(0x0),
56 fCurrentClusterIndex1(-1),
57 fInDead(kFALSE),
58 fIsSeeding(kFALSE),
59 fNoCluster(0),
60 fSort(0),
61 fBSigned(kFALSE),
62 fSeedType(0),
63 fSeed1(-1),
64 fSeed2(-1),
65 fMAngular(0),
19b00333 66 fCircular(0),
67 fClusterMap(159),
68 fSharedMap(159)
32fab534 69{
81e97e0d 70 //
5c09947e 71 for (Int_t i=0;i<160;i++) SetClusterIndex2(i,-3);
81e97e0d 72 for (Int_t i=0;i<160;i++) fClusterPointer[i]=0;
73 for (Int_t i=0;i<3;i++) fKinkIndexes[i]=0;
32fab534 74 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=0.2;
75 for (Int_t i=0;i<4;i++) {
76 fDEDX[i] = 0.;
77 fSDEDX[i] = 1e10;
78 fNCDEDX[i] = 0;
79 }
80 for (Int_t i=0;i<12;i++) fOverlapLabels[i] = -1;
bfb57b6c 81 // for (Int_t i=0;i<160;i++) fClusterMap[i]=kFALSE;
82 //for (Int_t i=0;i<160;i++) fSharedMap[i]=kFALSE;
83 fClusterMap.ResetAllBits(kFALSE);
84 fSharedMap.ResetAllBits(kFALSE);
85
81e97e0d 86}
32fab534 87
2928bdf0 88AliTPCseed::AliTPCseed(const AliTPCseed &s, Bool_t clusterOwner):
32fab534 89 AliTPCtrack(s),
90 fEsd(0x0),
2928bdf0 91 fClusterOwner(clusterOwner),
32fab534 92 fRow(0),
93 fSector(-1),
94 fRelativeSector(-1),
c07cb486 95 fCurrentSigmaY2(-1),
96 fCurrentSigmaZ2(-1),
e0e13b88 97 fCMeanSigmaY2p30(-1.), //! current mean sigma Y2 - mean30%
98 fCMeanSigmaZ2p30(-1.), //! current mean sigma Z2 - mean30%
c07cb486 99 fCMeanSigmaY2p30R(-1.), //! current mean sigma Y2 - mean2%
100 fCMeanSigmaZ2p30R(-1.), //! current mean sigma Z2 - mean2%
32fab534 101 fErrorY2(1e10),
102 fErrorZ2(1e10),
103 fCurrentCluster(0x0),
104 fCurrentClusterIndex1(-1),
105 fInDead(kFALSE),
106 fIsSeeding(kFALSE),
107 fNoCluster(0),
108 fSort(0),
109 fBSigned(kFALSE),
110 fSeedType(0),
111 fSeed1(-1),
112 fSeed2(-1),
113 fMAngular(0),
19b00333 114 fCircular(0),
115 fClusterMap(s.fClusterMap),
116 fSharedMap(s.fSharedMap)
32fab534 117{
81e97e0d 118 //---------------------
119 // dummy copy constructor
120 //-------------------------
2928bdf0 121 for (Int_t i=0;i<160;i++) {
122 fClusterPointer[i]=0;
123 if (fClusterOwner){
124 if (s.fClusterPointer[i])
125 fClusterPointer[i] = new AliTPCclusterMI(*(s.fClusterPointer[i]));
126 }else{
127 fClusterPointer[i] = s.fClusterPointer[i];
128 }
129 fTrackPoints[i] = s.fTrackPoints[i];
130 }
81e97e0d 131 for (Int_t i=0;i<160;i++) fIndex[i] = s.fIndex[i];
5c09947e 132 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=s.fTPCr[i];
133 for (Int_t i=0;i<4;i++) {
134 fDEDX[i] = s.fDEDX[i];
135 fSDEDX[i] = s.fSDEDX[i];
136 fNCDEDX[i] = s.fNCDEDX[i];
137 }
138 for (Int_t i=0;i<12;i++) fOverlapLabels[i] = s.fOverlapLabels[i];
19b00333 139
81e97e0d 140}
5c09947e 141
142
32fab534 143AliTPCseed::AliTPCseed(const AliTPCtrack &t):
144 AliTPCtrack(t),
145 fEsd(0x0),
2928bdf0 146 fClusterOwner(kFALSE),
32fab534 147 fRow(0),
148 fSector(-1),
149 fRelativeSector(-1),
c07cb486 150 fCurrentSigmaY2(-1),
151 fCurrentSigmaZ2(-1),
e0e13b88 152 fCMeanSigmaY2p30(-1.), //! current mean sigma Y2 - mean30%
153 fCMeanSigmaZ2p30(-1.), //! current mean sigma Z2 - mean30%
c07cb486 154 fCMeanSigmaY2p30R(-1.), //! current mean sigma Y2 - mean2%
155 fCMeanSigmaZ2p30R(-1.), //! current mean sigma Z2 - mean2%
32fab534 156 fErrorY2(1e10),
157 fErrorZ2(1e10),
158 fCurrentCluster(0x0),
159 fCurrentClusterIndex1(-1),
160 fInDead(kFALSE),
161 fIsSeeding(kFALSE),
162 fNoCluster(0),
163 fSort(0),
164 fBSigned(kFALSE),
165 fSeedType(0),
166 fSeed1(-1),
167 fSeed2(-1),
168 fMAngular(0),
19b00333 169 fCircular(0),
170 fClusterMap(159),
171 fSharedMap(159)
32fab534 172{
81e97e0d 173 //
32fab534 174 // Constructor from AliTPCtrack
175 //
176 fFirstPoint =0;
105b1b81 177 for (Int_t i=0;i<5;i++) fTPCr[i]=0.2;
81e97e0d 178 for (Int_t i=0;i<160;i++) {
179 fClusterPointer[i] = 0;
180 Int_t index = t.GetClusterIndex(i);
181 if (index>=-1){
182 SetClusterIndex2(i,index);
183 }
184 else{
185 SetClusterIndex2(i,-3);
186 }
187 }
32fab534 188 for (Int_t i=0;i<4;i++) {
189 fDEDX[i] = 0.;
190 fSDEDX[i] = 1e10;
191 fNCDEDX[i] = 0;
192 }
193 for (Int_t i=0;i<12;i++) fOverlapLabels[i] = -1;
bfb57b6c 194
195 //for (Int_t i=0;i<160;i++) fClusterMap[i]=kFALSE;
196 //for (Int_t i=0;i<160;i++) fSharedMap[i]=kFALSE;
197 fClusterMap.ResetAllBits(kFALSE);
198 fSharedMap.ResetAllBits(kFALSE);
199
81e97e0d 200}
201
6c94f330 202AliTPCseed::AliTPCseed(Double_t xr, Double_t alpha, const Double_t xx[5],
203 const Double_t cc[15], Int_t index):
204 AliTPCtrack(xr, alpha, xx, cc, index),
32fab534 205 fEsd(0x0),
2928bdf0 206 fClusterOwner(kFALSE),
32fab534 207 fRow(0),
208 fSector(-1),
209 fRelativeSector(-1),
c07cb486 210 fCurrentSigmaY2(-1),
211 fCurrentSigmaZ2(-1),
e0e13b88 212 fCMeanSigmaY2p30(-1.), //! current mean sigma Y2 - mean30%
213 fCMeanSigmaZ2p30(-1.), //! current mean sigma Z2 - mean30%
c07cb486 214 fCMeanSigmaY2p30R(-1.), //! current mean sigma Y2 - mean2%
215 fCMeanSigmaZ2p30R(-1.), //! current mean sigma Z2 - mean2%
32fab534 216 fErrorY2(1e10),
217 fErrorZ2(1e10),
218 fCurrentCluster(0x0),
219 fCurrentClusterIndex1(-1),
220 fInDead(kFALSE),
221 fIsSeeding(kFALSE),
222 fNoCluster(0),
223 fSort(0),
224 fBSigned(kFALSE),
225 fSeedType(0),
226 fSeed1(-1),
227 fSeed2(-1),
228 fMAngular(0),
19b00333 229 fCircular(0),
230 fClusterMap(159),
231 fSharedMap(159)
32fab534 232{
233 //
234 // Constructor
81e97e0d 235 //
32fab534 236 fFirstPoint =0;
5c09947e 237 for (Int_t i=0;i<160;i++) SetClusterIndex2(i,-3);
81e97e0d 238 for (Int_t i=0;i<160;i++) fClusterPointer[i]=0;
81e97e0d 239 for (Int_t i=0;i<5;i++) fTPCr[i]=0.2;
32fab534 240 for (Int_t i=0;i<4;i++) {
241 fDEDX[i] = 0.;
242 fSDEDX[i] = 1e10;
243 fNCDEDX[i] = 0;
244 }
245 for (Int_t i=0;i<12;i++) fOverlapLabels[i] = -1;
81e97e0d 246}
247
248AliTPCseed::~AliTPCseed(){
249 //
250 // destructor
81e97e0d 251 fNoCluster =0;
2928bdf0 252 if (fClusterOwner){
253 for (Int_t icluster=0; icluster<160; icluster++){
254 delete fClusterPointer[icluster];
255 }
256 }
bfb57b6c 257
81e97e0d 258}
179c6296 259//_________________________________________________
316c6cd9 260AliTPCseed & AliTPCseed::operator=(const AliTPCseed &param)
179c6296 261{
262 //
316c6cd9 263 // assignment operator
179c6296 264 //
316c6cd9 265 if(this!=&param){
266 AliTPCtrack::operator=(param);
267 fEsd =param.fEsd;
268 for(Int_t i = 0;i<160;++i)fClusterPointer[i] = param.fClusterPointer[i]; // this is not allocated by AliTPCSeed
269 fClusterOwner = param.fClusterOwner;
270 // leave out fPoint, they are also not copied in the copy ctor...
271 // but deleted in the dtor... strange...
316c6cd9 272 fRow = param.fRow;
273 fSector = param.fSector;
274 fRelativeSector = param.fRelativeSector;
275 fCurrentSigmaY2 = param.fCurrentSigmaY2;
276 fCurrentSigmaZ2 = param.fCurrentSigmaZ2;
277 fErrorY2 = param.fErrorY2;
278 fErrorZ2 = param.fErrorZ2;
279 fCurrentCluster = param.fCurrentCluster; // this is not allocated by AliTPCSeed
280 fCurrentClusterIndex1 = param.fCurrentClusterIndex1;
281 fInDead = param.fInDead;
282 fIsSeeding = param.fIsSeeding;
283 fNoCluster = param.fNoCluster;
284 fSort = param.fSort;
285 fBSigned = param.fBSigned;
286 for(Int_t i = 0;i<4;++i){
287 fDEDX[i] = param.fDEDX[i];
288 fSDEDX[i] = param.fSDEDX[i];
289 fNCDEDX[i] = param.fNCDEDX[i];
290 }
291 for(Int_t i = 0;i<AliPID::kSPECIES;++i)fTPCr[i] = param.fTPCr[i];
292
293 fSeedType = param.fSeedType;
294 fSeed1 = param.fSeed1;
295 fSeed2 = param.fSeed2;
296 for(Int_t i = 0;i<12;++i)fOverlapLabels[i] = param.fOverlapLabels[i];
297 fMAngular = param.fMAngular;
298 fCircular = param.fCircular;
299 for(int i = 0;i<160;++i)fTrackPoints[i] = param.fTrackPoints[i];
300 fClusterMap = param.fClusterMap;
301 fSharedMap = param.fSharedMap;
302 }
179c6296 303 return (*this);
304}
305//____________________________________________________
81e97e0d 306AliTPCTrackerPoint * AliTPCseed::GetTrackPoint(Int_t i)
307{
308 //
309 //
310 return &fTrackPoints[i];
311}
312
81e97e0d 313
314
315Double_t AliTPCseed::GetDensityFirst(Int_t n)
316{
317 //
318 //
319 // return cluster for n rows bellow first point
320 Int_t nfoundable = 1;
321 Int_t nfound = 1;
322 for (Int_t i=fLastPoint-1;i>0&&nfoundable<n; i--){
323 Int_t index = GetClusterIndex2(i);
324 if (index!=-1) nfoundable++;
325 if (index>0) nfound++;
326 }
327 if (nfoundable<n) return 0;
328 return Double_t(nfound)/Double_t(nfoundable);
329
330}
331
332
333void AliTPCseed::GetClusterStatistic(Int_t first, Int_t last, Int_t &found, Int_t &foundable, Int_t &shared, Bool_t plus2)
334{
335 // get cluster stat. on given region
336 //
337 found = 0;
338 foundable = 0;
339 shared =0;
340 for (Int_t i=first;i<last; i++){
341 Int_t index = GetClusterIndex2(i);
342 if (index!=-1) foundable++;
6d493ea0 343 if (index&0x8000) continue;
81e97e0d 344 if (fClusterPointer[i]) {
345 found++;
346 }
347 else
348 continue;
349
350 if (fClusterPointer[i]->IsUsed(10)) {
351 shared++;
352 continue;
353 }
354 if (!plus2) continue; //take also neighborhoud
355 //
356 if ( (i>0) && fClusterPointer[i-1]){
357 if (fClusterPointer[i-1]->IsUsed(10)) {
358 shared++;
359 continue;
360 }
361 }
362 if ( fClusterPointer[i+1]){
363 if (fClusterPointer[i+1]->IsUsed(10)) {
364 shared++;
365 continue;
366 }
367 }
368
369 }
370 //if (shared>found){
371 //Error("AliTPCseed::GetClusterStatistic","problem\n");
372 //}
373}
374
375
376
377
378
379void AliTPCseed::Reset(Bool_t all)
380{
381 //
382 //
383 SetNumberOfClusters(0);
384 fNFoundable = 0;
385 SetChi2(0);
6c94f330 386 ResetCovariance(10.);
81e97e0d 387 /*
388 if (fTrackPoints){
389 for (Int_t i=0;i<8;i++){
390 delete [] fTrackPoints[i];
391 }
392 delete fTrackPoints;
393 fTrackPoints =0;
394 }
395 */
396
397 if (all){
398 for (Int_t i=0;i<200;i++) SetClusterIndex2(i,-3);
399 for (Int_t i=0;i<160;i++) fClusterPointer[i]=0;
400 }
401
402}
403
404
405void AliTPCseed::Modify(Double_t factor)
406{
407
408 //------------------------------------------------------------------
409 //This function makes a track forget its history :)
410 //------------------------------------------------------------------
411 if (factor<=0) {
6c94f330 412 ResetCovariance(10.);
81e97e0d 413 return;
414 }
6c94f330 415 ResetCovariance(factor);
416
81e97e0d 417 SetNumberOfClusters(0);
418 fNFoundable =0;
419 SetChi2(0);
420 fRemoval = 0;
421 fCurrentSigmaY2 = 0.000005;
422 fCurrentSigmaZ2 = 0.000005;
423 fNoCluster = 0;
424 //fFirstPoint = 160;
425 //fLastPoint = 0;
426}
427
428
429
430
431Int_t AliTPCseed::GetProlongation(Double_t xk, Double_t &y, Double_t & z) const
432{
433 //-----------------------------------------------------------------
434 // This function find proloncation of a track to a reference plane x=xk.
435 // doesn't change internal state of the track
436 //-----------------------------------------------------------------
437
6c94f330 438 Double_t x1=GetX(), x2=x1+(xk-x1), dx=x2-x1;
81e97e0d 439
6c94f330 440 if (TMath::Abs(GetSnp()+GetC()*dx) >= AliTPCReconstructor::GetMaxSnpTrack()) {
81e97e0d 441 return 0;
442 }
443
444 // Double_t y1=fP0, z1=fP1;
6c94f330 445 Double_t c1=GetSnp(), r1=sqrt(1.- c1*c1);
446 Double_t c2=c1 + GetC()*dx, r2=sqrt(1.- c2*c2);
81e97e0d 447
6c94f330 448 y = GetY();
449 z = GetZ();
81e97e0d 450 //y += dx*(c1+c2)/(r1+r2);
451 //z += dx*(c1+c2)/(c1*r2 + c2*r1)*fP3;
452
453 Double_t dy = dx*(c1+c2)/(r1+r2);
454 Double_t dz = 0;
455 //
6c94f330 456 Double_t delta = GetC()*dx*(c1+c2)/(c1*r2 + c2*r1);
81e97e0d 457 /*
458 if (TMath::Abs(delta)>0.0001){
459 dz = fP3*TMath::ASin(delta)/fP4;
460 }else{
461 dz = dx*fP3*(c1+c2)/(c1*r2 + c2*r1);
462 }
463 */
464 // dz = fP3*AliTPCFastMath::FastAsin(delta)/fP4;
6c94f330 465 dz = GetTgl()*TMath::ASin(delta)/GetC();
81e97e0d 466 //
467 y+=dy;
468 z+=dz;
469
470
471 return 1;
472}
473
474
475//_____________________________________________________________________________
af32720d 476Double_t AliTPCseed::GetPredictedChi2(const AliCluster *c) const
81e97e0d 477{
478 //-----------------------------------------------------------------
479 // This function calculates a predicted chi2 increment.
480 //-----------------------------------------------------------------
6c94f330 481 Double_t p[2]={c->GetY(), c->GetZ()};
482 Double_t cov[3]={fErrorY2, 0., fErrorZ2};
483 return AliExternalTrackParam::GetPredictedChi2(p,cov);
81e97e0d 484}
485
81e97e0d 486//_________________________________________________________________________________________
487
488
489Int_t AliTPCseed::Compare(const TObject *o) const {
490 //-----------------------------------------------------------------
491 // This function compares tracks according to the sector - for given sector according z
492 //-----------------------------------------------------------------
493 AliTPCseed *t=(AliTPCseed*)o;
6c94f330 494
81e97e0d 495 if (fSort == 0){
496 if (t->fRelativeSector>fRelativeSector) return -1;
497 if (t->fRelativeSector<fRelativeSector) return 1;
498 Double_t z2 = t->GetZ();
499 Double_t z1 = GetZ();
500 if (z2>z1) return 1;
501 if (z2<z1) return -1;
502 return 0;
503 }
504 else {
505 Float_t f2 =1;
6c23ffed 506 f2 = 1-20*TMath::Sqrt(t->GetSigma1Pt2())/(t->OneOverPt()+0.0066);
81e97e0d 507 if (t->fBConstrain) f2=1.2;
508
509 Float_t f1 =1;
6c23ffed 510 f1 = 1-20*TMath::Sqrt(GetSigma1Pt2())/(OneOverPt()+0.0066);
81e97e0d 511
512 if (fBConstrain) f1=1.2;
513
514 if (t->GetNumberOfClusters()*f2 <GetNumberOfClusters()*f1) return -1;
515 else return +1;
516 }
517}
518
519
520
521
522//_____________________________________________________________________________
70e20dcf 523Bool_t AliTPCseed::Update(const AliCluster *c, Double_t chisq, Int_t index)
6c94f330 524{
81e97e0d 525 //-----------------------------------------------------------------
526 // This function associates a cluster with this track.
527 //-----------------------------------------------------------------
81e97e0d 528 Int_t n=GetNumberOfClusters();
70e20dcf 529 Int_t idx=GetClusterIndex(n); // save the current cluster index
530
531 AliCluster cl(*c); cl.SetSigmaY2(fErrorY2); cl.SetSigmaZ2(fErrorZ2);
532 if (!AliTPCtrack::Update(&cl,chisq,index)) return kFALSE;
e0e13b88 533
534 if (fCMeanSigmaY2p30<0){
535 fCMeanSigmaY2p30= c->GetSigmaY2(); //! current mean sigma Y2 - mean30%
c07cb486 536 fCMeanSigmaZ2p30= c->GetSigmaZ2(); //! current mean sigma Z2 - mean30%
537 fCMeanSigmaY2p30R = 1; //! current mean sigma Y2 - mean5%
538 fCMeanSigmaZ2p30R = 1; //! current mean sigma Z2 - mean5%
e0e13b88 539 }
540 //
541 fCMeanSigmaY2p30= 0.70*fCMeanSigmaY2p30 +0.30*c->GetSigmaY2();
c07cb486 542 fCMeanSigmaZ2p30= 0.70*fCMeanSigmaZ2p30 +0.30*c->GetSigmaZ2();
543 if (fCurrentSigmaY2>0){
544 fCMeanSigmaY2p30R = 0.7*fCMeanSigmaY2p30R +0.3*c->GetSigmaY2()/fCurrentSigmaY2;
545 fCMeanSigmaZ2p30R = 0.7*fCMeanSigmaZ2p30R +0.3*c->GetSigmaZ2()/fCurrentSigmaZ2;
546 }
e0e13b88 547
81e97e0d 548
70e20dcf 549 SetClusterIndex(n,idx); // restore the current cluster index
6c94f330 550 return kTRUE;
81e97e0d 551}
552
553
554
555//_____________________________________________________________________________
105b1b81 556Float_t AliTPCseed::CookdEdx(Double_t low, Double_t up,Int_t i1, Int_t i2, Bool_t onlyused) {
81e97e0d 557 //-----------------------------------------------------------------
558 // This funtion calculates dE/dX within the "low" and "up" cuts.
559 //-----------------------------------------------------------------
560
561 Float_t amp[200];
562 Float_t angular[200];
563 Float_t weight[200];
564 Int_t index[200];
565 //Int_t nc = 0;
81e97e0d 566 Float_t meanlog = 100.;
567
568 Float_t mean[4] = {0,0,0,0};
569 Float_t sigma[4] = {1000,1000,1000,1000};
570 Int_t nc[4] = {0,0,0,0};
571 Float_t norm[4] = {1000,1000,1000,1000};
572 //
573 //
574 fNShared =0;
575
4cc7ba77 576 Float_t gainGG = 1;
577 if (AliTPCcalibDB::Instance()->GetParameters()){
c0169053 578 gainGG= AliTPCcalibDB::Instance()->GetParameters()->GetGasGain()/20000.; //relative gas gain
4cc7ba77 579 }
580
581
81e97e0d 582 for (Int_t of =0; of<4; of++){
583 for (Int_t i=of+i1;i<i2;i+=4)
584 {
585 Int_t index = fIndex[i];
586 if (index<0||index&0x8000) continue;
587
588 //AliTPCTrackPoint * point = (AliTPCTrackPoint *) arr.At(i);
589 AliTPCTrackerPoint * point = GetTrackPoint(i);
590 //AliTPCTrackerPoint * pointm = GetTrackPoint(i-1);
591 //AliTPCTrackerPoint * pointp = 0;
592 //if (i<159) pointp = GetTrackPoint(i+1);
593
594 if (point==0) continue;
595 AliTPCclusterMI * cl = fClusterPointer[i];
596 if (cl==0) continue;
597 if (onlyused && (!cl->IsUsed(10))) continue;
598 if (cl->IsUsed(11)) {
599 fNShared++;
600 continue;
601 }
602 Int_t type = cl->GetType();
603 //if (point->fIsShared){
604 // fNShared++;
605 // continue;
606 //}
607 //if (pointm)
608 // if (pointm->fIsShared) continue;
609 //if (pointp)
610 // if (pointp->fIsShared) continue;
611
612 if (type<0) continue;
613 //if (type>10) continue;
614 //if (point->GetErrY()==0) continue;
615 //if (point->GetErrZ()==0) continue;
616
617 //Float_t ddy = (point->GetY()-cl->GetY())/point->GetErrY();
618 //Float_t ddz = (point->GetZ()-cl->GetZ())/point->GetErrZ();
619 //if ((ddy*ddy+ddz*ddz)>10) continue;
620
621
622 // if (point->GetCPoint().GetMax()<5) continue;
623 if (cl->GetMax()<5) continue;
624 Float_t angley = point->GetAngleY();
625 Float_t anglez = point->GetAngleZ();
626
627 Float_t rsigmay2 = point->GetSigmaY();
628 Float_t rsigmaz2 = point->GetSigmaZ();
629 /*
630 Float_t ns = 1.;
631 if (pointm){
632 rsigmay += pointm->GetTPoint().GetSigmaY();
633 rsigmaz += pointm->GetTPoint().GetSigmaZ();
634 ns+=1.;
635 }
636 if (pointp){
637 rsigmay += pointp->GetTPoint().GetSigmaY();
638 rsigmaz += pointp->GetTPoint().GetSigmaZ();
639 ns+=1.;
640 }
641 rsigmay/=ns;
642 rsigmaz/=ns;
643 */
644
645 Float_t rsigma = TMath::Sqrt(rsigmay2*rsigmaz2);
646
647 Float_t ampc = 0; // normalization to the number of electrons
648 if (i>64){
649 // ampc = 1.*point->GetCPoint().GetMax();
650 ampc = 1.*cl->GetMax();
651 //ampc = 1.*point->GetCPoint().GetQ();
652 // AliTPCClusterPoint & p = point->GetCPoint();
653 // Float_t dy = TMath::Abs(Int_t( TMath::Abs(p.GetY()/0.6)) - TMath::Abs(p.GetY()/0.6)+0.5);
654 // Float_t iz = (250.0-TMath::Abs(p.GetZ())+0.11)/0.566;
655 //Float_t dz =
656 // TMath::Abs( Int_t(iz) - iz + 0.5);
657 //ampc *= 1.15*(1-0.3*dy);
658 //ampc *= 1.15*(1-0.3*dz);
659 // Float_t zfactor = (AliTPCReconstructor::GetCtgRange()-0.0004*TMath::Abs(point->GetCPoint().GetZ()));
660 //ampc *=zfactor;
661 }
662 else{
663 //ampc = 1.0*point->GetCPoint().GetMax();
664 ampc = 1.0*cl->GetMax();
665 //ampc = 1.0*point->GetCPoint().GetQ();
666 //AliTPCClusterPoint & p = point->GetCPoint();
667 // Float_t dy = TMath::Abs(Int_t( TMath::Abs(p.GetY()/0.4)) - TMath::Abs(p.GetY()/0.4)+0.5);
668 //Float_t iz = (250.0-TMath::Abs(p.GetZ())+0.11)/0.566;
669 //Float_t dz =
670 // TMath::Abs( Int_t(iz) - iz + 0.5);
671
672 //ampc *= 1.15*(1-0.3*dy);
673 //ampc *= 1.15*(1-0.3*dz);
674 // Float_t zfactor = (1.02-0.000*TMath::Abs(point->GetCPoint().GetZ()));
675 //ampc *=zfactor;
676
677 }
678 ampc *= 2.0; // put mean value to channel 50
679 //ampc *= 0.58; // put mean value to channel 50
680 Float_t w = 1.;
681 // if (type>0) w = 1./(type/2.-0.5);
682 // Float_t z = TMath::Abs(cl->GetZ());
683 if (i<64) {
684 ampc /= 0.6;
685 //ampc /= (1+0.0008*z);
686 } else
687 if (i>128){
688 ampc /=1.5;
689 //ampc /= (1+0.0008*z);
690 }else{
691 //ampc /= (1+0.0008*z);
692 }
693
694 if (type<0) { //amp at the border - lower weight
695 // w*= 2.;
696
697 continue;
698 }
699 if (rsigma>1.5) ampc/=1.3; // if big backround
700 amp[nc[of]] = ampc;
c0169053 701 amp[nc[of]] /=gainGG;
81e97e0d 702 angular[nc[of]] = TMath::Sqrt(1.+angley*angley+anglez*anglez);
703 weight[nc[of]] = w;
704 nc[of]++;
705 }
706
707 TMath::Sort(nc[of],amp,index,kFALSE);
708 Float_t sumamp=0;
709 Float_t sumamp2=0;
710 Float_t sumw=0;
711 //meanlog = amp[index[Int_t(nc[of]*0.33)]];
712 meanlog = 50;
713 for (Int_t i=int(nc[of]*low+0.5);i<int(nc[of]*up+0.5);i++){
714 Float_t ampl = amp[index[i]]/angular[index[i]];
715 ampl = meanlog*TMath::Log(1.+ampl/meanlog);
716 //
717 sumw += weight[index[i]];
718 sumamp += weight[index[i]]*ampl;
719 sumamp2 += weight[index[i]]*ampl*ampl;
720 norm[of] += angular[index[i]]*weight[index[i]];
721 }
722 if (sumw<1){
723 SetdEdx(0);
724 }
725 else {
726 norm[of] /= sumw;
727 mean[of] = sumamp/sumw;
728 sigma[of] = sumamp2/sumw-mean[of]*mean[of];
729 if (sigma[of]>0.1)
730 sigma[of] = TMath::Sqrt(sigma[of]);
731 else
732 sigma[of] = 1000;
733
734 mean[of] = (TMath::Exp(mean[of]/meanlog)-1)*meanlog;
735 //mean *=(1-0.02*(sigma/(mean*0.17)-1.));
736 //mean *=(1-0.1*(norm-1.));
737 }
738 }
739
740 Float_t dedx =0;
741 fSdEdx =0;
742 fMAngular =0;
743 // mean[0]*= (1-0.05*(sigma[0]/(0.01+mean[1]*0.18)-1));
744 // mean[1]*= (1-0.05*(sigma[1]/(0.01+mean[0]*0.18)-1));
745
746
747 // dedx = (mean[0]* TMath::Sqrt((1.+nc[0]))+ mean[1]* TMath::Sqrt((1.+nc[1])) )/
748 // ( TMath::Sqrt((1.+nc[0]))+TMath::Sqrt((1.+nc[1])));
749
750 Int_t norm2 = 0;
751 Int_t norm3 = 0;
752 for (Int_t i =0;i<4;i++){
753 if (nc[i]>2&&nc[i]<1000){
754 dedx += mean[i] *nc[i];
755 fSdEdx += sigma[i]*(nc[i]-2);
756 fMAngular += norm[i] *nc[i];
757 norm2 += nc[i];
758 norm3 += nc[i]-2;
759 }
760 fDEDX[i] = mean[i];
761 fSDEDX[i] = sigma[i];
762 fNCDEDX[i]= nc[i];
763 }
764
765 if (norm3>0){
766 dedx /=norm2;
767 fSdEdx /=norm3;
768 fMAngular/=norm2;
769 }
770 else{
771 SetdEdx(0);
105b1b81 772 return 0;
81e97e0d 773 }
774 // Float_t dedx1 =dedx;
775 /*
776 dedx =0;
777 for (Int_t i =0;i<4;i++){
778 if (nc[i]>2&&nc[i]<1000){
779 mean[i] = mean[i]*(1-0.12*(sigma[i]/(fSdEdx)-1.));
780 dedx += mean[i] *nc[i];
781 }
782 fDEDX[i] = mean[i];
783 }
784 dedx /= norm2;
785 */
786
787
788 SetdEdx(dedx);
a2d457f2 789 return dedx;
81e97e0d 790}
791Double_t AliTPCseed::Bethe(Double_t bg){
792 //
793 // This is the Bethe-Bloch function normalised to 1 at the minimum
794 //
795 Double_t bg2=bg*bg;
796 Double_t bethe;
797 if (bg<3.5e1)
798 bethe=(1.+ bg2)/bg2*(log(5940*bg2) - bg2/(1.+ bg2));
799 else // Density effect ( approximately :)
800 bethe=1.15*(1.+ bg2)/bg2*(log(3.5*5940*bg) - bg2/(1.+ bg2));
801 return bethe/11.091;
802}
803
804void AliTPCseed::CookPID()
805{
806 //
807 // cook PID information according dEdx
808 //
809 Double_t fRange = 10.;
810 Double_t fRes = 0.1;
811 Double_t fMIP = 47.;
812 //
813 Int_t ns=AliPID::kSPECIES;
814 Double_t sumr =0;
815 for (Int_t j=0; j<ns; j++) {
816 Double_t mass=AliPID::ParticleMass(j);
6c94f330 817 Double_t mom=GetP();
81e97e0d 818 Double_t dedx=fdEdx/fMIP;
819 Double_t bethe=Bethe(mom/mass);
820 Double_t sigma=fRes*bethe;
821 if (sigma>0.001){
822 if (TMath::Abs(dedx-bethe) > fRange*sigma) {
823 fTPCr[j]=TMath::Exp(-0.5*fRange*fRange)/sigma;
824 sumr+=fTPCr[j];
825 continue;
826 }
827 fTPCr[j]=TMath::Exp(-0.5*(dedx-bethe)*(dedx-bethe)/(sigma*sigma))/sigma;
828 sumr+=fTPCr[j];
829 }
830 else{
831 fTPCr[j]=1.;
832 sumr+=fTPCr[j];
833 }
834 }
835 for (Int_t j=0; j<ns; j++) {
836 fTPCr[j]/=sumr; //normalize
837 }
838}
839
840/*
841void AliTPCseed::CookdEdx2(Double_t low, Double_t up) {
842 //-----------------------------------------------------------------
843 // This funtion calculates dE/dX within the "low" and "up" cuts.
844 //-----------------------------------------------------------------
845
846 Float_t amp[200];
847 Float_t angular[200];
848 Float_t weight[200];
849 Int_t index[200];
850 Bool_t inlimit[200];
851 for (Int_t i=0;i<200;i++) inlimit[i]=kFALSE;
852 for (Int_t i=0;i<200;i++) amp[i]=10000;
853 for (Int_t i=0;i<200;i++) angular[i]= 1;;
854
855
856 //
857 Float_t meanlog = 100.;
858 Int_t indexde[4]={0,64,128,160};
859
860 Float_t amean =0;
861 Float_t asigma =0;
862 Float_t anc =0;
863 Float_t anorm =0;
864
865 Float_t mean[4] = {0,0,0,0};
866 Float_t sigma[4] = {1000,1000,1000,1000};
867 Int_t nc[4] = {0,0,0,0};
868 Float_t norm[4] = {1000,1000,1000,1000};
869 //
870 //
871 fNShared =0;
872
873 // for (Int_t of =0; of<3; of++){
874 // for (Int_t i=indexde[of];i<indexde[of+1];i++)
875 for (Int_t i =0; i<160;i++)
876 {
877 AliTPCTrackPoint * point = GetTrackPoint(i);
878 if (point==0) continue;
879 if (point->fIsShared){
880 fNShared++;
881 continue;
882 }
883 Int_t type = point->GetCPoint().GetType();
884 if (type<0) continue;
885 if (point->GetCPoint().GetMax()<5) continue;
886 Float_t angley = point->GetTPoint().GetAngleY();
887 Float_t anglez = point->GetTPoint().GetAngleZ();
888 Float_t rsigmay = point->GetCPoint().GetSigmaY();
889 Float_t rsigmaz = point->GetCPoint().GetSigmaZ();
890 Float_t rsigma = TMath::Sqrt(rsigmay*rsigmaz);
891
892 Float_t ampc = 0; // normalization to the number of electrons
893 if (i>64){
894 ampc = point->GetCPoint().GetMax();
895 }
896 else{
897 ampc = point->GetCPoint().GetMax();
898 }
899 ampc *= 2.0; // put mean value to channel 50
900 // ampc *= 0.565; // put mean value to channel 50
901
902 Float_t w = 1.;
903 Float_t z = TMath::Abs(point->GetCPoint().GetZ());
904 if (i<64) {
905 ampc /= 0.63;
906 } else
907 if (i>128){
908 ampc /=1.51;
909 }
910 if (type<0) { //amp at the border - lower weight
911 continue;
912 }
913 if (rsigma>1.5) ampc/=1.3; // if big backround
914 angular[i] = TMath::Sqrt(1.+angley*angley+anglez*anglez);
915 amp[i] = ampc/angular[i];
916 weight[i] = w;
917 anc++;
918 }
919
920 TMath::Sort(159,amp,index,kFALSE);
921 for (Int_t i=int(anc*low+0.5);i<int(anc*up+0.5);i++){
922 inlimit[index[i]] = kTRUE; // take all clusters
923 }
924
925 // meanlog = amp[index[Int_t(anc*0.3)]];
926 meanlog =10000.;
927 for (Int_t of =0; of<3; of++){
928 Float_t sumamp=0;
929 Float_t sumamp2=0;
930 Float_t sumw=0;
931 for (Int_t i=indexde[of];i<indexde[of+1];i++)
932 {
933 if (inlimit[i]==kFALSE) continue;
934 Float_t ampl = amp[i];
935 ///angular[i];
936 ampl = meanlog*TMath::Log(1.+ampl/meanlog);
937 //
938 sumw += weight[i];
939 sumamp += weight[i]*ampl;
940 sumamp2 += weight[i]*ampl*ampl;
941 norm[of] += angular[i]*weight[i];
942 nc[of]++;
943 }
944 if (sumw<1){
945 SetdEdx(0);
946 }
947 else {
948 norm[of] /= sumw;
949 mean[of] = sumamp/sumw;
950 sigma[of] = sumamp2/sumw-mean[of]*mean[of];
951 if (sigma[of]>0.1)
952 sigma[of] = TMath::Sqrt(sigma[of]);
953 else
954 sigma[of] = 1000;
955 mean[of] = (TMath::Exp(mean[of]/meanlog)-1)*meanlog;
956 }
957 }
958
959 Float_t dedx =0;
960 fSdEdx =0;
961 fMAngular =0;
962 //
963 Int_t norm2 = 0;
964 Int_t norm3 = 0;
965 Float_t www[3] = {12.,14.,17.};
966 //Float_t www[3] = {1.,1.,1.};
967
968 for (Int_t i =0;i<3;i++){
969 if (nc[i]>2&&nc[i]<1000){
970 dedx += mean[i] *nc[i]*www[i]/sigma[i];
971 fSdEdx += sigma[i]*(nc[i]-2)*www[i]/sigma[i];
972 fMAngular += norm[i] *nc[i];
973 norm2 += nc[i]*www[i]/sigma[i];
974 norm3 += (nc[i]-2)*www[i]/sigma[i];
975 }
976 fDEDX[i] = mean[i];
977 fSDEDX[i] = sigma[i];
978 fNCDEDX[i]= nc[i];
979 }
980
981 if (norm3>0){
982 dedx /=norm2;
983 fSdEdx /=norm3;
984 fMAngular/=norm2;
985 }
986 else{
987 SetdEdx(0);
988 return;
989 }
990 // Float_t dedx1 =dedx;
991
992 dedx =0;
993 Float_t norm4 = 0;
994 for (Int_t i =0;i<3;i++){
995 if (nc[i]>2&&nc[i]<1000&&sigma[i]>3){
996 //mean[i] = mean[i]*(1+0.08*(sigma[i]/(fSdEdx)-1.));
997 dedx += mean[i] *(nc[i])/(sigma[i]);
998 norm4 += (nc[i])/(sigma[i]);
999 }
1000 fDEDX[i] = mean[i];
1001 }
1002 if (norm4>0) dedx /= norm4;
1003
1004
1005
1006 SetdEdx(dedx);
1007
1008 //mi deDX
1009
1010}
1011*/
6c94f330 1012Double_t AliTPCseed::GetYat(Double_t xk) const {
1013//-----------------------------------------------------------------
1014// This function calculates the Y-coordinate of a track at the plane x=xk.
1015//-----------------------------------------------------------------
1016 if (TMath::Abs(GetSnp())>AliTPCReconstructor::GetMaxSnpTrack()) return 0.; //patch 01 jan 06
1017 Double_t c1=GetSnp(), r1=TMath::Sqrt(1.- c1*c1);
1018 Double_t c2=c1+GetC()*(xk-GetX());
1019 if (TMath::Abs(c2)>AliTPCReconstructor::GetMaxSnpTrack()) return 0;
1020 Double_t r2=TMath::Sqrt(1.- c2*c2);
1021 return GetY() + (xk-GetX())*(c1+c2)/(r1+r2);
1022}
1023
19b00333 1024void AliTPCseed::SetClusterMapBit(int ibit, Bool_t state)
1025{
1026 fClusterMap[ibit] = state;
1027}
1028Bool_t AliTPCseed::GetClusterMapBit(int ibit)
1029{
1030 return fClusterMap[ibit];
1031}
1032void AliTPCseed::SetSharedMapBit(int ibit, Bool_t state)
1033{
1034 fSharedMap[ibit] = state;
1035}
1036Bool_t AliTPCseed::GetSharedMapBit(int ibit)
1037{
1038 return fSharedMap[ibit];
1039}
eb02f63a 1040
1041
0a65832b 1042
1043
1044
2fc9608f 1045Float_t AliTPCseed::CookdEdxNorm(Double_t low, Double_t up, Int_t type, Int_t i1, Int_t i2, AliTPCCalPad * gainMap, Bool_t posNorm, Bool_t padNorm){
0a65832b 1046
1047 //
1048 // calculates dedx using the cluster
1049 // low - up specify trunc mean range - default form 0-0.7
8076baa0 1050 // type - 1 - max charge or 0- total charge in cluster
1051 // //2- max no corr 3- total+ correction
0a65832b 1052 // i1-i2 - the pad-row range used for calculation
1053 //
1054 // normalization parametrization taken from AliTPCClusterParam
1055 //
1056 AliTPCClusterParam * parcl = AliTPCClusterParam::Instance();
8e1dcdda 1057 if (!parcl) parcl = AliTPCcalibDB::Instance()->GetClusterParam();
0a65832b 1058 if (!parcl) return 0;
1059 Float_t amp[160];
1060 Int_t indexes[160];
1061 Int_t ncl=0;
1062 //
1063 //
4cc7ba77 1064 Float_t gainGG = 1;
1065 if (AliTPCcalibDB::Instance()->GetParameters()){
1066 gainGG= 20000./AliTPCcalibDB::Instance()->GetParameters()->GetGasGain(); //relative gas gain
1067 }
1068
0a65832b 1069 const Float_t ktany = TMath::Tan(TMath::DegToRad()*10);
4cc7ba77 1070 const Float_t kedgey =3.;
0a65832b 1071 //
7cd8ac3f 1072 //
0a65832b 1073 for (Int_t irow=i1; irow<i2; irow++){
1074 AliTPCclusterMI* cluster = GetClusterPointer(irow);
1075 if (!cluster) continue;
1076 if (TMath::Abs(cluster->GetY())>cluster->GetX()*ktany-kedgey) continue; // edge cluster
8076baa0 1077 Float_t charge= (type%2)? cluster->GetMax():cluster->GetQ();
37540068 1078 if (!gainMap) gainMap = AliTPCcalibDB::Instance()->GetDedxGainFactor();
d6920632 1079 if (gainMap) {
1080 Float_t factor = 1;
1081 AliTPCCalROC * roc = gainMap->GetCalROC(cluster->GetDetector());
1082 if (irow < 63) { // IROC
1083 factor = roc->GetValue(irow, TMath::Nint(cluster->GetPad()))*1.55;
1084 } else { // OROC
1085 factor = roc->GetValue(irow - 63, TMath::Nint(cluster->GetPad()));
1086 }
1087 if (factor>0.5) charge/=factor;
7cd8ac3f 1088 }
d6920632 1089
0a65832b 1090 //do normalization
1091 Float_t corr=1;
8076baa0 1092 Int_t ipad= 0;
1093 if (irow>62) ipad=1;
1094 if (irow>127) ipad=2;
0a65832b 1095 if (type<=1){
0a65832b 1096 //
1097 AliTPCTrackerPoint * point = GetTrackPoint(irow);
1098 Float_t ty = TMath::Abs(point->GetAngleY());
1099 Float_t tz = TMath::Abs(point->GetAngleZ());
1100
1101 Float_t dr = (250.-TMath::Abs(cluster->GetZ()))/250.;
1102 corr = parcl->Qnorm(ipad,type,dr,ty,tz);
1103 }
1104 amp[ncl]=charge/corr;
d080e4a4 1105 amp[ncl]/=gainGG;
8e1dcdda 1106 if (posNorm){
1107 //
1108 //
1109 //
1110 corr = parcl->QnormPos(ipad,type, cluster->GetPad(),cluster->GetTimeBin(), cluster->GetZ(),
1111 cluster->GetSigmaY2(),cluster->GetSigmaZ2(),cluster->GetMax(),cluster->GetQ());
1112 amp[ncl]/=corr;
1113 }
1114
1115
8076baa0 1116 amp[ncl] *= 2.0; // put mean value to channel 50
2fc9608f 1117 if (padNorm){
1118 corr=1;
1119 if (type==0 && parcl->fQpadTnorm) corr = (*parcl->fQpadTnorm)[ipad];
1120 if (type==1 && parcl->fQpadTnorm) corr = (*parcl->fQpadMnorm)[ipad];
1121 amp[ncl]/=corr;
1122 }
1123
1124 // if (ipad==0) {
1125// amp[ncl] /= 0.65; // this we will take form OCDB
1126// } else
1127// if (ipad==2){
1128// amp[ncl] /=1.57;
1129// }else{
1130// }
0a65832b 1131 ncl++;
1132 }
8076baa0 1133
0a65832b 1134 if (type>3) return ncl;
1135 TMath::Sort(ncl,amp, indexes, kFALSE);
1136
8076baa0 1137 if (ncl<10) return 0;
0a65832b 1138
1139 Float_t suma=0;
1140 Float_t sumn=0;
1141 Int_t icl0=TMath::Nint(ncl*low);
1142 Int_t icl1=TMath::Nint(ncl*up);
1143 for (Int_t icl=icl0; icl<icl1;icl++){
1144 suma+=amp[indexes[icl]];
1145 sumn++;
1146 }
1147 return suma/sumn;
1148
1149}
1150
1151Double_t AliTPCseed::BetheMass(Double_t mass){
1152 //
1153 // return bethe-bloch
1154 //
1155 Float_t bg= P()/mass;
1156 const Double_t kp1=0.76176e-1;
1157 const Double_t kp2=10.632;
1158 const Double_t kp3=0.13279e-4;
1159 const Double_t kp4=1.8631;
1160 const Double_t kp5=1.9479;
1161
1162 Double_t dbg = (Double_t) bg;
1163
1164 Double_t beta = dbg/TMath::Sqrt(1.+dbg*dbg);
1165
1166 Double_t aa = TMath::Power(beta,kp4);
1167 Double_t bb = TMath::Power(1./dbg,kp5);
1168
1169 bb=TMath::Log(kp3+bb);
1170
1171 return ((Float_t)((kp2-aa-bb)*kp1/aa));
1172}
1173
1174
eb02f63a 1175Float_t AliTPCseed::CookShape(Int_t type){
1176 //
1177 //
1178 //
1179 //-----------------------------------------------------------------
1180 // This funtion calculates dE/dX within the "low" and "up" cuts.
1181 //-----------------------------------------------------------------
1182 Float_t means=0;
1183 Float_t meanc=0;
1184 for (Int_t i =0; i<160;i++) {
1185 AliTPCTrackerPoint * point = GetTrackPoint(i);
1186 if (point==0) continue;
1187
1188 AliTPCclusterMI * cl = fClusterPointer[i];
1189 if (cl==0) continue;
1190
1191 Float_t rsigmay = TMath::Sqrt(point->GetSigmaY());
1192 Float_t rsigmaz = TMath::Sqrt(point->GetSigmaZ());
1193 Float_t rsigma = (rsigmay+rsigmaz)*0.5;
1194 if (type==0) means+=rsigma;
1195 if (type==1) means+=rsigmay;
1196 if (type==2) means+=rsigmaz;
1197 meanc++;
1198 }
1199 Float_t mean = (meanc>0)? means/meanc:0;
1200 return mean;
1201}