From f4a51fbf5d35dc54bd09bc1ef070290310612642 Mon Sep 17 00:00:00 2001 From: hadaq Date: Wed, 2 Feb 2022 00:12:43 +0100 Subject: [PATCH] update hmon scripts --- hmon/QA.pm | 37 ++++---- hmon/ecal_drawing.htm | 89 ++++++++++-------- hmon/getebjson.pm | 37 +++++--- hmon/getrootjson.pm | 63 +++++++++++++ hmon/hmon_boxmon.pl | 52 ++++++----- hmon/hmon_eb_rate.pl | 2 +- hmon/hmon_endpoints.pl | 2 +- hmon/hmon_micro.pl | 0 hmon/hmon_rate2.pl | 7 +- hmon/hmon_spill.pl | 14 +-- hmon/hmon_startrate.pl | 132 ++++++++++++++++++++++++-- hmon/hmon_triggerratio.pl | 140 ++++++++++++++++++++++++++++ hmon/index.cgi | 63 +++++++------ hmon/monitor.cgi | 2 +- hmon/old/hmon_dutyfactor.pl | 15 +-- hmon/old/hmon_startrate.pl | 4 +- hmon/permanent/hmon_archiver.pl | 2 +- hmon/permanent/hmon_frpchv.pl | 4 +- hmon/permanent/hmon_itofhv.pl | 0 hmon/permanent/hmon_mdchv.pl | 51 +++++++--- hmon/permanent/hmon_mdcpressure.pl | 27 ++++-- hmon/permanent/hmon_richIsobutan.pl | 3 +- hmon/permanent/hmon_spillmon.pl | 26 +++--- hmon/start.sh | 2 +- hmon/stop.sh | 4 +- hmon/styles.css | 4 +- 26 files changed, 594 insertions(+), 188 deletions(-) create mode 100755 hmon/getrootjson.pm mode change 100755 => 100644 hmon/hmon_micro.pl create mode 100755 hmon/hmon_triggerratio.pl mode change 100644 => 100755 hmon/permanent/hmon_itofhv.pl diff --git a/hmon/QA.pm b/hmon/QA.pm index 7514953..d6c2472 100644 --- a/hmon/QA.pm +++ b/hmon/QA.pm @@ -44,15 +44,15 @@ our $entries->{'cats'} = ["main", # Order of entries in each cat $entries->{'main'} = ['time', 'rate','beamabort','up','spillcount']; $entries->{'daq'} = ['trbnet', 'timeouts', 'busy','readout','outofsync']; -$entries->{'trg'} = ['spill', 'accepted', 'source','pt1rate', 'start']; #, +$entries->{'trg'} = ['spill', 'accepted', 'source','pt1rate', 'start']; $entries->{'rate'} = ['pt1','pt2','pt3','pt7','pt8']; -$entries->{'server'} = ['fill', 'cpu', 'icinga', 'pwrsup', 'onlineqa']; +$entries->{'server'} = ['fill', 'cpu', '', '', 'onlineqa']; #icinga, pwrsup $entries->{'eb'} = ['run', 'rate','bytes', 'lostevt', 'errbits']; $entries->{'mdc'} = ['token', 'blocked', 'temp', 'linkqual', 'voltage']; $entries->{'endp'} = ['mdc','rich', 'tof', 'rpc', 'other']; -$entries->{'feeerr'} = ['feeerr','trginp','trgqual','','']; +$entries->{'feeerr'} = ['feeerr','trginp','trgqual','rpc','']; $entries->{'rich'} = ['temp','LV','bkpl','isob','richthr']; -$entries->{'padiwa'} = ['ecal','start','itof','hodo','']; +$entries->{'padiwa'} = ['ecal','start','itof','hodo','sts']; $entries->{'hv'} = ['richhv','ecalhv','rpchv','fwhv','tofhv']; $entries->{'hv2'} = ['mdchv','stshv','frpchv','starthv','itofhv']; $entries->{'misc'} = ['irq','calib','magnet','env','sequencer']; @@ -81,22 +81,22 @@ our $QAServer = "hades33"; our @FeeErrLimits = (0, 5, 10); our @MdcOepLimits = (372, 372-1, 372-3); -our @MdcVoltageLimits = (50, 70, 100); +our @MdcVoltageLimits = (60, 90, 100); our @MdcLockLimits = (0, 3, 5); our @MdcTempLimits = (75, 80, 85); our @EcalTempLimits = (55, 60, 65); our @StartTempLimits = (55, 60, 65); our @ItofTempLimits = (55, 60, 65); -our @RichInnerTempLimits = (34,34.5,35); +our @RichInnerTempLimits = (34.3,35.2,36); our @TrgErrLimits = (100, 1000, 10000); our @CPULimits = (95, 100, 100); our @TimeoutLimits = (0, 0, 1); -our @TimeoutLimitsOnlyRICHMDC = (0, 20, 30); +our @TimeoutLimitsOnlyRICHMDC = (0, 3, 4); our @LinkErrLimits = (50, 500, 1000); -our @MdcEndpMissingLimits = (0, 3, 5); #!!! Oh dear. +our @MdcEndpMissingLimits = (0, 2, 3); #!!! Oh dear. our @RichEndpMissingLimits = (0, 3, 4); our @TofEndpMissingLimits = (0, 0, 0); -our @RpcEndpMissingLimits = (0, 0, 1); +our @RpcEndpMissingLimits = (0, 0, 0); our @OtherEndpMissingLimits = (0, 0, 0); our @EBDeltaRateLimits = (0.1, 0.2, 0.3); # as a ratio compared to the rate our $TrgCheckPolarity = 1; @@ -108,7 +108,7 @@ our @EcalHvLimits = (493,325,320); our @RpcHvLimits = (12,12,12); our @TofHvLimits = (764,760,759); our @FwHvLimits = (280,250,200); -our @FrpcHvLimits = (5.5,3.9,0); #kV 5.6 -> std. / 4 -> idle +our @FrpcHvLimits = (5.39,3.9,0); #kV 5.6 -> std. / 4 -> idle our @ItofHvLimits = (29,28,0); our @TdcCalibrationInterval = (320000,450000,600000); @@ -118,16 +118,19 @@ our @PionLvCurrLimits = (4,5,6); our $PadiwaEcalNumber = 105; -our @PadiwaEcalLimits = (5, 10, 20); +our @PadiwaEcalLimits = (1, 4, 7); our $PadiwaItofNumber = 18; -our @PadiwaItofLimits = (0, 0, 1); +our @PadiwaItofLimits = (0, 0, 0); our $PadiwaStartNumber = 12; -our @PadiwaStartLimits = (0, 0, 1); +our @PadiwaStartLimits = (0, 0, 0); + +our $PadiwaHodoNumber = 2; +our @PadiwaHodoLimits = (0, 0, 0); our @LimitTriggerPerSpill = (1000, 0, 0); -our $AcceleratorCycle = 7; +our $AcceleratorCycle = 2; use constant {CTSAddress => 0x0003}; ############################################################################### @@ -135,17 +138,18 @@ use constant {CTSAddress => 0x0003}; ############################################################################### our $MdcHvOff = 0; our $RichHvOff = 0; +our $RichGasOff = 0; our $TofHvOff = 0; our $RpcHvOff = 0; our $FwHvOff = 1; our $MagnetOff = 1; our $StsHvOff = 0; our $StartHvOff = 1; -our $ItofHvOff = 1; +our $ItofHvOff = 0; our $FrpcHvOff = 0; our $EcalHvOff = 0; -our $QAServerOff = 1; +our $QAServerOff = 0; ############################################################################### # Missing Boards @@ -310,6 +314,7 @@ sub SciNotation { return "0" if $v == 0; # print $v."\n"; if(abs($v) >= 1) { + return sprintf("%.1f", $v) if (abs($v) < 10) ; return sprintf("%i", $v) if (abs($v) < 1000) ; return sprintf("%.1fk", $v / 1000.) if (abs($v) < 20000) ; return sprintf("%ik", $v / 1000.) if (abs($v) < 1E6) ; diff --git a/hmon/ecal_drawing.htm b/hmon/ecal_drawing.htm index 838f360..d788f63 100644 --- a/hmon/ecal_drawing.htm +++ b/hmon/ecal_drawing.htm @@ -1770,28 +1770,26 @@ function updatedata(d) { resetColor(); var trbs = [ - [ ["0x6013",1,0,0], ["0x6013",2,1,1], ["0x6013",3,2,2], ["0x6013",4,3,3], ["0x6013",5,4,4] - //["0x6025",14,14,14], ["0x6025",9,15,15], ["0x6041",3,22,22], ["0x6041",7,23,23] - ], - //["0x6051",1,0,23], ["0x6045",25,0,23], ["0x6011",49,0,23], ["0x6014",73,0,23], ["0x6042",97,0,23], ["0x6015",121,0,23], ["0x6026",145,0,18] ], //sector 0 + [ [] + ], //sector 0 - [ //["0x6013",1,0,0], ["0x6013",2,1,1], ["0x6013",3,2,2], ["0x6013",4,3,3], ["0x6013",5,4,4], - ["0x6013",6,8,8], ["0x6013",7,5,5], ["0x6013",8,6,6], ["0x6013",9,7,7], ["0x6013",10,16,16], - ["0x6013",11,9,9], ["0x6013",12,10,10], ["0x6013",13,11,11], ["0x6013",14,17,17], ["0x6013",15,18,18], ["0x6013",16,19,19], ["0x6013",17,20,20], - ["0x6013",18,12,12], ["0x6013",19,13,13], ["0x6013",20,14,14], ["0x6013",21,15,15], ["0x6013",22,21,21], ["0x6013",23,22,22], ["0x6013",24,23,23], - ["0x6014",25,0,0], ["0x6014",26,1,1], ["0x6014",27,2,2], ["0x6014",28,3,3], ["0x6014",29,4,4], ["0x6012",30,0,0], ["0x6012",31,1,1], ["0x6012",32,2,2], ["0x6012",33,3,3], - ["0x6014",34,8,8], ["0x6014",35,9,9], ["0x6014",36,5,5], ["0x6014",37,6,6], ["0x6014",38,7,7], ["0x6012",39,4,4], ["0x6012",40,5,5], ["0x6012",41,6,6], ["0x6012",42,7,7], - ["0x6014",43,10,10], ["0x6014",44,11,11], ["0x6014",45,12,12], ["0x6014",46,13,13], ["0x6012",47,8,8], ["0x6012",48,9,9], ["0x6012",49,10,10], ["0x6012",50,11,11], ["0x6012",51,12,12], - ["0x6014",52,16,16], ["0x6014",53,17,17], ["0x6014",54,18,18], ["0x6014",55,14,14], ["0x6014",56,15,15], ["0x6012",57,13,13], ["0x6012",58,14,14], ["0x6012",59,15,15], ["0x6012",60,16,16], ["0x6012",61,17,17], ["0x6012",62,18,18], - ["0x6014",63,19,19], ["0x6014",64,20,20], ["0x6014",65,21,21], ["0x6014",66,22,22], ["0x6014",67,23,23], ["0x6015",68,23,23], ["0x6012",69,19,19], ["0x6012",70,20,20], ["0x6012",71,21,21], ["0x6012",72,22,22], ["0x6012",73,23,23], - ["0x6015",74,22,22], ["0x6015",75,21,21], ["0x6015",76,20,20], ["0x6015",77,19,19], ["0x6015",78,18,18], ["0x6015",79,17,17], ["0x6015",80,16,16], ["0x6011",81,0,0], ["0x6011",82,1,1], ["0x6011",83,2,2], ["0x6011",84,3,3], ["0x6011",85,4,4], ["0x6011",86,5,5], - ["0x6015",87,15,15], ["0x6015",88,14,14], ["0x6015",89,13,13], ["0x6015",90,12,12], ["0x6015",91,11,11], ["0x6015",92,10,10], ["0x6011",93,8,8], ["0x6011",94,9,9], ["0x6011",95,10,10], ["0x6011",96,11,11], ["0x6011",97,12,12], ["0x6011",98,13,13], ["0x6011",99,14,14], - ["0x6015",100,7,7], ["0x6015",101,6,6], ["0x6015",102,5,5], ["0x6015",103,4,4], ["0x6015",104,3,3], ["0x6015",105,2,2], ["0x6015",106,1,1], ["0x6011",107,16,16], ["0x6011",108,17,17], ["0x6011",109,18,18], ["0x6011",110,19,19], ["0x6011",111,20,20], ["0x6011",112,21,21], ["0x6011",113,22,22], ["0x6011",114,23,23], - ["0x6015",115,0,0], ["0x6016",116,0,0], ["0x6016",117,1,1], ["0x6016",118,2,2], ["0x6016",119,3,3], ["0x6016",120,4,4], ["0x6016",121,5,5], ["0x6016",122,6,6], ["0x6010",123,0,0], ["0x6010",124,1,1], ["0x6010",125,2,2], ["0x6010",126,3,3], ["0x6010",127,4,4], ["0x6010",128,5,5], ["0x6010",129,6,6], - ["0x6016",130,8,8], ["0x6016",131,9,9], ["0x6016",132,10,10], ["0x6016",133,11,11], ["0x6016",134,12,12], ["0x6016",135,13,13], ["0x6016",136,14,14], ["0x6016",137,15,15], ["0x6016",138,7,7], ["0x6010",139,7,7], ["0x6010",140,8,8], ["0x6010",141,9,9], ["0x6010",142,10,10], ["0x6010",143,11,11], ["0x6010",144,12,12], ["0x6010",145,13,13], ["0x6010",146,14,14], - ["0x6016",147,16,16], ["0x6016",148,17,17], ["0x6016",149,18,18], ["0x6016",150,19,19], ["0x6016",151,20,20], ["0x6016",152,21,21], ["0x6016",153,22,22], ["0x6016",154,23,23], ["0x6010",155,16,16], ["0x6010",156,17,17], ["0x6010",157,18,18], ["0x6010",158,19,19], ["0x6010",159,20,20], ["0x6010",160,21,21], ["0x6010",161,22,22], ["0x6010",162,23,23], ["0x6010",163,15,15] - ], //sector1 + [ ["0x6013",1,16,16], ["0x6013",2,19,19], ["0x6013",3,6,6], ["0x6013",4,1,1], ["0x6013",5,4,4], + ["0x6013",6,7,7], ["0x6013",7,8,8], ["0x6013",8,11,11], ["0x6013",9,14,14], ["0x6013",10,9,9], + ["0x6013",11,12,12], ["0x6013",12,15,15], ["0x6013",13,0,0], ["0x6013",14,3,3], ["0x6013",15,22,22], ["0x6013",16,17,17], ["0x6013",17,20,20], + ["0x6013",18,23,23], ["0x6013",19,18,18], ["0x6013",20,21,21], ["0x6013",21,10,10], ["0x6013",22,13,13], ["0x6013",23,2,2], ["0x6013",24,5,5], + ["0x6014",25,2,2], ["0x6014",26,10,10], ["0x6014",27,13,13], ["0x6014",28,1,1], ["0x6014",29,15,15], ["0x6012",30,2,2], ["0x6012",31,13,13], ["0x6012",32,18,18], ["0x6012",33,21,21], + ["0x6014",34,22,22], ["0x6014",35,17,17], ["0x6014",36,20,20], ["0x6014",37,23,23], ["0x6014",38,4,4], ["0x6012",39,20,20], ["0x6012",40,7,7], ["0x6012",41,10,10], ["0x6012",42,5,5], + ["0x6014",43,3,3], ["0x6014",44,6,6], ["0x6014",45,0,0], ["0x6014",46,7,7], ["0x6012",47,15,15], ["0x6012",48,16,16], ["0x6012",49,0,0], ["0x6012",50,22,22], ["0x6012",51,17,17], + ["0x6014",52,18,18], ["0x6014",53,8,8], ["0x6014",54,11,11], ["0x6014",55,14,14], ["0x6014",56,9,9], ["0x6012",57,23,23], ["0x6012",58,8,8], ["0x6012",59,11,11], ["0x6012",60,14,14], ["0x6012",61,9,9], ["0x6012",62,12,12], + ["0x6014",63,12,12], ["0x6014",64,21,21], ["0x6014",65,16,16], ["0x6014",66,19,19], ["0x6014",67,5,5], ["0x6015",68,5,5], ["0x6012",69,19,19], ["0x6012",70,3,3], ["0x6012",71,6,6], ["0x6012",72,1,1], ["0x6012",73,4,4], + ["0x6015",74,21,21], ["0x6015",75,6,6], ["0x6015",76,14,14], ["0x6015",77,22,22], ["0x6015",78,7,7], ["0x6015",79,15,15], ["0x6015",80,23,23], ["0x6011",81,21,21], ["0x6011",82,6,6], ["0x6011",83,14,14], ["0x6011",84,22,22], ["0x6011",85,7,7], ["0x6011",86,15,15], + ["0x6015",87,3,3], ["0x6015",88,11,11], ["0x6015",89,19,19], ["0x6015",90,4,4], ["0x6015",91,12,12], ["0x6015",92,20,20], ["0x6011",93,18,18], ["0x6011",94,3,3], ["0x6011",95,11,11], ["0x6011",96,19,19], ["0x6011",97,4,4], ["0x6011",98,12,12], ["0x6011",99,20,20], + ["0x6015",100,0,0], ["0x6015",101,8,8], ["0x6015",102,16,16], ["0x6015",103,1,1], ["0x6015",104,9,9], ["0x6015",105,17,17], ["0x6015",106,2,2], ["0x6011",107,0,0], ["0x6011",108,8,8], ["0x6011",109,16,16], ["0x6011",110,1,1], ["0x6011",111,9,9], ["0x6011",112,17,17], ["0x6011",113,2,2], ["0x6011",114,10,10], + ["0x6015",115,18,18], ["0x6016",116,6,6], ["0x6016",117,14,14], ["0x6016",118,22,22], ["0x6016",119,7,7], ["0x6016",120,15,15], ["0x6016",121,23,23], ["0x6016",122,18,18], ["0x6010",123,21,21], ["0x6010",124,6,6], ["0x6010",125,14,14], ["0x6010",126,22,22], ["0x6010",127,7,7], ["0x6010",128,15,15], ["0x6010",129,23,23], + ["0x6016",130,21,21], ["0x6016",131,3,3], ["0x6016",132,11,11], ["0x6016",133,19,19], ["0x6016",134,4,4], ["0x6016",135,12,12], ["0x6016",136,20,20], ["0x6016",137,5,5], ["0x6016",138,13,13], ["0x6010",139,3,3], ["0x6010",140,11,11], ["0x6010",141,19,19], ["0x6010",142,4,4], ["0x6010",143,12,12], ["0x6010",144,20,20], ["0x6010",145,5,5], ["0x6010",146,13,13], + ["0x6016",147,0,0], ["0x6016",148,8,8], ["0x6016",149,16,16], ["0x6016",150,1,1], ["0x6016",151,9,9], ["0x6016",152,17,17], ["0x6016",153,2,2], ["0x6016",154,10,10], ["0x6010",155,0,0], ["0x6010",156,8,8], ["0x6010",157,16,16], ["0x6010",158,1,1], ["0x6010",159,9,9], ["0x6010",160,17,17], ["0x6010",161,2,2], ["0x6010",162,10,10], ["0x6010",163,18,18] + ], //sector1, Note: update new cabeling (12.2021) [ ["0x6023",1,0,0], ["0x6023",2,1,1], ["0x6023",3,2,2], ["0x6023",4,3,3], ["0x6023",5,4,4], ["0x6023",6,8,8], ["0x6023",7,5,5], ["0x6023",8,6,6], ["0x6023",9,7,7], ["0x6023",10,16,16], @@ -1810,8 +1808,22 @@ function updatedata(d) { ["0x6026",147,16,16], ["0x6026",148,17,17], ["0x6026",149,18,18], ["0x6026",150,19,19], ["0x6026",151,20,20], ["0x6026",152,21,21], ["0x6026",153,22,22], ["0x6026",154,23,23], ["0x6020",155,16,16], ["0x6020",156,17,17], ["0x6020",157,18,18], ["0x6020",158,19,19], ["0x6020",159,20,20], ["0x6020",160,21,21], ["0x6020",161,22,22], ["0x6020",162,23,23], ["0x6020",163,15,15] ], //sector 2 - [ [] - ], //sector 3 + [ ["0x6033",1,16,16], ["0x6033",2,19,19], ["0x6033",3,6,6], ["0x6033",4,1,1], ["0x6033",5,4,4], + ["0x6033",6,7,7], ["0x6033",7,8,8], ["0x6033",8,11,11], ["0x6033",9,14,14], ["0x6033",10,9,9], + ["0x6033",11,12,12], ["0x6033",12,15,15], ["0x6033",13,0,0], ["0x6033",14,3,3], ["0x6033",15,22,22], ["0x6033",16,17,17], ["0x6033",17,20,20], + ["0x6033",18,23,23], ["0x6033",19,18,18], ["0x6033",20,21,21], ["0x6033",21,10,10], ["0x6033",22,13,13], ["0x6033",23,2,2], ["0x6033",24,5,5], + ["0x6034",25,2,2], ["0x6034",26,10,10], ["0x6034",27,13,13], ["0x6034",28,1,1], ["0x6034",29,15,15], ["0x6032",30,2,2], ["0x6032",31,13,13], ["0x6032",32,18,18], ["0x6032",33,21,21], + ["0x6034",34,22,22], ["0x6034",35,17,17], ["0x6034",36,20,20], ["0x6034",37,23,23], ["0x6034",38,4,4], ["0x6032",39,20,20], ["0x6032",40,7,7], ["0x6032",41,10,10], ["0x6032",42,5,5], + ["0x6034",43,3,3], ["0x6034",44,6,6], ["0x6034",45,0,0], ["0x6034",46,7,7], ["0x6032",47,15,15], ["0x6032",48,16,16], ["0x6032",49,0,0], ["0x6032",50,22,22], ["0x6032",51,17,17], + ["0x6034",52,18,18], ["0x6034",53,8,8], ["0x6034",54,11,11], ["0x6034",55,14,14], ["0x6034",56,9,9], ["0x6032",57,23,23], ["0x6032",58,8,8], ["0x6032",59,11,11], ["0x6032",60,14,14], ["0x6032",61,9,9], ["0x6032",62,12,12], + ["0x6034",63,12,12], ["0x6034",64,21,21], ["0x6034",65,16,16], ["0x6034",66,19,19], ["0x6034",67,5,5], ["0x6035",68,5,5], ["0x6032",69,19,19], ["0x6032",70,3,3], ["0x6032",71,6,6], ["0x6032",72,1,1], ["0x6032",73,4,4], + ["0x6035",74,21,21], ["0x6035",75,6,6], ["0x6035",76,14,14], ["0x6035",77,22,22], ["0x6035",78,7,7], ["0x6035",79,15,15], ["0x6035",80,23,23], ["0x6031",81,21,21], ["0x6031",82,6,6], ["0x6031",83,14,14], ["0x6031",84,22,22], ["0x6031",85,7,7], ["0x6031",86,15,15], + ["0x6035",87,3,3], ["0x6035",88,11,11], ["0x6035",89,19,19], ["0x6035",90,4,4], ["0x6035",91,12,12], ["0x6035",92,20,20], ["0x6031",93,18,18], ["0x6031",94,3,3], ["0x6031",95,11,11], ["0x6031",96,19,19], ["0x6031",97,4,4], ["0x6031",98,12,12], ["0x6031",99,20,20], + ["0x6035",100,0,0], ["0x6035",101,8,8], ["0x6035",102,16,16], ["0x6035",103,1,1], ["0x6035",104,9,9], ["0x6035",105,17,17], ["0x6035",106,2,2], ["0x6031",107,0,0], ["0x6031",108,8,8], ["0x6031",109,16,16], ["0x6031",110,1,1], ["0x6031",111,9,9], ["0x6031",112,17,17], ["0x6031",113,2,2], ["0x6031",114,10,10], + ["0x6035",115,18,18], ["0x6036",116,6,6], ["0x6036",117,14,14], ["0x6036",118,22,22], ["0x6036",119,7,7], ["0x6036",120,15,15], ["0x6036",121,23,23], ["0x6036",122,18,18], ["0x6030",123,21,21], ["0x6030",124,6,6], ["0x6030",125,14,14], ["0x6030",126,22,22], ["0x6030",127,7,7], ["0x6030",128,15,15], ["0x6030",129,23,23], + ["0x6036",130,21,21], ["0x6036",131,3,3], ["0x6036",132,11,11], ["0x6036",133,19,19], ["0x6036",134,4,4], ["0x6036",135,12,12], ["0x6036",136,20,20], ["0x6036",137,5,5], ["0x6036",138,13,13], ["0x6030",139,3,3], ["0x6030",140,11,11], ["0x6030",141,19,19], ["0x6030",142,4,4], ["0x6030",143,12,12], ["0x6030",144,20,20], ["0x6030",145,5,5], ["0x6030",146,13,13], + ["0x6036",147,0,0], ["0x6036",148,8,8], ["0x6036",149,16,16], ["0x6036",150,1,1], ["0x6036",151,9,9], ["0x6036",152,17,17], ["0x6036",153,2,2], ["0x6036",154,10,10], ["0x6030",155,0,0], ["0x6030",156,8,8], ["0x6030",157,16,16], ["0x6030",158,1,1], ["0x6030",159,9,9], ["0x6030",160,17,17], ["0x6030",161,2,2], ["0x6030",162,10,10], ["0x6030",163,18,18] + ], //sector 3, Note: update new cabeling (12.2021) [ ["0x6045",1,16,16], ["0x6045",2,17,17], ["0x6045",3,18,18], ["0x6045",4,19,19], ["0x6045",5,20,20], ["0x6045",6,8,8], ["0x6045",7,21,21], ["0x6045",8,22,22], ["0x6045",9,23,23], ["0x6045",10,0,0], @@ -1830,22 +1842,23 @@ function updatedata(d) { ["0x6046",147,0,0], ["0x6046",148,1,1], ["0x6046",149,2,2], ["0x6046",150,3,3], ["0x6046",151,4,4], ["0x6046",152,5,5], ["0x6046",153,6,6], ["0x6046",154,7,7], ["0x6040",155,0,0], ["0x6040",156,1,1], ["0x6040",157,2,2], ["0x6040",158,3,3], ["0x6040",159,4,4], ["0x6040",160,5,5], ["0x6040",161,6,6], ["0x6040",162,7,7], ["0x6040",163,15,15] ], //sector 4 - [ ["0x6056",1,16,16], ["0x6056",2,17,17], ["0x6056",3,18,18], ["0x6056",4,19,19], ["0x6056",5,20,20], - ["0x6056",6,8,8], ["0x6056",7,21,21], ["0x6056",8,22,22], ["0x6056",9,23,23], ["0x6056",10,0,0], - ["0x6056",11,9,9], ["0x6056",12,10,10], ["0x6056",13,11,11], ["0x6056",14,1,1], ["0x6056",15,2,2], ["0x6056",16,3,3], ["0x6056",17,4,4], - ["0x6056",18,12,12], ["0x6056",19,13,13], ["0x6056",20,14,14], ["0x6056",21,15,15], ["0x6056",22,5,5], ["0x6056",23,6,6], ["0x6056",24,7,7], - ["0x6055",25,16,16], ["0x6055",26,17,17], ["0x6055",27,18,18], ["0x6055",28,19,19], ["0x6055",29,20,20], ["0x6052",30,16,16], ["0x6052",31,17,17], ["0x6052",32,18,18], ["0x6052",33,19,19], - ["0x6055",34,8,8], ["0x6055",35,9,9], ["0x6055",36,21,21], ["0x6055",37,22,22], ["0x6055",38,23,23], ["0x6052",39,20,20], ["0x6052",40,21,21], ["0x6052",41,22,22], ["0x6052",42,23,23], - ["0x6055",43,10,10], ["0x6055",44,11,11], ["0x6055",45,12,12], ["0x6055",46,13,13], ["0x6052",47,0,0], ["0x6052",48,1,1], ["0x6052",49,2,2], ["0x6052",50,3,3], ["0x6052",51,4,4], - ["0x6055",52,0,0], ["0x6055",53,1,1], ["0x6055",54,2,2], ["0x6055",55,14,14], ["0x6055",56,15,15], ["0x6052",57,5,5], ["0x6052",58,6,6], ["0x6052",59,7,7], ["0x6052",60,8,8], ["0x6052",61,9,9], ["0x6052",62,10,10], - ["0x6055",63,3,3], ["0x6055",64,4,4], ["0x6055",65,5,5], ["0x6055",66,6,6], ["0x6055",67,7,7], ["0x6052",68,16,16], ["0x6052",69,11,11], ["0x6052",70,12,12], ["0x6052",71,13,13], ["0x6052",72,14,14], ["0x6052",73,15,15], - ["0x6054",74,17,17], ["0x6054",75,18,18], ["0x6054",76,19,19], ["0x6054",77,20,20], ["0x6054",78,21,21], ["0x6054",79,22,22], ["0x6054",80,23,23], ["0x6051",81,16,16], ["0x6051",82,17,17], ["0x6051",83,18,18], ["0x6051",84,19,19], ["0x6051",85,20,20], ["0x6051",86,21,21], - ["0x6054",87,8,8], ["0x6054",88,9,9], ["0x6054",89,10,10], ["0x6054",90,11,11], ["0x6054",91,12,12], ["0x6054",92,13,13], ["0x6051",93,9,9], ["0x6051",94,9,9], ["0x6051",95,10,10], ["0x6051",96,11,11], ["0x6051",97,12,12], ["0x6051",98,13,13], ["0x6051",99,14,14], - ["0x6054",100,0,0], ["0x6054",101,1,1], ["0x6054",102,2,2], ["0x6054",103,3,3], ["0x6054",104,4,4], ["0x6054",105,5,5], ["0x6054",106,6,6], ["0x6051",107,0,0], ["0x6051",108,1,1], ["0x6051",109,2,2], ["0x6051",110,3,3], ["0x6051",111,4,4], ["0x6051",112,5,5], ["0x6051",113,6,6], ["0x6051",114,7,7], - ["0x6054",115,7,7], ["0x6053",116,16,16], ["0x6053",117,17,17], ["0x6053",118,18,18], ["0x6053",119,19,19], ["0x6053",120,20,20], ["0x6053",121,21,21], ["0x6053",122,22,22], ["0x6050",123,16,16], ["0x6050",124,17,17], ["0x6050",125,18,18], ["0x6050",126,19,19], ["0x6050",127,20,20], ["0x6050",128,21,21], ["0x6050",129,22,22], - ["0x6053",130,8,8], ["0x6053",131,9,9], ["0x6053",132,10,10], ["0x6053",133,11,11], ["0x6053",134,12,12], ["0x6053",135,13,13], ["0x6053",136,14,14], ["0x6053",137,15,15], ["0x6053",138,23,23], ["0x6050",139,23,23], ["0x6050",140,8,8], ["0x6050",141,9,9], ["0x6050",142,10,10], ["0x6050",143,11,11], ["0x6050",144,12,12], ["0x6050",145,13,13], ["0x6050",146,14,14], - ["0x6053",147,0,0], ["0x6053",148,1,1], ["0x6053",149,2,2], ["0x6053",150,3,3], ["0x6053",151,4,4], ["0x6053",152,5,5], ["0x6053",153,6,6], ["0x6053",154,7,7], ["0x6050",155,0,0], ["0x6050",156,1,1], ["0x6050",157,2,2], ["0x6050",158,3,3], ["0x6050",159,4,4], ["0x6050",160,5,5], ["0x6050",161,6,6], ["0x6050",162,7,7], ["0x6050",163,15,15] - ] //sector 5 + [ ["0x6056",1,16,16], ["0x6056",2,19,19], ["0x6056",3,6,6], ["0x6056",4,1,1], ["0x6056",5,4,4], + ["0x6056",6,7,7], ["0x6056",7,8,8], ["0x6056",8,11,11], ["0x6056",9,14,14], ["0x6056",10,9,9], + ["0x6056",11,12,12], ["0x6056",12,15,15], ["0x6056",13,0,0], ["0x6056",14,3,3], ["0x6056",15,22,22], ["0x6056",16,17,17], ["0x6056",17,20,20], + ["0x6056",18,23,23], ["0x6056",19,18,18], ["0x6056",20,21,21], ["0x6056",21,10,10], ["0x6056",22,13,13], ["0x6056",23,2,2], ["0x6056",24,5,5], + ["0x6055",25,2,2], ["0x6055",26,10,10], ["0x6055",27,13,13], ["0x6055",28,1,1], ["0x6055",29,15,15], ["0x6052",30,2,2], ["0x6052",31,13,13], ["0x6052",32,18,18], ["0x6052",33,21,21], + ["0x6055",34,22,22], ["0x6055",35,17,17], ["0x6055",36,20,20], ["0x6055",37,23,23], ["0x6055",38,4,4], ["0x6052",39,20,20], ["0x6052",40,7,7], ["0x6052",41,10,10], ["0x6052",42,5,5], + ["0x6055",43,3,3], ["0x6055",44,6,6], ["0x6055",45,0,0], ["0x6055",46,7,7], ["0x6052",47,15,15], ["0x6052",48,16,16], ["0x6052",49,0,0], ["0x6052",50,22,22], ["0x6052",51,17,17], + ["0x6055",52,18,18], ["0x6055",53,8,8], ["0x6055",54,11,11], ["0x6055",55,14,14], ["0x6055",56,9,9], ["0x6052",57,23,23], ["0x6052",58,8,8], ["0x6052",59,11,11], ["0x6052",60,14,14], ["0x6052",61,9,9], ["0x6052",62,12,12], + ["0x6055",63,12,12], ["0x6055",64,21,21], ["0x6055",65,16,16], ["0x6055",66,19,19], ["0x6055",67,5,5], ["0x6054",68,5,5], ["0x6052",69,19,19], ["0x6052",70,3,3], ["0x6052",71,6,6], ["0x6052",72,1,1], ["0x6052",73,4,4], + ["0x6054",74,21,21], ["0x6054",75,6,6], ["0x6054",76,14,14], ["0x6054",77,22,22], ["0x6054",78,7,7], ["0x6054",79,15,15], ["0x6054",80,23,23], ["0x6051",81,21,21], ["0x6051",82,6,6], ["0x6051",83,14,14], ["0x6051",84,22,22], ["0x6051",85,7,7], ["0x6051",86,15,15], + ["0x6054",87,3,3], ["0x6054",88,11,11], ["0x6054",89,19,19], ["0x6054",90,4,4], ["0x6054",91,12,12], ["0x6054",92,20,20], ["0x6051",93,18,18], ["0x6051",94,3,3], ["0x6051",95,11,11], ["0x6051",96,19,19], ["0x6051",97,4,4], ["0x6051",98,12,12], ["0x6051",99,20,20], + ["0x6054",100,0,0], ["0x6054",101,8,8], ["0x6054",102,16,16], ["0x6054",103,1,1], ["0x6054",104,9,9], ["0x6054",105,17,17], ["0x6054",106,2,2], ["0x6051",107,0,0], ["0x6051",108,8,8], ["0x6051",109,16,16], ["0x6051",110,1,1], ["0x6051",111,9,9], ["0x6051",112,17,17], ["0x6051",113,2,2], ["0x6051",114,10,10], + ["0x6054",115,18,18], ["0x6053",116,6,6], ["0x6053",117,14,14], ["0x6053",118,22,22], ["0x6053",119,7,7], ["0x6053",120,15,15], ["0x6053",121,23,23], ["0x6053",122,18,18], ["0x6050",123,21,21], ["0x6050",124,6,6], ["0x6050",125,14,14], ["0x6050",126,22,22], ["0x6050",127,7,7], ["0x6050",128,15,15], ["0x6050",129,23,23], + ["0x6053",130,21,21], ["0x6053",131,3,3], ["0x6053",132,11,11], ["0x6053",133,19,19], ["0x6053",134,4,4], ["0x6053",135,12,12], ["0x6053",136,20,20], ["0x6053",137,5,5], ["0x6053",138,13,13], ["0x6050",139,3,3], ["0x6050",140,11,11], ["0x6050",141,19,19], ["0x6050",142,4,4], ["0x6050",143,12,12], ["0x6050",144,20,20], ["0x6050",145,5,5], ["0x6050",146,13,13], + ["0x6053",147,0,0], ["0x6053",148,8,8], ["0x6053",149,16,16], ["0x6053",150,1,1], ["0x6053",151,9,9], ["0x6053",152,17,17], ["0x6053",153,2,2], ["0x6053",154,10,10], ["0x6050",155,0,0], ["0x6050",156,8,8], ["0x6050",157,16,16], ["0x6050",158,1,1], ["0x6050",159,9,9], ["0x6050",160,17,17], ["0x6050",161,2,2], ["0x6050",162,10,10], ["0x6050",163,18,18] + ] //sector 5, Note: new installed sector with new cabeling (12.2021) + ]; for (var i=0;i full names (_allnames) + use strict; use warnings; @@ -11,22 +14,32 @@ use Try::Tiny; use DateTime; use DateTime::Format::ISO8601; + + sub hashify { - my $d = $_[0]; + my $d = $_[0]; #current object + my $fn = $_[1].'/'; #full name + my $data = $_[2]; #global object + if ($d->{'_childs'}) { - my $i = 0; for my $c (0 .. scalar @{$d->{'_childs'}}) { - foreach my $k (keys %{$d->{'_childs'}[$i]}) { - $d->{$d->{'_childs'}[$i]{'_name'}}{$k} = $d->{'_childs'}[$i]{$k}; + my $name = $d->{'_childs'}[$c]{'_name'}; + next unless $name; + $d->{$name}{'_fullname'} = $fn.$name; + push(@{$data->{'_fullnames'}}, $fn.$name); + $data->{'_allnames'}{$name} = $fn.$name; + foreach my $k (keys %{$d->{'_childs'}[$c]}) { + if($k ne '_dabc_hist' && $k ne '_after_request' && $k ne '_make_request') { + $d->{$name}{$k} = $d->{'_childs'}[$c]{$k}; + } if($k eq 'time') { - my $dt = DateTime::Format::ISO8601->parse_datetime($d->{$d->{'_childs'}[$i]{'_name'}}{$k}); - $d->{$d->{'_childs'}[$i]{'_name'}}{$k} = $dt->epoch(); + my $dt = DateTime::Format::ISO8601->parse_datetime($d->{$name}{$k}); + $d->{$name}{$k} = $dt->epoch(); } - if($k eq '_childs') { - hashify($d->{$d->{'_childs'}[$i]{'_name'}}); + elsif($k eq '_childs') { + hashify($d->{$name},$fn.$name,$data); } } - $i++; } delete ($d->{'_childs'}); } @@ -35,10 +48,12 @@ sub hashify { sub getjsonhash { my ($src, $name) = @_; - my $baseurl; + my $baseurl = "invalid"; if($src eq 'rawmon') {$baseurl = 'http://lxhadeb12:8090/';} if($src eq 'ebmon') {$baseurl = 'http://lxhadeb12:8090/';} if($src eq 'eb') {$baseurl = 'http://lxhadeb12:8099/';} + if($src eq 'calib') {$baseurl = 'http://hadesp66:8092/';} + if($src eq 'calibtest') {$baseurl = 'http://hadesp63:8097/';} my $rawdata = get ($baseurl.$name); @@ -51,7 +66,7 @@ sub getjsonhash { } - hashify($data); + hashify($data,'',$data); return $data; } diff --git a/hmon/getrootjson.pm b/hmon/getrootjson.pm new file mode 100755 index 0000000..544d7fb --- /dev/null +++ b/hmon/getrootjson.pm @@ -0,0 +1,63 @@ +#!/usr/bin/perl -w +use strict; +use warnings; +use LWP::Simple qw(get); +use JSON qw( decode_json encode_json ); +use Data::Dumper; +use CGI qw(:standard); + + +sub getroothist { + my ($src, $name) = @_; + + my $baseurl = "invalid"; + if($src eq 'rawmon') {$baseurl = 'http://lxhadeb12:8090';} + if($src eq 'ebmon') {$baseurl = 'http://lxhadeb12:8090';} + if($src eq 'eb') {$baseurl = 'http://lxhadeb07:8099';} + if($src eq 'calib') {$baseurl = 'http://hadesp66:8092';} + if($src eq 'calibtest') {$baseurl = 'http://hadesp63:8097';} + + + + my $rawdata = get ($baseurl.$name."/get.json"); + + my $data; + + if (defined $rawdata) { + $data = decode_json($rawdata); + + foreach my $s ('xlabels', 'ylabels', 'zlabels') { + if ($data->{$s}) { + my @labels = split(',',$data->{$s}); + $data->{$s} = \@labels; + } + } + + + if($data->{'_kind'} eq 'ROOT.TH1D') { + $data->{"underflow"} = $data->{bins}[3]; + $data->{"overflow"} = $data->{bins}[-1]; + @{$data->{"bins"}} = splice(@{$data->{"bins"}},4,-1); + } + + if($data->{'_kind'} eq 'ROOT.TH2D') { + my $d; + foreach my $x (1..$data->{nbins1}) { + foreach my $y (1..$data->{nbins2}) { + $d->[$x-1][$y-1] = $data->{bins}[6+$x+$y*($data->{nbins1}+2)]; + } + } + # foreach my $x (1..$data->{nbins1}) { + # $data->{underflow}{x}[$x] = $data->{bins}[7+$x]; + # $data->{overflow}{x}[$x] = $data->{bins}[-($data->{nbins1}+$x-2)]; + # } + + $data->{bins} = $d; + } + return $data; + } + } + + + +1; diff --git a/hmon/hmon_boxmon.pl b/hmon/hmon_boxmon.pl index 4cb22f9..6b08ee7 100755 --- a/hmon/hmon_boxmon.pl +++ b/hmon/hmon_boxmon.pl @@ -12,30 +12,34 @@ use Time::HiRes qw(usleep time); use List::Util qw[min max sum]; -my $old; -my $oldtime = time(); -my $time = time(); +my $oldtb; my $diff; my $iter = 0; +my $vdiff; trb_init_ports() or die trb_strerror(); my $regs = [[128,129,130,131,132,133],[136,137,138,139,141,142],[500,501,502,503,504,505],[176,177,178,179,180,181],[192,193,194,195,196,197],[600,601,602,603,604,605],[700,701,702,703,704,705]]; while (1) { - my $o; - $o = trb_register_read_mem(0x10,0x9000,0,224); + + my $tb = trb_registertime_read_mem(0x10,0x9000,0,224); - if (defined $old) { - foreach my $b (keys %$o) { + my $inspill = $tb->{0x10}{value}[0x5d] >> 31; + + if (defined $oldtb) { + foreach my $b (keys %$tb) { + my $tdiff = $tb->{$b}{time}[0] - ($oldtb->{$b}{time}[0]||0); + $tdiff += 2**16 if ($tdiff <= 0); + $tdiff = ($tdiff * 16 / 1E6) || 1; for my $v (0..223) { - my $tdiff = time() - $oldtime; - my $vdiff = ($o->{$b}->[$v]&0xffffff) - ($old->{$b}->[$v]&0xffffff); - if ($vdiff < 0) { $vdiff += 2**24;} - $diff->{$b}->[$v] = $vdiff/($tdiff||1); + $vdiff = ($tb->{$b}{value}[$v]&0xffffff) - ($oldtb->{$b}{value}[$v]&0xffffff); + $vdiff += 2**24 if ($vdiff < 0); + $diff->{$b}->[$v] = $vdiff/$tdiff; } - } - + } + + $diff->{0x10}[500] = $diff->{0x10}[$regs->[0][0]] + $diff->{0x10}[$regs->[1][0]]; $diff->{0x10}[501] = $diff->{0x10}[$regs->[0][1]] + $diff->{0x10}[$regs->[1][1]]; $diff->{0x10}[502] = $diff->{0x10}[$regs->[0][2]] + $diff->{0x10}[$regs->[1][2]]; @@ -56,7 +60,10 @@ while (1) { $diff->{0x10}[703] = $diff->{0x10}[$regs->[4][3]] / ($diff->{0x10}[$regs->[2][3]]||1) * 100; $diff->{0x10}[704] = $diff->{0x10}[$regs->[4][4]] / ($diff->{0x10}[$regs->[2][4]]||1) * 100; $diff->{0x10}[705] = $diff->{0x10}[$regs->[4][5]] / ($diff->{0x10}[$regs->[2][5]]||1) * 100; - + + $diff->{0x10}[800] = sum(@{$diff->{0x10}}[56..63]) + sum(@{$diff->{0x10}}[72..79]); #sum from start +# print Dumper @{$diff->{0x10}}[56..63]; + my $str = Hmon::MakeTitle(8, 8, "Coincidences",1); $str .= "
TOFRPCSumiTOFCoincidencesCoin %Coin/TOFRPC"; @@ -70,23 +77,24 @@ while (1) { } $str .= "

"; - $str .= "

iTOF/TofRpc coincidence, mult 2
"; - $str .= QA::SciNotation($diff->{0x10}[209]); + $str .= box("iTOF/TofRpc coincidence, mult 2",240). box(QA::SciNotation($diff->{0x10}[209]))."
"; - $str .= "

M2/Veto"; - $str .= box(QA::SciNotation($diff->{0x10}[80]))." ".box(QA::SciNotation($diff->{0x10}[25]))." ".box(QA::SciNotation($diff->{0x10}[80]/$diff->{0x10}[25]||1)); + $str .= box("M2/Veto")." ".box(QA::SciNotation($diff->{0x10}[80]))." ".box(QA::SciNotation($diff->{0x10}[25]))." ".box(QA::SciNotation($diff->{0x10}[80]/($diff->{0x10}[25]||1)))."
"; + $str .= box("M2/Start")." ".box(QA::SciNotation($diff->{0x10}[80]))." ".box(QA::SciNotation($diff->{0x10}[800]))." ".box(QA::SciNotation($diff->{0x10}[80]/($diff->{0x10}[800]||1)))."
"; + + $str .= "

in spill
" if $inspill; + $str .= Hmon::MakeFooter(); Hmon::WriteFile("Triggerbox",$str); } - - $oldtime = time(); - $old = $o; + $oldtb = $tb; usleep(500000); } sub box { - return "
$_[0]
"; + my $w = $_[1] || 80; + return "
$_[0]
"; } diff --git a/hmon/hmon_eb_rate.pl b/hmon/hmon_eb_rate.pl index 7dfc4e2..ccf0e9c 100755 --- a/hmon/hmon_eb_rate.pl +++ b/hmon/hmon_eb_rate.pl @@ -20,7 +20,7 @@ my $offset = 2; my $last_rate_endp = 0; my $opt_addr = 3; #CTS my $error_ctr = 0; -my $error_limit = 1; +my $error_limit = 3; my $opt_debug =1; diff --git a/hmon/hmon_endpoints.pl b/hmon/hmon_endpoints.pl index b0d8d2f..99012e3 100755 --- a/hmon/hmon_endpoints.pl +++ b/hmon/hmon_endpoints.pl @@ -273,7 +273,7 @@ while(1) { my $qastate = QA::GetQAState('below',$num_mdc_missing,@QA::MdcEndpMissingLimits); $qastate = QA::ERROR if $samechamberboards; - $qastate = QA::ERROR if $mdcmissingtime > 250; + $qastate = QA::ERROR if $mdcmissingtime > 360; $longtext .= "
Few boards missing, but for a long time. Better do a restart." if $mdcmissingtime > 1800; Hmon::Speak('mdcmissonce',"$num_mdc_missing MDC Frontends missing") if($qastate > 60 && $qastate < QA::ERROR ); diff --git a/hmon/hmon_micro.pl b/hmon/hmon_micro.pl old mode 100755 new mode 100644 diff --git a/hmon/hmon_rate2.pl b/hmon/hmon_rate2.pl index 38fb3d5..cf832d8 100755 --- a/hmon/hmon_rate2.pl +++ b/hmon/hmon_rate2.pl @@ -39,7 +39,9 @@ sub getCorrectedValue { while (1) { my $rh_rate; $rh_rate = trb_register_read_mem(0x0003, 0xa001, 0, 0xff) or sleep 5 and next; - + my $spillsignal = trb_register_read(0x10,0x905d); + $spillsignal = $spillsignal->{0x10} >> 31; + my %store; foreach my $board (sort {$a <=> $b} keys %$rh_rate) { my $ctr = 0xa001; @@ -137,7 +139,8 @@ while (1) { my $oos; #Out of spill? - if($store{0xa02c} < 50) { +# if($store{0xa02c} < 50) { + if(!$spillsignal){ for my $b (0xa029, 0xa02a, 0xa02b, 0xa024, 0xa009, 0xa03c, 0xa037, 0xa02c, 0xa028, 0xa025, 0xa026) { $offset->{$b} = ($offset->{$b}||0) + (($store{$b}||0) - ($offset->{$b}||0))/10; } diff --git a/hmon/hmon_spill.pl b/hmon/hmon_spill.pl index 307c836..deb1869 100755 --- a/hmon/hmon_spill.pl +++ b/hmon/hmon_spill.pl @@ -21,7 +21,7 @@ my $events = 0; my $spilllength = 0; my $lastres = 0; my $midlastres = 0; -my $outofspill = 0; +my $lastspillsignal = 0; my @spills; my $spillavgshort = 0; my $spillavglong = 0; @@ -67,6 +67,8 @@ while (1) { $evtrate = 0 if $iter%2==0; my $trbneterr = 0; my $rh_result = trb_register_read(QA::CTSAddress, 0xa002) or $trbneterr = 1; #sleep 5 and next; + my $spillsignal = trb_register_read(0x10,0x905d); + $spillsignal = $spillsignal->{0x10} >> 31; my $stopped = trb_register_read(0x3,0xa0c0) or sleep 5 and next; $stopped = ($stopped->{3} || 0) & 0x400; @@ -80,8 +82,8 @@ while (1) { # my $spillcount = 0; # my $inspill = 0; - $lastspill = $outofspill; - $outofspill = ($rh_result->{QA::CTSAddress} || 0) & 0x10; +# $lastspill = $outofspill; +# $outofspill = ($rh_result->{QA::CTSAddress} || 0) & 0x10; $spilllength++ if $iter%2==0; #if($outofspill); $rh_result = trb_register_read(0x0002, 0x01) or $trbneterr = 1; #sleep 5 and next; @@ -105,7 +107,7 @@ while (1) { - if ($outofspill && !$lastspill) { + if (!$spillsignal && $lastspillsignal) { $spillcount++; push(@spills, $events); shift(@spills) if scalar @spills > 50; @@ -145,7 +147,7 @@ while (1) { # Hmon::Speak('nobeam', "No beam"); # } my $prefix = get ($url_prefix); - print Dumper $prefix; +# print Dumper $prefix; $prefix = "--" unless defined $prefix; if(($prefix =~ '-1') || ($prefix =~ 'be')) { Hmon::Speak('nobeam', "No beam") unless $opt_debug>0; @@ -153,7 +155,7 @@ while (1) { } } - + $lastspillsignal = $spillsignal; $qashort = sprintf(" %i ", $evtrate); $qastate = QA::OK; diff --git a/hmon/hmon_startrate.pl b/hmon/hmon_startrate.pl index 992397c..6229b50 100755 --- a/hmon/hmon_startrate.pl +++ b/hmon/hmon_startrate.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/perl -w use warnings; use strict; @@ -403,19 +403,38 @@ my $trbnet_endpoint_offset = 0x5000; #20480 # Spill variables my @totalDetectorHitsX_0; my @totalDetectorHitsY_0; +my @totalDetectorHitsX_1; +my @totalDetectorHitsY_1; my $spillThreshold = 1000; # threshold of rate in detector signaling the End of the Spill my $samplesPerSecond =10; my @lastspills_x_0; my @lastspills_y_0; +my @lastspills_x_1; +my @lastspills_y_1; + my $time_x_0 = 0; my $time_y_0 = 0; +my $time_x_1 = 0; +my $time_y_1 = 0; my $empties_x_0 = 0; my $empties_y_0 = 0; +my $empties_x_1 = 0; +my $empties_y_1 = 0; + + my($max_x_0, $duty_x_0, $total_x_0, $spillmin_x_0, $spillmax_x_0, $spillavg_x_0, $flucqual_x_0, $offtime_x_0, $length_x_0, $spillEnds_x_0) = (0, 0, 0, 0, 0, 0, 0, 0, "", 0); my($max_y_0, $duty_y_0, $total_y_0, $spillmin_y_0, $spillmax_y_0, $spillavg_y_0, $flucqual_y_0, $offtime_y_0, $length_y_0, $spillEnds_y_0) = (0, 0, 0, 0, 0, 0, 0, 0, "", 0); + +my($max_x_1, $duty_x_1, $total_x_1, $spillmin_x_1, $spillmax_x_1, $spillavg_x_1, $flucqual_x_1, $offtime_x_1, $length_x_1, $spillEnds_x_1) = (0, 0, 0, 0, 0, 0, 0, 0, "", 0); +my($max_y_1, $duty_y_1, $total_y_1, $spillmin_y_1, $spillmax_y_1, $spillavg_y_1, $flucqual_y_1, $offtime_y_1, $length_y_1, $spillEnds_y_1) = (0, 0, 0, 0, 0, 0, 0, 0, "", 0); + +my $maxTotalX; +my $maxTotalY; + + my ($lastinspill,$inspill,$spillends) = (0,0,0); HPlot::PlotDrawFork('StartSpillSumX_0'); @@ -824,6 +843,18 @@ while(1) { shift(@totalDetectorHitsY_0) if scalar @totalDetectorHitsY_0 > 2000; $empties_y_0++ if ($sum_y_0 < 1000); + +# added W.K 01.02.22 + push(@totalDetectorHitsX_1, $sum_x_1); + shift(@totalDetectorHitsX_1) if scalar @totalDetectorHitsX_1 > 2000; # makes sure that the array does not get huge. after 200 seconds of no beam, the last entries start to fall off + $empties_x_1++ if ($sum_x_1 < 1000); + push(@totalDetectorHitsY_1, $sum_y_1); + shift(@totalDetectorHitsY_1) if scalar @totalDetectorHitsY_1 > 2000; + $empties_y_1++ if ($sum_y_1 < 1000); +# end added + + + my $sp = trb_register_read(0x10,0x905d); # check it $inspill = ($sp->{0x10} >> 31) & 1; $spillends = $inspill == 0 && $lastinspill == 1; @@ -831,29 +862,60 @@ while(1) { if($spillends){ ($max_x_0, $duty_x_0, $total_x_0, $spillmin_x_0, $spillmax_x_0, $spillavg_x_0, $flucqual_x_0, $offtime_x_0, $length_x_0, $time_x_0, $empties_x_0, $spillEnds_x_0) = spillAnalysisACCSIG(\@totalDetectorHitsX_0, \@lastspills_x_0, $time_x_0, $empties_x_0); + $maxTotalX= calculateMaximumRate(\@totalDetectorHitsX_0,\@totalDetectorHitsX_1); + $maxTotalY= calculateMaximumRate(\@totalDetectorHitsY_0,\@totalDetectorHitsY_1); + @totalDetectorHitsX_0 = (); ($max_y_0, $duty_y_0, $total_y_0, $spillmin_y_0, $spillmax_y_0, $spillavg_y_0, $flucqual_y_0, $offtime_y_0, $length_y_0,$time_y_0, $empties_y_0, $spillEnds_y_0) = spillAnalysisACCSIG(\@totalDetectorHitsY_0, \@lastspills_y_0, $time_y_0, $empties_y_0); @totalDetectorHitsY_0 = (); + +# added W.K. 01.2.22 to include values of whole detector in plots + ($max_x_1, $duty_x_1, $total_x_1, $spillmin_x_1, $spillmax_x_1, $spillavg_x_1, $flucqual_x_1, $offtime_x_1, $length_x_1, $time_x_1, $empties_x_1, $spillEnds_x_1) = spillAnalysisACCSIG(\@totalDetectorHitsX_1, \@lastspills_x_1, $time_x_1, $empties_x_1); + + @totalDetectorHitsX_1 = (); + + ($max_y_1, $duty_y_1, $total_y_1, $spillmin_y_1, $spillmax_y_1, $spillavg_y_1, $flucqual_y_1, $offtime_y_1, $length_y_1,$time_y_1, $empties_y_1, $spillEnds_y_1) = spillAnalysisACCSIG(\@totalDetectorHitsY_1, \@lastspills_y_1, $time_y_1, $empties_y_1); + + @totalDetectorHitsY_1 = (); + +# end added + + + } if($spillends){ # Start X +# HPlot::PlotAdd("StartDutyFactorX_0", $duty_x_0,0); +# HPlot::PlotAdd("StartSpillPeakX_0", $max_x_0,0); +# HPlot::PlotAdd("StartSpillSumX_0", $total_x_0,0); + +# changed W.K 01.02.22 max_x and total_x for whole detector HPlot::PlotAdd("StartDutyFactorX_0", $duty_x_0,0); - HPlot::PlotAdd("StartSpillPeakX_0", $max_x_0,0); - HPlot::PlotAdd("StartSpillSumX_0", $total_x_0,0); + HPlot::PlotAdd("StartSpillPeakX_0", $maxTotalX,0); + HPlot::PlotAdd("StartSpillSumX_0", $total_x_0+$total_x_1,0); +# end changed $str = Hmon::MakeTitle(8, 19, "StartSpillShapeAnalysisX_0",1); $str .= qq@
\n@; $str .= qq@\n@; $str .= qq@\n@; $str .= qq@\n@; - $str .= "
Last Sum".QA::SciNotation($total_x_0); +# $str .= "
Last Sum".QA::SciNotation($total_x_0); + +# changed W.K. 01.02.22 total spill sum total_x=total_x_1+total_x_0 + $str .= "
Last Sum".QA::SciNotation( $maxTotalX); +# end changed + $str .= "Last Duty".sprintf("%0.3f",$duty_x_0); $str .= "
Last Duration".$length_x_0; $str .= "Last Break".$offtime_x_0." s"; - $str .= "
Last Max".QA::SciNotation($max_x_0)." Hz (100ms)"; +# $str .= "
Last Max".QA::SciNotation($max_x_0)." Hz (100ms)"; +# changed W.K. 01.02.22 total max_x = max_x_0+max_x_1 + $str .= "
Last Max".QA::SciNotation($maxTotalY)." Hz (100ms)"; +# end changed $str .= "Spill Fluctuation".QA::SciNotation($spillmin_x_0)." - ".QA::SciNotation($spillmax_x_0)."
∅ ".QA::SciNotation($spillavg_x_0)." (".QA::SciNotation($flucqual_x_0).")"; $str .= "
"; $str .= Hmon::MakeFooter(); @@ -864,20 +926,36 @@ while(1) { HPlot::PlotDrawFork('StartDutyFactorX_0'); # Start Y +# HPlot::PlotAdd("StartDutyFactorY_0", $duty_y_0,0); +# HPlot::PlotAdd("StartSpillPeakY_0", $max_y_0,0); +# HPlot::PlotAdd("StartSpillSumY_0", $total_y_0,0); +# changed W.K 01.02.22 HPlot::PlotAdd("StartDutyFactorY_0", $duty_y_0,0); - HPlot::PlotAdd("StartSpillPeakY_0", $max_y_0,0); - HPlot::PlotAdd("StartSpillSumY_0", $total_y_0,0); + HPlot::PlotAdd("StartSpillPeakY_0",$maxTotalY,0); + HPlot::PlotAdd("StartSpillSumY_0", $total_y_0+$total_y_1,0); +# end changed + + + $str = Hmon::MakeTitle(8, 19, "StartSpillShapeAnalysisY_0",1); $str .= qq@
\n@; $str .= qq@\n@; $str .= qq@\n@; $str .= qq@\n@; - $str .= "
Last Sum".QA::SciNotation($total_x_0); +# $str .= "
Last Sum".QA::SciNotation($total_x_0); + +# changed W.K. 01.02.22 + $str .= "
Last Sum".QA::SciNotation($maxTotalY); +# end changed + $str .= "Last Duty".sprintf("%0.3f",$duty_y_0); $str .= "
Last Duration".$length_y_0; $str .= "Last Break".$offtime_y_0." s"; - $str .= "
Last Max".QA::SciNotation($max_y_0)." Hz (100ms)"; +# $str .= "
Last Max".QA::SciNotation($max_y_0)." Hz (100ms)"; +# changed W.K. 01.02.22 + $str .= "
Last Max".QA::SciNotation($maxTotalY)." Hz (100ms)"; +# end changed $str .= "Spill Fluctuation".QA::SciNotation($spillmin_y_0)." - ".QA::SciNotation($spillmax_y_0)."
∅ ".QA::SciNotation($spillavg_y_0)." (".QA::SciNotation($flucqual_y_0).")"; $str .= "
"; $str .= Hmon::MakeFooter(); @@ -1044,3 +1122,39 @@ sub spillAnalysisACCSIG{ # $lastinspill = $inspill; # return (0, 0, 0, 0, 0, 0, 0, 0, 0, 0); } + +sub calculateMaximumRate{ + my ($totalDetectorHitsReference_firstHalf,$totalDetectorHitsReference_secondHalf)=@_; + my @totalDetectorHitsFirstHalf = @{$totalDetectorHitsReference_firstHalf}; + my @totalDetectorHitsSecondHalf = @{$totalDetectorHitsReference_secondHalf}; + my $maximumRate =0; + + my $lengthOfArray=0; + + my @sumOfTotalDetectorHits; + + my $lengthOfArrayFirstHalf = scalar @totalDetectorHitsFirstHalf; + my $lengthOfArraySecondHalf = scalar @totalDetectorHitsSecondHalf; + + if ($lengthOfArraySecondHalf == $lengthOfArrayFirstHalf && $lengthOfArraySecondHalf>0 ){ + $lengthOfArray = $lengthOfArrayFirstHalf; + for my $i (0..$lengthOfArray){ + $sumOfTotalDetectorHits[$i]=0; + } + for my $i (0..$lengthOfArray){ + $sumOfTotalDetectorHits[$i]= $totalDetectorHitsFirstHalf[$i]+ $totalDetectorHitsSecondHalf[$i]; + } + + $maximumRate = max(@sumOfTotalDetectorHits); + + } + + return $maximumRate; + + +} + + + + + diff --git a/hmon/hmon_triggerratio.pl b/hmon/hmon_triggerratio.pl new file mode 100755 index 0000000..2e74321 --- /dev/null +++ b/hmon/hmon_triggerratio.pl @@ -0,0 +1,140 @@ +#!/usr/bin/perl + +use warnings; +use strict; +use Data::Dumper; +use Data::TreeDumper; +use Hmon; +use QA; +use HADES::TrbNet; +use HPlot; +use Time::HiRes qw(usleep time); +use List::Util qw[min max sum]; + +my $STARTRATELIMIT = 50000; +my $UPPERLIMIT = 0.03; +my $oldtb; +my $diff; +my $iter = 0; +my $vdiff; + +HPlot::PlotInit({ + name => "M2StartRatio", + file => "files/M2StartRatio", + entries => 1000, + type => HPlot::TYPE_HISTORY, + output => HPlot::OUT_PNG, + xlabel => "Time", + ylabel => "Ratio", + sizex => 950, + sizey => 330, + ymin => -0.001, + ymax => "$UPPERLIMIT"."1", + xscale => 5, + curves => 2, + buffer => 1, + nokey => 1, + dots => 1, + storable => 1, + }); + +HPlot::PlotInit({ + name => "M2Rate", + file => "files/M2Rate", + entries => 1000, + type => HPlot::TYPE_HISTORY, + output => HPlot::OUT_PNG, + xlabel => "Time", + ylabel => "Rate", + sizex => 950, + sizey => 330, + ymin => -0.001, + ymax => "1E5<*", + xscale => 5, + curves => 2, + buffer => 1, + nokey => 1, +# dots => 1, + storable => 1, + }); + +my $str = Hmon::MakeTitle(12, 7, "M2 / Start Ratio",0); + $str .= qq@
\n@; + $str .= Hmon::MakeFooter(); + Hmon::WriteFile("M2StartRatio",$str); + + $str = Hmon::MakeTitle(12, 7, "M2 Rate",0); + $str .= qq@
\n@; + $str .= Hmon::MakeFooter(); + Hmon::WriteFile("M2Rate",$str); + +trb_init_ports() or die trb_strerror(); + + +while (1) { + my $tb = trb_registertime_read_mem(0x10,0x9000,0,224); + + my $inspill = $tb->{0x10}{value}[0x5d] >> 31; + + if (defined $oldtb) { + foreach my $b (keys %$tb) { + my $tdiff = $tb->{$b}{time}[0] - ($oldtb->{$b}{time}[0]||0); + $tdiff += 2**16 if ($tdiff <= 0); + $tdiff = ($tdiff * 16 / 1E6) || 1; + for my $v (0..223) { + $vdiff = ($tb->{$b}{value}[$v]&0xffffff) - ($oldtb->{$b}{value}[$v]&0xffffff); + $vdiff += 2**24 if ($vdiff < 0); + $diff->{$b}->[$v] = $vdiff/$tdiff; + } + } + + + my $start = sum(@{$diff->{0x10}}[56..63]) + sum(@{$diff->{0x10}}[72..79]); #sum from start + my $m2 = $diff->{0x10}[0x50]; + + my $ratio = $m2/($start||1); + if ($start <= $STARTRATELIMIT || !$inspill) { + HPlot::PlotAdd("M2StartRatio",0,1); + HPlot::PlotAdd("M2StartRatio","NaN",0) + } + elsif ($ratio >= $UPPERLIMIT) { + HPlot::PlotAdd("M2StartRatio",$UPPERLIMIT,1); + HPlot::PlotAdd("M2StartRatio","NaN",0) + } + + else { + HPlot::PlotAdd("M2StartRatio","NaN",1); + HPlot::PlotAdd("M2StartRatio",$ratio,0) + } + + + if (!$inspill) { + HPlot::PlotAdd("M2Rate",0,1); + HPlot::PlotAdd("M2Rate","NaN",0) + } +# elsif ($ratio >= $UPPERLIMIT) { +# HPlot::PlotAdd("M2StartRatio",$UPPERLIMIT,1); +# HPlot::PlotAdd("M2StartRatio","NaN",0) +# } + else { + HPlot::PlotAdd("M2Rate","NaN",1); + HPlot::PlotAdd("M2Rate",$m2,0) + } + + + if($iter++ == 5){ + HPlot::PlotDrawFork("M2StartRatio"); + HPlot::PlotDrawFork("M2Rate"); + $iter = 0; + } + } + + $oldtb = $tb; + usleep(200000); + } + + +sub box { + my $w = $_[1] || 80; + return "
$_[0]
"; + } diff --git a/hmon/index.cgi b/hmon/index.cgi index c580ccd..4169801 100755 --- a/hmon/index.cgi +++ b/hmon/index.cgi @@ -38,34 +38,35 @@ function openwin(url) { + + -