35 cellMapVersion(
" " ),
95 int status = readOutToGeometry( dduId,
107 wireId =
DTWireId( wheelId, stationId, sectorId, slId, layerId, cellId );
132 if(!atomicCache().isSet()) {
137 atomicCache()->mType.find( 0, defaultValue );
138 if ( defaultValue ) {
143 std::vector<int> dduKey;
145 dduKey.push_back( dduId );
146 dduKey.push_back( rosId );
147 searchStatus = atomicCache()->rgDDU.find( dduKey.begin(), dduKey.end(), ientry );
148 if ( searchStatus )
return searchStatus;
153 std::vector<int> rosKey;
155 rosKey.push_back( lros. cellId );
156 rosKey.push_back( robId );
157 searchStatus = atomicCache()->rgROS.find( rosKey.begin(), rosKey.end(), ientry );
158 if ( searchStatus )
return searchStatus;
160 if ( lrob. wheelId != defaultValue ) wheelId = lrob.
wheelId;
162 if ( lrob. sectorId != defaultValue ) sectorId = lrob.
sectorId;
164 std::vector<int> robKey;
166 robKey.push_back( lrob. cellId );
167 robKey.push_back( tdcId );
168 robKey.push_back( channelId );
169 searchStatus = atomicCache()->rgROB.find( robKey.begin(), robKey.end(), ientry );
170 if ( searchStatus )
return searchStatus;
179 std::vector<int> chanKey;
181 chanKey.push_back( dduId );
182 chanKey.push_back( rosId );
183 chanKey.push_back( robId );
184 chanKey.push_back( tdcId );
185 chanKey.push_back( channelId );
187 int searchStatus = atomicCache()->rgBuf.find( chanKey.begin(), chanKey.end(), ientry );
188 if ( !searchStatus ) {
209 return geometryToReadOut( wireId.
wheel(),
241 if(!atomicCache().isSet()) {
246 atomicCache()->mType.find( 0, defaultValue );
247 if ( defaultValue ) {
256 std::vector<int>
const* robMLgr;
257 std::vector<int>
const* rosMLgr;
258 std::vector<int>
const* dduMLgr;
260 std::vector<int> cellKey;
262 cellKey.push_back( cellId );
263 cellKey.push_back( layerId );
264 cellKey.push_back( slId );
265 std::vector<int> stdcKey = cellKey;
266 searchStatus = atomicCache()->grROB.find( cellKey.begin(), cellKey.end(), robMLgr );
267 if ( searchStatus )
return searchStatus;
268 if ( !( robMLgr->size() ) )
return 1;
269 std::vector<int>::const_iterator tdc_iter = robMLgr->begin();
270 std::vector<int>::const_iterator tdc_iend = robMLgr->end();
271 while( tdc_iter != tdc_iend ) {
274 readOutChannelDriftTubeMap[*tdc_iter++] );
279 cellKey.push_back( mapId );
280 cellKey.push_back( stationId );
281 std::vector<int> srosKey = cellKey;
282 searchStatus = atomicCache()->grROS.find( cellKey.begin(), cellKey.end(), rosMLgr );
283 if ( searchStatus )
continue;
284 if ( !( rosMLgr->size() ) )
continue;
285 std::vector<int>::const_iterator ros_iter = rosMLgr->begin();
286 std::vector<int>::const_iterator ros_iend = rosMLgr->end();
287 while( ros_iter != ros_iend ) {
290 readOutChannelDriftTubeMap[*ros_iter++] );
293 if ( ( secCk != defaultValue ) &&
294 ( secCk != sectorId ) )
continue;
295 if ( ( wheCk != defaultValue ) &&
296 ( wheCk != wheelId ) )
continue;
300 cellKey.push_back( mapId );
301 cellKey.push_back( wheelId );
302 cellKey.push_back( sectorId );
303 std::vector<int> sdduKey = cellKey;
304 searchStatus = atomicCache()->grDDU.find( cellKey.begin(), cellKey.end(), dduMLgr );
305 if ( searchStatus )
continue;
306 if ( !( dduMLgr->size() ) )
continue;
307 if ( searchStatus )
return searchStatus;
308 if ( !( dduMLgr->size() ) )
return 1;
310 std::vector<int>::const_iterator ddu_iter = dduMLgr->begin();
311 std::vector<int>::const_iterator ddu_iend = dduMLgr->end();
312 while( ddu_iter != ddu_iend ) {
315 readOutChannelDriftTubeMap[*ddu_iter++] );
316 if ( ( ( sectorId == secCk ) ||
318 ( ( wheelId == wheCk ) ||
319 ( wheelId == lddu.
wheelId ) ) ) {
332 std::vector<int> cellKey;
334 cellKey.push_back( wheelId );
335 cellKey.push_back( stationId );
336 cellKey.push_back( sectorId );
337 cellKey.push_back( slId );
338 cellKey.push_back( layerId );
339 cellKey.push_back( cellId );
341 int searchStatus = atomicCache()->grBuf.find( cellKey.begin(), cellKey.end(), ientry );
342 if ( !searchStatus ) {
358 if(!atomicCache().isSet()) {
363 atomicCache()->mType.find( 0, defaultValue );
364 if ( defaultValue )
return compact;
371 return cellMapVersion;
376 return cellMapVersion;
382 return robMapVersion;
387 return robMapVersion;
392 atomicCache().reset();
395 readOutChannelDriftTubeMap.clear();
424 int ientry = readOutChannelDriftTubeMap.size();
425 readOutChannelDriftTubeMap.push_back( link );
430 if(atomicCache().isSet()) {
431 pgrBuf = &atomicCache()->grBuf;
432 prgBuf = &atomicCache()->rgBuf;
434 pgrBuf = grBuf.get();
435 prgBuf = rgBuf.get();
438 std::vector<int> cellKey;
440 cellKey.push_back( wheelId );
441 cellKey.push_back( stationId );
442 cellKey.push_back( sectorId );
443 cellKey.push_back( slId );
444 cellKey.push_back( layerId );
445 cellKey.push_back( cellId );
446 int grStatus = pgrBuf->
insert( cellKey.begin(), cellKey.end(), ientry );
448 std::vector<int> chanKey;
450 chanKey.push_back( dduId );
451 chanKey.push_back( rosId );
452 chanKey.push_back( robId );
453 chanKey.push_back( tdcId );
454 chanKey.push_back( channelId );
455 int rgStatus = prgBuf->
insert( chanKey.begin(), chanKey.end(), ientry );
457 if ( grStatus || rgStatus )
return 1;
464 return readOutChannelDriftTubeMap.begin();
469 return readOutChannelDriftTubeMap.end();
474 if ( mapType() == plain )
return this;
475 return expandMap( *
this );
482 std::vector<DTReadOutGeometryLink> entryList;
485 while ( compIter != compIend ) entryList.push_back( *compIter++ );
513 std::vector<DTReadOutGeometryLink>::const_iterator iter = entryList.begin();
514 std::vector<DTReadOutGeometryLink>::const_iterator iend = entryList.end();
515 std::vector<DTReadOutGeometryLink>::const_iterator iros = entryList.end();
516 std::vector<DTReadOutGeometryLink>::const_iterator irob = entryList.end();
517 while ( iter != iend ) {
519 if ( rosEntry.
dduId > 0x3fffffff )
continue;
520 ddu = rosEntry.
dduId;
521 ros = rosEntry.
rosId;
528 iros = entryList.begin();
529 while ( iros != iend ) {
533 if ( ( rchEntry.
dduId != mt1 ) ||
534 ( rchEntry.
rosId != mi1 ) )
continue;
535 rch = rchEntry.
robId;
542 irob = entryList.begin();
543 while ( irob != iend ) {
545 if ( ( robEntry.
dduId != mt2 ) ||
546 ( robEntry.
rosId != mi2 ) )
continue;
547 if ( robEntry.
robId != rob ) {
548 std::cout <<
"ROB mismatch " << rob <<
" " 549 << robEntry.
robId << std::endl;
551 tdc = robEntry.
tdcId;
567 std::stringstream
name;
568 name << cellMapVersion <<
"_" << robMapVersion <<
"_map_GR" <<
this;
574 std::stringstream
name;
575 name << cellMapVersion <<
"_" << robMapVersion <<
"_map_RG" <<
this;
584 localCache->mType.insert( 0, 0 );
587 int entryMax = readOutChannelDriftTubeMap.size();
588 std::vector<int> cellKey;
590 std::vector<int> chanKey;
592 int defaultValue = 0;
597 std::map<int,std::vector<int>*> dduEntries;
598 for ( entryNum = 0; entryNum < entryMax; entryNum++ ) {
604 if ( key > 0x3fffffff ) {
605 if ( link.
tdcId > 0x3fffffff ) {
606 localCache->mType.insert( 0, defaultValue = link.
tdcId );
610 localCache->mType.insert( 0, defaultValue = link.
wheelId );
615 if ( defaultValue == 0 ) {
618 chanKey.push_back( link.
dduId );
619 chanKey.push_back( link.
rosId );
620 chanKey.push_back( link.
robId );
621 chanKey.push_back( link.
tdcId );
624 localCache->rgBuf.insert( chanKey.begin(), chanKey.end(), entryNum );
627 cellKey.push_back( link.
wheelId );
629 cellKey.push_back( link.
sectorId );
630 cellKey.push_back( link.
slId );
631 cellKey.push_back( link.
layerId );
632 cellKey.push_back( link.
cellId );
634 localCache->grBuf.insert( cellKey.begin(), cellKey.end(), entryNum );
638 if ( key == robMapKey ) {
641 chanKey.push_back( link.
rosId );
642 chanKey.push_back( link.
tdcId );
644 localCache->rgROB.insert( chanKey.begin(), chanKey.end(), entryNum );
647 cellKey.push_back( link.
cellId );
648 cellKey.push_back( link.
layerId );
649 cellKey.push_back( link.
slId );
650 std::vector<int>* robMLgr;
651 localCache->grROB.find( cellKey.begin(), cellKey.end(), robMLgr );
652 if ( robMLgr == 0 ) {
653 std::unique_ptr<std::vector<int> > newVector(
new std::vector<int>);
654 robMLgr = newVector.get();
655 localCache->grROB.insert( cellKey.begin(), cellKey.end(),
658 robMLgr->push_back( entryNum );
661 if ( key == rosMapKey ) {
664 chanKey.push_back( link.
rosId );
665 chanKey.push_back( link.
robId );
666 localCache->rgROS.insert( chanKey.begin(), chanKey.end(), entryNum );
669 cellKey.push_back( link.
cellId );
671 std::vector<int>* rosMLgr;
672 localCache->grROS.find( cellKey.begin(), cellKey.end(), rosMLgr );
673 if ( rosMLgr == 0 ) {
674 std::unique_ptr<std::vector<int> > newVector(
new std::vector<int>);
675 rosMLgr = newVector.get();
676 localCache->grROS.insert( cellKey.begin(), cellKey.end(),
679 rosMLgr->push_back( entryNum );
682 if ( ( key < 0x3fffffff ) &&
683 ( val > 0x3fffffff ) ) {
686 chanKey.push_back( link.
dduId );
687 chanKey.push_back( link.
rosId );
688 localCache->rgDDU.insert( chanKey.begin(), chanKey.end(), entryNum );
691 std::vector<int>* dduMLgr;
693 dduEntries.find( mapId );
694 if ( dduEntIter == dduEntries.end() )
695 dduEntries.insert( std::pair<
int,std::vector<int>*>( mapId,
696 dduMLgr =
new std::vector<int> ) );
697 else dduMLgr = dduEntIter->second;
698 dduMLgr->push_back( entryNum );
704 if ( defaultValue != 0 ) {
705 for ( entryNum = 0; entryNum < entryMax; entryNum++ ) {
707 readOutChannelDriftTubeMap[entryNum] );
709 if ( key != rosMapKey )
continue;
710 int mapId = link.
rosId;
714 std::vector<int>* dduMLgr;
716 dduEntries.find( mapId );
717 if ( dduEntIter != dduEntries.end() ) dduMLgr = dduEntIter->second;
719 std::vector<int>::const_iterator dduIter = dduMLgr->begin();
720 std::vector<int>::const_iterator dduIend = dduMLgr->end();
721 while( dduIter != dduIend ) {
722 int ientry = *dduIter++;
724 readOutChannelDriftTubeMap[ientry] );
727 if ( wheelId == defaultValue ) wheelId = lros.
wheelId;
728 if ( sectorId == defaultValue ) sectorId = lros.
sectorId;
730 cellKey.push_back( mapId );
731 cellKey.push_back( wheelId );
732 cellKey.push_back( sectorId );
733 std::vector<int>* dduMLgr = 0;
734 localCache->grDDU.find( cellKey.begin(), cellKey.end(), dduMLgr );
735 if ( dduMLgr == 0 ) {
736 std::unique_ptr<std::vector<int> > newVector(
new std::vector<int>);
737 dduMLgr = newVector.get();
738 localCache->grDDU.insert( cellKey.begin(), cellKey.end(),
741 dduMLgr->push_back( ientry );
749 while ( dduEntIter != dduEntIend ) {
750 const std::pair<int,std::vector<int>*>& dduEntry = *dduEntIter++;
751 delete dduEntry.second;
754 localCache->rgBuf.clear();
755 localCache->grBuf.clear();
758 atomicCache().set(
std::move(localCache));
std::string robMapVersion
const_iterator end() const
int readOutToGeometry(int dduId, int rosId, int robId, int tdcId, int channelId, DTWireId &wireId) const
transform identifiers
std::string mapNameRG() const
int layer() const
Return the layer number.
std::vector< DTReadOutGeometryLink >::const_iterator const_iterator
Access methods to the connections.
std::vector< DTReadOutGeometryLink > readOutChannelDriftTubeMap
edm::ConstRespectingPtr< DTBufferTree< int, int > > grBuf
const std::string & mapCellTdc() const
access parent maps identifiers
edm::ConstRespectingPtr< DTBufferTree< int, int > > rgBuf
int superLayer() const
Return the superlayer number.
const_iterator begin() 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
int wire() const
Return the wire number.
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
const std::string & mapRobRos() const
static DTReadOutMapping * expandMap(const DTReadOutMapping &compMap)
void cacheMap() const
read and store full content
int insert(ElementKey fKey, ElementKey lKey, Content cont)
std::string cellMapVersion
std::string mapNameGR() const
int station() const
Return the station number.
int wheel() const
Return the wheel number.
const DTReadOutMapping * fullMap() const
Expand to full map.