diff --git a/STARTRUN b/STARTRUN index 92b1f6353b..6b624a9e88 100755 --- a/STARTRUN +++ b/STARTRUN @@ -11,7 +11,7 @@ elif [[ $1 == "testrpi" ]]; then elif [[ $1 == "rpi" ]]; then script=./producers/cmshgcal/STARTRUN_RPI elif [[ $1 == "cmshgcal" ]]; then - script=./producers/cmshgcal/STARTRUN + script=./producers/cmshgcal/STARTRUN_tmp elif [[ $1 == "cmshgcal_with_dwc" ]]; then script=./producers/cmshgcal/STARTRUN_WITH_DWC elif [[ $1 == "dwc" ]]; then @@ -21,7 +21,7 @@ elif [[ $1 == "ahcal" ]]; then elif [[ $1 == "all" ]]; then script=./producers/cmshgcal/STARTRUN_ALL elif [[ $1 == "ped" ]]; then - script=./producers/cmshgcal/STARTRUN_PED + script=./producers/cmshgcal/STARTRUN_tmp else # default echo "This producer is not known to me: ${1}. Sorry." diff --git a/producers/cmshgcal/STARTRUN_ALL b/producers/cmshgcal/STARTRUN_ALL index d85ae78442..2a156a277a 100755 --- a/producers/cmshgcal/STARTRUN_ALL +++ b/producers/cmshgcal/STARTRUN_ALL @@ -138,8 +138,7 @@ printf '\033[22;33m\t caliceProducer-scintillator \033[0m \n' flog="../logs/Run${NEWRUNNUM}_AHCALProducer_$dt.log" nohup ./AHCALProducer.exe -n CaliceSc -r tcp://$TLUIP:$RCPORT > $flog 2>&1 & printf "The logs from the AHCALProducer are in $flog file. \n" - -sleep 2 +#sleep 2 ###################################################################### # wire chamber Producer diff --git a/producers/cmshgcal/STARTRUN_RPI b/producers/cmshgcal/STARTRUN_RPI index dc399f185d..ce94361a13 100755 --- a/producers/cmshgcal/STARTRUN_RPI +++ b/producers/cmshgcal/STARTRUN_RPI @@ -103,8 +103,8 @@ printf '\033[22;33m\t cms hgcal *Rpi* Producer \033[0m \n' #xterm -sb -sl 1000 -geom 80x500-200-900 -fn fixed -T "RPI Producer 2" -e './RpiProducer.exe -n RPI-2 -r tcp://$HOSTIP:$RCPORT' & -flog="../logs/Run${NEWRUNNUM}_RpiProducer_RDB2_$dt.log" -nohup ./RpiProducer.exe -n RPI-BRD2 -r tcp://$HOSTIP:$RCPORT > $flog 2>&1 & +flog="../logs/Run${NEWRUNNUM}_RpiProducer_RDB3_$dt.log" +nohup ./RpiProducer.exe -n RPI-BRD3 -r tcp://$HOSTIP:$RCPORT > $flog 2>&1 & printf "The logs from the RPiProducer are in $flog file. \n" #flog="../logs/Run${NEWRUNNUM}_RpiProducer_RDB3_$dt.log" diff --git a/producers/cmshgcal/conf/AllInOneProducer.conf b/producers/cmshgcal/conf/AllInOneProducer.conf index f531a7ace8..a53951ae7e 100644 --- a/producers/cmshgcal/conf/AllInOneProducer.conf +++ b/producers/cmshgcal/conf/AllInOneProducer.conf @@ -11,7 +11,7 @@ SaveLevel = EXTRA PrintLevel = DEBUG [Producer.CMS-HGCAL] -UhalLogLevel = 5 +UhalLogLevel = 3 DataBlockSize = 30787 AcquisitionMode = 1 #0 for DEBUG mode with print out and pause, 1 for beam test @@ -84,7 +84,7 @@ triggerMatchMode = 1 emptyEventEnable = 1 edgeDetectionMode = 2 timeResolution = 3 -maxHitsPerEvent = 9 +maxHitsPerEvent = 129 enabledChannels = 0xFFFF windowWidth = 0x40 windowOffset = -20 @@ -114,8 +114,8 @@ channel_15 = 1 dwc1_left_channel = 0 dwc1_right_channel = 1 -dwc1_down_channel = 2 -dwc1_up_channel = 3 +dwc1_down_channel = 3 +dwc1_up_channel = 2 dwc2_left_channel = 4 dwc2_right_channel = 5 dwc2_down_channel = 6 @@ -131,99 +131,3 @@ dwc4_up_channel = 8 slope_x = 0.2 slope_y = 0.2 - - -[Producer.RPI-BRD2] -RDBOARD = 2 -#RPI_1_IP = '127.0.0.1' -# svhgcal01: -#RPI_1_IP = '128.141.151.253' -# Main RPI on the ReadOut board:: -RPI_1_IP = '192.168.222.112' -# Spare RPI: -#RPI_1_IP = '192.168.222.99' - -# Other addresses for tests: -#RPI_1_IP = '128.141.196.154' -#RPI_1_IP = '128.141.196.225' -#RPI_1_IP = '128.141.149.196' - -# These should not be changed: -portTCP = '55211' -portUDP = '55212' - -# Instead of IP addresses, we use aliases for SSH for clarity. The alias-to-IP-address correspondence is defined here: $HOME/.ssh/config -piSynch_IP = "piS" -piRDOUT1_IP = "pi1" -piRDOUT2_IP = "pi2" -piRDOUT3_IP = "pi3" -piRDOUT4_IP = "pi4" - -# Mask for which RDOUT boards to configure, as a string of 1s and 0s. 1 = enable, 0 = disable; leftmost digit is assumed to correspond to the board with IP = piRDOUT1_IP. For example, "0010" enables configuring only piRDOUT3, "1100" configures piRDOUT1 and piRDOUT2, etc. -RDOUTMask = "0000" - -# Hardcoded SKIROC configuration strings for individual RDOUT boards. The script is executed in the following format: -# source targetDirPath_Skirocs/resetConfiguration_Skirocs_exe_fileName INDICES_STRING -# where INDICES_STRING is the following: -# skirocIndices_RDOUT1 = "1 3 2 4" -# skirocIndices_RDOUT2 = "1 3 2 4" -# skirocIndices_RDOUT3 = "1 3 2 4" -# skirocIndices_RDOUT4 = "1 3 2 4" -skirocIndices_RDOUT1 = " " -skirocIndices_RDOUT2 = " " -skirocIndices_RDOUT3 = "0 1 2 3 4" -skirocIndices_RDOUT4 = " " - -sourceDirPath_Synch = "/home/daq/forConfiguration_EUDAQ/sourceDir_Synch" -targetDirPath_Synch = "/home/pi/forConfiguration_EUDAQ/targetDir_Synch" -resetConfiguration_Synch_exe_fileName = "resetConfiguration_Synch.sh" -sourceDirPath_Readout = "/home/daq/forConfiguration_EUDAQ/sourceDir_Readout" -targetDirPath_Readout = "/home/pi/forConfiguration_EUDAQ/targetDir_Readout" -resetConfiguration_Readout_exe_fileName = "resetConfiguration_Readout.sh" -sourceDirPath_Skirocs = "/home/daq/forConfiguration_EUDAQ/sourceDir_Skirocs" -targetDirPath_Skirocs = "/home/pi/forConfiguration_EUDAQ/targetDir_Skirocs" -resetConfiguration_Skirocs_exe_fileName = "resetConfiguration_Skirocs.sh" - - -[Producer.RPI-BRD3] - -RDBOARD = 3 - -# Main RPI on the ReadOut board:: -RPI_1_IP = '192.168.222.113' - -# These should not be changed: -portTCP = '55511' -portUDP = '55512' - -# Instead of IP addresses, we use aliases for SSH for clarity. The alias-to-IP-address correspondence is defined here: $HOME/.ssh/config -piSynch_IP = "piS" -piRDOUT1_IP = "pi1" -piRDOUT2_IP = "pi2" -piRDOUT3_IP = "pi3" -piRDOUT4_IP = "pi4" - -# Mask for which RDOUT boards to configure, as a string of 1s and 0s. 1 = enable, 0 = disable; leftmost digit is assumed to correspond to the board with IP = piRDOUT1_IP. For example, "0010" enables configuring only piRDOUT3, "1100" configures piRDOUT1 and piRDOUT2, etc. -RDOUTMask = "0000" - -# Hardcoded SKIROC configuration strings for individual RDOUT boards. The script is executed in the following format: -# source targetDirPath_Skirocs/resetConfiguration_Skirocs_exe_fileName INDICES_STRING -# where INDICES_STRING is the following: -# skirocIndices_RDOUT1 = "1 3 2 4" -# skirocIndices_RDOUT2 = "1 3 2 4" -# skirocIndices_RDOUT3 = "1 3 2 4" -# skirocIndices_RDOUT4 = "1 3 2 4" -skirocIndices_RDOUT1 = " " -skirocIndices_RDOUT2 = " " -skirocIndices_RDOUT3 = "0 1 2 3 4" -skirocIndices_RDOUT4 = " " - -sourceDirPath_Synch = "/home/daq/forConfiguration_EUDAQ/sourceDir_Synch" -targetDirPath_Synch = "/home/pi/forConfiguration_EUDAQ/targetDir_Synch" -resetConfiguration_Synch_exe_fileName = "resetConfiguration_Synch.sh" -sourceDirPath_Readout = "/home/daq/forConfiguration_EUDAQ/sourceDir_Readout" -targetDirPath_Readout = "/home/pi/forConfiguration_EUDAQ/targetDir_Readout" -resetConfiguration_Readout_exe_fileName = "resetConfiguration_Readout.sh" -sourceDirPath_Skirocs = "/home/daq/forConfiguration_EUDAQ/sourceDir_Skirocs" -targetDirPath_Skirocs = "/home/pi/forConfiguration_EUDAQ/targetDir_Skirocs" -resetConfiguration_Skirocs_exe_fileName = "resetConfiguration_Skirocs.sh" diff --git a/producers/cmshgcal/conf/RpiProducer.conf b/producers/cmshgcal/conf/RpiProducer.conf index 66f99962a7..63177e6803 100644 --- a/producers/cmshgcal/conf/RpiProducer.conf +++ b/producers/cmshgcal/conf/RpiProducer.conf @@ -15,7 +15,7 @@ RPI_1_IP = "127.0.0.1" # svhgcal01: #RPI_1_IP = '128.141.151.253' # Main RPI on the ReadOut board:: -#RPI_1_IP = '192.168.222.3' +#RPI_1_IP = '192.168.222.113' # Spare RPI: #RPI_1_IP = '192.168.222.99' @@ -51,7 +51,7 @@ resetConfiguration_Skirocs_exe_fileName = "resetConfiguration_Skirocs.sh" [Producer.RPI-BRD3] RDBOARD = 3 -RPI_1_IP = "127.0.0.1" +RPI_1_IP = "192.168.222.113" portTCP = "55311" portUDP = "55312" diff --git a/producers/cmshgcal/onlinemon/src/HexagonHistos.cc b/producers/cmshgcal/onlinemon/src/HexagonHistos.cc index 06076b1ad7..275298f413 100644 --- a/producers/cmshgcal/onlinemon/src/HexagonHistos.cc +++ b/producers/cmshgcal/onlinemon/src/HexagonHistos.cc @@ -243,40 +243,50 @@ void HexagonHistos::Fill(const eudaq::StandardPlane &plane, int evNumber) { // ----- Maskig noisy channels ---- // These are noisy pixels in every hexaboard. Let's just mask them from DQM. // Upd Sept. 2017: after disabling LED, those are not noisy anymore in all module, except "May" - if ( (_sensor=="HexaBoard-RDB1" && _id==4 ) && + if ( (_sensor=="HexaBoard-RDB1" && _id==0 ) && pixel_x==3 && (pixel_y==32 || pixel_y==48)) continue; + // May module: + if ( (_sensor=="HexaBoard-RDB1" && _id==0 ) && + ( (pixel_x==0 && pixel_y==0 ) || (pixel_x==0 && pixel_y==2 ) || + (pixel_x==0 && pixel_y==4 ) || (pixel_x==0 && pixel_y==6 ) || + (pixel_x==1 && pixel_y==0 ) )) + continue; + // Module #63 if ( (_sensor=="HexaBoard-RDB1" && _id==3 ) && - pixel_x==0 && pixel_y==22 ) + ( pixel_x==0 && pixel_y==58 ) || ( pixel_x==0 && pixel_y==22 ) ) continue; - - // Module of May + // Module #75 if ( (_sensor=="HexaBoard-RDB1" && _id==4 ) && - ( (pixel_x==0 && pixel_y==0 ) || (pixel_x==0 && pixel_y==2 ) || (pixel_x==1 && pixel_y==0 ) )) - continue; - - - // Modules #53,55,63,62 - if ( (_sensor=="HexaBoard-RDB1" && (_id==0 || _id==1 || _id==3 || _id==5) ) && ( pixel_x==0 && pixel_y==58 ) ) continue; // Module #38 - if ( _sensor=="HexaBoard-RDB2" && _id==2 && + if ( _sensor=="HexaBoard-RDB2" && _id==0 && ( pixel_x==0 && pixel_y==58 ) || ( pixel_x==0 && pixel_y==22 ) ) continue; - // Module #42 - if ( _sensor=="HexaBoard-RDB2" && _id==3 && - ( pixel_x==1 && pixel_y==4 ) ) + // Module #46 + if ( _sensor=="HexaBoard-RDB2" && _id==2 && + ( pixel_x==0 && pixel_y==58 ) ) + continue; + + // Module #62 + if ( _sensor=="HexaBoard-RDB2" && _id==5 && + ( pixel_x==0 && pixel_y==58 ) ) continue; - // Module #39 - if ( _sensor=="HexaBoard-RDB3" && _id==0 && - ( pixel_x==0 && pixel_y==22 ) ) + // Module #53: + if ( _sensor=="HexaBoard-RDB2" && _id==1 && + ( pixel_x==0 && pixel_y==58 ) ) + continue; + + // Module #55: + if ( _sensor=="HexaBoard-RDB2" && _id==6 && + ( pixel_x==0 && pixel_y==58 ) ) continue; // All Modules on readout board 3 @@ -284,18 +294,21 @@ void HexagonHistos::Fill(const eudaq::StandardPlane &plane, int evNumber) { ( pixel_x==0 && pixel_y==58 ) ) continue; - // Module #64 + // Module #42 + if ( _sensor=="HexaBoard-RDB3" && _id==3 && + ( pixel_x==1 && pixel_y==4 ) ) + continue; + + // Module #39 if ( _sensor=="HexaBoard-RDB3" && _id==4 && - ( pixel_x==0 && pixel_y==58 ) || ( pixel_x==0 && pixel_y==22 ) ) + ( pixel_x==0 && pixel_y==22 ) ) continue; + // Module #64 + if ( _sensor=="HexaBoard-RDB3" && _id==6 && + ( pixel_x==0 && pixel_y==22 ) ) + continue; - // These are bad on some boards: - //if ( ( _sensor=="HexaBoard-RDB1" && _id==1 || - // _sensor=="HexaBoard-RDB2" && _id==1 || - // _sensor=="HexaBoard-RDB0" && _id==0 ) && - //continue; - // -------- end masking ------------- //std::cout<<" We are getting a pixel with pix="<checkState( (STATES)RDOUT_RDY ) ) continue; if( m_ev==m_triggerController->eventNumber() ) continue; + boost::timer::cpu_timer timerReadout; boost::timer::cpu_times times; eudaq::RawDataEvent ev(EVENT_TYPE,m_run,m_ev); @@ -203,9 +204,10 @@ class HGCalProducer : public eudaq::Producer { // Let's start the scripts needed to be run on RPIs + EUDAQ_INFO("Starting sync_debug.exe on piS"); - + int executionStatus = -99; executionStatus = system("ssh -T piS \" sudo killall sync_debug.exe \""); @@ -229,9 +231,11 @@ class HGCalProducer : public eudaq::Producer { for (int pi=0; pi<3; pi++){ std::string rpiName = "none"; + //if (pi==0) rpiName = "pi2"; if (pi==0) rpiName = "piRBDev"; if (pi==1) rpiName = "pi2"; if (pi==2) rpiName = "pi3"; + //if (pi==3) rpiName = "pi4"; EUDAQ_INFO("Starting new_rdout.exe on "+rpiName); @@ -244,7 +248,7 @@ class HGCalProducer : public eudaq::Producer { EUDAQ_INFO("Successfully killed on "+ rpiName); } - executionStatus = system(("ssh -T "+rpiName+" \" nohup sudo /home/pi/RDOUT_BOARD_IPBus/rdout_software/bin/new_rdout.exe 200 1000000 0 > log.log 2>&1& \" ").data()); + executionStatus = system(("ssh -T "+rpiName+" \" nohup sudo /home/pi/RDOUT_BOARD_IPBus/rdout_software/bin/new_rdout.exe 200 200000 0 > log.log 2>&1& \" ").data()); if (executionStatus != 0) { EUDAQ_ERROR("Error: unable to run exe on "+rpiName); @@ -255,19 +259,20 @@ class HGCalProducer : public eudaq::Producer { } + // End of scripts on RPIs // Do any configuration of the hardware here // Configuration file values are accessible as config.Get(name, default) m_uhalLogLevel = config.Get("UhalLogLevel", 5); m_blockSize = config.Get("DataBlockSize",962); - int mode=config.Get("AcquisitionMode",0); + const int mode=config.Get("AcquisitionMode",0); switch( mode ){ case 0 : m_acqmode = DEBUG; break; case 1 : m_acqmode = BEAMTEST; break; default : m_acqmode = DEBUG; break; } - int n_orms = config.Get("NumberOfORMs",1); + const int n_orms = config.Get("NumberOfORMs",1); std::ostringstream deviceName( std::ostringstream::ate ); for( int iorm=0; iormReadRegister("SKIROC_MASK"); - std::cout << "ORM " << iorm << "\t SKIROC_MASK = " << std::hex<ReadRegister("CONSTANT0"); + + const uint32_t mask=m_rdout_orms[iorm]->ReadRegister("SKIROC_MASK"); + std::cout << "ORM " << iorm << "\t SKIROC_MASK = " <ReadRegister("CONSTANT0"); std::cout << "ORM " << iorm << "\t CONST0 = " << std::hex << cst0 << std::endl; - uint32_t cst1=m_rdout_orms[iorm]->ReadRegister("CONSTANT1"); + const uint32_t cst1=m_rdout_orms[iorm]->ReadRegister("CONSTANT1"); std::cout << "ORM " << iorm << "\t CONST1 = " << std::hex << cst1 << std::endl; @@ -394,15 +399,19 @@ class HGCalProducer : public eudaq::Producer { // // we should also exit. virtual void OnTerminate() { SetStatus(eudaq::Status::LVL_OK, "Terminating..."); - m_state = STATE_GOTOTERM; - + int executionStatus = 0; executionStatus = system("ssh -T piS \" sudo killall sync_debug.exe \""); executionStatus = system("ssh -T piRBDev \" sudo killall new_rdout.exe \""); executionStatus = system("ssh -T pi2 \" sudo killall new_rdout.exe \""); executionStatus = system("ssh -T pi3 \" sudo killall new_rdout.exe \""); - + //executionStatus = system("ssh -T pi4 \" sudo killall new_rdout.exe \""); + + m_triggerController->stopRun(); + + m_state = STATE_GOTOTERM; + eudaq::mSleep(1000); } }; diff --git a/producers/cmshgcal/src/HexaBoardConverterPlugin.cc b/producers/cmshgcal/src/HexaBoardConverterPlugin.cc index d86bc882ff..c41632d6ce 100644 --- a/producers/cmshgcal/src/HexaBoardConverterPlugin.cc +++ b/producers/cmshgcal/src/HexaBoardConverterPlugin.cc @@ -17,8 +17,8 @@ const size_t RAW_EV_SIZE_32 = 123152; -const size_t nSkiPerBoard[3] = {24, 20, 24}; -const uint32_t skiMask[3] = {0xFFFFFF00, 0xFF000FFF, 0x00FFFFFF}; +const size_t nSkiPerBoard[3] = {20, 28, 32}; +const uint32_t skiMask[3] = {0xFFFFF000, 0x0FFFFFFF, 0xFFFFFFFF}; //const uint32_t skiMask[3] = {0xF0F00000, 0xF0F0F0F0, 0x0000F0F0}; //const uint32_t skiMask = 0; @@ -320,8 +320,9 @@ namespace eudaq { // Check that k1 and k2 are consecutive char last = -1; if (k1==12 && k2==0) { last = 0;} - else if (abs(k1-k2)>1) - EUDAQ_WARN("The k1 and k2 are not consecutive! abs(k1-k2) = "+ eudaq::to_string(abs(k1-k2))); + + //else if (abs(k1-k2)>1) + //EUDAQ_WARN("The k1 and k2 are not consecutive! abs(k1-k2) = "+ eudaq::to_string(abs(k1-k2)) +" rollMask="+eudaq::to_hex(r,8)+ " k1="+eudaq::to_string(k1)+" k2="+eudaq::to_string(k2)); //printf("The k1 and k2 are not consecutive! abs(k1-k2) = %d\n", abs(k1-k2)); else last = k1; diff --git a/producers/cmshgcal/src/TriggerController.cc b/producers/cmshgcal/src/TriggerController.cc index d78b6dc9e8..2e412dd415 100644 --- a/producers/cmshgcal/src/TriggerController.cc +++ b/producers/cmshgcal/src/TriggerController.cc @@ -67,13 +67,20 @@ void TriggerController::run() void TriggerController::runDebug() { - for( std::vector::iterator it=m_rdout_orms.begin(); it!=m_rdout_orms.end(); ++it ) + for( std::vector::iterator it=m_rdout_orms.begin(); it!=m_rdout_orms.end(); ++it ){ + + std::cout << " Before setting RDOUT_DONE register"<<(*it)->getInterface()->id() << "\t BLOCK_READY = " << (*it)->ReadRegister("BLOCK_READY") + <<" RDOUT_DONE: "<< (*it)->ReadRegister("RDOUT_DONE")<SetRegister("RDOUT_DONE",RDOUT_DONE_MAGIC); + } while(1){ if( m_state==END_RUN ) break; bool rdout_ready=true; + int iter=0; for( std::vector::iterator it=m_rdout_orms.begin(); it!=m_rdout_orms.end(); ++it ){ - std::cout << (*it)->getInterface()->id() << "\t BLOCK_READY = " << (*it)->ReadRegister("BLOCK_READY") << std::endl; + std::cout << (*it)->getInterface()->id() << "\t BLOCK_READY = " << (*it)->ReadRegister("BLOCK_READY") + <<" RDOUT_DONE: "<< (*it)->ReadRegister("RDOUT_DONE")<< " iter="<ReadRegister("BLOCK_READY")!=1 ) rdout_ready=false; } diff --git a/producers/cmshgcal_dwc/src/WireChamberConverterPlugin.cc b/producers/cmshgcal_dwc/src/WireChamberConverterPlugin.cc index 34fe44dc69..aee66b44df 100644 --- a/producers/cmshgcal_dwc/src/WireChamberConverterPlugin.cc +++ b/producers/cmshgcal_dwc/src/WireChamberConverterPlugin.cc @@ -84,7 +84,7 @@ namespace eudaq { std::vector wcs; - for (int wc_index=0; wc_index<4; wc_index++) { + for (int wc_index=0; wc_index<1; wc_index++) { float xl, xr, yu, yd; memcpy(&xl, &bl[4*wc_index*4+0], sizeof(xl)); memcpy(&xr, &bl[4*wc_index*4+4], sizeof(xr));