39 : cellMapVersion(cell_map_version),
40 robMapVersion(rob_map_version),
70 int dduId,
int rosId,
int robId,
int tdcId,
int channelId,
DTWireId& wireId)
const {
79 readOutToGeometry(dduId, rosId, robId, tdcId, channelId, wheelId, stationId, sectorId, slId, layerId, cellId);
81 wireId =
DTWireId(wheelId, stationId, sectorId, slId, layerId, cellId);
96 wheelId = stationId = sectorId = slId = layerId = cellId = 0;
108 std::vector<int> dduKey;
110 dduKey.push_back(dduId);
111 dduKey.push_back(rosId);
119 std::vector<int> rosKey;
121 rosKey.push_back(lros.
cellId);
122 rosKey.push_back(robId);
127 if (lrob.
wheelId != defaultValue)
133 std::vector<int> robKey;
135 robKey.push_back(lrob.
cellId);
136 robKey.push_back(tdcId);
137 robKey.push_back(channelId);
148 std::vector<int> chanKey;
150 chanKey.push_back(dduId);
151 chanKey.push_back(rosId);
152 chanKey.push_back(robId);
153 chanKey.push_back(tdcId);
154 chanKey.push_back(channelId);
159 wheelId =
link.wheelId;
160 stationId =
link.stationId;
161 sectorId =
link.sectorId;
163 layerId =
link.layerId;
164 cellId =
link.cellId;
171 const DTWireId& wireId,
int& dduId,
int& rosId,
int& robId,
int& tdcId,
int& channelId)
const {
195 int& channelId)
const {
196 dduId = rosId = robId = tdcId = channelId = 0;
212 std::vector<int>
const* robMLgr;
213 std::vector<int>
const* rosMLgr;
214 std::vector<int>
const* dduMLgr;
216 std::vector<int> cellKey;
218 cellKey.push_back(cellId);
219 cellKey.push_back(layerId);
220 cellKey.push_back(slId);
221 std::vector<int> stdcKey = cellKey;
225 if (!(robMLgr->size()))
227 std::vector<int>::const_iterator tdc_iter = robMLgr->begin();
228 std::vector<int>::const_iterator tdc_iend = robMLgr->end();
229 while (tdc_iter != tdc_iend) {
236 cellKey.push_back(mapId);
237 cellKey.push_back(stationId);
238 std::vector<int> srosKey = cellKey;
242 if (!(rosMLgr->size()))
244 std::vector<int>::const_iterator ros_iter = rosMLgr->begin();
245 std::vector<int>::const_iterator ros_iend = rosMLgr->end();
246 while (ros_iter != ros_iend) {
251 if ((secCk != defaultValue) && (secCk != sectorId))
253 if ((wheCk != defaultValue) && (wheCk != wheelId))
258 cellKey.push_back(mapId);
259 cellKey.push_back(wheelId);
260 cellKey.push_back(sectorId);
261 std::vector<int> sdduKey = cellKey;
265 if (!(dduMLgr->size()))
269 if (!(dduMLgr->size()))
272 std::vector<int>::const_iterator ddu_iter = dduMLgr->begin();
273 std::vector<int>::const_iterator ddu_iend = dduMLgr->end();
274 while (ddu_iter != ddu_iend) {
277 if (((sectorId == secCk) || (sectorId == lddu.
sectorId)) &&
278 ((wheelId == wheCk) || (wheelId == lddu.
wheelId))) {
290 std::vector<int> cellKey;
292 cellKey.push_back(wheelId);
293 cellKey.push_back(stationId);
294 cellKey.push_back(sectorId);
295 cellKey.push_back(slId);
296 cellKey.push_back(layerId);
297 cellKey.push_back(cellId);
306 channelId =
link.channelId;
357 link.channelId = channelId;
358 link.wheelId = wheelId;
359 link.stationId = stationId;
360 link.sectorId = sectorId;
362 link.layerId = layerId;
363 link.cellId = cellId;
379 std::vector<int> cellKey;
381 cellKey.push_back(wheelId);
382 cellKey.push_back(stationId);
383 cellKey.push_back(sectorId);
384 cellKey.push_back(slId);
385 cellKey.push_back(layerId);
386 cellKey.push_back(cellId);
387 int grStatus = pgrBuf->
insert(cellKey.begin(), cellKey.end(), ientry);
389 std::vector<int> chanKey;
391 chanKey.push_back(dduId);
392 chanKey.push_back(rosId);
393 chanKey.push_back(robId);
394 chanKey.push_back(tdcId);
395 chanKey.push_back(channelId);
396 int rgStatus = prgBuf->
insert(chanKey.begin(), chanKey.end(), ientry);
398 if (grStatus || rgStatus)
417 std::vector<DTReadOutGeometryLink> entryList;
420 while (compIter != compIend)
421 entryList.push_back(*compIter++);
447 std::vector<DTReadOutGeometryLink>::const_iterator iter = entryList.begin();
448 std::vector<DTReadOutGeometryLink>::const_iterator iend = entryList.end();
449 std::vector<DTReadOutGeometryLink>::const_iterator iros = entryList.end();
450 std::vector<DTReadOutGeometryLink>::const_iterator irob = entryList.end();
451 while (iter != iend) {
453 if (rosEntry.
dduId > 0x3fffffff)
455 ddu = rosEntry.
dduId;
456 ros = rosEntry.
rosId;
463 iros = entryList.begin();
464 while (iros != iend) {
468 if ((rchEntry.
dduId != mt1) || (rchEntry.
rosId != mi1))
470 rch = rchEntry.
robId;
479 irob = entryList.begin();
480 while (irob != iend) {
484 if (robEntry.
robId != rob) {
485 std::cout <<
"ROB mismatch " << rob <<
" " << robEntry.
robId << std::endl;
487 tdc = robEntry.
tdcId;
492 fullMap->
insertReadOutGeometryLink(ddu, ros, rch, tdc, tch, wha, sta, sea, qua, lay, cel);
500 std::stringstream
name;
506 std::stringstream
name;
514 localCache->mType.insert(0, 0);
518 std::vector<int> cellKey;
520 std::vector<int> chanKey;
522 int defaultValue = 0;
527 std::map<int, std::vector<int>*> dduEntries;
528 for (entryNum = 0; entryNum < entryMax; entryNum++) {
533 if (
key > 0x3fffffff) {
534 if (
link.tdcId > 0x3fffffff) {
535 localCache->mType.insert(0, defaultValue =
link.tdcId);
538 localCache->mType.insert(0, defaultValue =
link.wheelId);
543 if (defaultValue == 0) {
545 chanKey.push_back(
link.dduId);
546 chanKey.push_back(
link.rosId);
547 chanKey.push_back(
link.robId);
548 chanKey.push_back(
link.tdcId);
549 chanKey.push_back(
link.channelId);
551 localCache->rgBuf.insert(chanKey.begin(), chanKey.end(), entryNum);
554 cellKey.push_back(
link.wheelId);
555 cellKey.push_back(
link.stationId);
556 cellKey.push_back(
link.sectorId);
557 cellKey.push_back(
link.slId);
558 cellKey.push_back(
link.layerId);
559 cellKey.push_back(
link.cellId);
561 localCache->grBuf.insert(cellKey.begin(), cellKey.end(), entryNum);
564 if (
key == robMapKey) {
566 chanKey.push_back(
link.rosId);
567 chanKey.push_back(
link.tdcId);
568 chanKey.push_back(
link.channelId);
569 localCache->rgROB.insert(chanKey.begin(), chanKey.end(), entryNum);
572 cellKey.push_back(
link.cellId);
573 cellKey.push_back(
link.layerId);
574 cellKey.push_back(
link.slId);
575 std::vector<int>* robMLgr;
576 localCache->grROB.find(cellKey.begin(), cellKey.end(), robMLgr);
577 if (robMLgr ==
nullptr) {
578 std::unique_ptr<std::vector<int> > newVector(
new std::vector<int>);
579 robMLgr = newVector.get();
580 localCache->grROB.insert(cellKey.begin(), cellKey.end(),
std::move(newVector));
582 robMLgr->push_back(entryNum);
585 if (
key == rosMapKey) {
587 chanKey.push_back(
link.rosId);
588 chanKey.push_back(
link.robId);
589 localCache->rgROS.insert(chanKey.begin(), chanKey.end(), entryNum);
592 cellKey.push_back(
link.cellId);
593 cellKey.push_back(
link.stationId);
594 std::vector<int>* rosMLgr;
595 localCache->grROS.find(cellKey.begin(), cellKey.end(), rosMLgr);
596 if (rosMLgr ==
nullptr) {
597 std::unique_ptr<std::vector<int> > newVector(
new std::vector<int>);
598 rosMLgr = newVector.get();
599 localCache->grROS.insert(cellKey.begin(), cellKey.end(),
std::move(newVector));
601 rosMLgr->push_back(entryNum);
604 if ((
key < 0x3fffffff) && (
val > 0x3fffffff)) {
606 chanKey.push_back(
link.dduId);
607 chanKey.push_back(
link.rosId);
608 localCache->rgDDU.insert(chanKey.begin(), chanKey.end(), entryNum);
610 int mapId =
link.cellId;
611 std::vector<int>* dduMLgr;
612 std::map<int, std::vector<int>*>
::const_iterator dduEntIter = dduEntries.find(mapId);
613 if (dduEntIter == dduEntries.end())
614 dduEntries.insert(std::pair<
int, std::vector<int>*>(mapId, dduMLgr =
new std::vector<int>));
616 dduMLgr = dduEntIter->second;
617 dduMLgr->push_back(entryNum);
621 if (defaultValue != 0) {
622 for (entryNum = 0; entryNum < entryMax; entryNum++) {
625 if (
key != rosMapKey)
627 int mapId =
link.rosId;
628 int whchkId =
link.wheelId;
629 int secchkId =
link.sectorId;
631 std::vector<int>* dduMLgr;
632 std::map<int, std::vector<int>*>
::const_iterator dduEntIter = dduEntries.find(mapId);
633 if (dduEntIter != dduEntries.end())
634 dduMLgr = dduEntIter->second;
637 std::vector<int>::const_iterator dduIter = dduMLgr->begin();
638 std::vector<int>::const_iterator dduIend = dduMLgr->end();
639 while (dduIter != dduIend) {
640 int ientry = *dduIter++;
642 int wheelId = whchkId;
643 int sectorId = secchkId;
644 if (wheelId == defaultValue)
646 if (sectorId == defaultValue)
649 cellKey.push_back(mapId);
650 cellKey.push_back(wheelId);
651 cellKey.push_back(sectorId);
652 std::vector<int>* dduMLgr =
nullptr;
653 localCache->grDDU.find(cellKey.begin(), cellKey.end(), dduMLgr);
654 if (dduMLgr ==
nullptr) {
655 std::unique_ptr<std::vector<int> > newVector(
new std::vector<int>);
656 dduMLgr = newVector.get();
657 localCache->grDDU.insert(cellKey.begin(), cellKey.end(),
std::move(newVector));
659 dduMLgr->push_back(ientry);
663 std::map<int, std::vector<int>*>
::const_iterator dduEntIter = dduEntries.begin();
664 std::map<int, std::vector<int>*>
::const_iterator dduEntIend = dduEntries.end();
665 while (dduEntIter != dduEntIend) {
666 const std::pair<int, std::vector<int>*>& dduEntry = *dduEntIter++;
667 delete dduEntry.second;
670 localCache->rgBuf.clear();
671 localCache->grBuf.clear();