]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
add function to calculate charge gaps
authorabercuci <abercuci@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 22 Nov 2011 13:31:49 +0000 (13:31 +0000)
committerabercuci <abercuci@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 22 Nov 2011 13:31:49 +0000 (13:31 +0000)
TRD/AliTRDseedV1.cxx
TRD/AliTRDseedV1.h

index 4fc2f7cfba0ce8c5b5ab3d3117ec92119220f44d..f541fa35b0a6a1e0f1403c8849a7116064cb06ce 100644 (file)
@@ -501,6 +501,42 @@ Float_t AliTRDseedV1::GetCharge(Bool_t useOutliers) const
   return qt;
 }
 
+//____________________________________________________________________
+Int_t AliTRDseedV1::GetChargeGaps(Float_t sz[kNtb], Float_t pos[kNtb], Int_t isz[kNtb]) const
+{
+// Find number, size and position of charge gaps (consecutive missing time bins).
+// Returns the number of gaps and fills their size in input array "sz" and position in array "pos"
+
+  Bool_t gap(kFALSE);
+  Int_t n(0);
+  Int_t ipos[kNtb]; memset(isz, 0, kNtb*sizeof(Int_t));memset(ipos, 0, kNtb*sizeof(Int_t));
+  for(int ic(0); ic<kNtb; ic++){
+    if(fClusters[ic] || fClusters[ic+kNtb]){
+      if(gap) n++;
+      continue;
+    }
+    gap = kTRUE;
+    isz[n]++;
+    ipos[n] = ic;
+  }
+  if(!n) return 0;
+
+  // write calibrated values
+  AliTRDcluster fake;
+  for(Int_t igap(0); igap<n; igap++){
+    sz[igap] = isz[igap]*fVD/AliTRDCommonParam::Instance()->GetSamplingFrequency();
+    fake.SetPadTime(ipos[igap]);
+    pos[igap] = fake.GetXloc(fT0, fVD);
+    if(isz[igap]>1){
+      fake.SetPadTime(ipos[igap]-isz[igap]+1);
+      pos[igap] += fake.GetXloc(fT0, fVD);
+      pos[igap] /= 2.;
+    }
+  }
+  return n;
+}
+
+
 //____________________________________________________________________
 Bool_t AliTRDseedV1::GetEstimatedCrossPoint(Float_t &x, Float_t &z) const
 {
index d83427f1c05fe8567c823b844e6c22cc689aeba4..22de53e7fb6588dd447c2b55f1620da5722f391f 100644 (file)
@@ -131,6 +131,7 @@ public:
   Float_t   GetdZdX() const          { return fZfit[1];}
   Int_t     GetdY() const            { return Int_t(GetY()/0.014);}
   Int_t     GetDetector() const      { return fDet;}
+  Int_t     GetChargeGaps(Float_t sz[kNtb], Float_t pos[kNtb], Int_t ntb[kNtb]) const;
   void      GetCalibParam(Float_t &exb, Float_t &vd, Float_t &t0, Float_t &s2, Float_t &dl, Float_t &dt) const    { 
               exb = fExB; vd = fVD; t0 = fT0; s2 = fS2PRF; dl = fDiffL; dt = fDiffT;}
   AliTRDcluster*  GetClusters(Int_t i) const               { return i<0 || i>=kNclusters ? NULL: fClusters[i];}