Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:14:45

0001 /****************************************************************************
0002 *
0003 * This is a part of the PPS offline software.
0004 * Authors:
0005 *   Seyed Mohsen Etesami (setesami@cern.ch)
0006 *   Laurent Forthomme
0007 *   Nicola Minafra
0008 *
0009 ****************************************************************************/
0010 
0011 #ifndef EventFilter_CTPPSRawToDigi_DiamondVFATFrame
0012 #define EventFilter_CTPPSRawToDigi_DiamondVFATFrame
0013 
0014 #include "EventFilter/CTPPSRawToDigi/interface/VFATFrame.h"
0015 
0016 #include <cstdint>
0017 
0018 /**
0019  * Utilitary namespace to retrieve timing/status information from diamond VFAT frame
0020 **/
0021 namespace pps::diamond::vfat {
0022   /// Account for MSB/LSB "HW feature" reversal in HPTDC interpolation bits
0023   inline uint32_t correctTime(const uint32_t& time) { return (time & 0xFFE7FFFF) << 2 | (time & 0x00180000) >> 19; }
0024 
0025   /// get timing information for single leading edge
0026   inline uint32_t getLeadingEdgeTime(const VFATFrame& frame) {
0027     uint32_t time = ((frame.getData()[7] & 0x1f) << 16) + frame.getData()[8];
0028     return correctTime(time);
0029   }
0030   /// get timing information for single trailing edge
0031   inline uint32_t getTrailingEdgeTime(const VFATFrame& frame) {
0032     uint32_t time = ((frame.getData()[5] & 0x1f) << 16) + frame.getData()[6];
0033     return correctTime(time);
0034   }
0035   /// retrieve the threshold voltage for this channel
0036   inline uint32_t getThresholdVoltage(const VFATFrame& frame) {
0037     return ((frame.getData()[3] & 0x7ff) << 16) + frame.getData()[4];
0038   }
0039   /// flag stating whether the HPTDC channel encountered multiple hits
0040   inline VFATFrame::word getMultihit(const VFATFrame& frame) { return frame.getData()[2] & 0x01; }
0041   /// retrieve the list of error/status flags for the HPTDC when the frame was recorded
0042   inline VFATFrame::word getHptdcErrorFlag(const VFATFrame& frame) { return frame.getData()[1] & 0xFFFF; }
0043 }  // namespace pps::diamond::vfat
0044 
0045 #endif