+ nbBusPatch++;
+ }
+
+ // station 3
+ // for buspatch length reasons, one ddl connects one 1/4 of two chambers
+ // really messy isn't it ?
+ // much more with the new DDL sharing for station 3
+
+ if (idDE < 700 ) {
+
+ if (idDE % 100 == 0) {
+ cout << "# Chamber " << idDE/100 << endl;
+ out << "# Chamber " << idDE/100 << endl;
+ }
+
+ // chamber 5
+ if (idDE == 500 ) {
+ iDDL = (idDE/100)*2+2;
+ begin[cursor] = AliMpBusPatch::GetGlobalBusID(1, iDDL-1);
+
+ end[cursor] = begin[cursor] + nbBusPatch - 1;
+ ++cursor;
+ begin[cursor] = end[cursor-1] + 1;
+
+ cout << idDE << " " << begin[cursor-1]<<"-"<<end[cursor-1] << " " << iDDL-1 << " " <<nameSlat <<endl;
+ out << idDE << " " << begin[cursor-1]<<"-"<<end[cursor-1] <<" " << iDDL-1 <<endl;
+ }
+
+ if (idDE >= idCh5swp1 && idDE < idCh5swp2) {
+
+ if ( idDE == idCh5swp1) {
+ iDDL = (idDE/100)*2 ;
+ begin[cursor] = AliMpBusPatch::GetGlobalBusID(offsetBusCh5swp1, iDDL-1);
+ }
+
+ end[cursor] = begin[cursor] - nbBusPatch + 1;
+ ++cursor;
+ begin[cursor] = end[cursor-1] - 1;
+
+ cout << idDE << " " << end[cursor-1]<<"-"<<begin[cursor-1] << " " << iDDL-1 << " " <<nameSlat <<endl;
+ out << idDE << " " << end[cursor-1]<<"-"<<begin[cursor-1] <<" " << iDDL-1 <<endl;
+ }
+
+ if (idDE >= idCh5swp2 && idDE < idCh5swp3) {
+
+ if (idDE == idCh5swp2) {
+ iDDL = (idDE/100)*2-1;
+ begin[cursor] = AliMpBusPatch::GetGlobalBusID(1, iDDL-1);
+ }
+
+ end[cursor] = begin[cursor] + nbBusPatch - 1;
+ ++cursor;
+ begin[cursor] = end[cursor-1] + 1;
+
+ cout << idDE << " " << begin[cursor-1]<<"-"<<end[cursor-1] << " " << iDDL-1 << " " <<nameSlat <<endl;
+ out << idDE << " " << begin[cursor-1]<<"-"<<end[cursor-1] <<" " << iDDL-1 <<endl;
+ }
+
+ if (idDE >= idCh5swp3 && idDE < idCh5swp4) {
+
+ if (idDE == idCh5swp3) {
+ iDDL = (idDE/100)*2+1;
+ begin[cursor] = AliMpBusPatch::GetGlobalBusID(1, iDDL-1);
+ }
+
+ end[cursor] = begin[cursor] + nbBusPatch - 1;
+ ++cursor;
+ begin[cursor] = end[cursor-1] + 1;
+
+ cout << idDE << " " << begin[cursor-1]<<"-"<<end[cursor-1] << " " << iDDL-1 << " " <<nameSlat <<endl;
+ out << idDE << " " << begin[cursor-1]<<"-"<<end[cursor-1] <<" " << iDDL-1 <<endl;
+ }
+
+ if (idDE >= idCh5swp4 && idDE < 600) {
+
+ if ( idDE == idCh5swp4) {
+ iDDL = (idDE/100)*2+2 ;
+ begin[cursor] = AliMpBusPatch::GetGlobalBusID(offsetBusCh5swp2, iDDL-1);
+ }
+
+ end[cursor] = begin[cursor] - nbBusPatch + 1;
+ ++cursor;
+ begin[cursor] = end[cursor-1] - 1;
+
+ cout << idDE << " " << end[cursor-1]<<"-"<<begin[cursor-1] << " " << iDDL-1 << " " <<nameSlat <<endl;
+ out << idDE << " " << end[cursor-1]<<"-"<<begin[cursor-1] <<" " << iDDL-1 <<endl;
+ }
+
+ // chamber 6
+ if (idDE >= idCh6swp1 && idDE < idCh6swp2) {
+
+ if ( idDE == idCh6swp1) {
+ iDDL = (idDE/100)*2-2 ;
+ begin[cursor] = AliMpBusPatch::GetGlobalBusID(offsetBusCh5swp1+offsetBusCh6swp1, iDDL-1);
+ }
+
+ end[cursor] = begin[cursor] - nbBusPatch + 1;
+ ++cursor;
+ begin[cursor] = end[cursor-1] - 1;
+
+ cout << idDE << " " << end[cursor-1]<<"-"<<begin[cursor-1] << " " << iDDL-1 << " " <<nameSlat <<endl;
+ out << idDE << " " << end[cursor-1]<<"-"<<begin[cursor-1] <<" " << iDDL-1 <<endl;
+ }
+
+ if (idDE >= idCh6swp2 && idDE < idCh6swp3) {
+
+ if (idDE == idCh6swp2) {
+ iDDL = (idDE/100)*2-3;
+ begin[cursor] = AliMpBusPatch::GetGlobalBusID(offsetBusCh5swp2+1, iDDL-1);
+ }
+
+ end[cursor] = begin[cursor] + nbBusPatch - 1;
+ ++cursor;
+ begin[cursor] = end[cursor-1] + 1;
+
+ cout << idDE << " " << begin[cursor-1]<<"-"<<end[cursor-1] << " " << iDDL-1 << " " <<nameSlat <<endl;
+ out << idDE << " " << begin[cursor-1]<<"-"<<end[cursor-1] <<" " << iDDL-1 <<endl;
+ }
+
+ if (idDE >= idCh6swp3 && idDE < idCh6swp4) {
+
+ if (idDE == idCh6swp3) {
+ iDDL = (idDE/100)*2-1;
+ begin[cursor] = AliMpBusPatch::GetGlobalBusID(offsetBusCh5swp1+1, iDDL-1);
+ }
+
+ end[cursor] = begin[cursor] + nbBusPatch - 1;
+ ++cursor;
+ begin[cursor] = end[cursor-1] + 1;
+
+ cout << idDE << " " << begin[cursor-1]<<"-"<<end[cursor-1] << " " << iDDL-1 << " " <<nameSlat <<endl;
+ out << idDE << " " << begin[cursor-1]<<"-"<<end[cursor-1] <<" " << iDDL-1 <<endl;
+ }
+
+ if (idDE >= idCh6swp4 && idDE < 700) {
+
+ if ( idDE == idCh6swp4) {
+ iDDL = (idDE/100)*2 ;
+ begin[cursor] = AliMpBusPatch::GetGlobalBusID(offsetBusCh5swp2+offsetBusCh6swp2, iDDL-1);
+ }
+
+ end[cursor] = begin[cursor] - nbBusPatch + 1;
+ ++cursor;
+ begin[cursor] = end[cursor-1] - 1;
+
+ cout << idDE << " " << end[cursor-1]<<"-"<<begin[cursor-1] << " " << iDDL-1 << " " <<nameSlat <<endl;
+ out << idDE << " " << end[cursor-1]<<"-"<<begin[cursor-1] <<" " << iDDL-1 <<endl;
+ }