Changeset 12184
- Timestamp:
- 10/17/11 13:23:12 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/gui/RawEventsViewer/RawEventsViewer.cc
r12176 r12184 1 /*2 1 /* 3 2 * QtGl.cpp … … 381 380 exit(-1); 382 381 } 383 ifstream fin1("Trigger-Patches.txt");384 if (!fin1.is_open())385 {386 cout << "Error: file \"Trigger-Patches\" missing. aborting." << endl;387 exit(-1);388 }389 string buf;390 vector<int> patchHW(1440);391 int l = 0;392 while (getline(fin1, buf, '\n'))393 {394 buf = Tools::Trim(buf);395 if (buf[0]=='#')396 continue;397 398 stringstream str(buf);399 for (int i=0; i<9; i++)400 {401 unsigned int n;402 str >> n;403 404 if (n>=patchHW.size())405 continue;406 407 patchHW[n] = l;408 }409 l++;410 }411 if (l!=160)412 cerr << "WARNING - Problems reading Trigger-Patches.txt" << endl;413 382 414 383 assignPixelMap(mypMap); 415 assignTriggerPatchesMap(patchHW);416 417 GLfloat tempPixelsCoords[MAX_NUM_PIXELS][3];418 for (int i=0;i<1440;i++)419 for (int j=0;j<3;j++)420 tempPixelsCoords[hardwareMapping[i]][j] = pixelsCoords[i][j];421 for (int i=0;i<1440;i++)422 for (int j=0;j<3;j++)423 pixelsCoords[i][j] = tempPixelsCoords[i][j];424 425 for (int i=0;i<1440;i++)426 updateNeighbors(i);427 384 buildVerticesList(); 428 385 429 /* ifstream fin1("Trigger-Patches.txt");430 if (!fin1.is_open())431 {432 cout << "Error: file \"Trigger-Patches.txt\" missing. Aborting." << endl;433 exit(-1);434 }435 l=0;436 while (getline(fin1, buf, '\n'))437 {438 buf = Trim(buf);439 if (buf[0]=='#')440 continue;441 442 stringstream str(buf);443 for (int i=0; i<9; i++)444 {445 unsigned int n;446 str >> n;447 448 if (n>=1440)449 continue;450 451 patches[l][i] = hardwareMapping[n];452 }453 l++;454 }*/455 456 buildPatchesIndices();457 float color[3];458 386 for (int i=0;i<160;i++) 459 387 { 460 color[0] = 0.5; color[1] = 0.5; color[2] = 0.3; 388 const float color[3] = { 0.5, 0.5, 0.3 }; 389 461 390 for (int j=0;j<3;j++) 462 391 patchesColor[i][j] = color[j]; 463 392 } 464 465 for (int i=0;i<1440;i++)466 updateNeighbors(i);467 393 468 394 //calibrationLoaded = false; … … 487 413 } 488 414 489 void RawDataViewer::buildPatchesIndices()490 {491 vector<edge>::iterator it;492 bool erased = false;493 // patchesIndices.resize(NTMARK);494 for (int i=0;i<NTMARK;i++)//for all patches495 {496 patchesIndices[i].clear();497 for (int j=0;j<9;j++)//for all cells of the current patch498 {499 // if (patches[i][j] == 690 ||500 // patches[i][j] == 70)501 // continue;502 for (int k=0;k<6;k++)//for all sides of the current cell503 {504 int first = k-1;505 int second = k;506 if (first < 0)507 first = 5;508 erased = false;509 for (it=(patchesIndices[i]).begin(); it != (patchesIndices[i]).end(); it++)//check if this side is here already or not510 {511 if (((*it).first == verticesIndices[patches[i][j]][first] &&512 (*it).second == verticesIndices[patches[i][j]][second]) ||513 ((*it).first == verticesIndices[patches[i][j]][second] &&514 (*it).second == verticesIndices[patches[i][j]][first]))515 {516 patchesIndices[i].erase(it);517 erased = true;518 break;519 }520 }521 if (!erased)522 {523 edge temp;524 temp.first = verticesIndices[patches[i][j]][first];525 temp.second = verticesIndices[patches[i][j]][second];526 patchesIndices[i].push_back(temp);527 }528 }529 }530 }531 }532 415 /************************************************************ 533 416 * PAINT GL. main drawing function. … … 2481 2364 2482 2365 } 2366 2367 /* 2368 class MainWindow : public QMainWindow, protected Ui::MainWindow 2369 { 2370 Q_OBJECT; 2371 2372 public: 2373 MainWindow(QWidget *p=0) : QMainWindow(p) 2374 { 2375 setupUi(this); 2376 } 2377 2378 int SetupConfiguration(Configuration &conf) 2379 { 2380 RawDataViewer *canvas = GLWindow; 2381 2382 if (conf.Has("color.range")) 2383 { 2384 vector<double> value = conf.Vec<double>("color.range"); 2385 if (value.size() != 5) 2386 { 2387 cout << "Error, colorRange option should have exactly 5 double values" << endl; 2388 return -1; 2389 } 2390 for (int i=0;i<5;i++) 2391 canvas->ss[i] = value[i]; 2392 } 2393 2394 if (conf.Has("color.red")) 2395 { 2396 vector<double> value = conf.Vec<double>("color.red"); 2397 if (value.size() != 5) 2398 { 2399 cout << "Error, colorRed option should have exactly 5 double values" << endl; 2400 return -1; 2401 } 2402 for (int i=0;i<5;i++) 2403 canvas->rr[i] = value[i]; 2404 } 2405 2406 if (conf.Has("color.green")) 2407 { 2408 vector<double> value = conf.Vec<double>("color.green"); 2409 if (value.size() != 5) 2410 { 2411 cout << "Error, colorGreen option should have exactly 5 double values" << endl; 2412 return -1; 2413 } 2414 for (int i=0;i<5;i++) 2415 canvas->gg[i] = value[i]; 2416 } 2417 2418 if (conf.Has("color.blue")) 2419 { 2420 vector<double> value = conf.Vec<double>("color.blue"); 2421 if (value.size() != 5) 2422 { 2423 cout << "Error, colorBlue option should have exactly 5 double values" << endl; 2424 return -1; 2425 } 2426 for (int i=0;i<5;i++) 2427 canvas->bb[i] = value[i]; 2428 } 2429 2430 colorRange0->setValue(canvas->ss[0]); 2431 colorRange1->setValue(canvas->ss[1]); 2432 colorRange2->setValue(canvas->ss[2]); 2433 colorRange3->setValue(canvas->ss[3]); 2434 colorRange4->setValue(canvas->ss[4]); 2435 redValue0->setValue(canvas->rr[0]); 2436 redValue1->setValue(canvas->rr[1]); 2437 redValue2->setValue(canvas->rr[2]); 2438 redValue3->setValue(canvas->rr[3]); 2439 redValue4->setValue(canvas->rr[4]); 2440 greenValue0->setValue(canvas->gg[0]); 2441 greenValue1->setValue(canvas->gg[1]); 2442 greenValue2->setValue(canvas->gg[2]); 2443 greenValue3->setValue(canvas->gg[3]); 2444 greenValue4->setValue(canvas->gg[4]); 2445 blueValue0->setValue(canvas->bb[0]); 2446 blueValue1->setValue(canvas->bb[1]); 2447 blueValue2->setValue(canvas->bb[2]); 2448 blueValue3->setValue(canvas->bb[3]); 2449 blueValue4->setValue(canvas->bb[4]); 2450 2451 return 0; 2452 } 2453 2454 }; 2455 */ 2456 2483 2457 /************************************************************ 2484 2458 * MAIN PROGRAM FUNCTION. … … 2499 2473 } 2500 2474 2475 /* 2476 MainWindow myUi; 2477 if (myUi.SetupConfiguration(conf)<0) 2478 return -1; 2479 */ 2480 2501 2481 QMainWindow mainWindow; 2502 2482 … … 2555 2535 canvas->bb[i] = value[i]; 2556 2536 } 2557 2558 2537 2559 2538 … … 2564 2543 // QObject::connect(myUi.eventsStepBox, SIGNAL(valueChanged(int)), 2565 2544 // canvas, SLOT(setEventStep(int))); 2566 2567 2545 myUi.colorRange0->setValue(canvas->ss[0]); 2568 2546 myUi.colorRange1->setValue(canvas->ss[1]);
Note:
See TracChangeset
for help on using the changeset viewer.