WiredAdcChannelDataMap.h
Go to the documentation of this file.
1 // WiredAdcChannelDataMap.h
2 //
3 // David Adams
4 // September 2016
5 //
6 // WiredAdcChannelDataMap is a simple struct that hold a map of
7 // AdcChannelDataMaps and a map of larsoft wire containers.
8 // Both are indexed by name.
9 //
10 // It is used to hold intermediate states in data preparation.
11 
12 #ifndef WiredAdcChannelDataMap_H
13 #define WiredAdcChannelDataMap_H
14 
15 #include <string>
16 #include <vector>
19 
21 
22 public:
23 
24  typedef std::string Name;
25  typedef std::vector<Name> NameVector;
26  typedef std::vector<recob::Wire> WireContainer;
27 
28  // Data and wire maps indexed by state name.
29  std::map<Name, AdcChannelDataMap> dataMaps;
30  std::map<Name, WireContainer*> wires;
31 
32  WiredAdcChannelDataMap() =default;
33 
34  // Ctor from state name and maximum number of channels.
35  WiredAdcChannelDataMap(const NameVector names, AdcChannel nchmax) {
36  for ( Name name : names ) {
37  dataMaps[name];
38  WireContainer* pwires = new WireContainer;
39  wires[name] = pwires;
40  pwires->reserve(nchmax);
41  }
42  }
43 
44  // Return if this object holds ADC channel data for the given stae name.
45  bool hasData(Name sname) {
46  return dataMaps.find(sname) != dataMaps.end();
47  }
48 
49  // Return if this object holds wires for the given state name.
50  bool hasWires(Name sname) {
51  return wires.find(sname) != wires.end();
52  }
53 
54 };
55 
56 #endif
static QCString name
Definition: declinfo.cpp:673
std::string string
Definition: nybbler.cc:12
WiredAdcChannelDataMap(const NameVector names, AdcChannel nchmax)
std::map< Name, AdcChannelDataMap > dataMaps
std::map< Name, WireContainer * > wires
unsigned int AdcChannel
Definition: AdcTypes.h:50
WiredAdcChannelDataMap()=default
std::vector< Name > NameVector
Declaration of basic channel signal object.
static std::vector< std::string > const names
Definition: FragmentType.hh:8
std::vector< recob::Wire > WireContainer