CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
RBCProcessRPCDigis Class Reference

#include <RBCProcessRPCDigis.h>

Inheritance diagram for RBCProcessRPCDigis:
ProcessInputSignal

Public Member Functions

void builddata ()
 
void configure ()
 
int next () override
 
void print_output ()
 
 RBCProcessRPCDigis (const edm::ESHandle< RPCGeometry > &, const edm::Handle< RPCDigiCollection > &)
 Standard constructor. More...
 
void reset ()
 
RPCInputSignalretrievedata () override
 
void rewind ()
 
void showfirst ()
 
 ~RBCProcessRPCDigis () override
 Destructor. More...
 
- Public Member Functions inherited from ProcessInputSignal
virtual ~ProcessInputSignal ()
 

Private Member Functions

int getBarrelLayer (const int &, const int &)
 
void initialize (std::vector< RPCData > &) const
 
void setDigiAt (int, int, RPCData &)
 
void setInputBit (std::bitset< 15 > &, int)
 

Private Attributes

std::map< int, RBCInput * > m_data
 
const bool m_debug
 
std::map< int, l1trigger::Countersm_digiCounters
 
std::unique_ptr< RPCInputSignalm_lbin
 
const int m_maxBxWindow
 
const edm::Handle< RPCDigiCollection > * m_ptr_digiColl
 
const edm::ESHandle< RPCGeometry > * m_ptr_rpcGeom
 
std::map< int, std::vector< RPCData > > m_vecDataperBx
 

Detailed Description

Author
Andres Felipe Osorio Oliveros
Date
2009-04-15

Definition at line 39 of file RBCProcessRPCDigis.h.

Constructor & Destructor Documentation

◆ RBCProcessRPCDigis()

RBCProcessRPCDigis::RBCProcessRPCDigis ( const edm::ESHandle< RPCGeometry > &  rpcGeom,
const edm::Handle< RPCDigiCollection > &  digiColl 
)

Standard constructor.

Definition at line 18 of file RBCProcessRPCDigis.cc.

20  : m_maxBxWindow{3}, m_debug{false} {
21  m_ptr_rpcGeom = &rpcGeom;
23 
24  m_lbin = std::make_unique<RBCLinkBoardGLSignal>(&m_data);
25 
26  configure();
27 }

◆ ~RBCProcessRPCDigis()

RBCProcessRPCDigis::~RBCProcessRPCDigis ( )
override

Destructor.

Definition at line 37 of file RBCProcessRPCDigis.cc.

37 {}

Member Function Documentation

◆ builddata()

void RBCProcessRPCDigis::builddata ( )

Definition at line 171 of file RBCProcessRPCDigis.cc.

171  {
172  for (auto& vecData : m_vecDataperBx) {
173  int bx = vecData.first;
174  int bxsign(1);
175 
176  if (bx != 0)
177  bxsign = (bx / abs(bx));
178  else
179  bxsign = 1;
180 
181  for (auto& item : vecData.second) {
182  for (int k = 0; k < 6; ++k) {
183  int code = bxsign * (1000000 * abs(bx) + 10000 * item.wheelIdx() + 100 * item.m_sec1[k] + 1 * item.m_sec2[k]);
184 
185  RBCInput* signal = &item.m_orsignals[k];
186  signal->needmapping = false;
187 
188  if (signal->hasData)
189  m_data.emplace(code, signal);
190  }
191  }
192  }
193 
194  if (m_debug and not m_vecDataperBx.empty())
195  std::cout << "builddata: completed. size of data: " << m_data.size() << std::endl;
196 }

References funct::abs(), l1GtPatternGenerator_cfi::bx, gather_cfg::cout, B2GTnPMonitor_cfi::item, dqmdumpme::k, m_data, m_debug, and m_vecDataperBx.

Referenced by next().

◆ configure()

void RBCProcessRPCDigis::configure ( )

Definition at line 29 of file RBCProcessRPCDigis.cc.

29  {
30  for (auto wheel : s_wheelid)
31  m_digiCounters.emplace(wheel, wheel);
32 }

References m_digiCounters, rpctechnicaltrigger::s_wheelid, and makeMuonMisalignmentScenario::wheel.

◆ getBarrelLayer()

int RBCProcessRPCDigis::getBarrelLayer ( const int &  _layer,
const int &  _station 
)
private

Definition at line 198 of file RBCProcessRPCDigis.cc.

198  {
199  //... Calculates the generic Barrel Layer (1 to 6)
200  int blayer(0);
201 
202  if (_station < 3) {
203  blayer = ((_station - 1) * 2) + _layer;
204  } else {
205  blayer = _station + 2;
206  }
207 
208  return blayer;
209 }

Referenced by next().

◆ initialize()

void RBCProcessRPCDigis::initialize ( std::vector< RPCData > &  dataVec) const
private

Definition at line 144 of file RBCProcessRPCDigis.cc.

144  {
145  if (m_debug)
146  std::cout << "initialize" << std::endl;
147 
148  constexpr int maxWheels = 5;
149  constexpr int maxRbcBrds = 6;
150 
151  dataVec.reserve(maxWheels);
152  for (int i = 0; i < maxWheels; ++i) {
153  auto& block = dataVec.emplace_back();
154 
155  block.m_wheel = s_wheelid[i];
156 
157  for (int j = 0; j < maxRbcBrds; ++j) {
158  block.m_sec1[j] = s_sec1id[j];
159  block.m_sec2[j] = s_sec2id[j];
160  block.m_orsignals[j].input_sec[0].reset();
161  block.m_orsignals[j].input_sec[1].reset();
162  block.m_orsignals[j].needmapping = false;
163  block.m_orsignals[j].hasData = false;
164  }
165  }
166 
167  if (m_debug)
168  std::cout << "initialize: completed" << std::endl;
169 }

References groupFilesInBlocks::block, gather_cfg::cout, mps_fire::i, dqmiolumiharvest::j, m_debug, rpctechnicaltrigger::s_sec1id, rpctechnicaltrigger::s_sec2id, and rpctechnicaltrigger::s_wheelid.

Referenced by next().

◆ next()

int RBCProcessRPCDigis::next ( void  )
overridevirtual

Implements ProcessInputSignal.

Definition at line 40 of file RBCProcessRPCDigis.cc.

40  {
41  //...clean up previous data contents
42 
43  reset();
44 
45  int ndigis(0);
46 
47  for (auto const& detUnit : *(*m_ptr_digiColl)) {
48  if (m_debug)
49  std::cout << "looping over digis 1 ..." << std::endl;
50 
51  auto digiItr = detUnit.second.first;
52  int bx = (*digiItr).bx();
53 
54  if (abs(bx) >= m_maxBxWindow) {
55  if (m_debug)
56  std::cout << "RBCProcessRPCDigis> found a bx bigger than max allowed: " << bx << std::endl;
57  continue;
58  }
59 
60  const RPCDetId& id = detUnit.first;
61  const RPCRoll* roll = dynamic_cast<const RPCRoll*>((*m_ptr_rpcGeom)->roll(id));
62 
63  if ((roll->isForward())) {
64  if (m_debug)
65  std::cout << "RBCProcessRPCDigis: roll is forward" << std::endl;
66  continue;
67  }
68 
69  int wheel = roll->id().ring(); // -2,-1,0,+1,+2
70  int sector = roll->id().sector(); // 1 to 12
71  int layer = roll->id().layer(); // 1,2
72  int station = roll->id().station(); // 1-4
73  int blayer = getBarrelLayer(layer, station); // 1 to 6
74  int rollid = id.roll();
75 
76  int digipos = (station * 100) + (layer * 10) + rollid;
77 
78  if ((wheel == -1 || wheel == 0 || wheel == 1) && station == 2 && layer == 1)
79  digipos = 30000 + digipos;
80  if ((wheel == -2 || wheel == 2) && station == 2 && layer == 2)
81  digipos = 30000 + digipos;
82 
83  if ((wheel == -1 || wheel == 0 || wheel == 1) && station == 2 && layer == 2)
84  digipos = 20000 + digipos;
85  if ((wheel == -2 || wheel == 2) && station == 2 && layer == 1)
86  digipos = 20000 + digipos;
87 
88  if (m_debug)
89  std::cout << "Bx: " << bx << '\t' << "Wheel: " << wheel << '\t' << "Sector: " << sector << '\t'
90  << "Station: " << station << '\t' << "Layer: " << layer << '\t' << "B-Layer: " << blayer << '\t'
91  << "Roll id: " << rollid << '\t' << "Digi at: " << digipos << '\n';
92 
93  //... Construct the RBCinput objects
94  auto itr = m_vecDataperBx.find(bx);
95 
96  if (itr == m_vecDataperBx.end()) {
97  if (m_debug)
98  std::cout << "Found a new Bx: " << bx << std::endl;
99  auto& wheelData = m_vecDataperBx[bx];
100  initialize(wheelData);
101  setDigiAt(sector, digipos, wheelData[(wheel + 2)]);
102  } else {
103  setDigiAt(sector, digipos, (*itr).second[(wheel + 2)]);
104  }
105 
106  auto wheelCounter = m_digiCounters.find(wheel);
107 
108  if (wheelCounter != m_digiCounters.end())
109  (*wheelCounter).second.incrementSector(sector);
110 
111  if (m_debug)
112  std::cout << "looping over digis 2 ..." << std::endl;
113 
114  ++ndigis;
115  }
116 
117  if (m_debug)
118  std::cout << "size of data vectors: " << m_vecDataperBx.size() << std::endl;
119 
120  builddata();
121 
122  if (m_debug) {
123  std::cout << "after reset" << std::endl;
124  print_output();
125  }
126 
127  if (m_debug)
128  std::cout << "RBCProcessRPCDigis: DataSize: " << m_data.size() << " ndigis " << ndigis << std::endl;
129 
130  for (auto& wheelCounter : m_digiCounters) {
131  wheelCounter.second.evalCounters();
132  if (m_debug)
133  wheelCounter.second.printSummary();
134  }
135 
136  if (m_data.empty())
137  return 0;
138 
139  return 1;
140 }

References funct::abs(), builddata(), l1GtPatternGenerator_cfi::bx, gather_cfg::cout, getBarrelLayer(), RPCRoll::id(), initialize(), RPCRoll::isForward(), RPCDetId::layer(), m_data, m_debug, m_digiCounters, m_maxBxWindow, m_ptr_digiColl, m_vecDataperBx, print_output(), reset(), RPCDetId::ring(), RPCDetId::sector(), setDigiAt(), relativeConstraints::station, RPCDetId::station(), and makeMuonMisalignmentScenario::wheel.

◆ print_output()

void RBCProcessRPCDigis::print_output ( )

Definition at line 251 of file RBCProcessRPCDigis.cc.

251  {
252  std::cout << "RBCProcessRPCDigis> Output starts" << std::endl;
253 
254  for (auto const& item : m_data) {
255  std::cout << item.first << '\t' << (*item.second) << '\n';
256  }
257 
258  std::cout << "RBCProcessRPCDigis> Output ends" << std::endl;
259 }

References gather_cfg::cout, B2GTnPMonitor_cfi::item, and m_data.

Referenced by next().

◆ reset()

void RBCProcessRPCDigis::reset ( void  )

Definition at line 142 of file RBCProcessRPCDigis.cc.

142 { m_vecDataperBx.clear(); }

References m_vecDataperBx.

Referenced by next().

◆ retrievedata()

RPCInputSignal* RBCProcessRPCDigis::retrievedata ( )
inlineoverridevirtual

Implements ProcessInputSignal.

Definition at line 56 of file RBCProcessRPCDigis.h.

56 { return m_lbin.get(); };

References m_lbin.

◆ rewind()

void RBCProcessRPCDigis::rewind ( )
inline

Definition at line 58 of file RBCProcessRPCDigis.h.

58 {};

◆ setDigiAt()

void RBCProcessRPCDigis::setDigiAt ( int  sector,
int  digipos,
RPCData block 
)
private

Definition at line 211 of file RBCProcessRPCDigis.cc.

211  {
212  int pos = 0;
213  int isAoB = 0;
214 
215  if (m_debug)
216  std::cout << "setDigiAt" << std::endl;
217 
218  auto itr = std::find(s_sec1id.begin(), s_sec1id.end(), sector);
219 
220  if (itr == s_sec1id.end()) {
221  itr = std::find(s_sec2id.begin(), s_sec2id.end(), sector);
222  isAoB = 1;
223  }
224 
225  for (pos = 0; pos < 6; ++pos) {
226  if (block.m_sec1[pos] == sector || block.m_sec2[pos] == sector)
227  break;
228  }
229 
230  if (m_debug)
231  std::cout << block.m_orsignals[pos];
232 
233  setInputBit(block.m_orsignals[pos].input_sec[isAoB], digipos);
234 
235  block.m_orsignals[pos].hasData = true;
236 
237  if (m_debug)
238  std::cout << block.m_orsignals[pos];
239 
240  if (m_debug)
241  std::cout << "setDigiAt completed" << std::endl;
242 }

References groupFilesInBlocks::block, gather_cfg::cout, spr::find(), m_debug, rpctechnicaltrigger::s_sec1id, rpctechnicaltrigger::s_sec2id, and setInputBit().

Referenced by next().

◆ setInputBit()

void RBCProcessRPCDigis::setInputBit ( std::bitset< 15 > &  signals,
int  digipos 
)
private

Definition at line 244 of file RBCProcessRPCDigis.cc.

244  {
245  int bitpos = s_layermap.at(digipos);
246  if (m_debug)
247  std::cout << "Bitpos: " << bitpos << std::endl;
248  signals.set(bitpos, true);
249 }

References gather_cfg::cout, m_debug, and rpctechnicaltrigger::s_layermap.

Referenced by setDigiAt().

◆ showfirst()

void RBCProcessRPCDigis::showfirst ( )
inline

Definition at line 59 of file RBCProcessRPCDigis.h.

59 {};

Member Data Documentation

◆ m_data

std::map<int, RBCInput *> RBCProcessRPCDigis::m_data
private

Definition at line 76 of file RBCProcessRPCDigis.h.

Referenced by builddata(), next(), and print_output().

◆ m_debug

const bool RBCProcessRPCDigis::m_debug
private

Definition at line 82 of file RBCProcessRPCDigis.h.

Referenced by builddata(), initialize(), next(), setDigiAt(), and setInputBit().

◆ m_digiCounters

std::map<int, l1trigger::Counters> RBCProcessRPCDigis::m_digiCounters
private

Definition at line 80 of file RBCProcessRPCDigis.h.

Referenced by configure(), and next().

◆ m_lbin

std::unique_ptr<RPCInputSignal> RBCProcessRPCDigis::m_lbin
private

Definition at line 74 of file RBCProcessRPCDigis.h.

Referenced by retrievedata().

◆ m_maxBxWindow

const int RBCProcessRPCDigis::m_maxBxWindow
private

Definition at line 81 of file RBCProcessRPCDigis.h.

Referenced by next().

◆ m_ptr_digiColl

const edm::Handle<RPCDigiCollection>* RBCProcessRPCDigis::m_ptr_digiColl
private

Definition at line 72 of file RBCProcessRPCDigis.h.

Referenced by next().

◆ m_ptr_rpcGeom

const edm::ESHandle<RPCGeometry>* RBCProcessRPCDigis::m_ptr_rpcGeom
private

Definition at line 71 of file RBCProcessRPCDigis.h.

◆ m_vecDataperBx

std::map<int, std::vector<RPCData> > RBCProcessRPCDigis::m_vecDataperBx
private

Definition at line 78 of file RBCProcessRPCDigis.h.

Referenced by builddata(), next(), and reset().

RPCRoll
Definition: RPCRoll.h:12
DigiToRawDM_cff.digiColl
digiColl
Definition: DigiToRawDM_cff.py:32
mps_fire.i
i
Definition: mps_fire.py:355
RPCDetId::station
int station() const
Definition: RPCDetId.h:78
RBCProcessRPCDigis::configure
void configure()
Definition: RBCProcessRPCDigis.cc:29
RBCProcessRPCDigis::m_ptr_digiColl
const edm::Handle< RPCDigiCollection > * m_ptr_digiColl
Definition: RBCProcessRPCDigis.h:72
relativeConstraints.station
station
Definition: relativeConstraints.py:67
RBCProcessRPCDigis::builddata
void builddata()
Definition: RBCProcessRPCDigis.cc:171
RPCDetId
Definition: RPCDetId.h:16
gather_cfg.cout
cout
Definition: gather_cfg.py:144
pos
Definition: PixelAliasList.h:18
rpctechnicaltrigger::s_wheelid
constexpr std::array< int, 5 > s_wheelid
Definition: GeometryConstants.h:28
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
RBCProcessRPCDigis::setDigiAt
void setDigiAt(int, int, RPCData &)
Definition: RBCProcessRPCDigis.cc:211
RPCRoll::isForward
bool isForward() const
Definition: RPCRoll.cc:43
RBCProcessRPCDigis::initialize
void initialize(std::vector< RPCData > &) const
Definition: RBCProcessRPCDigis.cc:144
rpctechnicaltrigger::s_sec1id
constexpr std::array< int, 6 > s_sec1id
Definition: GeometryConstants.h:29
RPCRoll::id
RPCDetId id() const
Definition: RPCRoll.cc:16
RBCProcessRPCDigis::m_debug
const bool m_debug
Definition: RBCProcessRPCDigis.h:82
RBCProcessRPCDigis::getBarrelLayer
int getBarrelLayer(const int &, const int &)
Definition: RBCProcessRPCDigis.cc:198
dqmdumpme.k
k
Definition: dqmdumpme.py:60
RBCProcessRPCDigis::m_vecDataperBx
std::map< int, std::vector< RPCData > > m_vecDataperBx
Definition: RBCProcessRPCDigis.h:78
RBCProcessRPCDigis::setInputBit
void setInputBit(std::bitset< 15 > &, int)
Definition: RBCProcessRPCDigis.cc:244
RBCProcessRPCDigis::m_maxBxWindow
const int m_maxBxWindow
Definition: RBCProcessRPCDigis.h:81
makeMuonMisalignmentScenario.wheel
wheel
Definition: makeMuonMisalignmentScenario.py:319
RBCProcessRPCDigis::m_digiCounters
std::map< int, l1trigger::Counters > m_digiCounters
Definition: RBCProcessRPCDigis.h:80
RBCProcessRPCDigis::m_ptr_rpcGeom
const edm::ESHandle< RPCGeometry > * m_ptr_rpcGeom
Definition: RBCProcessRPCDigis.h:71
groupFilesInBlocks.block
block
Definition: groupFilesInBlocks.py:150
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
RBCProcessRPCDigis::print_output
void print_output()
Definition: RBCProcessRPCDigis.cc:251
itr
std::vector< std::pair< float, float > >::iterator itr
Definition: HGCDigitizer.cc:28
rpctechnicaltrigger::s_layermap
const std::map< int, int > s_layermap
Definition: GeometryConstants.cc:19
RPCDetId::ring
int ring() const
Definition: RPCDetId.h:59
RBCProcessRPCDigis::m_data
std::map< int, RBCInput * > m_data
Definition: RBCProcessRPCDigis.h:76
RBCProcessRPCDigis::reset
void reset()
Definition: RBCProcessRPCDigis.cc:142
RPCDetId::sector
int sector() const
Sector id: the group of chambers at same phi (and increasing r)
Definition: RPCDetId.h:81
RBCInput
Definition: RBCInput.h:22
RBCProcessRPCDigis::m_lbin
std::unique_ptr< RPCInputSignal > m_lbin
Definition: RBCProcessRPCDigis.h:74
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
rpctechnicaltrigger::s_sec2id
constexpr std::array< int, 6 > s_sec2id
Definition: GeometryConstants.h:30
RPCDetId::layer
int layer() const
Definition: RPCDetId.h:85