]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDtransform.cxx
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / TRD / AliTRDtransform.cxx
index 3ea14e21a19cc099d2dc60b381a9896e44c37132..b17d918b98ab3ac8f8dd0a86e1d166057475be95 100644 (file)
@@ -37,8 +37,6 @@
 
 ClassImp(AliTRDtransform)
 
-AliTRDgeometry* AliTRDtransform::fgGeo = NULL;
-
 //_____________________________________________________________________________
 AliTRDtransform::AliTRDtransform()
   :TObject()
@@ -50,8 +48,10 @@ AliTRDtransform::AliTRDtransform()
   ,fCalPRFROC(0x0)
   ,fkCalVdriftDet(0x0)
   ,fkCalT0Det(0x0)
+  ,fkCalExBDet(0x0)
   ,fCalVdriftDetValue(0)
   ,fCalT0DetValue(0)
+  ,fCalExBDetValue(0)
   ,fSamplingFrequency(0)
   ,fPadPlane(0x0)
   ,fZShiftIdeal(0)
@@ -61,13 +61,6 @@ AliTRDtransform::AliTRDtransform()
   // AliTRDtransform default constructor
   //
 
-  if(!fgGeo){
-    fgGeo = new AliTRDgeometry();
-    if (!fgGeo->CreateClusterMatrixArray()) {
-      AliError("Could not get transformation matrices\n");
-    }
-  }
-
   fParam             = AliTRDCommonParam::Instance();
   if (!fParam) {
     AliError("Could not get common parameters\n");
@@ -82,6 +75,7 @@ AliTRDtransform::AliTRDtransform()
   // Get the calibration objects for the global calibration
   fkCalVdriftDet     = fCalibration->GetVdriftDet();
   fkCalT0Det         = fCalibration->GetT0Det();
+  fkCalExBDet        = fCalibration->GetExBDet();
 
 }
 
@@ -96,8 +90,10 @@ AliTRDtransform::AliTRDtransform(Int_t det)
   ,fCalPRFROC(0x0)
   ,fkCalVdriftDet(0x0)
   ,fkCalT0Det(0x0)
+  ,fkCalExBDet(0x0)
   ,fCalVdriftDetValue(0)
   ,fCalT0DetValue(0)
+  ,fCalExBDetValue(0)
   ,fSamplingFrequency(0)
   ,fPadPlane(0x0)
   ,fZShiftIdeal(0)
@@ -107,13 +103,6 @@ AliTRDtransform::AliTRDtransform(Int_t det)
   // AliTRDtransform constructor for a given detector
   //
 
-  if(!fgGeo){
-    fgGeo = new AliTRDgeometry();
-    if (!fgGeo->CreateClusterMatrixArray()) {
-      AliError("Could not get transformation matrices\n");
-    }
-  }
-
   fParam             = AliTRDCommonParam::Instance();
   if (!fParam) {
     AliError("Could not get common parameters\n");
@@ -128,6 +117,7 @@ AliTRDtransform::AliTRDtransform(Int_t det)
   // Get the calibration objects for the global calibration
   fkCalVdriftDet     = fCalibration->GetVdriftDet();
   fkCalT0Det         = fCalibration->GetT0Det();
+  fkCalExBDet        = fCalibration->GetExBDet();
 
   SetDetector(det);
 
@@ -144,8 +134,10 @@ AliTRDtransform::AliTRDtransform(const AliTRDtransform &t)
   ,fCalPRFROC(0x0)
   ,fkCalVdriftDet(0x0)
   ,fkCalT0Det(0x0)
+  ,fkCalExBDet(0x0)
   ,fCalVdriftDetValue(0)
   ,fCalT0DetValue(0)
+  ,fCalExBDetValue(0)
   ,fSamplingFrequency(0)
   ,fPadPlane(0x0)
   ,fZShiftIdeal(0)
@@ -167,7 +159,7 @@ AliTRDtransform::AliTRDtransform(const AliTRDtransform &t)
   }
   fkCalVdriftDet     = fCalibration->GetVdriftDet();
   fkCalT0Det         = fCalibration->GetT0Det();
-
+  fkCalExBDet        = fCalibration->GetExBDet();
 }
 
 //_____________________________________________________________________________
@@ -179,6 +171,64 @@ AliTRDtransform::~AliTRDtransform()
 
 }
 
+//_____________________________________________________________________________
+AliTRDtransform &AliTRDtransform::operator=(const AliTRDtransform &t)
+{
+  //
+  // Assignment operator
+  //
+
+  if (this != &t) {
+    ((AliTRDtransform &) t).Copy(*this);
+  }
+
+  return *this;
+
+}
+
+//_____________________________________________________________________________
+void AliTRDtransform::Copy(TObject &t) const
+{
+  //
+  // Copy function
+  //
+
+  ((AliTRDtransform &) t).fDetector          = fDetector;
+  ((AliTRDtransform &) t).fParam             = AliTRDCommonParam::Instance();
+  ((AliTRDtransform &) t).fCalibration       = AliTRDcalibDB::Instance();
+  if (fCalibration) {
+    ((AliTRDtransform &) t).fkCalVdriftDet   = fCalibration->GetVdriftDet();
+    ((AliTRDtransform &) t).fkCalT0Det       = fCalibration->GetT0Det();
+    ((AliTRDtransform &) t).fkCalExBDet      = fCalibration->GetExBDet();
+  }
+  else {
+    ((AliTRDtransform &) t).fkCalVdriftDet   = 0;
+    ((AliTRDtransform &) t).fkCalT0Det       = 0;
+    ((AliTRDtransform &) t).fkCalExBDet      = 0;
+  }
+  ((AliTRDtransform &) t).fCalVdriftROC      = 0x0;
+  ((AliTRDtransform &) t).fCalT0ROC          = 0x0;
+  ((AliTRDtransform &) t).fCalPRFROC         = 0x0;
+  ((AliTRDtransform &) t).fCalVdriftDetValue = 0; 
+  ((AliTRDtransform &) t).fCalT0DetValue     = 0;
+  ((AliTRDtransform &) t).fCalExBDetValue     = 0;
+  ((AliTRDtransform &) t).fSamplingFrequency = 0;
+  ((AliTRDtransform &) t).fPadPlane          = 0x0;
+  ((AliTRDtransform &) t).fZShiftIdeal       = 0;
+  ((AliTRDtransform &) t).fMatrix            = 0x0;
+
+}
+
+//_____________________________________________________________________________
+AliTRDgeometry& AliTRDtransform::Geometry()
+{
+  static AliTRDgeometry g;
+  if (!g.CreateClusterMatrixArray()) {
+    AliErrorGeneral("AliTRDtransform::Geometry()", "Could not get transformation matrices\n");
+  }
+  return g;
+}
+
 //_____________________________________________________________________________
 void AliTRDtransform::SetDetector(Int_t det)
 {
@@ -197,15 +247,16 @@ void AliTRDtransform::SetDetector(Int_t det)
   // Get the detector wise defined calibration values
   fCalVdriftDetValue = fkCalVdriftDet->GetValue(det);
   fCalT0DetValue     = fkCalT0Det->GetValue(det);
+  fCalExBDetValue    = fkCalExBDet->GetValue(det);
 
   // Shift needed to define Z-position relative to middle of chamber
-  Int_t layer        = fgGeo->GetLayer(det);
-  Int_t stack        = fgGeo->GetStack(det);
-  fPadPlane          = fgGeo->GetPadPlane(layer,stack);
+  Int_t layer        = Geometry().GetLayer(det);
+  Int_t stack        = Geometry().GetStack(det);
+  fPadPlane          = Geometry().GetPadPlane(layer,stack);
   fZShiftIdeal       = 0.5 * (fPadPlane->GetRow0() + fPadPlane->GetRowEnd());
 
   // Get the current transformation matrix
-  fMatrix            = fgGeo->GetClusterMatrix(det);
+  fMatrix            = Geometry().GetClusterMatrix(det);
 
 }
 
@@ -236,7 +287,7 @@ Bool_t AliTRDtransform::Transform(AliTRDcluster *c)
   Double_t t0  = fCalT0DetValue     + fCalT0ROC->GetValue(col,row);
   t0 /= fSamplingFrequency;
   // ExB correction
-  Double_t exb = AliTRDCommonParam::Instance()->GetOmegaTau(vd);
+  Double_t exb = fCalExBDetValue;//AliTRDCommonParam::Instance()->GetOmegaTau(vd);
 
   Float_t x = c->GetXloc(t0, vd);