]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDclusterizerV0.cxx
- Return from Gstpar if material is not used.
[u/mrichter/AliRoot.git] / TRD / AliTRDclusterizerV0.cxx
index 48091dee55d84d8d36154064a908578656009ef5..397dc1c14bc1dccf55053eece4b691579a6b374e 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-$Log$
-Revision 1.4  2000/06/08 18:32:58  cblume
-Make code compliant to coding conventions
-
-Revision 1.3  2000/06/07 16:27:01  cblume
-Try to remove compiler warnings on Sun and HP
-
-Revision 1.2  2000/05/08 16:17:27  cblume
-Merge TRD-develop
-
-Revision 1.1.4.1  2000/05/08 15:08:41  cblume
-Replace AliTRDcluster by AliTRDrecPoint
-
-Revision 1.1  2000/02/28 18:58:33  cblume
-Add new TRD classes
-
-*/
+/* $Id$ */
 
 ///////////////////////////////////////////////////////////////////////////////
 //                                                                           //
@@ -48,16 +31,20 @@ Add new TRD classes
 
 #include <TRandom.h>
 #include <TTree.h>
+#include "AliRun.h"
 
+#include "AliTRD.h"
 #include "AliTRDclusterizerV0.h"
-#include "AliTRDconst.h"
+#include "AliTRDhit.h"
 #include "AliTRDgeometry.h"
 #include "AliTRDrecPoint.h"
+#include "AliTRDparameter.h"
 
 ClassImp(AliTRDclusterizerV0)
 
 //_____________________________________________________________________________
-AliTRDclusterizerV0::AliTRDclusterizerV0():AliTRDclusterizer()
+  AliTRDclusterizerV0::AliTRDclusterizerV0():AliTRDclusterizer(), fTRD(NULL)
 {
   //
   // AliTRDclusterizerV0 default constructor
@@ -67,7 +54,7 @@ AliTRDclusterizerV0::AliTRDclusterizerV0():AliTRDclusterizer()
 
 //_____________________________________________________________________________
 AliTRDclusterizerV0::AliTRDclusterizerV0(const Text_t* name, const Text_t* title)
-                    :AliTRDclusterizer(name,title)
+                    :AliTRDclusterizer(name,title), fTRD(NULL)
 {
   //
   // AliTRDclusterizerV0 default constructor
@@ -101,22 +88,37 @@ void AliTRDclusterizerV0::Init()
 }
 
 //_____________________________________________________________________________
-Bool_t AliTRDclusterizerV0::MakeCluster()
+Bool_t AliTRDclusterizerV0::MakeClusters()
 {
   //
   // Generates the cluster
   //
 
-  // Get the pointer to the detector class and check for version 1
-  AliTRD *trd = (AliTRD*) gAlice->GetDetector("TRD");
-  if (trd->IsVersion() != 0) {
+  // Get the TRD object
+  fTRD = (AliTRD*) gAlice->GetDetector("TRD"); 
+  if (!fTRD) {
+    printf("AliTRDclusterizerV0::makClusters -- ");
+    printf("No TRD detector object found\n");
+    return kFALSE;
+  }
+
+  if (fTRD->IsVersion() != 0) {
     printf("AliTRDclusterizerV0::MakeCluster -- ");
     printf("TRD must be version 0 (fast simulator).\n");
     return kFALSE; 
   }
 
   // Get the geometry
-  AliTRDgeometry *geo = trd->GetGeometry();
+  AliTRDgeometry *geo = fTRD->GetGeometry();
+
+  // Create a default parameter class if none is defined
+  if (!fPar) {
+    fPar = new AliTRDparameter("TRDparameter","Standard TRD parameter");
+    if (fVerbose > 0) {
+      printf("<AliTRDclusterizerV0::MakeCluster> ");
+      printf("Create the default parameter object.\n");
+    }
+  }
   
   printf("AliTRDclusterizerV0::MakeCluster -- ");
   printf("Start creating cluster.\n");
@@ -126,7 +128,7 @@ Bool_t AliTRDclusterizerV0::MakeCluster()
   AliTRDhit *hit;
   
   // Get the pointer to the hit tree
-  TTree     *hitTree      = gAlice->TreeH();
+  TTree     *hitTree      = fTRD->TreeH();
   // Get the pointer to the reconstruction tree
   TTree     *clusterTree  = gAlice->TreeR();
 
@@ -137,18 +139,18 @@ Bool_t AliTRDclusterizerV0::MakeCluster()
   Int_t nTrack = (Int_t) hitTree->GetEntries();
 
   // Loop through all the chambers
-  for (Int_t icham = 0; icham < kNcham; icham++) {
-    for (Int_t iplan = 0; iplan < kNplan; iplan++) {
-      for (Int_t isect = 0; isect < kNsect; isect++) {
+  for (Int_t icham = 0; icham < AliTRDgeometry::Ncham(); icham++) {
+    for (Int_t iplan = 0; iplan < AliTRDgeometry::Nplan(); iplan++) {
+      for (Int_t isect = 0; isect < AliTRDgeometry::Nsect(); isect++) {
 
-        Int_t   nColMax     = geo->GetColMax(iplan);
-        Float_t row0        = geo->GetRow0(iplan,icham,isect);
-        Float_t col0        = geo->GetCol0(iplan);
-        Float_t time0       = geo->GetTime0(iplan);
+        Int_t   nColMax     = fPar->GetColMax(iplan);
+        Float_t row0        = fPar->GetRow0(iplan,icham,isect);
+        Float_t col0        = fPar->GetCol0(iplan);
+        Float_t time0       = fPar->GetTime0(iplan);
 
-        Float_t rowPadSize  = geo->GetRowPadSize();
-        Float_t colPadSize  = geo->GetColPadSize();
-        Float_t timeBinSize = geo->GetTimeBinSize();
+        Float_t rowPadSize  = fPar->GetRowPadSize(iplan,icham,isect);
+        Float_t colPadSize  = fPar->GetColPadSize(iplan);
+        Float_t timeBinSize = fPar->GetTimeBinSize();
 
         // Loop through all entries in the tree
         for (Int_t iTrack = 0; iTrack < nTrack; iTrack++) {
@@ -157,12 +159,12 @@ Bool_t AliTRDclusterizerV0::MakeCluster()
           nBytes += hitTree->GetEvent(iTrack);
 
           // Get the number of hits in the TRD created by this particle
-          Int_t nHit = trd->Hits()->GetEntriesFast();
+          Int_t nHit = fTRD->Hits()->GetEntriesFast();
 
           // Loop through the TRD hits  
           for (Int_t iHit = 0; iHit < nHit; iHit++) {
 
-            if (!(hit = (AliTRDhit *) trd->Hits()->UncheckedAt(iHit))) 
+            if (!(hit = (AliTRDhit *) fTRD->Hits()->UncheckedAt(iHit))) 
               continue;
 
             Float_t pos[3];
@@ -185,7 +187,7 @@ Bool_t AliTRDclusterizerV0::MakeCluster()
             geo->Rotate(detector,pos,rot);
 
             // Add this recPoint to the temporary array for this chamber
-            AliTRDrecPoint *recPoint = new AliTRDrecPoint();
+            AliTRDrecPoint *recPoint = new AliTRDrecPoint("");
             recPoint->SetLocalRow(rot[2]);
             recPoint->SetLocalCol(rot[1]);
             recPoint->SetLocalTime(rot[0]);
@@ -274,12 +276,17 @@ Bool_t AliTRDclusterizerV0::MakeCluster()
          // Transform into local coordinates
           smear[0] = (Int_t) ((smear[0] -  row0) /  rowPadSize);
           smear[1] = (Int_t) ((smear[1] -  col0) /  colPadSize);
-          smear[2] = (Int_t) ((smear[2] - time0) / timeBinSize);
+          smear[2] = (Int_t) ((time0 - smear[2]) / timeBinSize);
 
           // Add the smeared cluster to the output array 
-          Int_t detector  = recPoint1->GetDetector();
-          Int_t digits[3] = {0};
-          trd->AddRecPoint(smear,digits,detector,0.0);
+          Int_t   detector  = recPoint1->GetDetector();
+         Int_t   tr[9]     = { -1   };
+          Float_t pos[3];
+          Float_t sigma[2]  = {  0.0 };
+          pos[0] = smear[1];
+          pos[1] = smear[0];
+          pos[2] = (time0 - smear[2]) / timeBinSize;
+          AddCluster(pos,detector,0.0,tr,sigma,0);
 
        }
 
@@ -291,7 +298,7 @@ Bool_t AliTRDclusterizerV0::MakeCluster()
   }
 
   printf("AliTRDclusterizerV0::MakeCluster -- ");
-  printf("Found %d points.\n",trd->RecPoints()->GetEntries());
+  printf("Found %d points.\n",RecPoints()->GetEntries());
   printf("AliTRDclusterizerV0::MakeCluster -- ");
   printf("Fill the cluster tree.\n");
   clusterTree->Fill();