00001
00011
00012
00013
00014 #include "CondTools/DT/interface/DTExpandMap.h"
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include <iostream>
00025 #include <fstream>
00026 #include <vector>
00027
00028 class DTMapEntry {
00029
00030 public:
00031
00032 DTMapEntry();
00033 DTMapEntry( int xk1, int xk2, int xk3, int xk4, int xk5,
00034 int xv1, int xv2, int xv3, int xv4, int xv5, int xv6 );
00035 ~DTMapEntry();
00036 int k1;
00037 int k2;
00038 int k3;
00039 int k4;
00040 int k5;
00041 int v1;
00042 int v2;
00043 int v3;
00044 int v4;
00045 int v5;
00046 int v6;
00047
00048 };
00049
00050 DTMapEntry::DTMapEntry():
00051 k1( 0 ),
00052 k2( 0 ),
00053 k3( 0 ),
00054 k4( 0 ),
00055 k5( 0 ),
00056 v1( 0 ),
00057 v2( 0 ),
00058 v3( 0 ),
00059 v4( 0 ),
00060 v5( 0 ),
00061 v6( 0 ) {
00062 }
00063
00064 DTMapEntry::DTMapEntry( int xk1, int xk2, int xk3, int xk4, int xk5,
00065 int xv1, int xv2, int xv3, int xv4, int xv5,
00066 int xv6 ):
00067 k1( xk1 ),
00068 k2( xk2 ),
00069 k3( xk3 ),
00070 k4( xk4 ),
00071 k5( xk5 ),
00072 v1( xv1 ),
00073 v2( xv2 ),
00074 v3( xv3 ),
00075 v4( xv4 ),
00076 v5( xv5 ),
00077 v6( xv6 ) {
00078 }
00079
00080 DTMapEntry::~DTMapEntry() {
00081 }
00082
00083 void DTExpandMap::expandSteering( std::ifstream& file ) {
00084
00085 std::vector<int> key;
00086 int k1;
00087 int k2;
00088 int k3;
00089 int k4;
00090 int k5;
00091 int v1;
00092 int v2;
00093 int v3;
00094 int v4;
00095 int v5;
00096 int v6;
00097
00098 std::vector<DTMapEntry> entryList;
00099 while ( file >> k1 >> k2 >> k3 >> k4 >> k5
00100 >> v1 >> v2 >> v3 >> v4 >> v5 >> v6 ) {
00101 std::vector<int> key;
00102 key.push_back( k1 );
00103 key.push_back( k2 );
00104 key.push_back( k3 );
00105 key.push_back( k4 );
00106 key.push_back( k5 );
00107 DTMapEntry currentEntry( k1, k2, k3, k4, k5,
00108 v1, v2, v3, v4, v5, v6 );
00109 entryList.push_back( currentEntry );
00110 }
00111
00112 int ddu;
00113 int ros;
00114 int rch;
00115 int tdc;
00116 int tch;
00117 int whe;
00118 int sta;
00119 int sec;
00120 int rob;
00121 int qua;
00122 int lay;
00123 int cel;
00124 int mt1;
00125 int mi1;
00126 int mt2;
00127 int mi2;
00128 int def;
00129 int wha;
00130 int sea;
00131 std::vector<DTMapEntry>::const_iterator iter = entryList.begin();
00132 std::vector<DTMapEntry>::const_iterator iend = entryList.end();
00133 std::vector<DTMapEntry>::const_iterator iros = entryList.end();
00134 std::vector<DTMapEntry>::const_iterator irob = entryList.end();
00135 while ( iter != iend ) {
00136 const DTMapEntry& rosEntry( *iter++ );
00137 if ( rosEntry.k1 > 0x3fffffff ) continue;
00138 ddu = rosEntry.k1;
00139 ros = rosEntry.k2;
00140 whe = rosEntry.v1;
00141 def = rosEntry.v2;
00142 sec = rosEntry.v3;
00143 rob = rosEntry.v4;
00144 mt1 = rosEntry.v5;
00145 mi1 = rosEntry.v6;
00146 iros = entryList.begin();
00147 while ( iros != iend ) {
00148 wha = whe;
00149 sea = sec;
00150 const DTMapEntry& rchEntry( *iros++ );
00151 if ( ( rchEntry.k1 != mt1 ) ||
00152 ( rchEntry.k2 != mi1 ) ) continue;
00153 rch = rchEntry.k3;
00154 if ( rchEntry.v1 != def ) wha = rchEntry.v1;
00155 sta = rchEntry.v2;
00156 if ( rchEntry.v3 != def ) sea = rchEntry.v3;
00157 rob = rchEntry.v4;
00158 mt2 = rchEntry.v5;
00159 mi2 = rchEntry.v6;
00160 irob = entryList.begin();
00161 while ( irob != iend ) {
00162 const DTMapEntry& robEntry( *irob++ );
00163 if ( ( robEntry.k1 != mt2 ) ||
00164 ( robEntry.k2 != mi2 ) ) continue;
00165 if ( robEntry.k3 != rob ) {
00166 std::cout << "ROB mismatch " << rob << " "
00167 << robEntry.k3 << std::endl;
00168 }
00169 tdc = robEntry.k4;
00170 tch = robEntry.k5;
00171 qua = robEntry.v4;
00172 lay = robEntry.v5;
00173 cel = robEntry.v6;
00174 std::cout << ddu << " "
00175 << ros << " "
00176 << rch << " "
00177 << tdc << " "
00178 << tch << " "
00179 << wha << " "
00180 << sta << " "
00181 << sea << " "
00182 << qua << " "
00183 << lay << " "
00184 << cel << std::endl;
00185 }
00186 }
00187 }
00188
00189 return;
00190
00191 }
00192
00193