14 std::istringstream _conv;
17 _pos = _name.find(
"_R", _pos);
18 if (_pos == std::string::npos || (_pos += 2) >= _size)
19 throw cms::Exception(
"InvalidLinkBoardName") <<
"Expected _R[region], got " << _name;
20 switch (_name.at(_pos)) {
24 throw cms::Exception(
"InvalidLinkBoardName") <<
"Expected Region B or E, got " << _name.at(_pos) <<
" in " << _name;
27 if ((++_pos) >= _size)
28 throw cms::Exception(
"InvalidLinkBoardName") <<
"Name too short: " << _name;
31 _next = _name.find_first_not_of(
"+-0123456789", _pos);
33 _conv.str(_name.substr(_pos, _next - _pos));
39 _pos = _name.find(
"_S", _pos);
40 if (_pos == std::string::npos || (_pos += 2) >= _size)
41 throw cms::Exception(
"InvalidLinkBoardName") <<
"Expected _S[sector], got " << _name;
42 _next = _name.find_first_not_of(
"+-0123456789", _pos);
44 _conv.str(_name.substr(_pos, _next - _pos));
50 _pos = _name.find(
"_", _pos);
51 if (_pos == std::string::npos || (_pos += 2) >= _size)
52 throw cms::Exception(
"InvalidLinkBoardName") <<
"Name too short: " << _name;
53 switch (_name.at(_pos)) {
54 case 'N': _lb_link.
setSide(0);
break;
55 case 'M': _lb_link.
setSide(1);
break;
56 case 'P': _lb_link.
setSide(2);
break;
58 throw cms::Exception(
"InvalidLinkBoardName") <<
"Expected Side N, M or P, got " << _name.at(_pos) <<
" in " << _name;
61 if ((++_pos) >= _size)
62 throw cms::Exception(
"InvalidLinkBoardName") <<
"Name too short: " << _name;
66 _conv.str(_name.substr(_pos, 1));
69 if ((++_pos) >= _size)
70 throw cms::Exception(
"InvalidLinkBoardName") <<
"Name too short: " << _name;
75 char const * _tmpchar =
std::find(&(_fibre[0]), &(_fibre[0]) + 8, _name.at(_pos));
76 _lb_link.
setFibre(_tmpchar - &(_fibre[0]));
78 if ((++_pos) >= _size)
82 _next = _name.find(
"_CH", _pos);
83 if (_next == std::string::npos)
85 if (_next - _pos == 2) {
89 else if (_radial ==
"cd")
98 if (_pos + 3 >= _size)
99 throw cms::Exception(
"InvalidLinkBoardName") <<
"Name too short: " << _name;
101 _next = _name.find_first_not_of(
"+-0123456789", _pos);
103 _conv.str(_name.substr(_pos, _next - _pos));
112 parse(_name, _lb_link);
RPCLBLink & setSector(int _sector=wildcard_)
RPCLBLink & setWheelOrDisk(int _wheelordisk=wildcard_)
RPCLBLink & setSide(int _side=wildcard_)
RPCLBLink & setFibre(int _fibre=wildcard_)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
RPCLBLink & setRadial(int _radial=wildcard_)
RPCLBLink & setLinkBoard(int _linkboard=wildcard_)
static void parse(std::string const &_name, RPCLBLink &_lb_link)
RPCLBLink & setRegion(int _region=wildcard_)
RPCLBLink & setYoke(int _yoke=wildcard_)