# This is a rucosmic demo "experiment" file (.exp) # The experiment below is simply a Tcl subroutine which # will be read in by rucosmic and replace the running version # of the analysis subroutine (named "process_event"). # The following global variables are available to process_event: # triga trigb trigc trigd trige starttime running duration secondsduration # EXPERIMENT fileid1 LOCATIONNAME # TRIGGERNAME1 TRIGGERNAME2 TRIGGERNAME3 TRIGGERNAME4 TRIGGERNAME5 # in0 in1 in2 in3 # var0 var1 ... var10 # # On the rucosmic window, you will see a blue "Experiment" label at around # the middle of the screen. Beneath that are the TRIGGERNAMEs. The # variables triga..trige are the numerical counts for these triggers. # Setting the EXPERIMENT name: set EXPERIMENT "Counter totals" # Setting the Triggernames labels: set TRIGGERNAME1 "Total triggers:" set TRIGGERNAME2 "One counter events:" set TRIGGERNAME3 "Two counter events:" set TRIGGERNAME4 "Three counter events:" set TRIGGERNAME5 "Four counter events:" # Now comes a definition of a routine to interpret the data. # This redefines the default routine inside rucosmic. set in0 0 set in1 0 set in2 0 set in3 0 proc process_event { clock input0 input1 input2 input3} { global startevent global myfile global datavals global triga trigb trigc trigd trige global in0 in1 in2 in3 if {$input0 >= 128} { # new event TRIG # Need to close out previous event, and write data to display # Write triga - total number of events incr triga # update total count for this event set totalcount 0 set totalcount [expr $in0 + $in1 + $in2 + $in3] if {($totalcount == 1)} { incr trigb } if {($totalcount == 2)} { incr trigc } if {($totalcount == 3)} { incr trigd } if {($totalcount == 4)} { incr trige } # now can reset the counters and begin counting anew set in0 0 set in1 0 set in2 0 set in3 0 set tmp1 [expr $input0 - 128] if { ($tmp1 >= 32) } { set in0 1 } if { ($input1 >= 32) } { set in1 1 } if { ($input2 >= 32) } { set in2 1 } if { ($input3 >= 32) } { set in3 1 } } else { # continuation of an event readout if { ($input0 >= 32) } { set in0 1 } if { ($input1 >= 32) } { set in1 1 } if { ($input2 >= 32) } { set in2 1 } if { ($input3 >= 32) } { set in3 1 } } }