]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/AliTPCParam.h
AliTPCcalibTimeGain.cxx - Adding the Gamma conversion selected electorns
[u/mrichter/AliRoot.git] / TPC / AliTPCParam.h
index 86c9ee74b0e1fced2d1fa5d00ff7500b91e9360f..d3bf7da2a6c8c00e556c0247060e1b771db31537 100644 (file)
@@ -12,7 +12,7 @@
 #include "AliDetectorParam.h"
 #include "TMath.h"
 
-
+#include <TGeoMatrix.h>
 
 class AliTPCParam : public AliDetectorParam {
   //////////////////////////////////////////////////////
@@ -24,14 +24,16 @@ class AliTPCParam : public AliDetectorParam {
 public:
   AliTPCParam(); 
   virtual ~AliTPCParam();
-  
+  TGeoHMatrix *  Tracking2LocalMatrix(const TGeoHMatrix * geoMatrix, Int_t sector) const;  
   virtual Bool_t  Transform(Float_t *xyz, Int_t *index, Int_t* oindex);
   //transformation from input coodination system to output coordination system  
   Int_t  Transform0to1(Float_t *xyz, Int_t *index) const;
   //trasforamtion from global to global - adjust index[0] sector 
   //return value is equal to sector corresponding to global position
+  void Transform1to2Ideal(Float_t *xyz, Int_t *index) const;
+  //transformation to rotated coordinata - ideal frame 
   void Transform1to2(Float_t *xyz, Int_t *index) const;
-  //transformation to rotated coordinata 
+  //transformation to rotated coordinata   
   void Transform2to1(Float_t *xyz, Int_t *index) const;
   //transformation from rotated coordinata to global coordinata
   void Transform2to2(Float_t *xyz, Int_t *index, Int_t *oindex) const;
@@ -63,42 +65,43 @@ public:
   void  Transform8to6(Float_t *xyz, Int_t *index) const;
   //transform 'digit' coordinata to dr,f coordinata 
 
-  virtual Int_t  Transform2toPadRow(Float_t *xyz, Int_t *index) const{return 0;}
+  virtual Int_t  Transform2toPadRow(Float_t */*xyz*/, Int_t */*index*/) const{return 0;}
   //transform rotated to
 
   virtual  Int_t GetPadRow(Float_t *xyz, Int_t *index) const ;
   //return pad row of point xyz - xyz is given in coordinate system -(given by index)
   //output system is 3 for straight row and 7 for cylindrical row
-  virtual void XYZtoCRXYZ(Float_t *xyz
-                     Int_t &sector, Int_t &padrow, Int_t option=3) const {;}
+  virtual void XYZtoCRXYZ(Float_t */*xyz*/
+                         Int_t &/*sector*/, Int_t &/*padrow*/, Int_t /*option*/) const {;}
   //transform global position to the position relative to the sector padrow
   //if option=0  X calculate absolute            calculate sector
   //if option=1  X           absolute            use input sector
   //if option=2  X           relative to pad row calculate sector
   //if option=3  X           relative            use input sector
 
-  virtual void CRXYZtoXYZ(Float_t *xyz,
-                         const Int_t &sector, const Int_t & padrow, Int_t option=3) const {;}  
+  virtual void CRXYZtoXYZ(Float_t */*xyz*/,
+                         const Int_t &/*sector*/, const Int_t & /*padrow*/, Int_t /*option*/) const {;}  
   //transform relative position  to the gloabal position
 
-  virtual void CRTimePadtoYZ(Float_t &y, Float_t &z
-                            const Float_t &time, const Float_t &pad,
-                            Int_t sector, Int_t padrow ){;}
+  virtual void CRTimePadtoYZ(Float_t &/*y*/, Float_t &/*z*/
+                            const Float_t &/*time*/, const Float_t &/*pad*/,
+                            Int_t /*sector*/, Int_t /*padrow*/ ){;}
   //transform position in digit  units (time slices and pads)  to "normal" 
   //units (cm)   
-  virtual void CRYZtoTimePad(const Float_t &y, const Float_t &z
-                            Float_t &time, Float_t &pad,
-                            Int_t sector, Int_t padrow){;}
+  virtual void CRYZtoTimePad(const Float_t &/*y*/, const Float_t &/*z*/
+                            Float_t &/*time*/, Float_t &/*pad*/,
+                            Int_t /*sector*/, Int_t /*padrow*/){;}
   //transform position in cm to position in digit unit 
-  virtual Int_t   CalcResponse(Float_t* x, Int_t * index, Int_t row){return 0;}
+  virtual Int_t   CalcResponse(Float_t* /*x*/, Int_t * /*index*/, Int_t /*row*/){return 0;}
   //calculate bin response as function of the input position -x and the weight 
   //if row -pad row is equal -1 calculate response for each pad row 
   //otherwise it calculate only in given pad row
   //return number of valid response bin
   virtual void SetDefault();          //set defaut TPCparam 
   virtual Bool_t Update();            //recalculate and check geometric parameters 
-  Bool_t GetStatus();         //get information about object consistency  
-  Int_t GetIndex(Int_t sector, Int_t row);  //give index of the given sector and pad row 
+  virtual Bool_t ReadGeoMatrices();   //read geo matrixes        
+  Bool_t GetStatus() const;         //get information about object consistency  
+  Int_t GetIndex(Int_t sector, Int_t row) const;  //give index of the given sector and pad row 
   Int_t GetNSegmentsTotal() const {return fNtRows;} 
   Double_t GetLowMaxY(Int_t irow) const {return irow*0.;}
   Double_t GetUpMaxY(Int_t irow) const {return irow*0;}
@@ -110,6 +113,8 @@ public:
   void  AdjustCosSin(Int_t isec, Float_t &cos, Float_t &sin) const;
   //set cosinus and sinus of rotation angles for sector isec 
   Float_t GetAngle(Int_t isec) const;
+  //  void GetChamberPos(Int_t isec, Float_t* xyz) const;
+  //  void GetChamberRot(Int_t isec, Float_t* angles) const;
   //
   //set sector parameters
   //
@@ -192,6 +197,10 @@ public:
   //
   void  SetNResponseMax(Int_t max) { fNResponseMax = max;} 
   void  SetResponseThreshold(Int_t threshold) {fResponseThreshold = threshold;}
+  //set L1 parameters
+  void  SetGateDelay(Float_t delay) {fGateDelay = delay;}
+  void  SetL1Delay(Float_t delay) {fL1Delay = delay;}
+  void  SetNTBinsBeforeL1(UShort_t nbins) {fNTBinsBeforeL1 = nbins;}
   //
   //get sector parameters
   //
@@ -210,7 +219,7 @@ public:
   Int_t    GetNInnerSector() const {return fNInnerSector;}
   Int_t    GetNOuterSector() const {return fNOuterSector;}
   Int_t    GetNSector() const {return fNSector;}
-  Float_t  GetZLength() const {return fZLength;}
+  Float_t  GetZLength(Int_t sector=0) const;
   Int_t    GetGeometryType() const {return fGeometryType;}
 
   //
@@ -227,7 +236,7 @@ public:
   Float_t  GetOuterWWPitch() const {return fOuterWWPitch;}  
   Int_t    GetOuterDummyWire() const {return fOuterDummyWire;}
   Float_t  GetOuterOffWire() const {return fOuterOffWire;}
-  Float_t  GetLastWireUp1()  {return fLastWireUp1;}
+  Float_t  GetLastWireUp1()  const {return fLastWireUp1;}
   Float_t  GetROuterFirstWire() const {return fROuterFirstWire;}
   Float_t  GetROuterLastWire() const {return fROuterLastWire;}  
   Float_t  GetWWPitch(Int_t isector = 0) const  {
@@ -250,18 +259,14 @@ public:
   Float_t  GetPadPitchWidth(Int_t isector = 0) const  {
     return ( (isector < fNInnerSector) ? fInnerPadPitchWidth :fOuterPadPitchWidth);}
   Float_t  GetPadPitchLength(Int_t isector = 0, Int_t padrow=0)  const
-  {
-    if (isector < fNInnerSector) {return fInnerPadPitchLength;} 
-    else { 
-     return ((padrow<fNRowUp1) ? fOuter1PadPitchLength:fOuter2PadPitchLength);
-    }
-  }
+  { if (isector < fNInnerSector) return fInnerPadPitchLength; 
+    else return ((padrow<fNRowUp1) ? fOuter1PadPitchLength:fOuter2PadPitchLength);}
   Int_t GetNRowLow() const;   //get the number of pad rows in low sector
   Int_t GetNRowUp() const;    //get the number of pad rows in up sector
   Int_t GetNRowUp1() const;  // number of short rows in up sector  
   Int_t GetNRowUp2() const;  // number of long rows in up sector
   Int_t GetNRow(Int_t isec) const {return  ((isec<fNInnerSector) ?  fNRowLow:fNRowUp);}
-  Int_t GetNRowsTotal(){return fNtRows;}  //get total nuber of rows
+  Int_t GetNRowsTotal() const {return fNtRows;}  //get total nuber of rows
   Float_t GetPadRowRadiiLow(Int_t irow) const; //get the pad row (irow) radii
   Float_t GetPadRowRadiiUp(Int_t irow) const;  //get the pad row (irow) radii
   Float_t GetPadRowRadii(Int_t isec,Int_t irow) const {
@@ -274,6 +279,15 @@ public:
 
   Float_t GetYInner(Int_t irow) const; // wire length in low sec row
   Float_t GetYOuter(Int_t irow) const; // wire length in up sec row  
+  Int_t GetSectorIndex(Float_t angle, Int_t row, Float_t z) const; // get sector index
+  Float_t GetChamberCenter(Int_t isec, Float_t * center = 0) const; // get readout chamber positions
+  TGeoHMatrix *GetTrackingMatrix(Int_t isec) const {
+    return fTrackingMatrix[isec];}
+  TGeoHMatrix *GetClusterMatrix(Int_t isec) const {
+    return fClusterMatrix[isec];}
+  TGeoHMatrix *GetGlobalMatrix(Int_t isec) const {
+    return fGlobalMatrix[isec];}
+  Bool_t   IsGeoRead(){ return fGlobalMatrix!=0;}
   //
   //get GAS parameters 
   //
@@ -296,7 +310,7 @@ public:
   Float_t  GetZWidth() const {return fZWidth;}
   Float_t  GetTFWHM() const {return fTSigma*2.35;}
   Float_t  GetZSigma() const {return fTSigma*fDriftV;}  
-  virtual  Float_t  GetZOffset() {return 3*fTSigma*fDriftV;}
+  virtual  Float_t  GetZOffset() const {return 3*fTSigma*fDriftV;}
   Int_t    GetMaxTBin() const {return fMaxTBin;}
   Int_t    GetADCSat() const {return fADCSat;}
   Float_t  GetADCDynRange() const {return fADCDynRange;}
@@ -309,6 +323,12 @@ public:
   //return response bin i  - bin given by  padrow [0] pad[1] timebin[2] 
   Float_t & GetResWeight(Int_t i);
   //return  weight of response bin i
+
+  // get L1 data
+  Float_t  GetGateDelay() const {return fGateDelay;}
+  Float_t  GetL1Delay() const {return fL1Delay;}
+  UShort_t GetNTBinsBeforeL1() const {return fNTBinsBeforeL1;}
+  Float_t  GetNTBinsL1() const {return fNTBinsL1;}
 protected :
 
   Bool_t fbStatus;  //indicates consistency of the data
@@ -334,6 +354,18 @@ protected :
   Float_t *fRotAngle;         //[fNSector]  sin and cos of rotation angles for 
                               //  diferent sectors -calculated
   Int_t   fGeometryType;      //type of geometry -0 straight rows
+  //  Float_t *fChamberPos;       //[fNSector] displacements of the readout chambers 
+                              //with respect to the 'idead' geometry
+                              //in local corrdinate system
+  //  Float_t *fChamberRot;       //[fNSector] rotation angles of the readout chambers 
+                              //with respect to the 'idead' geometry
+                              //in local corrdinate system
+  TGeoHMatrix **fTrackingMatrix;   //![fNSector] transformation matrices of the tracking
+                              //coordinate system
+  TGeoHMatrix **fClusterMatrix;    //![fNSector] transformation matrices of the cluster
+                              //coordinate system
+  TGeoHMatrix **fGlobalMatrix;    //![fNSector] fTrackingMatrix * fClusterMatrix
+
   //1-cylindrical
   //---------------------------------------------------------------------
   //   ALICE TPC wires  geometry - for GEM we can consider that it is gating  
@@ -346,7 +378,7 @@ protected :
   Float_t fRInnerLastWire;    //position of the last wire                 -calculated
   Float_t fLastWireUp1;     //position of the last wire in outer1 sector
   Int_t   fNOuter1WiresPerPad; //Number of wires per pad
-  Int_t   fNOuter2WiresPerPad;  
+  Int_t   fNOuter2WiresPerPad; // Number of wires per pad
   Float_t fOuterWWPitch;      //pitch between wires in outer sector      -calculated
   Int_t   fOuterDummyWire;    //number of wires without pad readout
   Float_t fOuterOffWire;      //oofset of first wire to the begining of the sector
@@ -360,10 +392,10 @@ protected :
   Float_t   fInnerPadLength;         //Inner pad  length
   Float_t   fInnerPadWidth;          //Inner pad  width
   Float_t   fOuter1PadPitchLength;    //Outer pad pitch length
-  Float_t   fOuter2PadPitchLength;    
+  Float_t   fOuter2PadPitchLength;    //Outer pad pitch length
   Float_t   fOuterPadPitchWidth;     //Outer pad pitch width
   Float_t   fOuter1PadLength;         //Outer pad  length
-  Float_t   fOuter2PadLength;
+  Float_t   fOuter2PadLength;         //Outer pad length
   Float_t   fOuterPadWidth;          //Outer pad  width
   Bool_t    fBMWPCReadout;           //indicate wire readout - kTRUE or GEM readout -kFALSE
   Int_t     fNCrossRows;             //number of rows to crostalk calculation
@@ -407,8 +439,6 @@ protected :
   Float_t fTotalNormFac;    //full normalisation factor - calculated
   Float_t fNoiseNormFac;    //normalisation factor to transform noise in electron to ADC channel   
   
-protected:
   //---------------------------------------------------------------------
   // ALICE TPC response data 
   //---------------------------------------------------------------------
@@ -418,7 +448,18 @@ protected:
   Int_t   *fResponseBin;    //!array with bins                     -calulated
   Float_t *fResponseWeight; //!array with response                 -calulated
 
-  ClassDef(AliTPCParam,3)  //parameter  object for set:TPC
+  //---------------------------------------------------------------------
+  //   ALICE TPC L1 Parameters
+  //--------------------------------------------------------------------
+  Float_t fGateDelay;       //Delay of L1 arrival for the TPC gate signal
+  Float_t fL1Delay;         //Delay of L1 arrival for the TPC readout 
+  UShort_t fNTBinsBeforeL1; //Number of time bins before L1 arrival which are being read out 
+  Float_t fNTBinsL1;        //Overall L1 delay in time bins
+
+private:
+  AliTPCParam(const AliTPCParam &);
+  AliTPCParam & operator=(const AliTPCParam &);
+  ClassDef(AliTPCParam,4)  //parameter  object for set:TPC
 };
 
  
@@ -427,7 +468,7 @@ inline Int_t * AliTPCParam::GetResBin(Int_t i)
   //return response bin i  - bin given by  padrow [0] pad[1] timebin[2] 
   if (i<fCurrentMax) return &fResponseBin[i*3];
   else return 0;
-};
+}
   
 inline Float_t &AliTPCParam::GetResWeight(Int_t i)
 {
@@ -455,22 +496,42 @@ inline Float_t   AliTPCParam::GetAngle(Int_t isec) const
 }
 
 
-inline void AliTPCParam::Transform1to2(Float_t *xyz, Int_t *index) const
+inline void AliTPCParam::Transform1to2Ideal(Float_t *xyz, Int_t *index) const
 {
-  //transformation to rotated coordinates 
+  //transformation to rotated coordinates
   //we must have information about sector!
-
   //rotate to given sector
+  // ideal frame
+
   Float_t cos,sin;
-  AdjustCosSin(index[1],cos,sin);   
+  AdjustCosSin(index[1],cos,sin);
   Float_t x1=xyz[0]*cos + xyz[1]*sin;
-  Float_t y1=-xyz[0]*sin + xyz[1]*cos; 
+  Float_t y1=-xyz[0]*sin + xyz[1]*cos;
   xyz[0]=x1;
   xyz[1]=y1;
-  xyz[2]=fZLength-TMath::Abs(xyz[2]); 
+  xyz[2]=fZLength-TMath::Abs(xyz[2]);
+  index[0]=2;
+}
+
+
+inline void AliTPCParam::Transform1to2(Float_t *xyz, Int_t *index) const
+{
+  //transformation to rotated coordinates 
+  //we must have information about sector!
+  //rotate to given sector
+  Double_t xyzmaster[3] = {xyz[0],xyz[1],xyz[2]};
+  Double_t xyzlocal[3]={0,0,0};
+  if (index[1]>=0 && index[1]<fNSector) 
+    fGlobalMatrix[index[1]]->MasterToLocal(xyzmaster,xyzlocal);
+  xyz[0] = xyzlocal[0];
+  xyz[1] = xyzlocal[1];
+  xyz[2] = xyzlocal[2];
   index[0]=2;
 }
 
+
+
+
 inline void AliTPCParam::Transform2to1(Float_t *xyz, Int_t *index) const
 {
   //
@@ -484,9 +545,9 @@ inline void AliTPCParam::Transform2to1(Float_t *xyz, Int_t *index) const
   xyz[1]=y1;
   xyz[2]=fZLength-xyz[2]; 
   if (index[1]<fNInnerSector)
-    if ( index[1]>=(fNInnerSector>>1)) xyz[2]*=-1.;
+    {if ( index[1]>=(fNInnerSector>>1))        xyz[2]*=-1.;}
   else 
-    if ( (index[1]-fNInnerSector) > (fNOuterSector>>1) )    xyz[2]*=-1;      
+    {if ( (index[1]-fNInnerSector) >= (fNOuterSector>>1) )    xyz[2]*=-1;}
   index[0]=1;
 }
 
@@ -509,12 +570,10 @@ inline Float_t  AliTPCParam::Transform2to2NearestWire(Float_t *xyz, Int_t *index
   Float_t xnew,dx;
   if (index[1]<fNInnerSector) {
      xnew = fRInnerFirstWire+TMath::Nint((xyz[0]-fRInnerFirstWire)/fInnerWWPitch)*fInnerWWPitch;
-       }
+    }
     else {
      xnew = fROuterFirstWire+TMath::Nint((xyz[0]-fROuterFirstWire)/fOuterWWPitch)*fOuterWWPitch;
     }
-    
   dx = xnew-xyz[0];
   xyz[0]=xnew;
   return  dx;
@@ -608,6 +667,13 @@ inline void AliTPCParam::Transform4to8(Float_t *xyz, Int_t *index) const
   //transform xyz coordinates to 'digit' coordinates
   //
 
+  if (index[1]<fNInnerSector) {
+    if ( index[1]>=(fNInnerSector>>1)) xyz[1]*=-1.;
+  }
+  else {
+    if ( (index[1]-fNInnerSector) >= (fNOuterSector>>1) ) xyz[1]*=-1;      
+  }
+
   xyz[2]/=fZWidth;  
   if  (index[1]<fNInnerSector) {    
     xyz[0]/=fInnerPadPitchLength;
@@ -618,6 +684,7 @@ inline void AliTPCParam::Transform4to8(Float_t *xyz, Int_t *index) const
     if (index[2]<fNRowUp1 ) xyz[0]/=fOuter1PadPitchLength;      
     else xyz[0]/=fOuter2PadPitchLength;     
   }
+  xyz[1]-=0.5;
   index[0]=8;
 }
 
@@ -626,6 +693,13 @@ inline void AliTPCParam::Transform8to4(Float_t *xyz, Int_t *index) const
   //
   //transforms 'digit' coordinates to xyz coordinates
   //
+  if (index[1]<fNInnerSector) {
+    if ( index[1]>=(fNInnerSector>>1)) xyz[1]*=-1.;
+  }
+  else {
+    if ( (index[1]-fNInnerSector) >= (fNOuterSector>>1) ) xyz[1]*=-1;      
+  }
+
   xyz[2]*=fZWidth;
   if  (index[1]<fNInnerSector) {    
     xyz[0]*=fInnerPadPitchLength;
@@ -674,5 +748,8 @@ inline void  AliTPCParam::Transform8to6(Float_t *xyz, Int_t *index) const
   }  
   index[0]=6;
 }
-
+inline Float_t AliTPCParam::GetZLength(Int_t sector) const
+{ if(sector <18 || (sector>35&&sector<54)) return   fZLength-0.275;
+  else return fZLength-0.302;
+}
 #endif