1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Authors: Jochen Thaeder <thaeder@kip.uni-heidelberg.de> *
5 * for The ALICE Off-line Project. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
16 /** @file AliHLTGUI.cxx
17 @author Jochen Thaeder
19 @brief Qt class for ALICE HLT online Display
28 #include "AliHLTGUI.h"
29 #include "AliHLTTPCDisplayMain.h"
30 #include "AliHLTLogging.h"
31 #include "AliHLTTPCDigitReaderRaw.h"
33 #include <TQtWidget.h>
36 #include <qcheckbox.h>
38 #include <qbuttongroup.h>
39 #include <qgroupbox.h>
40 #include <qpushbutton.h>
41 #include <qlineedit.h>
42 #include <qlistview.h>
44 #include <qtabwidget.h>
56 // -- standard constructor
57 //____________________________________________________________________________________________________
58 AliHLTGUI::AliHLTGUI()
65 residualsWidget(NULL),
72 padrow_padWidget(NULL),
77 // -- not a valid copy constructor, defined according to effective C++ style
78 //____________________________________________________________________________________________________
79 AliHLTGUI::AliHLTGUI(const AliHLTGUI& srcGUI)
81 fDisplay(srcGUI.fDisplay),
82 fHostnames(srcGUI.fHostnames),
83 fPorts(srcGUI.fPorts),
84 padrowWidget(srcGUI.padrowWidget),
85 padWidget(srcGUI.padWidget),
86 residualsWidget(srcGUI.residualsWidget),
87 chargeWidget(srcGUI.chargeWidget),
88 threeDWidget(srcGUI.threeDWidget),
89 frontWidget(srcGUI.frontWidget),
90 hits_sWidget(srcGUI.hits_sWidget),
91 q_trackWidget(srcGUI.q_trackWidget),
92 q_sWidget(srcGUI.q_sWidget),
93 padrow_padWidget(srcGUI.padrow_padWidget),
94 fEventLoop(srcGUI.fEventLoop)
96 HLTFatal("copy constructor not implemented");
99 // -- not a valid assignment op, but defined according to effective C++ style
100 //____________________________________________________________________________________________________
101 AliHLTGUI& AliHLTGUI::operator=(const AliHLTGUI&) {
102 HLTFatal("assignment operator not implemented");
107 //____________________________________________________________________________________________________
108 AliHLTGUI::AliHLTGUI( Int_t argc, Char_t **argv )
115 residualsWidget(NULL),
122 padrow_padWidget(NULL),
125 cout << "Creating display" << endl;
128 padrowWidget = tQtWidgetPadRow;
129 residualsWidget = tQtWidgetResiduals;
130 threeDWidget = tQtWidget3D;
131 padWidget = tQtWidgetPad;
132 chargeWidget = tQtWidgetCharge;
133 frontWidget = tQtWidgetFront;
134 hits_sWidget = tQtWidgetHits_s;
135 q_trackWidget = tQtWidgetq_track;
136 q_sWidget = tQtWidgetQ_s;
137 padrow_padWidget = tQtWidgetPadRow_Pad;
139 AliHLTTPCDisplayMain* display = new AliHLTTPCDisplayMain((void*) this, &AliHLTGUI::callback_setGUIPad);
141 HLTFatal( "ERROR no Display!" );
145 fDisplay = (void*)display;
150 display->RegisterCanvas( charge, chargeWidget->GetCanvas() );
151 display->RegisterCanvas( padrow, padrowWidget->GetCanvas() );
152 display->RegisterCanvas( threeD, threeDWidget->GetCanvas() );
153 display->RegisterCanvas( pad, padWidget->GetCanvas() );
154 display->RegisterCanvas( residuals, residualWidget->GetCanvas() );
155 display->RegisterCanvas( front, frontWidget->GetCanvas() );
156 display->RegisterCanvas( hits_s, hits_sWidget->GetCanvas() );
157 display->RegisterCanvas( q_track, q_trackWidget->GetCanvas() );
158 display->RegisterCanvas( q_s, q_sWidget->GetCanvas() );
159 display->RegisterCanvas( padrow_pad, padrow_padWidget->GetCanvas() );
162 // Set Canvas // TODO : REDO with enum
163 display->SetCanvasCharge(chargeWidget->GetCanvas());
164 display->SetCanvasPadRow(padrowWidget->GetCanvas());
165 display->SetCanvas3D(threeDWidget->GetCanvas());
166 display->SetCanvasPad(padWidget->GetCanvas());
167 display->SetCanvasResiduals(residualsWidget->GetCanvas());
168 display->SetCanvasFront(frontWidget->GetCanvas());
169 display->SetCanvasHits_S(hits_sWidget->GetCanvas());
170 display->SetCanvasQ_Track(q_trackWidget->GetCanvas());
171 display->SetCanvasQ_S(q_sWidget->GetCanvas());
172 #if ALIHLTTPCDISPLAY_VERSION >= 2
173 display->SetCanvasPadRow_Pad(padrow_padWidget->GetCanvas());
179 // -- Timer for Event-Loop
180 // -----------------------
181 fEventLoop = new QTimer( this );
183 HLTFatal( "ERROR no QTimer" );
187 connect( fEventLoop, SIGNAL(timeout()),this, SLOT(nextEvent()) );
189 // -- read commandline arguments and set values in AliHLTTPCDiplayMain
190 // -------------------------------------------------------------------
192 Char_t* cpErr; // error string
193 Int_t errocc = 0; // check if error occured
194 Bool_t connectToSource = kFALSE; // check if connect to source on startup
197 while ( ii < argc ) {
199 // -- raw reader mode
200 if ( !strcmp( argv[ii], "-rawreadermode" ) ) {
201 if ( argc <= ii+1 ) {
202 HLTError( "Raw Reader Mode not specified" );
207 // Int_t readerMode = AliHLTTPCDigitReaderRaw::DecodeMode( argv[ii+1] );
208 // Int_t readerMode = AliHLTTPCDigitReaderRaw::DecodeMode( 1 );
209 Int_t readerMode = 0;
211 HLTError ("Cannot convert rawreadermode specifier '%s'", argv[ii+1]);
216 // display->SetRawReaderMode( readerMode );
222 // -- zero suppression threshold
223 if ( !strcmp( argv[ii], "-adc-threshold" ) ) {
224 if ( argc <= ii+1 ) {
225 HLTError( "adc-threshold not specified" );
230 Int_t sigThresh = strtoul( argv[ii+1], &cpErr ,0 );
232 HLTError("Cannot convert adc-threshold specifier '%s'.", argv[ii+1]);
237 // display->SetZeroSuppressionThreshold(sigThresh);
243 // -- pad occupancy limit
244 if ( !strcmp( argv[ii], "-occupancy-limit" ) ) {
245 if ( argc <= ii+1 ) {
246 HLTError( "occupancy-limit not specified" );
251 Float_t occuLimit = strtof( argv[ii+1], &cpErr );
253 HLTError("Cannot convert occupancy-limit specifier '%s'.", argv[ii+1]);
258 // display->SetOccupancyLimit(occuLimit);
265 if ( !strcmp( argv[ii], "-b-field" ) ) {
266 if ( argc <= ii+1 ) {
267 HLTError( "b-field not specified" );
272 Float_t bfield = strtof( argv[ii+1], &cpErr );
274 HLTError("Cannot convert b-field specifier '%s'.", argv[ii+1]);
279 // display->SetBField( bfield )
286 if ( !strcmp( argv[ii], "-n-time-bins" ) ) {
287 if ( argc <= ii+1 ) {
288 HLTError( "n-time-bins not specified" );
293 Int_t nTimeBins = strtoul( argv[ii+1], &cpErr ,0);
294 // check if already a number, if not check if "tpc" or "sim"
296 if ( !strcmp( argv[ii+1], "sim" ) )
298 else if ( !strcmp( argv[ii+1], "tpc") )
301 HLTError("Cannot convert n-time-bins specifier '%s'.", argv[ii+1]);
307 // display->SetNTimeBins( nTimeBins );
314 if ( !strcmp( argv[ii], "-tcp-source" ) ) {
315 if ( argc <= ii+1 ) {
316 HLTError( "-tcp-source not specified" );
321 Int_t sourceCount = 1;
324 // break if more argc is exceeded
325 if ( argc <= ii+sourceCount ) break;
327 // check is next is new option and source count != 1 ( because at least 1 host:port is needed)
328 if ( strstr( argv[ii + sourceCount], "-" ) ) {
329 if ( sourceCount == 1 ){
330 HLTError( "-tcp-source not specified" );
336 // break if argument is no host:port
337 if ( !strstr( argv[ii + sourceCount], ":" ) ) break;
339 Char_t *host = strtok( argv[ii + sourceCount], ":" );
340 Char_t *port = strtok( NULL, ":" );
343 HLTError("Cannot convert tcp-source specifier '%s'.", argv[ii+1]);
349 fHostnames.push_back( host );
350 fPorts.push_back( port );
353 QListViewItem * item1 = new QListViewItem( hostListView, host, port );
354 hostListView->insertItem(item1);
359 if ( errocc != 0 ) break;
366 if ( !strcmp( argv[ii], "--connect" ) ) {
368 connectToSource = kTRUE;
375 if ( !strcmp( argv[ii], "--help" ) ) {
376 cout << "Usage: AliHLTGUI [OPTON VALUE] ..." << endl;
377 cout << " OPTIONs:\n --------" << endl;
378 cout << " -rawreadermode <mode> Sets the mode for AliHLTDigitReaderRaw, can bei either digit or string." << endl;
379 cout << " -n-time-bins <mode> Sets number of TimeBins for the TPC, can bei either a digit, 'sim' or 'tpc'." << endl;
380 cout << " -adc-threshold <mode> Sets the ADC Threshold for the Zero-Suppression of raw data, should be ADC counts." << endl;
381 cout << " -occupancy-limit <mode> Sets the Occupancy limits for pads, wherby <mode> is [0,1]." << endl;
382 cout << " -b-field <mode> Sets the B-field." << endl;
383 cout << " -tcp-source <host:port> ... Sets Host and Ports to a TCP port of a TCPDumpSubscriber. Multiple Connections can be given." << endl;
384 cout << " -connect Connects already to given TCP-Sources." << endl;
385 cout << " --help Shows the Help Menu." << endl;
386 cout << " --version Prints version of AliHLTGUI" << endl;
392 if ( !strcmp( argv[ii], "--version" ) ) {
393 cout << "Version of AliHLTGUI: " << PACKAGE_VERSION << endl;
399 HLTError( "Unknown Option", "Unknown option '%s'", argv[ii] );
402 } // end while ( ii < argc ) {
406 // if error occured: Print usage and exit
408 cout << "Usage: AliHLTGUI [OPTON VALUE] ..." << endl;
409 cout << " OPTIONs:\n --------" << endl;
410 cout << " -rawreadermode <mode> Sets the mode for AliHLTDigitReaderRaw, can bei either digit or string." << endl;
411 cout << " -n-time-bins <mode> Sets number of TimeBins for the TPC, can bei either a digit, 'sim' or 'tpc'." << endl;
412 cout << " -adc-threshold <mode> Sets the ADC Threshold for the Zero-Suppression of raw data, should be ADC counts." << endl;
413 cout << " -occupancy-limit <mode> Sets the Occupancy limits for pads, wherby <mode> is [0,1]." << endl;
414 cout << " -b-field <mode> Sets the B-field." << endl;
415 cout << " -tcp-source <host:port> ... Sets Host and Ports to a TCP port of a TCPDumpSubscriber. Multiple Connections can be given." << endl;
416 cout << " -connect Connects already to given TCP-Sources." << endl;
417 cout << " --help Shows the Help Menu." << endl;
418 cout << " --version Prints version of AliHLTGUI" << endl;
423 if ( connectToSource ) connectDisplay();
427 //____________________________________________________________________________________________________
428 AliHLTGUI::~AliHLTGUI() {
435 AliHLTTPCDisplayMain* display = (AliHLTTPCDisplayMain*) fDisplay;
442 //____________________________________________________________________________________________________
443 void AliHLTGUI::connectDisplay() {
444 // -- connect to Display class / TCPDumpSubscriber
446 AliHLTTPCDisplayMain* display = (AliHLTTPCDisplayMain*)fDisplay;
450 enableDisplay( display->GetConnectionStatus() );
452 // if connected => diconnect
453 if ( display->GetConnectionStatus() ) {
454 cout << "Disonnecting..." << endl;
455 display->SetConnectionStatus(kFALSE);
457 connectPushButton->setText("Connect");
458 connectTextLabel->setText("DISCONNECTED");
459 connectTextLabel->setPaletteForegroundColor(red);
460 HostListTextLabel->setEnabled(TRUE);
461 hostListView->setEnabled(TRUE);
462 removePushButton->setEnabled(TRUE);
463 addGroupBox->setEnabled(TRUE);
465 eventGroupBox->setEnabled(FALSE);
468 #if ALIHLTTPCDISPLAY_VERSION >= 2
469 display->Disconnect();
471 HLTWarning("disconnect not available for AliHLTTPCDisplay version < 2");
478 cout << "Connecting..." << endl;
481 // -- Set geometry file in AliHLTTPCDisplayMain
482 // --------------------------------------------
483 Char_t * geometryPath = getenv("ALIHLT_TOPDIR");
484 Char_t * geometryFile = "alice.geom";
491 strcat(geoPath,geometryPath);
492 strcat(geoPath,"/TPCLib/OnlineDisplay");
494 else strcat(geoPath,".");
497 strcat(geoPath,geometryFile);
499 // -- Set Hostnames in AliHLTTPCDisplayMain
500 // ----------------------------------------
501 Int_t cnt = fHostnames.size();
504 HLTError( "Error establishing connection: No Hostnames specified" );
505 connectTextLabel->setText("ERROR");
506 connectTextLabel->setPaletteForegroundColor(red);
510 unsigned short* ports = new unsigned short[cnt];
511 const char** hostnames = new const char*[cnt];
513 for ( Int_t i = 0; i < cnt; i++ ) {
514 const char * temp = fHostnames[i].latin1();
516 ports[i] = (unsigned short) atoi(fPorts[i]);
519 Int_t connect = display->Connect( cnt, (const char**) hostnames, ports, geoPath);
524 // check return value
526 connectTextLabel->setText("CONNECTED");
527 connectTextLabel->setPaletteForegroundColor(green);
529 else if (connect == -1){
530 connectTextLabel->setText("NO CHAIN");
531 connectTextLabel->setPaletteForegroundColor(red);
534 else if (connect == -2){
535 connectTextLabel->setText("TIMEOUT");
536 connectTextLabel->setPaletteForegroundColor(red);
540 connectTextLabel->setText("GENERAL ERROR");
541 connectTextLabel->setPaletteForegroundColor(red);
548 // if raw data present
549 if ( display->ExistsRawData() ) {
550 rawZeroGroupBox->setEnabled(TRUE);
551 rawSliceGroupBox->setEnabled(TRUE);
552 padrowGroupBox->setEnabled(TRUE);
553 frontDataButtonGroup->setEnabled(TRUE);
554 frontDisplayButtonGroup->setEnabled(TRUE);
555 padrowCheckBox->setEnabled(TRUE);
556 threeDRawButtonGroup->setEnabled(TRUE);
559 rawZeroGroupBox->setEnabled(FALSE);
560 rawSliceGroupBox->setEnabled(FALSE);
561 padrowGroupBox->setEnabled(FALSE);
562 frontDataButtonGroup->setEnabled(FALSE);
563 frontDisplayButtonGroup->setEnabled(FALSE);
564 padrowCheckBox->setEnabled(FALSE);
565 threeDRawButtonGroup->setEnabled(FALSE);
569 // if cluster data present
570 if ( display->ExistsClusterData() ) {
571 clusterCheckBox->setEnabled(TRUE);
572 clusterPropButtonGroup->setEnabled(TRUE);
575 clusterCheckBox->setEnabled(FALSE);
576 clusterPropButtonGroup->setEnabled(FALSE);
579 // if track data present
580 if ( display->ExistsTrackData() ) {
581 tracksCheckBox->setEnabled(TRUE);
582 trackPropGroupBox->setEnabled(TRUE);
583 selectTrackGroupBox->setEnabled(TRUE);
584 trackParamGroupBox->setEnabled(TRUE);
587 tracksCheckBox->setEnabled(FALSE);
588 trackPropGroupBox->setEnabled(FALSE);
589 selectTrackGroupBox->setEnabled(FALSE);
590 trackParamGroupBox->setEnabled(FALSE);
595 enableDisplay( display->GetConnectionStatus() );
598 connectPushButton->setText("Disconnect");
599 connectTextLabel->setText("READ DATA");
600 connectTextLabel->setPaletteForegroundColor(green);
601 HostListTextLabel->setEnabled(FALSE);
602 hostListView->setEnabled(FALSE);
603 removePushButton->setEnabled(FALSE);
604 addGroupBox->setEnabled(FALSE);
607 eventGroupBox->setEnabled(TRUE);
608 nextEventPushButton->setEnabled(TRUE);
609 redisplayPushButton->setEnabled(TRUE);
610 saveGroupBox->setEnabled(TRUE);
611 sectorButtonGroup->setEnabled(TRUE);
612 threeDGroupBox->setEnabled(TRUE);
616 display->ReadData(kFALSE);
617 display->DisplayEvent();
619 Char_t eventID[256] = "";
620 #if ALIHLTTPCDISPLAY_VERSION >= 2
621 sprintf(eventID,"%Lu",display->GetEventID());
623 sprintf(eventID,"%Lu",0);
624 eventIDTextLabel->setText(eventID);
629 //____________________________________________________________________________________________________
630 void AliHLTGUI::nextEvent(){
631 // -- Display next event
632 AliHLTTPCDisplayMain* display = (AliHLTTPCDisplayMain*)fDisplay;
634 #if ALIHLTTPCDISPLAY_VERSION >= 2
635 ret = display->ReadData();
640 connectTextLabel->setText("NO CHAIN");
641 setPaletteForegroundColor(red);
643 // Stop of Event Loop
644 if (!fEventLoop->isActive()){
646 eventLoopPushButton->setText("Start Loop");
651 else if (ret == -2) {
652 connectTextLabel->setText("TIME OUT");
653 connectTextLabel->setPaletteForegroundColor(red);
655 // Stop of Event Loop
656 if (!fEventLoop->isActive()){
658 eventLoopPushButton->setText("Start Loop");
663 else if (ret == -3) {
664 connectTextLabel->setText("GENERAL ERROR");
665 connectTextLabel->setPaletteForegroundColor(red);
667 // Stop of Event Loop
668 if (!fEventLoop->isActive()){
670 eventLoopPushButton->setText("Start Loop");
676 connectTextLabel->setText("READ DATA");
677 connectTextLabel->setPaletteForegroundColor(green);
680 display->DisplayEvent();
682 Char_t eventID[256] = "";
683 #if ALIHLTTPCDISPLAY_VERSION >= 2
684 sprintf(eventID,"%Lu",display->GetEventID());
686 sprintf(eventID,"%Lu",0);
687 eventIDTextLabel->setText(eventID);
692 //____________________________________________________________________________________________________
693 void AliHLTGUI::eventLoop(){
694 // -- Start / Stop of Event Loop
695 if (!fEventLoop->isActive()){
696 fEventLoop->start(1000 * atoi( eventLoopSpinBox->text() ) );
697 eventLoopPushButton->setText("Stop Loop");
701 eventLoopPushButton->setText("Start Loop");
706 //____________________________________________________________________________________________________
707 void AliHLTGUI::enableDisplay(Bool_t connected){
708 AliHLTTPCDisplayMain* display = (AliHLTTPCDisplayMain*) fDisplay;
710 Bool_t inverseconnected = ~connected; // TODO check!!
712 // if already connected => disconnect
713 // else disconnect => connect
715 HostListTextLabel->setEnabled( connected );
716 hostListView->setEnabled( connected );
717 removePushButton->setEnabled( connected );
718 addGroupBox->setEnabled( connected );
719 eventGroupBox->setEnabled( inverseconnected );
722 cout << "Disonnecting..." << endl;
723 display->SetConnectionStatus( inverseconnected );
725 connectPushButton->setText("Connect");
726 connectTextLabel->setText("DISCONNECTED");
727 connectTextLabel->setPaletteForegroundColor(red);
729 #if ALIHLTTPCDISPLAY_VERSION >= 2
730 display->Disconnect();
732 HLTWarning("disconnect not available for AliHLTTPCDisplay version < 2");
738 else { // connected = false
740 connectPushButton->setText("Disconnect");
741 connectTextLabel->setText("READ DATA");
742 connectTextLabel->setPaletteForegroundColor(green);
745 nextEventPushButton->setEnabled( inverseconnected );
746 redisplayPushButton->setEnabled( inverseconnected );
747 saveGroupBox->setEnabled( inverseconnected );
748 sectorButtonGroup->setEnabled( inverseconnected );
749 threeDGroupBox->setEnabled( inverseconnected );
754 //____________________________________________________________________________________________________
755 void AliHLTGUI::enableDataObjects(){
756 AliHLTTPCDisplayMain* display = (AliHLTTPCDisplayMain*) fDisplay;
758 Bool_t existsRawData = display->ExistsRawData();
759 Bool_t existsClusterData = display->ExistsClusterData();
760 Bool_t existsTrackData = display->ExistsTrackData();
763 rawZeroGroupBox->setEnabled(existsRawData);
764 rawSliceGroupBox->setEnabled(existsRawData);
765 padrowGroupBox->setEnabled(existsRawData);
766 frontDataButtonGroup->setEnabled(existsRawData);
767 frontDisplayButtonGroup->setEnabled(existsRawData);
768 padrowCheckBox->setEnabled(existsRawData);
769 threeDRawButtonGroup->setEnabled(existsRawData);
772 clusterCheckBox->setEnabled(existsClusterData);
773 clusterPropButtonGroup->setEnabled(existsClusterData);
776 tracksCheckBox->setEnabled(existsTrackData);
777 trackPropGroupBox->setEnabled(existsTrackData);
778 selectTrackGroupBox->setEnabled(existsTrackData);
779 trackParamGroupBox->setEnabled(existsTrackData);
782 //____________________________________________________________________________________________________
783 void AliHLTGUI::updateEventLoop(){
784 if (fEventLoop->isActive())
785 fEventLoop->changeInterval(1000 * atoi( eventLoopSpinBox->text() ) );
788 //____________________________________________________________________________________________________
789 void AliHLTGUI::redisplay(Bool_t newRawSlice){
790 // -- ReDisplay current event
791 AliHLTTPCDisplayMain* display = (AliHLTTPCDisplayMain*)fDisplay;
792 #if ALIHLTTPCDISPLAY_VERSION >= 2
793 display->DisplayEvent(newRawSlice);
795 display->DisplayEvent();
801 //____________________________________________________________________________________________________
802 void AliHLTGUI::saveHistograms(){
803 // -- save all Histograms
804 AliHLTTPCDisplayMain* display = (AliHLTTPCDisplayMain*)fDisplay;
805 display->SaveHistograms();
808 //____________________________________________________________________________________________________
809 void AliHLTGUI::addHost(){
810 // -- add host to hostlist
812 fHostnames.push_back( hostnameLineEdit->text() );
813 fPorts.push_back( portSpinBox->text() );
816 QListViewItem * item1 = new QListViewItem(hostListView, hostnameLineEdit->text(), portSpinBox->text() );
817 hostListView->insertItem(item1);
820 //____________________________________________________________________________________________________
821 void AliHLTGUI::removeHost(){
822 // -- remove host from hostlist
823 if (hostListView->selectedItem()) {
824 for ( unsigned i = 0; i < fHostnames.size(); i++ ) {
825 if ( fHostnames[i] == hostListView->selectedItem()->text(0) && fPorts[i] == hostListView->selectedItem()->text(1)){
826 fHostnames.erase( fHostnames.begin()+i );
827 fPorts.erase( fPorts.begin()+i );
830 delete hostListView->selectedItem(); // #########
831 // hostListView->removeItem(hostListView->selectedItem());
835 //----------------------------------------------------------------------------------------------------
836 // SETTER - minor functions
837 //____________________________________________________________________________________________________
838 void AliHLTGUI::setSector(){
839 // -- set sectors to display
840 AliHLTTPCDisplayMain* display = (AliHLTTPCDisplayMain*)fDisplay;
842 Int_t selectSectorID = sectorButtonGroup->selectedId();
845 if (selectSectorID == 0) {
846 display->SetSlices();
847 display->SetTheta(90.);
850 else if (selectSectorID == 4) {
851 display->SetSlices( atoi( oneSpinBox->text() ) );
852 display->SetTheta(0.);
854 // Set RANGE of Sectors
855 else if (selectSectorID == 1) {
856 display->SetSlices( atoi( rangeMinSpinBox->text() ) ,atoi( rangeMaxSpinBox->text() ) );
857 display->SetTheta(90.);
859 // Set PAIR of Sectors
860 else if (selectSectorID == 3) {
861 display->SetSlicesPair(atoi( pairSpinBox->text() ) );
862 display->SetTheta(90.);
864 // Set PAIR RANGE of Sectors
865 else if (selectSectorID == 2) {
866 display->SetSlicesPair(atoi( pairRangeMinSpinBox->text() ) ,atoi( pairRangeMaxSpinBox->text() ) );
867 display->SetTheta(90.);
873 //____________________________________________________________________________________________________
874 void AliHLTGUI::setCluster(){
875 // -- set used/unuse/all cluster
876 AliHLTTPCDisplayMain* display = (AliHLTTPCDisplayMain*)fDisplay;
878 // ALL Cluster = 0 | USED Cluster = 1 | UNUSED Cluster = 2
879 display->SetSelectCluster( clusterPropButtonGroup->selectedId() );
884 //____________________________________________________________________________________________________
885 void AliHLTGUI::setTrack(){
886 // -- set track properties
887 AliHLTTPCDisplayMain* display = (AliHLTTPCDisplayMain*)fDisplay;
889 display->SetCutHits(atoi (cutHitsSpinBox->text() ) );
890 display->SetCutPt( (Float_t) atof (cutPtLineEdit->text() ) );
891 display->SetCutPsi( (Float_t) atof (cutPsiLineEdit->text() ) );
892 display->SetCutLambda( (Float_t) atof (cutLambdaLineEdit->text() ) );
893 display->SetCutS( (Float_t) atof (cutSLineEdit->text() ) );
894 display->SetIncidentPadrow( (Int_t) atoi (cutPadrowLineEdit->text() ) );
898 //____________________________________________________________________________________________________
899 void AliHLTGUI::setInvert(){
900 // -- set invert 3D display
901 AliHLTTPCDisplayMain* display = (AliHLTTPCDisplayMain*)fDisplay;
903 display->SetInvert();
907 //____________________________________________________________________________________________________
908 void AliHLTGUI::setKeepView(){
909 // -- keep angle view
910 AliHLTTPCDisplayMain* display = (AliHLTTPCDisplayMain*)fDisplay;
912 if (keepViewCheckBox->isChecked() ) display->SetKeepView(kTRUE);
913 else display->SetKeepView(kFALSE);
917 void AliHLTGUI::setZeroSuppression(){
918 // -- set Zero Suppresion
919 AliHLTTPCDisplayMain* display = (AliHLTTPCDisplayMain*)fDisplay;
921 #if ALIHLTTPCDISPLAY_VERSION >= 2
922 if (rawZeroCheckBox->isChecked() ) display->SetZeroSuppression(kTRUE);
923 else display->SetZeroSuppression(kFALSE);
925 HLTError("function not available for AliHLTTPCDisplay version < 2");
932 //____________________________________________________________________________________________________
933 void AliHLTGUI::setRawSlice(){
934 // -- set slice for padrow / pad / timebin
935 AliHLTTPCDisplayMain* display = (AliHLTTPCDisplayMain*)fDisplay;
937 display->SetSlicePadRow( atoi (rawSectorSpinBox->text() ) );
939 redisplay(kTRUE/*newRawSlice*/);
942 //____________________________________________________________________________________________________
943 void AliHLTGUI::setPadRow(){
945 AliHLTTPCDisplayMain* display = (AliHLTTPCDisplayMain*)fDisplay;
947 display->SetPadRow(atoi (padrowSpinBox->text() ) );
949 padSpinBox->setMaxValue(display->GetNPads());
950 padSlider->setMaxValue(display->GetNPads());
955 //____________________________________________________________________________________________________
956 void AliHLTGUI::setPad(){
957 // -- set pad, or pad histograms
958 AliHLTTPCDisplayMain* display = (AliHLTTPCDisplayMain*)fDisplay;
960 display->SetPad(atoi (padSpinBox->text() ) );
965 //____________________________________________________________________________________________________
966 void AliHLTGUI::setTimeBin(){
968 AliHLTTPCDisplayMain* display = (AliHLTTPCDisplayMain*)fDisplay;
970 Int_t selectTimebinID = frontDisplayButtonGroup->selectedId();
972 #if ALIHLTTPCDISPLAY_VERSION >= 2
974 if ( selectTimebinID == 3) display->SetTimeBinMinMax(0,display->GetNTimeBins()-1 );
977 else if ( selectTimebinID == 2) display->SetTimeBinMinMax( atoi( oneTimeBinSpinBox->text() ), atoi( oneTimeBinSpinBox->text() ) );
979 // Set RANGE of TimeBins
980 else if ( selectTimebinID == 1) {
981 Int_t min = atoi( minTimeBinSpinBox->text() );
982 Int_t max = atoi( maxTimeBinSpinBox->text() );
986 maxTimeBinSpinBox->setValue(max);
989 display->SetTimeBinMinMax( min , max );
993 HLTError("function not available for AliHLTTPCDisplay version < 2");
999 //____________________________________________________________________________________________________
1000 void AliHLTGUI::selectTimeBinData(){
1001 // -- select max,sum,average of Data
1002 AliHLTTPCDisplayMain* display = (AliHLTTPCDisplayMain*)fDisplay;
1004 Int_t selectFrontDataID = frontDataButtonGroup->selectedId();
1006 #if ALIHLTTPCDISPLAY_VERSION >= 2
1007 // Set use sum in data
1008 if (selectFrontDataID == 0) display->SetFrontDataSwitch(0);
1010 // Set use average in data
1011 else if (selectFrontDataID == 1) display->SetFrontDataSwitch(1);
1013 // Set use maximum in data
1014 else if (selectFrontDataID == 2) display->SetFrontDataSwitch(2);
1016 HLTError("function not available for AliHLTTPCDisplay version < 2");
1022 //____________________________________________________________________________________________________
1023 void AliHLTGUI::setSplitPadRow(){
1024 // -- set split PadRow Canvas
1025 AliHLTTPCDisplayMain* display = (AliHLTTPCDisplayMain*)fDisplay;
1027 if (padrowSplitCheckBox->isChecked() ) display->SetSplitPadRow(kTRUE);
1028 else display->SetSplitPadRow(kFALSE);
1032 //____________________________________________________________________________________________________
1033 void AliHLTGUI::setSplitFront(){
1034 // -- set split Front Canvas
1035 AliHLTTPCDisplayMain* display = (AliHLTTPCDisplayMain*)fDisplay;
1037 #if ALIHLTTPCDISPLAY_VERSION >= 2
1038 if (frontSplitCheckBox->isChecked() ) display->SetSplitFront(kTRUE);
1039 else display->SetSplitFront(kFALSE);
1041 HLTError("function not available for AliHLTTPCDisplay version < 2");
1048 //____________________________________________________________________________________________________
1049 void AliHLTGUI::setAllTimeBins(){
1050 // -- set show all Timebins in front view
1051 AliHLTTPCDisplayMain* display = (AliHLTTPCDisplayMain*)fDisplay;
1053 if (allTimebinCheckBox->isChecked() ) display->SetAllTimebins(kTRUE);
1054 else display->SetAllTimebins(kFALSE);
1060 //____________________________________________________________________________________________________
1061 void AliHLTGUI::setGUIPad(Int_t pad){
1062 // -- set GUI pad value
1063 padSpinBox->setValue(pad);
1066 //____________________________________________________________________________________________________
1067 void AliHLTGUI::set3D(){
1068 // -- set 3D Display
1069 AliHLTTPCDisplayMain* display = (AliHLTTPCDisplayMain*)fDisplay;
1071 if (padrowCheckBox->isChecked()) setPadRow();
1073 display->SetSwitches(tracksCheckBox->isChecked(), clusterCheckBox->isChecked(), padrowCheckBox->isChecked(), geometryCheckBox->isChecked() );
1077 //____________________________________________________________________________________________________
1078 void AliHLTGUI::set3DRaw(){
1079 // -- set 3D Display Raw Properties
1080 AliHLTTPCDisplayMain* display = (AliHLTTPCDisplayMain*)fDisplay;
1082 Int_t selectRawID = threeDRawButtonGroup->selectedId();
1084 #if ALIHLTTPCDISPLAY_VERSION >= 2
1086 if (selectRawID == 0) display->Set3DRawSwitch(0);
1089 else if (selectRawID == 1) display->Set3DRawSwitch(1);
1091 HLTError("function not available for AliHLTTPCDisplay version < 2");
1098 //____________________________________________________________________________________________________
1099 void AliHLTGUI::setSelectTrack(){
1100 // -- turn on /off of single track
1101 AliHLTTPCDisplayMain* display = (AliHLTTPCDisplayMain*)fDisplay;
1103 display->SetSelectTrackSwitch( selectTrackCheckBox->isChecked() );
1105 if (! selectTrackCheckBox->isChecked() ) {
1106 display->SetSelectTrack(0);
1109 else selectTrackSector();
1112 //____________________________________________________________________________________________________
1113 void AliHLTGUI::selectTrackSector(){
1114 // -- select slice for single track
1115 AliHLTTPCDisplayMain* display = (AliHLTTPCDisplayMain*)fDisplay;
1117 Int_t slice = atoi( selectTrackSectorSpinBox->text());
1119 if (display->GetTracksPerSlice(slice) == 0) selectTrackSpinBox->setMaxValue( 0 );
1120 else selectTrackSpinBox->setMaxValue( display->GetTracksPerSlice(slice) - 1 );
1122 selectTrackSpinBox->setValue(0);
1124 display->SetSelectTrackSlice(slice);
1129 //____________________________________________________________________________________________________
1130 void AliHLTGUI::selectTrack(){
1131 // -- select single track in slice
1132 AliHLTTPCDisplayMain* display = (AliHLTTPCDisplayMain*)fDisplay;
1134 display->SetSelectTrack( atoi( selectTrackSpinBox->text() ) );
1139 //____________________________________________________________________________________________________
1140 void AliHLTGUI::displayTrackParam(){
1141 // -- display Track Parameters
1142 AliHLTTPCDisplayMain* display = (AliHLTTPCDisplayMain*)fDisplay;
1144 Char_t nHits[256] = "";
1145 Char_t charge[256] = "";
1146 Char_t kappa[256] = "";
1147 Char_t radius[256] = "";
1148 Char_t slice[256] = "";
1149 Char_t phi0[256] = "";
1150 Char_t psi[256] = "";
1151 Char_t lambda[256]= "";
1152 Char_t pt[256] = "";
1153 Char_t id[256] = "";
1155 if ( display->GetSelectTrackSwitch()
1156 && display->ExistsTrackData()
1157 && display->GetDisplaySlice( atoi(selectTrackSectorSpinBox->text()) )
1158 && display->GetTracksPerSlice( atoi(selectTrackSectorSpinBox->text()) ) > 0 ){
1159 sprintf(kappa,"%f",display->fTrackParam.kappa);
1160 sprintf(nHits,"%d",display->fTrackParam.nHits);
1161 sprintf(charge,"%d",display->fTrackParam.charge);
1162 sprintf(radius,"%f",display->fTrackParam.radius);
1163 sprintf(slice,"%d",display->fTrackParam.slice);
1164 sprintf(phi0,"%f",display->fTrackParam.phi0);
1165 sprintf(psi,"%f",display->fTrackParam.psi);
1166 sprintf(lambda,"%f",display->fTrackParam.lambda);
1167 sprintf(pt,"%f",display->fTrackParam.pt);
1168 sprintf(id,"%d",display->fTrackParam.id);
1171 sprintf(kappa,"%f",0.);
1172 sprintf(nHits,"%d",1);
1173 sprintf(charge,"%d",0);
1174 sprintf(radius,"%f",0.);
1175 sprintf(slice,"%d",0);
1176 sprintf(phi0,"%f",0.);
1177 sprintf(psi,"%f",0.);
1178 sprintf(lambda,"%f",0.);
1179 sprintf(pt,"%f",0.);
1183 trackParamSliceTextLabel->setText(slice);
1184 trackParamIDTextLabel->setText(id);
1185 trackParamKappaTextLabel->setText(kappa);
1186 trackParamPtTextLabel->setText(pt);
1187 trackParamNHitsTextLabel->setText(nHits);
1188 trackParamChargeTextLabel->setText(charge);
1189 trackParamRadiusTextLabel->setText(radius);
1190 trackParamPhi0TextLabel->setText(phi0);
1191 trackParamPsiTextLabel->setText(psi);
1192 trackParamLambdaTextLabel->setText(lambda);