New AliTRDcluster constructor
authorcblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 20 Jun 2007 09:41:31 +0000 (09:41 +0000)
committercblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 20 Jun 2007 09:41:31 +0000 (09:41 +0000)
TRD/AliTRDcluster.cxx
TRD/AliTRDcluster.h
TRD/AliTRDclusterizer.cxx
TRD/AliTRDclusterizer.h
TRD/AliTRDclusterizerV1.cxx
TRD/AliTRDtrackingAnalysis.cxx

index 279733c..9309cfd 100644 (file)
@@ -46,9 +46,37 @@ AliTRDcluster::AliTRDcluster()
 
 }
 
+//___________________________________________________________________________
+AliTRDcluster::AliTRDcluster(Int_t det, Float_t q
+                           , Float_t *pos, Float_t *sig
+                           , Int_t *tracks, Char_t npads, Short_t *signals
+                           , UChar_t col, Char_t timebin
+                          , Float_t center, UShort_t volid)
+  :AliCluster(volid,pos[2],pos[0],pos[1],sig[0],sig[1],0.0,0x0) 
+  ,fDetector(det)
+  ,fTimeBin(timebin)
+  ,fQ(q)
+  ,fNPads(npads)
+  ,fCenter(center)
+  ,fPad(col)
+{ 
+  //
+  // Constructor
+  //
+
+  for (Int_t i = 0; i < 7; i++) {
+    fSignals[i] = signals[i];
+  }
+
+  if (tracks) {
+    AddTrackIndex(tracks);
+  }
+
+}
+
 //_____________________________________________________________________________
 AliTRDcluster::AliTRDcluster(const AliTRDcluster &c)
-  :AliCluster()
+  :AliCluster(c)
   ,fDetector(c.fDetector)
   ,fTimeBin(c.fTimeBin)
   ,fQ(c.fQ)
@@ -155,19 +183,6 @@ void AliTRDcluster::AddTrackIndex(Int_t *track)
 }          
 
 //_____________________________________________________________________________
-void AliTRDcluster::SetSignals(Short_t *signals)
-{
-  //
-  // Write signals in the cluster
-  //
-
-  for (Int_t i = 0; i < 7; i++) {
-    fSignals[i] = signals[i];
-  }
-
-}
-
-//_____________________________________________________________________________
 Float_t AliTRDcluster::GetSumS() const
 {
   //
index 0c369f3..5090053 100644 (file)
@@ -18,33 +18,18 @@ class AliTRDcluster : public AliCluster {
  public:
 
   AliTRDcluster();
+  AliTRDcluster(Int_t det, Float_t q, Float_t *pos, Float_t *sig
+              , Int_t *tracks, Char_t npads, Short_t *signals
+              , UChar_t col, Char_t timebin
+              , Float_t center, UShort_t volid);
   AliTRDcluster(const AliTRDcluster &c);
 
   virtual void     AddTrackIndex(Int_t *i); 
 
           Int_t    IsUsed() const               { return (fQ < 0) ? 1 : 0;    }
           void     Use(Int_t = 0)               { fQ = -fQ;                   }
-  
-          Bool_t   From2pad() const             { return TestBit(k2pad);      }
-          Bool_t   From3pad() const             { return TestBit(k3pad);      }
-          Bool_t   From4pad() const             { return TestBit(k4pad);      }
-          Bool_t   From5pad() const             { return TestBit(k5pad);      }
-          Bool_t   FromLarge() const            { return TestBit(kLarge);     }
-          Bool_t   Isolated() const             { return (TestBit(k2pad) || TestBit(k3pad)); }
-  virtual void     SetDetector(Int_t d)         { fDetector = d;    } 
-          void     SetLocalTimeBin(Int_t t)     { fTimeBin  = t;    }
-          void     SetQ(Float_t q)              { fQ        = q;    }
-          void     SetCenter(Float_t c)         { fCenter   = c;    }
-         void     SetPad(UChar_t pad)          { fPad      = pad;  }
-          void     SetSignals(Short_t *signals);
-          void     Set2pad()                    { SetBit(k2pad);  fNPads = 2; }
-          void     Set3pad()                    { SetBit(k3pad);  fNPads = 3; }
-          void     Set4pad()                    { SetBit(k4pad);  fNPads = 4; }
-          void     Set5pad()                    { SetBit(k5pad);  fNPads = 5; }
-          void     SetLarge()                   { SetBit(kLarge); fNPads = 6; }
-  
-  virtual Int_t    GetDetector() const          { return fDetector; }
+    
+          Int_t    GetDetector() const          { return fDetector; }
           Int_t    GetLocalTimeBin() const      { return fTimeBin;  }
           Float_t  GetQ() const                 { return fQ;        }
           Int_t    GetNPads() const             { return fNPads;    }
@@ -54,14 +39,6 @@ class AliTRDcluster : public AliCluster {
           Float_t  GetSumS() const;
 
  protected:
-
-          enum {
-            k2pad  = 0x00000001,   //  2 pad cluster
-            k3pad  = 0x00000002,   //  3 pad cluster
-            k4pad  = 0x00000004,   //  4 pad cluster
-            k5pad  = 0x00000008,   //  5 pad cluster
-            kLarge = 0x00000016    //  Large cluster
-          };
   
           Int_t   fDetector;       //  TRD detector number
           Char_t  fTimeBin;        //  Time bin number within the detector
@@ -74,6 +51,4 @@ class AliTRDcluster : public AliCluster {
   ClassDef(AliTRDcluster,4)        //  Cluster for the TRD
  
 };
-
-
 #endif
index 618cab4..4f493ba 100644 (file)
@@ -267,60 +267,6 @@ Bool_t AliTRDclusterizer::WriteClusters(Int_t det)
   
 }
 
-
-//_____________________________________________________________________________
-AliTRDcluster* AliTRDclusterizer::AddCluster(Double_t *pos, Int_t timebin
-                                           , Int_t det, Double_t amp
-                                          , Int_t *tracks, Double_t *sig
-                                           , Int_t iType, Int_t col
-                                          , UShort_t volid
-                                           , Float_t center)
-{
-  //
-  // Add a cluster for the TRD
-  //
-
-  AliTRDcluster *c = new AliTRDcluster();
-
-  c->SetDetector(det);
-  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(timebin);
-  c->SetCenter(center);
-  c->SetPad(col);
-  c->SetVolumeId(volid);
-
-  if (tracks) {
-    c->AddTrackIndex(tracks);
-  }
-
-  switch (iType) {
-  case 0:
-    c->Set2pad();
-    break;
-  case 1:
-    c->Set3pad();
-    break;
-  case 2:
-    c->Set4pad();
-    break;
-  case 3:
-    c->Set5pad();
-    break;
-  case 4:
-    c->SetLarge();
-    break;
-  };
-
-  RecPoints()->Add(c);
-  return c;
-
-}
-
 //_____________________________________________________________________________
 Double_t AliTRDclusterizer::CalcXposFromTimebin(Float_t timebin, Int_t idet
                                               , Int_t col, Int_t row)
@@ -365,7 +311,7 @@ void AliTRDclusterizer::ResetRecPoints()
 }
 
 //_____________________________________________________________________________
-TObjArray* AliTRDclusterizer::RecPoints() 
+TObjArray *AliTRDclusterizer::RecPoints() 
 {
   //
   // Returns the list of rec points
index 955dc51..5a53aaa 100644 (file)
@@ -40,13 +40,7 @@ class AliTRDclusterizer : public TNamed {
   virtual Bool_t   MakeClusters() = 0;
   virtual Bool_t   WriteClusters(Int_t det);
           void     ResetRecPoints();
-
-          TObjArray     *RecPoints();
-  virtual AliTRDcluster *AddCluster(Double_t *pos, Int_t timebin, Int_t det
-                                  , Double_t amp, Int_t *tracks
-                                 , Double_t *sig, Int_t iType
-                                  , Int_t col, UShort_t volid
-                                  , Float_t center = 0);
+  TObjArray       *RecPoints();
 
  protected:
 
index 76ac457..9c91861 100644 (file)
@@ -190,12 +190,6 @@ Bool_t AliTRDclusterizerV1::MakeClusters()
   AliTRDdataArrayI *digitsIn;
   AliTRDdataArrayI *tracksIn;
 
-  // Get the geometry
-  //AliTRDgeometry *geo            = AliTRDgeometry::GetGeometry(fRunLoader);  
-  //if (!geo) {
-  //  AliWarning("Creating default TRD geometry!");
-  //  geo = new AliTRDgeometry();
-  //}
   AliTRDgeometry geo;
 
   AliTRDcalibDB  *calibration    = AliTRDcalibDB::Instance();
@@ -235,7 +229,6 @@ Bool_t AliTRDclusterizerV1::MakeClusters()
   const Int_t   kNdict   = AliTRDdigitsManager::kNDict;
   const Int_t   kNtrack  = kNdict * kNclus;
 
-  Int_t    iType         = 0;
   Int_t    iUnfold       = 0;  
   Double_t ratioLeft     = 1.0;
   Double_t ratioRight    = 1.0;
@@ -254,8 +247,6 @@ Bool_t AliTRDclusterizerV1::MakeClusters()
   Int_t    sectEnd    = AliTRDgeometry::Nsect();
   Int_t    nTimeTotal = calibration->GetNumberOfTimeBins();
 
-  Int_t    dummy[9]   = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
-
   AliDebug(1,Form("Number of Time Bins = %d.\n",nTimeTotal));
 
   // Start clustering in every chamber
@@ -293,11 +284,6 @@ Bool_t AliTRDclusterizerV1::MakeClusters()
         Float_t       calGainFactorDetValue = calGainFactorDet->GetValue(idet);
 
         Int_t nClusters      = 0;
-        Int_t nClusters2pad  = 0;
-        Int_t nClusters3pad  = 0;
-        Int_t nClusters4pad  = 0;
-        Int_t nClusters5pad  = 0;
-        Int_t nClustersLarge = 0;
 
        // Apply the gain and the tail cancelation via digital filter
         AliTRDdataArrayF *digitsOut = new AliTRDdataArrayF(digitsIn->GetNrow()
@@ -379,28 +365,6 @@ Bool_t AliTRDclusterizerV1::MakeClusters()
                   if (col+ii+1 >= nColMax) break;
                }
                 nClusters++;
-                switch (nPadCount) {
-                case 2:
-                  iType = 0;
-                  nClusters2pad++;
-                  break;
-                case 3:
-                  iType = 1;
-                  nClusters3pad++;
-                  break;
-                case 4:
-                  iType = 2;
-                  nClusters4pad++;
-                  break;
-                case 5:
-                  iType = 3;
-                  nClusters5pad++;
-                  break;
-                default:
-                  iType = 4;
-                  nClustersLarge++;
-                  break;
-               };
 
                // Look for 5 pad cluster with minimum in the middle
                 Bool_t fivePadCluster = kFALSE;
@@ -425,7 +389,6 @@ Bool_t AliTRDclusterizerV1::MakeClusters()
                // of the cluster which remains from a previous unfolding
                 if (iUnfold) {
                   clusterSignal[0] *= ratioLeft;
-                  iType   = 5;
                   iUnfold = 0;
                }
 
@@ -441,7 +404,6 @@ Bool_t AliTRDclusterizerV1::MakeClusters()
                   ratioRight        = Unfold(kEpsilon,iplan,padSignal);
                   ratioLeft         = 1.0 - ratioRight; 
                   clusterSignal[2] *= ratioRight;
-                  iType   = 5;
                   iUnfold = 1;
                 }
 
@@ -493,30 +455,17 @@ Bool_t AliTRDclusterizerV1::MakeClusters()
 
                 // Correct for t0 (sum of chamber and pad wise values !!!)
                 Float_t  calT0ROCValue  = calT0ROC->GetValue(col,row);
-               Int_t    clusterTimeBin = TMath::Nint(time - (calT0DetValue + calT0ROCValue));
+               Char_t   clusterTimeBin = ((Char_t) TMath::Nint(time - (calT0DetValue + calT0ROCValue)));
                 Double_t colSize        = padPlane->GetColSize(col);
                 Double_t rowSize        = padPlane->GetRowSize(row);
 
-                Double_t clusterPos[3];
+                Float_t clusterPos[3];
                clusterPos[0] = padPlane->GetColPos(col) - (clusterPads[1] + 0.5) * colSize;
                clusterPos[1] = padPlane->GetRowPos(row) - 0.5                    * rowSize;
                 clusterPos[2] = CalcXposFromTimebin(clusterPads[2],idet,col,row);
-                Double_t clusterSig[2];
+                Float_t clusterSig[2];
                 clusterSig[0] = (clusterSigmaY2 + 1.0/12.0) * colSize*colSize;
                 clusterSig[1] = rowSize * rowSize / 12.0;                                       
-                
-                // Add the cluster to the output array
-               // The track indices will be stored later 
-                AliTRDcluster *cluster = AddCluster(clusterPos
-                                                   ,clusterTimeBin
-                                                   ,idet
-                                                  ,clusterCharge
-                                                  ,dummy
-                                                  ,clusterSig
-                                                  ,iType
-                                                   ,col
-                                                  ,volid
-                                                  ,clusterPads[1]);
                
                // Store the amplitudes of the pads in the cluster for later analysis
                Short_t signals[7] = { 0, 0, 0, 0, 0, 0, 0 };
@@ -527,13 +476,26 @@ Bool_t AliTRDclusterizerV1::MakeClusters()
                  }
                  signals[jPad-col+3] = TMath::Nint(TMath::Abs(digitsOut->GetDataUnchecked(row,jPad,time)));
                }
-               cluster->SetSignals(signals);
 
+                // Add the cluster to the output array
+               // The track indices will be stored later 
+                AliTRDcluster *cluster = new AliTRDcluster(idet
+                                                          ,clusterCharge
+                                                          ,clusterPos
+                                                          ,clusterSig
+                                                          ,0x0
+                                                         ,((Char_t) nPadCount)
+                                                          ,signals
+                                                         ,((UChar_t) col)
+                                                          ,clusterTimeBin
+                                                          ,clusterPads[1]
+                                                          ,volid);
                // Temporarily store the row, column and time bin of the center pad
                // Used to later on assign the track indices
                 cluster->SetLabel( row,0);
                 cluster->SetLabel( col,1);
                 cluster->SetLabel(time,2);
+                RecPoints()->Add(cluster);
 
                // Store the index of the first cluster in the current ROC
                 if (firstClusterROC < 0) {
index dd7758e..696a833 100644 (file)
@@ -448,8 +448,8 @@ void  AliTRDtrackingAnalysis::DrawRecPointResolution(int startEvent, int stopEve
        double dy = dz * h01;
        double yy = cls->GetY() - dy;
                
-       if (cls->From2pad()) fClY2->Fill(10 * (yy - yref));
-       if (cls->From3pad()) fClY3->Fill(10 * (yy - yref));
+       if (cls->GetNPads() == 2) fClY2->Fill(10 * (yy - yref));
+       if (cls->GetNPads() == 3) fClY3->Fill(10 * (yy - yref));
 
        int idx = GetPhiBin(tgphi);
        if (idx >= 0 && idx < 12) fClYTgPhi[idx]->Fill(10 * (yy - yref));