CFEL - ASG Software Suite  2.5.0
CASS
lcls_key.hpp
Go to the documentation of this file.
1 // Copyright (C) 2016 Lutz Foucar
2 
3 /**
4  * @file lcls_key.hpp contains the lcls keys
5  *
6  * @author Lutz Foucar
7  */
8 
9 #include "pdsdata/xtc/TypeId.hh"
10 #include "pdsdata/xtc/DetInfo.hh"
11 
12 namespace cass
13 {
14 namespace lclsid
15 {
16 /** Key for IdConversion Map
17  *
18  * This will take the different information from the xtc and transform it to
19  * a unique key by having a comparison smaller than applied.
20  *
21  * Unfortunately the xtc differentiats between the detector and the detectorId
22  * the detector is an enum described in Pds::DetInfo::Detector and the detector
23  * id is different. The same is true for the device. Both, the detector ids and
24  * the device ids are encoded in a single unsigned 32 bit integer. To identify
25  * a single detector it is therefore necessary to give all the information.
26  *
27  * @author Lutz Foucar
28  */
29 class Key
30 {
31 public:
32  /** constructor
33  *
34  * will create the physical from the detector and device inputs. The
35  * detectorType can just be copied.
36  *
37  * @param detectorType the type of data contained in the xtc
38  * @param det enum of the detector itself
39  * @param detId the id of the detector
40  * @param dev enum of the device of the data
41  * @param devId the id of the device
42  */
43  Key(const Pds::TypeId::Type& detectorType,
44  const Pds::DetInfo::Detector& det, uint32_t detId,
45  const Pds::DetInfo::Device& dev, uint32_t devId)
46  :_detectorType(detectorType),
47  _detector(((det&0xff)<<24) | ((detId&0xff)<<16) | ((dev&0xff)<<8) |(devId&0xff))
48  {}
49 
50  /** constructor
51  *
52  * one can retrieve the physical id and the type id directly from the xtc.
53  * Therefore a direct assigmnet is possible.
54  *
55  * @param detectorType the type of data contained in the xtc
56  * @param physicalId the id that has the info about device and detector encoded
57  */
58  Key(const Pds::TypeId::Type& detectorType, uint32_t physicalId)
59  :_detectorType(detectorType),_detector(physicalId)
60  {}
61 
62  /** check whether this is less than other
63  *
64  * will compare for less first the _detectorType. If this is the same it will
65  * compare for less the _detector value. This makes sure that the lcls Id is
66  * unique.
67  *
68  * @param other the other key that one compares this key to
69  */
70  bool operator <(const Key& other) const
71  {
72  if (_detectorType != other._detectorType)
73  return _detectorType < other._detectorType;
74  return _detector < other._detector;
75  }
76 
77 private:
78  /** type of the detector contained in the xtc */
79  uint32_t _detectorType;
80 
81  /** the physical value of the detectors data. */
82  uint32_t _detector;
83 };
84 }//end namespace Id
85 }//end cass
definition of front detector[PixelDetectors] FrontPnCCD Detector
Key(const Pds::TypeId::Type &detectorType, uint32_t physicalId)
constructor
Definition: lcls_key.hpp:58
uint32_t _detector
the physical value of the detectors data.
Definition: lcls_key.hpp:82
Key(const Pds::TypeId::Type &detectorType, const Pds::DetInfo::Detector &det, uint32_t detId, const Pds::DetInfo::Device &dev, uint32_t devId)
constructor
Definition: lcls_key.hpp:43
uint32_t _detectorType
type of the detector contained in the xtc
Definition: lcls_key.hpp:79
bool operator<(const Key &other) const
check whether this is less than other
Definition: lcls_key.hpp:70
Key for IdConversion Map.
Definition: lcls_key.hpp:29