Pixie16 Analysis Software Suite
Analysis code for processing of .ldf files
DetectorLibrary.hpp
Go to the documentation of this file.
1 
5 #ifndef __DETECTORLIBRARY_HPP_
6 #define __DETECTORLIBRARY_HPP_
7 
8 #include <map>
9 #include <set>
10 #include <string>
11 #include <vector>
12 
13 #include "Identifier.hpp"
14 #include "RawEvent.hpp"
15 
16 //class RawEvent;
17 
19 class DetectorLibrary : public std::vector<Identifier> {
20 public:
22  static DetectorLibrary* get();
23 
28  virtual const_reference at(DetectorLibrary::size_type mod,
29  DetectorLibrary::size_type ch) const;
33  virtual const_reference at(DetectorLibrary::size_type idx) const;
34 
39  virtual reference at(DetectorLibrary::size_type mod,
40  DetectorLibrary::size_type ch);
44  virtual reference at(DetectorLibrary::size_type idx);
45 
48  virtual void push_back(const Identifier &x);
50  virtual ~DetectorLibrary();
51 
55  const std::set<int> &GetLocations(const Identifier &id) const;
60  const std::set<int> &GetLocations(const std::string &type,
61  const std::string &subtype) const;
65  int GetNextLocation(const Identifier &id) const;
70  int GetNextLocation(const std::string &type,
71  const std::string &subtype) const;
76  size_type GetIndex(int mod, int chan) const;
80  int ModuleFromIndex(int index) const;
84  int ChannelFromIndex(int index) const;
85 
87  unsigned int GetPhysicalModules() const {return numPhysicalModules;}
89  unsigned int GetModules() const {return numModules;}
94  bool HasValue(int mod, int chan) const;
98  bool HasValue(int index) const;
102  void Set(int index, const Identifier& value);
107  void Set(int mod, int ch, const Identifier& value);
108 
110  void PrintMap(void) const;
113  void PrintUsedDetectors(RawEvent& rawev) const;
114 
119  const std::set<std::string>& GetKnownDetectors(void);
121  const std::set<std::string>& GetUsedDetectors(void) const;
122 
123  typedef std::string mapkey_t;
124 
125 private:
126  DetectorLibrary();
130 
132  void LoadXml();
133 
138  mapkey_t MakeKey( const std::string &type, const std::string &subtype ) const;
139 
140  std::map< mapkey_t, std::set<int> > locations;
141  static std::set<int> emptyLocations;
142 
143  unsigned int numModules;
144  unsigned int numPhysicalModules;
145 
146  std::set<std::string> usedTypes;
147  std::set<std::string> usedSubtypes;
148  std::set<std::string> knownDetectors;
149 };
150 #endif // __DETECTORLIBRARY_HPP_
int GetNextLocation(const Identifier &id) const
A class to define a library of detectors known to the analysis.
Definition: DetectorLibrary.hpp:19
void Set(int index, const Identifier &value)
virtual void push_back(const Identifier &x)
DetectorLibrary()
Default Constructor.
int ModuleFromIndex(int index) const
int ChannelFromIndex(int index) const
size_type GetIndex(int mod, int chan) const
const std::set< int > & GetLocations(const Identifier &id) const
mapkey_t MakeKey(const std::string &type, const std::string &subtype) const
const std::set< std::string > & GetKnownDetectors(void)
std::map< mapkey_t, std::set< int > > locations
collection of all used locations for a given type and subtype
Definition: DetectorLibrary.hpp:140
bool HasValue(int mod, int chan) const
virtual ~DetectorLibrary()
Defines identifying information for channels.
virtual const_reference at(DetectorLibrary::size_type mod, DetectorLibrary::size_type ch) const
DetectorLibrary & operator=(DetectorLibrary const &)
Define copy constructor.
const std::set< std::string > & GetUsedDetectors(void) const
static DetectorLibrary * instance
the static instance of the class
Definition: DetectorLibrary.hpp:129
std::set< std::string > usedTypes
used types
Definition: DetectorLibrary.hpp:146
void PrintMap(void) const
std::set< std::string > usedSubtypes
used subtypes
Definition: DetectorLibrary.hpp:147
unsigned int GetModules() const
Definition: DetectorLibrary.hpp:89
static std::set< int > emptyLocations
dummy locations to return when map key does not exist
Definition: DetectorLibrary.hpp:141
std::string mapkey_t
typedef for a mapkey
Definition: DetectorLibrary.hpp:123
unsigned int numPhysicalModules
number of physical modules
Definition: DetectorLibrary.hpp:144
unsigned int numModules
number of modules
Definition: DetectorLibrary.hpp:143
The all important raw event.
Definition: RawEvent.hpp:46
unsigned int GetPhysicalModules() const
Definition: DetectorLibrary.hpp:87
std::set< std::string > knownDetectors
known detectors in the analysis
Definition: DetectorLibrary.hpp:148
Channel identification.
Definition: Identifier.hpp:23
void PrintUsedDetectors(RawEvent &rawev) const
Header file for the rawevent.