[ROOT] [Fwd: ROOT compilation problem]

From: Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
Date: Tue Oct 26 2004 - 11:38:06 MEST


-------- Original Message --------
Subject: ROOT compilation problem
Date: Tue, 26 Oct 2004 11:37:50 +0200
From: Alberto Pulvirenti <alberto.pulvirenti@ct.infn.it>
To: rene.brun@cern.ch

Dear all,

I am trying to create a shared library with some ROOT-heir classes, and
I followed the explanation in the guide, creating che ClassDef instances
and a LinkDef file.

I attached in this email the linkDef, and some classes which I
implemented. When trying to compile with these, I get always an error,
which I do not understand.

Can someone tell me where the error is?

Tnahks,

	Alberto






# Makefile for the ROOT test programs.
# This Makefile shows nicely how to compile and link applications
# using the ROOT libraries on all supported platforms.
#
# Copyright (c) 2000 Rene Brun and Fons Rademakers
#
# Author: Fons Rademakers, 29/2/2000

ARCH         := $(shell root-config --arch)
PLATFORM      = $(ARCH)

ObjSuf        = o
SrcSuf        = cxx
ExeSuf        =
DllSuf        = so
OutPutOpt     = -o # keep whitespace after "-o"

ROOTCFLAGS   := $(shell root-config --cflags)
ROOTLIBS     := $(shell root-config --libs)
ROOTGLIBS    := $(shell root-config --glibs)

# Linux with egcs, gcc 2.9x, gcc 3.x (>= RedHat 5.2)

CXX           = g++
CXXFLAGS      = -O -Wall -fPIC
LD            = g++
LDFLAGS       = -O
SOFLAGS       = -shared

CXXFLAGS     += $(ROOTCFLAGS)
LIBS          = $(ROOTLIBS) $(SYSLIBS)
GLIBS         = $(ROOTGLIBS) $(SYSLIBS)

#------------------------------------------------------------------------------

SRCS  = clsPoint.cxx\
	clsEvent.cxx\
	clsTrack.cxx\
	clsTrackCut.cxx\
	clsTracker.cxx\
	clsAnalysis.cxx\
	myCint.cxx

HDRS      = $(SOURCES:.cxx=.h) myLinkDef.h

DICTSRC   = myCint.cxx
DICTHDR   = myCint.h
DICTOBJ   = myCint.o

OBJS      = $(SRCS:.cxx=.o) $(DICTO)

#------------------------------------------------------------------------------

.SUFFIXES: .$(SrcSuf) .$(ObjSuf) .$(DllSuf)

libTrackingTB2003.so:   $(OBJS) myCint.o
						@echo "$(HDRS)"
						@echo "$@ linking!"
						$(LD) $(SOFLAGS) $(LDFLAGS) $(OBJS) $(OutPutOpt)$@
						@echo "$@ linking done"

clean:
			@rm -f $(OBJS) core
		
distclean:  clean
			@rm -f *Cint.* 

.SUFFIXES: .$(SrcSuf)

###

myCint.$(SrcSuf): clsPoint.h clsEvent.h clsTrack.h clsTracker.h clsAnalysis.h myLinkDef.h
	@echo "Generating dictionary $@..."
	@rootcint -f $@ -c $^

clsPoint.$(ObjSuf): clsPoint.h

.$(SrcSuf).$(ObjSuf):
	$(CXX) $(CXXFLAGS) -c $<



#include <TVector3.h>
#include "clsTrack.h"

#include "clsTrackCut.h"

/* ROOT implementation */
ClassImp(clsTrackCut);

// Constructor
clsTrackCut::clsTrackCut()
{
	fParam = NULL;
}

// Destructos
clsTrackCut::~clsTrackCut()
{
	if (fParam != NULL) {
		delete [] fParam;
	}
}

// virtual function
Bool_t clsTrackCut::Pass(clsTrack *track)
{
	Warning("Pass", "This method must be overridden");
	return kFALSE;
}

//
//
//

/* ROOT implementation */
ClassImp(clsTrackCutKink);

// Argumented constructor
clsTrackCutKink::clsTrackCutKink(Double_t kinkmax) : clsTrackCut()
{
	fParam = new Double_t(kinkmax);
}

// Method for check
Bool_t clsTrackCutKink::Pass(clsTrack *track)
{
	// translation of 'fParam' variables
	// to meaningful names
	Double_t kinkMax = fParam[0];
	
	// calculates the total kink angle between the segments
	// of the connected path 0-->1-->3-->4
	// and checks if it is smaller than a given cut
	TVector3 v01 = track->Point[0]->VectorTo(track->Point[1]);
	TVector3 v13 = track->Point[1]->VectorTo(track->Point[3]);
	TVector3 v34 = track->Point[3]->VectorTo(track->Point[4]);
	TVector3 v04 = track->Point[0]->VectorTo(track->Point[4]);

	Double_t checkval = TMath::Abs(v01.Angle(v13)) + TMath::Abs(v13.Angle(v34));
	checkval *= 180.0 / TMath::Pi();
	return (checkval <= kinkMax);
}

//
//
//

/* ROOT implementation */
ClassImp(clsTrackCutTarget);

// Argumented constructor
clsTrackCutTarget::clsTrackCutTarget
(Double_t zTarget, Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax)
 : clsTrackCut()
{
	fParam = new Double_t[5];
	
	fParam[0] = zTarget;
	fParam[1] = xmin;
	fParam[2] = xmax;
	fParam[3] = ymin;
	fParam[4] = ymax;
}

// Method for check
Bool_t clsTrackCutTarget::Pass(clsTrack *track)
{
	// translation of 'fParam' variables
	// to meaningful names
	Double_t zTarget = fParam[0];
	Double_t xMin = fParam[1], xMax = fParam[2];
	Double_t yMin = fParam[1], yMax = fParam[2];
	
	// definition of an ellipse whose center is in the mean point
	// between the two edges in X, Y, given by the user
	Double_t projX   = 0.5 * (xMax + xMin) - track->X(zTarget);
	Double_t projY   = 0.5 * (yMax + yMin) - track->Y(zTarget);
	Double_t radiusX = 0.5 * (xMax - xMin);
	Double_t radiusY = 0.5 * (yMax - yMin);
	
	// checks if the track prolongation to Z of target (parameter 0)
	// falls into the ellipse above defined
	projX /= radiusX;
	projY /= radiusY;
	Double_t checkval = projX*projX + projY*projY;
	return (checkval <= 1.0);
	/*
	Double_t projX = t->X(fZTarget);
	if (projX < fCutProjX[0] || projX > fCutProjX[1]) {
		param = projX;
		return 7;
	}
	Double_t projY = t->Y(fZTarget);
	if (projY < fCutProjY[0] || projY > fCutProjY[1]) {
		param = projY;
		return 8;
	}
	*/
}

//
//
//

/* ROOT implementation */
ClassImp(clsTrackCutCorrelation);

// Argumented constructor
clsTrackCutCorrelation::clsTrackCutCorrelation
(Double_t xzCorr, Double_t yzCorr)  : clsTrackCut()
{
	fParam = new Double_t[2];
	
	fParam[0] = xzCorr;
	fParam[1] = yzCorr;
}

// Method for check
Bool_t clsTrackCutCorrelation::Pass(clsTrack *track)
{
	// translation of 'fParam' variables
	// to meaningful names
	Double_t xzCorrMin = fParam[0];
	Double_t yzCorrMin = fParam[1];
	
	// check for correlation factors
	track->GetCorrelationFactors();
	return ((track->CorrX >= xzCorrMin) && (track->CorrY < yzCorrMin));
}




#ifndef __clsTrackCut__
#define __clsTrackCut__

#include <TObject.h>

class clsTrack;

class clsTrackCut : public TObject {

public:
	         clsTrackCut();
	virtual ~clsTrackCut();
	
	virtual  Bool_t Pass(clsTrack *clsTrack);

protected:
	Double_t *fParam;    // parameters for cut evaluation
	
private:

	/* ROOT definitions */
	ClassDef(clsTrackCut, 1)
};

//
//
//

class clsTrackCutKink : public clsTrackCut {

public:
	         clsTrackCutKink() : clsTrackCut() { }
			 clsTrackCutKink(Double_t kinkmax);
							   
	virtual ~clsTrackCutKink() { }
	
	virtual Bool_t Pass(clsTrack* clsTrack);
	
private:

	ClassDef(clsTrackCutKink, 1)
};

//
//
//

class clsTrackCutTarget : public clsTrackCut {

public:
	         clsTrackCutTarget() : clsTrackCut() { }
			 clsTrackCutTarget(Double_t zTarget, 
			                   Double_t xmin, Double_t xmax,
							   Double_t ymin, Double_t ymax);
							   
	virtual ~clsTrackCutTarget() { }
	
	virtual Bool_t Pass(clsTrack *clsTrack);
	
private:

	ClassDef(clsTrackCutTarget, 1)
};

//
//
//

class clsTrackCutCorrelation : public clsTrackCut {

public:
	         clsTrackCutCorrelation() : clsTrackCut() { }
			 clsTrackCutCorrelation(Double_t xzCorr, Double_t yzCorr);
				   
	virtual ~clsTrackCutCorrelation() { }
	
	virtual Bool_t Pass(clsTrack *clsTrack);
	
private:

	ClassDef(clsTrackCutCorrelation, 1)
};

#endif



#ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ class clsPoint+;
#pragma link C++ class clsEvent+;
#pragma link C++ class clsTrack+;
#pragma link C++ class clsTrackCut+;
#pragma link C++ class clsTrackCutKink+;
#pragma link C++ class clsTrackCutTarget+;
#pragma link C++ class clsTrackCutCorrelation+;
#pragma link C++ class clsTracker+;
#pragma link C++ class clsAnalysis+;
#endif



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:10 MET