+ virtual ~AliITSgeom(); // Default destructor
+ // Zero and reinitilizes this class.
+ void Init(Int_t itype,Int_t nlayers,const Int_t *nlads,
+ const Int_t *ndets,Int_t mods);
+ // this function allocates a AliITSgeomMatrix for a particular module.
+ void CreateMatrix(Int_t mod,Int_t lay,Int_t lad,Int_t det,
+ AliITSDetector idet,const Double_t tran[3],
+ const Double_t rot[10]);
+ void ReadNewFile(const char *filename); // Constructor for new format.
+ void WriteNewFile(const char *filename)const; // Output for new format.
+ // Getters
+ Int_t GetTransformationType() const {return fTrans;}
+ //
+ // returns kTRUE if the transformation defined by this class is
+ // for Global GEANT coordinate system to the local GEANT coordinate system
+ // of the detector. These are the transformation used by GEANT.
+ Bool_t IsGeantToGeant() const {return (fTrans == 0);}
+ // returns kTRUE if the transformation defined by this class is
+ // for Global GEANT coordinate system to the local "Tracking" coordinate
+ // system of the detector. These are the transformation used by the
+ // Tracking code.
+ Bool_t IsGeantToTracking() const {return ((fTrans&&0xfffe)!= 0);}
+ // returns kTRUE if the transformation defined by this class is
+ // for Global GEANT coordinate system to the local GEANT coordinate system
+ // of the detector but may have been displaced by some typically small
+ // amount. These are modified transformation similar to that used by GEANT.
+ Bool_t IsGeantToDisplaced() const {return ((fTrans&&0xfffd)!= 0);}
+ // returns kTRUE if the shape defined by ishape has been defined in this
+ // set of transformations. Typical values of ishape are kSPD, kSDD, kSSD,
+ // kSSD2.
+ Bool_t IsShapeDefined(Int_t ishape)const {
+ return ((fShape.At(ishape))!=0);}
+ //
+ // This function returns a pointer to the particular AliITSgeomMatrix
+ // class for a specific module index.
+ AliITSgeomMatrix *GetGeomMatrix(Int_t index){if(index<fGm.GetSize()&&
+ index>=0)
+ return (AliITSgeomMatrix*)(fGm.At(index));else
+ Error("GetGeomMatrix","index=%d<0||>=GetSize()=%d",
+ index,fGm.GetSize());return 0;}
+ AliITSgeomMatrix *GetGeomMatrix(Int_t index)const{if(index<fGm.GetSize()
+ &&index>=0)
+ return (AliITSgeomMatrix*)(fGm.At(index));else
+ Error("GetGeomMatrix","index=%d<0||>=GetSize()=%d",
+ index,fGm.GetSize());return 0;}
+ // This function find and return the number of detector types only.
+ Int_t GetNDetTypes()const{Int_t max;return GetNDetTypes(max);};
+ // This function find and return the number of detector types and the
+ // maximum det type value.
+ Int_t GetNDetTypes(Int_t &max)const;
+ // This function finds and return the number of detector types and the
+ // and the number of each type in the TArrayI and their types.
+ Int_t GetNDetTypes(TArrayI &maxs,AliITSDetector *types)const;
+ // This function returns the number of detectors/ladder for a give
+ // layer. In particular it returns fNdet[layer-1].
+ Int_t GetNdetectors(Int_t lay) const {return fNdet[lay-1];}
+ // This function returns the number of ladders for a give layer. In
+ // particular it returns fNlad[layer-1].
+ Int_t GetNladders(Int_t lay) const {return fNlad[lay-1];};
+ // This function returns the number of layers defined in the ITS
+ // geometry. In particular it returns fNlayers.
+ Int_t GetNlayers() const {return fNlayers;}
+ Int_t GetModuleIndex(Int_t lay,Int_t lad,Int_t det)const;
+ // This function returns the module index number given the layer,
+ // ladder and detector numbers put into the array id[3].
+ Int_t GetModuleIndex(const Int_t *id)const{
+ return GetModuleIndex(id[0],id[1],id[2]);}
+ void GetModuleId(Int_t index,Int_t &lay,Int_t &lad,Int_t &det)const;
+ // Returns the detector type
+ //Int_t GetModuleType(Int_t index)const{
+ // return GetGeomMatrix(index)->GetDetectorIndex();}
+ AliITSDetector GetModuleType(Int_t index)const{
+ return (AliITSDetector)(GetGeomMatrix(index)->GetDetectorIndex());}
+ // Returns the detector type as a string
+ const char * GetModuleTypeName(Int_t index)const{
+ return GetDetectorTypeName(GetModuleType(index));}
+ // Returns the detector type as a string
+ const char * GetDetectorTypeName(Int_t index)const{switch(index) {
+ case kSPD : return "kSPD" ; case kSDD : return "kSDD" ;
+ case kSSD : return "kSSD" ; case kSSDp: return "kSSDp";
+ case kSDDp: return "kSDDp"; default : return "Undefined";};}
+ //
+ Int_t GetStartDet(Int_t dtype )const;
+ Int_t GetLastDet(Int_t dtype)const;
+ // Returns the starting module index number for SPD detector,
+ // assuming the modules are placed in the "standard" cylindrical
+ // ITS structure.
+ Int_t GetStartSPD()const{return GetStartDet(kSPD);}
+ // Returns the ending module index number for SPD detector,
+ // assuming the modules are placed in the "standard" cylindrical
+ // ITS structure.
+ Int_t GetLastSPD()const{return GetLastDet(kSPD);}
+ // Returns the starting module index number for SDD detector,
+ // assuming the modules are placed in the "standard" cylindrical
+ // ITS structure.
+ Int_t GetStartSDD()const{return GetStartDet(kSDD);}
+ // Returns the ending module index number for SDD detector,
+ // assuming the modules are placed in the "standard" cylindrical
+ // ITS structure.
+ Int_t GetLastSDD()const{return GetLastDet(kSDD);}
+ // Returns the starting module index number for SSD detector,
+ // assuming the modules are placed in the "standard" cylindrical
+ // ITS structure.
+ Int_t GetStartSSD()const{return GetStartDet(kSSD);}
+ // Returns the ending module index number for SSD detector,
+ // assuming the modules are placed in the "standard" cylindrical
+ // ITS structure.
+ Int_t GetLastSSD()const{return GetLastDet(kSSD);}
+ // Returns the last module index number.
+ Int_t GetIndexMax() const {return fNmodules;}
+ //
+ // This function returns the rotation angles for a give module
+ // in the Double point array ang[3]. The angles are in radians
+ void GetAngles(Int_t index,Double_t *ang)const{
+ GetGeomMatrix(index)->GetAngles(ang);}
+ // This function returns the rotation angles for a give module
+ // in the three floating point variables provided. rx = frx,
+ // fy = fry, rz = frz. The angles are in radians
+ void GetAngles(Int_t index,Float_t &rx,Float_t &ry,Float_t &rz)const{
+ Double_t a[3];GetAngles(index,a);rx = a[0];ry = a[1];rz = a[2];}
+ // This function returns the rotation angles for a give detector on
+ // a give ladder in a give layer in the three floating point variables
+ // provided. rx = frx, fy = fry, rz = frz. The angles are in radians
+ void GetAngles(Int_t lay,Int_t lad,Int_t det,
+ Float_t &rx,Float_t &ry,Float_t &rz)const{
+ GetAngles(GetModuleIndex(lay,lad,det),rx,ry,rz);}
+ //
+ // This function returns the 6 GEANT rotation angles for a give
+ // module in the double point array ang[3]. The angles are in degrees
+ void GetGeantAngles(Int_t index,Double_t *ang)const{
+ GetGeomMatrix(index)->SixAnglesFromMatrix(ang);}
+ //
+ // This function returns the Cartesian translation for a give
+ // module in the Double array t[3]. The units are
+ // those of the Monte Carlo, generally cm.
+ void GetTrans(Int_t index,Double_t *t)const{
+ GetGeomMatrix(index)->GetTranslation(t);}
+ // This function returns the Cartesian translation for a give
+ // module index in the three floating point variables provided.
+ // x = fx0, y = fy0, z = fz0. The units are those of the Mont
+ // Carlo, generally cm.
+ void GetTrans(Int_t index,Float_t &x,Float_t &y,Float_t &z)const{
+ Double_t t[3];GetTrans(index,t);x = t[0];y = t[1];z = t[2];}
+ // This function returns the Cartesian translation for a give
+ // detector on a give ladder in a give layer in the three floating
+ // point variables provided. x = fx0, y = fy0, z = fz0. The units are
+ // those of the Monte Carlo, generally cm.
+ void GetTrans(Int_t lay,Int_t lad,Int_t det,
+ Float_t &x,Float_t &y,Float_t &z)const{
+ GetTrans(GetModuleIndex(lay,lad,det),x,y,z);}
+ //
+ // This function returns the Cartesian translation for a give
+ // module in the Double array t[3]. The units are
+ // those of the Monte Carlo, generally cm.
+ void GetTransCyln(Int_t index,Double_t *t)const{
+ GetGeomMatrix(index)->GetTranslationCylinderical(t);}
+ // This function returns the Cartesian translation for a give
+ // module index in the three floating point variables provided.
+ // x = fx0, y = fy0, z = fz0. The units are those of the Mont
+ // Carlo, generally cm.
+ void GetTransCyln(Int_t index,Float_t &x,Float_t &y,Float_t &z)const{
+ Double_t t[3];GetTransCyln(index,t);x = t[0];y = t[1];z = t[2];}
+ // This function returns the Cartesian translation for a give
+ // detector on a give ladder in a give layer in the three floating
+ // point variables provided. x = fx0, y = fy0, z = fz0. The units are
+ // those of the Monte Carlo, generally cm.
+ void GetTransCyln(Int_t lay,Int_t lad,Int_t det,
+ Float_t &x,Float_t &y,Float_t &z)const{
+ GetTransCyln(GetModuleIndex(lay,lad,det),x,y,z);}
+ //
+ // This function returns the Cartesian translation [cm] and the
+ // 6 GEANT rotation angles [degrees]for a given layer ladder and
+ // detector number, in the TVector x (at least 9 elements large).
+ // This function is required to be in-lined for speed.
+ void GetCenterThetaPhi(Int_t lay,Int_t lad,Int_t det,TVector &x)const{
+ Double_t t[3],a[6];Int_t i=GetModuleIndex(lay,lad,det);GetTrans(i,t);
+ GetGeantAngles(i,a);x(0)=t[0];x(1)=t[1];x(2)=t[2];x(3)=a[0];x(4)=a[1];
+ x(5)=a[2];x(6)=a[3];x(7)=a[4];x(8)=a[5];}
+ //
+ // This function returns the rotation matrix in Double
+ // precision for a given module.
+ void GetRotMatrix(Int_t index,Double_t mat[3][3])const{
+ GetGeomMatrix(index)->GetMatrix(mat);}
+ // This function returns the rotation matrix in a Double
+ // precision pointer for a given module. mat[i][j] => mat[3*i+j].
+ void GetRotMatrix(Int_t index,Double_t *mat)const{
+ Double_t rot[3][3];GetRotMatrix(index,rot);
+ for(Int_t i=0;i<3;i++)for(Int_t j=0;j<3;j++) mat[3*i+j] = rot[i][j];}
+ // This function returns the rotation matrix in a floating
+ // precision pointer for a given layer ladder and detector module.
+ // mat[i][j] => mat[3*i+j].
+ void GetRotMatrix(Int_t lay,Int_t lad,Int_t det,Float_t *mat)const{
+ GetRotMatrix(GetModuleIndex(lay,lad,det),mat);}
+ // This function returns the rotation matrix in a Double
+ // precision pointer for a given layer ladder and detector module.
+ // mat[i][j] => mat[3*i+j].
+ void GetRotMatrix(Int_t lay,Int_t lad,Int_t det,Double_t *mat)const{
+ GetRotMatrix(GetModuleIndex(lay,lad,det),mat);}
+ // This function returns the rotation matrix in a floating
+ // precision pointer for a given module. mat[i][j] => mat[3*i+j].
+ void GetRotMatrix(Int_t index,Float_t *mat)const{
+ Double_t rot[3][3];
+ GetGeomMatrix(index)->GetMatrix(rot);
+ for(Int_t i=0;i<3;i++)for(Int_t j=0;j<3;j++) mat[3*i+j] = rot[i][j];}
+ // This function sets the rotation matrix in a Double
+ // precision pointer for a given module. mat[i][j] => mat[3*i+j].
+ void SetRotMatrix(Int_t index,Double_t *mat){Double_t rot[3][3];
+ for(Int_t i=0;i<3;i++)for(Int_t j=0;j<3;j++) rot[i][j]=mat[3*i+j];
+ GetGeomMatrix(index)->SetMatrix(rot);}
+ // Return the normal for a specific module
+ void GetGlobalNormal(Int_t index,Double_t n[3]){
+ GetGeomMatrix(index)->GetGlobalNormal(n[0],n[1],n[2]);}
+ //
+ // Will define fShape if it isn't already defined.
+ void DefineShapes(Int_t size=5){fShape.Expand(size);}
+ // this function returns a pointer to the array of detector
+ // descriptions, Segmentation.
+ virtual TObjArray *GetShapeArray(){return &fShape;};
+ // this function returns a pointer to the class describing a particular
+ // detector type based on AliITSDetector value. This will return a pointer
+ // to one of the classes AliITSgeomSPD, AliITSgeomSDD, or
+ // AliITSgeomSSD, for example.
+ virtual TObject *GetShape(AliITSDetector idet){
+ return fShape.At((Int_t)idet);};
+ virtual TObject *GetShape(AliITSDetector idet)const{
+ return fShape.At((Int_t)idet);};
+ // This function returns a pointer to the class describing the
+ // detector for a particular module index. This will return a pointer
+ // to one of the classes AliITSgeomSPD, AliITSgeomSDD,
+ // or AliITSgeomSSD, for example.
+ virtual TObject *GetShape(Int_t index){
+ return fShape.At(GetGeomMatrix(index)->GetDetectorIndex());}
+ virtual TObject *GetShape(Int_t index)const{
+ return fShape.At(GetGeomMatrix(index)->GetDetectorIndex());}
+ // This function returns a pointer to the class describing the
+ // detector for a particular layer ladder and detector numbers. This
+ // will return a pointer to one of the classes AliITSgeomSPD,
+ // AliITSgeomSDD, or AliITSgeomSSD, for example.
+ virtual TObject *GetShape(Int_t lay,Int_t lad,Int_t det)
+ {return GetShape(GetModuleIndex(lay,lad,det));}
+ // Determine if a give point is inside of a detectors sensitive
+ // volume (as defined by these transformations).
+ virtual Bool_t IsInside(Int_t module,Double_t point[3])const;
+ //
+ // Setters
+ // Sets the rotation angles and matrix for a give module index
+ // via the double precision array a[3] [radians].
+ void SetByAngles(Int_t index,const Double_t a[]){
+ GetGeomMatrix(index)->SetAngles(a);}
+ // Sets the rotation angles and matrix for a give module index
+ // via the 3 floating precision variables rx, ry, and rz [radians].
+ void SetByAngles(Int_t index,Float_t rx, Float_t ry, Float_t rz) {
+ Double_t a[3];a[0] = rx;a[1] = ry;a[2] = rz;
+ GetGeomMatrix(index)->SetAngles(a);}
+ // Sets the rotation angles and matrix for a give layer, ladder,
+ // and detector numbers via the 3 floating precision variables rx,
+ // ry, and rz [radians].