
function res = resETOH( t, x0, par, data, stds, input, prior2 )
if min(par)>0


%mStruct.p.mu1=1;
%mStruct.p.k1=2;
%mStruct.p.alpha=3;
%mStruct.p.g1=4;
%mStruct.p.k2=5;
%mStruct.p.g2=6;

clear x0

x0(1)       = par(3)/par(4);
x0(2) 		= par(5)/par(6)*x0(1);
%x0(1)       = 0;
%x0(2)       = 0;
x0(3)       = par(3)/par(4);
x0(4)       = par(5)/par(6)*x0(3);
%x0(3)       = 0;
%x0(4)       = 0;

reltols = 1e-14;
abstols = 1e-14;

try
    [t,x] = odeGAL1p( t, x0, par(1:6), input, [reltols abstols 10] );
catch
    clear odeGAL1p;
    error( 'failure' );


    return;
end

y1 = par(1)*(x(2,:));
y2 = par(1)*(x(4,:));   

% prior for mRNA decay
kg2(1) = 1.769292045467269;
kg2(2) = 20.589996419308118;

kk1(1) = -1.492365943401997;
kk1(2) = 0.660794593704535;

% eGFP AA sequence
%MVSKGEELFTGVVPILVELDGDVNGHKFSVSGEGEGDATYGKLTLKFICTTGKLPVPWPTLVTTLTYGVQCFSRYPDHMK
%QHDFFKSAMPEGYVQERTIFFKDDGNYKTRAEVKFEGDTLVNRIELKGIDFKEDGNILGHKLEYNYNSHNVYIMADKQKN
%GIKVNFKIRHNIEDGSVQLADHYQQNTPIGDGPVLLPDNHYLSTQSALSKDPNEKRDHMVLLEFVTAAGITLGMDELYK

res = [(data(1:length(y1))-y1(1:end))/par(7) , sqrt(length(y1)*log(par(7))) , (data(length(y1)+1:end)-y2)/par(8) , sqrt(length(y2)*log(par(8))) , sqrt(-log(lognpdf(par(2)*60,kk1(1),kk1(2)))) , sqrt(-log(prior2(1/par(6)*60)))];
else
res = inf;
end