CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Friends
DTReadOutMapping Class Reference

#include <DTReadOutMapping.h>

Public Types

typedef std::vector< DTReadOutGeometryLink >::const_iterator const_iterator
 Access methods to the connections. More...
 
enum  type { plain, compact }
 

Public Member Functions

const_iterator begin () const
 
void clear ()
 clear map More...
 
 DTReadOutMapping ()
 
 DTReadOutMapping (DTReadOutMapping const &)=delete
 
 DTReadOutMapping (const std::string &cell_map_version, const std::string &rob_map_version)
 
const_iterator end () const
 
const DTReadOutMappingfullMap () const
 Expand to full map. More...
 
int geometryToReadOut (int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, int &dduId, int &rosId, int &robId, int &tdcId, int &channelId) const
 
int geometryToReadOut (const DTWireId &wireId, int &dduId, int &rosId, int &robId, int &tdcId, int &channelId) const
 
int insertReadOutGeometryLink (int dduId, int rosId, int robId, int tdcId, int channelId, int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId)
 insert connection More...
 
const std::string & mapCellTdc () const
 access parent maps identifiers More...
 
std::string & mapCellTdc ()
 
const std::string & mapRobRos () const
 
std::string & mapRobRos ()
 
type mapType () const
 
DTReadOutMappingoperator= (DTReadOutMapping const &)=delete
 
int readOutToGeometry (int dduId, int rosId, int robId, int tdcId, int channelId, DTWireId &wireId) const
 transform identifiers More...
 
int readOutToGeometry (int dduId, int rosId, int robId, int tdcId, int channelId, int &wheelId, int &stationId, int &sectorId, int &slId, int &layerId, int &cellId) const
 
 ~DTReadOutMapping ()
 

Private Member Functions

edm::AtomicPtrCache< DTReadOutMappingCache > const & atomicCache () const
 
edm::AtomicPtrCache< DTReadOutMappingCache > & atomicCache ()
 
void cacheMap () const
 read and store full content More...
 
std::string mapNameGR () const
 
std::string mapNameRG () const
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Static Private Member Functions

static DTReadOutMappingexpandMap (const DTReadOutMapping &compMap)
 

Private Attributes

edm::AtomicPtrCache< DTReadOutMappingCacheatomicCache_
 
std::string cellMapVersion
 
edm::ConstRespectingPtr< DTBufferTree< int, int > > grBuf
 
std::vector< DTReadOutGeometryLinkreadOutChannelDriftTubeMap
 
edm::ConstRespectingPtr< DTBufferTree< int, int > > rgBuf
 
std::string robMapVersion
 

Friends

class boost::serialization::access
 
template<typename CondSerializationT , typename Enabled >
struct cond::serialization::access
 

Detailed Description

Description: Class to map read-out channels to physical drift tubes Many details related to this class are described in internal note IN 2010_033. In particular the compact format is described there.

Author
Paolo Ronchese INFN Padova

Definition at line 62 of file DTReadOutMapping.h.

Member Typedef Documentation

◆ const_iterator

Access methods to the connections.

Definition at line 132 of file DTReadOutMapping.h.

Member Enumeration Documentation

◆ type

Enumerator
plain 
compact 

Definition at line 75 of file DTReadOutMapping.h.

Constructor & Destructor Documentation

◆ DTReadOutMapping() [1/3]

DTReadOutMapping::DTReadOutMapping ( )

Constructor

Definition at line 33 of file DTReadOutMapping.cc.

References readOutChannelDriftTubeMap.

Referenced by expandMap().

35  readOutChannelDriftTubeMap.reserve(2000);
36 }
std::string robMapVersion
edm::ConstRespectingPtr< DTBufferTree< int, int > > rgBuf
std::vector< DTReadOutGeometryLink > readOutChannelDriftTubeMap
edm::ConstRespectingPtr< DTBufferTree< int, int > > grBuf
std::string cellMapVersion

◆ DTReadOutMapping() [2/3]

DTReadOutMapping::DTReadOutMapping ( DTReadOutMapping const &  )
delete

◆ DTReadOutMapping() [3/3]

DTReadOutMapping::DTReadOutMapping ( const std::string &  cell_map_version,
const std::string &  rob_map_version 
)

Definition at line 38 of file DTReadOutMapping.cc.

References readOutChannelDriftTubeMap.

39  : cellMapVersion(cell_map_version),
40  robMapVersion(rob_map_version),
43  readOutChannelDriftTubeMap.reserve(2000);
44 }
std::string robMapVersion
edm::ConstRespectingPtr< DTBufferTree< int, int > > rgBuf
std::vector< DTReadOutGeometryLink > readOutChannelDriftTubeMap
edm::ConstRespectingPtr< DTBufferTree< int, int > > grBuf
std::string cellMapVersion

◆ ~DTReadOutMapping()

DTReadOutMapping::~DTReadOutMapping ( )

Destructor

Definition at line 62 of file DTReadOutMapping.cc.

62 {}

Member Function Documentation

◆ atomicCache() [1/2]

edm::AtomicPtrCache<DTReadOutMappingCache> const& DTReadOutMapping::atomicCache ( ) const
inlineprivate

Definition at line 140 of file DTReadOutMapping.h.

References atomicCache_.

Referenced by cacheMap(), clear(), geometryToReadOut(), insertReadOutGeometryLink(), mapType(), and readOutToGeometry().

140 { return atomicCache_; }
edm::AtomicPtrCache< DTReadOutMappingCache > atomicCache_

◆ atomicCache() [2/2]

edm::AtomicPtrCache<DTReadOutMappingCache>& DTReadOutMapping::atomicCache ( )
inlineprivate

Definition at line 141 of file DTReadOutMapping.h.

References atomicCache_.

141 { return atomicCache_; }
edm::AtomicPtrCache< DTReadOutMappingCache > atomicCache_

◆ begin()

DTReadOutMapping::const_iterator DTReadOutMapping::begin ( void  ) const

Definition at line 404 of file DTReadOutMapping.cc.

References readOutChannelDriftTubeMap.

Referenced by expandMap().

404 { return readOutChannelDriftTubeMap.begin(); }
std::vector< DTReadOutGeometryLink > readOutChannelDriftTubeMap

◆ cacheMap()

void DTReadOutMapping::cacheMap ( ) const
private

read and store full content

Definition at line 511 of file DTReadOutMapping.cc.

References atomicCache(), DTReadOutGeometryLink::cellId, DTReadOutGeometryLink::channelId, DTReadOutGeometryLink::dduId, hltPixelClustersMultiplicity_cfi::defaultValue, crabWrapper::key, DTReadOutGeometryLink::layerId, eostools::move(), readOutChannelDriftTubeMap, DTReadOutGeometryLink::robId, DTReadOutGeometryLink::rosId, DTReadOutGeometryLink::sectorId, edm::AtomicPtrCache< T >::set(), DTReadOutGeometryLink::slId, DTReadOutGeometryLink::stationId, DTReadOutGeometryLink::tdcId, heppy_batch::val, and DTReadOutGeometryLink::wheelId.

Referenced by geometryToReadOut(), mapType(), and readOutToGeometry().

511  {
512  std::unique_ptr<DTReadOutMappingCache> localCache(new DTReadOutMappingCache);
513 
514  localCache->mType.insert(0, 0);
515 
516  int entryNum = 0;
517  int entryMax = readOutChannelDriftTubeMap.size();
518  std::vector<int> cellKey;
519  cellKey.reserve(6);
520  std::vector<int> chanKey;
521  chanKey.reserve(5);
522  int defaultValue = 0;
523  int key;
524  int val;
525  int rosMapKey = 0;
526  int robMapKey = 0;
527  std::map<int, std::vector<int>*> dduEntries;
528  for (entryNum = 0; entryNum < entryMax; entryNum++) {
529  const DTReadOutGeometryLink& link(readOutChannelDriftTubeMap[entryNum]);
530 
531  key = link.dduId;
532  val = link.stationId;
533  if (key > 0x3fffffff) {
534  if (link.tdcId > 0x3fffffff) {
535  localCache->mType.insert(0, defaultValue = link.tdcId);
536  rosMapKey = key;
537  } else {
538  localCache->mType.insert(0, defaultValue = link.wheelId);
539  robMapKey = key;
540  }
541  }
542 
543  if (defaultValue == 0) {
544  chanKey.clear();
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);
550 
551  localCache->rgBuf.insert(chanKey.begin(), chanKey.end(), entryNum);
552 
553  cellKey.clear();
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);
560 
561  localCache->grBuf.insert(cellKey.begin(), cellKey.end(), entryNum);
562  }
563 
564  if (key == robMapKey) {
565  chanKey.clear();
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);
570 
571  cellKey.clear();
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));
581  }
582  robMLgr->push_back(entryNum);
583  }
584 
585  if (key == rosMapKey) {
586  chanKey.clear();
587  chanKey.push_back(link.rosId);
588  chanKey.push_back(link.robId);
589  localCache->rgROS.insert(chanKey.begin(), chanKey.end(), entryNum);
590 
591  cellKey.clear();
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));
600  }
601  rosMLgr->push_back(entryNum);
602  }
603 
604  if ((key < 0x3fffffff) && (val > 0x3fffffff)) {
605  chanKey.clear();
606  chanKey.push_back(link.dduId);
607  chanKey.push_back(link.rosId);
608  localCache->rgDDU.insert(chanKey.begin(), chanKey.end(), entryNum);
609 
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>));
615  else
616  dduMLgr = dduEntIter->second;
617  dduMLgr->push_back(entryNum);
618  }
619  }
620 
621  if (defaultValue != 0) {
622  for (entryNum = 0; entryNum < entryMax; entryNum++) {
623  const DTReadOutGeometryLink& link(readOutChannelDriftTubeMap[entryNum]);
624  key = link.dduId;
625  if (key != rosMapKey)
626  continue;
627  int mapId = link.rosId;
628  int whchkId = link.wheelId;
629  int secchkId = link.sectorId;
630 
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;
635  else
636  continue;
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)
645  wheelId = lros.wheelId;
646  if (sectorId == defaultValue)
647  sectorId = lros.sectorId;
648  cellKey.clear();
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));
658  }
659  dduMLgr->push_back(ientry);
660  }
661  }
662 
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;
668  }
669 
670  localCache->rgBuf.clear();
671  localCache->grBuf.clear();
672  }
673 
674  atomicCache().set(std::move(localCache));
675 
676  return;
677 }
bool set(std::unique_ptr< T > iNewValue) const
std::vector< DTReadOutGeometryLink >::const_iterator const_iterator
Access methods to the connections.
std::vector< DTReadOutGeometryLink > readOutChannelDriftTubeMap
edm::AtomicPtrCache< DTReadOutMappingCache > const & atomicCache() const
def move(src, dest)
Definition: eostools.py:511

◆ clear()

void DTReadOutMapping::clear ( void  )

clear map

Definition at line 333 of file DTReadOutMapping.cc.

References atomicCache(), DTBufferTree< Key, Content >::clear(), grBuf, readOutChannelDriftTubeMap, edm::AtomicPtrCache< T >::reset(), and rgBuf.

333  {
334  atomicCache().reset();
335  rgBuf->clear();
336  grBuf->clear();
338  return;
339 }
edm::ConstRespectingPtr< DTBufferTree< int, int > > rgBuf
void reset()
unsets the value and deletes the memory
std::vector< DTReadOutGeometryLink > readOutChannelDriftTubeMap
edm::ConstRespectingPtr< DTBufferTree< int, int > > grBuf
edm::AtomicPtrCache< DTReadOutMappingCache > const & atomicCache() const

◆ end()

DTReadOutMapping::const_iterator DTReadOutMapping::end ( void  ) const

Definition at line 406 of file DTReadOutMapping.cc.

References readOutChannelDriftTubeMap.

Referenced by Types.LuminosityBlockRange::cppID(), Types.EventRange::cppID(), and expandMap().

406 { return readOutChannelDriftTubeMap.end(); }
std::vector< DTReadOutGeometryLink > readOutChannelDriftTubeMap

◆ expandMap()

DTReadOutMapping * DTReadOutMapping::expandMap ( const DTReadOutMapping compMap)
staticprivate

Definition at line 416 of file DTReadOutMapping.cc.

References begin(), DTReadOutGeometryLink::cellId, DTReadOutGeometryLink::channelId, gather_cfg::cout, DTReadOutGeometryLink::dduId, spu::def(), DTReadOutMapping(), end(), fullMap(), insertReadOutGeometryLink(), DTReadOutGeometryLink::layerId, mapCellTdc(), mapRobRos(), MT2Analyzer::mt2, DTReadOutGeometryLink::robId, DTReadOutGeometryLink::rosId, fileinputsource_cfi::sec, DTReadOutGeometryLink::sectorId, DTReadOutGeometryLink::slId, DTReadOutGeometryLink::stationId, AlCaHLTBitMon_QueryRunRegistry::string, DTReadOutGeometryLink::tdcId, and DTReadOutGeometryLink::wheelId.

Referenced by fullMap().

416  {
417  std::vector<DTReadOutGeometryLink> entryList;
418  DTReadOutMapping::const_iterator compIter = compMap.begin();
419  DTReadOutMapping::const_iterator compIend = compMap.end();
420  while (compIter != compIend)
421  entryList.push_back(*compIter++);
422 
423  std::string rosMap = "expand_";
424  rosMap += compMap.mapRobRos();
425  std::string tdcMap = "expand_";
426  tdcMap += compMap.mapCellTdc();
427  DTReadOutMapping* fullMap = new DTReadOutMapping(tdcMap, rosMap);
428  int ddu;
429  int ros;
430  int rch;
431  int tdc;
432  int tch;
433  int whe;
434  int sta;
435  int sec;
436  int rob;
437  int qua;
438  int lay;
439  int cel;
440  int mt1;
441  int mi1;
442  int mt2;
443  int mi2;
444  int def;
445  int wha;
446  int sea;
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) {
452  const DTReadOutGeometryLink& rosEntry(*iter++);
453  if (rosEntry.dduId > 0x3fffffff)
454  continue;
455  ddu = rosEntry.dduId;
456  ros = rosEntry.rosId;
457  whe = rosEntry.wheelId;
458  def = rosEntry.stationId;
459  sec = rosEntry.sectorId;
460  rob = rosEntry.slId;
461  mt1 = rosEntry.layerId;
462  mi1 = rosEntry.cellId;
463  iros = entryList.begin();
464  while (iros != iend) {
465  wha = whe;
466  sea = sec;
467  const DTReadOutGeometryLink& rchEntry(*iros++);
468  if ((rchEntry.dduId != mt1) || (rchEntry.rosId != mi1))
469  continue;
470  rch = rchEntry.robId;
471  if (rchEntry.wheelId != def)
472  wha = rchEntry.wheelId;
473  sta = rchEntry.stationId;
474  if (rchEntry.sectorId != def)
475  sea = rchEntry.sectorId;
476  rob = rchEntry.slId;
477  mt2 = rchEntry.layerId;
478  mi2 = rchEntry.cellId;
479  irob = entryList.begin();
480  while (irob != iend) {
481  const DTReadOutGeometryLink& robEntry(*irob++);
482  if ((robEntry.dduId != mt2) || (robEntry.rosId != mi2))
483  continue;
484  if (robEntry.robId != rob) {
485  std::cout << "ROB mismatch " << rob << " " << robEntry.robId << std::endl;
486  }
487  tdc = robEntry.tdcId;
488  tch = robEntry.channelId;
489  qua = robEntry.slId;
490  lay = robEntry.layerId;
491  cel = robEntry.cellId;
492  fullMap->insertReadOutGeometryLink(ddu, ros, rch, tdc, tch, wha, sta, sea, qua, lay, cel);
493  }
494  }
495  }
496  return fullMap;
497 }
int def(FILE *, FILE *, int)
const DTReadOutMapping * fullMap() const
Expand to full map.
std::vector< DTReadOutGeometryLink >::const_iterator const_iterator
Access methods to the connections.
const std::string & mapRobRos() const
const_iterator begin() const
const std::string & mapCellTdc() const
access parent maps identifiers
int insertReadOutGeometryLink(int dduId, int rosId, int robId, int tdcId, int channelId, int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId)
insert connection
const_iterator end() const

◆ fullMap()

const DTReadOutMapping * DTReadOutMapping::fullMap ( ) const

Expand to full map.

Definition at line 408 of file DTReadOutMapping.cc.

References expandMap(), mapType(), and plain.

Referenced by expandMap().

408  {
409  if (mapType() == plain)
410  return this;
411  return expandMap(*this);
412 }
static DTReadOutMapping * expandMap(const DTReadOutMapping &compMap)
type mapType() const

◆ geometryToReadOut() [1/2]

int DTReadOutMapping::geometryToReadOut ( int  wheelId,
int  stationId,
int  sectorId,
int  slId,
int  layerId,
int  cellId,
int &  dduId,
int &  rosId,
int &  robId,
int &  tdcId,
int &  channelId 
) const

Definition at line 185 of file DTReadOutMapping.cc.

References atomicCache(), cacheMap(), totem::nt2::vfat::channelId(), DTReadOutGeometryLink::channelId, DTReadOutGeometryLink::dduId, hltPixelClustersMultiplicity_cfi::defaultValue, DTBufferTree< Key, Content >::find(), DTReadOutMappingCache::grBuf, DTReadOutMappingCache::grDDU, DTReadOutMappingCache::grROB, DTReadOutMappingCache::grROS, DTReadOutMappingCache::mType, readOutChannelDriftTubeMap, DTReadOutGeometryLink::robId, DTReadOutGeometryLink::rosId, DTReadOutGeometryLink::sectorId, DTReadOutGeometryLink::tdcId, and DTReadOutGeometryLink::wheelId.

Referenced by DTDigiTask::channelsMap(), and geometryToReadOut().

195  {
196  dduId = rosId = robId = tdcId = channelId = 0;
197 
198  if (!atomicCache().isSet()) {
199  cacheMap();
200  }
201 
202  int defaultValue;
204  if (defaultValue) {
205  int loop1 = 0;
206  int loop2 = 0;
207  int loop3 = 0;
208  int loop0 = 0;
209 
210  int searchStatus;
211  int mapId = 0;
212  std::vector<int> const* robMLgr;
213  std::vector<int> const* rosMLgr;
214  std::vector<int> const* dduMLgr;
215 
216  std::vector<int> cellKey;
217  cellKey.reserve(6);
218  cellKey.push_back(cellId);
219  cellKey.push_back(layerId);
220  cellKey.push_back(slId);
221  std::vector<int> stdcKey = cellKey;
222  searchStatus = atomicCache()->grROB.find(cellKey.begin(), cellKey.end(), robMLgr);
223  if (searchStatus)
224  return searchStatus;
225  if (robMLgr->empty())
226  return 1;
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) {
230  loop1++;
231  const DTReadOutGeometryLink& ltdc(readOutChannelDriftTubeMap[*tdc_iter++]);
232  channelId = ltdc.channelId;
233  tdcId = ltdc.tdcId;
234  mapId = ltdc.rosId;
235  cellKey.clear();
236  cellKey.push_back(mapId);
237  cellKey.push_back(stationId);
238  std::vector<int> srosKey = cellKey;
239  searchStatus = atomicCache()->grROS.find(cellKey.begin(), cellKey.end(), rosMLgr);
240  if (searchStatus)
241  continue;
242  if (rosMLgr->empty())
243  continue;
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) {
247  loop2++;
248  const DTReadOutGeometryLink& lros(readOutChannelDriftTubeMap[*ros_iter++]);
249  int secCk = lros.sectorId;
250  int wheCk = lros.wheelId;
251  if ((secCk != defaultValue) && (secCk != sectorId))
252  continue;
253  if ((wheCk != defaultValue) && (wheCk != wheelId))
254  continue;
255  robId = lros.robId;
256  mapId = lros.rosId;
257  cellKey.clear();
258  cellKey.push_back(mapId);
259  cellKey.push_back(wheelId);
260  cellKey.push_back(sectorId);
261  std::vector<int> sdduKey = cellKey;
262  searchStatus = atomicCache()->grDDU.find(cellKey.begin(), cellKey.end(), dduMLgr);
263  if (searchStatus)
264  continue;
265  if (dduMLgr->empty())
266  continue;
267  if (searchStatus)
268  return searchStatus;
269  if (dduMLgr->empty())
270  return 1;
271  loop0++;
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) {
275  loop3++;
276  const DTReadOutGeometryLink& lddu(readOutChannelDriftTubeMap[*ddu_iter++]);
277  if (((sectorId == secCk) || (sectorId == lddu.sectorId)) &&
278  ((wheelId == wheCk) || (wheelId == lddu.wheelId))) {
279  rosId = lddu.rosId;
280  dduId = lddu.dduId;
281  return 0;
282  }
283  }
284  }
285  }
286 
287  return 1;
288  }
289 
290  std::vector<int> cellKey;
291  cellKey.reserve(6);
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);
298  int ientry;
299  int searchStatus = atomicCache()->grBuf.find(cellKey.begin(), cellKey.end(), ientry);
300  if (!searchStatus) {
302  dduId = link.dduId;
303  rosId = link.rosId;
304  robId = link.robId;
305  tdcId = link.tdcId;
306  channelId = link.channelId;
307  }
308 
309  return searchStatus;
310 }
std::vector< DTReadOutGeometryLink > readOutChannelDriftTubeMap
edm::AtomicPtrCache< DTReadOutMappingCache > const & atomicCache() const
DTBufferTree< int, int > mType
DTBufferTree< int, std::unique_ptr< std::vector< int > > > grROB
void cacheMap() const
read and store full content
uint8_t channelId(const VFATFrame &frame)
retrieve this channel identifier
DTBufferTree< int, std::unique_ptr< std::vector< int > > > grROS
int find(ElementKey fKey, ElementKey lKey, typename DTBufferTreeTrait< Content >::outputTypeOfConstFind &cont) const
DTBufferTree< int, std::unique_ptr< std::vector< int > > > grDDU
DTBufferTree< int, int > grBuf

◆ geometryToReadOut() [2/2]

int DTReadOutMapping::geometryToReadOut ( const DTWireId wireId,
int &  dduId,
int &  rosId,
int &  robId,
int &  tdcId,
int &  channelId 
) const

Definition at line 170 of file DTReadOutMapping.cc.

References totem::nt2::vfat::channelId(), geometryToReadOut(), DTLayerId::layer(), DTChamberId::sector(), DTChamberId::station(), DTSuperLayerId::superLayer(), DTChamberId::wheel(), and DTWireId::wire().

171  {
172  return geometryToReadOut(wireId.wheel(),
173  wireId.station(),
174  wireId.sector(),
175  wireId.superLayer(),
176  wireId.layer(),
177  wireId.wire(),
178  dduId,
179  rosId,
180  robId,
181  tdcId,
182  channelId);
183 }
int station() const
Return the station number.
Definition: DTChamberId.h:42
int superLayer() const
Return the superlayer number.
int wire() const
Return the wire number.
Definition: DTWireId.h:42
int geometryToReadOut(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, int &dduId, int &rosId, int &robId, int &tdcId, int &channelId) const
uint8_t channelId(const VFATFrame &frame)
retrieve this channel identifier
int layer() const
Return the layer number.
Definition: DTLayerId.h:42
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:39
int sector() const
Definition: DTChamberId.h:49

◆ insertReadOutGeometryLink()

int DTReadOutMapping::insertReadOutGeometryLink ( int  dduId,
int  rosId,
int  robId,
int  tdcId,
int  channelId,
int  wheelId,
int  stationId,
int  sectorId,
int  slId,
int  layerId,
int  cellId 
)

insert connection

Definition at line 341 of file DTReadOutMapping.cc.

References atomicCache(), DTReadOutGeometryLink::cellId, totem::nt2::vfat::channelId(), DTReadOutGeometryLink::channelId, DTReadOutGeometryLink::dduId, edm::ConstRespectingPtr< T >::get(), DTReadOutMappingCache::grBuf, grBuf, DTBufferTree< Key, Content >::insert(), DTReadOutGeometryLink::layerId, readOutChannelDriftTubeMap, DTReadOutMappingCache::rgBuf, rgBuf, DTReadOutGeometryLink::robId, DTReadOutGeometryLink::rosId, DTReadOutGeometryLink::sectorId, DTReadOutGeometryLink::slId, DTReadOutGeometryLink::stationId, DTReadOutGeometryLink::tdcId, and DTReadOutGeometryLink::wheelId.

Referenced by expandMap(), and DTReadOutMappingHandler::getNewObjects().

351  {
353  link.dduId = dduId;
354  link.rosId = rosId;
355  link.robId = robId;
356  link.tdcId = tdcId;
357  link.channelId = channelId;
358  link.wheelId = wheelId;
359  link.stationId = stationId;
360  link.sectorId = sectorId;
361  link.slId = slId;
362  link.layerId = layerId;
363  link.cellId = cellId;
364 
365  int ientry = readOutChannelDriftTubeMap.size();
366  readOutChannelDriftTubeMap.push_back(link);
367 
368  DTBufferTree<int, int>* pgrBuf;
369  DTBufferTree<int, int>* prgBuf;
370 
371  if (atomicCache().isSet()) {
372  pgrBuf = &atomicCache()->grBuf;
373  prgBuf = &atomicCache()->rgBuf;
374  } else {
375  pgrBuf = grBuf.get();
376  prgBuf = rgBuf.get();
377  }
378 
379  std::vector<int> cellKey;
380  cellKey.reserve(6);
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);
388 
389  std::vector<int> chanKey;
390  chanKey.reserve(5);
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);
397 
398  if (grStatus || rgStatus)
399  return 1;
400  else
401  return 0;
402 }
edm::ConstRespectingPtr< DTBufferTree< int, int > > rgBuf
DTBufferTree< int, int > rgBuf
std::vector< DTReadOutGeometryLink > readOutChannelDriftTubeMap
edm::ConstRespectingPtr< DTBufferTree< int, int > > grBuf
edm::AtomicPtrCache< DTReadOutMappingCache > const & atomicCache() const
uint8_t channelId(const VFATFrame &frame)
retrieve this channel identifier
int insert(ElementKey fKey, ElementKey lKey, Content cont)
DTBufferTree< int, int > grBuf

◆ mapCellTdc() [1/2]

const std::string & DTReadOutMapping::mapCellTdc ( ) const

access parent maps identifiers

Definition at line 325 of file DTReadOutMapping.cc.

References cellMapVersion.

Referenced by expandMap().

325 { return cellMapVersion; }
std::string cellMapVersion

◆ mapCellTdc() [2/2]

std::string & DTReadOutMapping::mapCellTdc ( )

Definition at line 327 of file DTReadOutMapping.cc.

References cellMapVersion.

327 { return cellMapVersion; }
std::string cellMapVersion

◆ mapNameGR()

std::string DTReadOutMapping::mapNameGR ( ) const
private

Definition at line 499 of file DTReadOutMapping.cc.

References cellMapVersion, Skims_PA_cff::name, and robMapVersion.

499  {
500  std::stringstream name;
501  name << cellMapVersion << "_" << robMapVersion << "_map_GR" << this;
502  return name.str();
503 }
std::string robMapVersion
std::string cellMapVersion

◆ mapNameRG()

std::string DTReadOutMapping::mapNameRG ( ) const
private

Definition at line 505 of file DTReadOutMapping.cc.

References cellMapVersion, Skims_PA_cff::name, and robMapVersion.

505  {
506  std::stringstream name;
507  name << cellMapVersion << "_" << robMapVersion << "_map_RG" << this;
508  return name.str();
509 }
std::string robMapVersion
std::string cellMapVersion

◆ mapRobRos() [1/2]

const std::string & DTReadOutMapping::mapRobRos ( ) const

Definition at line 329 of file DTReadOutMapping.cc.

References robMapVersion.

Referenced by expandMap().

329 { return robMapVersion; }
std::string robMapVersion

◆ mapRobRos() [2/2]

std::string & DTReadOutMapping::mapRobRos ( )

Definition at line 331 of file DTReadOutMapping.cc.

References robMapVersion.

331 { return robMapVersion; }
std::string robMapVersion

◆ mapType()

DTReadOutMapping::type DTReadOutMapping::mapType ( ) const

Definition at line 312 of file DTReadOutMapping.cc.

References atomicCache(), cacheMap(), compact, hltPixelClustersMultiplicity_cfi::defaultValue, DTBufferTree< Key, Content >::find(), DTReadOutMappingCache::mType, and plain.

Referenced by fullMap().

312  {
313  if (!atomicCache().isSet()) {
314  cacheMap();
315  }
316 
317  int defaultValue;
319  if (defaultValue)
320  return compact;
321  else
322  return plain;
323 }
edm::AtomicPtrCache< DTReadOutMappingCache > const & atomicCache() const
DTBufferTree< int, int > mType
void cacheMap() const
read and store full content
int find(ElementKey fKey, ElementKey lKey, typename DTBufferTreeTrait< Content >::outputTypeOfConstFind &cont) const

◆ operator=()

DTReadOutMapping& DTReadOutMapping::operator= ( DTReadOutMapping const &  )
delete

◆ readOutToGeometry() [1/2]

int DTReadOutMapping::readOutToGeometry ( int  dduId,
int  rosId,
int  robId,
int  tdcId,
int  channelId,
DTWireId wireId 
) const

transform identifiers

Operations

Definition at line 69 of file DTReadOutMapping.cc.

References totem::nt2::vfat::channelId(), and mps_update::status.

Referenced by DTDAQInfo::dqmEndLuminosityBlock(), DTBlockedROChannelsTest::fillChamberMap(), DTDataIntegrityTest::readOutToGeometry(), and DTBlockedROChannelsTest::readOutToGeometry().

70  {
71  int wheelId;
72  int stationId;
73  int sectorId;
74  int slId;
75  int layerId;
76  int cellId;
77 
78  int status =
79  readOutToGeometry(dduId, rosId, robId, tdcId, channelId, wheelId, stationId, sectorId, slId, layerId, cellId);
80 
81  wireId = DTWireId(wheelId, stationId, sectorId, slId, layerId, cellId);
82  return status;
83 }
int readOutToGeometry(int dduId, int rosId, int robId, int tdcId, int channelId, DTWireId &wireId) const
transform identifiers
uint8_t channelId(const VFATFrame &frame)
retrieve this channel identifier

◆ readOutToGeometry() [2/2]

int DTReadOutMapping::readOutToGeometry ( int  dduId,
int  rosId,
int  robId,
int  tdcId,
int  channelId,
int &  wheelId,
int &  stationId,
int &  sectorId,
int &  slId,
int &  layerId,
int &  cellId 
) const

Definition at line 85 of file DTReadOutMapping.cc.

References atomicCache(), cacheMap(), DTReadOutGeometryLink::cellId, totem::nt2::vfat::channelId(), hltPixelClustersMultiplicity_cfi::defaultValue, DTBufferTree< Key, Content >::find(), DTReadOutGeometryLink::layerId, DTReadOutMappingCache::mType, readOutChannelDriftTubeMap, DTReadOutMappingCache::rgBuf, DTReadOutMappingCache::rgDDU, DTReadOutMappingCache::rgROB, DTReadOutMappingCache::rgROS, DTReadOutGeometryLink::sectorId, DTReadOutGeometryLink::slId, DTReadOutGeometryLink::stationId, and DTReadOutGeometryLink::wheelId.

95  {
96  wheelId = stationId = sectorId = slId = layerId = cellId = 0;
97 
98  if (!atomicCache().isSet()) {
99  cacheMap();
100  }
101 
102  int defaultValue;
104  if (defaultValue) {
105  int searchStatus;
106  int ientry;
107 
108  std::vector<int> dduKey;
109  dduKey.reserve(5);
110  dduKey.push_back(dduId);
111  dduKey.push_back(rosId);
112  searchStatus = atomicCache()->rgDDU.find(dduKey.begin(), dduKey.end(), ientry);
113  if (searchStatus)
114  return searchStatus;
116  wheelId = lros.wheelId;
117  sectorId = lros.sectorId;
118 
119  std::vector<int> rosKey;
120  rosKey.reserve(5);
121  rosKey.push_back(lros.cellId);
122  rosKey.push_back(robId);
123  searchStatus = atomicCache()->rgROS.find(rosKey.begin(), rosKey.end(), ientry);
124  if (searchStatus)
125  return searchStatus;
127  if (lrob.wheelId != defaultValue)
128  wheelId = lrob.wheelId;
129  stationId = lrob.stationId;
130  if (lrob.sectorId != defaultValue)
131  sectorId = lrob.sectorId;
132 
133  std::vector<int> robKey;
134  robKey.reserve(5);
135  robKey.push_back(lrob.cellId);
136  robKey.push_back(tdcId);
137  robKey.push_back(channelId);
138  searchStatus = atomicCache()->rgROB.find(robKey.begin(), robKey.end(), ientry);
139  if (searchStatus)
140  return searchStatus;
142  slId = ltdc.slId;
143  layerId = ltdc.layerId;
144  cellId = ltdc.cellId;
145  return 0;
146  }
147 
148  std::vector<int> chanKey;
149  chanKey.reserve(5);
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);
155  int ientry;
156  int searchStatus = atomicCache()->rgBuf.find(chanKey.begin(), chanKey.end(), ientry);
157  if (!searchStatus) {
159  wheelId = link.wheelId;
160  stationId = link.stationId;
161  sectorId = link.sectorId;
162  slId = link.slId;
163  layerId = link.layerId;
164  cellId = link.cellId;
165  }
166 
167  return searchStatus;
168 }
DTBufferTree< int, int > rgDDU
DTBufferTree< int, int > rgBuf
std::vector< DTReadOutGeometryLink > readOutChannelDriftTubeMap
edm::AtomicPtrCache< DTReadOutMappingCache > const & atomicCache() const
DTBufferTree< int, int > rgROB
DTBufferTree< int, int > mType
void cacheMap() const
read and store full content
uint8_t channelId(const VFATFrame &frame)
retrieve this channel identifier
int find(ElementKey fKey, ElementKey lKey, typename DTBufferTreeTrait< Content >::outputTypeOfConstFind &cont) const
DTBufferTree< int, int > rgROS

◆ serialize()

template<class Archive >
void DTReadOutMapping::serialize ( Archive &  ar,
const unsigned int  version 
)
private

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 160 of file DTReadOutMapping.h.

◆ cond::serialization::access

template<typename CondSerializationT , typename Enabled >
friend struct cond::serialization::access
friend

Definition at line 160 of file DTReadOutMapping.h.

Member Data Documentation

◆ atomicCache_

edm::AtomicPtrCache<DTReadOutMappingCache> DTReadOutMapping::atomicCache_
private

Definition at line 150 of file DTReadOutMapping.h.

Referenced by atomicCache().

◆ cellMapVersion

std::string DTReadOutMapping::cellMapVersion
private

Definition at line 145 of file DTReadOutMapping.h.

Referenced by mapCellTdc(), mapNameGR(), and mapNameRG().

◆ grBuf

edm::ConstRespectingPtr<DTBufferTree<int, int> > DTReadOutMapping::grBuf
private

Definition at line 152 of file DTReadOutMapping.h.

Referenced by clear(), and insertReadOutGeometryLink().

◆ readOutChannelDriftTubeMap

std::vector<DTReadOutGeometryLink> DTReadOutMapping::readOutChannelDriftTubeMap
private

◆ rgBuf

edm::ConstRespectingPtr<DTBufferTree<int, int> > DTReadOutMapping::rgBuf
private

Definition at line 151 of file DTReadOutMapping.h.

Referenced by clear(), and insertReadOutGeometryLink().

◆ robMapVersion

std::string DTReadOutMapping::robMapVersion
private

Definition at line 146 of file DTReadOutMapping.h.

Referenced by mapNameGR(), mapNameRG(), and mapRobRos().