1
/* This file is part of MAUS: http://micewww.pp.rl.ac.uk:8080/projects/maus
3
* MAUS is free software: you can redistribute it and/or modify
4
* it under the terms of the GNU General Public License as published by
5
* the Free Software Foundation, either version 3 of the License, or
6
* (at your option) any later version.
8
* MAUS is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License
14
* along with MAUS. If not, see <http://www.gnu.org/licenses/>.
18
#ifndef _MAUS_INPUTCPPREALDATA_CA_HH_
19
#define _MAUS_INPUTCPPREALDATA_CA_HH_
32
#include "Interface/Squeal.hh"
34
/** Identifier for a single DAQ channel.
35
* This class is used to hold and manage all the information needed
36
* to identifiy one DAQ Channel.
42
:_ldcId(-999), _geo(-999), _channel(-999), _eqType(-999), _detector("unknown") {}
44
DAQChannelKey(int l, int g, int ch, int e, std::string d)
45
:_ldcId(l), _geo(g), _channel(ch), _eqType(e), _detector(d) {}
47
explicit DAQChannelKey(std::string keyStr) throw(Squeal);
49
virtual ~DAQChannelKey() {}
51
bool operator==( DAQChannelKey key );
52
bool operator!=( DAQChannelKey key );
54
friend std::ostream& operator<< ( std::ostream& stream, DAQChannelKey key );
55
friend std::istream& operator>> ( std::istream& stream, DAQChannelKey &key ) throw(Squeal);
57
std::string detector() {return _detector;}
59
/** This function converts the DAQChannelKey into string.
60
* \return String identifier.
64
int ldc() const {return _ldcId;}
65
int geo() const {return _geo;}
66
int channel() const {return _channel;}
67
int eqType() const {return _eqType;}
69
/** This function creates unique integer identifier.
70
* \return Integer identifier.
72
int make_DAQChannelKey_id() { return _ldcId*1e8 + _geo*1e6 + _channel*1e3 + _eqType; }
76
/// Id number of the Local Data Concentrator (DAQ computer).
79
/// Id number of the board.
85
/// Type of the equipement as coded in DATE.
88
/// Name of the detector connected to this channel.
89
std::string _detector;
92
//////////////////////////////////////////////////////////////////////////////////////////////
94
/** Complete map of all DAQ channels.
95
* This class is used to hold and manage the informatin for all DAQ Channel.
101
virtual ~DAQChannelMap();
103
/** Initialize the map from text file.
104
* \param[in] filename name of the text file.
105
* \returns true if the map is initialized successfully.
107
bool InitFromFile(std::string filename);
112
/** Return pointer to the key.
113
* This function returns pointer to the key for the required DAQ channel.
114
* \param[in] ldc Id number of the Local Data Concentrator (computer).
115
* \param[in] geo Id number of the board.
116
* \param[in] ch Channel number.
117
* \param[in] eqType Type of the equipement as coded in DATE.
118
* \return The key of the DAQ channel.
120
DAQChannelKey* find(int ldc, int geo, int ch, int eqType);
122
/** Return pointer to the key.
123
* This function returns pointer to the key for the required DAQ channel.
124
* \param[in] daqKeyStr the required key coded as string.
125
* \return The key of the DAQ channel.
127
DAQChannelKey* find(std::string daqKeyStr);
129
/// Return the name of the detectro conected to this DAQ channel.
130
std::string detector(int ldc, int geo, int ch, int eqType);
133
/// vector holding DAQChannelKeys for all channels of the MICE DAQ system
134
std::vector<DAQChannelKey*> _chKey;