]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDseedV1.cxx
https://savannah.cern.ch/bugs/index.php?98544
[u/mrichter/AliRoot.git] / TRD / AliTRDseedV1.cxx
index 4fc2f7cfba0ce8c5b5ab3d3117ec92119220f44d..3208df689749eeb4e53153e8e8ab62586d566833 100644 (file)
@@ -258,7 +258,7 @@ void AliTRDseedV1::Init(const AliRieman *rieman)
 
 
 //____________________________________________________________
-Bool_t AliTRDseedV1::Init(AliTRDtrackV1 *track)
+Bool_t AliTRDseedV1::Init(const AliTRDtrackV1 *track)
 {
 // Initialize this tracklet using the track information
 //
@@ -495,12 +495,48 @@ Float_t AliTRDseedV1::GetCharge(Bool_t useOutliers) const
   AliTRDcluster *c(NULL); Float_t qt(0.);
   for(int ic=0; ic<kNclusters; ic++){
     if(!(c=fClusters[ic])) continue;
-    if(c->IsInChamber() && !useOutliers) continue;
+    if(!c->IsInChamber() && !useOutliers) continue;
     qt += TMath::Abs(c->GetQ());
   }
   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
 {
@@ -548,12 +584,12 @@ Float_t AliTRDseedV1::GetQperTB(Int_t tb) const
   //
   // Charge of the clusters at timebin
   //
-  Float_t Q = 0;
+  Float_t q = 0;
   if(fClusters[tb] /*&& fClusters[tb]->IsInChamber()*/)
-    Q += TMath::Abs(fClusters[tb]->GetQ());
+    q += TMath::Abs(fClusters[tb]->GetQ());
   if(fClusters[tb+kNtb] /*&& fClusters[tb+kNtb]->IsInChamber()*/)
-    Q += TMath::Abs(fClusters[tb+kNtb]->GetQ());
-  return Q/TMath::Sqrt(1. + fYref[1]*fYref[1] + fZref[1]*fZref[1]);
+    q += TMath::Abs(fClusters[tb+kNtb]->GetQ());
+  return q/TMath::Sqrt(1. + fYref[1]*fYref[1] + fZref[1]*fZref[1]);
 }
 
 //____________________________________________________________________