Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:51:03

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 loop1 = 0;
0206     int loop2 = 0;
0207     int loop3 = 0;
0208     int loop0 = 0;
0209 
0210     int searchStatus;
0211     int mapId = 0;
0212     std::vector<int> const* robMLgr;
0213     std::vector<int> const* rosMLgr;
0214     std::vector<int> const* dduMLgr;
0215 
0216     std::vector<int> cellKey;
0217     cellKey.reserve(6);
0218     cellKey.push_back(cellId);
0219     cellKey.push_back(layerId);
0220     cellKey.push_back(slId);
0221     std::vector<int> stdcKey = cellKey;
0222     searchStatus = atomicCache()->grROB.find(cellKey.begin(), cellKey.end(), robMLgr);
0223     if (searchStatus)
0224       return searchStatus;
0225     if (!(robMLgr->size()))
0226       return 1;
0227     std::vector<int>::const_iterator tdc_iter = robMLgr->begin();
0228     std::vector<int>::const_iterator tdc_iend = robMLgr->end();
0229     while (tdc_iter != tdc_iend) {
0230       loop1++;
0231       const DTReadOutGeometryLink& ltdc(readOutChannelDriftTubeMap[*tdc_iter++]);
0232       channelId = ltdc.channelId;
0233       tdcId = ltdc.tdcId;
0234       mapId = ltdc.rosId;
0235       cellKey.clear();
0236       cellKey.push_back(mapId);
0237       cellKey.push_back(stationId);
0238       std::vector<int> srosKey = cellKey;
0239       searchStatus = atomicCache()->grROS.find(cellKey.begin(), cellKey.end(), rosMLgr);
0240       if (searchStatus)
0241         continue;
0242       if (!(rosMLgr->size()))
0243         continue;
0244       std::vector<int>::const_iterator ros_iter = rosMLgr->begin();
0245       std::vector<int>::const_iterator ros_iend = rosMLgr->end();
0246       while (ros_iter != ros_iend) {
0247         loop2++;
0248         const DTReadOutGeometryLink& lros(readOutChannelDriftTubeMap[*ros_iter++]);
0249         int secCk = lros.sectorId;
0250         int wheCk = lros.wheelId;
0251         if ((secCk != defaultValue) && (secCk != sectorId))
0252           continue;
0253         if ((wheCk != defaultValue) && (wheCk != wheelId))
0254           continue;
0255         robId = lros.robId;
0256         mapId = lros.rosId;
0257         cellKey.clear();
0258         cellKey.push_back(mapId);
0259         cellKey.push_back(wheelId);
0260         cellKey.push_back(sectorId);
0261         std::vector<int> sdduKey = cellKey;
0262         searchStatus = atomicCache()->grDDU.find(cellKey.begin(), cellKey.end(), dduMLgr);
0263         if (searchStatus)
0264           continue;
0265         if (!(dduMLgr->size()))
0266           continue;
0267         if (searchStatus)
0268           return searchStatus;
0269         if (!(dduMLgr->size()))
0270           return 1;
0271         loop0++;
0272         std::vector<int>::const_iterator ddu_iter = dduMLgr->begin();
0273         std::vector<int>::const_iterator ddu_iend = dduMLgr->end();
0274         while (ddu_iter != ddu_iend) {
0275           loop3++;
0276           const DTReadOutGeometryLink& lddu(readOutChannelDriftTubeMap[*ddu_iter++]);
0277           if (((sectorId == secCk) || (sectorId == lddu.sectorId)) &&
0278               ((wheelId == wheCk) || (wheelId == lddu.wheelId))) {
0279             rosId = lddu.rosId;
0280             dduId = lddu.dduId;
0281             return 0;
0282           }
0283         }
0284       }
0285     }
0286 
0287     return 1;
0288   }
0289 
0290   std::vector<int> cellKey;
0291   cellKey.reserve(6);
0292   cellKey.push_back(wheelId);
0293   cellKey.push_back(stationId);
0294   cellKey.push_back(sectorId);
0295   cellKey.push_back(slId);
0296   cellKey.push_back(layerId);
0297   cellKey.push_back(cellId);
0298   int ientry;
0299   int searchStatus = atomicCache()->grBuf.find(cellKey.begin(), cellKey.end(), ientry);
0300   if (!searchStatus) {
0301     const DTReadOutGeometryLink& link(readOutChannelDriftTubeMap[ientry]);
0302     dduId = link.dduId;
0303     rosId = link.rosId;
0304     robId = link.robId;
0305     tdcId = link.tdcId;
0306     channelId = link.channelId;
0307   }
0308 
0309   return searchStatus;
0310 }
0311 
0312 DTReadOutMapping::type DTReadOutMapping::mapType() const {
0313   if (!atomicCache().isSet()) {
0314     cacheMap();
0315   }
0316 
0317   int defaultValue;
0318   atomicCache()->mType.find(0, defaultValue);
0319   if (defaultValue)
0320     return compact;
0321   else
0322     return plain;
0323 }
0324 
0325 const std::string& DTReadOutMapping::mapCellTdc() const { return cellMapVersion; }
0326 
0327 std::string& DTReadOutMapping::mapCellTdc() { return cellMapVersion; }
0328 
0329 const std::string& DTReadOutMapping::mapRobRos() const { return robMapVersion; }
0330 
0331 std::string& DTReadOutMapping::mapRobRos() { return robMapVersion; }
0332 
0333 void DTReadOutMapping::clear() {
0334   atomicCache().reset();
0335   rgBuf->clear();
0336   grBuf->clear();
0337   readOutChannelDriftTubeMap.clear();
0338   return;
0339 }
0340 
0341 int DTReadOutMapping::insertReadOutGeometryLink(int dduId,
0342                                                 int rosId,
0343                                                 int robId,
0344                                                 int tdcId,
0345                                                 int channelId,
0346                                                 int wheelId,
0347                                                 int stationId,
0348                                                 int sectorId,
0349                                                 int slId,
0350                                                 int layerId,
0351                                                 int cellId) {
0352   DTReadOutGeometryLink link;
0353   link.dduId = dduId;
0354   link.rosId = rosId;
0355   link.robId = robId;
0356   link.tdcId = tdcId;
0357   link.channelId = channelId;
0358   link.wheelId = wheelId;
0359   link.stationId = stationId;
0360   link.sectorId = sectorId;
0361   link.slId = slId;
0362   link.layerId = layerId;
0363   link.cellId = cellId;
0364 
0365   int ientry = readOutChannelDriftTubeMap.size();
0366   readOutChannelDriftTubeMap.push_back(link);
0367 
0368   DTBufferTree<int, int>* pgrBuf;
0369   DTBufferTree<int, int>* prgBuf;
0370 
0371   if (atomicCache().isSet()) {
0372     pgrBuf = &atomicCache()->grBuf;
0373     prgBuf = &atomicCache()->rgBuf;
0374   } else {
0375     pgrBuf = grBuf.get();
0376     prgBuf = rgBuf.get();
0377   }
0378 
0379   std::vector<int> cellKey;
0380   cellKey.reserve(6);
0381   cellKey.push_back(wheelId);
0382   cellKey.push_back(stationId);
0383   cellKey.push_back(sectorId);
0384   cellKey.push_back(slId);
0385   cellKey.push_back(layerId);
0386   cellKey.push_back(cellId);
0387   int grStatus = pgrBuf->insert(cellKey.begin(), cellKey.end(), ientry);
0388 
0389   std::vector<int> chanKey;
0390   chanKey.reserve(5);
0391   chanKey.push_back(dduId);
0392   chanKey.push_back(rosId);
0393   chanKey.push_back(robId);
0394   chanKey.push_back(tdcId);
0395   chanKey.push_back(channelId);
0396   int rgStatus = prgBuf->insert(chanKey.begin(), chanKey.end(), ientry);
0397 
0398   if (grStatus || rgStatus)
0399     return 1;
0400   else
0401     return 0;
0402 }
0403 
0404 DTReadOutMapping::const_iterator DTReadOutMapping::begin() const { return readOutChannelDriftTubeMap.begin(); }
0405 
0406 DTReadOutMapping::const_iterator DTReadOutMapping::end() const { return readOutChannelDriftTubeMap.end(); }
0407 
0408 const DTReadOutMapping* DTReadOutMapping::fullMap() const {
0409   if (mapType() == plain)
0410     return this;
0411   return expandMap(*this);
0412 }
0413 
0414 // The code for this function was copied verbatim from
0415 // CondCore/DTPlugins/src/DTCompactMapPluginHandler.c
0416 DTReadOutMapping* DTReadOutMapping::expandMap(const DTReadOutMapping& compMap) {
0417   std::vector<DTReadOutGeometryLink> entryList;
0418   DTReadOutMapping::const_iterator compIter = compMap.begin();
0419   DTReadOutMapping::const_iterator compIend = compMap.end();
0420   while (compIter != compIend)
0421     entryList.push_back(*compIter++);
0422 
0423   std::string rosMap = "expand_";
0424   rosMap += compMap.mapRobRos();
0425   std::string tdcMap = "expand_";
0426   tdcMap += compMap.mapCellTdc();
0427   DTReadOutMapping* fullMap = new DTReadOutMapping(tdcMap, rosMap);
0428   int ddu;
0429   int ros;
0430   int rch;
0431   int tdc;
0432   int tch;
0433   int whe;
0434   int sta;
0435   int sec;
0436   int rob;
0437   int qua;
0438   int lay;
0439   int cel;
0440   int mt1;
0441   int mi1;
0442   int mt2;
0443   int mi2;
0444   int def;
0445   int wha;
0446   int sea;
0447   std::vector<DTReadOutGeometryLink>::const_iterator iter = entryList.begin();
0448   std::vector<DTReadOutGeometryLink>::const_iterator iend = entryList.end();
0449   std::vector<DTReadOutGeometryLink>::const_iterator iros = entryList.end();
0450   std::vector<DTReadOutGeometryLink>::const_iterator irob = entryList.end();
0451   while (iter != iend) {
0452     const DTReadOutGeometryLink& rosEntry(*iter++);
0453     if (rosEntry.dduId > 0x3fffffff)
0454       continue;
0455     ddu = rosEntry.dduId;
0456     ros = rosEntry.rosId;
0457     whe = rosEntry.wheelId;
0458     def = rosEntry.stationId;
0459     sec = rosEntry.sectorId;
0460     rob = rosEntry.slId;
0461     mt1 = rosEntry.layerId;
0462     mi1 = rosEntry.cellId;
0463     iros = entryList.begin();
0464     while (iros != iend) {
0465       wha = whe;
0466       sea = sec;
0467       const DTReadOutGeometryLink& rchEntry(*iros++);
0468       if ((rchEntry.dduId != mt1) || (rchEntry.rosId != mi1))
0469         continue;
0470       rch = rchEntry.robId;
0471       if (rchEntry.wheelId != def)
0472         wha = rchEntry.wheelId;
0473       sta = rchEntry.stationId;
0474       if (rchEntry.sectorId != def)
0475         sea = rchEntry.sectorId;
0476       rob = rchEntry.slId;
0477       mt2 = rchEntry.layerId;
0478       mi2 = rchEntry.cellId;
0479       irob = entryList.begin();
0480       while (irob != iend) {
0481         const DTReadOutGeometryLink& robEntry(*irob++);
0482         if ((robEntry.dduId != mt2) || (robEntry.rosId != mi2))
0483           continue;
0484         if (robEntry.robId != rob) {
0485           std::cout << "ROB mismatch " << rob << " " << robEntry.robId << std::endl;
0486         }
0487         tdc = robEntry.tdcId;
0488         tch = robEntry.channelId;
0489         qua = robEntry.slId;
0490         lay = robEntry.layerId;
0491         cel = robEntry.cellId;
0492         fullMap->insertReadOutGeometryLink(ddu, ros, rch, tdc, tch, wha, sta, sea, qua, lay, cel);
0493       }
0494     }
0495   }
0496   return fullMap;
0497 }
0498 
0499 std::string DTReadOutMapping::mapNameGR() const {
0500   std::stringstream name;
0501   name << cellMapVersion << "_" << robMapVersion << "_map_GR" << this;
0502   return name.str();
0503 }
0504 
0505 std::string DTReadOutMapping::mapNameRG() const {
0506   std::stringstream name;
0507   name << cellMapVersion << "_" << robMapVersion << "_map_RG" << this;
0508   return name.str();
0509 }
0510 
0511 void DTReadOutMapping::cacheMap() const {
0512   std::unique_ptr<DTReadOutMappingCache> localCache(new DTReadOutMappingCache);
0513 
0514   localCache->mType.insert(0, 0);
0515 
0516   int entryNum = 0;
0517   int entryMax = readOutChannelDriftTubeMap.size();
0518   std::vector<int> cellKey;
0519   cellKey.reserve(6);
0520   std::vector<int> chanKey;
0521   chanKey.reserve(5);
0522   int defaultValue = 0;
0523   int key;
0524   int val;
0525   int rosMapKey = 0;
0526   int robMapKey = 0;
0527   std::map<int, std::vector<int>*> dduEntries;
0528   for (entryNum = 0; entryNum < entryMax; entryNum++) {
0529     const DTReadOutGeometryLink& link(readOutChannelDriftTubeMap[entryNum]);
0530 
0531     key = link.dduId;
0532     val = link.stationId;
0533     if (key > 0x3fffffff) {
0534       if (link.tdcId > 0x3fffffff) {
0535         localCache->mType.insert(0, defaultValue = link.tdcId);
0536         rosMapKey = key;
0537       } else {
0538         localCache->mType.insert(0, defaultValue = link.wheelId);
0539         robMapKey = key;
0540       }
0541     }
0542 
0543     if (defaultValue == 0) {
0544       chanKey.clear();
0545       chanKey.push_back(link.dduId);
0546       chanKey.push_back(link.rosId);
0547       chanKey.push_back(link.robId);
0548       chanKey.push_back(link.tdcId);
0549       chanKey.push_back(link.channelId);
0550 
0551       localCache->rgBuf.insert(chanKey.begin(), chanKey.end(), entryNum);
0552 
0553       cellKey.clear();
0554       cellKey.push_back(link.wheelId);
0555       cellKey.push_back(link.stationId);
0556       cellKey.push_back(link.sectorId);
0557       cellKey.push_back(link.slId);
0558       cellKey.push_back(link.layerId);
0559       cellKey.push_back(link.cellId);
0560 
0561       localCache->grBuf.insert(cellKey.begin(), cellKey.end(), entryNum);
0562     }
0563 
0564     if (key == robMapKey) {
0565       chanKey.clear();
0566       chanKey.push_back(link.rosId);
0567       chanKey.push_back(link.tdcId);
0568       chanKey.push_back(link.channelId);
0569       localCache->rgROB.insert(chanKey.begin(), chanKey.end(), entryNum);
0570 
0571       cellKey.clear();
0572       cellKey.push_back(link.cellId);
0573       cellKey.push_back(link.layerId);
0574       cellKey.push_back(link.slId);
0575       std::vector<int>* robMLgr;
0576       localCache->grROB.find(cellKey.begin(), cellKey.end(), robMLgr);
0577       if (robMLgr == nullptr) {
0578         std::unique_ptr<std::vector<int> > newVector(new std::vector<int>);
0579         robMLgr = newVector.get();
0580         localCache->grROB.insert(cellKey.begin(), cellKey.end(), std::move(newVector));
0581       }
0582       robMLgr->push_back(entryNum);
0583     }
0584 
0585     if (key == rosMapKey) {
0586       chanKey.clear();
0587       chanKey.push_back(link.rosId);
0588       chanKey.push_back(link.robId);
0589       localCache->rgROS.insert(chanKey.begin(), chanKey.end(), entryNum);
0590 
0591       cellKey.clear();
0592       cellKey.push_back(link.cellId);
0593       cellKey.push_back(link.stationId);
0594       std::vector<int>* rosMLgr;
0595       localCache->grROS.find(cellKey.begin(), cellKey.end(), rosMLgr);
0596       if (rosMLgr == nullptr) {
0597         std::unique_ptr<std::vector<int> > newVector(new std::vector<int>);
0598         rosMLgr = newVector.get();
0599         localCache->grROS.insert(cellKey.begin(), cellKey.end(), std::move(newVector));
0600       }
0601       rosMLgr->push_back(entryNum);
0602     }
0603 
0604     if ((key < 0x3fffffff) && (val > 0x3fffffff)) {
0605       chanKey.clear();
0606       chanKey.push_back(link.dduId);
0607       chanKey.push_back(link.rosId);
0608       localCache->rgDDU.insert(chanKey.begin(), chanKey.end(), entryNum);
0609 
0610       int mapId = link.cellId;
0611       std::vector<int>* dduMLgr;
0612       std::map<int, std::vector<int>*>::const_iterator dduEntIter = dduEntries.find(mapId);
0613       if (dduEntIter == dduEntries.end())
0614         dduEntries.insert(std::pair<int, std::vector<int>*>(mapId, dduMLgr = new std::vector<int>));
0615       else
0616         dduMLgr = dduEntIter->second;
0617       dduMLgr->push_back(entryNum);
0618     }
0619   }
0620 
0621   if (defaultValue != 0) {
0622     for (entryNum = 0; entryNum < entryMax; entryNum++) {
0623       const DTReadOutGeometryLink& link(readOutChannelDriftTubeMap[entryNum]);
0624       key = link.dduId;
0625       if (key != rosMapKey)
0626         continue;
0627       int mapId = link.rosId;
0628       int whchkId = link.wheelId;
0629       int secchkId = link.sectorId;
0630 
0631       std::vector<int>* dduMLgr;
0632       std::map<int, std::vector<int>*>::const_iterator dduEntIter = dduEntries.find(mapId);
0633       if (dduEntIter != dduEntries.end())
0634         dduMLgr = dduEntIter->second;
0635       else
0636         continue;
0637       std::vector<int>::const_iterator dduIter = dduMLgr->begin();
0638       std::vector<int>::const_iterator dduIend = dduMLgr->end();
0639       while (dduIter != dduIend) {
0640         int ientry = *dduIter++;
0641         const DTReadOutGeometryLink& lros(readOutChannelDriftTubeMap[ientry]);
0642         int wheelId = whchkId;
0643         int sectorId = secchkId;
0644         if (wheelId == defaultValue)
0645           wheelId = lros.wheelId;
0646         if (sectorId == defaultValue)
0647           sectorId = lros.sectorId;
0648         cellKey.clear();
0649         cellKey.push_back(mapId);
0650         cellKey.push_back(wheelId);
0651         cellKey.push_back(sectorId);
0652         std::vector<int>* dduMLgr = nullptr;
0653         localCache->grDDU.find(cellKey.begin(), cellKey.end(), dduMLgr);
0654         if (dduMLgr == nullptr) {
0655           std::unique_ptr<std::vector<int> > newVector(new std::vector<int>);
0656           dduMLgr = newVector.get();
0657           localCache->grDDU.insert(cellKey.begin(), cellKey.end(), std::move(newVector));
0658         }
0659         dduMLgr->push_back(ientry);
0660       }
0661     }
0662 
0663     std::map<int, std::vector<int>*>::const_iterator dduEntIter = dduEntries.begin();
0664     std::map<int, std::vector<int>*>::const_iterator dduEntIend = dduEntries.end();
0665     while (dduEntIter != dduEntIend) {
0666       const std::pair<int, std::vector<int>*>& dduEntry = *dduEntIter++;
0667       delete dduEntry.second;
0668     }
0669 
0670     localCache->rgBuf.clear();
0671     localCache->grBuf.clear();
0672   }
0673 
0674   atomicCache().set(std::move(localCache));
0675 
0676   return;
0677 }