Streamer, It was not setting a value for frot[3] as it should when reading.
void GetTrans(const Int_t lay,const Int_t lad,const Int_t det,
Float_t &x,Float_t &y,Float_t &z) {
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(const Int_t index,Double_t *t) {
+ 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(const Int_t index,Float_t &x,Float_t &y,Float_t &z) {
+ 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(const Int_t lay,const Int_t lad,const Int_t det,
+ Float_t &x,Float_t &y,Float_t &z) {
+ 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
/*
$Log$
+Revision 1.8 2001/02/09 00:00:57 nilsen
+Fixed compatibility problem with HP unix {ios::fmtflags -> Int_t}. Fixed
+bugs in iostream based streamers used to read and write .det files. Fixed
+some detector sizes. Fixed bugs in some default-special constructors.
+
Revision 1.7 2001/02/03 00:00:30 nilsen
New version of AliITSgeom and related files. Now uses automatic streamers,
set up for new formatted .det file which includes detector information.
#include <iomanip.h>
#include <TMath.h>
#include <TBuffer.h>
+#include <TClass.h>
#include "AliITSgeomMatrix.h"
fid[i] = 0;
frot[i] = ftran[i] = 0.0;
for(j=0;j<3;j++) fm[i][j] = 0.0;
+ fCylR = fCylPhi = 0.0;
}// end for i
fm[0][0] = fm[1][1] = fm[2][2] = 1.0;
}
this->fid[i] = sourse.fid[i];
this->frot[i] = sourse.frot[i];
this->ftran[i] = sourse.ftran[i];
+ this->fCylR = sourse.fCylR;
+ this->fCylPhi = sourse.fCylPhi;
for(j=0;j<3;j++) this->fm[i][j] = sourse.fm[i][j];
}// end for i
}
this->fid[i] = sourse.fid[i];
this->frot[i] = sourse.frot[i];
this->ftran[i] = sourse.ftran[i];
+ this->fCylR = sourse.fCylR;
+ this->fCylPhi = sourse.fCylPhi;
for(j=0;j<3;j++) this->fm[i][j] = sourse.fm[i][j];
}// end for i
}
*/
//End_Html
////////////////////////////////////////////////////////////////////////
- Int_t i;
+ Int_t i;
- fDetectorIndex = idt; // a value never defined.
- for(i=0;i<3;i++){
- fid[i] = id[i];
- frot[i] = rot[i];
- ftran[i] = tran[i];
- }// end for i
- this->MatrixFromAngle();
+ fDetectorIndex = idt; // a value never defined.
+ for(i=0;i<3;i++){
+ fid[i] = id[i];
+ frot[i] = rot[i];
+ ftran[i] = tran[i];
+ }// end for i
+ fCylR = TMath::Sqrt(ftran[0]*ftran[0]+ftran[1]*ftran[1]);
+ fCylPhi = TMath::ATan2(ftran[1],ftran[0]);
+ if(fCylPhi<0.0) fCylPhi += TMath::Pi();
+ this->MatrixFromAngle();
}
//----------------------------------------------------------------------
AliITSgeomMatrix::AliITSgeomMatrix(const Int_t idt, const Int_t id[3],
*/
//End_Html
////////////////////////////////////////////////////////////////////////
- Int_t i,j;
+ Int_t i,j;
- fDetectorIndex = idt; // a value never defined.
- for(i=0;i<3;i++){
- fid[i] = id[i];
- ftran[i] = tran[i];
- for(j=0;j<3;j++) fm[i][j] = matrix[i][j];
- }// end for i
- this->AngleFromMatrix();
+ fDetectorIndex = idt; // a value never defined.
+ for(i=0;i<3;i++){
+ fid[i] = id[i];
+ ftran[i] = tran[i];
+ for(j=0;j<3;j++) fm[i][j] = matrix[i][j];
+ }// end for i
+ fCylR = TMath::Sqrt(ftran[0]*ftran[0]+ftran[1]*ftran[1]);
+ fCylPhi = TMath::ATan2(ftran[1],ftran[0]);
+ if(fCylPhi<0.0) fCylPhi += TMath::Pi();
+ this->AngleFromMatrix();
}
//----------------------------------------------------------------------
void AliITSgeomMatrix::SixAnglesFromMatrix(Double_t *ang){
fid[i] = id[i];
ftran[i] = tran[i];
}// end for i
+ fCylR = TMath::Sqrt(ftran[0]*ftran[0]+ftran[1]*ftran[1]);
+ fCylPhi = TMath::ATan2(ftran[1],ftran[0]);
+ if(fCylPhi<0.0) fCylPhi += TMath::Pi();
this->MatrixFromSixAngles(rotd);
}
//----------------------------------------------------------------------
for(i=0;i<3;i++) *is >> ftran[i];
for(i=0;i<3;i++)for(j=0;j<3;j++) *is >> fm[i][j];
AngleFromMatrix(); // compute angles frot[].
+ fCylR = TMath::Sqrt(ftran[0]*ftran[0]+ftran[1]*ftran[1]);
+ fCylPhi = TMath::ATan2(ftran[1],ftran[0]);
+ if(fCylPhi<0.0) fCylPhi += TMath::Pi();
return;
}
+//______________________________________________________________________
+void AliITSgeomMatrix::Streamer(TBuffer &R__b){
+ // Stream an object of class AliITSgeomMatrix.
+
+ if (R__b.IsReading()) {
+ AliITSgeomMatrix::Class()->ReadBuffer(R__b, this);
+ fCylR = TMath::Sqrt(ftran[0]*ftran[0]+ftran[1]*ftran[1]);
+ fCylPhi = TMath::ATan2(ftran[1],ftran[0]);
+ this->AngleFromMatrix();
+ if(fCylPhi<0.0) fCylPhi += TMath::Pi();
+ } else {
+ AliITSgeomMatrix::Class()->WriteBuffer(R__b, this);
+ }
+}
//----------------------------------------------------------------------
ostream &operator<<(ostream &os,AliITSgeomMatrix &p){
////////////////////////////////////////////////////////////////////////
void SetAngles(const Double_t rot[3]){// [radians]
for(Int_t i=0;i<3;i++)frot[i] = rot[i];this->MatrixFromAngle();}
void SetTranslation(const Double_t tran[3]){
- for(Int_t i=0;i<3;i++) ftran[i] = tran[i];}
+ for(Int_t i=0;i<3;i++) ftran[i] = tran[i];
+ fCylR = TMath::Sqrt(ftran[0]*ftran[0]+
+ ftran[1]*ftran[1]);
+ fCylPhi = TMath::ATan2(ftran[1],ftran[0]);
+ if(fCylPhi<0.0) fCylPhi += TMath::Pi();}
void SetMatrix(Double_t matrix[3][3]){ for(Int_t i=0;i<3;i++)
for(Int_t j=0;j<3;j++) fm[i][j]=matrix[i][j];this->AngleFromMatrix();}
void SetDetectorIndex(const Int_t idt) {fDetectorIndex = idt;}
for(Int_t i=0;i<3;i++) rot[i] = frot[i];}
void GetTranslation(Double_t tran[3]){
for(Int_t i=0;i<3;i++) tran[i] = ftran[i];}
+ void GetTranslationCylinderical(Double_t tran[3]){
+ tran[0] = fCylR;
+ tran[1] = fCylPhi;
+ tran[2] = ftran[2];}
void GetMatrix(Double_t matrix[3][3]){for(Int_t i=0;i<3;i++)
for(Int_t j=0;j<3;j++) matrix[i][j] = fm[i][j];}
Int_t GetDetectorIndex() {return fDetectorIndex;}
Int_t fid[3]; // layer, ladder, detector numbers.
Double_t frot[3]; //! vector of rotations about x,y,z [radians].
Double_t ftran[3]; // Translation vector of module x,y,z.
+ Double_t fCylR,fCylPhi; //! Translation vector in Cylinderical coord.
Double_t fm[3][3]; // Rotation matrix based on frot.
+ // Note, fCylR and fCylPhi are added as data members because it costs
+ // about a factor of 10 to compute them over looking them up. Since
+ // they are used in some tracking algorithms this can be a large cost
+ // in computing time. They are not written out but computed.
+
ClassDef(AliITSgeomMatrix,1) // Matrix class used by AliITSgeom.
};
// Input and output function for standard C++ input/output.
#pragma link C++ class AliITSdigitSSD+;
#pragma link C++ class AliITSTransientDigit+;
#pragma link C++ class AliITSgeom+;
-#pragma link C++ class AliITSgeomMatrix+;
+#pragma link C++ class AliITSgeomMatrix-;
#pragma link C++ class AliITSgeomSPD+;
#pragma link C++ class AliITSgeomSDD+;
#pragma link C++ class AliITSgeomSSD+;