]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDclusterizer.cxx
Moving place of smell-detector
[u/mrichter/AliRoot.git] / TRD / AliTRDclusterizer.cxx
index ee93b76da0e1e21226bd86fc76809c0c30319ea7..87af305108a4d6ecfe1caaf4c99cff3994025bdc 100644 (file)
@@ -33,7 +33,7 @@
 #include "AliTRDcluster.h"
 #include "AliTRDrecPoint.h"
 #include "AliTRDgeometry.h"
-#include "AliTRDparameter.h"
+#include "AliTRDcalibDB.h"
 
 ClassImp(AliTRDclusterizer)
 
@@ -47,7 +47,6 @@ AliTRDclusterizer::AliTRDclusterizer():TNamed()
   fClusterTree = NULL;
   fRecPoints   = 0;
   fVerbose     = 0;
-  fPar         = 0;
 
 }
 
@@ -62,7 +61,6 @@ AliTRDclusterizer::AliTRDclusterizer(const Text_t* name, const Text_t* title)
   fClusterTree = NULL;
   fRecPoints   = 0;
   fVerbose     = 0;
-  fPar         = 0;
 
 }
 
@@ -112,7 +110,6 @@ void AliTRDclusterizer::Copy(TObject &c) const
   ((AliTRDclusterizer &) c).fClusterTree = NULL;
   ((AliTRDclusterizer &) c).fRecPoints   = NULL;  
   ((AliTRDclusterizer &) c).fVerbose     = fVerbose;  
-  ((AliTRDclusterizer &) c).fPar         = 0;
 
 }
 
@@ -240,7 +237,6 @@ Bool_t AliTRDclusterizer::WriteClusters(Int_t det)
     AliTRDgeometry *geo = fTRD->GetGeometry();
     geo->SetName("TRDgeometry");
     geo->Write();
-    fPar->Write();
     */
     AliLoader* loader = fRunLoader->GetLoader("TRDLoader");
     loader->WriteRecPoints("OVERWRITE");
@@ -261,7 +257,7 @@ Bool_t AliTRDclusterizer::WriteClusters(Int_t det)
 
 
 //_____________________________________________________________________________
-void AliTRDclusterizer::AddCluster(Double_t *pos, Int_t det, Double_t amp
+AliTRDcluster* AliTRDclusterizer::AddCluster(Double_t *pos, Int_t timebin, Int_t det, Double_t amp
                                   , Int_t *tracks, Double_t *sig, Int_t iType, Float_t center)
 {
   //
@@ -273,11 +269,12 @@ void AliTRDclusterizer::AddCluster(Double_t *pos, Int_t det, Double_t amp
   c->SetDetector(det);
   c->AddTrackIndex(tracks);
   c->SetQ(amp);
+  c->SetX(pos[2]);
   c->SetY(pos[0]);
   c->SetZ(pos[1]);
   c->SetSigmaY2(sig[0]);   
   c->SetSigmaZ2(sig[1]);
-  c->SetLocalTimeBin(((Int_t) pos[2]));
+  c->SetLocalTimeBin(timebin);
   c->SetCenter(center);
   switch (iType) {
   case 0:
@@ -298,5 +295,26 @@ void AliTRDclusterizer::AddCluster(Double_t *pos, Int_t det, Double_t amp
   };
 
   RecPoints()->Add(c);
+  return c;
+}
+
+//_____________________________________________________________________________
+Double_t AliTRDclusterizer::CalcXposFromTimebin(Float_t timebin, Int_t idet, Int_t col, Int_t row)
+{
+  //
+  // Calculates the local x position in the detector from the timebin, depends on the drift velocity
+  // and t0
+  //
+  
+  AliTRDcalibDB* calibration = AliTRDcalibDB::Instance();
+  if (!calibration)
+    return -1;
+
+  Float_t vdrift = calibration->GetVdrift(idet, col, row);  
+  Float_t t0 = calibration->GetT0(idet, col, row);
+  Float_t samplingFrequency = calibration->GetSamplingFrequency();
+
+  timebin -= t0;
 
+  return timebin / samplingFrequency * vdrift;
 }