Changeset 294 in Idarraga


Ignore:
Timestamp:
May 1, 2012, 3:07:56 PM (12 years ago)
Author:
idarraga
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • mafalda/MAFTools/TimePixCalibrationHandler.cpp

    r291 r294  
    1111#include <iostream>
    1212#include <fstream>
    13 
     13#include <math.h>
    1414#include <stdlib.h>
    1515
     
    112112        int index = XYtoC(pix, m_width);
    113113
    114         double par[] = { m_a[index], m_b[index], m_c[index], m_t[index] };
     114        //double par[] = { m_a[index], m_b[index], m_c[index], m_t[index] };
     115
     116        // cuadratic solution
     117        double a = m_a[index];
     118        double b = m_b[index] - m_a[index]*m_t[index] - (double)tot;
     119        double c = -m_c[index] - m_t[index]*m_b[index];
     120
     121        double sol1 = -b + sqrt(b*b - 4*a*c);
     122        sol1 /= 2*a;
     123        double sol2 = -b - sqrt(b*b - 4*a*c);
     124        sol2 /= 2*a;
     125
     126        cout << "sol1 = " << sol1 << " , sol2 = " << sol2 << endl;
     127
     128        if(sol2 <= 0) return sol1;
     129        else return sol2;
     130
     131        return 0.;
    115132
    116133        /*
     
    122139        }*/
    123140
    124 
     141/*
    125142        double evalTOT = 0.;
    126143        double prev_e = 0.;
     
    143160
    144161        return prev_e;
     162        */
    145163}
    146164
Note: See TracChangeset for help on using the changeset viewer.