8 #ifndef HARDWAREELEMENTS_H 9 #define HARDWAREELEMENTS_H 23 typedef unsigned int ID;
49 if(
fType ==
"APA")
return 0;
50 if(
fType ==
"TPC")
return 1;
51 if(
fType ==
"Board")
return 2;
52 if(
fType ==
"ASIC")
return 3;
75 std::vector<raw::ChannelID_t>
const&
getChannels()
const{
return fChannelIDs;}
76 std::set<raw::ChannelID_t>
const&
getChannelsSet()
const{
return fChannelIDsSet;}
88 if(addChannelToSet(channel)) fChannelIDs.push_back(channel);
94 if(addHardwareIDToSet(
id)) fHardwareIDs.push_back(
id);
99 os << base <<
" has "<< rhs.
getNChannels() <<
" channels";
102 unsigned int max_num_channels = 16;
103 unsigned int this_channel_num = 0;
105 if(this_channel_num==0) os <<
":";
106 if(this_channel_num++ >= max_num_channels) {
114 os <<
"Contains: " << rhs.
getNHardwareIDs() <<
" pieces of hardware\n";
116 os << hardwareid <<
"\n";
132 auto result = fChannelIDsSet.insert(this_channel);
133 if(
result.first != fChannelIDsSet.end())
return result.second;
140 auto result = fHardwareIDsSet.insert(this_hardwareid);
141 if(
result.first != fHardwareIDsSet.end())
return result.second;
157 using ASICMap = std::map<ID, std::shared_ptr<ASIC >>;
158 using BoardMap = std::map<ID, std::shared_ptr<Board>>;
159 using TPCMap = std::map<ID, std::shared_ptr<TPC >>;
160 using APAMap = std::map<ID, std::shared_ptr<APA >>;
162 #endif //#ifndef __GCCXML__ 165 #endif //#ifndef HARDWAREELEMENTS_H
size_t getNHardwareIDs() const
bool addHardwareIDToSet(HardwareID this_hardwareid)
std::set< raw::ChannelID_t > fChannelIDsSet
std::vector< raw::ChannelID_t > fChannelIDs
friend std::ostream & operator<<(std::ostream &os, HardwareID const &rhs)
size_t getNChannels() const
static const HardwareID UnknownID
HardwareID(ID id, std::string this_type)
void addChannel(raw::ChannelID_t channel)
size_t getNChannelsSet() const
Element(ID id, std::string this_type)
friend bool operator<(const HardwareID &lhs, const HardwareID &rhs)
std::map< ID, std::shared_ptr< TPC >> TPCMap
std::map< ID, std::shared_ptr< ASIC >> ASICMap
std::string const & getType() const
std::vector< raw::ChannelID_t > const & getChannels() const
std::vector< HardwareID > const & getHardwareIDs() const
std::set< HardwareID > const & getHardwareIDsSet() const
std::vector< HardwareID > fHardwareIDs
size_t getNHardwareIDsSet() const
std::map< ID, std::shared_ptr< APA >> APAMap
unsigned int ChannelID_t
Type representing the ID of a readout channel.
std::set< raw::ChannelID_t > const & getChannelsSet() const
std::map< ID, std::shared_ptr< Board >> BoardMap
std::set< HardwareID > fHardwareIDsSet
void addHardwareID(HardwareID id)
bool addChannelToSet(raw::ChannelID_t this_channel)