macro compilation failure

From: Roger Mason <rmason_at_esd.mun.ca>
Date: Wed, 11 Apr 2007 16:24:44 -0230


Hello rooters,

When I try to compile the attached macro I get this error:

root [1] .x fitCaMnMixing.C+ (4)
Info in <TUnixSystem::ACLiC>: creating shared library /home/rmason/Programming/rootmac/fitCaMnMixing_C.so dlopen error: /home/rmason/Programming/rootmac/fitCaMnMixing_C.so: undefined symbol: _ZN13TLinearFitterC1Ev Load Error: Failed to load Dynamic link library /home/rmason/Programming/rootmac/fitCaMnMixing_C.so /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/../../../crt1.o: In function `_start': init.c:(.text+0x18): undefined reference to `main' /home/rmason/Programming/rootmac/filettEHAm.o: In function `fitCaMnMixing(int)': filettEHAm.cxx:(.text+0xfa3): undefined reference to `TLinearFitter::TLinearFitter()' collect2: ld returned 1 exit status
*** Interpreter error recovered ***

If someone can see what I have done wrong I'd appreciate the help.

Thanks,
Roger

Version 5.14/00 14 December 2006
Linux minnie 2.6.18-gentoo-r6 #6 PREEMPT Wed Jan 31 10:28:12 NST 2007 i686 Celeron (Mendocino) GenuineIntel GNU/Linux

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// fitCaMnMixing: used fitLinear2 as a starting point
#include "TLinearFitter.h"
#include "TF1.h"
#include "TRandom.h"
#include <TSQLServer.h>
#include <TSQLResult.h>
#include <TSQLRow.h>
#include <TString.h>
#include <Riostream.h>
#include <sstream>

void fitCaMnMixing(Int_t maxrank)
{

   //Fit a 36d "surface".  The x[i] are the numbers of CaMn, CaCa,
   //MnMn pairs, in that sequence.  So, x[0] is CaMn1, x[1] is CaCa1,
   //x[2] is MnMn1, x[3] is CaMn2 etc.

   

   const Int_t n=4800;
   Int_t i;
   TLinearFitter *lf=new TLinearFitter();

   Double_t y[n]; // The energy from GULP    // Double_t x[36][4800];
   Double_t *x=new Double_t[n*maxrank*3];    Double_t e[n];
   Int_t nrows=0;
   Int_t nfields=0;

//Get the points from the db
TSQLServer *db = TSQLServer::Connect("pgsql://localhost/mixing", "rmason", ""); TSQLResult *res;
TSQLRow *row;
// Get data from database
// Build query & get info from the query result  TString q1;
 TString q;
 q.Append("select e.file,c.rank,e.param,c.camn+c.mnca,c.caca,c.mnmn from energy e, configs c where e.file=c.file and c.rank=");

 Int_t k = 0;
 stringstream out[maxrank];
 for (i = 0; i < maxrank; i++){

   out[i] << i+1 << ";";	// To convert int to string
   q1 = q.Copy();		// The base query
   q1.Append(out[i].str()); 	// The specific rank to fetch
   cout << i << " " << out[i].str() << " " << q1 << endl;    res = db->Query(q1);
   nrows = res->GetRowCount();
   nfields = res->GetFieldCount();
   // cout << "Rows = " << nrows << " Fields = " << nfields << endl;    // Populate arrays
     for (int j = 0; j < nrows; j++){
       row = res->Next();
       y[j] = atof(row->GetField(2)); // Energy
       x[k*nrows + j      ] = atof(row->GetField(3)); // Pair frequency CaMn
       x[(k+1)*nrows + j  ] = atof(row->GetField(4)); // Pair frequency CaCa
       x[(k+2)*nrows + j  ] = atof(row->GetField(5)); // Pair frequency MnMn
       e[j] = 0.001;
       //       cout << "(k+2)*nrows + j = " << (k+2)*nrows + j << endl;
       delete row;
     } // j loop
     cout << "k = " << k << endl;
     k += 3;

 } // i loop

// //To avoid copying the data into the fitter, the following function can be used:  lf->AssignData(nrows, 3*maxrank, x, y, e);

//    //A different way to put the points into the fitter would be to use
//    //the AddPoint function for each point. This way the points are copied and stored
//    //inside the fitter

// Define the formula
 lf->SetFormula("x[0]++x[1]++x[2]++x[3]++x[4]++x[5]++x[6]++x[7]++x[8]++x[9]++x[10]++x[11]");

//    //Perform the fitting and look at the results
//  lf->Eval();
//    TVectorD params;
//    TVectorD errors;
//    lf->GetParameters(params);
//    lf->GetErrors(errors);
//    for (Int_t i=0; i<3; i++)
//       printf("par[%d]=%f+-%f\n", i, params(i), errors(i));
//    Double_t chisquare=lf->GetChisquare();
//    printf("chisquare=%f\n", chisquare);

   delete lf;

} Received on Wed Apr 11 2007 - 20:58:14 CEST

This archive was generated by hypermail 2.2.0 : Wed Apr 11 2007 - 23:50:02 CEST