#include <AliTPCParam.h>
+#include <TGeoManager.h>
+#include <TGeoPhysicalNode.h>
+#include "AliAlignObj.h"
+#include "AliAlignObjAngles.h"
+#include "AliLog.h"
+
ClassImp(AliTPCParam)
fResponseBin = 0;
fResponseWeight = 0;
fRotAngle = 0;
+ // fChamberPos = fChamberRot = 0;
+ fTrackingMatrix = fClusterMatrix = fGlobalMatrix = 0;
SetTitle("75x40_100x60_150x60");
SetDefault();
}
if (fResponseBin!=0) delete [] fResponseBin;
if (fResponseWeight!=0) delete [] fResponseWeight;
if (fRotAngle !=0) delete [] fRotAngle;
-
+ // if (fChamberPos !=0) delete [] fChamberPos;
+ // if (fChamberRot !=0) delete [] fChamberRot;
+
+// if (fTrackingMatrix!=0) {
+// for(Int_t i=0;i<fNSector;i++)
+// delete fTrackingMatrix[i];
+// delete [] fTrackingMatrix;
+// }
+// if (fClusterMatrix!=0) {
+// for(Int_t i=0;i<fNSector;i++)
+// delete fClusterMatrix[i];
+// delete [] fClusterMatrix;
+// }
+// if (fGlobalMatrix!=0) {
+// for(Int_t i=0;i<fNSector;i++)
+// delete fGlobalMatrix[i];
+// delete [] fGlobalMatrix;
+// }
}
static const Int_t kMaxTBin =445;
static const Int_t kADCSat =1024;
static const Float_t kADCDynRange =2000.;
- //
- //
- //
- static const Float_t kBField =0.2;
- static const Float_t kNPrimLoss =10.9;
- static const Float_t kNTotalLoss =39.9;
//
//response constants
//
static const Int_t kNResponseMax=100;
static const Float_t kResponseThreshold=0.01;
+ //L1 constants
+ static const Float_t kGateDelay=6.1e-6; //In s
+ static const Float_t kL1Delay=6.5e-6; //In s
+ static const UShort_t kNTBinsBeforeL1=14;
fbStatus = kFALSE;
//
//set sector parameters
SetMaxTBin(kMaxTBin);
SetADCSat(kADCSat);
SetADCDynRange(kADCDynRange);
- //set magnetic field
- SetBField(kBField);
- SetNPrimLoss(kNPrimLoss);
- SetNTotalLoss(kNTotalLoss);
+// //set magnetic field
+// SetBField(kBField);
+// SetNPrimLoss(kNPrimLoss);
+// SetNTotalLoss(kNTotalLoss);
//
//set response parameters
//
SetNResponseMax(kNResponseMax);
SetResponseThreshold(static_cast<int>(kResponseThreshold));
+ //L1 data
+ SetGateDelay(kGateDelay);
+ SetL1Delay(kL1Delay);
+ SetNTBinsBeforeL1(kNTBinsBeforeL1);
}
fRotAngle[i+2] =angle;
fRotAngle[j+2] =angle;
}
+
fZWidth = fTSample*fDriftV;
fTotalNormFac = fPadCoupling*fChipNorm*kQel*1.e15*fChipGain*fADCSat/fADCDynRange;
fNoiseNormFac = kQel*1.e15*fChipGain*fADCSat/fADCDynRange;
if (fResponseWeight==0) delete [] fResponseBin;
fResponseBin = new Int_t[3*fNResponseMax];
fResponseWeight = new Float_t[fNResponseMax];
-
+
+ //L1 data
+ fNTBinsL1 = fL1Delay/fTSample - (Float_t)fNTBinsBeforeL1;
fbStatus = kTRUE;
return kTRUE;
}
+Bool_t AliTPCParam::ReadGeoMatrices(){
+ //
+ //read geo matrixes
+ //
+ if (!gGeoManager){
+ AliFatal("Geo manager not initialized\n");
+ }
+ AliAlignObjAngles o;
+ //
+ if (fTrackingMatrix) delete [] fTrackingMatrix;
+ fTrackingMatrix = new TGeoHMatrix*[fNSector];
+ if (fClusterMatrix) delete [] fClusterMatrix;
+ fClusterMatrix = new TGeoHMatrix*[fNSector];
+ if (fGlobalMatrix) delete [] fGlobalMatrix;
+ fGlobalMatrix = new TGeoHMatrix*[fNSector];
+ //
+ for (Int_t isec=0; isec<fNSector; isec++) {
+ fGlobalMatrix[isec] = 0;
+ AliAlignObj::ELayerID iLayer;
+ Int_t iModule;
+
+ if(isec<fNInnerSector) {
+ iLayer = AliAlignObj::kTPC1;
+ iModule = isec;
+ }
+ else {
+ iLayer = AliAlignObj::kTPC2;
+ iModule = isec - fNInnerSector;
+ }
+
+ UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iModule);
+ const char *path = AliAlignObj::GetVolPath(volid);
+ gGeoManager->cd(path);
+ TGeoHMatrix* m = gGeoManager->GetCurrentMatrix();
+ //
+ TGeoRotation mchange;
+ mchange.RotateY(90); mchange.RotateX(90);
+ Float_t x0 = GetChamberCenter(isec);
+ TGeoTranslation center("center",-x0,0,0);
+ // Convert to global coordinate system
+ //m->Multiply(¢er);
+ fGlobalMatrix[isec] = new TGeoHMatrix(*m);
+ fGlobalMatrix[isec]->Multiply(&(mchange.Inverse()));
+ }
+ return kTRUE;
+}
+
+
Bool_t AliTPCParam::GetStatus() const
{
//get information about object consistency
return fYOuter[irow];
}
+Int_t AliTPCParam::GetSectorIndex(Float_t angle, Int_t row, Float_t z) const
+{
+ // returns the sector index
+ // takes as input the angle, index of the pad row and z position
+ if(row<0) return -1;
+ if (angle > 2.*TMath::Pi()) angle -= 2.*TMath::Pi();
+ if (angle < 0. ) angle += 2.*TMath::Pi();
+
+ Int_t sector;
+ if(row<fNRowLow) {
+ sector=Int_t(TMath::Nint((angle-fInnerAngleShift)/fInnerAngle));
+ if (z<0) sector += (fNInnerSector>>1);
+ }
+ else {
+ sector=Int_t(TMath::Nint((angle-fOuterAngleShift)/fOuterAngle))+fNInnerSector;
+ if (z<0) sector += (fNOuterSector>>1);
+ }
+
+ return sector;
+}
-
-
+Float_t AliTPCParam::GetChamberCenter(Int_t isec) const
+{
+ // returns the default radial position
+ // of the readout chambers
+ if (isec<fNInnerSector)
+ return (fInnerRadiusLow+fInnerRadiusUp)/2.;
+ else
+ return (fOuterRadiusLow+fOuterRadiusUp)/2.;
+}
#include "AliDetectorParam.h"
#include "TMath.h"
+#include <TGeoMatrix.h>
+
class AliTPCParam : public AliDetectorParam {
//////////////////////////////////////////////////////
//////////////////////////////////////////////////////
//return number of valid response bin
virtual void SetDefault(); //set defaut TPCparam
virtual Bool_t Update(); //recalculate and check geometric parameters
+ 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;}
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
//
//
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
//
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) 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
//
//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
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
Int_t *fResponseBin; //!array with bins -calulated
Float_t *fResponseWeight; //!array with response -calulated
+ //---------------------------------------------------------------------
+ // 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,3) //parameter object for set:TPC
+ ClassDef(AliTPCParam,4) //parameter object for set:TPC
};
return fRotAngle[isec*4+2];
}
+//inline void AliTPCParam::GetChamberPos(Int_t isec, Float_t* xyz) const
+//{
+ //
+ //return displacement and rotation of the readout chamber
+ //with respect to the ideal geometry
+// xyz[0] = fChamberPos[isec*3];
+// xyz[1] = fChamberPos[isec*3+1];
+// xyz[2] = fChamberPos[isec*3+2];
+//}
+
+//inline void AliTPCParam::GetChamberRot(Int_t isec, Float_t* angles) const
+//{
+ //
+ //return displacement and rotation of the readout chamber
+ //with respect to the ideal geometry
+// angles[0] = fChamberRot[isec*3];
+// angles[1] = fChamberRot[isec*3+1];
+// angles[2] = fChamberRot[isec*3+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]; */
+/* fGlobalMatrix[index[1]]->MasterToLocal(xyzmaster,xyzlocal); */
+/* xyz[0] = xyzlocal[0]; */
+/* xyz[1] = xyzlocal[1]; */
+/* xyz[2] = TMath::Abs(xyzlocal[2]); */
+/* index[0]=2; */
+/* } */
inline void AliTPCParam::Transform1to2(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
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::Transform2to1(Float_t *xyz, Int_t *index) const
{
//
if (index[1]<fNInnerSector)
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;
}
if (index[2]<fNRowUp1 ) xyz[0]/=fOuter1PadPitchLength;
else xyz[0]/=fOuter2PadPitchLength;
}
+ xyz[1]-=0.5;
index[0]=8;
}