From 5fba5f2bb432cb7249c7b465fbf23b16df65d799 Mon Sep 17 00:00:00 2001 From: "c.wendisch" Date: Tue, 8 Aug 2023 12:53:22 +0200 Subject: [PATCH] xbox config of new FEE --- users/gsi_xbox_mdc/TdcEventBuilder.xml | 4 +- users/gsi_xbox_mdc/TdcEventBuilder_noHLD.xml | 2 +- users/gsi_xbox_mdc/conf_cts.sh | 79 ++-- users/gsi_xbox_mdc/db/addresses_mbo.db | 34 -- users/gsi_xbox_mdc/db/addresses_mdcoep.db | 16 - users/gsi_xbox_mdc/db/register_configgbe.db | 4 +- .../gsi_xbox_mdc/db/register_configgbe_ip.db | 6 +- users/gsi_xbox_mdc/first.C | 18 +- users/gsi_xbox_mdc/read.C | 11 +- users/gsi_xbox_mdc/reset_trb.sh | 5 +- users/gsi_xbox_mdc/second.C | 417 ------------------ users/gsi_xbox_mdc/startGo4.sh | 5 +- users/gsi_xbox_mdc/startup.sh | 86 ++-- 13 files changed, 135 insertions(+), 552 deletions(-) delete mode 100644 users/gsi_xbox_mdc/db/addresses_mbo.db delete mode 100644 users/gsi_xbox_mdc/second.C diff --git a/users/gsi_xbox_mdc/TdcEventBuilder.xml b/users/gsi_xbox_mdc/TdcEventBuilder.xml index bc5e421..630bbf2 100644 --- a/users/gsi_xbox_mdc/TdcEventBuilder.xml +++ b/users/gsi_xbox_mdc/TdcEventBuilder.xml @@ -95,7 +95,7 @@ When starting analysis from the go4 gui, one should specify stream server with p - + @@ -126,7 +126,7 @@ When starting analysis from the go4 gui, one should specify stream server with p - + diff --git a/users/gsi_xbox_mdc/TdcEventBuilder_noHLD.xml b/users/gsi_xbox_mdc/TdcEventBuilder_noHLD.xml index 31a919a..8982d61 100644 --- a/users/gsi_xbox_mdc/TdcEventBuilder_noHLD.xml +++ b/users/gsi_xbox_mdc/TdcEventBuilder_noHLD.xml @@ -60,7 +60,7 @@ When starting analysis from the go4 gui, one should specify stream server with p - + diff --git a/users/gsi_xbox_mdc/conf_cts.sh b/users/gsi_xbox_mdc/conf_cts.sh index 6e75887..c9c9576 100755 --- a/users/gsi_xbox_mdc/conf_cts.sh +++ b/users/gsi_xbox_mdc/conf_cts.sh @@ -1,6 +1,9 @@ + +#echo "cts" +#trbcmd w 0x8000 0xa137 1000000 # CTS Configuration dump -# generated: 2019-11-28 14:47 -# CTS Compile time: 2019-01-21 14:47 +# generated: 2021-11-08 01:23 +# CTS Compile time: 2020-06-29 11:12 # # trbcmd Dev. Reg. Value trbcmd setbit 0xc035 0xa00c 0x80000000 # Disable all triggers @@ -8,54 +11,54 @@ trbcmd w 0xc035 0xa008 0xffffffff # cts_fsm_limits: ro=65535, td=65535 trbcmd w 0xc035 0xa009 0x00000001 # cts_readout_config: # channel_cnt=false, idle_dead_cnt=false, input_cnt=true # timestamp=false, trg_cnt=false -trbcmd w 0xc035 0xa00c 0x80000414 # cts_throttle: enable=true, stop=false, threshold=0 +trbcmd w 0xc035 0xa00c 0x80000413 # cts_throttle: enable=true, stop=false, threshold=20 trbcmd w 0xc035 0xa00d 0x00000001 # cts_eventbuilder: # cal_eb=0, mask=0000 0000 0000 0001, rr_interval=0 # use_cal_eb=false -trbcmd w 0xc035 0xa101 0xffff0400 # trg_channel_mask: edge=1111 1111 1111 1111, mask=0000 0100 0000 0000 -trbcmd w 0xc035 0xa124 0x00000000 # trg_input_config0: delay=0, invert=false, override=off, spike_rej=0 -trbcmd w 0xc035 0xa125 0x00000000 # trg_input_config1: delay=0, invert=false, override=off, spike_rej=0 +trbcmd w 0xc035 0xa101 0xffff0001 # trg_channel_mask: edge=1111 1111 1111 1111, mask=0000 0000 0000 1000 +trbcmd w 0xc035 0xa124 0x0000003c # trg_input_config0: delay=60, invert=false, override=off, spike_rej=0 +trbcmd w 0xc035 0xa125 0x00000028 # trg_input_config1: delay=40, invert=false, override=off, spike_rej=0 trbcmd w 0xc035 0xa126 0x00000000 # trg_input_config2: delay=0, invert=false, override=off, spike_rej=0 trbcmd w 0xc035 0xa127 0x00000000 # trg_input_config3: delay=0, invert=false, override=off, spike_rej=0 trbcmd w 0xc035 0xa128 0x00000000 # trg_input_config4: delay=0, invert=false, override=off, spike_rej=0 trbcmd w 0xc035 0xa129 0x00000000 # trg_input_config5: delay=0, invert=false, override=off, spike_rej=0 -trbcmd w 0xc035 0xa12a 0x00000000 # trg_input_config6: delay=0, invert=false, override=off, spike_rej=0 -trbcmd w 0xc035 0xa13b 0x000f0000 # trg_coin_config0: - # coin_mask=0000 0000, inhibit_mask=0000 0000 - # window=15 -trbcmd w 0xc035 0xa13c 0x000f0000 # trg_coin_config1: - # coin_mask=0000 0000, inhibit_mask=0000 0000 - # window=15 -trbcmd w 0xc035 0xa13e 0x00000000 # trg_input_mux0: input=extclk[0] -trbcmd w 0xc035 0xa13f 0x00000001 # trg_input_mux1: input=extclk[1] -trbcmd w 0xc035 0xa140 0x00000002 # trg_input_mux2: input=trgext[2] -trbcmd w 0xc035 0xa141 0x00000003 # trg_input_mux3: input=trgext[3] -trbcmd w 0xc035 0xa142 0x00000004 # trg_input_mux4: input=jeclin[0] -trbcmd w 0xc035 0xa143 0x00000005 # trg_input_mux5: input=jeclin[1] -trbcmd w 0xc035 0xa144 0x00000006 # trg_input_mux6: input=jeclin[2] -trbcmd w 0xc035 0xa146 0x00000000 # trg_addon_output_mux0: input=itc[0] -trbcmd w 0xc035 0xa147 0x00000001 # trg_addon_output_mux1: input=itc[1] -trbcmd w 0xc035 0xa148 0x00000002 # trg_addon_output_mux2: input=itc[2] -trbcmd w 0xc035 0xa149 0x00000003 # trg_addon_output_mux3: input=itc[3] -trbcmd w 0xc035 0xa14a 0x00000004 # trg_addon_output_mux4: input=itc[4] -trbcmd w 0xc035 0xa14b 0x00000005 # trg_addon_output_mux5: input=itc[5] -trbcmd w 0xc035 0xa14c 0x00000006 # trg_addon_output_mux6: input=itc[6] -trbcmd w 0xc035 0xa14d 0x00000007 # trg_addon_output_mux7: input=itc[7] -trbcmd w 0xc035 0xa14f 0x00000002 # trg_periph_config0: mask=0000 0000 0000 0000 0010 -trbcmd w 0xc035 0xa150 0x00000000 # trg_periph_config1: mask=0000 0000 0000 0000 0000 -trbcmd w 0xc035 0xa151 0x00000000 # trg_periph_config2: mask=0000 0000 0000 0000 0000 -trbcmd w 0xc035 0xa152 0x00000000 # trg_periph_config3: mask=0000 0000 0000 0000 0000 -trbcmd w 0xc035 0xa154 0xffffffff # trg_pulser_config0: low_duration=4294967295 -trbcmd w 0xc035 0xa155 0x00000003 # trg_pulser_config1: low_duration=3 -trbcmd w 0xc035 0xa157 0x00000000 # trg_random_pulser_config0: threshold=0 -trbcmd w 0xc035 0xa159 0x1111111d # _trg_trigger_types0: +trbcmd w 0xc035 0xa12a 0x0000003c # trg_input_config6: delay=60, invert=false, override=off, spike_rej=0 +trbcmd w 0xc035 0xa12b 0x0000001e # trg_input_config7: delay=30, invert=false, override=off, spike_rej=0 +trbcmd w 0xc035 0xa13e 0x00004080 # trg_coin_config0: + # coin_mask=1000 0000, inhibit_mask=0100 0000 + # window=0 +trbcmd w 0xc035 0xa13f 0x00000001 # trg_coin_config1: + # coin_mask=0000 0001, inhibit_mask=0000 0000 + # window=0 +trbcmd w 0xc035 0xa141 0x00000030 # trg_input_mux0: input=itc[10] +trbcmd w 0xc035 0xa142 0x00000028 # trg_input_mux1: input=itc[2] +trbcmd w 0xc035 0xa143 0x00000005 # trg_input_mux2: input=jeclin[1] +trbcmd w 0xc035 0xa144 0x00000006 # trg_input_mux3: input=jeclin[2] +trbcmd w 0xc035 0xa145 0x00000004 # trg_input_mux4: input=jeclin[0] +trbcmd w 0xc035 0xa146 0x00000000 # trg_input_mux5: input=extclk[0] +trbcmd w 0xc035 0xa147 0x00000033 # trg_input_mux6: input=itc[13] +trbcmd w 0xc035 0xa148 0x0000002e # trg_input_mux7: input=itc[8] +trbcmd w 0xc035 0xa14a 0x00000004 # trg_addon_output_mux0: input=itc[4] +trbcmd w 0xc035 0xa14b 0x00000005 # trg_addon_output_mux1: input=itc[5] +trbcmd w 0xc035 0xa14c 0x00000006 # trg_addon_output_mux2: input=itc[6] +trbcmd w 0xc035 0xa14d 0x00000007 # trg_addon_output_mux3: input=itc[7] +trbcmd w 0xc035 0xa14e 0x00000004 # trg_addon_output_mux4: input=itc[4] +trbcmd w 0xc035 0xa14f 0x00000002 # trg_addon_output_mux5: input=itc[2] +trbcmd w 0xc035 0xa150 0x00000000 # trg_addon_output_mux6: input=itc[0] +trbcmd w 0xc035 0xa151 0x00000000 # trg_addon_output_mux7: input=itc[0] +trbcmd w 0xc035 0xa153 0x00000002 # trg_periph_config0: mask=0000 0000 0000 0000 0010 +trbcmd w 0xc035 0xa154 0x000fffff # trg_periph_config1: mask=1111 1111 1111 1111 1111 +trbcmd w 0xc035 0xa155 0x00000003 # trg_periph_config2: mask=0000 0000 0000 0000 0011 +trbcmd w 0xc035 0xa156 0x00000004 # trg_periph_config3: mask=0000 0000 0000 0000 0100 +trbcmd w 0xc035 0xa158 0x00001387 # trg_pulser_config0: low_duration=4999 +trbcmd w 0xc035 0xa15a 0x11111111 # trg_random_pulser_config0: threshold=286331153 +trbcmd w 0xc035 0xa15c 0x11111111 # _trg_trigger_types0: # type0=0xd_tdc_calibration_trigger, type1=0x1_physics_trigger # type2=0x1_physics_trigger, type3=0x1_physics_trigger # type4=0x1_physics_trigger, type5=0x1_physics_trigger # type6=0x1_physics_trigger, type7=0x1_physics_trigger -trbcmd w 0xc035 0xa15a 0x11111111 # _trg_trigger_types1: +trbcmd w 0xc035 0xa15d 0x11111111 # _trg_trigger_types1: # type10=0x1_physics_trigger, type11=0x1_physics_trigger # type12=0x1_physics_trigger, type13=0x1_physics_trigger # type14=0x1_physics_trigger, type15=0x1_physics_trigger # type8=0x1_physics_trigger, type9=0x1_physics_trigger -trbcmd clearbit 0xc035 0xa00c 0x80000000 # Enable all triggers diff --git a/users/gsi_xbox_mdc/db/addresses_mbo.db b/users/gsi_xbox_mdc/db/addresses_mbo.db deleted file mode 100644 index 1d00968..0000000 --- a/users/gsi_xbox_mdc/db/addresses_mbo.db +++ /dev/null @@ -1,34 +0,0 @@ -#TRBNet serial FPGA - -0x1801 60011 1 -0x1802 70011 1 -0x1803 60021 1 -0x1804 70021 1 -0x1805 60031 1 -0x1806 70031 1 -0x1807 60041 1 -0x1808 70041 1 -0x1809 60051 1 -0x1810 70051 1 -0x1811 60061 1 -0x1812 70061 1 -0x1813 60071 1 -0x1814 70071 1 -0x1815 60081 1 -0x1816 70081 1 -0x1801 60011 1 -0x1802 70011 1 -0x1803 60021 1 -0x1804 70021 1 -0x1805 60031 1 -0x1806 70031 1 -0x1807 60041 1 -0x1808 70041 1 -0x1809 60051 1 -0x1810 70051 1 -0x1811 60061 1 -0x1812 70061 1 -0x1813 60071 1 -0x1814 70071 1 -0x1815 60081 1 -0x1816 70081 1 diff --git a/users/gsi_xbox_mdc/db/addresses_mdcoep.db b/users/gsi_xbox_mdc/db/addresses_mdcoep.db index 23b2c92..860c44b 100644 --- a/users/gsi_xbox_mdc/db/addresses_mdcoep.db +++ b/users/gsi_xbox_mdc/db/addresses_mdcoep.db @@ -15,19 +15,3 @@ 0x8014 80014 1 0x8015 80015 1 0x8016 80016 1 -0x8001 80001 1 -0x8002 80002 1 -0x8003 80003 1 -0x8004 80004 1 -0x8005 80005 1 -0x8006 80006 1 -0x8007 80007 1 -0x8008 80008 1 -0x8009 80009 1 -0x8010 80010 1 -0x8011 80011 1 -0x8012 80012 1 -0x8013 80013 1 -0x8014 80014 1 -0x8015 80015 1 -0x8016 80016 1 diff --git a/users/gsi_xbox_mdc/db/register_configgbe.db b/users/gsi_xbox_mdc/db/register_configgbe.db index d5df0d0..2e0e3b5 100755 --- a/users/gsi_xbox_mdc/db/register_configgbe.db +++ b/users/gsi_xbox_mdc/db/register_configgbe.db @@ -13,7 +13,9 @@ # Hub # Type # C0 # C1 # C2 # C3 # C4 # ################################################################################## 0xc035 0 0xc035 1 0 0xffffff 1 - 0x8150 0 0x8150 1 0 0xffffff 1 +# 0x0350 0 0x0350 0 0 0xffffff 1 +# 0x0351 0 0x0351 0 0 0xffffff 1 +# 0x8150 0 0x8150 1 0 0xffffff 1 diff --git a/users/gsi_xbox_mdc/db/register_configgbe_ip.db b/users/gsi_xbox_mdc/db/register_configgbe_ip.db index a74fe4e..78a0b14 100755 --- a/users/gsi_xbox_mdc/db/register_configgbe_ip.db +++ b/users/gsi_xbox_mdc/db/register_configgbe_ip.db @@ -30,8 +30,8 @@ # 0xc035 0 0xF13BAF95 0xF0DE 0xc0a80401 50002 0xc350 # 0x8150 0 0xF13BAF95 0xF0DE 0xc0a80401 50003 0xc351 - 0xc035 0 0x4C80BC07 0xD85D 0xc0a80401 50002 0xc350 - 0x8150 0 0x4C80BC07 0xD85D 0xc0a80401 50003 0xc351 - +# 0xc035 0 0x4C80BC07 0xD85D 0xc0a80401 50002 0xc350 #xbox enp2s0 local network card +# 0x8150 0 0x4C80BC07 0xD85D 0xc0a80401 50003 0xc351 +0xc035 0 0xF4D7BA4C 0xBC5F 0xc0a8648a 50002 0xc350 #xbox_enp3s0 hades network card diff --git a/users/gsi_xbox_mdc/first.C b/users/gsi_xbox_mdc/first.C index 52e8697..54013cd 100644 --- a/users/gsi_xbox_mdc/first.C +++ b/users/gsi_xbox_mdc/first.C @@ -22,7 +22,7 @@ #include #define TDCRANGE_START 0x0350 -#define TDCRANGE_STOP 0x1823 +#define TDCRANGE_STOP 0x8888 void first() @@ -53,7 +53,7 @@ void first() //hadaq::T // [min..max] range for HUB ids //hadaq::TrbProcessor::SetHUBRange(HUBRANGE_START, HUBRANGE_STOP); - hadaq::TrbProcessor::SetHUBRange(0x8000, 0x8400); + hadaq::TrbProcessor::SetHUBRange(0x8000, 0x9000); // when first argument true - TRB/TDC will be created on-the-fly // second parameter is function name, called after elements are created @@ -62,12 +62,14 @@ void first() hadaq::TrbProcessor* trb = new hadaq::TrbProcessor(0xc035, hld); //trb->SetAutoCreate(true); //trb->AddHadaqHUBId(0xc035); - trb->AddHadaqHUBId(0x8352); - trb->AddHadaqHUBId(0x8353); - - unsigned TDClist[14] = { 0x1000, 0x1001, 0x1010, 0x1011, 0x10A0, 0x10A1, 0x10b0, 0x10b1, 0x10c0, 0x10c1, 0x10D0, 0x10D1, 0x1020, 0x1021 }; + trb->AddHadaqHUBId(0x353); + trb->AddHadaqHUBId(0x352); + const int NumMDCTDC = 17; + unsigned TDClist[NumMDCTDC] = { 0x10A0, 0x10A1, 0x10b0, 0x10b1, 0x10c0, 0x10c1, 0x1030, 0x1031, 0x1020, 0x1021, 0x1022, 0x1010, 0x1011, 0x1012, 0x1060, 0x1061, 0x1062}; + //~ const int NumMDCTDC = 9; + //~ unsigned TDClist[NumMDCTDC] = { 0x1020, 0x1021, 0x1022, 0x1010, 0x1011, 0x1012, 0x1060, 0x1061, 0x1062}; // create custom processor - hadaq::MdcProcessor *mdc[14]; + hadaq::MdcProcessor *mdc[NumMDCTDC]; for (int itdc = 0 ; itdc < int(sizeof(TDClist)/sizeof(*TDClist)) ; itdc++) { @@ -130,5 +132,3 @@ extern "C" void after_create(hadaq::HldProcessor* hld) trb->SetPrintErrors(10); } } - - diff --git a/users/gsi_xbox_mdc/read.C b/users/gsi_xbox_mdc/read.C index f5fc3e0..d7a4d8c 100644 --- a/users/gsi_xbox_mdc/read.C +++ b/users/gsi_xbox_mdc/read.C @@ -1,7 +1,16 @@ // macro reads tree with data, stored by TDC processor +#include "TTree.h" +#include "TFile.h" +#include "TSystem.h" +#include "TString.h" +#include "TH1.h" +#include "TH2.h" +#include "TCanvas.h" +#include "/home/hadaq/trbsoft/trb3/stream/include/hadaq/MdcSubEvent.h" void read() { + gSystem->AddIncludePath(" -I/home/hadaq/trbsoft/trb3/stream/include"); auto f = TFile::Open("mdc.root"); if (!f) return; @@ -10,7 +19,7 @@ void read() auto vect = new std::vector; - t->SetBranchAddress("MDC_10a0", &vect); + t->SetBranchAddress("MDC_10b0", &vect); long entry = 0, total = 0; diff --git a/users/gsi_xbox_mdc/reset_trb.sh b/users/gsi_xbox_mdc/reset_trb.sh index 89eb168..114d791 100755 --- a/users/gsi_xbox_mdc/reset_trb.sh +++ b/users/gsi_xbox_mdc/reset_trb.sh @@ -7,6 +7,8 @@ echo "addresses" trbcmd s 0x920000039053d928 0x05 0xc035 # use new HADES addresses : ../../tools/merge_serial_address.pl ../../../hades_mdc_settings/serials/serials_mdcmbo.db ../../../hades_mdc_settings/settings_oep/auto/addresses_mdc.db +# trb3s need addresses +../../tools/merge_serial_address.pl ../../base/serials_trb3.db db/addresses_trb3.db echo "FPGAs after addressing" @@ -19,6 +21,7 @@ echo "Hubs" ../../tools/loadregisterdb.pl register_configgbe_ip.db + #echo "cts" #trbcmd w 0x8000 0xa137 1000000 # CTS Configuration dump @@ -82,7 +85,7 @@ trbcmd w 0xc035 0xa15d 0x11111111 # _trg_trigger_types1: # type12=0x1_physics_trigger, type13=0x1_physics_trigger # type14=0x1_physics_trigger, type15=0x1_physics_trigger # type8=0x1_physics_trigger, type9=0x1_physics_trigger -trbcmd clearbit 0xc035 0xa00c 0x80000000 # Enable all triggers +#trbcmd clearbit 0xc035 0xa00c 0x80000000 # Enable all triggers #echo "tdc" diff --git a/users/gsi_xbox_mdc/second.C b/users/gsi_xbox_mdc/second.C deleted file mode 100644 index 8684ff2..0000000 --- a/users/gsi_xbox_mdc/second.C +++ /dev/null @@ -1,417 +0,0 @@ -#include -#include -#include -#include - -#include "TTree.h" -#include "TFile.h" -#include "TSystem.h" -#include "TString.h" -#include "TH1.h" -#include "TH2.h" -#include "TCanvas.h" -#include "TGo4AnalysisObjectManager.h" - - -#include "base/EventProc.h" -#include "base/Event.h" -#include "hadaq/TdcSubEvent.h" - -#include "go4_settings.h" - -// #define CHANNELS 53 // in "go_settings.h" -#define REFCHAN 0 -// #define REFCHAN_B 0 - -#define VERBOSE 0 -#define TAKE_FIRST_HIT 1 - - - -// Muentz-Torte -// #define t1_L -800 // EE -// #define t1_R 800 // EE -// #define tot_L -10 // EE -// #define tot_R 2000 // EE - -#define ref_channel_offset -75 //ns fine measured ref channel relative to coarse measured cts trigger channel -//#define ref_channel_offset 0 //ns fine measured ref channel relative to coarse measured cts trigger channel - -// in the first iteration, scanning through data in the coincidence window, rejecting hits (fuzzy edges) - - -// moved to "go4_settings.h" -// #define spike_rejection 80 // for PASTTREC test -// #define spike_rejection_refchan 10 - -#define individual_spike_rejection 0 - - - -#define t1_accept_L ( t1_L + ref_channel_offset) //ns // EE -#define t1_accept_R ( t1_R + ref_channel_offset) //ns // EE - -#define fish_proj_cut 20 - - - -// real cuts on selected data - -#define max_tot 1000000 // Muentz-Torte -#define t1_cut_L -2000 -#define t1_cut_R 2000 - - -// #define coincidence_rejection 7 -#define accept_hits_per_layer 20 - -#define enable_coincidence_rejection 0 - -#define enable_single_hits 0 -#define enable_one_hit_per_layer 1 -#define enable_two_to_one_hits 0 - - - -// TFile* tree_out; -std::map trig_no; -std::map data_tree; -Bool_t write_tree = false; - - - -Bool_t file_exists(TString fname){ - - fstream src_file(fname.Data()); - return src_file.good(); -} - -TString from_env(TString env_var,TString default_val){ - if(gSystem->Getenv(env_var)){ - return gSystem->Getenv(env_var); - } - return default_val; -} - - - -class SecondProc : public base::EventProc { - protected: - - std::string fTdcId; //!< tdc id where channels will be selected - - double fHits[8]; //!< 8 channel, abstract hits - - base::H1handle hNumHits; //!< histogram with hits number -// base::H2handle h2D; - -// base::H1handle totCh1; //!< histogram with hits number -// base::H1handle totCh2; //!< histogram with hits number - - - base::H1handle tot_h[CHANNELS]; - base::H1handle tot_untrig_h[CHANNELS]; - base::H1handle t1_h[CHANNELS]; - base::H1handle potato_h[CHANNELS]; - base::H1handle meta_potato_h; - base::H1handle meta_t1_h; - base::H1handle meta_tot_h; - base::H1handle meta_tot_2d; - base::H1handle meta_t1_2d; - base::H1handle coinc_matrix; -// base::H1handle meta_fish; -// base::H1handle meta_fish_proj; -// base::H1handle fishes[FISHES]; -// base::H1handle fish_proj[FISHES]; - base::H1handle efficiency_h; - base::H1handle ref_counts_h; - base::H1handle dut_counts_h; - - - int entry_chan; - int entry_ref_chan; - double entry_t1; - double entry_tot; - - - - - -// int evt_no; - - public: - SecondProc(const char* procname, const char* _tdcid) : - base::EventProc(procname), - fTdcId(_tdcid), - hNumHits(0) - { - printf("Create %s for %s\n", GetName(), fTdcId.c_str()); - - hNumHits = MakeH1("FineAll","Fine all", 1020, 0, 1020, "fine"); -// h2D = MakeH2("h2d","title", 100, -20, 20, 100, -20,20,"x;y"); -// totCh1 = MakeH1("totCh1","totCh1", 20000, -200, 200, "ns"); -// totCh2 = MakeH1("totCh2","totCh2", 20000, -200, 200, "ns"); - - - if(from_env("tree_out","false") == "true"){ - write_tree = true; - } - - trig_no[fTdcId] = 0; - data_tree[fTdcId] = new TTree((TString) fTdcId,"data recorded"); - data_tree[fTdcId]->Branch("trig_no",&trig_no[fTdcId]); - data_tree[fTdcId]->Branch("t1",&entry_t1); - data_tree[fTdcId]->Branch("tot",&entry_tot); - data_tree[fTdcId]->Branch("chan",&entry_chan); - data_tree[fTdcId]->Branch("ref_chan",&entry_ref_chan); - - - for( unsigned i=0; iSetDrawOption("P0"); - ((TH1F*) efficiency_h)->SetMarkerStyle(22); - ((TH1F*) efficiency_h)->GetXaxis()->SetNdivisions(55); - - coinc_matrix = MakeH2("coinc_matrix","coinc_matrix",12,-2.5,9.5,10,15-0.5,24+0.5, "channels 0-7;channels 16-23"); - - // enable storing already in constructor - SetStoreEnabled(); - } - - virtual void UserPostLoop(void) { - - static Int_t was_called_before = 0; - - cout << "--- User Post Loop " << fTdcId << endl; - - if(from_env("tree_out","false") == "true"){ - - cout << "write tree_out.root" << endl; - TFile* tree_out; - - - if(was_called_before){ - tree_out = new TFile("tree_out.root","UPDATE"); - } else { - tree_out = new TFile("tree_out.root","RECREATE"); - } - tree_out->cd(); - data_tree[fTdcId]->Write(); - tree_out->Write(); - tree_out->Close(); - delete tree_out; - } - was_called_before ++; - } - - - virtual void CreateBranch(TTree* t) - { - // only called when tree is created in first.C - // one can ignore - t->Branch(GetName(), fHits, "hits[8]/D"); - } - - virtual bool Process(base::Event* ev) - { -// printf("### DEBUG ###\n"); - for (unsigned n=0;n<8;n++) fHits[n] = 0.; - - hadaq::TdcSubEvent* sub = - dynamic_cast (ev->GetSubEvent(fTdcId)); - - if(VERBOSE) cout<< "tdc: " << fTdcId << " evt no: " << trig_no[fTdcId] << endl; - if (sub==0) return false; - -// printf("%s process sub %d %s\n", GetName(), sub->Size(), fTdcId.c_str()); - - - static float effective_spike_rejection = from_env("spike_rejection", TString::Itoa(spike_rejection,10) ).Atof(); - - - - - - double num(0), ch0tm(0), ch1tm(0), ch2tm(0), ch3tm(0); - double t1_candidate[CHANNELS]; - double t2_candidate[CHANNELS]; - double t1[CHANNELS]; - double t2[CHANNELS]; - bool got_rising[CHANNELS]; - bool got_falling[CHANNELS]; - bool got_real_hit[CHANNELS]; - double tot[CHANNELS]; - for (unsigned i=0; iSize();cnt++) { - const hadaq::TdcMessageExt& ext = sub->msg(cnt); - - unsigned chid = ( ext.msg().getHitChannel() ); - bool rising = ext.msg().isHitRisingEdge(); // use this line for rising edge first/positive pulses - - if (chid==0) { - ch0tm = ext.GetGlobalTime(); - got_real_hit[chid] = true; - t1[chid] = 0; - tot[chid] = 100e-9; - continue; - - } - - - // full time - double tm = ext.GetGlobalTime(); - if((chid) >= CHANNELS) {continue;} // channel out of range of analysis - if(rising){ - - - if( !(TAKE_FIRST_HIT && got_real_hit[chid]) ){ // block subsequent hits if TAKE_FIRST_HIT setting is active - if((( ((tm)*1e9) > t1_accept_L) && (((tm)*1e9) < t1_accept_R )) ) { // this condition sets another coincidence window, except for REFCHAN_A - got_rising[chid] = true; - got_falling[chid] = false; - t1_candidate[chid] = tm; - } - } - }else{ // if falling edge -// printf("got falling edge, ch %d\n",(chid)); - if(got_rising[chid]){ - if(not(got_falling[chid])){ - got_falling[chid] = true; - t2_candidate[chid] = tm; - Double_t candidate_tot_ns = (t2_candidate[chid] - t1_candidate[chid])*1e9; - - if( candidate_tot_ns > effective_spike_rejection || (chid==REFCHAN && candidate_tot_ns > spike_rejection_refchan) ){ - // hit is long enough not to be rejected - t1[chid] = t1_candidate[chid]; - t2[chid] = t2_candidate[chid]; - tot[chid] = t2[chid] - t1[chid]; - got_real_hit[chid] = true; - - // fill untriggered tot histogram - FillH1(tot_untrig_h[chid],tot[chid]*1e9); - } -// printf("got hit, ch %d, tot = %f ns\n",(chid), tot[chid]*1e9); - } - } - } - - } - - - - for( unsigned i=0; i t1_cut_L) && (t1_vs_ref < t1_cut_R) && (tot[i]*1e9 < max_tot) ) { - - // fill histograms - FillH1(tot_h[i],tot[i]*1e9); - FillH2(potato_h[i],t1_vs_ref ,tot[i]*1e9); - FillH1(t1_h[i],t1_vs_ref ); // without cuts -// if(t1_vs_ref < -200 && tot[i]*1e9 > 0 ) FillH1(t1_h[i],t1_vs_ref ); // with noise rejecting cuts - // if( tot[i]*1e9 > 50 ) FillH1(t1_h[i],t1_vs_ref ); // with noise rejecting cuts - - - if( i != 0 ) { - FillH2(meta_potato_h,t1_vs_ref,tot[i]*1e9); - FillH1(meta_tot_h,tot[i]*1e9); - FillH1(meta_t1_h,t1_vs_ref ); - FillH2(meta_tot_2d,tot[i]*1e9,i); - FillH2(meta_t1_2d,t1_vs_ref,i); - entry_chan = i; - entry_t1 = t1_vs_ref; - entry_tot = tot[i]*1e9; - if(write_tree){ - data_tree[fTdcId]->Fill(); - } - } - - // efficiency estimation ... this cell, cell #i, is a reference detector -// ref_counts[i]++; // count up reference counts -// FillH1(counts_h,i-0.5); - } - } - } - - - - for (int i = 1 ; iSetBinContent(i,((float) (((TH1F*) t1_h[i])->GetEntries()) )/((float) (((TH1F*) t1_h[0])->GetEntries()))); - ((TH1F*) efficiency_h)->SetBinContent(i,((float) (((TH1F*) t1_h[i])->Integral()) )/ 600. ); // fixed numer of pulses sent for each channel - // ((TH1F*) efficiency_h)->SetBinContent(i,((float) (((TH1F*) t1_h[i])->Integral()) )/((float) (((TH1F*) tot_h[i])->Integral()))); ; // normalize by number of signals in same channel without couts, as for almost each trigger a noise signal is measured - } - - - - -// if(got_real_hit[0]){ -// FillH1(totCh1,tot[0]*1e9); -// } -// if(got_real_hit[1]){ -// FillH1(totCh2,tot[1]*1e9);ref_counts[i] -// } - -// FillH1(hNumHits, num); - - -// draw_and_save((TH2F*) meta_fish, "meta_fish","./","colz"); - -// tree_out->cd(); -// data_tree[fTdcId]->Write(); - trig_no[fTdcId]++; - - return true; - } - - -}; - - -void second() -{ - //hadaq::TdcProcessor::SetDefaults(700); -// tree_out = new TFile("./tree_out.root","RECREATE"); -// new SecondProc("Sec_1130", "TDC_1130"); -// new SecondProc("Sec_0352", "TDC_0353"); -// new SecondProc("Sec_0350", "TDC_0350"); -// new SecondProc("Sec_0351", "TDC_0351"); -// new SecondProc("Sec_0352", "TDC_0352"); -// new SecondProc("Sec_0353", "TDC_0353"); -// -// new SecondProc("Sec_1500", "TDC_1500"); -// new SecondProc("Sec_1501", "TDC_1501"); -// new SecondProc("Sec_1502", "TDC_1502"); -// new SecondProc("Sec_1503", "TDC_1503"); -// tree_out->Write(); -// tree_out->Close(); - - SECOND_PROCESS_TDCs - - -} - diff --git a/users/gsi_xbox_mdc/startGo4.sh b/users/gsi_xbox_mdc/startGo4.sh index 901fcad..eba2264 100755 --- a/users/gsi_xbox_mdc/startGo4.sh +++ b/users/gsi_xbox_mdc/startGo4.sh @@ -1,5 +1,6 @@ +. ~/trbsoft/trb3/trb3login killall go4analysis export CALMODE=0; -rm Go4AutoSave.root; tree_out=false go4analysis -stream localhost:6789 -http localhost:8081; -#rm Go4AutoSave.root; tree_out=false go4analysis -stream hadesp63:6789 -http localhost:8080; +#rm Go4AutoSave.root; tree_out=false go4analysis -stream localhost:6789 -http localhost:8081; +rm Go4AutoSave.root; tree_out=false go4analysis -stream localhost:6789 -http localhost:8080; #rm Go4AutoSave.root; tree_out=false go4analysis -stream 192.168.103.126:6789 -http localhost:8080; diff --git a/users/gsi_xbox_mdc/startup.sh b/users/gsi_xbox_mdc/startup.sh index eb8c8e7..33ea310 100755 --- a/users/gsi_xbox_mdc/startup.sh +++ b/users/gsi_xbox_mdc/startup.sh @@ -1,25 +1,28 @@ #!/bin/bash +#. ~/trbsoft/trb3/trb3login # only for dabc + go4 + export CTS_TRB_NUM=35 -provide_trbnetd=yes +#provide_trbnetd=yes -DAQ_TOOLS_PATH=~/trbsoft/daqtools +export DAQ_TOOLS_PATH=~/trbsoft/daqtools USER_DIR=~/trbsoft/daqtools/users/gsi_xbox_mdc TRB_WEB_DIR=$DAQ_TOOLS_PATH/web +export MDC_DIR=~/trbsoft/hades_mdc_settings/ -export PATH=$PATH:$DAQ_TOOLS_PATH export PATH=$PATH:$DAQ_TOOLS_PATH/tools export PATH=$PATH:$USER_DIR #export TRB3_SERVER=trb0$CTS_TRB_NUM:26000 -export TRB3_SERVER=192.168.102.35 # trb3 IP inside HADES VLAN +export TRB3_SERVER=192.168.102.35 # trb3 IP inside HADES VLAN +#export TRB3_SERVER=trb035 # trb3 IP in local network +#export TRB3_SERVER=192.168.4.240 # trb3 IP inside xbox-local trbnetwork (for COSY) export TRBNETDPID=$(pgrep -f "trbnetd -i $CTS_TRB_NUM") export DAQOPSERVER=localhost:$CTS_TRB_NUM -#echo "- trbnetd pid: $TRBNETDPID" -#echo "TRB3_SERVER: $TRB3_SERVER" -. ~/trbsoft/trb3/trb3login +echo "- trbnetd pid: $TRBNETDPID" +echo "TRB3_SERVER: $TRB3_SERVER" if [[ -z "$TRBNETDPID" ]] @@ -31,45 +34,74 @@ fi echo "Reset System" -#trbcmd reset -./reset_trb.sh -#sleep 1; +trbcmd reset ################################################## ## Set addresses ################################################## -merge_serial_address.pl $DAQ_TOOLS_PATH/base/serials_trb3.db $USER_DIR/db/addresses_trb3.db -#merge_serial_address.pl $DAQ_TOOLS_PATH/base/serials_mbo.db $USER_DIR/db/addresses_mbo.db -#merge_serial_address.pl $DAQ_TOOLS_PATH/base/serials_mdcoep.db $USER_DIR/db/addresses_mdcoep.db +merge_serial_address.pl $DAQ_TOOLS_PATH/base/serials_trb3.db $USER_DIR/db/addresses_trb3.db +merge_serial_address.pl $MDC_DIR/serials/serials_mdcmbo.db $MDC_DIR/settings_oep/auto/addresses_mdc.db +#merge_serial_address.pl $DAQ_TOOLS_PATH/base/serials_trb3sc.db $USER_DIR/db/addresses_trb3sc.db +#merge_serial_address.pl $DAQ_TOOLS_PATH/base/serials_dirich.db $USER_DIR/db/addresses_dirich.db +#merge_serial_address.pl $DAQ_TOOLS_PATH/base/serials_dirich_concentrator.db $USER_DIR/db/addresses_dirich_concentrator.db +#merge_serial_address.pl $DAQ_TOOLS_PATH/base/serials_farich_concentrator.db $USER_DIR/db/addresses_farich_concentrator.db +#merge_serial_address.pl $DAQ_TOOLS_PATH/base/serials_farich.db $USER_DIR/db/addresses_farich.db +#merge_serial_address.pl $DAQ_TOOLS_PATH/base/serials_dirich5s.db $USER_DIR/db/addresses_dirich5s.db +#merge_serial_address.pl $DAQ_TOOLS_PATH/base/serials_trb5sc.db $USER_DIR/db/addresses_trb5sc.db + +#~ . ~/trbsoft/hades_mdc_settings/installation/addresses.sh +trbcmd s 0x0000023000752941 0x05 0x8e10 +trbcmd s 0x00001e4a00752941 0x03 0xa100 +trbcmd s 0x0000064e00752941 0x03 0xa101 + +#~ # long board 095 +#~ trbcmd s 0x00007fe300822941 0x05 0x8010 +#~ trbcmd s 0x0000828d00822941 0x00 +#~ trbcmd s 0x000025db00822941 0x01 +#~ trbcmd s 0x0000947d00822941 0x02 +#~ # short board 008 +#~ trbcmd s 0x000009d700762941 0x05 +#~ trbcmd s 0x000090d700752941 0x03 +#~ trbcmd s 0x0000766e00752941 0x03 + +#~ # short board 004 +#~ trbcmd s 0x000006de00752941 0x05 +#~ trbcmd s 0x0000618f00752941 0x01 +#~ trbcmd s 0x0000770800752941 0x01 + + + echo "GbE settings" loadregisterdb.pl db/register_configgbe.db loadregisterdb.pl db/register_configgbe_ip.db echo "TDC settings" -#loadregisterdb.pl db/register_configtdc.db -#./conf_tdcs.sh +loadregisterdb.pl db/register_configtdc.db echo "TDC settings end" + +# CTS configuration +echo "CTS settings" +#./conf_cts.sh + # setup central FPGA - enable peripherial signals #switchport.pl 0x8841 6 off # set correct timeout: off for channel 0, 1, 2sec for 2 -trbcmd w 0xfffe 0xc5 0x50ff +#trbcmd w 0xfffe 0xc5 0x50ff -# echo "pulser" -# # pulser #0 to 10 kHz -# trbcmd w 0xc035 0xa156 0x0000270f +echo "pulser" +# pulser #0 to 10 kHz +trbcmd w 0xc035 0xa158 0x0000270f -# echo "trigger type" -# # set trigger type to 0x1 -# trbcmd setbit 0xc035 0xa15e 0x10 +echo "trigger type" +# set trigger type to 0x1 +trbcmd setbit 0xc035 0xa15c 0x1 -# echo "pulser enable" -# # pulser enable -# trbcmd setbit 0xc035 0xa101 0x2 +echo "pulser enable" +# pulser enable +trbcmd setbit 0xc035 0xa101 0x1 -# setup all CTS registers (needed?, MT) -./conf_cts.sh -- 2.43.0