cspad_mod/include/ElementT.h

Go to the documentation of this file.
00001 #ifndef CSPAD_MOD_ELEMENTT_H
00002 #define CSPAD_MOD_ELEMENTT_H
00003 
00004 //--------------------------------------------------------------------------
00005 // File and Version Information:
00006 //      $Id: ElementT.h 5253 2013-01-30 17:56:28Z salnikov@SLAC.STANFORD.EDU $
00007 //
00008 // Description:
00009 //      Class ElementT.
00010 //
00011 //------------------------------------------------------------------------
00012 
00013 //-----------------
00014 // C/C++ Headers --
00015 //-----------------
00016 
00017 //----------------------
00018 // Base Class Headers --
00019 //----------------------
00020 #include "psddl_psana/cspad.ddl.h"
00021 
00022 //-------------------------------
00023 // Collaborating Class Headers --
00024 //-------------------------------
00025 
00026 //------------------------------------
00027 // Collaborating Class Declarations --
00028 //------------------------------------
00029 
00030 //              ---------------------
00031 //              -- Class Interface --
00032 //              ---------------------
00033 
00034 namespace cspad_mod {
00035 
00036 /// @addtogroup cspad_mod
00037 
00038 /**
00039  *  @ingroup cspad_mod
00040  *
00041  *  @brief Implementation of Psana::CsPad::ElementV* interface for
00042  *  calibrated data.
00043  *
00044  *  This software was developed for the LCLS project.  If you use all or 
00045  *  part of it, please give an appropriate acknowledgment.
00046  *
00047  *  @version $Id: ElementT.h 5253 2013-01-30 17:56:28Z salnikov@SLAC.STANFORD.EDU $
00048  *
00049  *  @author Andy Salnikov
00050  */
00051 
00052 template <typename ElemType>
00053 class ElementT : public ElemType {
00054 public:
00055 
00056   typedef ElemType IfaceType;
00057 
00058   enum {
00059     Nsbtemp = ElemType::Nsbtemp /**< Number of the elements in _sbtemp array. */
00060   };
00061 
00062   /**
00063    *  Constructor takes old object and calibrated data.
00064    *  Data array must be allocated with new[] and will be deallocated in destructor.
00065    *  Common_mode array is copied, caller keeps ownership.
00066    */
00067   ElementT (const ElemType& elem,
00068       int16_t* data,
00069       const float* common_mode) ;
00070 
00071   // Destructor
00072   virtual ~ElementT () ;
00073 
00074   /** Virtual channel number. */
00075   virtual uint32_t virtual_channel() const { return m_virtual_channel; }
00076   /** Lane number. */
00077   virtual uint32_t lane() const { return m_lane; }
00078   virtual uint32_t tid() const { return m_tid; }
00079   virtual uint32_t acq_count() const { return m_acq_count; }
00080   virtual uint32_t op_code() const { return m_op_code; }
00081   /** Quadrant number. */
00082   virtual uint32_t quad() const { return m_quad; }
00083   /** Counter incremented on every event. */
00084   virtual uint32_t seq_count() const { return m_seq_count; }
00085   virtual uint32_t ticks() const { return m_ticks; }
00086   virtual uint32_t fiducials() const { return m_fiducials; }
00087   virtual ndarray<const uint16_t, 1> sb_temp() const { return make_ndarray(m_sb_temp, Nsbtemp); }
00088   virtual uint32_t frame_type() const { return m_frame_type; }
00089   virtual ndarray<const int16_t, 3> data() const { return ndarray<const int16_t, 3>(m_data, m_data_shape); }
00090   /** Returns section mask for this quadrant. Mask can contain up to 8 bits in the lower byte,
00091                                 total bit count gives the number of sections active. */
00092   virtual uint32_t sectionMask() const { return m_sectionMask; }
00093   /** Common mode value for a given section, section number can be 0 to config.numAsicsRead()/2.
00094                 Will return 0 for data read from XTC, may be non-zero after calibration. */
00095   virtual float common_mode(uint32_t section) const { return m_common_mode[section]; }
00096 
00097 protected:
00098 
00099 private:
00100 
00101   uint32_t m_virtual_channel;
00102   uint32_t m_lane;
00103   uint32_t m_tid;
00104   uint32_t m_acq_count;
00105   uint32_t m_op_code;
00106   uint32_t m_quad;
00107   uint32_t m_seq_count;
00108   uint32_t m_ticks;
00109   uint32_t m_fiducials;
00110   uint16_t m_sb_temp[Nsbtemp];
00111   uint32_t m_frame_type;
00112   int16_t* m_data;
00113   uint32_t m_sectionMask;
00114   float m_common_mode[8];
00115   unsigned m_data_shape[3];
00116 
00117   // Copy constructor and assignment are disabled by default
00118   ElementT ( const ElementT& ) ;
00119   ElementT& operator = ( const ElementT& ) ;
00120 };
00121 
00122 typedef ElementT<Psana::CsPad::ElementV1> ElementV1;
00123 typedef ElementT<Psana::CsPad::ElementV2> ElementV2;
00124 
00125 } // namespace cspad_mod
00126 
00127 #endif // CSPAD_MOD_ELEMENTT_H

Generated on 19 Dec 2016 for PSANAmodules by  doxygen 1.4.7