2021-07-13 16:36:41 -04:00
|
|
|
/*
|
|
|
|
ChannelMap.h
|
|
|
|
Class which acts as the go between for global compass channels (board#*16 + channel) and
|
|
|
|
physical detector information. Used in the event builder to assign compass data to real values
|
|
|
|
in a simple way. Takes in a definition file and parses it into an unordered_map container.
|
|
|
|
|
|
|
|
Written by G.W. McCann Oct. 2020
|
|
|
|
*/
|
|
|
|
#ifndef CHANNELMAP_H
|
|
|
|
#define CHANNELMAP_H
|
|
|
|
|
2021-12-13 12:28:56 -05:00
|
|
|
struct Channel
|
|
|
|
{
|
2021-07-13 16:36:41 -04:00
|
|
|
int detectorType; //What kind of detector we're looking at
|
|
|
|
int detectorID; //Which specific detector we're looking at
|
|
|
|
int detectorPart; //Which specific part we're looking at
|
|
|
|
};
|
|
|
|
|
|
|
|
//Detector part/type identifiers for use in the code
|
2021-12-13 12:28:56 -05:00
|
|
|
enum class DetAttribute
|
|
|
|
{
|
|
|
|
FocalPlane,
|
|
|
|
ScintLeft,
|
|
|
|
ScintRight,
|
|
|
|
AnodeFront,
|
|
|
|
AnodeBack,
|
|
|
|
DelayFR,
|
|
|
|
DelayFL,
|
|
|
|
DelayBR,
|
|
|
|
DelayBL,
|
|
|
|
Cathode,
|
|
|
|
Monitor,
|
|
|
|
SabreRing = 88, //These are offset to avoid interference at the variable mapping phase
|
|
|
|
SabreWedge = 99 //Just don't add any new attributes with values greater than 88
|
2021-07-13 16:36:41 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2021-12-13 12:28:56 -05:00
|
|
|
class ChannelMap
|
|
|
|
{
|
2021-07-13 16:36:41 -04:00
|
|
|
|
|
|
|
public:
|
2021-12-13 12:28:56 -05:00
|
|
|
typedef std::unordered_map<DetAttribute, Channel> Containter;
|
|
|
|
typedef std::unordered_map<DetAttribute, Channel>::iterator Iterator;
|
2021-07-13 16:36:41 -04:00
|
|
|
|
|
|
|
ChannelMap();
|
|
|
|
ChannelMap(const std::string& filename);
|
|
|
|
~ChannelMap();
|
|
|
|
bool FillMap(const std::string& filename);
|
|
|
|
inline const Containter* GetCMap() { return &cmap; };
|
|
|
|
inline Iterator FindChannel(int key) { return cmap.find(key); };
|
|
|
|
inline Iterator End() { return cmap.end(); };
|
|
|
|
inline bool IsValid() { return is_valid; };
|
|
|
|
|
|
|
|
private:
|
|
|
|
Containter cmap;
|
|
|
|
bool is_valid;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|