CMS 3D CMS Logo

RPCDigiL1Link.cc
Go to the documentation of this file.
3 
5 {
6  for (unsigned int i=0;i<7;i++){
7  std::pair<unsigned int, int > c(0,0);
8  _link.push_back(c);
9  }
10 }
11 
12 
14 {}
15 
16 
17 bool
19 {
20  bool e=true;
21  for (unsigned int l=1;l<=6;l++){
22  if (!this->empty(l)) e=false;
23  }
24  return e;
25 }
26 
27 
28 bool
29 RPCDigiL1Link::empty(unsigned int layer) const
30 {
31  this->checklayer(layer);
32  return this->rawdetId(layer)==0;
33 }
34 
35 
36 unsigned int
37 RPCDigiL1Link::rawdetId(unsigned int layer) const
38 {
39  this->checklayer(layer);
40  return _link[layer-1].first;
41 }
42 
43 
44 int
45 RPCDigiL1Link::strip(unsigned int layer) const
46 {
47  this->checklayer(layer);
48  return abs(_link[layer-1].second)%1000;
49 }
50 
51 int
52 RPCDigiL1Link::bx(unsigned int layer) const
53 {
54  this->checklayer(layer);
55  return _link[layer-1].second/1000;
56 }
57 
58 unsigned int
60 {
61  return _link.size()-1;
62 }
63 
64 
65 void
66 RPCDigiL1Link::setLink(unsigned int layer,
67  unsigned int rpcdetId,
68  int strip, int bx)
69 {
70  this->checklayer(layer);
71  int pdigi=abs(bx)*1000+strip;
72  if (bx<0)
73  pdigi*=-1;
74  std::pair<unsigned int, int> digi(rpcdetId,pdigi);
75  _link[layer-1]=digi;
76 
77 }
78 
79 
80 void
81 RPCDigiL1Link::checklayer(unsigned int layer)const {
82  if (layer == 0 || layer > 6)
83  throw cms::Exception("RPCException")
84  <<"RPCDigiL1Link: layer must be in the range from 1 to 6"
85 <<std::endl;
86 }
U second(std::pair< T, U > const &p)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22