//------------------------------------------------------------------------------ // Channel geometry class -- // (C) Piero Giubilato 2008-2010, Berkeley Lab -- //------------------------------------------------------------------------------ //______________________________________________________________________________ // {Trace} // [File name] "geom_Channel.cpp" // [Author] "Piero Giubilato" // [Version] "0.5" // [Modified by] "Piero Giubilato" // [Last revision] "30 Jun 2008" // [Language] "C++" // [Compiler] "Visual 9.x" // [Member of] "Cool SEAL" // [Project] "SEAL" // [Description] "Channel geometry class." // [Key documentation] // "Root user's guide" // "Visual C++ Reference Help" // {Trace} //______________________________________________________________________________ // Standard libraries #include // Application objects #include "global.h" #include "geom_Channel.h" // CINT Preprocessor class import definition //ClassImp(geom_Channel) //______________________________________________________________________________ geom_Channel::geom_Channel () { // 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. } //______________________________________________________________________________ geom_Channel::geom_Channel (UInt_t chip_Idx, UInt_t layer_Idx) { // Provides a linking layer between a physical device description (geom_Chip) // and a logical layer (geom_Layer). // Basically, the channel will use the geometrical information stored into // the linked geom_Chip to map its data into a data_Layer derived from the // linked geom_Layer. // Debug dbg_Print("geom_Channel::geom_Channel:()", DBG_LVL_ZERO); // Preset if (data_Preset(chip_Idx, layer_Idx)) { dbg_Print("geom_Channel::geom_Channel: unable to instantiate object", DBG_LVL_MAKE); } } //______________________________________________________________________________ geom_Channel::~geom_Channel () { // Standard destructor // Debug dbg_Print("geom_Channel::~geom_Channel:()", DBG_LVL_ZERO); // Destructor: frees all allocated memory // Nothing to free, everything is into the stack } //______________________________________________________________________________ int geom_Channel::data_Preset(UInt_t chip_Idx, UInt_t layer_Idx) { // Sets up all the data for the object // Debug dbg_Print("geom_Channel::data_Preset:(UInt, UInt)", DBG_LVL_MAKE); // Save chip references chn_chip_Idx = chip_Idx; chn_layer_Idx = layer_Idx; // Update object status this->isOk(true); this->isModified(false); // All OK return 0; } //______________________________________________________________________________ UInt_t geom_Channel::chip_Idx() const { // Gets layer associated chip Idx. return chn_chip_Idx; } //______________________________________________________________________________ UInt_t geom_Channel::chip_Idx(UInt_t chip_Idx) { // Sets layer associated chip Idx. chn_chip_Idx = chip_Idx; return chn_chip_Idx; } //______________________________________________________________________________ UInt_t geom_Channel::layer_Idx() const { // Gets layer associated chip Idx. return chn_layer_Idx; } //______________________________________________________________________________ UInt_t geom_Channel::layer_Idx(UInt_t layer_Idx) { // Sets layer associated chip Idx. chn_layer_Idx = layer_Idx; return chn_layer_Idx; } //______________________________________________________________________________ void geom_Channel::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_Channel: " << (int*)this << "\n"; std::cout << space.Data() << "class_Ver: " << class_Ver << "\n"; std::cout << space.Data() << "chip_Idx: " << chn_chip_Idx << "\n"; std::cout << space.Data() << "layer_Idx: " << chn_layer_Idx << "\n"; // Shows the parent data_Object::Dump(level + 2); } //______________________________________________________________________________ void geom_Channel::Streamer(TBuffer &b) { // Streams the data for the geom_Chip // Read if (b.IsReading()) { // Debug dbg_Print ("geom_Channel::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_Channel::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 >> chn_chip_Idx; b >> chn_layer_Idx; // Writes } else { // Debug dbg_Print ("geom_Channel::Streamer: write call",DBG_LVL_FLOW) // Writes class version b << class_Ver; // Writes parent class data_Object::Streamer(b); // Writes layer properties b << chn_chip_Idx; b << chn_layer_Idx; } }