//------------------------------------------------------------------------------ // Main data classes -- // (C) Piero Giubilato 2007-2010, Berkeley Lab -- //------------------------------------------------------------------------------ //______________________________________________________________________________ // {Trace} // [File name] "data_Burst.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_Burst_H #define data_Burst_H // Standard libs #include #include // Root components #include // Application components #include "global.h" #include "data_Object.h" #include "data_Frame.h" #include "geom_Frame.h" // Template definition #define tT template #define tU template #define dB_T data_Burst #define dB_U data_Burst #define dF_U data_Frame #define dL_U data_Layer //______________________________________________________________________________ template class data_Burst: public data_Object { private: // Class identifiers static const UShort_t class_Ver = 1; // Class version // Data storage std::vector*> fr_Array; // Frames collection const geom_Frame* burst_frame_Ref; // Reference to the last fitted frame // Data functions void data_Preset(geom_Frame* frm_Ref = NULL, UInt_t frm_Count = 0); tU void data_Copy(const dB_U&); tU void data_Math(const dB_U&, UInt_t Op); 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_Burst(); data_Burst(geom_Frame* frm_Ref, UInt_t frm_Count); data_Burst(const dB_T&); // To avoid compiler override tU data_Burst(const dB_U&); ~data_Burst(); // Operator = dB_T& operator=(const geom_Frame& ro) {frame_Fit(&ro, 1); return *this;} dB_T& operator=(const dB_T& ro) {data_Copy(ro); return *this;} // To avoid compiler override tU dB_T& operator=(const dB_U& ro) {data_Copy(ro); return *this;} tU dB_T& operator=(const dF_U& ro) {data_Math(ro, km_Set); return *this;} tU dB_T& operator=(const dL_U& ro) {data_Math(ro, km_Set); return *this;} tU dB_T& operator=(const U& ro) {data_Math(ro, km_Set); return *this;} // Self assignement member unary operators (work on data_Frames&Layers and scalars) tU dB_T& operator+=(const U& ro) {data_Math(ro, km_Add); return *this;} tU dB_T& operator-=(const U& ro) {data_Math(ro, km_Sub); return *this;} tU dB_T& operator*=(const U& ro) {data_Math(ro, km_Mul); return *this;} tU dB_T& operator/=(const U& ro) {data_Math(ro, km_Div); return *this;} // New object member unary operators (work on data_Bursts&Frames&Layers, and scalars) tU dB_T operator+(const U& ro) {return dB_T(*this) += ro;} tU dB_T operator-(const U& ro) {return dB_T(*this) -= ro;} tU dB_T operator*(const U& ro) {return dB_T(*this) *= ro;} tU dB_T operator/(const U& ro) {return dB_T(*this) /= ro;} // New object binary friend operators (works only on data_Bursts) tU dB_T friend operator+(const dB_T& lo, const dB_U& ro) {return dB_T(lo) += ro;} tU dB_T friend operator-(const dB_T& lo, const dB_U& ro) {return dB_T(lo) -= ro;} tU dB_T friend operator*(const dB_T& lo, const dB_U& ro) {return dB_T(ro) *= ro;} tU dB_T friend operator/(const dB_T& lo, const dB_U& ro) {return dB_T(lo) /= ro;} // New object binary friend operators (works only on data_Framess) tU dB_T friend operator+(const dB_T& lo, const dF_U& ro) {return dB_T(lo) += ro;} tU dB_T friend operator-(const dB_T& lo, const dF_U& ro) {return dB_T(lo) -= ro;} tU dB_T friend operator*(const dB_T& lo, const dF_U& ro) {return dB_T(ro) *= ro;} tU dB_T friend operator/(const dB_T& lo, const dF_U& ro) {return dB_T(lo) /= ro;} // Data manipulation methods (mutuated from data_Frame) tU dB_T& dp_all_Set(U val) {data_Math(val, km_Set); return *this;} tU dB_T& dp_all_Add(U val) {data_Math(val, km_Add); return *this;} tU dB_T& dp_all_Sub(U val) {data_Math(val, km_Sub); return *this;} tU dB_T& dp_all_Mul(U val) {data_Math(val, km_Mul); return *this;} tU dB_T& dp_all_Div(U val) {data_Math(val, km_Div); return *this;} dB_T& dp_all_Mir(T val) {data_Math(val, km_Mir); return *this;}; dB_T& dp_all_Sqr(void) {data_Math(0, km_Sqr); return *this;} dB_T& dp_all_Pow(Int_t exp) {data_Math(exp, km_Pow); return *this;} dB_T& dp_all_Range(T start = 0, T dp_Step = 1, T ly_Step = 0); // Data stat void dp_all_Limits(T& min, T& max) const; void dp_all_Stat(Double_t& avg, Double_t& sgm) const; data_Frame& fr_all_Avg() const; data_Frame& fr_all_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; const geom_Frame* frame_Fit(const geom_Frame* frame_ref, UInt_t frm_Count); // Frame setting UInt_t frame_Count() const; UInt_t frame_Count(UInt_t frm_Count); data_Frame* frame(UInt_t frm_Idx) const; // Data points size and count UInt_t dp_Count() const; UInt_t dp_Size() const; }; // Reset definition #undef tT #undef tU #undef dB_T #undef dB_U #undef dF_U #undef dL_U // Reference to the translation unit, allows to just include th .h file #include "data_Burst.cpp" // Overloading check #endif