Changeset 631


Ignore:
Timestamp:
Jan 13, 2012, 12:18:50 PM (12 years ago)
Author:
torrento
Message:

Added function sigmaRawBand and 3-cluster treatment

File:
1 edited

Legend:

Unmodified
Added
Removed
  • BAORadio/AmasNancay/trunk/plotRawDiffOnOff.pic

    r626 r631  
    11#source should be in minuscule letters
     2# gain = 1 if on,off have been divided by gain
     3
    24set source $1
    35set ncycles $2
     6set gain $3
    47
    58#c++compile meanSigSum
     
    1518setaxesatt "$axedefatt"
    1619
    17 
    18 set f1420low 1420.2
    19 set f1420high 1420.6
    20 nbins1420 = floor((${f1420high}-${f1420low})/250*8192)
    21 
     20set path "/sps/baoradio/AmasNancay/AST"
     21if ( $gain == "0" ) then
     22  openppf ${path}/rawOnOffDiffNoGain_${source}-${ncycles}Cycles.ppf
     23  echo "Opening file  ${path}/rawOnOffDiffNoGain_${source}-${ncycles}Cycles.ppf"
     24else
     25  openppf ${path}/rawOnOffDiff_${source}-${ncycles}Cycles.ppf
     26  echo "Opening file  ${path}/rawOnOffDiff_${source}-${ncycles}Cycles.ppf"
     27endif
     28
     29# Abell 85, 500 cycles
     30if ( ${source} == "abell85" ) then
     31  set f1420low 1420.2
     32  set f1420high 1420.6
     33  set packVal "1 10 25 50 100"
     34endif
     35
     36<<<<<<< .mine
     37# Abell 1205, 600, 750 cycles
     38if ( ${source} == "abell1205" ) then
     39  set f1420low 1420.1
     40  set f1420high 1420.6
     41  if ( $ncycles == 600 ) then
     42    set packVal "1 10 25 50 100 120"
     43  else
     44    set packVal "1 10 15 50 75 125 150"
     45  endif
     46endif
     47=======
    2248set path "/sps/baoradio/AmasNancay/JEC"
    2349openppf ${path}/rawOnOffDiff_${source}-${ncycles}Cycles.ppf
    24 
     50>>>>>>> .r630
     51
     52# Abell 2440, 210 cycles
     53if ( ${source} == "abell2440" ) then
     54  set f1420low 1420.4
     55  set f1420high 1420.7
     56  set packVal "1 10 25 42"
     57endif
     58
     59# All clusters, 1549 cycles
     60if ( ${source} == "abell85-abell2440-abell1205" ) then
     61  set f1420low 1420.1
     62  set f1420high 1420.7
     63  set packVal "1 10 25 50 100 260"
     64endif
     65
     66echo "f1420low=${f1420low}, f1420high=${f1420high}"
     67echo "Packing values="${packVal}
     68
     69nbins1420 = floor((${f1420high}-${f1420low})/250*8192)
     70#echo $nbins1420
    2571
    2672clearscript evolAt1420Freq
     
    2975clearscript sigmaRaw1420Side
    3076clearscript sigmaRaw1410a1415
     77clearscript sigmaRawBand
    3178clearscript IntAt1420
    3279clearscript diffOnOff
     
    64111c++compile rebining
    65112c++link rebining.so dorebin
    66 
    67113
    68114#col 3 = onoffRaw01420side   Ch 0
     
    81127set sigmaCh1 ""
    82128set errsigCh1 ""
    83 
    84129
    85130foreach ipack ( $packVal )
     
    210255endscript
    211256###########################################
     257# Old function sigmaRaw1400a1420
     258defscript sigmaRawBand
     259# flow,fhigh = frequency limits for integration band
     260# offFilt = 1 we divide on-off by filtered Off
     261
     262set flow $1
     263set fhigh $2
     264set offFilt $3
     265set nclusters $4
     266graphicatt ""
     267
     268if ( $nclusters == 1 ) then
     269## Individual clusters (update of mergeAnaFiles.cc on 09/01/2012)
     270## mergeAnaFiles.cc -> meanRawDiffOnOffCycles -> rawOnOffDiff_[source]-[n]Cycles.ppf
     271## Frequency bands [1405,1415], [1405,1410], [1410,1415] MHz
     272## [1405,1415]: col 11,12 = onoffRaw[0,1]f14051415 Ch[0,1] (ON-OFF)/OFF_filt
     273## [1405,1410]: col 13,14 = onoffRaw[0,1]f14051410 Ch[0,1]
     274## [1410,1415]: col  5, 6 = onoffRaw[0,1]f14101415 Ch[0,1]
     275## [1405,1415]: col 15,16 = diffonoffRaw[0,1]f14051415 Ch[0,1] (ON-OFF)
     276## [1405,1410]: col 17,18 = diffonoffRaw[0,1]f14051410 Ch[0,1]
     277## [1410,1415]: col 19,20 = diffonoffRaw[0,1]f14101415 Ch[0,1]
     278  if ( $flow == 1405 ) then
     279    if ( $fhigh == 1415 ) then
     280      if ( $offFilt == 1 ) then
     281        set col0 11
     282        set col1 12
     283      else
     284        set col0 15
     285        set col1 16
     286      endif
     287    endif
     288    if ( $fhigh == 1410 ) then
     289      if ( $offFilt == 1 ) then
     290        set col0 13
     291        set col1 14
     292      else
     293        set col0 17
     294        set col1 18
     295      endif
     296    endif
     297  endif
     298  if ( $flow == 1410 ) then
     299    if ( $fhigh == 1415 ) then
     300      if ( $offFilt == 1 ) then
     301        set col0 5
     302        set col1 6
     303      else
     304        set col0 19
     305        set col1 20
     306      endif
     307    endif
     308  endif
     309
     310  ntcol2var onoffevol $col0 linCh0All
     311  line2vec vecCh0All $linCh0All
     312  ntcol2var onoffevol $col1 linCh1All
     313  line2vec vecCh1All $linCh1All
     314else
     315  ## Execute if analysing All Clusters abell85-abell2440-abell1205
     316  ## mergeAnaFiles.cc -> MeanRawDiffOnOffAllClusters -> rawOnOffDiff_[sources]-[n]Cycles.ppf
     317  ## Shifts the distribution of each cluster to mean~0, to avoid
     318  ## offset problems when regrouping values
     319  ##   col 5,6  = onoffRaw0f14101415   Ch 0,1 [1410,1415]MHz
     320  ##   col 7,8  = onoffRaw1f141014125  Ch 0,1 [1410,1412.5]MHz
     321  ##   col 9,10 = onoffRaw1f14101411   Ch 0,1 [1410,1411]MHz
     322
     323  if ( $flow == 1410 ) then
     324    if ( $fhigh == 1415 ) then
     325      set col0 5
     326      set col1 6
     327    endif
     328    if ( $fhigh == 14125 ) then
     329      set col0 7
     330      set col1 8
     331    endif
     332    if ( $fhigh == 1411 ) then
     333      set col0 9
     334      set col1 10
     335    endif
     336  endif
     337  echo Analysing ntuple columns $col0, $col1
     338
     339  ntcol2var onoffevol $col0 linCh0All
     340  line2vec invecCh0All $linCh0All
     341  ntcol2var onoffevol $col1 linCh1All
     342  line2vec invecCh1All $linCh1All
     343
     344  del v85 v2440 v1205
     345  exptovec v85 onoffevol cycletot-1 srcID==85
     346  set v85_first ${v85.min}
     347  set v85_last ${v85.max}
     348  exptovec v2440 onoffevol cycletot-1 srcID==2440
     349  set v2440_first ${v2440.min}
     350  set v2440_last ${v2440.max}
     351  exptovec v1205 onoffevol cycletot-1 srcID==1205
     352  set v1205_first ${v1205.min}
     353  set v1205_last ${v1205.max}
     354
     355  del vecCh085 vecCh02440 vecCh01205 vecCh185 vecCh12440 vecCh11205 vecCh0All vecCh1All
     356  h/copy invecCh0All vecCh085 ${v85_first}:${v85_last}
     357  h/copy invecCh0All vecCh02440 $v2440_first:$v2440_last
     358  h/copy invecCh0All vecCh01205 $v1205_first:$v1205_last
     359  h/copy invecCh1All vecCh185 $v85_first:$v85_last
     360  h/copy invecCh1All vecCh12440 $v2440_first:$v2440_last
     361  h/copy invecCh1All vecCh11205 $v1205_first:$v1205_last
     362
     363  c++exec double m,s; int l=-1; \
     364          MeanSigma(vecCh085,m,s)  ; vecCh085   -= m;\
     365          MeanSigma(vecCh02440,m,s); vecCh02440 -= m;\
     366          MeanSigma(vecCh01205,m,s); vecCh01205 -= m;\
     367          MeanSigma(vecCh185,m,s)  ; vecCh185   -= m;\
     368          MeanSigma(vecCh12440,m,s); vecCh12440 -= m;\
     369          MeanSigma(vecCh11205,m,s); vecCh11205 -= m;\
     370          TVector<r_8> vecCh0All(invecCh0All.NElts()); KeepObj(vecCh0All); \
     371          TVector<r_8> vecCh1All(invecCh1All.NElts()); KeepObj(vecCh1All); \
     372          for (int i=0;i<vecCh085.NElts();i++){l++;vecCh0All(l)=vecCh085(i);vecCh1All(l)=vecCh185(i);}\
     373          for (int j=0;j<vecCh02440.NElts();j++){l++;vecCh0All(l)=vecCh02440(j);vecCh1All(l)=vecCh12440(j);}\
     374          for (int k=0;k<vecCh01205.NElts();k++){l++;vecCh0All(l)=vecCh01205(k);vecCh1All(l)=vecCh11205(k);}
     375  ## End All Clusters
     376endif
     377 
     378set sigmaCh0 ""
     379set errsigCh0 ""
     380set sigmaCh1 ""
     381set errsigCh1 ""
     382
     383c++compile rebining
     384c++link rebining.so dorebin
     385
     386foreach ipack ( $packVal )
     387
     388#Packing per ipack
     389  del invec
     390  del outvec
     391  cp vecCh0All invec
     392  call dorebin $ipack
     393  mean0 = ${outvec.sum}/${outvec.size}
     394  sigma0 = sqrt(${outvec.sumsq}/${outvec.size}-${mean0}*${mean0})
     395  errsig0 = ${sigma0}/sqrt(2*${outvec.size})   
     396  set sigmaCh0 "${sigmaCh0} ${sigma0}" 
     397  set errsigCh0 "${errsigCh0} ${errsig0}"       
     398#
     399  del invec
     400  del outvec
     401  cp vecCh1All invec
     402  call dorebin $ipack
     403  mean1 = ${outvec.sum}/${outvec.size}
     404  sigma1 = sqrt(${outvec.sumsq}/${outvec.size}-${mean1}*${mean1})
     405  errsig1 = ${sigma1}/sqrt(2*${outvec.size})   
     406  set sigmaCh1 "${sigmaCh1} ${sigma1}" 
     407  set errsigCh1 "${errsigCh1} ${errsig1}"
     408end
     409
     410newnt nt0 x y ey
     411newnt nt1 x y ey
     412
     413set x0 ( $packVal )
     414set y0 ( $sigmaCh0 )
     415set ey0 ( $errsigCh0 )
     416
     417set x1 ( $packVal )
     418set y1 ( $sigmaCh1 )
     419set ey1 ( $errsigCh1 )
     420
     421for i 0:$#x0
     422 line2nt nt0 $x0[i] $y0[i] $ey0[i]
     423 line2nt nt1 $x1[i] $y1[i] $ey1[i]
     424end
     425
     426newwin 1 1
     427plot2de nt0 x y 0 ey 1 "blue marker=fcircle,9 notit nsta"     
     428plot2de nt1 x y 0 ey 1 "same red  marker=fcircle,9 notit nsta"
     429n = ${#x0}-1
     430func $y0[0]/sqrt(x) $x0[0] $x0[n]  100 "same"
     431settitle "Sigma [$flow,$fhigh]MHz ${source} Ch 0 (blue) Ch 1 (red)" ' ' $defatt
     432setaxelabels "num of cycles" "Sigma (a.u)" $axedefatt
     433
     434del h0 h1
     435set xmin -0.01
     436set xmax 0.01
     437newh1d h0 $xmin $xmax 200
     438newh1d h1 $xmin $xmax 200
     439if ( $offFilt == 0 ) then
     440  if ( $gain == 0 ) then
     441    del h0 h1
     442    newh1d h0 -0.0001 0.0001 200
     443    newh1d h1 -0.0001 0.0001 200
     444  endif
     445  newwin 1 1
     446  n/proj h0 onoffevol.diffonoffRaw0f$flow$fhigh ! ! ! "blue notit"
     447  n/proj h1 onoffevol.diffonoffRaw1f$flow$fhigh ! ! ! "same red notit"
     448  settitle "diffonoffRaw [$flow,$fhigh]MHz ${source} Ch 0 (blue) Ch 1 (red)" ' ' $defatt
     449  newwin 1 1
     450  n/pl onoffevol.diffonoffRaw1f$flow$fhigh%cycle ! ! "cpts red notit"
     451  n/pl onoffevol.diffonoffRaw0f$flow$fhigh%cycle ! ! "cpts same blue notit"
     452  settitle "diffonoffRaw [$flow,$fhigh]MHz ${source} Ch 0 (blue) Ch 1 (red)" ' ' $defatt
     453else
     454  newwin 1 1
     455  n/proj h0 onoffevol.onoffRaw0f$flow$fhigh ! ! ! "cpts blue notit"
     456  n/proj h1 onoffevol.onoffRaw1f$flow$fhigh ! ! ! "cpts same red notit"
     457  settitle "onoffRaw [$flow,$fhigh]MHz ${source} Ch 0 (blue) Ch 1 (red)" ' ' $defatt
     458  newwin 1 1
     459  n/pl onoffevol.onoffRaw0f$flow$fhigh%cycle ! ! "cpts blue notit"
     460  n/pl onoffevol.onoffRaw1f$flow$fhigh%cycle ! ! "cpts same red notit"
     461  settitle "onoffRaw [$flow,$fhigh]MHz ${source} Ch 0 (blue) Ch 1 (red)" ' ' $defatt
     462endif
     463
     464endscript
     465##########################################
     466defscript evolAt1400a1415OffOn
     467
     468graphicatt "xylimits=0,${ncycles},0.99,1.02"
     469
     470newwin 1 1
     471n/pl onoffevol.offRaw0f14001415%cycle ! ! "blue cpts notit nsta"
     472n/pl onoffevol.offRaw1f14001415%cycle ! ! "same red cpts notit nsta"
     473n/pl onoffevol.onRaw0f14001415%cycle ! ! "same cyan cpts notit nsta"
     474n/pl onoffevol.onRaw1f14001415%cycle ! ! "same orange cpts notit nsta"
     475settitle "Raw OFF and ON  ${source} Ch 0 (blue/cyan) Ch 1 (red/orange) ${ncycles}cycles " ' ' $defatt
     476setaxelabels "cycle" "I[1400,1415]MHz Raw (a.u)" $axedefatt
     477
     478endscript
     479##########################################
    212480defscript evolAt1410a1415OffOn
    213481
Note: See TracChangeset for help on using the changeset viewer.