]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDtrackletOflHelper.cxx
Version where the process for HLT and vdrift on DAQ are off(Raphaelle)
[u/mrichter/AliRoot.git] / TRD / AliTRDtrackletOflHelper.cxx
index 7bef0af51d4314b9124745e976c487dd640f6339..91a1555ef40787709882fd932d931b230a4ddcfb 100644 (file)
@@ -246,12 +246,13 @@ void AliTRDtrackletOflHelper::FindSolidCls(Bool_t *mark, Int_t *q)
 //  Find clusters produced by large fluctuations of energy deposits
 //  Largest charge and well separation from neighbors
 
-  Int_t idx[AliTRDseedV1::kNtb];
-  TMath::Sort(Int_t(AliTRDseedV1::kNtb), q, idx, kTRUE);
+  Int_t ntb(AliTRDseedV1::kNtb);
+  Int_t idx[ntb+1];
+  TMath::Sort(ntb, q, idx, kTRUE);
   Int_t qmax = Int_t(0.3*q[idx[0]]);
   mark[0] = kFALSE;
-  for(Int_t icl(AliTRDseedV1::kNtb-5); icl<AliTRDseedV1::kNtb; icl++) mark[icl] = kFALSE;
-  for(Int_t icl(0); icl<AliTRDseedV1::kNtb; icl++){
+  for(Int_t icl(ntb-5); icl<ntb; icl++) mark[icl] = kFALSE;
+  for(Int_t icl(0); icl<ntb; icl++){
     Int_t jcl(idx[icl]);
     if(!mark[jcl]) continue;
     if(q[jcl-1]>q[jcl] || q[jcl+1]>q[jcl]){
@@ -325,10 +326,8 @@ Bool_t AliTRDtrackletOflHelper::Fit(Int_t n, Double_t *x, Double_t *y, Double_t
 {
 // Iterative robust tracklet fit 
   if(n<3) return kFALSE;
-  //compute <x>
-  if(Int_t(par[2])==21122012){ 
-    par[2] = 0.; 
-  } else {
+  //select reference radial position
+  if(par[2]<0.){ //compute reference radial position as <x>
     par[2] = 0.; for(Int_t ic(n); ic--;) par[2] += x[ic]; par[2] /= n;
   }
   AliTRDtrackerV1::AliTRDLeastSquare &f=Fitter();
@@ -396,21 +395,20 @@ void AliTRDtrackletOflHelper::GetColSignals(Int_t col, Int_t adc[32], Bool_t mai
 }
 
 //___________________________________________________________________
-Int_t AliTRDtrackletOflHelper::GetRMS(Double_t &r, Double_t &m, Double_t &s, Double_t &xm) const
+Int_t AliTRDtrackletOflHelper::GetRMS(Double_t &r, Double_t &m, Double_t &s, Double_t xm) const
 {
-// Calculate Rotation[r], Mean y[m] (at mean radial position [xm]) and Sigma[s] (of a gaussian distribution in the tracklet [SR])
+// Calculate Rotation[r], Mean y[m] (at radial position [xm]) and Sigma[s] (of a gaussian distribution in the tracklet [SR])
 // for clusters attach to this helper. The Rotation and Mean are calculated without tilt correction option.
 // It returns the number of clusters in 1 sigma cut.
   
   Int_t n(fClusters->GetEntriesFast());
-  if(n==2){
-    return n;
-  }
-  
-  Double_t par[3] = {0., 0., 0.};
+  if(n<=2) return n;
+  Double_t par[3] = {0., 0., -1.};
+  if(xm>0.) par[2] = xm; // select reference radial position from outside 
   Fit(par);
-  xm= par[2];
+  m = par[0];
   r = par[1];
+  xm= par[2];
 
   Double_t corr = TMath::Tan(TMath::DegToRad()*fPadPlane->GetTiltingAngle())*
                   fPadPlane->GetLengthIPad();
@@ -424,7 +422,6 @@ Int_t AliTRDtrackletOflHelper::GetRMS(Double_t &r, Double_t &m, Double_t &s, Dou
   }
   Double_t m1(0.);
   AliMathBase::EvaluateUni(n, y, m1, s, 0);
-  m = par[0] + m1;
   Int_t n0(0);
   for(Int_t ic(n); ic--;){
     c = (AliTRDcluster*)fClusters->At(ic);
@@ -434,6 +431,21 @@ Int_t AliTRDtrackletOflHelper::GetRMS(Double_t &r, Double_t &m, Double_t &s, Dou
   return n0;
 }
 
+//___________________________________________________________________
+Double_t AliTRDtrackletOflHelper::GetQ() const
+{
+// Calculate total charge NOT normalized to inclination
+
+  Double_t q(0.);
+  Int_t n(fClusters->GetEntriesFast());
+  AliTRDcluster *c(NULL);
+  for(Int_t ic(n); ic--;){
+    c = (AliTRDcluster*)fClusters->At(ic);
+    q += TMath::Abs(c->GetQ());
+  }
+  return q;
+}
+
 //___________________________________________________________________
 Double_t AliTRDtrackletOflHelper::GetSyMean() const
 {
@@ -471,13 +483,16 @@ Int_t AliTRDtrackletOflHelper::Segmentation(Int_t n, Double_t *x, Double_t *y, I
     AliErrorGeneral("AliTRDtrackletOflHelper::Segmentation()", "One of the input arrays non initialized.");
     return 0;
   }
-
+  const Int_t kBuffer = 200;
+  if(n>kBuffer){
+    AliWarningGeneral("AliTRDtrackletOflHelper::Segmentation()", Form("Input array size %d exceed buffer %d. Truncate.", n, kBuffer));
+    n = kBuffer;
+  }
   const Double_t kGapSize(0.2); // cm
   Int_t ng(0),
         nc(0);
-  Double_t xx[100], dy;
-  Int_t idx[200], jdx[100], kdx[100]; 
-  
+  Double_t xx[kBuffer], dy;
+  Int_t idx[kBuffer+1], jdx[kBuffer], kdx[kBuffer];
   TMath::Sort(n, y, idx);
   for(Int_t iy(0); iy<n; iy++){
     dy = iy>0?(TMath::Abs(y[idx[iy-1]]-y[idx[iy]])):0.;