-
Notifications
You must be signed in to change notification settings - Fork 1
/
DetInfo.cc
58 lines (50 loc) · 1.49 KB
/
DetInfo.cc
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
#include "pdsdata/xtc/DetInfo.hh"
#include "pdsdata/xtc/Level.hh"
#include <stdint.h>
#include <stdio.h>
using namespace Pds;
DetInfo::DetInfo(uint32_t processId,
Detector det, uint32_t detId,
Device dev, uint32_t devId) : Src(Level::Source) {
_log |= processId&0x00ffffff;
_phy = ((det&0xff)<<24) | ((detId&0xff)<<16) | ((dev&0xff)<<8) |(devId&0xff);
}
uint32_t DetInfo::processId() const { return _log&0xffffff; }
DetInfo::Detector DetInfo::detector() const {return (Detector)((_phy&0xff000000)>>24);}
DetInfo::Device DetInfo::device() const {return (Device)((_phy&0xff00)>>8);}
uint32_t DetInfo::detId() const {return (_phy&0xff0000)>>16;}
uint32_t DetInfo::devId() const {return _phy&0xff;}
const char* DetInfo::name(Detector det){
static const char* _detNames[] = {
"NoDetector",
"AmoIms",
"AmoPem",
"AmoETof",
"AmoITof",
"AmoMbs",
"AmoIis",
"AmoBps",
"Camp"
};
return (det < NumDetector ? _detNames[det] : "-Invalid-");
}
const char* DetInfo::name(Device dev) {
static const char* _devNames[] = {
"NoDevice",
"Evr",
"Acqiris",
"Opal1000",
"TM6740",
"pnCCD",
"NumDevice"
};
return (dev < NumDevice ? _devNames[dev] : "-Invalid-");
}
const char* DetInfo::name(const DetInfo& src) {
const int MaxLength=32;
static char _name[MaxLength];
snprintf(_name, MaxLength, "%s-%d|%s-%d",
name(src.detector()), src.detId(),
name(src.device ()), src.devId());
return _name;
}