er  dev
ERBeamTimeCommon.h
1 #ifndef ERBeamTimeCommon_H
2 #define ERBeamTimeCommon_H
3 
4 #include <map>
5 #include <vector>
6 #include <tuple>
7 
8 #include "ERSupport.h"
9 
10 using Signal = short;
11 using AmplitudeAndTime = std::pair<Signal, Signal>;
12 using SignalsAndChannelCount = std::pair<Signal*, ERChannel>;
13 using Channels = std::vector<ERChannel>;
14 using ChannelToSignal = std::map<ERChannel, Signal>;
15 using ChannelToAmpTime = std::map<ERChannel, AmplitudeAndTime>;
16 using ChannelToAmpTimeTac = std::map<ERChannel, std::tuple<Signal, Signal, Signal>>;
17 using ChannelMapping = std::map<ERChannel, ERChannel>;
18 const Signal no_signal = 0;
19 
20 //--------------------------------------------------------------------------------------------------
21 inline ERChannel GetChannelNumber(const ERChannel raw_channel, const ChannelMapping* channelsMapping) {
22  if (!channelsMapping)
23  return raw_channel;
24  const auto it = channelsMapping->find(raw_channel);
25  if (it == channelsMapping->end())
26  return raw_channel;
27  return it->second;
28 }
29 //--------------------------------------------------------------------------------------------------
30 
31 #endif //ERBeamTimeCommon_H