]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/AliTPC.h
Processing of many events possible now
[u/mrichter/AliRoot.git] / TPC / AliTPC.h
index f9f7e36b4534b6d6a7d2d1f15cb810c4a4007bd1..13a6e35111afed0e570b3898abfd0e4abb801288 100644 (file)
@@ -1,61 +1,75 @@
-#ifndef TPC_H
-#define TPC_H
+#ifndef ALITPC_H
+#define ALITPC_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
 ////////////////////////////////////////////////
 //  Manager class for TPC                     //
 ////////////////////////////////////////////////
-
 #include "AliDetector.h"
 #include "AliHit.h" 
 #include "AliDigit.h" 
-#include "AliTPCSecGeo.h" 
-#include <TMatrix.h>
 
-#define MAXTPCTBK 500
 
-class AliTPCcluster;
-class AliTPCtrack;
+class TMatrix;
+class TTree;
+
+class TFile;
+class AliTPCParam;
+class AliTPCDigitsArray;
+class AliTPCClustersArray;
+class AliTPCTrackHits; // M.I.
 
 class AliTPC : public AliDetector {
 protected:
+  Int_t          fDefaults;
   Int_t          fSens;             // ISENS
   Int_t          fSecAL;            // Upper sector selector
   Int_t          fSecAU;            // Lower sector selector
   Int_t          fSecLows[6];       // List of lower sectors selected
   Int_t          fSecUps[12];       // List of upper sectors selected
   Int_t          fNsectors;         // Number of sectors in TPC
-  Int_t          fNclusters;        // Number of clusters in TPC
-  Int_t          fNtracks;          // Number of tracks in TPC
-  Int_t          *fClustersIndex;   // Index for each sector in fClusters
-  Int_t          *fDigitsIndex;     // Index for each sector in fDigits
-  TClonesArray   *fClusters;        // List of clusters for all sectors
-  TClonesArray   *fTracks;          // List of reconstructed tracks
-  
+  //MI changes
+  AliTPCDigitsArray * fDigitsArray;              //!detector digit object  
+  AliTPCClustersArray * fClustersArray; //!detector cluster object
+  AliTPCParam *fTPCParam;           // pointer to TPC parameters 
+  AliTPCTrackHits *fTrackHits;      //!hits for given track M.I.
+  Int_t  fHitType; // if fNewHit = 1 old data structure if 2 new hits
+  //  3 both types  
+  Int_t fDigitsSwitch; // digits type, 0->normal, 1->summable
+
+  //MK changes
+
+  Float_t        fSide;  // selects left(-1), right(+1), or both(0) sides of the TPC
+  Int_t          fNoComp; // number of a drift gas components
+  Int_t          fMixtComp[3]; // drift gas components
+  Float_t        fMixtProp[3]; // mixture proportions
+
 public:
   AliTPC();
   AliTPC(const char *name, const char *title);
   virtual      ~AliTPC();
-  virtual void  AddCluster(Float_t*, Int_t*);
-  /*virtual*/void  AddCluster(const AliTPCcluster&);
-  virtual void  AddDigit(Int_t*, Int_t*);
-  virtual void  AddHit(Int_t, Int_t*, Float_t*);
-  virtual void  AddTrack(Float_t*);
-  /*virtual*/void  AddTrack(const AliTPCtrack&);
+  virtual void  AddHit(Int_t a1, Int_t *a2, Float_t *a3);
   Int_t         DistancetoPrimitive(Int_t px, Int_t py);
   virtual void  BuildGeometry();
   virtual void  CreateGeometry() {}
   virtual void  CreateMaterials();
-  virtual void  Hits2Clusters();
-  virtual void  Hits2Digits();
+  virtual void  Hits2Clusters(TFile *of, Int_t eventn);
+  virtual void  Hits2ExactClustersSector(Int_t isec); // MI change calculate "exact" cluster position
+  virtual void  SDigits2Digits(Int_t eventnumber=0);
+  virtual void  Hits2SDigits(Int_t eventnumber=0);
+  virtual void  Digits2Reco(Int_t eventnumber=0);
+  virtual void  Hits2Digits(Int_t eventnumber=0);   //MI change
+  virtual void  Hits2DigitsSector(Int_t isec);  //MI change
   virtual void  Init();
   virtual Int_t IsVersion() const =0;
-  virtual void  Digits2Clusters();
-  virtual void  Clusters2Tracks();
-  TClonesArray  *Clusters() {return fClusters;}
-  TClonesArray  *Tracks()   {return fTracks;}
-  Int_t         *GetClustersIndex() {return fClustersIndex;}
-  Int_t         *GetDigitsIndex()   {return fDigitsIndex;}
+  virtual void  Digits2Clusters(TFile *of, Int_t eventnumber=0);
+  virtual void  Clusters2Tracks(TFile *of);
+
   Int_t         GetNsectors()       {return fNsectors;}
-  virtual void  MakeBranch(Option_t *opt=" ");
+  virtual void  MakeBranch(Option_t *opt=" ", const char *file=0 );
   virtual void  ResetDigits();
   virtual void  SetSecAL(Int_t sec);
   virtual void  SetSecAU(Int_t sec);
@@ -63,103 +77,62 @@ public:
   virtual void  SetSecUps (Int_t s1,Int_t s2,Int_t s3,Int_t s4,Int_t s5, Int_t s6,
                           Int_t s7,Int_t s8,Int_t s9,Int_t s10, Int_t s11, Int_t s12);
   virtual void  SetSens(Int_t sens);
-  virtual void  StepManager()=0;
-  virtual void  DrawDetector() {}
-  
-private:
-  //
-  //  Private inline functions for AliTPC
-  //
-  inline Float_t P1(const Float_t x){
-#ifndef __CINT__
-    const
-#endif
-    Float_t y=x*x;
-    return(1.25e-3-8.0e-3*x+0.0274*y-0.0523*x*y); //electron is 3 pads away
-  }
-  //
-  inline Float_t P2(const Float_t x){
-#ifndef __CINT__
-    const
-#endif
-    Float_t y=x*x;
 
-    return(.0114-0.0726*x+0.2408*y-0.4421*x*y);    //electron is 2 pads away
-  }
-  //
-  inline Float_t P3(const Float_t x){
-#ifndef __CINT__
-    const
-#endif
-    Float_t y=x*x;
-
-    return(0.0959-0.5204*x+0.9272*y+0.2865*x*y);      //electron is 1 pad away
-  }
-  //
-  inline Float_t P4(const Float_t x){
-#ifndef __CINT__
-    const
-#endif
-      Float_t y=x*x; 
-    return(.2835-2.7*y+11.55*y*y); //electron is here
-  }
 
+  virtual void  SetSide(Float_t side);
+  virtual void  SetGasMixt(Int_t nc,Int_t c1,Int_t c2,Int_t c3,Float_t p1,
+                           Float_t p2,Float_t p3); 
 
-  //
-  //  Time response, 3 sigma truncated Gaussian
-  //
-  inline Float_t TimeRes(const Float_t x) {
-#ifndef __CINT__
-    const 
-#endif
-      Float_t sigma = fwhm/2.354820045;
-#ifndef __CINT__
-    const
-#endif
-      Float_t trunc = 3.*sigma;
-    const Float_t norm = 0.4; // according to H-G. Fischer
-#ifndef __CINT__
-    const
-#endif
-      Float_t x1 = x-trunc;
-    return (TMath::Abs(x1)>trunc) ? 0 : norm*TMath::Exp(-0.5*x1*x1/sigma/sigma);
-  }
-  //
-  // Private prototypes for Alice TPC
-  //
-  void CreateList(Int_t *tracks,Float_t signal[][MAXTPCTBK+1],Int_t ntr,Int_t time);
-  void DigSignal(Int_t isec,Int_t irow,TObjArray *pointer);
-  void ElDiff(Float_t *xyz);
-  
-  ClassDef(AliTPC,2)  // Time Projection Chamber class
-};
+  virtual void  StepManager()=0;
+  virtual void  DrawDetector() {}
+  AliTPCDigitsArray*  GetDigitsArray() {return fDigitsArray;} //MI change
+  AliTPCClustersArray* GetClustersArray(){return fClustersArray;} //MI change
+  AliTPCParam *GetParam(){return fTPCParam;} // M.K, M.I changes
+  void SetParam(AliTPCParam *param){fTPCParam=param;} // M.K, M.I changes
+  void SetDigitsArray(AliTPCDigitsArray* param) {fDigitsArray=param;}  //MI change
+  void SetClustersArray(AliTPCClustersArray *clusters) {fClustersArray = clusters;} //MI change
+
+// additional function neccesary for the new hits 
+   virtual void MakeBranch2(Option_t *opt=" ", const char *file=0);  //
+   virtual void SetTreeAddress();
+   virtual void SetTreeAddress2();
+   virtual void AddHit2(Int_t a1,  Int_t *a2, Float_t *a3);  //
+   virtual void ResetHits();
+   virtual void ResetHits2();     
+   virtual AliHit* FirstHit(Int_t track);
+   virtual AliHit* NextHit();
+   virtual AliHit* FirstHit2(Int_t track);
+   virtual AliHit* NextHit2();
+   
+   virtual void LoadPoints(Int_t dummy);
+   virtual void LoadPoints2(Int_t dummy);
+   virtual void LoadPoints3(Int_t dumy);
+   virtual void FinishPrimary();
+   virtual void RemapTrackHitIDs(Int_t *map);
+   virtual void FindTrackHitsIntersection(TClonesArray * arr);
+   //fill clones array with intersection of current point with the
+   //middle of the row
+   void SetHitType(Int_t type){fHitType =type;} //set type of hit container
+   void SetDigitsSwitch(Int_t sw){fDigitsSwitch = sw;}
+   void SetDefSwitch(Int_t def){fDefaults = def;}
 
-//_____________________________________________________________________________
 
-class AliTPCcluster : public TObject {
-public:
-  Int_t     fTracks[3];//labels of overlapped tracks
-  Int_t     fSector;   //sector number
-  Int_t     fPadRow;   //PadRow number
-  Float_t   fY ;       //Y of cluster
-  Float_t   fZ ;       //Z of cluster
-  Float_t   fQ ;       //Q of cluster (in ADC counts)
-  Float_t   fSigmaY2;  //Sigma Y square of cluster
-  Float_t   fSigmaZ2;  //Sigma Z square of cluster
-  
-public:
-  AliTPCcluster() {
-    fTracks[0]=fTracks[1]=fTracks[2]=0; 
-    fSector=fPadRow=0;
-    fY=fZ=fQ=fSigmaY2=fSigmaZ2=0.;
-  }
-  AliTPCcluster(Float_t *hits, Int_t*);
-  virtual ~AliTPCcluster() {;}
-  void Use() {fTracks[0]=-fTracks[0];}
-  int IsUsed() const {return (fTracks[0]<0) ? 1 : 0;}
-  void GetXYZ(Double_t& x,Double_t& y,Double_t& z) const; //Get global x,y,z
+private:
+  //
+  void SetDefaults();
+  void DigitizeRow(Int_t irow,Int_t isec,TObjArray **rowTriplet);
+  Float_t GetSignal(TObjArray *p1, Int_t ntr, TMatrix *m1, TMatrix *m2,
+                    Int_t *IndexRange);
+  void GetList (Float_t label,Int_t np,TMatrix *m,Int_t *IndexRange,
+                Float_t **pList);
+  void MakeSector(Int_t isec,Int_t nrows,TTree *TH,Stat_t ntracks,TObjArray **row);
+  void TransportElectron(Float_t *xyz, Int_t *index);
+  Int_t fCurrentIndex[4];// index[0] indicates coordinate system, 
+                         // index[1] sector number, 
+                         // index[2] pad row number  
+                         // index[3] pad row number for which signal is calculated
   
-  ClassDef(AliTPCcluster,1)  // Time Projection Chamber clusters
+  ClassDef(AliTPC,4)  // Time Projection Chamber class
 };
 
 
@@ -194,120 +167,20 @@ public:
    AliTPChit() {}
    AliTPChit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits);
    virtual ~AliTPChit() {}
+   void SetX(Float_t x){fX = x;}
+   void SetY(Float_t y){fY = y;}
+   void SetZ(Float_t z){fZ = z;}
  
    ClassDef(AliTPChit,1)  // Time Projection Chamber hits
 };
-//_____________________________________________________________________________
-const unsigned MAX_CLUSTER_PER_ROW=500;
-const Double_t FIELD=0.2;
-
-class AliTPCtrack : public TObject {
-   Double_t fAlpha;          // rotation angle
-   Double_t ref;             // track reference plane (X-coordinate)
-   TVector x;                // vector of track parameters
-   TMatrix C;                // covariance matrix of track parameters
-   TObjArray clusters;       // pointers to clusters belonging to this track
-   Double_t chi2;            // total chi2 value for this track
-public:
-   AliTPCtrack(Float_t *hits);
-   AliTPCtrack(const AliTPCcluster& c, const TVector& xx, const TMatrix& CC); 
-   AliTPCtrack(const AliTPCtrack& t);
-   int PropagateTo(Double_t x,
-                    Double_t x0=28.94,Double_t rho=0.9e-3,Double_t pm=0.139);
-   void PropagateToVertex(
-                    Double_t x0=36.66,Double_t rho=1.2e-3,Double_t pm=0.139);
-   void Update(const AliTPCcluster* c, Double_t chi2);
-   int Rotate(Double_t angle);
 
-   void UseClusters() const ;
-   Double_t GetPredictedChi2(const AliTPCcluster*) const ;
-   Double_t GetX() const {return ref;}
-   Double_t GetY() const {return x(0);}
-   Double_t GetC() const {return x(2);}
-   Double_t GetY(Double_t x) const;
-   Double_t GetZ() const {return x(1);}
-   Double_t GetTgl() const {return x(4);}
-   Double_t GetPt() const {return 0.3*FIELD/x(2)/100;}
-   int GetLab() const ;
-   Double_t GetSigmaY2() const {return C(0,0);}
-   Double_t GetSigmaZ2() const {return C(1,1);}
-   Double_t GetSigmaC2() const {return C(2,2);}
-   Double_t GetSigmaTgl2() const {return C(4,4);}
-   Double_t GetAlpha() const {return fAlpha;}
-   Double_t GetChi2() const {return chi2;}
-   operator int() const {return clusters.GetEntriesFast();}
-   AliTPCcluster& operator[](int i) {
-      return *((AliTPCcluster*)clusters.UncheckedAt(i));
-   } 
-   void GetPxPyPz(Double_t&, Double_t&, Double_t&) const ;
-   void GetXYZ(Double_t& X,Double_t& Y,Double_t& Z) const {X=ref;Y=x(0);Z=x(1);}
-   ClassDef(AliTPCtrack,1)  // Time Projection Chamber reconstructed tracks
-};
+#endif
 
-//_____Classes for internal tracking use ______________________________________
 
-class TrackSeed : public AliTPCtrack {
-public:
-   TrackSeed(const AliTPCcluster& c, const TVector& x, const TMatrix& C) :
-   AliTPCtrack(c,x,C) {}
-   Bool_t IsSortable() const {return kTRUE;}
-   Int_t Compare(TObject *o) {
-      AliTPCtrack *t=(AliTPCtrack*)o;
-      Double_t c =GetSigmaY2();
-      Double_t co=t->GetSigmaY2();
-      if (c>co) return 1;
-      else if (c<co) return -1;
-      return 0;
-   }
-};
 
-class AliTPCRow {
-   unsigned num_of_clusters;
-   const AliTPCcluster *clusters[MAX_CLUSTER_PER_ROW];
-public:
-   AliTPCRow() {num_of_clusters=0;}
-   void InsertCluster(const AliTPCcluster*);
 
-   operator int() const {return num_of_clusters;}
-   const AliTPCcluster* operator[](int i) const {return clusters[i];}
-   int Find(Double_t y) const; 
-};
 
-class AliTPCSector {
-   unsigned num_of_rows; 
-   AliTPCRow *row;
-public:
-   AliTPCSector(int nl) { 
-      row = new AliTPCRow[nl]; num_of_rows=nl;
-   }
-   virtual ~AliTPCSector() { delete[] row; }
-   AliTPCRow& operator[](int i) const { return *(row+i); }
-   virtual Double_t GetX(int l) const = 0;
-   virtual Double_t GetMaxY(int l) const = 0;
-   virtual Double_t GetAlpha() const = 0;
-};
 
-class AliTPCSSector : public AliTPCSector {
-public:
-   AliTPCSSector(): AliTPCSector(nrow_low){}
-   virtual ~AliTPCSSector() {}
-   Double_t GetX(int l) const { return pad_row_low[0] + (l+0.0)*pad_pitch_l; }
-   Double_t GetMaxY(int l) const { return GetX(l)*tan(0.5*alpha_low); }
-   Double_t GetAlpha() const {return alpha_low;}
-};
 
-class AliTPCLSector : public AliTPCSector {
-public:
-   AliTPCLSector(): AliTPCSector(nrow_up){}
-   virtual ~AliTPCLSector() {}
-   Double_t GetX(int l) const { return pad_row_up[0] + (l+0.0)*pad_pitch_l; }
-   Double_t GetMaxY(int l) const { return GetX(l)*tan(0.5*alpha_up); }
-   Double_t GetAlpha() const {return alpha_up;}
-};
 
-#endif