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_CABLINGTOOLS_EMR_HH_
19
#define _MAUS_INPUTCPPREALDATA_CABLINGTOOLS_EMR_HH_
31
#include "Utils/DAQChannelMap.hh"
32
#include "Utils/Exception.hh"
33
#include "Interface/Squeak.hh"
39
using std::stringstream;
43
//////////////////////////////////////////////////////////////////////////////////////////////
44
/** Identifier for a single EMR channel.
45
* This class is used to hold and manage all the information needed
46
* to identifiy one channel in the EMR detectors.
52
:_plane(-999), _orientation(-999), _bar(-999), _detector("unknown") {}
54
EMRChannelKey(int pl, int o, int b, string d)
55
: _plane(pl), _orientation(o), _bar(b), _detector(d) {}
57
explicit EMRChannelKey(string keyStr) throw(Exception);
58
virtual ~EMRChannelKey() {}
60
bool operator==( EMRChannelKey key );
61
bool operator!=( EMRChannelKey key );
63
friend ostream& operator<<( ostream& stream, EMRChannelKey key );
64
friend istream& operator>>( istream& stream, EMRChannelKey &key ) throw(Exception);
66
/** This function converts the DAQChannelKey into string.
67
* \return String identifier.
71
int plane() const {return _plane;}
72
int orientation() const {return _orientation;}
73
int bar() const {return _bar;}
74
string detector() const {return _detector;}
76
void SetPlane(int xPlane) {_plane = xPlane;}
77
void SetOrientation(int xOrientation) {_orientation = xOrientation;}
78
void SetBar(int xBar) {_bar = xBar;}
79
void SetDetector(string xDetector) {_detector = xDetector;}
92
/// Name of the detector.
96
//////////////////////////////////////////////////////////////////////////////////////////////
97
/** Complete map of all EMR channels.
98
* This class is used to hold and manage the informatin for all EMR Channel.
100
class EMRChannelMap {
104
virtual ~EMRChannelMap();
106
/// Initialize the map from text file.
107
bool InitFromFile(string filename);
112
/** Return pointer to the EMR key.
113
* This function returns pointer to the EMR channel key for the required DAQ channel.
114
* \param[in] daqch DAQ channel to search for.
115
* \return The key of the EMR channel connected to the given DAQ channel.
117
EMRChannelKey* find(DAQChannelKey* daqKey);
119
/** Return pointer to the EMR key.
120
* This function returns pointer to the EMR channel key for the required DAQ channel.
121
* \param[in] daqch DAQ channel to search for, coded as string.
122
* \return The key of the EMR channel connected to the given DAQ channel.
124
EMRChannelKey* find(string daqKeyStr);
125
int getOrientation(int plane);
129
for (unsigned int i = 0; i < _emrKey.size(); i++)
130
std::cout << *(_emrKey[i]) << " " << *(_dbbKey[i]) << std::endl;
135
std::vector<EMRChannelKey*> _emrKey;
136
std::vector<DAQChannelKey*> _dbbKey;