##user define function provides run_v4.nb (.m) customized Func for the output of correlation and sensitivity Corr(ri, Func) and Sens(ri, Func)
##users can provide multiple customized functions as follows:
##format:
##Name: name 1
##!Function Begin: 
##func1 command... (in mathematica expressions)
##!Function End

##Name: name 2
##!Function Begin: 
##func2 command... (in mathematica expressions)
##!Function End
##......
##......
##......

##when executable run user define function, users can customize the function in Corr(ri, Func) for plotting. For example, Func == u/d, ubar/dbar, etc
##users can use 
##1. FxQ[iflavour] to describe f(x,Q) of selected flavour for all experiments, data point index, replica index 
##2. FxQ[ExptID,iflavour,ipt,iset] to describe f(x,Q) of selected flavour, experiments, data point index, replica index 
##3. FxQ[ExptID,iflavour,ipt] to describe f(x,Q) of selected flavour, experiments, data point index for all replica index 
##where the f(x,Q) data structure in the executable is [[iexpt,iflavour]], for each element: [["data"]]={LF[x,Q,f(1),...f((Nset)], LF[...], ...} 
##global variables that are helpful as inputs: {ibbar, icbar, isbar, idbar, iubar, ig, iu, id, is, ic, ib} = {-5......5}
## the customize function could also be a List with Length = total# of replicas of the selected PDFset
##e.g. for CT14NNLO, Nset = 57, so we can input {val1,......,val57}  
#e. g. combination of PDFs of various flavours for all expts, data points, and replicas
#Function: (FxQ[iu]-FxQ[iubar])/(FxQ[iu]+FxQ[iubar])
#e. g. a List of 57 replicas for CT14NNLO
#Function: ExptIDin=159;ipt=3;Table[(FxQ[ExptIDin,iu,ipt,iset]-FxQ[ExptIDin,iubar,ipt,iset])/(FxQ[ExptIDin,iu,ipt,iset]+FxQ[ExptIDin,iubar,ipt,iset]),{iset,57}]
#e. g. a List of 57 replicas for CT14NNLO
#Function: ExptIDin=159;ipt=3;(FxQ[ExptIDin,iu,ipt]-FxQ[ExptIDin,iubar,ipt])/(FxQ[ExptIDin,iu,ipt]+FxQ[ExptIDin,iubar,ipt])
#e. g. a List of 57 numbers
#Function: {0.00032584, 0.00032511, 0.00032643, 0.00032257, 0.00032641, 0.00031168, 0.00032554, 0.00032456, 0.00032305, 0.00033046, 0.00032177, 0.00033036, 0.000321, 0.00032171, 0.00032977, 0.00032669, 0.00032221, 0.00031768, 0.00033428, 0.00032633, 0.00032464, 0.00032479, 0.00032646, 0.00032004, 0.00033215, 0.00032818, 0.00032388, 0.00033194, 0.00031556, 0.00031764, 0.00033074, 0.00031886, 0.00033605, 0.00031876, 0.00033216, 0.00031899, 0.00033076, 0.00030885, 0.00034467, 0.00035059, 0.00031285, 0.00032465, 0.000325, 0.000331, 0.00031591, 0.00034582, 0.00031019, 0.00032934, 0.00032362, 0.00032705, 0.00032475, 0.00032675, 0.0003251, 0.00030061, 0.00032828, 0.00031684, 0.00034034}

#Warning: be careful not to define the variables in the function that do not exist in run_v4.nb (.m), it is risky that variables rewrite values in the code

##the Name of user define function will show in the title of output figures 

Name: 701 residual 

!Function Begin:  {0.00098942, 0.00098173, 0.00098396, 0.00097558, 0.00099351, 0.00095067, 0.00101211, 0.00099413, 0.00097181, 0.00101561, 0.00097453,
 0.00099632, 0.00097541, 0.00094744, 0.00098743, 0.00100186, 0.00094726, 0.00098585, 0.00099331, 0.00097051, 0.00100608, 0.00099326, 0.0009868, 
0.00097291, 0.00100699, 0.00098791, 0.00099058, 0.00101748, 0.00094195, 0.00094426, 0.0010162, 0.00095969, 0.0010322, 0.00096181, 0.00101368, 
0.00094068, 0.00102951, 0.00096548, 0.00101539, 0.00105604, 0.00095553, 0.00097095, 0.00099036, 0.00101176, 0.00092786, 0.00104997, 0.00097324, 
0.00098937, 0.00101352, 0.00099091, 0.00099408, 0.00099629, 0.00098689, 0.00092023, 0.00101062, 0.00096475, 0.00102149}

!Function End

Name: test func

!Function Begin: 
Table[i,{i,1,57}]

!Function End

Name: Asym(u)

!Function Begin: 
(FxQ[iu]-FxQ[iubar])/(FxQ[iu]+FxQ[iubar])

!Function End

#Name: Asym(u) one point
Name: s 125 1pt

!Function Begin: 
#be careful not to define the variables that do not exist in run_v4.nb (.m), it is risky that variables rewrite values in the code
#ExptIDin=125;iptin=3;(FxQ[ExptIDin,iu,iptin]-FxQ[ExptIDin,iubar,iptin])/(FxQ[ExptIDin,iu,iptin]+FxQ[ExptIDin,iubar,iptin])

ExptIDin=125;iptin=33;(FxQ[ExptIDin,is,iptin])

!Function End



