TotemDAQMapping

TotemTimingPlaneChannelPair

TotemVFATInfo

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
/****************************************************************************
*
* This is a part of TOTEM offline software.
* Authors: 
*   Maciej Wróbel (wroblisko@gmail.com)
*   Jan Kašpar (jan.kaspar@cern.ch)
*
****************************************************************************/

#ifndef CondFormats_PPSObjects_TotemDAQMapping
#define CondFormats_PPSObjects_TotemDAQMapping

#include "CondFormats/PPSObjects/interface/TotemFramePosition.h"
#include "CondFormats/PPSObjects/interface/TotemSymbId.h"
#include "CondFormats/PPSObjects/interface/TotemT2FramePosition.h"
#include "CondFormats/Serialization/interface/Serializable.h"
#include <map>
#include <cstdint>

//----------------------------------------------------------------------------------------------------

/**
 *\brief Contains mappind data related to a VFAT.
 */
class TotemVFATInfo {
public:
  /// the symbolic id
  TotemSymbID symbolicID;

  /// the hardware ID (16 bit)
  unsigned int hwID;

  friend std::ostream& operator<<(std::ostream& s, const TotemVFATInfo& fp);

  void print(std::ostream& os, std::string subSystemName) const;

  COND_SERIALIZABLE;
};

//----------------------------------------------------------------------------------------------------

/**
 *\brief The mapping between FramePosition and VFATInfo.
 */
class TotemDAQMapping {
public:
  std::map<TotemFramePosition, TotemVFATInfo> VFATMapping;

  /// Hw Id mapping for Totem Timing (dynamical mapping in Sampic)
  struct TotemTimingPlaneChannelPair {
    int plane;
    int channel;

    TotemTimingPlaneChannelPair(const int& plane = -1, const int& channel = -1) : plane(plane), channel(channel) {}
    COND_SERIALIZABLE;
  };
  std::map<uint8_t, TotemTimingPlaneChannelPair> totemTimingChannelMap;

  void insert(const TotemFramePosition& fp, const TotemVFATInfo& vi);
  void insert(const TotemT2FramePosition& fp2, const TotemVFATInfo& vi);
  void print(std::ostream& os, std::string subSystemName) const;

  /// Given the hardware ID, returns the corresponding Plane, Channel pair (TotemTimingPlaneChannelPair)
  const TotemTimingPlaneChannelPair getTimingChannel(const uint8_t hwId) const;

  COND_SERIALIZABLE;
};

std::ostream& operator<<(std::ostream& os, TotemDAQMapping mapping);

#endif