Commit 82d99e73 authored by David Cussans's avatar David Cussans

fixed typo in miniTLU.xml (counter registers were write-only rather than…

fixed typo in miniTLU.xml (counter registers were write-only rather than read-only). Added print out of counters to startTLU
parent 488c3cb3
......@@ -14,10 +14,10 @@
<node id="triggerInputs" address="0x040" description="Inputs configuration">
<node id="SerdesRst" address="0x0" permission="w" description="" />
<node id="SerdesRstR" address="0x8" permission="w" description="" />
<node id="ThrCount0R" address="0x9" permission="w" description="" />
<node id="ThrCount1R" address="0xa" permission="w" description="" />
<node id="ThrCount2R" address="0xb" permission="w" description="" />
<node id="ThrCount3R" address="0xc" permission="w" description="" />
<node id="ThrCount0R" address="0x9" permission="r" description="" />
<node id="ThrCount1R" address="0xa" permission="r" description="" />
<node id="ThrCount2R" address="0xb" permission="r" description="" />
<node id="ThrCount3R" address="0xc" permission="r" description="" />
</node>
<node id="triggerLogic" address="0x060" description="Trigger logic configuration">
......
......@@ -35,9 +35,9 @@ parser = OptionParser()
parser.add_option('-r','--rootFname',dest='rootFname',
default=default_filename,help='Path of output file')
parser.add_option('-o','--writeTimestamps',dest='writeTimestamps',
default=True,help='Set True to write timestamps to ROOT file')
default="True",help='Set True to write timestamps to ROOT file')
parser.add_option('-p','--printTimestamps',dest='printTimestamps',
default=True,help='Set True to print timestamps to screen')
default="True",help='Set True to print timestamps to screen (nothing printed unless also output to file) ')
parser.add_option('-s','--listenForTelescopeShutter',dest='listenForTelescopeShutter',
default=False,help='Set True to veto triggers when shutter goes high')
parser.add_option('-d','--pulseDelay',dest='pulseDelay', type=int,
......@@ -60,15 +60,14 @@ parser.add_option('-v','--thresholdVoltage',dest='thresholdVoltage',
from ROOT import TFile, TTree
from ROOT import gROOT # , AddressOf
# "bufferPos, highWord , lowWord , event-number , timestamp , evtType = %x %016x %016x %08x %012x %01x %03x" % ( evt , highWord , lowWord, evtNumber , timeStamp , evtType , trigsFired)
#gROOT.ProcessLine(
#"struct TLUEvtStruct {\
# UInt_t uBufpos;\
# ULong64_t ulHighWord;\
# ULong64_t ulLowWord;\
# UInt_t uEvtNumber;\
# ULong64_t ulTimeStamp;\
# UInt_t uEvtNumber;\
# UInt_t uBufpos;\
# UInt_t uEvtType;\
# UInt_t uTrigsFired;\
#};" );
......@@ -116,6 +115,11 @@ oldEvtNumber = 0
oldPreVetotriggerCount = board.read("PreVetoTriggersR")
oldPostVetotriggerCount = board.read("PostVetoTriggersR")
oldThresholdCounter0 =0
oldThresholdCounter1 =0
oldThresholdCounter2 =0
oldThresholdCounter3 =0
print "Starting polling loop"
eventFifoFillLevel = 0
......@@ -139,7 +143,7 @@ while loopRunning:
elif c == 'c':
runStarted = True
print "Starting Run"
startTLU( uhalDevice = hw, pychipsBoard = board, writeTimestamps = options.writeTimestamps )
startTLU( uhalDevice = hw, pychipsBoard = board, writeTimestamps = ( options.writeTimestamps == "True" ) )
elif c == 'f':
# runStarted = True
print "Stopping triggers "
......@@ -156,6 +160,11 @@ while loopRunning:
timestampHigh = hw.getNode("Event_Formatter.CurrentTimestampHR").read()
timestampLow = hw.getNode("Event_Formatter.CurrentTimestampLR").read()
thresholdCounter0 = hw.getNode("triggerInputs.ThrCount0R").read()
thresholdCounter1 = hw.getNode("triggerInputs.ThrCount1R").read()
thresholdCounter2 = hw.getNode("triggerInputs.ThrCount2R").read()
thresholdCounter3 = hw.getNode("triggerInputs.ThrCount3R").read()
hw.dispatch()
newTime = time.time()
......@@ -167,10 +176,22 @@ while loopRunning:
oldPreVetotriggerCount = preVetotriggerCount
oldPostVetotriggerCount = postVetotriggerCount
deltaCounts0 = thresholdCounter0 - oldThresholdCounter0
oldThresholdCounter0 = thresholdCounter0
deltaCounts1 = thresholdCounter1 - oldThresholdCounter1
oldThresholdCounter1 = thresholdCounter1
deltaCounts2 = thresholdCounter2 - oldThresholdCounter2
oldThresholdCounter2 = thresholdCounter2
deltaCounts3 = thresholdCounter3 - oldThresholdCounter3
oldThresholdCounter3 = thresholdCounter3
print "pre , post veto triggers , pre , post frequency = " , preVetotriggerCount , postVetotriggerCount , preVetoFreq , postVetoFreq
print "Current timestamp High,Low (hex) = " , hex(timestampHigh) , hex(timestampLow)
print "Input counts 0,1,2,3 = " , thresholdCounter0 , thresholdCounter1 , thresholdCounter2 , thresholdCounter3
print "Input freq (Hz) 0,1,2,3 = " , deltaCounts0/timeDelta , deltaCounts1/timeDelta , deltaCounts2/timeDelta , deltaCounts3/timeDelta
nEvents = int(eventFifoFillLevel)//4 # only read out whole events ( 4 x 32-bit words )
wordsToRead = nEvents*4
......@@ -202,7 +223,7 @@ while loopRunning:
trigsFired = (timestampData[ (evt*4) + 0] >> 16) & 0xFFF
if options.printTimestamps:
if (options.printTimestamps == "True" ):
print "bufferPos, highWord , lowWord , event-number , timestamp , evtType = %x %016x %016x %08x %012x %01x %03x" % ( evt , highWord , lowWord, evtNumber , timeStamp , evtType , trigsFired)
tluEvtStruct.uBufpos = evt
......
#!/bin/bash
export PYTHONPATH=../../../../PyChips_1_5_0_pre2A/src
CURRENT_DIR=${0%/*}
echo "Current directory " $CURRENT_DIR
export PYTHONPATH=$CURRENT_DIR/../PyChips_1_5_0_pre2A/src
export LD_LIBRARY_PATH=/opt/cactus/lib:$LD_LIBRARY_PATH
export PATH=/opt/cactus/bin:$PATH
export PATH=/usr/bin/:/opt/cactus/bin:$PATH
cd $CURRENT_DIR
python startTLU_v4.py
python $CURRENT_DIR/startTLU_v4.py $@
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment