//------------------------------------------------------------------------------ // Main geometry classes -- // (C) Piero Giubilato 2008-2010, Berkeley Lab -- //------------------------------------------------------------------------------ //______________________________________________________________________________ // {Trace} // [File name] "geom_Layer.cpp" // [Author] "Piero Giubilato" // [Version] "1.0" // [Modified by] "Piero Giubilato" // [Last revision] "31 Jan 2009" // [Language] "C++" // [Compiler] "Visual C++ 9.x" // [Member of] "Cool SEAL" // [Project] "SEAL" // [Description] "Main geometry classes." // [Key documentation] // "Root user's guide" // "Visual C++ Reference Help" // {Trace} //______________________________________________________________________________ // Standard libraries #include // Application objects #include "geom_Layer.h" #include "global.h" // CINT Preprocessor class import definition //ClassImp(geom_Layer) //ClassImp(geom_Point3D) //ClassImp(geom_Angle3D) //ClassImp(geom_iPixel) //______________________________________________________________________________ geom_Layer::geom_Layer () { // Provides the base class for a data_Layer object. This is a dummy // constructor that should never be used, it is here to avoid warnings // from Cint compiler. data_Preset(0, 0, 0, 0, 0, 0); } //______________________________________________________________________________ geom_Layer::geom_Layer (Double_t x, Double_t y, Double_t z, Double_t a, Double_t b, Double_t g) { // Provides the geometrical information (position x y z, rotation ab g) // for a given logical (data) layer. // Debug dbg_Print("geom_Layer::geom_Layer:()", DBG_LVL_ZERO); // Preset if (data_Preset(x, y, z, a, b, g)) { dbg_Print("geom_Layer::geom_Layer: unable to instantiate object", DBG_LVL_WARN); } } //______________________________________________________________________________ geom_Layer::~geom_Layer () { // Standard destructor // Debug dbg_Print("geom_Layer::~geom_Layer:()", DBG_LVL_ZERO); // Destructor: frees all allocated memory // Nothing to free, everything is into the stack } //______________________________________________________________________________ int geom_Layer::data_Preset(Double_t x, Double_t y, Double_t z, Double_t a, Double_t b, Double_t g) { // Sets up all the data for the object // Debug dbg_Print("geom_Layer::data_Preset:()", DBG_LVL_MAKE); // Preset layer position and orientation into space layer_Pos.x = 0; layer_Pos.y = 0; layer_Pos.z = 0; layer_Rot.a = 0; layer_Rot.b = 0; layer_Rot.g = 0; // Update object status this->isOk(true); this->isModified(false); // All OK return 0; } //______________________________________________________________________________ UInt_t geom_Layer::dp_col_Count() const { // Gets layer width return layer_col_Count; } //______________________________________________________________________________ UInt_t geom_Layer::dp_col_Count(UInt_t Cols) { // Sets layer width layer_col_Count = Cols; return layer_col_Count; } //______________________________________________________________________________ UInt_t geom_Layer::dp_row_Count() const { // Gets layer width return layer_row_Count; } //______________________________________________________________________________ UInt_t geom_Layer::dp_row_Count(UInt_t Rows) { // Sets layer width layer_row_Count = Rows; return layer_row_Count; } //______________________________________________________________________________ UInt_t geom_Layer::dp_Count(UInt_t cols, UInt_t rows) { // Sets the layer width and height layer_col_Count = cols; layer_row_Count = rows; return cols * rows; } //______________________________________________________________________________ Double_t geom_Layer::size_Width() const { // Gets layer width return layer_size_Width; } //______________________________________________________________________________ Double_t geom_Layer::size_Width(Double_t width) { // Sets layer width layer_size_Width = width; return width; } //______________________________________________________________________________ Double_t geom_Layer::size_Height() const { // Gets layer width return layer_size_Width; } //______________________________________________________________________________ Double_t geom_Layer::size_Height(Double_t height) { // Sets layer width layer_size_Height = height; return height; } //______________________________________________________________________________ Double_t geom_Layer::pos_X() const { // Gets layer x reference position. return layer_Pos.x; } //______________________________________________________________________________ Double_t geom_Layer::pos_X(Double_t x) { // Sets layer x reference position. layer_Pos.x = x; return x; } //______________________________________________________________________________ Double_t geom_Layer::pos_Y() const { // Gets layer y reference position. return layer_Pos.y; } //______________________________________________________________________________ Double_t geom_Layer::pos_Y(Double_t y) { // Sets layer y reference position. layer_Pos.y = y; return y; } //______________________________________________________________________________ Double_t geom_Layer::pos_Z() const { // Gets layer z reference position. return layer_Pos.z; } //______________________________________________________________________________ Double_t geom_Layer::pos_Z(Double_t z) { // Sets layer z reference position. layer_Pos.z = z; return z; } //______________________________________________________________________________ Double_t geom_Layer::rot_A() const { // Gets a rotation angle. return layer_Rot.a; } //______________________________________________________________________________ Double_t geom_Layer::rot_A(Double_t a) { // Sets a rotation angle. layer_Rot.a = a; return a; } //______________________________________________________________________________ Double_t geom_Layer::rot_B() const { // Gets b rotation angle. return layer_Rot.b; } //______________________________________________________________________________ Double_t geom_Layer::rot_B(Double_t b) { // Sets b rotation angle. layer_Rot.b = b; return b; } //______________________________________________________________________________ Double_t geom_Layer::rot_G() const { // Gets g rotation angle. return layer_Rot.g; } //______________________________________________________________________________ Double_t geom_Layer::rot_G(Double_t g) { // Sets g rotation angle. layer_Rot.g = g; return g; } //______________________________________________________________________________ void geom_Layer::Dump(UInt_t level) const { // Dumps all the object data into std::out // Shows the header and the data members TString space(' ', level); std::cout << space.Data() << "*geom_Layer: " << (int*)this << "\n"; std::cout << space.Data() << "class_Ver: " << class_Ver << "\n"; std::cout << space.Data() << "col_Count: " << layer_col_Count << "\n"; std::cout << space.Data() << "row_Count: " << layer_row_Count << "\n"; std::cout << space.Data() << "size_Width: " << layer_size_Width << "\n"; std::cout << space.Data() << "size_Height: " << layer_size_Height << "\n"; std::cout << space.Data() << "pos_X: " << layer_Pos.x << "\n"; std::cout << space.Data() << "pos_Y: " << layer_Pos.y << "\n"; std::cout << space.Data() << "pos_Z: " << layer_Pos.z << "\n"; std::cout << space.Data() << "rot_A: " << layer_Rot.a << "\n"; std::cout << space.Data() << "rot_B: " << layer_Rot.b << "\n"; std::cout << space.Data() << "rot_G: " << layer_Rot.g << "\n"; // Shows the parent data_Object::Dump(level + 2); } //______________________________________________________________________________ void geom_Layer::Streamer(TBuffer &b) { // Streams the data for the geom_Chip // Read if (b.IsReading()) { // Debug dbg_Print ("geom_Layer::Streamer: read call", DBG_LVL_FLOW) // Reads class version UShort_t class_ver_Read = 0; b >> class_ver_Read; // Check version if (class_ver_Read != class_Ver) { // Debug dbg_Print ("geom_Layer::Streamer: read: version mismatch", DBG_LVL_WARN) dbg_Value(class_ver_Read, DBG_LVL_WARN); dbg_Value(class_Ver, DBG_LVL_WARN); } // Reads parent class data_Object::Streamer(b); // Reads chip properties b >> layer_col_Count; b >> layer_row_Count; b >> layer_size_Width; b >> layer_size_Height; b >> layer_Pos.x; b >> layer_Pos.y; b >> layer_Pos.z; b >> layer_Rot.a; b >> layer_Rot.b; b >> layer_Rot.g; // Writes } else { // Debug dbg_Print ("geom_Layer::Streamer: write call",DBG_LVL_FLOW) // Writes class version b << class_Ver; // Writes parent class data_Object::Streamer(b); // Writes layer properties b << layer_col_Count; b << layer_row_Count; b << layer_size_Width; b << layer_size_Height; b << layer_Pos.x; b << layer_Pos.y; b << layer_Pos.z; b << layer_Rot.a; b << layer_Rot.b; b << layer_Rot.g; } }