Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include "CondCore/DTPlugins/interface/DTCompactMapPluginHandler.h"
00014
00015
00016
00017
00018 #include "CondFormats/DTObjects/interface/DTReadOutMapping.h"
00019
00020
00021
00022
00023 #include <iostream>
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 DTCompactMapPluginHandler::DTCompactMapPluginHandler() {
00034
00035
00036
00037
00038
00039
00040 }
00041
00042
00043
00044
00045
00046 DTCompactMapPluginHandler::~DTCompactMapPluginHandler() {
00047 }
00048
00049
00050
00051
00052
00053 void DTCompactMapPluginHandler::build() {
00054 if ( instance == 0 ) instance = new DTCompactMapPluginHandler;
00055 }
00056
00057
00058 DTReadOutMapping* DTCompactMapPluginHandler::expandMap( const DTReadOutMapping& compMap ) {
00059 std::vector<DTReadOutGeometryLink> entryList;
00060 DTReadOutMapping::const_iterator compIter = compMap.begin();
00061 DTReadOutMapping::const_iterator compIend = compMap.end();
00062 while ( compIter != compIend ) entryList.push_back( *compIter++ );
00063
00064 std::string
00065 rosMap = "expand_";
00066 rosMap += compMap.mapRobRos();
00067 std::string
00068 tdcMap = "expand_";
00069 tdcMap += compMap.mapCellTdc();
00070 DTReadOutMapping* fullMap = new DTReadOutMapping( tdcMap, rosMap );
00071 int ddu;
00072 int ros;
00073 int rch;
00074 int tdc;
00075 int tch;
00076 int whe;
00077 int sta;
00078 int sec;
00079 int rob;
00080 int qua;
00081 int lay;
00082 int cel;
00083 int mt1;
00084 int mi1;
00085 int mt2;
00086 int mi2;
00087 int def;
00088 int wha;
00089 int sea;
00090 std::vector<DTReadOutGeometryLink>::const_iterator iter = entryList.begin();
00091 std::vector<DTReadOutGeometryLink>::const_iterator iend = entryList.end();
00092 std::vector<DTReadOutGeometryLink>::const_iterator iros = entryList.end();
00093 std::vector<DTReadOutGeometryLink>::const_iterator irob = entryList.end();
00094 while ( iter != iend ) {
00095 const DTReadOutGeometryLink& rosEntry( *iter++ );
00096 if ( rosEntry.dduId > 0x3fffffff ) continue;
00097 ddu = rosEntry.dduId;
00098 ros = rosEntry.rosId;
00099 whe = rosEntry.wheelId;
00100 def = rosEntry.stationId;
00101 sec = rosEntry.sectorId;
00102 rob = rosEntry.slId;
00103 mt1 = rosEntry.layerId;
00104 mi1 = rosEntry.cellId;
00105 iros = entryList.begin();
00106 while ( iros != iend ) {
00107 wha = whe;
00108 sea = sec;
00109 const DTReadOutGeometryLink& rchEntry( *iros++ );
00110 if ( ( rchEntry.dduId != mt1 ) ||
00111 ( rchEntry.rosId != mi1 ) ) continue;
00112 rch = rchEntry.robId;
00113 if ( rchEntry.wheelId != def ) wha = rchEntry.wheelId;
00114 sta = rchEntry.stationId;
00115 if ( rchEntry.sectorId != def ) sea = rchEntry.sectorId;
00116 rob = rchEntry.slId;
00117 mt2 = rchEntry.layerId;
00118 mi2 = rchEntry.cellId;
00119 irob = entryList.begin();
00120 while ( irob != iend ) {
00121 const DTReadOutGeometryLink& robEntry( *irob++ );
00122 if ( ( robEntry.dduId != mt2 ) ||
00123 ( robEntry.rosId != mi2 ) ) continue;
00124 if ( robEntry.robId != rob ) {
00125 std::cout << "ROB mismatch " << rob << " "
00126 << robEntry.robId << std::endl;
00127 }
00128 tdc = robEntry.tdcId;
00129 tch = robEntry.channelId;
00130 qua = robEntry.slId;
00131 lay = robEntry.layerId;
00132 cel = robEntry.cellId;
00133 fullMap->insertReadOutGeometryLink( ddu, ros, rch, tdc, tch,
00134 wha, sta, sea,
00135 qua, lay, cel );
00136
00137 }
00138 }
00139 }
00140 return fullMap;
00141 }
00142
00143