Pixie16 Analysis Software Suite
Analysis code for processing of .ldf files
DetectorLibrary Class Reference

A class to define a library of detectors known to the analysis. More...

#include <DetectorLibrary.hpp>

Inheritance diagram for DetectorLibrary:
Collaboration diagram for DetectorLibrary:

Public Types

typedef std::string mapkey_t
 typedef for a mapkey
 

Public Member Functions

virtual const_reference at (DetectorLibrary::size_type mod, DetectorLibrary::size_type ch) const
 
virtual const_reference at (DetectorLibrary::size_type idx) const
 
virtual reference at (DetectorLibrary::size_type mod, DetectorLibrary::size_type ch)
 
virtual reference at (DetectorLibrary::size_type idx)
 
virtual void push_back (const Identifier &x)
 
virtual ~DetectorLibrary ()
 
const std::set< int > & GetLocations (const Identifier &id) const
 
const std::set< int > & GetLocations (const std::string &type, const std::string &subtype) const
 
int GetNextLocation (const Identifier &id) const
 
int GetNextLocation (const std::string &type, const std::string &subtype) const
 
size_type GetIndex (int mod, int chan) const
 
int ModuleFromIndex (int index) const
 
int ChannelFromIndex (int index) const
 
unsigned int GetPhysicalModules () const
 
unsigned int GetModules () const
 
bool HasValue (int mod, int chan) const
 
bool HasValue (int index) const
 
void Set (int index, const Identifier &value)
 
void Set (int mod, int ch, const Identifier &value)
 
void PrintMap (void) const
 
void PrintUsedDetectors (RawEvent &rawev) const
 
const std::set< std::string > & GetKnownDetectors (void)
 
const std::set< std::string > & GetUsedDetectors (void) const
 

Static Public Member Functions

static DetectorLibraryget ()
 

Private Member Functions

 DetectorLibrary ()
 Default Constructor.
 
 DetectorLibrary (const DetectorLibrary &)
 Define the constructor with itself.
 
DetectorLibraryoperator= (DetectorLibrary const &)
 Define copy constructor.
 
void LoadXml ()
 
mapkey_t MakeKey (const std::string &type, const std::string &subtype) const
 

Private Attributes

std::map< mapkey_t, std::set< int > > locations
 collection of all used locations for a given type and subtype
 
unsigned int numModules
 number of modules
 
unsigned int numPhysicalModules
 number of physical modules
 
std::set< std::string > usedTypes
 used types
 
std::set< std::string > usedSubtypes
 used subtypes
 
std::set< std::string > knownDetectors
 known detectors in the analysis
 

Static Private Attributes

static DetectorLibraryinstance
 the static instance of the class
 
static std::set< int > emptyLocations
 dummy locations to return when map key does not exist
 

Detailed Description

A class to define a library of detectors known to the analysis.

Constructor & Destructor Documentation

virtual DetectorLibrary::~DetectorLibrary ( )
virtual

Default destructor

Member Function Documentation

virtual const_reference DetectorLibrary::at ( DetectorLibrary::size_type  mod,
DetectorLibrary::size_type  ch 
) const
virtual

Defines the at operator for access via module and channel number (const)

Parameters
[in]mod: the module
[in]ch: the channel
Returns
a reference to the DetectorLibrary
virtual const_reference DetectorLibrary::at ( DetectorLibrary::size_type  idx) const
virtual

defines the at operator for using an id (const)

Parameters
[in]idx: the id to look for
Returns
a reference to the DetectorLibrary
virtual reference DetectorLibrary::at ( DetectorLibrary::size_type  mod,
DetectorLibrary::size_type  ch 
)
virtual

Defines the at operator for access via module and channel number

Parameters
[in]mod: the module
[in]ch: the channel
Returns
a reference to the DetectorLibrary
virtual reference DetectorLibrary::at ( DetectorLibrary::size_type  idx)
virtual

defines the at operator for using an id (const)

Parameters
[in]idx: the id to look for
Returns
a reference to the DetectorLibrary
int DetectorLibrary::ChannelFromIndex ( int  index) const

Calculate channel number from the index

Parameters
[in]index: the index to convert
Returns
the channel calculated from the index
static DetectorLibrary* DetectorLibrary::get ( )
static
Returns
the only instance of the class
size_type DetectorLibrary::GetIndex ( int  mod,
int  chan 
) const

Get the index for a given module and channel

Parameters
[in]mod: the module number
[in]chan: the channel number
Returns
the index for a given module, channel
const std::set<std::string>& DetectorLibrary::GetKnownDetectors ( void  )

Retrieves a vector containing all detector types for which an analysis routine has been defined making it possible to declare this detector type in the map.txt file. The currently known detector types are in detectorString

Returns
Get the detectors known to the analysis
const std::set<int>& DetectorLibrary::GetLocations ( const Identifier id) const

Get the set of locations for the provided Identifier

Parameters
[in]id: The identifier to get the locations for
Returns
the set of locations for a given type, subtype
const std::set<int>& DetectorLibrary::GetLocations ( const std::string &  type,
const std::string &  subtype 
) const

Get the set of locations for the given type and subtype

Parameters
[in]type: the type to look for
[in]subtype: the subtype to look for
Returns
the set of locations for a given type, subtype
unsigned int DetectorLibrary::GetModules ( ) const
inline
Returns
the number of modules
int DetectorLibrary::GetNextLocation ( const Identifier id) const

Get the next undefined location of a given Identifier

Parameters
[in]id: The Identifier you want the the next location for
Returns
the id for the locaton
int DetectorLibrary::GetNextLocation ( const std::string &  type,
const std::string &  subtype 
) const

Get the next undefined location of a given type and subtype

Parameters
[in]type: the detector type
[in]subtype: the detector subtype
Returns
the id for the locaton
unsigned int DetectorLibrary::GetPhysicalModules ( ) const
inline
Returns
the number of physical modules
const std::set<std::string>& DetectorLibrary::GetUsedDetectors ( void  ) const
Returns
the used detectors
bool DetectorLibrary::HasValue ( int  mod,
int  chan 
) const

Check that the detector is in the list and kill if it's not

Parameters
[in]mod: the module number to check
[in]chan: the channel number to check
Returns
true if it has a value at the given mod,chan
bool DetectorLibrary::HasValue ( int  index) const

Check if the Library has a value at a given index

Parameters
[in]index: the index to check for
Returns
true if it has a value at the given mod,chan
void DetectorLibrary::LoadXml ( )
private

Load the XML configuration file

mapkey_t DetectorLibrary::MakeKey ( const std::string &  type,
const std::string &  subtype 
) const
private

Make a unique map key for the given type,subtype

Parameters
[in]type: the type to make a key out of
[in]subtype: the subtype to make a key out of
Returns
the constructed map key
int DetectorLibrary::ModuleFromIndex ( int  index) const

Calculate the module number from the index

Parameters
[in]index: the index to convert to module number
Returns
the module number
void DetectorLibrary::PrintMap ( void  ) const

Print out the map

void DetectorLibrary::PrintUsedDetectors ( RawEvent rawev) const

Print out the used detectors

Parameters
[in]rawev: the raw event to print from
virtual void DetectorLibrary::push_back ( const Identifier x)
virtual

Add an additional Identifier to the library

Parameters
[in]x: the Identifier to push back
void DetectorLibrary::Set ( int  index,
const Identifier value 
)

Check that the detector is in the list and kill if it's not

Parameters
[in]index: the index to look for
[in]value: the value to check for
void DetectorLibrary::Set ( int  mod,
int  ch,
const Identifier value 
)

Check that the detector is in the list and kill if it's not

Parameters
[in]mod: the module number to check
[in]ch: the channel number to check
[in]value: the value to check for

The documentation for this class was generated from the following file: