Move old trigger code to attic
authorcblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 5 May 2009 15:56:40 +0000 (15:56 +0000)
committercblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 5 May 2009 15:56:40 +0000 (15:56 +0000)
TRD/attic/AliTRDgtuTrack.cxx [new file with mode: 0644]
TRD/attic/AliTRDgtuTrack.h [new file with mode: 0644]
TRD/attic/AliTRDltuTracklet.cxx [new file with mode: 0644]
TRD/attic/AliTRDltuTracklet.h [new file with mode: 0644]
TRD/attic/AliTRDmcm.cxx [new file with mode: 0644]
TRD/attic/AliTRDmcm.h [new file with mode: 0644]
TRD/attic/AliTRDtrapAlu.cxx [new file with mode: 0644]
TRD/attic/AliTRDtrapAlu.h [new file with mode: 0644]
TRD/attic/AliTRDtrigParam.cxx [new file with mode: 0644]
TRD/attic/AliTRDtrigParam.h [new file with mode: 0644]

diff --git a/TRD/attic/AliTRDgtuTrack.cxx b/TRD/attic/AliTRDgtuTrack.cxx
new file mode 100644 (file)
index 0000000..abc88fe
--- /dev/null
@@ -0,0 +1,609 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id: AliTRDgtuTrack.cxx 29149 2008-10-08 15:09:38Z abercuci $ */
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+//                                                                           //
+//  TRD module global track (GTU)                                            //
+//                                                                           //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+#include <TMath.h>
+#include <TMatrixD.h>
+#include <TObjArray.h>
+
+#include "AliLog.h"
+
+//#include "AliTRDReconstructor.h"
+//#include "AliTRDcalibDB.h"
+#include "AliTRDgeometry.h"
+#include "AliTRDltuTracklet.h"
+#include "AliTRDgtuTrack.h"
+#include "Cal/AliTRDCalPID.h"
+
+ClassImp(AliTRDgtuTrack)
+
+//_____________________________________________________________________________
+AliTRDgtuTrack::AliTRDgtuTrack()
+  :TObject()
+  ,fTracklets(new TObjArray(400))
+  ,fYproj(0)
+  ,fZproj(0)
+  ,fSlope(0)
+  ,fDetector(-1)
+  ,fNtracklets(0)
+  ,fNplanes(0)
+  ,fNclusters(0)
+  ,fPt(0)
+  ,fPhi(0)
+  ,fEta(0)
+  ,fLabel(-1)
+  ,fPID(0)
+  ,fIsElectron(kFALSE)
+{
+  //
+  // Default constructor
+  //
+
+}
+
+//_____________________________________________________________________________
+AliTRDgtuTrack::AliTRDgtuTrack(const AliTRDgtuTrack &t)
+  :TObject(t)
+  ,fTracklets(NULL)
+  ,fYproj(t.fYproj)
+  ,fZproj(t.fZproj)
+  ,fSlope(t.fSlope)
+  ,fDetector(t.fDetector)
+  ,fNtracklets(t.fNtracklets)
+  ,fNplanes(t.fNplanes)
+  ,fNclusters(t.fNclusters)
+  ,fPt(t.fPt)
+  ,fPhi(t.fPhi)
+  ,fEta(t.fEta)
+  ,fLabel(t.fLabel)
+  ,fPID(t.fPID)
+  ,fIsElectron(t.fIsElectron)
+{
+  //
+  // Copy contructor
+  //
+
+}
+
+//_____________________________________________________________________________
+AliTRDgtuTrack &AliTRDgtuTrack::operator=(const AliTRDgtuTrack &t)
+{
+  //
+  // Assignment operator
+  //
+
+  if (this != &t) ((AliTRDgtuTrack &) t).Copy(*this); 
+
+  return *this;
+
+} 
+
+//_____________________________________________________________________________
+void AliTRDgtuTrack::Copy(TObject &t) const
+{
+  //
+  // Copy function
+  //
+
+  ((AliTRDgtuTrack &) t).fTracklets  = NULL;
+  ((AliTRDgtuTrack &) t).fYproj      = fYproj;
+  ((AliTRDgtuTrack &) t).fZproj      = fZproj;
+  ((AliTRDgtuTrack &) t).fSlope      = fSlope;
+  ((AliTRDgtuTrack &) t).fDetector   = fDetector;
+  ((AliTRDgtuTrack &) t).fNtracklets = fNtracklets;
+  ((AliTRDgtuTrack &) t).fNplanes    = fNplanes;
+  ((AliTRDgtuTrack &) t).fNclusters  = fNclusters;
+  ((AliTRDgtuTrack &) t).fPt         = fPt;
+  ((AliTRDgtuTrack &) t).fPhi        = fPhi;
+  ((AliTRDgtuTrack &) t).fEta        = fEta;
+  ((AliTRDgtuTrack &) t).fLabel      = fLabel;
+  ((AliTRDgtuTrack &) t).fPID        = fPID;
+  ((AliTRDgtuTrack &) t).fIsElectron = fIsElectron;
+
+}
+
+//_____________________________________________________________________________
+AliTRDgtuTrack::~AliTRDgtuTrack()
+{
+  //
+  // Destructor
+  //
+
+  if (fTracklets) {
+    //fTracklets->Delete();
+    fTracklets->Clear();
+    delete fTracklets;
+    fTracklets = 0;
+  }
+
+}
+
+//_____________________________________________________________________________
+void AliTRDgtuTrack::AddTracklet(AliTRDltuTracklet *trk)
+{
+  //
+  // Add a LTU tracklet to this track
+  //
+
+  Tracklets()->Add(trk);
+
+}
+
+//_____________________________________________________________________________
+AliTRDltuTracklet *AliTRDgtuTrack::GetTracklet(Int_t pos) const
+{
+  //
+  // Return LTU tracklet at position "pos"
+  //
+
+  if (fTracklets == 0) {
+    return 0;
+  }
+  void *trk = fTracklets->UncheckedAt(pos);
+  if (trk == 0) {
+    return 0;
+  }
+
+  return (AliTRDltuTracklet *) trk;
+
+}
+
+//_____________________________________________________________________________
+Int_t AliTRDgtuTrack::Compare(const TObject *o) const
+{
+  //
+  // Compare function for sorting the tracks
+  //
+
+  AliTRDgtuTrack *gtutrack = (AliTRDgtuTrack *) o;
+
+  if (fYproj <  gtutrack->GetYproj()) {
+    return -1;
+  }
+  if (fYproj == gtutrack->GetYproj()) {
+    return  0;
+  }
+
+  return +1;
+
+}
+
+//_____________________________________________________________________________
+void AliTRDgtuTrack::Reset()
+{
+  //
+  // Reset the track information
+  //
+
+  fYproj      = 0.0;
+  fZproj      = 0.0;
+  fSlope      = 0.0;
+  fDetector   = -1;
+  fNtracklets = 0;
+  fNplanes    = 0;
+  fNclusters  = 0;
+  fPt         = 0.0;
+  fPhi        = 0.0;
+  fEta        = 0.0;
+  fLabel      = -1;
+  fPID        = 0.0;
+  fIsElectron = kFALSE;
+  
+}
+
+//_____________________________________________________________________________
+void AliTRDgtuTrack::Track(Float_t xpl, Float_t field)
+{
+  //
+  // Calculate the kinematics of the found track
+  //
+
+  Int_t  i    = 0;
+  Int_t  iDet = 0;
+  Int_t  nDet = 0;
+  Bool_t newDetector;
+
+  AliTRDltuTracklet *trk;
+  Int_t nTracklets = GetNtracklets();
+  Float_t fC[kNmaxTrk][3];            // X, Y, Z  coordinates of segments
+
+  fYproj      = 0.0;
+  fZproj      = 0.0;
+  fSlope      = 0.0;
+  fNclusters  = 0;
+  fNplanes    = 0;
+  fNtracklets = GetNtracklets();
+  Int_t inDetector[kNlayer];
+  for (i = 0; i < kNlayer; i++) {
+    inDetector[i] = -1;
+  }
+
+  for (i = 0; i < nTracklets; i++) {
+
+    trk         = GetTracklet(i);
+    fYproj     += trk->GetYproj(xpl);
+    fZproj     += trk->GetZproj(xpl);
+    fSlope     += trk->GetSlope();
+    fNclusters += trk->GetNclusters();
+    iDet        = trk->GetDetector();
+
+    newDetector = kTRUE;
+    for (Int_t id = 0; id < nDet; id++) {
+      if (iDet == inDetector[id]) {
+       newDetector = kFALSE;
+       break;
+      }
+    }
+    if (newDetector) {
+      inDetector[nDet++] = iDet;
+      fNplanes++;
+    }
+
+    fC[i][0] = trk->GetTime0();
+    fC[i][1] = trk->GetOffset();
+    fC[i][2] = trk->GetRowz();
+
+  }
+  fYproj /= (Float_t) nTracklets;
+  fZproj /= (Float_t) nTracklets;
+  fSlope /= (Float_t) nTracklets;
+
+  Float_t x[kNmaxTrk+1];
+  Float_t y[kNmaxTrk+1];
+  Float_t z[kNmaxTrk+1];
+  Bool_t  count[kNmaxTrk];
+  for (i = 0; i < kNmaxTrk; i++) {
+    count[i] = kFALSE;
+  }
+
+  Int_t iXmin = -1;
+  Int_t j     =  0;
+  x[0] = y[0] = z[0] = 0.0;
+  while (j < nTracklets) {
+    iXmin = -1;
+    for (i = 0; i < nTracklets; i++) {
+      if (count[i]) continue;
+      if (iXmin == -1) {
+       iXmin = i;
+       continue;
+      }
+      if (fC[i][0] < fC[iXmin][0]) {
+        iXmin = i;
+      }
+    }
+    x[j+1] = fC[iXmin][0];
+    y[j+1] = fC[iXmin][1];
+    z[j+1] = fC[iXmin][2];
+    j++;
+    count[iXmin] = kTRUE;
+  }
+
+  TMatrixD smatrix(2,2);
+  TMatrixD sums(2,1);
+  TMatrixD res(2,1);
+  Double_t xv, yv;
+  Float_t a, b;
+
+  smatrix.Zero();
+  sums.Zero();
+  for (i = 0; i < nTracklets; i++) {
+    xv = (Double_t) x[i+1];
+    yv = (Double_t) y[i+1];
+    smatrix(0,0) += 1.0;
+    smatrix(1,1) += xv*xv;
+    smatrix(0,1) += xv;
+    smatrix(1,0) += xv;
+    sums(0,0)    += yv;
+    sums(1,0)    += xv*yv;
+  }
+  res = smatrix.Invert() * sums;
+  a   = res(0,0);
+  b   = res(1,0);
+
+  Float_t dist  = AliTRDgeometry::GetTime0(1) - AliTRDgeometry::GetTime0(0);
+  Float_t fx1   = x[1]          + dist * (Float_t) (nTracklets-1) / 6.0;
+  Float_t fy1   = a + b * fx1;
+  Float_t fx2   = x[nTracklets] - dist * (Float_t) (nTracklets-1) / 6.0;
+  Float_t fy2   = a + b * fx2;
+  Float_t d12   = TMath::Sqrt((fx2-fx1)*(fx2-fx1)+(fy2-fy1)*(fy2-fy1));
+  Float_t alpha = TMath::ATan(fy2/fx2) - TMath::ATan(fy1/fx1);
+  Float_t r     = (d12 / 2.0) / TMath::Sin(alpha);
+
+  fPt = 0.3 * field * 0.01 * r;
+
+  Float_t d1 = fx1*fx1 + fy1*fy1;
+  Float_t d2 = fx2*fx2 + fy2*fy2;
+  Float_t d  = fx1*fy2 - fx2*fy1;
+  
+  Float_t xc = (d1*fy2 - d2*fy1) / (2.0*d);
+  Float_t yc = (d2*fx1 - d1*fx2) / (2.0*d);
+
+  if (yc != 0.0) {
+    fPhi = TMath::ATan(xc/yc);
+  } 
+  else {
+    fPhi = TMath::PiOver2();
+  }
+
+  fPhi *= 180.0/TMath::Pi();
+
+  smatrix.Zero();
+  sums.Zero();
+  for (i = 0; i < nTracklets+1; i++) {
+    xv = (Double_t) z[i];
+    yv = (Double_t) x[i];
+    smatrix(0,0) += 1.0;
+    smatrix(1,1) += xv*xv;
+    smatrix(0,1) += xv;
+    smatrix(1,0) += xv;
+    sums(0,0)    += yv;
+    sums(1,0)    += xv*yv;
+  }
+  res = smatrix.Invert() * sums;
+  a   = res(0,0);
+  b   = res(1,0);
+  Float_t theta = TMath::ATan(b);
+  
+  if (theta < 0.0) {
+    theta = TMath::Pi() + theta;
+  }
+  if (theta == 0.0) {
+    fEta = 0.0;
+  } 
+  else {
+    fEta = -TMath::Log(TMath::Tan(theta/2.0));
+  }
+  
+}
+
+//_____________________________________________________________________________
+void AliTRDgtuTrack::MakePID()
+{
+  //
+  // Electron likelihood signal
+  //
+
+  Int_t i = 0;
+
+  // Avoid dependency on libTRDrec.pkg (CBL)
+  //AliTRDcalibDB *calibration = AliTRDcalibDB::Instance();
+  //if (!calibration) {
+  //  AliError("No instance of AliTRDcalibDB.");
+  //  return;  
+  //}
+  //
+  //AliTRDrecoParam *rec = AliTRDReconstructor::RecoParam();
+  //if (!rec) {
+  //  AliError("No TRD reco param.");
+  //  return;
+  //}
+  //const AliTRDCalPID *pd = calibration->GetPIDObject(rec->GetPIDMethod());
+
+  AliTRDltuTracklet *trk;
+  Int_t   nTracklets = GetNtracklets();
+  Int_t   det;
+  Int_t   pla;
+  Float_t sl;
+  Float_t th;
+  Float_t q;
+  Float_t probPio = 1.0;
+  Float_t probEle = 1.0;
+
+  for (i = 0; i < nTracklets; i++) {
+
+    trk = GetTracklet(i);
+
+    sl  = TMath::Abs(trk->GetSlope());     // Tracklet inclination in X-y plane
+    th  = trk->GetRowz()/trk->GetTime0();  // Tracklet inclination in X-z plane
+    th  = TMath::ATan(TMath::Abs(th));
+
+    q   = trk->GetQ() 
+        * TMath::Cos(sl/180.0*TMath::Pi()) 
+        * TMath::Cos(th/180.0*TMath::Pi());
+
+    det = trk->GetDetector();
+    pla = trk->GetPlane(det);
+
+    // Unclear yet factor to match the PS distributions = 5.8
+    // not explained only by the tail filter ...
+    // AliRoot v4-03-07 , v4-03-Release
+    //q = q * 5.8;
+
+    // HEAD28Mar06
+    // Temporary (B. Vulpescu):
+    // The charge distributions do not match the new changes in simulation (A. Bercuci),
+    // which are nevertheless now in agreement with the beam tests.
+    // Some tricks will be used to still have reasonable results
+    // To match the existing charge distributions, the charge per layer has to be modified
+    // as folows:
+    /*
+      if (k == 0) {
+      // electrons
+      q = 4.3 * q + 95.0;
+      } else {
+      // others
+      q = 4.2 * q + 70.0;
+      }
+    */
+    // Since at tracking time we have no information on the particle type, we will modify
+    // instead the charge distributions accordingly. This will slow down the sampling.
+    // The modified distributions are in TRDdEdxHistogramsV1_BV.root and the CDB has
+    // been regenerated with AliTRDCreateDummyCDB.C
+    // The new PIDLQ data base has the version :
+    // I-AliCDBLocal::Get: CDB object retrieved: path "TRD/Calib/PIDLQ"; run range [0,0];
+    // version v0_s1
+
+    // HEAD28Mar06 new distributions: factor = 6.0
+
+               // A.Bercuci on 2nd May 2007
+               // Temporary modification to deal with more energy slices. The values
+               // attached to charge slices and track length are dummy
+                Float_t dedx[3];
+                dedx[0] = dedx[1] = q*3.; dedx[2] = 0.;
+                //Float_t length = 3.7;
+
+    //probEle *= pd->GetProbability(0, TMath::Abs(fPt), dedx, length, 0);
+    //probPio *= pd->GetProbability(2, TMath::Abs(fPt), dedx, length, 0);
+
+  }
+
+  if ((probEle + probPio) > 0.0) {
+    fPID = probEle/(probEle + probPio);
+  } 
+  else {
+    fPID = 0.0;
+  }
+
+  // Thresholds for LQ cut at 90% electron efficiency (from AliRoot v4-03-07)
+  // P [GeV/c]  fPIDcut (between 0 and 1)
+  // 2          0.925
+  // 3          0.915
+  // 4          0.875
+  // 5          0.855
+  // 6          0.845
+  // 8          0.785
+  // 10         0.735
+  //
+  // PIDcut = 0.978 - 0.024 * P[GeV/c]
+  //Float_t PIDcut = 0.978 - 0.024 * TMath::Abs(fPt);
+
+  // HEAD28Mar06 with modified distributions (A. Bercuci changes, P. Shukla distributions)
+  //Float_t fPIDcut = 0.829 - 0.032 * TMath::Abs(fPt);
+
+  // HEAD28Mar06 with new generated distributions (pol2 fit)
+  Float_t absPt   = TMath::Abs(fPt);
+  //Float_t fPIDcut = 0.9575 - 0.0832 * absPt + 0.0037 * absPt*absPt;  // 800 bins in dEdx
+  Float_t fPIDcut = 0.9482 - 0.0795 * absPt + 0.0035 * absPt*absPt;    // 200 bins in dEdx
+
+  fIsElectron = kFALSE;
+  if (fPID >= fPIDcut) {
+    fIsElectron = kTRUE;
+  }
+
+}
+
+//_____________________________________________________________________________
+void AliTRDgtuTrack::CookLabel()
+{
+  //
+  // Cook the track label from tracklets labels
+  //
+
+  AliTRDltuTracklet *trk;
+
+  const Int_t kMaxTracks = 10;
+  Int_t trackLabel[kMaxTracks];
+  Int_t trackCount[kMaxTracks];
+  for (Int_t it = 0; it < kMaxTracks; it++) {
+    trackLabel[it] = -1;
+    trackCount[it] =  0;
+  }
+
+  Bool_t counted;
+  Int_t  label;
+  Int_t  nTracks = 0;
+  for (Int_t itrk = 0; itrk < fNtracklets; itrk++) {
+
+    trk = GetTracklet(itrk);
+
+    if (trk->GetLabel() == -1) {
+      continue;
+    }
+
+    label = trk->GetLabel();
+
+    counted = kFALSE;
+    for (Int_t it = 0; it < nTracks; it++) {
+      if (label == trackLabel[it]) {
+       trackCount[it]++;
+       counted = kTRUE;
+       break;
+      }
+    }
+    if (!counted) {
+      trackLabel[nTracks] = label;
+      trackCount[nTracks]++;
+      nTracks++;
+      if (nTracks == kMaxTracks) {
+       Warning("CookLabel","Too many tracks for this tracklet.");
+       nTracks--;
+       break;
+      }
+    }
+    
+  }
+
+  Float_t frac = 4.0 / 5.0;
+  for (Int_t it = 0; it < kMaxTracks; it++) {
+    if (trackCount[it] >= (Int_t) (frac*fNtracklets)) {
+      fLabel = trackLabel[it];
+      break;
+    }
+  }
+
+}
+
+//_____________________________________________________________________________
+void AliTRDgtuTrack::ResetTracklets() 
+{ 
+  //
+  // Resets the list of tracklets
+  //
+
+  if (fTracklets) {
+    //fTracklets->Delete(); 
+    fTracklets->Clear();
+  }
+
+}
+
+//_____________________________________________________________________________
+TObjArray *AliTRDgtuTrack::Tracklets() 
+{ 
+  //
+  // Returns the list of tracklets
+  //
+
+  if (!fTracklets) {
+    fTracklets = new TObjArray(400); 
+  }
+
+  return fTracklets; 
+
+}
+
+//_____________________________________________________________________________
+Int_t AliTRDgtuTrack::GetNtracklets() const 
+{
+  //
+  // Returns the number of tracklets
+  //
+
+  if (fTracklets) {
+    return fTracklets->GetEntriesFast();
+  }
+
+  return 0;
+
+}
diff --git a/TRD/attic/AliTRDgtuTrack.h b/TRD/attic/AliTRDgtuTrack.h
new file mode 100644 (file)
index 0000000..e2f86f7
--- /dev/null
@@ -0,0 +1,84 @@
+#ifndef ALITRDGTUTRACK_H
+#define ALITRDGTUTRACK_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id: AliTRDgtuTrack.h 26344 2008-06-03 10:28:50Z cblume $ */
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+//  TRD module global track (GTU)                                            //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+#include <TObject.h>
+
+class AliTRDltuTracklet;
+
+class AliTRDgtuTrack : public TObject {
+
+ public:
+
+  enum { kNmaxTrk = 12, kNlayer = 6 };
+
+  AliTRDgtuTrack();
+  AliTRDgtuTrack(const AliTRDgtuTrack &t);
+  virtual         ~AliTRDgtuTrack();
+  AliTRDgtuTrack  &operator=(const AliTRDgtuTrack &t);
+
+  virtual void     Copy(TObject &t) const;
+
+          Bool_t   IsSortable() const            { return kTRUE;       }
+  virtual Int_t    Compare(const TObject *o) const;
+          void     Reset();
+          void     ResetTracklets();
+          void     Track(Float_t xpl, Float_t field);
+          void     CookLabel();
+          void     SetDetector(Int_t det)        { fDetector = det;    };
+          void     MakePID();
+          void     AddTracklet(AliTRDltuTracklet *trk);
+          Int_t    GetNtracklets() const;
+
+          AliTRDltuTracklet *GetTracklet(Int_t pos) const;
+          TObjArray         *Tracklets(); 
+
+          Float_t  GetYproj() const              { return fYproj;      };
+          Float_t  GetZproj() const              { return fZproj;      };
+          Float_t  GetSlope() const              { return fSlope;      };
+          Int_t    GetTracklets() const          { return fNtracklets; };
+          Int_t    GetPlanes() const             { return fNplanes;    };
+          Int_t    GetClusters() const           { return fNclusters;  };
+          Float_t  GetPt() const                 { return fPt;         };
+          Float_t  GetPhi() const                { return fPhi;        };
+          Float_t  GetEta() const                { return fEta;        };
+          Int_t    GetLabel() const              { return fLabel;      };
+          Int_t    GetDetector() const           { return fDetector;   };
+          Float_t  GetPID() const                { return fPID;        };
+          Bool_t   IsElectron() const            { return fIsElectron; };
+
+ protected:
+
+          TObjArray  *fTracklets;                               //! Array of LTU tracklets
+
+          Float_t     fYproj;                                   //  Average y-projection
+          Float_t     fZproj;                                   //  Average z-projection
+          Float_t     fSlope;                                   //  Average slope 
+
+          Int_t       fDetector;                                //  First detector in the module
+
+          Int_t       fNtracklets;                              //  Number of tracklets
+          Int_t       fNplanes;                                 //  Number of TRD planes
+          Int_t       fNclusters;                               //  Total number of clusters
+
+          Float_t     fPt;                                      //  Transverse momentum
+          Float_t     fPhi;                                     //  Phi angle at the vertex
+          Float_t     fEta;                                     //  Eta at the vertex
+          Int_t       fLabel;                                   //  Track label
+          Float_t     fPID;                                     //  PID electron likelihood
+          Bool_t      fIsElectron;                              //  Electron flag
+
+  ClassDef(AliTRDgtuTrack,2)                                    //  TRD module global track (GTU)
+
+};
+
+#endif
diff --git a/TRD/attic/AliTRDltuTracklet.cxx b/TRD/attic/AliTRDltuTracklet.cxx
new file mode 100644 (file)
index 0000000..47bfe62
--- /dev/null
@@ -0,0 +1,155 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+//                                                                           //
+//  TRD chamber local track (LTU, tracklet)                                  //
+//                                                                           //
+//  Author:                                                                  //
+//    Bogdan Vulpescu                                                        //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+#include <TMath.h>
+
+#include "AliTRDltuTracklet.h"
+
+ClassImp(AliTRDltuTracklet)
+
+//_____________________________________________________________________________
+AliTRDltuTracklet::AliTRDltuTracklet()
+  :TObject()
+  ,fX(0)
+  ,fY(0)
+  ,fSlope(0)
+  ,fRowz(0)
+  ,fDetector(0)
+  ,fRow(0)
+  ,fNclusters(0)
+  ,fLabel(0)
+  ,fQ(0)
+{
+  //
+  // AliTRDltuTracklet default constructor
+  //
+
+}
+
+//_____________________________________________________________________________
+AliTRDltuTracklet::AliTRDltuTracklet(Int_t det, Int_t row, Float_t rowz
+                                  , Float_t slope, Float_t offset, Float_t time
+                                  , Int_t ncl, Int_t label, Float_t q) 
+  :TObject()
+  ,fX(time)
+  ,fY(offset)
+  ,fSlope(slope)
+  ,fRowz(rowz)
+  ,fDetector(det)
+  ,fRow(row)
+  ,fNclusters(ncl)
+  ,fLabel(label)
+  ,fQ(q)
+{
+  //
+  // AliTRDltuTracklet constructor
+  //
+
+}
+
+//_____________________________________________________________________________
+AliTRDltuTracklet::~AliTRDltuTracklet()
+{
+  //
+  // Destructor
+  //
+
+}
+
+//_____________________________________________________________________________
+Float_t AliTRDltuTracklet::GetPt(Float_t field) const
+{
+  //
+  // Transverse momentum calculation
+  // Curvature R = (fX*fX + fY*fY) / (2 * sin(alpha))
+  // alpha = angle deviation from "infinite momentum"
+  //
+  // Consistent with AliTRDmcmTracklet::GetPt(...)
+  //
+
+  Float_t infSlope = TMath::ATan(fY/fX) / TMath::Pi()*180.0;    
+  Float_t alpha    = fSlope - infSlope;
+  Float_t r        = TMath::Sqrt(fX*fX + fY*fY)
+                   / (2.0 * TMath::Sin(alpha/180.0*TMath::Pi()));
+  
+  Float_t pt       = 0.3 * field * 0.01 * r;
+  return pt;
+}
+
+//_____________________________________________________________________________
+Int_t AliTRDltuTracklet::Compare(const TObject *o) const
+{
+  //
+  // compare two LTU tracklets according to the intercept point Y1
+  //
+
+  AliTRDltuTracklet *ltutrk = (AliTRDltuTracklet *) o;
+
+  if (fRow      != ltutrk->fRow) {
+    return +1;
+  }
+  if (fDetector != ltutrk->fDetector) {
+    return +1;
+  }
+
+  if (fY <  ltutrk->fY) {
+    return -1;
+  }
+  if (fY == ltutrk->fY) {
+    return  0;
+  }
+
+  return 1;
+
+}
+
+//_____________________________________________________________________________
+Float_t AliTRDltuTracklet::GetYproj(Float_t xpl) const
+{
+  //
+  // y-projection (bending plane) onto the median plane
+  //
+
+  Float_t yproj = fY + TMath::Tan(fSlope/180.0*TMath::Pi()) * (xpl - fX);
+
+  return yproj;
+
+}
+
+//_____________________________________________________________________________
+Float_t AliTRDltuTracklet::GetZproj(Float_t xpl) const
+{
+  //
+  // z-projection (using pad row center) onto the median plane
+  //
+
+  Float_t zproj = fRowz * xpl / fX;
+
+  return zproj;
+
+}
+
diff --git a/TRD/attic/AliTRDltuTracklet.h b/TRD/attic/AliTRDltuTracklet.h
new file mode 100644 (file)
index 0000000..42668cc
--- /dev/null
@@ -0,0 +1,60 @@
+#ifndef ALITRDLTUTRACKLET_H
+#define ALITRDLTUTRACKLET_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id: AliTRDltuTracklet.h 14830 2006-08-11 17:58:05Z cblume $ */
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+//  TRD LTU tracklet                                                         //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+#include <TObject.h>
+
+class AliTRDltuTracklet : public TObject {
+  
+ public:
+
+  enum { kNplan = 6 };
+
+  AliTRDltuTracklet();
+  AliTRDltuTracklet(Int_t det, Int_t row, Float_t rowz, Float_t slope, Float_t offset
+                  ,Float_t time, Int_t ncl, Int_t label, Float_t q);
+  virtual         ~AliTRDltuTracklet();
+
+          Bool_t   IsSortable() const { return kTRUE; }
+  virtual Int_t    Compare(const TObject *o) const;
+
+          Int_t    GetDetector() const             { return fDetector;                };
+          Int_t    GetPlane(Int_t det) const       { return ((Int_t) (det % kNplan)); };
+          Int_t    GetRow() const                  { return fRow;                     };
+          Int_t    GetNclusters() const            { return fNclusters;               };
+          Float_t  GetSlope() const                { return fSlope;                   };
+          Float_t  GetOffset() const               { return fY;                       }; 
+          Float_t  GetTime0() const                { return fX;                       };
+          Float_t  GetRowz() const                 { return fRowz;                    };
+          Float_t  GetYproj(Float_t xpl) const;
+          Float_t  GetZproj(Float_t xpl) const;
+          Int_t    GetLabel() const                { return fLabel;                   };
+          Float_t  GetPt(Float_t field) const;
+          Float_t  GetQ() const                    { return fQ;                       };
+
+ protected:
+
+          Float_t  fX;                              // Distance vertex to entrance window
+          Float_t  fY;                              // Tracklet offset at entrance window
+          Float_t  fSlope;                          // Tracklet slope
+          Float_t  fRowz;                           // z coordinate of the pad row center
+          Int_t    fDetector;                       // Detector number
+          Int_t    fRow;                            // Pad row number 
+          Int_t    fNclusters;                      // Number of clusters
+          Int_t    fLabel;                          // MC track label
+          Float_t  fQ;                              // Charge sum divided by number of clusters
+
+  ClassDef(AliTRDltuTracklet,2)                     // LTU tracklet
+
+};
+
+#endif
diff --git a/TRD/attic/AliTRDmcm.cxx b/TRD/attic/AliTRDmcm.cxx
new file mode 100644 (file)
index 0000000..8183b5c
--- /dev/null
@@ -0,0 +1,907 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id: AliTRDmcm.cxx 29514 2008-10-26 10:24:38Z hristov $ */
+
+////////////////////////////////////////////////////////////////////////////
+//                                                                        //
+//                                                                        //
+//  Multi Chip Module exponential filter and tracklet finder              //
+//                                                                        //
+//                                                                        //
+////////////////////////////////////////////////////////////////////////////
+
+#include <TMath.h>
+
+#include "AliLog.h"
+
+#include "AliTRDmcm.h"
+#include "AliTRDtrigParam.h"
+
+ClassImp(AliTRDmcm)
+
+//_____________________________________________________________________________
+AliTRDmcm::AliTRDmcm() 
+  :TObject()
+  ,fNtrk(0)
+  ,fRobId(0)
+  ,fChaId(0)
+  ,fRow(0)
+  ,fColFirst(0)
+  ,fColLast(0)
+  ,fTime1(0)
+  ,fTime2(0)
+  ,fClusThr(0)
+  ,fPadThr(0)
+  ,fNtrkSeeds(0)
+  ,fR1(0)
+  ,fR2(0)
+  ,fC1(0)
+  ,fC2(0)
+  ,fPedestal(0)
+  ,fId(0)
+{
+  //
+  // AliTRDmcm default constructor
+  //
+
+  Int_t i = 0;
+  Int_t j = 0;
+
+  for (i = 0; i < kMaxTrackletsPerMCM; i++) {
+    fTrkIndex[i] = 0;
+    fSeedCol[i]  = -1;
+  }
+  for (i = 0; i < kMcmCol; i++) {
+    fPadHits[i]  = 0;
+    for (j = 0; j < kMcmTBmax; j++) {
+      fADC[i][j]    = 0.0;
+      fIsClus[i][j] = kFALSE;
+    }
+  }
+
+}
+
+//_____________________________________________________________________________
+AliTRDmcm::AliTRDmcm(Int_t id) 
+  :TObject()
+  ,fNtrk(0)
+  ,fRobId(0)
+  ,fChaId(0)
+  ,fRow(0)
+  ,fColFirst(0)
+  ,fColLast(0)
+  ,fTime1(0)
+  ,fTime2(0)
+  ,fClusThr(0)
+  ,fPadThr(0)
+  ,fNtrkSeeds(0)
+  ,fR1(0)
+  ,fR2(0)
+  ,fC1(0)
+  ,fC2(0)
+  ,fPedestal(0)
+  ,fId(id)
+{
+  //
+  // AliTRDmcm constructor
+  //
+
+  Int_t i = 0;
+  Int_t j = 0;
+
+  for (i = 0; i < kMaxTrackletsPerMCM; i++) {
+    fTrkIndex[i] = 0;
+    fSeedCol[i]  = -1;
+  }
+  for (i = 0; i < kMcmCol; i++) {
+    fPadHits[i]  = 0;
+    for (j = 0; j < kMcmTBmax; j++) {
+      fADC[i][j]    = 0.0;
+      fIsClus[i][j] = kFALSE;
+    }
+  }
+
+  fTime1   = AliTRDtrigParam::Instance()->GetTime1();
+  fTime2   = AliTRDtrigParam::Instance()->GetTime2();
+  fClusThr = AliTRDtrigParam::Instance()->GetClusThr();
+  fPadThr  = AliTRDtrigParam::Instance()->GetPadThr();
+  
+  AliTRDtrigParam::Instance()->GetFilterParam(fR1,fR2,fC1,fC2,fPedestal);
+
+}
+
+//_____________________________________________________________________________
+AliTRDmcm::AliTRDmcm(const AliTRDmcm &m) 
+  :TObject(m)
+  ,fNtrk(m.fNtrk)
+  ,fRobId(m.fRobId)
+  ,fChaId(m.fChaId)
+  ,fRow(m.fRow)
+  ,fColFirst(m.fColFirst)
+  ,fColLast(m.fColLast)
+  ,fTime1(m.fTime1)
+  ,fTime2(m.fTime2)
+  ,fClusThr(m.fClusThr)
+  ,fPadThr(m.fPadThr)
+  ,fNtrkSeeds(m.fNtrkSeeds)
+  ,fR1(m.fR1)
+  ,fR2(m.fR2)
+  ,fC1(m.fC1)
+  ,fC2(m.fC2)
+  ,fPedestal(m.fPedestal)
+  ,fId(m.fId)
+{
+  //
+  // AliTRDmcm copy constructor
+  //
+
+  Int_t i = 0;
+  Int_t j = 0;
+
+  for (i = 0; i < kMaxTrackletsPerMCM; i++) {
+    ((AliTRDmcm &) m).fTrkIndex[i] = 0;
+    ((AliTRDmcm &) m).fSeedCol[i]  = -1;
+  }
+  for (i = 0; i < kMcmCol; i++) {
+    ((AliTRDmcm &) m).fPadHits[i]  = 0;
+    for (j = 0; j < kMcmTBmax; j++) {
+      ((AliTRDmcm &) m).fADC[i][j]    = 0.0;
+      ((AliTRDmcm &) m).fIsClus[i][j] = kFALSE;
+    }
+  }
+
+}
+
+//_____________________________________________________________________________
+AliTRDmcm::~AliTRDmcm() 
+{
+  //
+  // AliTRDmcm destructor
+  //
+
+}
+
+//_____________________________________________________________________________
+AliTRDmcm &AliTRDmcm::operator=(const AliTRDmcm &m)
+{
+  //
+  // Assignment operator
+  //
+
+  if (this != &m) ((AliTRDmcm &) m).Copy(*this); 
+
+  return *this;
+
+}
+
+//_____________________________________________________________________________
+void AliTRDmcm::Copy(TObject &m) const
+{
+  //
+  // Copy function
+  //
+
+  Int_t i = 0;
+  Int_t j = 0;
+
+  ((AliTRDmcm &) m).fNtrk       = fNtrk;
+  ((AliTRDmcm &) m).fRobId      = fRobId;
+  ((AliTRDmcm &) m).fChaId      = fChaId;
+  ((AliTRDmcm &) m).fRow        = fRow;
+  ((AliTRDmcm &) m).fColFirst   = fColFirst;
+  ((AliTRDmcm &) m).fColLast    = fColLast;
+  ((AliTRDmcm &) m).fTime1      = fTime1;
+  ((AliTRDmcm &) m).fTime2      = fTime2;
+  ((AliTRDmcm &) m).fClusThr    = fClusThr;
+  ((AliTRDmcm &) m).fPadThr     = fPadThr;
+  ((AliTRDmcm &) m).fNtrkSeeds  = fNtrkSeeds;
+  ((AliTRDmcm &) m).fR1         = fR1;
+  ((AliTRDmcm &) m).fR2         = fR2;
+  ((AliTRDmcm &) m).fC1         = fC1;
+  ((AliTRDmcm &) m).fC2         = fC2;
+  ((AliTRDmcm &) m).fPedestal   = fPedestal;
+  ((AliTRDmcm &) m).fId         = fId;
+
+  for (i = 0; i < kMaxTrackletsPerMCM; i++) {
+    ((AliTRDmcm &) m).fTrkIndex[i] = 0;
+    ((AliTRDmcm &) m).fSeedCol[i]  = -1;
+  }
+  for (i = 0; i < kMcmCol; i++) {
+    ((AliTRDmcm &) m).fPadHits[i]  = 0;
+    for (j = 0; j < kMcmTBmax; j++) {
+      ((AliTRDmcm &) m).fADC[i][j]    = 0.0;
+      ((AliTRDmcm &) m).fIsClus[i][j] = kFALSE;
+    }
+  }
+
+}
+
+//_____________________________________________________________________________
+void AliTRDmcm::AddTrk(Int_t id) 
+{
+  //
+  // Add a tracklet index
+  //
+
+  fTrkIndex[fNtrk] = id;
+  fNtrk++;
+
+  return;
+
+}
+
+//_____________________________________________________________________________
+void AliTRDmcm::Reset()
+{
+  //
+  // Reset MCM data
+  //
+
+  Int_t i = 0;
+  Int_t j = 0;
+
+  for (i = 0; i < kMcmCol; i++) {
+    fPadHits[i] = 0;
+    for (j = 0; j < kMcmTBmax; j++) {
+      fADC[i][j]    = 0.0;
+      fIsClus[i][j] = kFALSE;
+    }
+  }
+  for (i = 0; i < kMaxTrackletsPerMCM; i++) {
+    fSeedCol[i] = -1;
+  }
+  
+}
+
+//_____________________________________________________________________________
+Bool_t AliTRDmcm::Run()
+{
+  //
+  // Run MCM
+  //
+
+  AliDebug(2,(Form("Run MCM %d\n",Id())));
+
+  Int_t   iTime = 0;
+  Int_t   iCol  = 0;
+  Int_t   iPlus = 0;
+  Int_t   i     = 0;
+  Int_t   j     = 0;
+
+  Float_t amp[3] = { 0.0, 0.0, 0.0 };
+  Int_t   nClus;
+  Int_t   clusCol[kMcmCol/2];
+  Float_t clusAmp[kMcmCol/2];
+  Float_t veryLarge;
+  Int_t   clusMin = -1;
+  
+  // Main TB loop
+  for (iTime = fTime1; iTime <= fTime2; iTime++) {  
+
+    // Find clusters...
+    nClus = 0;
+    for (iCol = 1; iCol < (kMcmCol-1); iCol++) {
+      amp[0] = fADC[iCol-1][iTime];
+      amp[1] = fADC[iCol  ][iTime];
+      amp[2] = fADC[iCol+1][iTime];
+      if (IsCluster(amp)) {
+       fIsClus[iCol][iTime] = kTRUE;
+       clusCol[nClus]       = iCol;
+       clusAmp[nClus]       = amp[0]+amp[1]+amp[2];
+       nClus++;
+       if (nClus == kMcmCol/2) {
+         AliWarning(Form("Too many clusters in time bin %2d MCM %d...\n",iTime,Id()));
+         break;
+       }
+      }
+    }
+
+    // ...but no more than six...
+    if (nClus > (Int_t) kSelClus) {
+      for (j = kSelClus/2; j < nClus-kSelClus/2; j++) {
+       fIsClus[clusCol[j]][iTime] = kFALSE;
+      } 
+    }
+
+    // ...and take the largest four.
+    Int_t nClusPlus = nClus - kMaxClus;
+    for (iPlus = 0; iPlus < nClusPlus; iPlus++ ) {
+      veryLarge = 1.E+10;
+      for (i = 0; i < nClus; i++) {
+       if (fIsClus[clusCol[i]][iTime]) {
+         if (clusAmp[i] <= veryLarge) {
+           veryLarge = clusAmp[i];
+           clusMin = i;
+         }
+       }
+      }
+      fIsClus[clusCol[clusMin]][iTime] = kFALSE;
+    }
+
+    AddTimeBin(iTime);
+
+  }  // end main TB loop
+    
+  if ((fNtrkSeeds = CreateSeeds())) {
+    return kTRUE;
+  }
+
+  return kFALSE;
+
+}
+
+//_____________________________________________________________________________
+Int_t AliTRDmcm::CreateSeeds()
+{
+  //
+  // Make column seeds (from Falk Lesser, ex KIP)
+  //
+
+  Int_t i      = 0;
+  Int_t j      = 0;
+  Int_t nSeeds = 0;
+
+  AliDebug(2,Form("AliTRDmcm::CreateSeeds MCM %d \n",Id()));
+
+  // Working array for hit sums
+  Int_t fHit2padSum[2][kMcmCol];            
+
+  // Initialize the array
+  for (i = 0; i < 2; i++) {
+    for (j = 0; j < kMcmCol; j++ ) {
+      if (i == 0) {
+       fHit2padSum[i][j] = j; 
+      } else {
+       fHit2padSum[i][j] = -1; 
+      }
+    }
+  }
+
+  Int_t sum10 = AliTRDtrigParam::Instance()->GetSum10();
+  Int_t sum12 = AliTRDtrigParam::Instance()->GetSum12();
+
+  // Build the 2padSum
+  Int_t nsum2seed = 0;
+  for (i = 0; i < kMcmCol; i++) {
+    if (i < (kMcmCol-1)) {
+      if ((fPadHits[i] >= sum10) && ((fPadHits[i] + fPadHits[i+1]) >= sum12)) {
+       fHit2padSum[1][i] = fPadHits[i] + fPadHits[i+1]; 
+      } 
+      else {
+       fHit2padSum[1][i] = -1;
+      }
+    } 
+    else {
+      if (fPadHits[i] >= sum12) {
+       fHit2padSum[1][i] = fPadHits[i]; 
+      } 
+      else {
+       fHit2padSum[1][i] = -1;
+      }
+    }
+    if (fHit2padSum[1][i] > 0) {
+      nsum2seed++;
+    }
+  }
+
+  // sort the sums in decreasing order of the amplitude        
+  Sort(kMcmCol,&fHit2padSum[0][0],&fHit2padSum[1][0],1);
+
+  // arrange (maximum number of) candidates in increasing order of the column number
+  nSeeds = TMath::Min(nsum2seed,kMaxTrackletsPerMCM);
+  Sort(nSeeds,&fHit2padSum[1][0],&fHit2padSum[0][0],0);
+
+  for (i = 0; i < nSeeds; i++) {
+    fSeedCol[i] = fHit2padSum[0][i];
+  }
+
+  // reject multiple found tracklets
+  Int_t imax = nSeeds - 1;
+  for (i = 0; i < imax; i++) {
+
+    if ((fHit2padSum[0][i]+1) == fHit2padSum[0][i+1]) {
+      nSeeds--;
+      if (fHit2padSum[1][i] >= fHit2padSum[1][i+1]) {
+       AliDebug(2,Form("Reject seed %1d in col %02d. \n",i,fHit2padSum[0][i+1]));
+       fSeedCol[i+1] = -1;
+      } 
+      else {
+       AliDebug(2,Form("Reject seed %1d in col %02d. \n",i,fHit2padSum[0][i]));
+       fSeedCol[i]   = -1;
+      }
+    }
+
+  }
+
+  return nSeeds;
+
+}
+
+//_____________________________________________________________________________
+void AliTRDmcm::Sort(Int_t nel, Int_t *x1, Int_t *x2, Int_t dir) const
+{
+  //
+  // Sort two parallel vectors (x1[nel], x2[nel]) after the second one (x2)
+  // in the direction: dir = 0 ascending order
+  //                   dir = 1 descending order
+  //
+
+  Int_t  i = 0;
+  Bool_t sort;
+  Int_t  tmp1;
+  Int_t  tmp2;
+
+  if (dir == 0) {
+
+    do { 
+      sort = kTRUE;
+      for (i = 0; i < (nel-1); i++) {
+       if (x2[i+1] < x2[i]) {
+         tmp2    = x2[i]; 
+         x2[i]   = x2[i+1]; 
+         x2[i+1] = tmp2;
+         tmp1    = x1[i]; 
+         x1[i]   = x1[i+1]; 
+         x1[i+1] = tmp1;
+         sort    = kFALSE;
+       }
+      }
+    } while (sort == kFALSE);
+
+  }
+
+  if (dir == 1) {
+
+    do { 
+      sort = kTRUE;
+      for (i = 0; i < (nel-1); i++) {
+       if (x2[i+1] > x2[i]) {
+         tmp2    = x2[i]; 
+         x2[i]   = x2[i+1]; 
+         x2[i+1] = tmp2;
+         tmp1    = x1[i]; 
+         x1[i]   = x1[i+1]; 
+         x1[i+1] = tmp1;
+         sort    = kFALSE;
+       }
+      }
+    } while (sort == kFALSE);
+
+  }
+
+}
+
+//_____________________________________________________________________________
+void AliTRDmcm::AddTimeBin(const Int_t iTime)
+{
+  //
+  // Build column seeds
+  //
+
+  for (Int_t iPad = 1; iPad < (kMcmCol-1); iPad++) {
+    if (fIsClus[iPad][iTime]) {
+      fPadHits[iPad]++;
+    }
+  }
+
+}
+
+//_____________________________________________________________________________
+Bool_t AliTRDmcm::IsCluster(Float_t amp[3]) const
+{
+  //
+  // Find if the amplitudes amp[0], amp[1], amp[2] are a cluster
+  //
+
+  // -> shape
+  if (amp[0] > amp[1] || amp[2] > amp[1]) {
+    return kFALSE;
+  }
+
+  // -> cluster amplitude
+  if ((amp[0]+amp[1]+amp[2]) < fClusThr) {
+    return kFALSE;
+  }
+
+  // -> pad amplitude
+  if (amp[0] < fPadThr && amp[2] < fPadThr) {
+    return kFALSE;
+  }
+
+  return kTRUE;
+
+}
+
+//_____________________________________________________________________________
+void AliTRDmcm::Filter(Int_t nexp, Int_t ftype)
+{
+  //
+  // Exponential filter
+  //
+
+  Int_t iCol  = 0;
+  Int_t iTime = 0;
+
+  Double_t sour[kMcmTBmax];
+  Double_t dtarg[kMcmTBmax];
+  Int_t    itarg[kMcmTBmax];
+
+  switch(ftype) {
+
+   case 0:
+
+    for (iCol = 0; iCol < kMcmCol; iCol++) {
+      for (iTime = 0; iTime < kMcmTBmax; iTime++) {
+       sour[iTime] = fADC[iCol][iTime];
+      }
+      DeConvExpA(sour,dtarg,kMcmTBmax,nexp);
+      for (iTime = 0; iTime < kMcmTBmax; iTime++) {
+       fADC[iCol][iTime] = TMath::Max(0.0,dtarg[iTime]);
+      }
+    }
+    break;
+
+  case 1:
+
+    for (iCol = 0; iCol < kMcmCol; iCol++) {
+      for (iTime = 0; iTime < kMcmTBmax; iTime++) {
+       sour[iTime] = fADC[iCol][iTime];
+      }
+      DeConvExpD(sour,itarg,kMcmTBmax,nexp);
+      for (iTime = 0; iTime < kMcmTBmax; iTime++) {
+       fADC[iCol][iTime] = itarg[iTime];
+      }
+    }
+    break;
+
+  case 2:
+
+    for (iCol = 0; iCol < kMcmCol; iCol++) {
+      for (iTime = 0; iTime < kMcmTBmax; iTime++) {
+       sour[iTime] = fADC[iCol][iTime];
+      }
+      DeConvExpMI(sour,dtarg,kMcmTBmax);
+      for (iTime = 0; iTime < kMcmTBmax; iTime++) {
+       fADC[iCol][iTime] = TMath::Max(0.0,dtarg[iTime]);
+      }
+    }
+    break;
+
+  default:
+
+    AliError(Form("Invalid filter type %d ! \n",ftype));
+    return;
+
+  }
+
+}
+
+//_____________________________________________________________________________
+void AliTRDmcm::DeConvExpA(Double_t *source, Double_t *target, Int_t n, Int_t nexp) 
+{
+  //
+  // Exponential filter "analog"
+  //
+
+  Int_t    i = 0;
+  Int_t    k = 0;
+  Double_t reminder[2];
+  Double_t correction;
+  Double_t result;
+  Double_t rates[2];
+  Double_t coefficients[2];
+
+  // Initialize (coefficient = alpha, rates = lambda)
+  
+  // FilterOpt.C (aliroot@pel:/homel/aliroot/root/work/beamt/CERN02)
+  Double_t r1, r2, c1, c2;
+  r1 = (Double_t)fR1;
+  r2 = (Double_t)fR2;
+  c1 = (Double_t)fC1;
+  c2 = (Double_t)fC2;
+  
+  coefficients[0] = c1;
+  coefficients[1] = c2;
+
+  Double_t dt = 0.1;
+  rates[0] = TMath::Exp(-dt/(r1));
+  rates[1] = TMath::Exp(-dt/(r2));
+
+  // Attention: computation order is important
+  correction = 0.0;
+  for (k = 0; k < nexp; k++) {
+    reminder[k] = 0.0;
+  }
+    
+  for (i = 0; i < n; i++) {
+
+    result    = (source[i] - correction);    // no rescaling
+    target[i] = result;
+    
+    for (k = 0; k < nexp; k++) {
+      reminder[k] = rates[k] * (reminder[k] + coefficients[k] * result);
+    }
+      
+    correction = 0.0;
+    for (k = 0; k < nexp; k++) {
+      correction += reminder[k];
+    }
+
+  }
+  
+}
+
+//_____________________________________________________________________________
+void AliTRDmcm::DeConvExpD(Double_t *source, Int_t *target, Int_t n, Int_t nexp) 
+{
+  //
+  // Exponential filter "digital"
+  //
+
+  Int_t i = 0;
+
+  Int_t fAlphaL;
+  Int_t fAlphaS;
+  Int_t fLambdaL;
+  Int_t fLambdaS;
+  Int_t fTailPed;
+
+  Int_t iAlphaL;
+  Int_t iAlphaS;
+  Int_t iLambdaL;
+  Int_t iLambdaS;
+
+  // FilterOpt.C (aliroot@pel:/homel/aliroot/root/work/beamt/CERN02)
+  // initialize (coefficient = alpha, rates = lambda)
+
+  fLambdaL = 0; 
+  fAlphaL  = 0; 
+  fLambdaS = 0; 
+  fAlphaS  = 0;
+  iLambdaL = 0; 
+  iAlphaL  = 0; 
+  iLambdaS = 0; 
+  iAlphaS  = 0;
+
+  Double_t dt = 0.1;
+
+  Double_t r1;
+  Double_t r2;
+  Double_t c1;
+  Double_t c2;
+  r1 = (Double_t) fR1;
+  r2 = (Double_t) fR2;
+  c1 = (Double_t) fC1;
+  c2 = (Double_t) fC2;
+
+  fLambdaL = (Int_t)((TMath::Exp(-dt/r1) - 0.75) * 2048.0);
+  fLambdaS = (Int_t)((TMath::Exp(-dt/r2) - 0.25) * 2048.0);
+  iLambdaL = fLambdaL & 0x01FF; iLambdaL |= 0x0600;    //  9 bit paramter + fixed bits
+  iLambdaS = fLambdaS & 0x01FF; iLambdaS |= 0x0200;    //  9 bit paramter + fixed bits
+
+  if (nexp == 1) {
+    fAlphaL = (Int_t) (c1 * 2048.0);
+    iAlphaL = fAlphaL & 0x03FF;                                // 10 bit paramter
+  }
+  if (nexp == 2) {
+    fAlphaL = (Int_t) (c1 * 2048.0);
+    fAlphaS = (Int_t) ((c2 - 0.5) * 2048.0);
+    iAlphaL = fAlphaL & 0x03FF;                                // 10 bit paramter
+    iAlphaS = fAlphaS & 0x03FF; iAlphaS |= 0x0400;             // 10 bit paramter + fixed bits
+  }
+  
+  Double_t iAl = iAlphaL  / 2048.0;           // alpha L: correspondence to floating point numbers
+  Double_t iAs = iAlphaS  / 2048.0;           // alpha S: correspondence to floating point numbers
+  Double_t iLl = iLambdaL / 2048.0;           // lambda L: correspondence to floating point numbers
+  Double_t iLs = iLambdaS / 2048.0;           // lambda S: correspondence to floating point numbers
+
+  Int_t h1;
+  Int_t h2;
+  Int_t rem1;
+  Int_t rem2;
+  Int_t correction;
+  Int_t result;
+  Int_t iFactor = ((Int_t) fPedestal) << 2;
+
+  Double_t xi = 1 - (iLl*iAs + iLs*iAl);            // Calculation of equilibrium values of the
+  rem1 = (Int_t) ((iFactor/xi) * ((1-iLs)*iLl*iAl)); // Internal registers to prevent switch on effects.
+  rem2 = (Int_t) ((iFactor/xi) * ((1-iLl)*iLs*iAs));
+  
+  // further initialization
+  if ((rem1 + rem2) > 0x0FFF) {
+    correction = 0x0FFF;
+  } 
+  else {
+    correction = (rem1 + rem2) & 0x0FFF;
+  }
+
+  fTailPed = iFactor - correction;
+
+  for (i = 0; i < n; i++) {
+
+    result = ((Int_t)source[i] - correction);
+    if (result < 0) {                          
+      result = 0;
+    }
+
+    target[i] = result;
+                                                        
+    h1 = (rem1 + ((iAlphaL * result) >> 11));
+    if (h1 > 0x0FFF) {
+      h1 = 0x0FFF;
+    } 
+    else {
+      h1 &= 0x0FFF;
+    }
+
+    h2 = (rem2 + ((iAlphaS * result) >> 11));
+    if (h2 > 0x0FFF) {
+      h2 = 0x0FFF;
+    } 
+    else {
+      h2 &= 0x0FFF;
+    }
+  
+    rem1 = (iLambdaL * h1 ) >> 11;
+    rem2 = (iLambdaS * h2 ) >> 11;
+    
+    if ((rem1 + rem2) > 0x0FFF) {
+      correction = 0x0FFF;
+    } 
+    else {
+      correction = (rem1 + rem2) & 0x0FFF;
+    }
+
+  }
+
+}
+
+//_____________________________________________________________________________
+void AliTRDmcm::DeConvExpMI(Double_t *source, Double_t *target, Int_t n) 
+{
+  //
+  // Exponential filter (M. Ivanov)
+  //
+
+  Int_t i = 0;
+
+  Double_t sig1[100];
+  Double_t sig2[100];
+  Double_t sig3[100];
+
+  for (i = 0; i < n; i++) {
+    sig1[i] = source[i];
+  }
+
+  Float_t dt = 0.1;
+
+  Float_t lambda0 = (1.0 / fR2) * dt;
+  Float_t lambda1 = (1.0 / fR1) * dt;
+
+  TailMakerSpline(sig1,sig2,lambda0,n);
+  TailCancelationMI(sig2,sig3,0.7,lambda1,n);
+
+  for (i = 0; i < n; i++) {
+    target[i] = sig3[i];
+  }
+
+}
+
+//______________________________________________________________________________
+void AliTRDmcm::TailMakerSpline(Double_t *ampin, Double_t *ampout, Double_t lambda, Int_t n) 
+{
+  //
+  // Special filter (M. Ivanov)
+  //
+
+  Int_t    i = 0;
+
+  Double_t l = TMath::Exp(-lambda*0.5);
+  Double_t in[1000];
+  Double_t out[1000];
+
+  // Initialize in[] and out[] goes 0 ... 2*n+19
+  for (i = 0; i < n*2+20; i++) {
+    in[i]  = 0;
+    out[i] = 0;
+  }
+
+  // in[] goes 0, 1
+  in[0] = ampin[0];
+  in[1] = (ampin[0] + ampin[1]) * 0.5;
+   
+  // Add charge to the end
+  for (i = 0; i < 22; i++) {
+    // in[] goes 2*n-2, 2*n-1, ... , 2*n+19 
+    in[2*(n-1)+i] = ampin[n-1];
+  }
+
+  // Use arithmetic mean
+  for (i = 1; i < n-1; i++) {
+    // in[] goes 2, 3, ... , 2*n-4, 2*n-3
+    in[2*i]   = ampin[i];
+    in[2*i+1] = ((ampin[i]+ampin[i+1]))/2.;
+  }
+
+  Double_t temp;
+  out[2*n]    = in[2*n];
+  temp        = 0;
+  for (i = 2*n; i >= 0; i--) {
+    out[i]    = in[i] + temp;
+    temp      = l*(temp+in[i]);
+  }
+
+  for (i = 0; i < n; i++){
+    //ampout[i] = out[2*i+1];  // org
+    ampout[i] = out[2*i];
+  }
+
+}
+
+//______________________________________________________________________________
+void AliTRDmcm::TailCancelationMI(Double_t *ampin, Double_t *ampout
+                                , Double_t norm, Double_t lambda, Int_t n) 
+{
+  //
+  // Special filter (M. Ivanov)
+  //
+
+  Int_t    i = 0;
+
+  Double_t l = TMath::Exp(-lambda*0.5);
+  Double_t k = l*(1.0 - norm*lambda*0.5);
+  Double_t in[1000];
+  Double_t out[1000];
+
+  // Initialize in[] and out[] goes 0 ... 2*n+19
+  for (i = 0; i < n*2+20; i++) {
+    in[i]  = 0;
+    out[i] = 0;
+  }
+
+  // in[] goes 0, 1
+  in[0] = ampin[0];
+  in[1] = (ampin[0]+ampin[1])*0.5;
+
+  // Add charge to the end
+  for (i =-2; i < 22; i++) {
+    // in[] goes 2*n-4, 2*n-3, ... , 2*n+19 
+    in[2*(n-1)+i] = ampin[n-1];
+  }
+
+  for (i = 1; i < n-2; i++) {
+    // in[] goes 2, 3, ... , 2*n-6, 2*n-5
+    in[2*i]    = ampin[i];
+    in[2*i+1]  = (9.0 * (ampin[i]+ampin[i+1]) - (ampin[i-1]+ampin[i+2])) / 16.0;
+    //in[2*i+1]  = ((ampin[i]+ampin[i+1]))/2.0;
+  }
+
+  Double_t temp;
+  out[0] = in[0];
+  temp   = in[0];
+  for (i = 1; i <= 2*n; i++) {
+    out[i] = in[i] + (k-l)*temp;
+    temp   = in[i] +  k   *temp;
+  }
+
+  for (i = 0; i < n; i++) {
+    //ampout[i] = out[2*i+1];  // org
+    //ampout[i] = TMath::Max(out[2*i+1],0.0);  // org
+    ampout[i] = TMath::Max(out[2*i],0.0);
+  }
+
+}
+
diff --git a/TRD/attic/AliTRDmcm.h b/TRD/attic/AliTRDmcm.h
new file mode 100644 (file)
index 0000000..8fa8b9e
--- /dev/null
@@ -0,0 +1,101 @@
+#ifndef ALITRDMCM_H
+#define ALITRDMCM_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id: AliTRDmcm.h 22653 2007-11-29 21:18:30Z cblume $ */
+
+////////////////////////////////////////////////////////////////////////////
+//                                                                        //
+//  Multi Chip Module object                                              //
+//                                                                        //
+////////////////////////////////////////////////////////////////////////////
+
+#include <TObject.h>
+
+class AliTRDmcm : public TObject {
+
+ public:
+
+  enum { kMaxTrackletsPerMCM = 4
+       , kMcmCol             = 21
+       , kMcmTBmax           = 60
+       , kSelClus            = 6
+       , kMaxClus            = 4 };
+
+  AliTRDmcm();
+  AliTRDmcm(const AliTRDmcm &m);
+  AliTRDmcm(Int_t id);
+  virtual         ~AliTRDmcm();
+  AliTRDmcm       &operator=(const AliTRDmcm &m);
+
+  virtual void     Copy(TObject &m) const;
+
+          void     SetRobId(Int_t id)                          { fRobId = id; };
+          void     SetChaId(Int_t id)                          { fChaId = id; };
+          void     SetRow(Int_t row)                           { fRow = row;  };
+          void     SetColRange(Int_t colf, Int_t coll)         { fColFirst = colf; fColLast = coll; };
+          void     SetADC(Int_t icol, Int_t itb, Float_t adc)  { fADC[icol][itb] = adc;       };
+          void     SetCluster(Int_t icol, Int_t itb)           { fIsClus[icol][itb] = kTRUE;  };
+          void     UnSetCluster(Int_t icol, Int_t itb)         { fIsClus[icol][itb] = kFALSE; };
+
+          Int_t   *GetTrkIndex()                               { return &fTrkIndex[0];        };
+          Int_t    GetRobId() const { return fRobId; };
+          Int_t    GetChaId() const { return fChaId; };
+          Int_t    GetRow() const { return fRow; };
+          void     GetColRange(Int_t &colf, Int_t &coll) const { colf = fColFirst; coll = fColLast; };
+          Float_t  GetADC(Int_t icol, Int_t itb) const         { return fADC[icol][itb];     };
+          Int_t    GetNtrkSeeds() const                        { return fNtrkSeeds;          };
+          Int_t   *GetSeedCol()                                { return &fSeedCol[0];        };
+          Int_t   *GetPadHits()                                { return &fPadHits[0];        };
+          Bool_t   IsCluster(Int_t icol, Int_t itim) const     { return fIsClus[icol][itim]; };
+          Int_t    Ntrk() const { return fNtrk; };
+          Int_t    Id() const { return fId; };
+
+          void     AddTrk(Int_t id);
+          void     Reset();
+          Bool_t   Run();
+          Bool_t   IsCluster(Float_t amp[3]) const;
+          void     AddTimeBin(Int_t itime);
+          Int_t    CreateSeeds();
+          void     Sort(Int_t nel, Int_t *x1, Int_t *x2, Int_t dir) const;
+
+          void     Filter(Int_t nexp, Int_t ftype = 0);
+          void     DeConvExpA(Double_t *source, Double_t *target, Int_t n, Int_t nexp);
+          void     DeConvExpD(Double_t *source, Int_t    *target, Int_t n, Int_t nexp);
+          void     DeConvExpMI(Double_t *source, Double_t *target, Int_t n);
+          void     TailMakerSpline(Double_t *ampin, Double_t *ampout, Double_t lambda, Int_t n);
+          void     TailCancelationMI(Double_t *ampin, Double_t *ampout, Double_t norm, Double_t lambda, Int_t n);
+
+ protected:
+
+          Int_t    fNtrk;                              //  Number of found tracklets
+          Int_t    fTrkIndex[kMaxTrackletsPerMCM];     //  Index of found tracklets
+          Int_t    fRobId;                             //  ROB id
+          Int_t    fChaId;                             //  Chamber id
+          Int_t    fRow;                               //  Pad row number (0-11 or 0-15)
+          Int_t    fColFirst;                          //  First pad column
+          Int_t    fColLast;                           //  Last pad column (<)
+          Float_t  fADC[kMcmCol][kMcmTBmax];           //! Array with MCM ADC values
+          Bool_t   fIsClus[kMcmCol][kMcmTBmax];        //! Flag of a cluster maximum
+          Int_t    fTime1;                             //  First time bin for tracking (incl.)
+          Int_t    fTime2;                             //  Last  time bin for tracking (incl.)
+          Float_t  fClusThr;                           //  Cluster threshold
+          Float_t  fPadThr;                            //  Pad threshold
+          Int_t    fPadHits[kMcmCol];                  //  Hit counter in pads
+          Int_t    fNtrkSeeds;                         //  Number of found seeds
+          Int_t    fSeedCol[kMaxTrackletsPerMCM];      //  Column number of found tracklet seeds
+                                                       //  Filter parameters (1 = long, 2 = short component)
+          Float_t  fR1;                                //  Time constant [microseconds] 
+          Float_t  fR2;                                //  Time constant [microseconds]
+          Float_t  fC1;                                //  Weight
+          Float_t  fC2;                                //  Weight
+          Float_t  fPedestal;                          //  ADC baseline (pedestal)
+
+          Int_t    fId;                                //  Dummy id
+  ClassDef(AliTRDmcm,3)                                //  TRD MCM class
+
+};
+
+#endif
diff --git a/TRD/attic/AliTRDtrapAlu.cxx b/TRD/attic/AliTRDtrapAlu.cxx
new file mode 100644 (file)
index 0000000..005cdca
--- /dev/null
@@ -0,0 +1,515 @@
+/**************************************************************************\r
+* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
+*                                                                        *\r
+* Author: The ALICE Off-line Project.                                    *\r
+* Contributors are mentioned in the code where appropriate.              *\r
+*                                                                        *\r
+* Permission to use, copy, modify and distribute this software and its   *\r
+* documentation strictly for non-commercial purposes is hereby granted   *\r
+* without fee, provided that the above copyright notice appears in all   *\r
+* copies and that both the copyright notice and this permission notice   *\r
+* appear in the supporting documentation. The authors make no claims     *\r
+* about the suitability of this software for any purpose. It is          *\r
+* provided "as is" without express or implied warranty.                  *\r
+**************************************************************************/\r
+\r
+/* $Id: AliTRDtrapAlu.cxx 25891 2008-05-19 14:58:18Z fca $ */\r
+\r
+///////////////////////////////////////////////////////////////////////////////\r
+//                                                                           //\r
+//  TRAP-ALU implementation                                                  //\r
+//                                                                           //\r
+//  Author:                                                                  //\r
+//    Clemens Haltebourg <halteb@physi.uni-heidelberg.de>                    //\r
+//                                                                           //\r
+//  Usage of the class:                                                      //\r
+//    Declaration of class instances: AliTRDtrapAlu a,b,c;                   //\r
+//    Initialization:                 a.Init(2,11); b.Init(4,4); c.Init(5,4);//\r
+//    Assigning values:               a.AssignDouble(5.7); b.AssignInt(3);   //\r
+//    (you can also do b.AssignDouble(3) with same effect);                  //\r
+//    Calculation:                     c = a*b;                              //\r
+//    Test if c has right value:       c.WriteWord();                        //\r
+//    Don't declare pointers; operators not overridden for pointer types;    //\r
+//    You have to dereference yourself;                                      //\r
+//    Use operators +,-,*,/ only with instances of the class; don't do       //\r
+//    things like c=a*2 but rather b.AssignInt(2); c=a*b;                    //\r
+//                                                                           //\r
+///////////////////////////////////////////////////////////////////////////////\r
+\r
+#include "AliTRDtrapAlu.h"\r
+\r
+ClassImp(AliTRDtrapAlu)\r
+\r
+//_____________________________________________________________________________  \r
+AliTRDtrapAlu::AliTRDtrapAlu():TObject()\r
+\r
+  ,fValue(0)\r
+  ,fPreCom(0)\r
+  ,fPostCom(0)\r
+  ,fuRestriction(0)\r
+  ,flRestriction(0)\r
+  ,fSigned(kFALSE)\r
+\r
+{\r
+  \r
+  // default constructor\r
+  \r
+}\r
+\r
+//_____________________________________________________________________________  \r
+AliTRDtrapAlu::~AliTRDtrapAlu(){\r
+  //destructor\r
+}\r
+\r
+//_____________________________________________________________________________  \r
+void AliTRDtrapAlu::Init(const Int_t& precom, const Int_t& postcom, const Int_t& lRestriction, const Int_t& uRestriction){\r
+   // initialization: characterizes the bit-word (nr of pre- and post-comma bits, boundaries)\r
+   fPostCom = postcom;\r
+   fPreCom  = precom;\r
+   fValue   = 0;       //currently, re-initialization kills the value\r
+   fSigned  = kFALSE;\r
+\r
+   if (fPreCom + fPostCom > 32 || fPreCom > 31) {fPreCom = 1; fPostCom = 0;return;} // prevent pre-comma part exceeding 31 spaces\r
+   if (fPreCom  <= 0) {fPreCom  = 1;}\r
+   if (fPostCom <  0) {fPostCom = 0;}\r
+   \r
+   Int_t lut = LUT(fPreCom + fPostCom)-1;\r
+   if (uRestriction <= -1 || uRestriction > lut) {fuRestriction = lut;}\r
+   else {fuRestriction = uRestriction;}\r
+   if (lRestriction <= -1 || lRestriction > fuRestriction) {flRestriction = -lut;}\r
+   else {flRestriction = lRestriction;}\r
+   // up to now you can only choose a non-negative lower restriction (e.g. if you want your values to be >=0) ; can't deal with asymmetric borders; have to be implemented if needed\r
+}\r
+\r
+//_____________________________________________________________________________  \r
+Double_t AliTRDtrapAlu::GetValueWhole() const { \r
+   // get the actual value (respecting pre- and post-comma parts) in integer-description\r
+   Double_t valPre = (Double_t)(fValue>>fPostCom);\r
+   Double_t valPost = 0.0;\r
+   for(Int_t i = 0; i<=fPostCom-1; i++){\r
+     Double_t num = (fValue>>i)&1;\r
+     Double_t denom = LUT(fPostCom-i);\r
+     valPost = valPost + num/denom;\r
+   }\r
+   Double_t val = valPre + valPost;\r
+   return val;\r
+ }\r
+\r
+//_____________________________________________________________________________  \r
+void AliTRDtrapAlu::WriteWord(){\r
+  // for debugging purposes\r
+  printf("bit-word: ");\r
+  if (fSigned == true) printf("-");\r
+  for(Int_t i = fPostCom + fPreCom - 1; i >= fPostCom; i--){  //read from behind in order to write the word from left to right\r
+    printf("%d",(fValue>>i) & 1);\r
+  }\r
+  printf(".");\r
+  for (Int_t j = fPostCom - 1; j >= 0; j--){\r
+    printf("%d",(fValue>>j) & 1);\r
+  }\r
+  printf("\n");\r
+         \r
+}\r
+\r
+//_____________________________________________________________________________  \r
+AliTRDtrapAlu& AliTRDtrapAlu::AssignInt(const Int_t& first){  \r
+  // assign an integer\r
+\r
+  // parameter "first" is an integer for the pre-comma part (not UInt in order to match the error case first<0)\r
+  fSigned = kFALSE;\r
+  Int_t exponent = fPreCom + fPostCom;\r
+\r
+    \r
+  if (first<0) {\r
+    fValue  = 0;                      //setting fValue to 0; first should not be negative\r
+    fValue  = fValue & 0;\r
+    return *this;\r
+  }\r
+\r
+  if (CheckUSize(first<<fPostCom) == kFALSE){\r
+    \r
+    //setting fValue to maximum; first was to big\r
+    fValue  = fuRestriction;\r
+    fValue  = fValue & (LUT(exponent)-1);\r
+    return *this;\r
+  }\r
+\r
+  if (CheckLSize(first<<fPostCom) == kFALSE){\r
+    \r
+    //setting fValue to minimum; first was to small\r
+    fValue  = flRestriction;\r
+    fValue  = fValue & (LUT(exponent)-1);\r
+    return *this;\r
+  }\r
+\r
+  \r
+  fValue  = first;\r
+  fValue  = fValue<<fPostCom; \r
+  fValue  = fValue & (LUT(exponent)-1);\r
\r
+  return *this;\r
+    \r
+}\r
+\r
+//_____________________________________________________________________________  \r
+AliTRDtrapAlu& AliTRDtrapAlu::AssignDouble(const  Double_t& first){\r
+  // assign a double\r
\r
+  fSigned = kFALSE;\r
+  Int_t exponent           = fPreCom + fPostCom;\r
+  Int_t firstPre          = 0;  //integer part of first\r
+  Int_t firstPost         = 0;  //comma part of first (cut off with enough accuracy\r
+  Int_t c                  = 0;\r
+  Double_t firstPreFloat = 0;\r
+  \r
+  \r
+  Int_t power1 = LUT(exponent);\r
+  \r
+  firstPre       = (Int_t)first;\r
+  firstPreFloat = firstPre;\r
+  \r
+  if(firstPre < 0){\r
+    fValue  = 0;\r
+    fValue = fValue & 0;\r
+    return *this;\r
+  }\r
+  \r
+  if(CheckUSize((Int_t)(first*LUT(fPostCom))) == kFALSE){\r
+    \r
+    //fValue  = MakePower(2,fPreCom) - 1;\r
+    fValue  = fuRestriction;\r
+    fValue  = fValue & (power1 - 1);\r
+    return *this;\r
+  }\r
+  \r
+  if(CheckLSize((Int_t)(first*LUT(fPostCom))) == kFALSE){\r
+    \r
+    //fValue  = MakePower(2,fPreCom) - 1;\r
+    fValue  = flRestriction;\r
+    fValue  = fValue & (power1 - 1);\r
+    return *this;\r
+  }\r
+  \r
+\r
+  fValue = firstPre;\r
+  \r
+  //get post comma part with adequate accuracy\r
+  firstPost = (Int_t)((first - firstPreFloat)*LUT(fPostCom));\r
+  for(Int_t i = 1; i <= fPostCom; i++) {\r
+    c = (firstPost>>(fPostCom - i)) & 1;\r
+    fValue  = fValue<<1;\r
+    fValue  = fValue | c;\r
+  }\r
+\r
+  fValue = fValue & (power1 - 1);\r
+  return *this;\r
+}\r
+\r
+//_____________________________________________________________________________  \r
+AliTRDtrapAlu& AliTRDtrapAlu::operator=(const AliTRDtrapAlu& binary){\r
+  // assign an object of type AliTRDtrapAlu\r
+\r
+  Int_t c    = 0;\r
+  //Int_t exponent = fPreCom + fPostCom;\r
+  \r
+  \r
+  Int_t power1 = LUT(fPreCom + fPostCom);\r
+\r
+  fValue          = binary.GetValue();         // in case this==&binary : binary's values are overwritten\r
+  Int_t diffPost = binary.GetPost()-fPostCom;\r
+  Int_t check     = 0;\r
+  if(diffPost<0) check = fValue<<(-diffPost);\r
+  else check = fValue>>(diffPost);\r
+  if (CheckUSize(check)==kFALSE){    //checking size of pre-comma part\r
+    \r
+    //setting fValue to maximum\r
+      \r
+           \r
+    fValue  = fuRestriction;         // fuRestriction >= 0 \r
+    fValue  = fValue & (power1 - 1);\r
+    fSigned = kFALSE;\r
+    return *this;\r
+  }\r
+\r
+  Int_t val = (binary.GetSign()==kFALSE) ? check : -check; \r
+  if (CheckLSize(val)==kFALSE){    //checking size of pre-comma part\r
+    \r
+    //setting fValue to minimum\r
+      \r
+           \r
+    if (flRestriction < 0) {\r
+      fValue  = -flRestriction;\r
+      fSigned = kTRUE;\r
+    }\r
+    else {\r
+      fValue  = flRestriction;\r
+      fSigned = kFALSE;\r
+    }\r
+    fValue  = fValue & (power1 - 1);\r
+    return *this;\r
+  }\r
+  \r
+  if (this == & binary) return *this;\r
+  \r
+  fSigned = kFALSE;\r
+  Int_t iValue = fValue;\r
+  fValue = fValue>>(binary.GetPost());           //only keep the valid pre-comma bits\r
+  \r
+  //append existing post-comma bits to fValue; cut off or add 0 if post-comma numbers don`t match\r
+  for(Int_t i = 1; i <= fPostCom; i++){\r
+    if(i <= (binary.GetPost())){\r
+      c = ((iValue)>>(binary.GetPost()-i)) & 1;\r
+    }\r
+    else{\r
+      c = 0;\r
+    }\r
+    fValue  = fValue<<1;\r
+    fValue  = fValue | c;\r
+  }\r
+  \r
+  fValue = fValue & (power1 - 1);\r
+  fSigned = binary.GetSign();\r
+  return *this;\r
+}\r
+\r
+//_____________________________________________________________________________  \r
+AliTRDtrapAlu AliTRDtrapAlu::operator+(const AliTRDtrapAlu& binary){ \r
+  // + operator\r
+\r
+  //no const parameter because referenced object will be changed\r
+     \r
+    AliTRDtrapAlu alu;\r
+  \r
+  Int_t binPre     = binary.GetPre();\r
+  Int_t binPost    = binary.GetPost();\r
+  Int_t binVal     = binary.GetValue();\r
+  \r
+  Int_t min         = Min(binPost,fPostCom);\r
+  Int_t max         = Max(binPre,fPreCom);\r
+  \r
+  Int_t shift       = binPost - min;\r
+  Int_t add1        = (binVal)>>(shift);    //for addition: cut off at minimum accuracy\r
+  shift             = fPostCom - min;\r
+  Int_t add2        = fValue>>(shift);\r
+  if(binary.GetSign() == kTRUE) add1 = -add1;\r
+  if(fSigned == kTRUE) add2 = -add2;\r
+  Int_t add = add1 + add2;\r
+  \r
+  /*\r
+  //because the parameter "binary" could be a reference to the object to which Mem() is a reference, do not change Mem() until you have extracted all information from "binary"; otherwise you change the information you would like to read\r
+  Mem().Init(max + 1,min);      //buffer: enough space for pre-comma,post-comma according to accuracy\r
+  Mem().AssignFormatted(Max(add,-add));\r
+  Mem().SetSign(add);\r
+  \r
+\r
+  //Mem().FastInit(max+1,min,add);\r
+  return Mem();*/\r
\r
+ alu.Init(max + 1,min);      //buffer: enough space for pre-comma,post-comma according to accuracy\r
+ alu.AssignFormatted(Max(add,-add));\r
+ alu.SetSign(add);\r
\r
+ return alu;\r
+\r
+}\r
+\r
+//_____________________________________________________________________________  \r
+AliTRDtrapAlu AliTRDtrapAlu::operator-(const AliTRDtrapAlu& binary){\r
+  // - operator    \r
+\r
+    AliTRDtrapAlu alu;\r
+\r
+  Int_t binPre    = binary.GetPre();\r
+  Int_t binPost   = binary.GetPost();\r
+  Int_t binVal    = binary.GetValue();\r
+\r
+\r
+  Int_t min      = Min(binPost,fPostCom);\r
+  Int_t max      = Max(binPre,fPreCom);\r
+\r
+  Int_t shift    = binPost - min;\r
+  Int_t sub1 = (binVal)>>(shift); //for addition: cut off at minimum accuracy\r
+  shift = fPostCom - min;\r
+  Int_t sub2 = fValue>>(shift);\r
+  if(binary.GetSign() == kTRUE) sub1 = -sub1;\r
+  if(fSigned  == kTRUE) sub2 = -sub2;\r
+  Int_t sub = sub2 - sub1;     // order of subtraction is important\r
\r
+/*\r
+  Mem().Init(max + 1,min);      //buffer: enough space for pre-comma, post-comma according to accuracy\r
+  Mem().AssignFormatted(Max(sub,-sub)); \r
+  Mem().SetSign(sub);\r
+  //Mem().FastInit(max+1,min,sub);\r
+  return Mem();*/\r
+  \r
+  alu.Init(max + 1,min);\r
+  alu.AssignFormatted(Max(sub,-sub)); \r
+  alu.SetSign(sub);\r
+\r
+  return alu;\r
+\r
+} \r
+\r
+//_____________________________________________________________________________  \r
+AliTRDtrapAlu AliTRDtrapAlu::operator*(const AliTRDtrapAlu& binary){\r
+  // * operator\r
+  \r
+    AliTRDtrapAlu alu;\r
+\r
+  Int_t binPre   = binary.GetPre();\r
+  Int_t binPost  = binary.GetPost();\r
+\r
+\r
+  Int_t min      = Min(binPost,fPostCom);\r
+  Int_t max      = Max(binPre,fPreCom);\r
+\r
+  \r
+  Int_t mult1 = binary.GetValue();\r
+  Int_t mult2 = fValue;\r
+  Int_t shift  = (Int_t)(fPostCom + binPost - min);\r
+  Double_t fmult1 = (Double_t)mult1;\r
+  Double_t fmult2 = (Double_t)mult2;\r
+  (fmult1 > fmult2) ? fmult1 = fmult1/LUT(shift) : fmult2 = fmult2/LUT(shift);\r
+  \r
+    \r
+  if (binary.GetSign() == kTRUE) fmult1 = -fmult1;\r
+  if (fSigned  == kTRUE) fmult2 = -fmult2;\r
+  Double_t fmult  = fmult1*fmult2;\r
+  Int_t mult = (Int_t)fmult;\r
+  Int_t sign = 1;\r
+  if(mult<0) sign = -1;\r
+  mult = Max(mult,-mult);\r
+  //Int_t shift = fPostCom + binPost - min;\r
+  //mult = mult>>(shift);\r
+\r
+/*\r
+  Mem().Init(2 * max + 1, min); // +1 to consider the borrow from the past-comma part; accuracy of past-comma part is determined by the minimum; therefore, for the result not more accuracy is guaranteed\r
+  // be aware that this only works if 2*max+1+min <= 32!! adjusting the pre-comma place to the value would consume too much time\r
+\r
+  Mem().AssignFormatted(mult);\r
+  Mem().SetSign(sign);\r
+  //mult = sign*mult;\r
+  //Mem().FastInit(2*max+1,min,mult);\r
+  return Mem();*/\r
+  \r
+  alu.Init(2 * max + 1, min); // +1 to consider the borrow from the past-comma part; accuracy of past-comma part is determined by the minimum; therefore, for the result not more accuracy is guaranteed\r
+// be aware that this only works if 2*max+1+min <= 32!! adjusting the pre-comma place to the value would consume too much time\r
+\r
+  alu.AssignFormatted(mult);\r
+  alu.SetSign(sign);\r
+  \r
+  return alu;\r
+}\r
+  \r
+//_____________________________________________________________________________  \r
+AliTRDtrapAlu AliTRDtrapAlu::operator/(const AliTRDtrapAlu& binary){\r
+  // / operator\r
\r
+    AliTRDtrapAlu alu;\r
+\r
+  Int_t binPre  = binary.GetPre();\r
+  Int_t binPost = binary.GetPost();\r
+  Int_t min              = Min(binPost,fPostCom);\r
+  Int_t max              = Max(binPre,fPreCom);\r
+  \r
+  Int_t div1             = binary.GetValue(); //value in integer format\r
+  Int_t div2             = fValue;\r
+  \r
+  // this approach does not always work because it can exceed the range of integers\r
+  //Int_t numerator     = div2 * LUT(min);\r
+  Int_t numerator     = div2;\r
+  if (fSigned == kTRUE) numerator = numerator*(-1);\r
+  Int_t denominator   = div1;\r
+  if (binary.GetSign() == kTRUE) denominator = denominator*(-1);\r
+  Double_t fdiv       = 0.0;\r
+  Double_t fLUT       = 0.0;\r
+  Int_t div           = 0;\r
+  \r
+\r
+  if (div1 == 0){\r
+      /*Mem().Init(max + 1,min);\r
+    Mem().AssignFormatted(LUT(max+min+1)-1); // division by 0: set to max value\r
+    //Mem().FastInit(max+1,min,div1);\r
+    return Mem();*/\r
+      alu.Init(max + 1,min);\r
+      alu.AssignFormatted(LUT(max+min+1)-1); // division by 0: set to max value\r
+      return alu;\r
+  }\r
+      \r
+  fdiv = (Double_t)numerator/denominator;\r
+  \r
+  Int_t shift = fPostCom - binPost;\r
+  \r
+  if(shift>0){\r
+      //denominator = denominator * LUT(shift);\r
+      fLUT = (Double_t)LUT(min)/LUT(shift);\r
+  }\r
+  else {\r
+      if(shift<0) {\r
+         shift = -shift;\r
+         //numerator =  numerator * LUT(shift);\r
+         fLUT = (Double_t)LUT(min)*LUT(shift);\r
+      }\r
+      else {\r
+         fLUT = (Double_t)LUT(min);\r
+      }\r
+  }\r
+\r
+  fdiv = fdiv*fLUT;\r
+  div = (Int_t)fdiv;\r
+  \r
+  Int_t sign = (div>=0) ? 1 : -1;\r
+  div = Max(div,-div);\r
+  \r
+  // chose min as past-comma part because from a division of integers you can't get only an integer\r
+  \r
+  /*Mem().Init(max + 1,min); // max+1+min must <= 32!!\r
+  Mem().SetSign(sign);\r
+  Mem().AssignFormatted(div);\r
+  \r
+  return Mem();*/\r
+\r
+  alu.Init(max + 1,min); // max+1+min must <= 32!!\r
+  alu.SetSign(sign);\r
+  alu.AssignFormatted(div);\r
+  \r
+  return alu;\r
+\r
+  \r
+}\r
+\r
+//_____________________________________________________________________________  \r
+Int_t AliTRDtrapAlu::MakePower(const Int_t& base,const  Int_t& exponent)const{\r
+// calculate "base" to the power of "exponent"\r
+  Int_t result = 1;\r
+  \r
+    for(Int_t i = 1; i <= exponent; i++){\r
+    result = result * base;\r
+  }\r
+  return result;\r
+}\r
+\r
+//_____________________________________________________________________________  \r
+Int_t AliTRDtrapAlu::LUT(const Int_t& index){   \r
+  // simple look-up table for base=2\r
+  \r
+    AliTRDtrapAlu alu;\r
+\r
+  static Bool_t fLUT = kFALSE;\r
+  static Int_t gLUT[30];\r
+  if (fLUT == kFALSE) {\r
+    gLUT[0] = 1;\r
+    for(Int_t i = 1; i<30; i++) {\r
+      gLUT[i] = gLUT[i-1] * 2;\r
+    }\r
+  fLUT = kTRUE;\r
+  } \r
+  if (index >=0 && index < 30){\r
+    return gLUT[index];\r
+  }\r
+  else {\r
+    \r
+      //return Mem().MakePower(2,index);\r
+      return alu.MakePower(2,index);\r
+  }\r
+}\r
diff --git a/TRD/attic/AliTRDtrapAlu.h b/TRD/attic/AliTRDtrapAlu.h
new file mode 100644 (file)
index 0000000..d4bc348
--- /dev/null
@@ -0,0 +1,140 @@
+#ifndef ALITRDTRAPALU_H\r
+#define ALITRDTRAPALU_H\r
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
+ * See cxx source for full Copyright notice                               */\r
+\r
+/* $Id: AliTRDtrapAlu.h 23387 2008-01-17 17:25:16Z cblume $ */\r
+\r
+////////////////////////////////////////////////////////////////////////////\r
+//                                                                        //\r
+//  TRAP-ALU implementation                                               //\r
+//                                                                        //\r
+////////////////////////////////////////////////////////////////////////////\r
+\r
+#include <TObject.h>\r
+\r
+class AliTRDtrapAlu:public TObject {\r
\r
+ public:\r
+   \r
+               AliTRDtrapAlu();\r
+              //AliTRDtrapAlu(AliTRDtrapAlu& bin); //copy constructor\r
+  virtual      ~AliTRDtrapAlu();\r
+\r
+\r
+  void Init(const Int_t& precom=10, const Int_t& postcom=2\r
+          , const Int_t& lRestriction = -1, const Int_t& uRestriction = -1);\r
+\r
+  Int_t   GetValue () const { \r
+    // return the value \r
+    return fValue;\r
+  }\r
+\r
+  Int_t   GetSignedValue ()const{  \r
+    // return the value with its sign\r
+    if(fSigned == kFALSE) return fValue;\r
+    else return fValue*(-1);\r
+  }\r
+\r
+  Int_t   GetValuePre ()const{\r
+    // return value of pre-comma part as integer\r
+    Int_t valPre = fValue>>fPostCom;\r
+    return valPre;   \r
+  }\r
+\r
+  Double_t GetValueWhole() const;  \r
+\r
+  Int_t   GetPre()const{\r
+    // return nr of pre-comma bits\r
+    return fPreCom;\r
+  }\r
+\r
+  Int_t   GetPost()const{\r
+    // return nr of past-comma bits\r
+    return fPostCom;\r
+  }\r
+\r
+  Bool_t  GetSign()const{\r
+    // return true if signed\r
+    if(fSigned == kTRUE) return kTRUE;\r
+    return kFALSE;\r
+  }\r
+   \r
+  Bool_t  CheckUSize(const Int_t& val)const{\r
+    // compare value to the upper restriction\r
+    if(val>fuRestriction) return kFALSE;\r
+    return kTRUE;\r
+  }\r
+\r
+  Bool_t  CheckLSize(const Int_t& val)const{\r
+    // compare value to the lower restriction\r
+    if(val<flRestriction) return kFALSE;\r
+    return kTRUE;\r
+  }\r
+\r
+  void AssignFormatted(const Int_t& formVal){ \r
+    // assign a value with proper format; assigns formVal directly to fValue; better not use explicitely\r
+    fValue  = formVal;\r
+    //fValue  = fValue & (LUT(fPreCom + fPostCom) - 1); // no cut-off wanted\r
+  } \r
+\r
+  void SetSign(const Int_t& s){\r
+    // sets the sign\r
+    if(s >= 0) fSigned = kFALSE;\r
+    if(s <  0) fSigned = kTRUE;\r
+  }\r
+\r
+  void   WriteWord();  \r
+\r
+  AliTRDtrapAlu& AssignInt(const  Int_t& first);     // in case a decimal integer is assigned to a binary; \r
+  AliTRDtrapAlu& AssignDouble(const  Double_t& first);  // change "Double_t" into "Float_t"\r
+  AliTRDtrapAlu& operator=(const AliTRDtrapAlu& binary);\r
+       \r
+  AliTRDtrapAlu operator+(const AliTRDtrapAlu& binary); //binary is not const, because in a+(b*c) binary is reference to the object, to which Mem() is also a reference and this object is changed\r
+  AliTRDtrapAlu operator-(const AliTRDtrapAlu& binary);\r
+  AliTRDtrapAlu operator*(const AliTRDtrapAlu& binary);\r
+  AliTRDtrapAlu operator/(const AliTRDtrapAlu& binary);\r
+\r
+ protected:\r
+\r
+  // void FastInit(const Int_t& precom = 10, const Int_t&  postcom = 2, const Int_t& formVal = 0); //meant to combine definition of format with integer-value assignment; not to apply by user  \r
+\r
+  //the following two functions encapsulate global static members; can only be changed by member functions (visibility only inside class)\r
+\r
+  Int_t  MakePower(const Int_t& base=1,const  Int_t& exponent=1)const;\r
+\r
+  /*static AliTRDtrapAlu& Mem() { \r
+    // a global instance of the class, which is only defined once\r
+    static AliTRDtrapAlu fAuxiliary;\r
+    return fAuxiliary;\r
+  }*/\r
+\r
+  static Int_t LUT(const Int_t& index);\r
+       \r
+  const Int_t&  Min(const Int_t& comp1, const Int_t& comp2)const{\r
+    // return the minimum\r
+    if (comp1 <= comp2) return comp1;\r
+    return comp2;\r
+  }\r
+\r
+  const Int_t&  Max(const Int_t& comp1, const Int_t& comp2)const{\r
+    // return the maximum\r
+    if (comp1 >= comp2) return comp1;\r
+    return comp2;\r
+  }\r
+\r
+  //static AliTRDtrapAlu fAlu;\r
+\r
+  Int_t    fValue;          // the value in integers\r
+  Int_t    fPreCom;         // number of pre-comma bits\r
+  Int_t    fPostCom;        // number of past-comma bits\r
+  Int_t    fuRestriction;   // the upper restriction for the value\r
+  Int_t    flRestriction;   // the lower restriction for the value\r
+  Bool_t   fSigned;         // signed value? \r
+\r
+  ClassDef(AliTRDtrapAlu,1) // TRAP-ALU\r
+\r
+};\r
+#endif\r
+\r
+\r
diff --git a/TRD/attic/AliTRDtrigParam.cxx b/TRD/attic/AliTRDtrigParam.cxx
new file mode 100644 (file)
index 0000000..71096fa
--- /dev/null
@@ -0,0 +1,237 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+//  TRD trigger parameters class                                             //
+//                                                                           //
+//  Request an instance with AliTRDCommonParam::Instance()                   //
+//  Then request the needed values                                           //
+//                                                                           //
+//  Author:                                                                  //
+//     Bogdan Vulpescu                                                       //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+#include "AliTRDgeometry.h"
+
+#include "AliTRDtrigParam.h"
+
+ClassImp(AliTRDtrigParam)
+
+AliTRDtrigParam *AliTRDtrigParam::fgInstance = 0;
+Bool_t AliTRDtrigParam::fgTerminated = kFALSE;
+
+//_ singleton implementation __________________________________________________
+AliTRDtrigParam *AliTRDtrigParam::Instance()
+{
+  //
+  // Singleton implementation
+  // Returns an instance of this class, it is created if neccessary
+  //
+
+  if (fgTerminated != kFALSE) {
+    return 0;
+  }
+
+  if (fgInstance == 0) {
+    fgInstance = new AliTRDtrigParam();
+  }
+
+  return fgInstance;
+
+}
+
+//_____________________________________________________________________________
+void AliTRDtrigParam::Terminate()
+{
+  //
+  // Singleton implementation
+  // Deletes the instance of this class and sets the terminated flag,
+  // instances cannot be requested anymore
+  // This function can be called several times.
+  //
+
+  fgTerminated = kTRUE;
+
+  if (fgInstance != 0) {
+    delete fgInstance;
+    fgInstance = 0;
+  }
+
+}
+
+//_____________________________________________________________________________
+AliTRDtrigParam::AliTRDtrigParam()
+  :TObject()
+  ,fTime1(2)
+  ,fTime2(22)
+  ,fClusThr(10.0)
+  ,fPadThr(1)
+  ,fSum10(2)
+  ,fSum12(10)
+  ,fTCOn(1)
+  ,fTCnexp(1)
+  ,fFilterType(0)
+  ,fR1(0)
+  ,fR2(0)
+  ,fC1(0)
+  ,fC2(0)
+  ,fPedestal(0)
+  ,fADCnoise(0)
+  ,fDeltaY(2.0)
+  ,fDeltaS(2.5)
+  ,fXprojPlane(0)
+  ,fLtuPtCut(2.3)
+  ,fGtuPtCut(3.0)
+  ,fHighPt(10.0)
+  ,fNPartJetLow(5)
+  ,fNPartJetHigh(3)
+  ,fJetLowPt(3.0)
+  ,fJetHighPt(5.0)
+{
+  //
+  // AliTRDtrigParam default constructor
+  //
+
+  // PASA.v.4
+  if      (fTCnexp == 1) {
+    fR1 = 1.1563;
+    fR2 = 0.1299;
+    fC1 = 0.0657;
+    fC2 = 0.0000;
+  }
+  else if (fTCnexp == 2) {
+    fR1 = 1.1563;
+    fR2 = 0.1299;
+    fC1 = 0.1141;
+    fC2 = 0.6241;
+  }
+  Init();
+
+}
+
+//_____________________________________________________________________________
+AliTRDtrigParam::AliTRDtrigParam(const AliTRDtrigParam &p)
+  :TObject(p)
+  ,fTime1(p.fTime1)
+  ,fTime2(p.fTime2)
+  ,fClusThr(p.fClusThr)
+  ,fPadThr(p.fPadThr)
+  ,fSum10(p.fSum10)
+  ,fSum12(p.fSum12)
+  ,fTCOn(p.fTCOn)
+  ,fTCnexp(p.fTCnexp)
+  ,fFilterType(p.fFilterType)
+  ,fR1(p.fR1)
+  ,fR2(p.fR2)
+  ,fC1(p.fC1)
+  ,fC2(p.fC2)
+  ,fPedestal(p.fPedestal)
+  ,fADCnoise(p.fADCnoise)
+  ,fDeltaY(p.fDeltaY)
+  ,fDeltaS(p.fDeltaS)
+  ,fXprojPlane(p.fXprojPlane)
+  ,fLtuPtCut(p.fLtuPtCut)
+  ,fGtuPtCut(p.fGtuPtCut)
+  ,fHighPt(p.fHighPt)
+  ,fNPartJetLow(p.fNPartJetLow)
+  ,fNPartJetHigh(p.fNPartJetHigh)
+  ,fJetLowPt(p.fJetLowPt)
+  ,fJetHighPt(p.fJetHighPt)
+{
+  //
+  // AliTRDtrigParam copy constructor
+  //
+
+}
+
+//_____________________________________________________________________________
+AliTRDtrigParam::~AliTRDtrigParam()
+{
+  //
+  // AliTRDtrigParam destructor
+  //
+
+}
+
+//_____________________________________________________________________________
+AliTRDtrigParam &AliTRDtrigParam::operator=(const AliTRDtrigParam &p)
+{
+  //
+  // Assignment operator
+  //
+
+  if (this != &p) ((AliTRDtrigParam &) p).Copy(*this);
+  return *this;
+
+}
+
+//_____________________________________________________________________________
+void AliTRDtrigParam::Copy(TObject &p) const
+{
+  //
+  // Copy function
+  //
+
+  ((AliTRDtrigParam &) p).fTime1        = fTime1;
+  ((AliTRDtrigParam &) p).fTime2        = fTime2;
+  ((AliTRDtrigParam &) p).fClusThr      = fClusThr;
+  ((AliTRDtrigParam &) p).fPadThr       = fPadThr;
+  ((AliTRDtrigParam &) p).fSum10        = fSum10;
+  ((AliTRDtrigParam &) p).fSum12        = fSum12;
+  ((AliTRDtrigParam &) p).fTCOn         = fTCOn;
+  ((AliTRDtrigParam &) p).fTCnexp       = fTCnexp;
+  ((AliTRDtrigParam &) p).fFilterType   = fFilterType;
+  ((AliTRDtrigParam &) p).fR1           = fR1;
+  ((AliTRDtrigParam &) p).fR2           = fR2;
+  ((AliTRDtrigParam &) p).fC1           = fC1;
+  ((AliTRDtrigParam &) p).fC2           = fC2;
+  ((AliTRDtrigParam &) p).fPedestal     = fPedestal;
+  ((AliTRDtrigParam &) p).fADCnoise     = fADCnoise;
+  ((AliTRDtrigParam &) p).fDeltaY       = fDeltaY;
+  ((AliTRDtrigParam &) p).fDeltaS       = fDeltaS;
+  ((AliTRDtrigParam &) p).fXprojPlane   = fXprojPlane;
+  ((AliTRDtrigParam &) p).fLtuPtCut     = fLtuPtCut;
+  ((AliTRDtrigParam &) p).fGtuPtCut     = fGtuPtCut;
+  ((AliTRDtrigParam &) p).fHighPt       = fHighPt;
+  ((AliTRDtrigParam &) p).fNPartJetLow  = fNPartJetLow;
+  ((AliTRDtrigParam &) p).fNPartJetHigh = fNPartJetHigh;
+  ((AliTRDtrigParam &) p).fJetLowPt     = fJetLowPt;
+  ((AliTRDtrigParam &) p).fJetHighPt    = fJetHighPt;
+
+}
+
+//_____________________________________________________________________________
+void AliTRDtrigParam::Init()
+{
+  //
+  // Initialize the other parameters
+  //
+
+  Float_t xPlane0;
+  Float_t xPlane5;
+  xPlane0     = AliTRDgeometry::GetTime0(0) 
+              - AliTRDgeometry::CdrHght() 
+              - 0.5*AliTRDgeometry::CamHght(); 
+  xPlane5     = AliTRDgeometry::GetTime0(5) 
+              - AliTRDgeometry::CdrHght()
+              - 0.5*AliTRDgeometry::CamHght();
+  fXprojPlane = 0.5 * (xPlane0 + xPlane5);
+
+}
+
diff --git a/TRD/attic/AliTRDtrigParam.h b/TRD/attic/AliTRDtrigParam.h
new file mode 100644 (file)
index 0000000..98dd563
--- /dev/null
@@ -0,0 +1,129 @@
+#ifndef ALITRDTRIGPARAM_H
+#define ALITRDTRIGPARAM_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+//  TRD trigger parameters class                                             //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+#include "TObject.h"
+
+class AliTRDtrigParam : public TObject {
+
+ public:
+
+  AliTRDtrigParam(const AliTRDtrigParam &p);   
+  virtual         ~AliTRDtrigParam();
+  AliTRDtrigParam &operator=(const AliTRDtrigParam &p); 
+
+  static AliTRDtrigParam *Instance();
+  static  void     Terminate();
+
+  virtual void     Copy(TObject &p) const;
+
+          void     Init();
+
+          Int_t    GetTime1() const                        { return fTime1;         };
+          Int_t    GetTime2() const                        { return fTime2;         };
+          Float_t  GetClusThr() const                      { return fClusThr;       };
+          Float_t  GetPadThr() const                       { return fPadThr;        };
+          Int_t    GetSum10() const                        { return fSum10;         };
+          Int_t    GetSum12() const                        { return fSum12;         };
+          Int_t    GetTailCancelation() const              { return fTCOn;          };
+          Int_t    GetNexponential() const                 { return fTCnexp;        };
+          Int_t    GetFilterType() const                   { return fFilterType;    };
+          void     GetFilterParam(Float_t &r1, Float_t &r2, Float_t &c1, Float_t &c2, Float_t &ped) const 
+                                                           { r1            = fR1; 
+                                                             r2            = fR2; 
+                                                             c1            = fC1; 
+                                                             c2            = fC2; 
+                                                             ped           = fPedestal; };
+          Float_t  GetADCnoise() const                     { return fADCnoise;      };
+          Float_t  GetDeltaY() const                       { return fDeltaY;        };
+          Float_t  GetDeltaS() const                       { return fDeltaS;        }; 
+          Float_t  GetXprojPlane() const                   { return fXprojPlane;    };
+          Float_t  GetLtuPtCut() const                     { return fLtuPtCut;      };
+          Float_t  GetGtuPtCut() const                     { return fGtuPtCut;      };
+          Float_t  GetHighPt() const                       { return fHighPt;        };
+          Int_t    GetNPartJetLow() const                  { return fNPartJetLow;   };
+          Int_t    GetNPartJetHigh() const                 { return fNPartJetHigh;  };
+          Float_t  GetJetLowPt() const                     { return fJetLowPt;      };
+          Float_t  GetJetHighPt() const                    { return fJetHighPt;     };
+
+          void     SetTimeRange(Int_t time1, Int_t time2)  { fTime1        = time1; 
+                                                             fTime2        = time2; };
+          void     SetClusThr(Float_t clth)                { fClusThr      = clth;  };
+          void     SetPadThr(Float_t path)                 { fPadThr       = path;  };
+          void     SetSum10(Int_t sum)                     { fSum10        = sum;   };
+          void     SetSum12(Int_t sum)                     { fSum12        = sum;   }; 
+          void     SetTailCancelation(Int_t tcOn = 0)      { fTCOn         = tcOn;  };
+          void     SetNexponential(Int_t nexp = 1)         { fTCnexp       = nexp;  };
+          void     SetFilterType(Int_t ftype = 0)          { fFilterType   = ftype; };
+          void     SetFilterParam(Float_t r1, Float_t r2, Float_t c1, Float_t c2, Float_t ped) 
+                                                           { fR1           = r1; 
+                                                             fR2           = r2; 
+                                                             fC1           = c1; 
+                                                             fC2           = c2; 
+                                                             fPedestal     = ped;   };
+          void     SetADCnoise(Float_t adcn)               { fADCnoise     = adcn;  };
+          void     SetDeltaY(Float_t dy)                   { fDeltaY       = dy;    };
+          void     SetDeltaS(Float_t ds)                   { fDeltaS       = ds;    };
+          void     SetLtuPtCut(Float_t ptcut)              { fLtuPtCut     = ptcut; };
+          void     SetGtuPtCut(Float_t ptcut)              { fGtuPtCut     = ptcut; };
+          void     SetHighPt(Float_t hpt)                  { fHighPt       = hpt;   };
+          void     SetNPartJetLow(Int_t npj)               { fNPartJetLow  = npj;   };
+          void     SetNPartJetHigh(Int_t npj)              { fNPartJetHigh = npj;   };
+          void     SetJetLowPt(Float_t thr)                { fJetLowPt     = thr;   };
+          void     SetJetHighPt(Float_t thr)               { fJetHighPt    = thr;   };
+
+ protected:
+
+  static  AliTRDtrigParam *fgInstance;             // Instance of this class (singleton implementation)
+  static  Bool_t           fgTerminated;           // Defines if this class has already been terminated
+
+          Int_t    fTime1;                         // First time bin for tracking (incl.)
+          Int_t    fTime2;                         // Last  time bin for tracking (incl.)
+          Float_t  fClusThr;                       // Cluster threshold
+          Float_t  fPadThr;                        // Pad threshold
+          Int_t    fSum10;                         // MCM CreateSeeds: Min_Thr_Left_Neighbour
+          Int_t    fSum12;                         // MCM CreateSeeds: Min_Sum_From_Two_Neighbours
+          Int_t    fTCOn;                          // Tail cancelation flag
+          Int_t    fTCnexp;                        // Number of exp in filter
+          Int_t    fFilterType;                    // Filter type (0=A - analog, 1=D - digital)
+
+          // Filter parameters (1 = long, 2 = short component)
+          Float_t  fR1;                            // Time constant [microseconds]
+          Float_t  fR2;                            // Time constant [microseconds]
+          Float_t  fC1;                            // Weight
+          Float_t  fC2;                            // Weight
+          Float_t  fPedestal;                      // ADC baseline
+          Float_t  fADCnoise;                      // ADC noise (not contained in the digitizer)
+
+          Float_t  fDeltaY;                        // Y (offset) matching window in the GTU
+          Float_t  fDeltaS;                        // Slope matching window in the GTU
+
+          Float_t  fXprojPlane;                    // Projection plane (X) for GTU matching
+
+          Float_t  fLtuPtCut;                      // Local pt cut
+          Float_t  fGtuPtCut;                      // Global pt cut
+
+          Float_t  fHighPt;                        // High pt selection
+
+          Int_t    fNPartJetLow;                   // Number of tracks for jet (low)
+          Int_t    fNPartJetHigh;                  // Number of tracks for jet (high)
+          Float_t  fJetLowPt;                      // Low pt threshold for jet particles
+          Float_t  fJetHighPt;                     // High pt threshold for jet particles
+
+ private:
+
+  // This is a singleton, constructor is private!
+  AliTRDtrigParam();
+
+  ClassDef(AliTRDtrigParam,3)                      // TRD trigger parameter class
+
+};
+
+#endif