//------------------------------------------------------------------------------ // Main data classes -- // (C) Piero Giubilato 2008-2010, Berkeley Lab -- //------------------------------------------------------------------------------ //______________________________________________________________________________ // {Trace} // [File name] "data_Frame.h" // [Author] "Piero Giubilato" // [Version] "1.0" // [Modified by] "Piero Giubilato" // [Last revision] "17 Feb 2009" // [Language] "C++" // [Compiler] "Visual C++ 9.x" // [Member of] "Cool SEAL" // [Project] "SEAL" // [Description] "Main data classes." // [Key documentation] // "Root user's guide" // "Visual C++ Reference Help" // {Trace} //______________________________________________________________________________ // Overloading check #ifndef data_Frame_H #define data_Frame_H // Standard libs #include #include // Root components #include #include // Application components #include "global.h" #include "data_Object.h" #include "data_Layer.h" #include "geom_Frame.h" #include "geom_Layer.h" // Template definition #define tT template #define tU template #define dF_T data_Frame #define dF_U data_Frame #define dL_U data_Layer //______________________________________________________________________________ template class data_Frame: public data_Object { private: // Class identifiers static const UShort_t class_Ver = 1; // Class version // Data storage std::vector*> ly_Array; // Layers collection const geom_Frame* fit_frame_Ref; // Reference to the last fitted frame // Data functions tU void data_Copy(const dF_U&); tU void data_Math(const dF_U&, UInt_t Op); tU void data_Math(const dL_U&, UInt_t Op); tU void data_Math(const U&, UInt_t Op); // Konstants enum ka {km_Set, km_Add, km_Sub, km_Mul, km_Div, km_Sqr, km_Pow, km_Mir}; public: // Special member functions data_Frame(); data_Frame(const dF_T&); // To avoid compiler override tU data_Frame(const dF_U&); data_Frame(const geom_Frame*); ~data_Frame(); // Operator = dF_T& operator=(const geom_Frame& ro) {frame_Fit(&ro); return *this;} dF_T& operator=(const dF_T& ro) {data_Copy(ro); return *this;} // To avoid compiler override tU dF_T& operator=(const dF_U& ro) {data_Copy(ro); return *this;} tU dF_T& operator=(const dL_U& ro) {data_Math(ro, km_Set); return *this;} tU dF_T& operator=(const U& ro) {data_Math(ro, km_Set); return *this;} // Self assignement member unary operators (work on data_Layers and scalars) tU dF_T& operator+=(const U& ro) {data_Math(ro, km_Add); return *this;} tU dF_T& operator-=(const U& ro) {data_Math(ro, km_Sub); return *this;} tU dF_T& operator*=(const U& ro) {data_Math(ro, km_Mul); return *this;} tU dF_T& operator/=(const U& ro) {data_Math(ro, km_Div); return *this;} // New object member unary operators (work on data_Frames&Layers, and scalars) tU dF_T operator+(const U& ro) {return dF_T(*this) += ro;} tU dF_T operator-(const U& ro) {return dF_T(*this) -= ro;} tU dF_T operator*(const U& ro) {return dF_T(*this) *= ro;} tU dF_T operator/(const U& ro) {return dF_T(*this) /= ro;} // New object binary friend operators (works only on data_Frames) tU dF_T friend operator+(const dF_T& lo, const dF_U& ro) {return dF_T(lo) += ro;} tU dF_T friend operator-(const dF_T& lo, const dF_U& ro) {return dF_T(lo) -= ro;} tU dF_T friend operator*(const dF_T& lo, const dF_U& ro) {return dF_T(ro) *= ro;} tU dF_T friend operator/(const dF_T& lo, const dF_U& ro) {return dF_T(lo) /= ro;} // Data manipulation methods (mutuated from data_Layer) tU dF_T& dp_all_Set(U val) {data_Math(val, km_Set); return *this;} tU dF_T& dp_all_Add(U val) {data_Math(val, km_Add); return *this;} tU dF_T& dp_all_Sub(U val) {data_Math(val, km_Sub); return *this;} tU dF_T& dp_all_Mul(U val) {data_Math(val, km_Mul); return *this;} tU dF_T& dp_all_Div(U val) {data_Math(val, km_Div); return *this;} dF_T& dp_all_Mir(T val) {data_Math(val, km_Mir); return *this;}; dF_T& dp_all_Sqr(void) {data_Math(0, km_Sqr); return *this;} dF_T& dp_all_Pow(Int_t exp) {data_Math(exp, km_Pow); return *this;} dF_T& dp_all_Range(T start = 0, T dp_Step = 1, T ly_Step = 0); // Data statistics void dp_all_Limits(T& min, T& max) const; void dp_all_Stat(Double_t& avg, Double_t& sgm) const; // Root overloaded void Streamer(TBuffer &b); void Dump() const {Dump(0);} void Dump(UInt_t level) const; // data_Object overloaded UInt_t obj_Type() const; UInt_t data_Type() const; // Frame fitting const geom_Frame* frame_Fit() const; void frame_Fit(const geom_Frame* ref); // Layer setting UInt_t layer_Count() const; UInt_t layer_Count(UInt_t layer_Count); data_Layer* layer(UInt_t layer_Idx) const; // Data points size and count UInt_t dp_Count() const; UInt_t dp_Size() const; }; // Reset definition #undef tT #undef tU #undef dF_T #undef dF_U #undef dL_U // Reference to the translation unit, allows to just include the .h file #include "data_Frame.cpp" // Overloading check #endif