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 std::vector<DTMapEntry>::const_iterator itdc = entryList.end();
00136 while ( iter != iend ) {
00137 const DTMapEntry& rosEntry( *iter++ );
00138 if ( rosEntry.k1 > 0x3fffffff ) continue;
00139 ddu = rosEntry.k1;
00140 ros = rosEntry.k2;
00141 whe = rosEntry.v1;
00142 def = rosEntry.v2;
00143 sec = rosEntry.v3;
00144 rob = rosEntry.v4;
00145 mt1 = rosEntry.v5;
00146 mi1 = rosEntry.v6;
00147 iros = entryList.begin();
00148 while ( iros != iend ) {
00149 wha = whe;
00150 sea = sec;
00151 const DTMapEntry& rchEntry( *iros++ );
00152 if ( ( rchEntry.k1 != mt1 ) ||
00153 ( rchEntry.k2 != mi1 ) ) continue;
00154 rch = rchEntry.k3;
00155 if ( rchEntry.v1 != def ) wha = rchEntry.v1;
00156 sta = rchEntry.v2;
00157 if ( rchEntry.v3 != def ) sea = rchEntry.v3;
00158 rob = rchEntry.v4;
00159 mt2 = rchEntry.v5;
00160 mi2 = rchEntry.v6;
00161 irob = entryList.begin();
00162 while ( irob != iend ) {
00163 const DTMapEntry& robEntry( *irob++ );
00164 if ( ( robEntry.k1 != mt2 ) ||
00165 ( robEntry.k2 != mi2 ) ) continue;
00166 if ( robEntry.k3 != rob ) {
00167 std::cout << "ROB mismatch " << rob << " "
00168 << robEntry.k3 << std::endl;
00169 }
00170 tdc = robEntry.k4;
00171 tch = robEntry.k5;
00172 qua = robEntry.v4;
00173 lay = robEntry.v5;
00174 cel = robEntry.v6;
00175 std::cout << ddu << " "
00176 << ros << " "
00177 << rch << " "
00178 << tdc << " "
00179 << tch << " "
00180 << wha << " "
00181 << sta << " "
00182 << sea << " "
00183 << qua << " "
00184 << lay << " "
00185 << cel << std::endl;
00186 }
00187 }
00188 }
00189
00190 return;
00191
00192 }
00193
00194