Locked History Actions

attachment:livetime_det.kumac of Dead time

Attachment 'livetime_det.kumac'

Download

 macro livetime_det
   set *
   opt *
   opt ndat
   opt nbox
   size 8 8
   set xmgr 0.5
   set ymgu 0.5
   set txfp -131
   set vfon -131
   set lfon -131
   
   exe def_fill
   vec/del *
   npoint = 21
   vec/cre deadt(4) r 0.1 1 10 100
   sigma rate=10**(array([npoint],-1#6))
   vec/cre x([npoint],4) r
   vec/cre y([npoint],4) r
   
   npointcal = 30
   sigma ratecal=10**(array([npointcal],-1#6))
   vec/cre xcal([npointcal],4) r

   
   do j=1,4
     do i=1,[npoint]
       rate=$rsigma(rate([i])/1000)
       str=livetime([rate],$rsigma(deadt([j])))
       livetime=$call([str])*100
       vec/inp x([i],[j]) rate([i])
       vec/inp y([i],[j]) [livetime]
     enddo
   enddo
   do j=1,4
     do i=1,[npointcal]
       vec/inp xcal([i],[j]) ratecal([i])
     enddo
   enddo
   
   for/file 33 livetime_det.eps
   gr/me 33 -113
   
   set ndvx 505
   opt logx; opt liny
   null 0.05 1200000. -10. 120.
   sym1=20
   sym2=21
   sym3=24
   sym4=25
   
   set chhe 0.2
   set ylab 0.8
   do j=1,4
     sigma ycal=100*exp(-deadt([j])*ratecal/1000)  
     set ltyp [j]
     graph [npointcal] xcal(1:[npointcal],[j]) ycal(1:[npointcal]) c
     hp/sym x(1:[npoint],[j]) y(1:[npoint],[j]) [npoint] [sym[j]] 0.2
     exe legend_line [j] [j] $eval(deadt([j]))//' [m]s'
     exe legend_symbol [j] [sym[j]] 0.2 $eval(deadt([j]))//' [m]s'
   enddo
   atit 'Rate (kcps)' 'Live time (%)' ! 220
   for/clo 33
      
 return
 
 macro def_fill
   APPLICATION COMIS QUIT
      real function livetime(rate,deadtime)
      CALL HDELET(1)
      CALL HBOOK1(1,'deadtime',100,0.,10000.,0.)
      
      ifirst=1
      total_time=0.
      igated=1
      nevents=100000
      do i=1,nevents
        x=rndm(0.1234)
        y=-(1/rate)*log(x)
        call hf1(1,y,1.)
        
        total_time = total_time + y
        if (y .gt. deadtime) then
          igated = igated + 1
        endif
        
c       if (ifirst.eq.1) then
c         CALL HPLOT(1,'K',' ',0)
c         ifirst=0
c       elseif mod(i,10000) .eq. 0 then
c         CALL HPLOT(1,'U',' ',0)
c         call igterm
c         write(*,*) 'total_time, i, igated'
c     &               ,total_time, i, igated
c       endif
      enddo
      livetime = igated / float(nevents)            
c      CALL HPLOT(1,'',' ',0)
      end
   QUIT
 return 

 macro legend_line nline=1 typ=1 com=''
   
   for str in_
     wnxmin wnxmax xsiz xmgl xmgr xwin xzones_
     wnymin wnymax ysiz ymgu ymgl ywin yzones_
     chhe
     [str]=$grafinfo([str])
   endfor
   xwns = [xsiz] - ([xmgl] + [xmgr] + [xwin]*[xzones])
   xwid = ([wnxmax]) - ([wnxmin])
   xtxr = [chhe] / [xwns]
   ywns = [ysiz] - ([ymgu] + [ymgl] + [ywin]*[yzones])
   ywid = ([wnymax]) - ([wnymin])
   ytxr = [chhe] / [ywns]
   
   x1 = 0.60  * [xwid] + ([wnxmin])
   x2 = 0.75  * [xwid] + ([wnxmin])
   x3 = 0.77  * [xwid] + ([wnxmin])
   y1 = (0.97-[ytxr]*([nline]-1)) * [ywid] + ([wnymin])
   
   if $OPTION('LOGX') = 1 then
     x1 = $sigma(10.**([x1]))
     x2 = $sigma(10.**([x2]))
     x3 = $sigma(10.**([x3]))
   endif
   if $OPTION('LOGY') = 1 then
     y1 = $sigma(10.**([y1]))
   endif
   
   set dmod [typ]
   dline [x1] [x2] [y1] [y1]
   set txal 13
   itx [x3] [y1] [com]
 return
 
 macro legend_symbol nline=1 typ=1 siz=0.28 com=''
   
   do i=1,2147483647
     if $vexist('temp'//[i]) .eq. 0 then
       vecname='temp'//[i]
       breakl
     endif
   enddo
   vec/cre [vecname](2) r

   for str in_
     wnxmin wnxmax xsiz xmgl xmgr xwin xzones_
     wnymin wnymax ysiz ymgu ymgl ywin yzones_
     chhe
     [str]=$grafinfo([str])
   endfor
   xwns = [xsiz] - ([xmgl] + [xmgr] + [xwin]*[xzones])
   xwid = ([wnxmax]) - ([wnxmin])
   xtxr = [chhe] / [xwns]
   ywns = [ysiz] - ([ymgu] + [ymgl] + [ywin]*[yzones])
   ywid = ([wnymax]) - ([wnymin])
   ytxr = [chhe] / [ywns]
   
   x1 = 0.675 * [xwid] + ([wnxmin])
   x3 = 0.77  * [xwid] + ([wnxmin])
   y1 = (0.97-[ytxr]*([nline]-1)) * [ywid] + ([wnymin])
   
   if $OPTION('LOGX') = 1 then
     x1 = $sigma(10**([x1]))
     x3 = $sigma(10**([x3]))
   endif
   if $OPTION('LOGY') = 1 then
     y1 = $sigma(10**([y1]))
   endif
   
   vec/inp [vecname](1) [x1]
   vec/inp [vecname](2) [y1]
   
   hp/sym [vecname](1) [vecname](2) 1 [typ] [siz] [com]
   set txal 13
   itx [x3] [y1] [com]
   
   vec/del [vecname]  
 return

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2012-02-18 18:30:09, 3.9 KB) [[attachment:Deadtime_fig.ver0.01.png]]
  • [get | view] (2011-01-26 03:17:30, 1.6 KB) [[attachment:accepted.kumac]]
  • [get | view] (2011-01-26 03:19:54, 5.9 KB) [[attachment:accepted.png]]
  • [get | view] (2012-02-18 22:28:18, 1.7 KB) [[attachment:accepted_daq.kumac]]
  • [get | view] (2012-02-18 22:34:52, 11.4 KB) [[attachment:accepted_daq.png]]
  • [get | view] (2012-02-18 22:28:27, 1.7 KB) [[attachment:accepted_det.kumac]]
  • [get | view] (2012-02-18 22:35:00, 13.2 KB) [[attachment:accepted_det.png]]
  • [get | view] (2012-02-18 19:54:43, 3.0 KB) [[attachment:daq_dead_explanation.png]]
  • [get | view] (2011-01-26 03:17:48, 3.8 KB) [[attachment:deadtime.kumac]]
  • [get | view] (2011-01-26 03:20:02, 7.4 KB) [[attachment:deadtime.png]]
  • [get | view] (2011-01-26 03:17:59, 3.2 KB) [[attachment:deadtime_emu.kumac]]
  • [get | view] (2011-01-26 03:20:09, 6.3 KB) [[attachment:deadtime_emu.png]]
  • [get | view] (2012-02-18 19:54:47, 4.1 KB) [[attachment:det_dead_explanation.png]]
  • [get | view] (2019-10-15 00:52:22, 0.3 KB) [[attachment:latex_032d55d381ec2d43ca925f93ce116a3212dafb17_p1.png]]
  • [get | view] (2019-10-15 00:52:21, 0.4 KB) [[attachment:latex_06b6b6307ef31c54e7bc0194a1c82ab257cc29f3_p1.png]]
  • [get | view] (2019-10-15 00:52:22, 0.4 KB) [[attachment:latex_07a7d2113659e9d6280eab187991383fefc9fbcd_p1.png]]
  • [get | view] (2019-10-15 00:52:23, 1.0 KB) [[attachment:latex_09675e3ac61a8de5720c09150ecc963608f0b835_p1.png]]
  • [get | view] (2019-10-15 00:52:22, 0.3 KB) [[attachment:latex_122c1e6496766aacb3d05dbd1170c020b7344316_p1.png]]
  • [get | view] (2019-10-15 00:52:21, 0.6 KB) [[attachment:latex_12cf95437852b775071477b0bd2c8f52235c9c61_p1.png]]
  • [get | view] (2019-10-15 00:52:21, 0.2 KB) [[attachment:latex_1812b4c1aa0bfe91e08464852801004438dbbe14_p1.png]]
  • [get | view] (2019-10-15 00:52:21, 0.2 KB) [[attachment:latex_2511cf4c85f8b110d383773f441695503f0a7f0c_p1.png]]
  • [get | view] (2019-10-15 00:52:21, 0.2 KB) [[attachment:latex_2cb96bc4e4d5dda2f4ec1fd64974aea989651ce9_p1.png]]
  • [get | view] (2019-10-15 00:52:23, 1.0 KB) [[attachment:latex_2ee10f6710a54de352b5601e02c7161f4fe52319_p1.png]]
  • [get | view] (2019-10-15 00:52:21, 0.5 KB) [[attachment:latex_2fab22770267b502bbe6233e2c98ea6a6a68bde0_p1.png]]
  • [get | view] (2019-10-15 00:52:22, 0.3 KB) [[attachment:latex_318e066321dd5fa6f38c85595f3b5ea9dee6fd77_p1.png]]
  • [get | view] (2019-10-15 00:52:21, 0.4 KB) [[attachment:latex_32b163e2873f75bbf8ce1858328f25c8abe354b0_p1.png]]
  • [get | view] (2019-10-15 00:52:22, 0.5 KB) [[attachment:latex_3488e03a7aebf9998c3e58a879f770707d8fa0de_p1.png]]
  • [get | view] (2019-10-15 00:52:23, 0.6 KB) [[attachment:latex_3868889a94c5fb400f840232696106a8735998ad_p1.png]]
  • [get | view] (2019-10-15 00:52:21, 0.6 KB) [[attachment:latex_39c40ff6c5fb53732b72c32d73317f598e2a4cc4_p1.png]]
  • [get | view] (2019-10-15 00:52:22, 0.5 KB) [[attachment:latex_3a0971cdf9168e8fb2cf3a122120a4cd5e9e6969_p1.png]]
  • [get | view] (2019-10-15 00:52:21, 0.2 KB) [[attachment:latex_4b234546431cd1f87fa5617c165c0f8b4cfacaf9_p1.png]]
  • [get | view] (2019-10-15 00:52:22, 0.7 KB) [[attachment:latex_4b2ab6d407f410b66e1064956df696c71b195352_p1.png]]
  • [get | view] (2019-10-15 00:52:22, 1.0 KB) [[attachment:latex_4b8c210e9c59f2524989f6c0ce77b6839189db86_p1.png]]
  • [get | view] (2019-10-15 00:52:22, 0.4 KB) [[attachment:latex_5dcda459350a29c70e02a9b5ea2616d548c7503b_p1.png]]
  • [get | view] (2019-10-15 00:52:22, 0.4 KB) [[attachment:latex_60171e3cd11dc910227a8a14c5fd66b8fa455992_p1.png]]
  • [get | view] (2019-10-15 00:52:22, 0.5 KB) [[attachment:latex_605b075ac23d42175c87f94520769d5055247b90_p1.png]]
  • [get | view] (2019-10-15 00:52:22, 0.3 KB) [[attachment:latex_610e8f0deb9c20ca6fe16b63a577847884509626_p1.png]]
  • [get | view] (2019-10-15 00:52:21, 0.4 KB) [[attachment:latex_64a8e43503fd57e0f7bc22207bde744a37251c3c_p1.png]]
  • [get | view] (2019-10-15 00:52:21, 0.3 KB) [[attachment:latex_67499e1e2ec086126ba0918164683a53f487e21d_p1.png]]
  • [get | view] (2019-10-15 00:52:21, 0.5 KB) [[attachment:latex_684b23d1212df327698cffbdb7cdf287cfb5cda1_p1.png]]
  • [get | view] (2019-10-15 00:52:23, 1.4 KB) [[attachment:latex_6da4d2e0b4703f22d5003fae06558852ae1f9e77_p1.png]]
  • [get | view] (2019-10-15 00:52:21, 0.5 KB) [[attachment:latex_7a0a72b5bc3407878ed16b819c12e19d25462e94_p1.png]]
  • [get | view] (2019-10-15 00:52:21, 0.2 KB) [[attachment:latex_7ca0c27628bb60f2b679da0ec97aa3a3f2c76eeb_p1.png]]
  • [get | view] (2019-10-15 00:52:21, 0.3 KB) [[attachment:latex_7ead818a05122295272b12b86267d0a8307d8c58_p1.png]]
  • [get | view] (2019-10-15 00:52:23, 0.5 KB) [[attachment:latex_7fe0b56dced0a591252ce8222a160ad0787ac1a8_p1.png]]
  • [get | view] (2019-10-15 00:52:21, 0.2 KB) [[attachment:latex_81dcfcdc1b9ca81abc5e730d0f65a2c0dd912fe8_p1.png]]
  • [get | view] (2019-10-15 00:52:21, 0.2 KB) [[attachment:latex_8c452f44b945b80d778d61f5bbbfe89a62927ccb_p1.png]]
  • [get | view] (2019-10-15 00:52:22, 0.3 KB) [[attachment:latex_8c4c7c3de722e38f3c02820e3a5da6689682e692_p1.png]]
  • [get | view] (2019-10-15 00:52:21, 0.5 KB) [[attachment:latex_9c8c0abb4a1e676d1521db6381d096f1cd863c0c_p1.png]]
  • [get | view] (2019-10-15 00:52:21, 0.2 KB) [[attachment:latex_b1763d7de7dc63f7ab634be5db4d9fdb26b293c5_p1.png]]
  • [get | view] (2019-10-15 00:52:23, 1.8 KB) [[attachment:latex_b39649c798e9f066fc28dc866de8fed79cc44dba_p1.png]]
  • [get | view] (2019-10-15 00:52:21, 0.4 KB) [[attachment:latex_b652ae9dc01799bea5304c6c031b5609db3126da_p1.png]]
  • [get | view] (2019-10-15 00:52:22, 0.2 KB) [[attachment:latex_b65922ff4dce6b30aaf4601f6c8a42e4f5400294_p1.png]]
  • [get | view] (2019-10-15 00:52:21, 0.3 KB) [[attachment:latex_b7228fbef3a3728b7179d0697ba9c06546e7fa94_p1.png]]
  • [get | view] (2019-10-15 00:52:22, 0.5 KB) [[attachment:latex_b7f1a2ae26db29033218e30de02da907edd729a1_p1.png]]
  • [get | view] (2019-10-15 00:52:22, 0.5 KB) [[attachment:latex_bb7ceebbc5b3df530d80b84d71b1006fc497314f_p1.png]]
  • [get | view] (2019-10-15 00:52:22, 0.3 KB) [[attachment:latex_c20ea311976992e67a9f9982f865777e5f55887b_p1.png]]
  • [get | view] (2019-10-15 00:52:23, 0.8 KB) [[attachment:latex_c3b80cc734de34889fb5a89131ff1f0a0a6dd068_p1.png]]
  • [get | view] (2019-10-15 00:52:22, 0.6 KB) [[attachment:latex_cd2e7e0a88a0bbaf4e44594fd8e2695ac19b2295_p1.png]]
  • [get | view] (2019-10-15 00:52:21, 0.2 KB) [[attachment:latex_d5aec1f250eb063350e150abadd1c6479cbe4a2f_p1.png]]
  • [get | view] (2019-10-15 00:52:22, 0.4 KB) [[attachment:latex_dce193f2f7170f23531e5a16746a8ab94f9b2409_p1.png]]
  • [get | view] (2019-10-15 00:52:22, 0.8 KB) [[attachment:latex_efcd6da3d291da26455327b7ba7619b67d852820_p1.png]]
  • [get | view] (2019-10-15 00:52:22, 0.3 KB) [[attachment:latex_f7b12d2bd51d2cc681fd94d413564084eb97d455_p1.png]]
  • [get | view] (2019-10-15 00:52:22, 0.8 KB) [[attachment:latex_fb8942298bdc0027eb35dab2e51e48f9886687cd_p1.png]]
  • [get | view] (2019-10-15 00:52:23, 1.2 KB) [[attachment:latex_fccaf455061fb1f8b35c5f50330ca4b39a2cc37d_p1.png]]
  • [get | view] (2019-10-15 00:52:22, 0.2 KB) [[attachment:latex_fecbeb770ff16de41dea69819f851db7691f9570_p1.png]]
  • [get | view] (2012-02-18 22:28:39, 4.0 KB) [[attachment:livetime_daq.kumac]]
  • [get | view] (2012-02-18 22:35:06, 14.8 KB) [[attachment:livetime_daq.png]]
  • [get | view] (2012-02-18 22:41:33, 3.4 KB) [[attachment:livetime_daq_emu.kumac]]
  • [get | view] (2012-02-18 22:41:20, 12.7 KB) [[attachment:livetime_daq_emu.png]]
  • [get | view] (2012-02-18 22:29:03, 4.2 KB) [[attachment:livetime_det.kumac]]
  • [get | view] (2012-02-18 22:35:13, 15.8 KB) [[attachment:livetime_det.png]]

You are not allowed to attach a file to this page.