Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:02:07

0001 /*
0002  *  See header file for a description of this class.
0003  *
0004  *  \author Paolo Ronchese INFN Padova
0005  *
0006  */
0007 
0008 //----------------------
0009 // This Class' Header --
0010 //----------------------
0011 #include "CondFormats/DTObjects/interface/DTReadOutMapping.h"
0012 
0013 //-------------------------------
0014 // Collaborating Class Headers --
0015 //-------------------------------
0016 #include "CondFormats/DTObjects/interface/DTBufferTree.h"
0017 #include "CondFormats/DTObjects/interface/DTReadOutMappingCache.h"
0018 
0019 //---------------
0020 // C++ Headers --
0021 //---------------
0022 #include <iostream>
0023 #include <sstream>
0024 #include <map>
0025 
0026 //-------------------
0027 // Initializations --
0028 //-------------------
0029 
0030 //----------------
0031 // Constructors --
0032 //----------------
0033 DTReadOutMapping::DTReadOutMapping()
0034     : cellMapVersion(" "), robMapVersion(" "), rgBuf(new DTBufferTree<int, int>), grBuf(new DTBufferTree<int, int>) {
0035   readOutChannelDriftTubeMap.reserve(2000);
0036 }
0037 
0038 DTReadOutMapping::DTReadOutMapping(const std::string& cell_map_version, const std::string& rob_map_version)
0039     : cellMapVersion(cell_map_version),
0040       robMapVersion(rob_map_version),
0041       rgBuf(new DTBufferTree<int, int>),
0042       grBuf(new DTBufferTree<int, int>) {
0043   readOutChannelDriftTubeMap.reserve(2000);
0044 }
0045 
0046 DTReadOutGeometryLink::DTReadOutGeometryLink()
0047     : dduId(0),
0048       rosId(0),
0049       robId(0),
0050       tdcId(0),
0051       channelId(0),
0052       wheelId(0),
0053       stationId(0),
0054       sectorId(0),
0055       slId(0),
0056       layerId(0),
0057       cellId(0) {}
0058 
0059 //--------------
0060 // Destructor --
0061 //--------------
0062 DTReadOutMapping::~DTReadOutMapping() {}
0063 
0064 DTReadOutGeometryLink::~DTReadOutGeometryLink() {}
0065 
0066 //--------------
0067 // Operations --
0068 //--------------
0069 int DTReadOutMapping::readOutToGeometry(
0070     int dduId, int rosId, int robId, int tdcId, int channelId, DTWireId& wireId) const {
0071   int wheelId;
0072   int stationId;
0073   int sectorId;
0074   int slId;
0075   int layerId;
0076   int cellId;
0077 
0078   int status =
0079       readOutToGeometry(dduId, rosId, robId, tdcId, channelId, wheelId, stationId, sectorId, slId, layerId, cellId);
0080 
0081   wireId = DTWireId(wheelId, stationId, sectorId, slId, layerId, cellId);
0082   return status;
0083 }
0084 
0085 int DTReadOutMapping::readOutToGeometry(int dduId,
0086                                         int rosId,
0087                                         int robId,
0088                                         int tdcId,
0089                                         int channelId,
0090                                         int& wheelId,
0091                                         int& stationId,
0092                                         int& sectorId,
0093                                         int& slId,
0094                                         int& layerId,
0095                                         int& cellId) const {
0096   wheelId = stationId = sectorId = slId = layerId = cellId = 0;
0097 
0098   if (!atomicCache().isSet()) {
0099     cacheMap();
0100   }
0101 
0102   int defaultValue;
0103   atomicCache()->mType.find(0, defaultValue);
0104   if (defaultValue) {
0105     int searchStatus;
0106     int ientry;
0107 
0108     std::vector<int> dduKey;
0109     dduKey.reserve(5);
0110     dduKey.push_back(dduId);
0111     dduKey.push_back(rosId);
0112     searchStatus = atomicCache()->rgDDU.find(dduKey.begin(), dduKey.end(), ientry);
0113     if (searchStatus)
0114       return searchStatus;
0115     const DTReadOutGeometryLink& lros(readOutChannelDriftTubeMap[ientry]);
0116     wheelId = lros.wheelId;
0117     sectorId = lros.sectorId;
0118 
0119     std::vector<int> rosKey;
0120     rosKey.reserve(5);
0121     rosKey.push_back(lros.cellId);
0122     rosKey.push_back(robId);
0123     searchStatus = atomicCache()->rgROS.find(rosKey.begin(), rosKey.end(), ientry);
0124     if (searchStatus)
0125       return searchStatus;
0126     const DTReadOutGeometryLink& lrob(readOutChannelDriftTubeMap[ientry]);
0127     if (lrob.wheelId != defaultValue)
0128       wheelId = lrob.wheelId;
0129     stationId = lrob.stationId;
0130     if (lrob.sectorId != defaultValue)
0131       sectorId = lrob.sectorId;
0132 
0133     std::vector<int> robKey;
0134     robKey.reserve(5);
0135     robKey.push_back(lrob.cellId);
0136     robKey.push_back(tdcId);
0137     robKey.push_back(channelId);
0138     searchStatus = atomicCache()->rgROB.find(robKey.begin(), robKey.end(), ientry);
0139     if (searchStatus)
0140       return searchStatus;
0141     const DTReadOutGeometryLink& ltdc(readOutChannelDriftTubeMap[ientry]);
0142     slId = ltdc.slId;
0143     layerId = ltdc.layerId;
0144     cellId = ltdc.cellId;
0145     return 0;
0146   }
0147 
0148   std::vector<int> chanKey;
0149   chanKey.reserve(5);
0150   chanKey.push_back(dduId);
0151   chanKey.push_back(rosId);
0152   chanKey.push_back(robId);
0153   chanKey.push_back(tdcId);
0154   chanKey.push_back(channelId);
0155   int ientry;
0156   int searchStatus = atomicCache()->rgBuf.find(chanKey.begin(), chanKey.end(), ientry);
0157   if (!searchStatus) {
0158     const DTReadOutGeometryLink& link(readOutChannelDriftTubeMap[ientry]);
0159     wheelId = link.wheelId;
0160     stationId = link.stationId;
0161     sectorId = link.sectorId;
0162     slId = link.slId;
0163     layerId = link.layerId;
0164     cellId = link.cellId;
0165   }
0166 
0167   return searchStatus;
0168 }
0169 
0170 int DTReadOutMapping::geometryToReadOut(
0171     const DTWireId& wireId, int& dduId, int& rosId, int& robId, int& tdcId, int& channelId) const {
0172   return geometryToReadOut(wireId.wheel(),
0173                            wireId.station(),
0174                            wireId.sector(),
0175                            wireId.superLayer(),
0176                            wireId.layer(),
0177                            wireId.wire(),
0178                            dduId,
0179                            rosId,
0180                            robId,
0181                            tdcId,
0182                            channelId);
0183 }
0184 
0185 int DTReadOutMapping::geometryToReadOut(int wheelId,
0186                                         int stationId,
0187                                         int sectorId,
0188                                         int slId,
0189                                         int layerId,
0190                                         int cellId,
0191                                         int& dduId,
0192                                         int& rosId,
0193                                         int& robId,
0194                                         int& tdcId,
0195                                         int& channelId) const {
0196   dduId = rosId = robId = tdcId = channelId = 0;
0197 
0198   if (!atomicCache().isSet()) {
0199     cacheMap();
0200   }
0201 
0202   int defaultValue;
0203   atomicCache()->mType.find(0, defaultValue);
0204   if (defaultValue) {
0205     int searchStatus;
0206     int mapId = 0;
0207     std::vector<int> const* robMLgr;
0208     std::vector<int> const* rosMLgr;
0209     std::vector<int> const* dduMLgr;
0210 
0211     std::vector<int> cellKey;
0212     cellKey.reserve(6);
0213     cellKey.push_back(cellId);
0214     cellKey.push_back(layerId);
0215     cellKey.push_back(slId);
0216     std::vector<int> stdcKey = cellKey;
0217     searchStatus = atomicCache()->grROB.find(cellKey.begin(), cellKey.end(), robMLgr);
0218     if (searchStatus)
0219       return searchStatus;
0220     if (robMLgr->empty())
0221       return 1;
0222     std::vector<int>::const_iterator tdc_iter = robMLgr->begin();
0223     std::vector<int>::const_iterator tdc_iend = robMLgr->end();
0224     while (tdc_iter != tdc_iend) {
0225       const DTReadOutGeometryLink& ltdc(readOutChannelDriftTubeMap[*tdc_iter++]);
0226       channelId = ltdc.channelId;
0227       tdcId = ltdc.tdcId;
0228       mapId = ltdc.rosId;
0229       cellKey.clear();
0230       cellKey.push_back(mapId);
0231       cellKey.push_back(stationId);
0232       std::vector<int> srosKey = cellKey;
0233       searchStatus = atomicCache()->grROS.find(cellKey.begin(), cellKey.end(), rosMLgr);
0234       if (searchStatus)
0235         continue;
0236       if (rosMLgr->empty())
0237         continue;
0238       std::vector<int>::const_iterator ros_iter = rosMLgr->begin();
0239       std::vector<int>::const_iterator ros_iend = rosMLgr->end();
0240       while (ros_iter != ros_iend) {
0241         const DTReadOutGeometryLink& lros(readOutChannelDriftTubeMap[*ros_iter++]);
0242         int secCk = lros.sectorId;
0243         int wheCk = lros.wheelId;
0244         if ((secCk != defaultValue) && (secCk != sectorId))
0245           continue;
0246         if ((wheCk != defaultValue) && (wheCk != wheelId))
0247           continue;
0248         robId = lros.robId;
0249         mapId = lros.rosId;
0250         cellKey.clear();
0251         cellKey.push_back(mapId);
0252         cellKey.push_back(wheelId);
0253         cellKey.push_back(sectorId);
0254         std::vector<int> sdduKey = cellKey;
0255         searchStatus = atomicCache()->grDDU.find(cellKey.begin(), cellKey.end(), dduMLgr);
0256         if (searchStatus)
0257           continue;
0258         if (dduMLgr->empty())
0259           continue;
0260         if (searchStatus)
0261           return searchStatus;
0262         if (dduMLgr->empty())
0263           return 1;
0264         std::vector<int>::const_iterator ddu_iter = dduMLgr->begin();
0265         std::vector<int>::const_iterator ddu_iend = dduMLgr->end();
0266         while (ddu_iter != ddu_iend) {
0267           const DTReadOutGeometryLink& lddu(readOutChannelDriftTubeMap[*ddu_iter++]);
0268           if (((sectorId == secCk) || (sectorId == lddu.sectorId)) &&
0269               ((wheelId == wheCk) || (wheelId == lddu.wheelId))) {
0270             rosId = lddu.rosId;
0271             dduId = lddu.dduId;
0272             return 0;
0273           }
0274         }
0275       }
0276     }
0277 
0278     return 1;
0279   }
0280 
0281   std::vector<int> cellKey;
0282   cellKey.reserve(6);
0283   cellKey.push_back(wheelId);
0284   cellKey.push_back(stationId);
0285   cellKey.push_back(sectorId);
0286   cellKey.push_back(slId);
0287   cellKey.push_back(layerId);
0288   cellKey.push_back(cellId);
0289   int ientry;
0290   int searchStatus = atomicCache()->grBuf.find(cellKey.begin(), cellKey.end(), ientry);
0291   if (!searchStatus) {
0292     const DTReadOutGeometryLink& link(readOutChannelDriftTubeMap[ientry]);
0293     dduId = link.dduId;
0294     rosId = link.rosId;
0295     robId = link.robId;
0296     tdcId = link.tdcId;
0297     channelId = link.channelId;
0298   }
0299 
0300   return searchStatus;
0301 }
0302 
0303 DTReadOutMapping::type DTReadOutMapping::mapType() const {
0304   if (!atomicCache().isSet()) {
0305     cacheMap();
0306   }
0307 
0308   int defaultValue;
0309   atomicCache()->mType.find(0, defaultValue);
0310   if (defaultValue)
0311     return compact;
0312   else
0313     return plain;
0314 }
0315 
0316 const std::string& DTReadOutMapping::mapCellTdc() const { return cellMapVersion; }
0317 
0318 std::string& DTReadOutMapping::mapCellTdc() { return cellMapVersion; }
0319 
0320 const std::string& DTReadOutMapping::mapRobRos() const { return robMapVersion; }
0321 
0322 std::string& DTReadOutMapping::mapRobRos() { return robMapVersion; }
0323 
0324 void DTReadOutMapping::clear() {
0325   atomicCache().reset();
0326   rgBuf->clear();
0327   grBuf->clear();
0328   readOutChannelDriftTubeMap.clear();
0329   return;
0330 }
0331 
0332 int DTReadOutMapping::insertReadOutGeometryLink(int dduId,
0333                                                 int rosId,
0334                                                 int robId,
0335                                                 int tdcId,
0336                                                 int channelId,
0337                                                 int wheelId,
0338                                                 int stationId,
0339                                                 int sectorId,
0340                                                 int slId,
0341                                                 int layerId,
0342                                                 int cellId) {
0343   DTReadOutGeometryLink link;
0344   link.dduId = dduId;
0345   link.rosId = rosId;
0346   link.robId = robId;
0347   link.tdcId = tdcId;
0348   link.channelId = channelId;
0349   link.wheelId = wheelId;
0350   link.stationId = stationId;
0351   link.sectorId = sectorId;
0352   link.slId = slId;
0353   link.layerId = layerId;
0354   link.cellId = cellId;
0355 
0356   int ientry = readOutChannelDriftTubeMap.size();
0357   readOutChannelDriftTubeMap.push_back(link);
0358 
0359   DTBufferTree<int, int>* pgrBuf;
0360   DTBufferTree<int, int>* prgBuf;
0361 
0362   if (atomicCache().isSet()) {
0363     pgrBuf = &atomicCache()->grBuf;
0364     prgBuf = &atomicCache()->rgBuf;
0365   } else {
0366     pgrBuf = grBuf.get();
0367     prgBuf = rgBuf.get();
0368   }
0369 
0370   std::vector<int> cellKey;
0371   cellKey.reserve(6);
0372   cellKey.push_back(wheelId);
0373   cellKey.push_back(stationId);
0374   cellKey.push_back(sectorId);
0375   cellKey.push_back(slId);
0376   cellKey.push_back(layerId);
0377   cellKey.push_back(cellId);
0378   int grStatus = pgrBuf->insert(cellKey.begin(), cellKey.end(), ientry);
0379 
0380   std::vector<int> chanKey;
0381   chanKey.reserve(5);
0382   chanKey.push_back(dduId);
0383   chanKey.push_back(rosId);
0384   chanKey.push_back(robId);
0385   chanKey.push_back(tdcId);
0386   chanKey.push_back(channelId);
0387   int rgStatus = prgBuf->insert(chanKey.begin(), chanKey.end(), ientry);
0388 
0389   if (grStatus || rgStatus)
0390     return 1;
0391   else
0392     return 0;
0393 }
0394 
0395 DTReadOutMapping::const_iterator DTReadOutMapping::begin() const { return readOutChannelDriftTubeMap.begin(); }
0396 
0397 DTReadOutMapping::const_iterator DTReadOutMapping::end() const { return readOutChannelDriftTubeMap.end(); }
0398 
0399 const DTReadOutMapping* DTReadOutMapping::fullMap() const {
0400   if (mapType() == plain)
0401     return this;
0402   return expandMap(*this);
0403 }
0404 
0405 // The code for this function was copied verbatim from
0406 // CondCore/DTPlugins/src/DTCompactMapPluginHandler.c
0407 DTReadOutMapping* DTReadOutMapping::expandMap(const DTReadOutMapping& compMap) {
0408   std::vector<DTReadOutGeometryLink> entryList;
0409   DTReadOutMapping::const_iterator compIter = compMap.begin();
0410   DTReadOutMapping::const_iterator compIend = compMap.end();
0411   while (compIter != compIend)
0412     entryList.push_back(*compIter++);
0413 
0414   std::string rosMap = "expand_";
0415   rosMap += compMap.mapRobRos();
0416   std::string tdcMap = "expand_";
0417   tdcMap += compMap.mapCellTdc();
0418   DTReadOutMapping* fullMap = new DTReadOutMapping(tdcMap, rosMap);
0419   int ddu;
0420   int ros;
0421   int rch;
0422   int tdc;
0423   int tch;
0424   int whe;
0425   int sta;
0426   int sec;
0427   int rob;
0428   int qua;
0429   int lay;
0430   int cel;
0431   int mt1;
0432   int mi1;
0433   int mt2;
0434   int mi2;
0435   int def;
0436   int wha;
0437   int sea;
0438   std::vector<DTReadOutGeometryLink>::const_iterator iter = entryList.begin();
0439   std::vector<DTReadOutGeometryLink>::const_iterator iend = entryList.end();
0440   std::vector<DTReadOutGeometryLink>::const_iterator iros = entryList.end();
0441   std::vector<DTReadOutGeometryLink>::const_iterator irob = entryList.end();
0442   while (iter != iend) {
0443     const DTReadOutGeometryLink& rosEntry(*iter++);
0444     if (rosEntry.dduId > 0x3fffffff)
0445       continue;
0446     ddu = rosEntry.dduId;
0447     ros = rosEntry.rosId;
0448     whe = rosEntry.wheelId;
0449     def = rosEntry.stationId;
0450     sec = rosEntry.sectorId;
0451     rob = rosEntry.slId;
0452     mt1 = rosEntry.layerId;
0453     mi1 = rosEntry.cellId;
0454     iros = entryList.begin();
0455     while (iros != iend) {
0456       wha = whe;
0457       sea = sec;
0458       const DTReadOutGeometryLink& rchEntry(*iros++);
0459       if ((rchEntry.dduId != mt1) || (rchEntry.rosId != mi1))
0460         continue;
0461       rch = rchEntry.robId;
0462       if (rchEntry.wheelId != def)
0463         wha = rchEntry.wheelId;
0464       sta = rchEntry.stationId;
0465       if (rchEntry.sectorId != def)
0466         sea = rchEntry.sectorId;
0467       rob = rchEntry.slId;
0468       mt2 = rchEntry.layerId;
0469       mi2 = rchEntry.cellId;
0470       irob = entryList.begin();
0471       while (irob != iend) {
0472         const DTReadOutGeometryLink& robEntry(*irob++);
0473         if ((robEntry.dduId != mt2) || (robEntry.rosId != mi2))
0474           continue;
0475         if (robEntry.robId != rob) {
0476           std::cout << "ROB mismatch " << rob << " " << robEntry.robId << std::endl;
0477         }
0478         tdc = robEntry.tdcId;
0479         tch = robEntry.channelId;
0480         qua = robEntry.slId;
0481         lay = robEntry.layerId;
0482         cel = robEntry.cellId;
0483         fullMap->insertReadOutGeometryLink(ddu, ros, rch, tdc, tch, wha, sta, sea, qua, lay, cel);
0484       }
0485     }
0486   }
0487   return fullMap;
0488 }
0489 
0490 std::string DTReadOutMapping::mapNameGR() const {
0491   std::stringstream name;
0492   name << cellMapVersion << "_" << robMapVersion << "_map_GR" << this;
0493   return name.str();
0494 }
0495 
0496 std::string DTReadOutMapping::mapNameRG() const {
0497   std::stringstream name;
0498   name << cellMapVersion << "_" << robMapVersion << "_map_RG" << this;
0499   return name.str();
0500 }
0501 
0502 void DTReadOutMapping::cacheMap() const {
0503   std::unique_ptr<DTReadOutMappingCache> localCache(new DTReadOutMappingCache);
0504 
0505   localCache->mType.insert(0, 0);
0506 
0507   int entryNum = 0;
0508   int entryMax = readOutChannelDriftTubeMap.size();
0509   std::vector<int> cellKey;
0510   cellKey.reserve(6);
0511   std::vector<int> chanKey;
0512   chanKey.reserve(5);
0513   int defaultValue = 0;
0514   int key;
0515   int val;
0516   int rosMapKey = 0;
0517   int robMapKey = 0;
0518   std::map<int, std::vector<int>*> dduEntries;
0519   for (entryNum = 0; entryNum < entryMax; entryNum++) {
0520     const DTReadOutGeometryLink& link(readOutChannelDriftTubeMap[entryNum]);
0521 
0522     key = link.dduId;
0523     val = link.stationId;
0524     if (key > 0x3fffffff) {
0525       if (link.tdcId > 0x3fffffff) {
0526         localCache->mType.insert(0, defaultValue = link.tdcId);
0527         rosMapKey = key;
0528       } else {
0529         localCache->mType.insert(0, defaultValue = link.wheelId);
0530         robMapKey = key;
0531       }
0532     }
0533 
0534     if (defaultValue == 0) {
0535       chanKey.clear();
0536       chanKey.push_back(link.dduId);
0537       chanKey.push_back(link.rosId);
0538       chanKey.push_back(link.robId);
0539       chanKey.push_back(link.tdcId);
0540       chanKey.push_back(link.channelId);
0541 
0542       localCache->rgBuf.insert(chanKey.begin(), chanKey.end(), entryNum);
0543 
0544       cellKey.clear();
0545       cellKey.push_back(link.wheelId);
0546       cellKey.push_back(link.stationId);
0547       cellKey.push_back(link.sectorId);
0548       cellKey.push_back(link.slId);
0549       cellKey.push_back(link.layerId);
0550       cellKey.push_back(link.cellId);
0551 
0552       localCache->grBuf.insert(cellKey.begin(), cellKey.end(), entryNum);
0553     }
0554 
0555     if (key == robMapKey) {
0556       chanKey.clear();
0557       chanKey.push_back(link.rosId);
0558       chanKey.push_back(link.tdcId);
0559       chanKey.push_back(link.channelId);
0560       localCache->rgROB.insert(chanKey.begin(), chanKey.end(), entryNum);
0561 
0562       cellKey.clear();
0563       cellKey.push_back(link.cellId);
0564       cellKey.push_back(link.layerId);
0565       cellKey.push_back(link.slId);
0566       std::vector<int>* robMLgr;
0567       localCache->grROB.find(cellKey.begin(), cellKey.end(), robMLgr);
0568       if (robMLgr == nullptr) {
0569         std::unique_ptr<std::vector<int> > newVector(new std::vector<int>);
0570         robMLgr = newVector.get();
0571         localCache->grROB.insert(cellKey.begin(), cellKey.end(), std::move(newVector));
0572       }
0573       robMLgr->push_back(entryNum);
0574     }
0575 
0576     if (key == rosMapKey) {
0577       chanKey.clear();
0578       chanKey.push_back(link.rosId);
0579       chanKey.push_back(link.robId);
0580       localCache->rgROS.insert(chanKey.begin(), chanKey.end(), entryNum);
0581 
0582       cellKey.clear();
0583       cellKey.push_back(link.cellId);
0584       cellKey.push_back(link.stationId);
0585       std::vector<int>* rosMLgr;
0586       localCache->grROS.find(cellKey.begin(), cellKey.end(), rosMLgr);
0587       if (rosMLgr == nullptr) {
0588         std::unique_ptr<std::vector<int> > newVector(new std::vector<int>);
0589         rosMLgr = newVector.get();
0590         localCache->grROS.insert(cellKey.begin(), cellKey.end(), std::move(newVector));
0591       }
0592       rosMLgr->push_back(entryNum);
0593     }
0594 
0595     if ((key < 0x3fffffff) && (val > 0x3fffffff)) {
0596       chanKey.clear();
0597       chanKey.push_back(link.dduId);
0598       chanKey.push_back(link.rosId);
0599       localCache->rgDDU.insert(chanKey.begin(), chanKey.end(), entryNum);
0600 
0601       int mapId = link.cellId;
0602       std::vector<int>* dduMLgr;
0603       std::map<int, std::vector<int>*>::const_iterator dduEntIter = dduEntries.find(mapId);
0604       if (dduEntIter == dduEntries.end())
0605         dduEntries.insert(std::pair<int, std::vector<int>*>(mapId, dduMLgr = new std::vector<int>));
0606       else
0607         dduMLgr = dduEntIter->second;
0608       dduMLgr->push_back(entryNum);
0609     }
0610   }
0611 
0612   if (defaultValue != 0) {
0613     for (entryNum = 0; entryNum < entryMax; entryNum++) {
0614       const DTReadOutGeometryLink& link(readOutChannelDriftTubeMap[entryNum]);
0615       key = link.dduId;
0616       if (key != rosMapKey)
0617         continue;
0618       int mapId = link.rosId;
0619       int whchkId = link.wheelId;
0620       int secchkId = link.sectorId;
0621 
0622       std::vector<int>* dduMLgr;
0623       std::map<int, std::vector<int>*>::const_iterator dduEntIter = dduEntries.find(mapId);
0624       if (dduEntIter != dduEntries.end())
0625         dduMLgr = dduEntIter->second;
0626       else
0627         continue;
0628       std::vector<int>::const_iterator dduIter = dduMLgr->begin();
0629       std::vector<int>::const_iterator dduIend = dduMLgr->end();
0630       while (dduIter != dduIend) {
0631         int ientry = *dduIter++;
0632         const DTReadOutGeometryLink& lros(readOutChannelDriftTubeMap[ientry]);
0633         int wheelId = whchkId;
0634         int sectorId = secchkId;
0635         if (wheelId == defaultValue)
0636           wheelId = lros.wheelId;
0637         if (sectorId == defaultValue)
0638           sectorId = lros.sectorId;
0639         cellKey.clear();
0640         cellKey.push_back(mapId);
0641         cellKey.push_back(wheelId);
0642         cellKey.push_back(sectorId);
0643         std::vector<int>* dduMLgr = nullptr;
0644         localCache->grDDU.find(cellKey.begin(), cellKey.end(), dduMLgr);
0645         if (dduMLgr == nullptr) {
0646           std::unique_ptr<std::vector<int> > newVector(new std::vector<int>);
0647           dduMLgr = newVector.get();
0648           localCache->grDDU.insert(cellKey.begin(), cellKey.end(), std::move(newVector));
0649         }
0650         dduMLgr->push_back(ientry);
0651       }
0652     }
0653 
0654     std::map<int, std::vector<int>*>::const_iterator dduEntIter = dduEntries.begin();
0655     std::map<int, std::vector<int>*>::const_iterator dduEntIend = dduEntries.end();
0656     while (dduEntIter != dduEntIend) {
0657       const std::pair<int, std::vector<int>*>& dduEntry = *dduEntIter++;
0658       delete dduEntry.second;
0659     }
0660 
0661     localCache->rgBuf.clear();
0662     localCache->grBuf.clear();
0663   }
0664 
0665   atomicCache().set(std::move(localCache));
0666 
0667   return;
0668 }