From 04c75a628b0f19be5010e14734a1f06d49fd360a Mon Sep 17 00:00:00 2001 From: kreczko Date: Wed, 4 Feb 2015 13:14:11 +0000 Subject: [PATCH 1/3] structural changes: - split code among 'include' and 'src' folder - removed local TSVDUnfold implementation (always use ROOT) - always compile TUnfold wrapper --- .cproject => eclipse/.cproject | 97 +--- .project => eclipse/.project | 17 +- {src => include}/RooUnfold.h | 0 {src => include}/RooUnfoldBayes.h | 0 {src => include}/RooUnfoldBinByBin.h | 0 {src => include}/RooUnfoldDagostini.h | 0 {src => include}/RooUnfoldErrors.h | 0 {src => include}/RooUnfoldInvert.h | 0 {src => include}/RooUnfoldParms.h | 0 {src => include}/RooUnfoldResponse.h | 0 {src => include}/RooUnfoldSvd.h | 0 {src => include}/RooUnfoldTUnfold.h | 0 {src => include}/RooUnfold_LinkDef.h | 5 - src/RooUnfold.cxx | 18 +- src/RooUnfoldBayes.cxx | 4 +- src/RooUnfoldBinByBin.cxx | 4 +- src/RooUnfoldDagostini.cxx | 4 +- src/RooUnfoldErrors.cxx | 8 +- src/RooUnfoldInvert.cxx | 4 +- src/RooUnfoldParms.cxx | 6 +- src/RooUnfoldResponse.cxx | 2 +- src/RooUnfoldSvd.cxx | 8 +- src/RooUnfoldTUnfold.cxx | 4 +- src/TSVDUnfold.cxx | 693 -------------------------- src/TSVDUnfold_local.h | 146 ------ 25 files changed, 58 insertions(+), 962 deletions(-) rename .cproject => eclipse/.cproject (50%) rename .project => eclipse/.project (75%) rename {src => include}/RooUnfold.h (100%) rename {src => include}/RooUnfoldBayes.h (100%) rename {src => include}/RooUnfoldBinByBin.h (100%) rename {src => include}/RooUnfoldDagostini.h (100%) rename {src => include}/RooUnfoldErrors.h (100%) rename {src => include}/RooUnfoldInvert.h (100%) rename {src => include}/RooUnfoldParms.h (100%) rename {src => include}/RooUnfoldResponse.h (100%) rename {src => include}/RooUnfoldSvd.h (100%) rename {src => include}/RooUnfoldTUnfold.h (100%) rename {src => include}/RooUnfold_LinkDef.h (87%) delete mode 100644 src/TSVDUnfold.cxx delete mode 100644 src/TSVDUnfold_local.h diff --git a/.cproject b/eclipse/.cproject similarity index 50% rename from .cproject rename to eclipse/.cproject index 7b465bb..1e64e03 100644 --- a/.cproject +++ b/eclipse/.cproject @@ -11,54 +11,29 @@ - + + + + - + - - - - - - - - - - - - - - - - + + + - + + + @@ -74,55 +49,29 @@ - + + + + - + - - - - - - - - - - - - - - - - - - - - - + + + - + + + @@ -130,7 +79,7 @@ - + diff --git a/.project b/eclipse/.project similarity index 75% rename from .project rename to eclipse/.project index fcae050..742cc8c 100644 --- a/.project +++ b/eclipse/.project @@ -5,6 +5,11 @@ + + org.python.pydev.PyDevBuilder + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder clean,full,incremental, @@ -23,16 +28,6 @@ org.eclipse.cdt.core.ccnature org.eclipse.cdt.managedbuilder.core.managedBuildNature org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + org.python.pydev.pythonNature - - - 1403534503186 - - 5 - - org.eclipse.ui.ide.multiFilter - 1.0-name-matches-false-false-.travis.yml - - - diff --git a/src/RooUnfold.h b/include/RooUnfold.h similarity index 100% rename from src/RooUnfold.h rename to include/RooUnfold.h diff --git a/src/RooUnfoldBayes.h b/include/RooUnfoldBayes.h similarity index 100% rename from src/RooUnfoldBayes.h rename to include/RooUnfoldBayes.h diff --git a/src/RooUnfoldBinByBin.h b/include/RooUnfoldBinByBin.h similarity index 100% rename from src/RooUnfoldBinByBin.h rename to include/RooUnfoldBinByBin.h diff --git a/src/RooUnfoldDagostini.h b/include/RooUnfoldDagostini.h similarity index 100% rename from src/RooUnfoldDagostini.h rename to include/RooUnfoldDagostini.h diff --git a/src/RooUnfoldErrors.h b/include/RooUnfoldErrors.h similarity index 100% rename from src/RooUnfoldErrors.h rename to include/RooUnfoldErrors.h diff --git a/src/RooUnfoldInvert.h b/include/RooUnfoldInvert.h similarity index 100% rename from src/RooUnfoldInvert.h rename to include/RooUnfoldInvert.h diff --git a/src/RooUnfoldParms.h b/include/RooUnfoldParms.h similarity index 100% rename from src/RooUnfoldParms.h rename to include/RooUnfoldParms.h diff --git a/src/RooUnfoldResponse.h b/include/RooUnfoldResponse.h similarity index 100% rename from src/RooUnfoldResponse.h rename to include/RooUnfoldResponse.h diff --git a/src/RooUnfoldSvd.h b/include/RooUnfoldSvd.h similarity index 100% rename from src/RooUnfoldSvd.h rename to include/RooUnfoldSvd.h diff --git a/src/RooUnfoldTUnfold.h b/include/RooUnfoldTUnfold.h similarity index 100% rename from src/RooUnfoldTUnfold.h rename to include/RooUnfoldTUnfold.h diff --git a/src/RooUnfold_LinkDef.h b/include/RooUnfold_LinkDef.h similarity index 87% rename from src/RooUnfold_LinkDef.h rename to include/RooUnfold_LinkDef.h index ea3907a..f50489e 100644 --- a/src/RooUnfold_LinkDef.h +++ b/include/RooUnfold_LinkDef.h @@ -14,14 +14,9 @@ #pragma link C++ class RooUnfoldErrors+; #pragma link C++ class RooUnfoldParms+; #pragma link C++ class RooUnfoldInvert+; -#ifndef NOTUNFOLD #pragma link C++ class RooUnfoldTUnfold+; -#endif #ifdef HAVE_DAGOSTINI #pragma link C++ class RooUnfoldDagostini+; #endif -#ifdef HAVE_TSVDUNFOLD -#pragma link C++ class TSVDUnfold+; -#endif #endif diff --git a/src/RooUnfold.cxx b/src/RooUnfold.cxx index cb039f1..633f460 100644 --- a/src/RooUnfold.cxx +++ b/src/RooUnfold.cxx @@ -62,7 +62,7 @@ END_HTML */ ///////////////////////////////////////////////////////////// -#include "RooUnfold.h" +#include "../include/RooUnfold.h" #include #include @@ -81,18 +81,18 @@ END_HTML */ #include "TDecompChol.h" #include "TRandom.h" -#include "RooUnfoldResponse.h" -#include "RooUnfoldErrors.h" +#include "../include/RooUnfoldResponse.h" +#include "../include/RooUnfoldErrors.h" // Need subclasses just for RooUnfold::New() -#include "RooUnfoldBayes.h" -#include "RooUnfoldSvd.h" -#include "RooUnfoldInvert.h" -#include "RooUnfoldBinByBin.h" +#include "../include/RooUnfoldBayes.h" +#include "../include/RooUnfoldSvd.h" +#include "../include/RooUnfoldInvert.h" +#include "../include/RooUnfoldBinByBin.h" #ifndef NOTUNFOLD -#include "RooUnfoldTUnfold.h" +#include "../include/RooUnfoldTUnfold.h" #endif #ifdef HAVE_DAGOSTINI -#include "RooUnfoldDagostini.h" +#include "../include/RooUnfoldDagostini.h" #endif using std::vector; diff --git a/src/RooUnfoldBayes.cxx b/src/RooUnfoldBayes.cxx index e028a2b..0c0951c 100644 --- a/src/RooUnfoldBayes.cxx +++ b/src/RooUnfoldBayes.cxx @@ -24,7 +24,7 @@ END_HTML */ //#define OLDERRS // restore old (incorrect) error calculation -#include "RooUnfoldBayes.h" +#include "../include/RooUnfoldBayes.h" #include #include @@ -34,7 +34,7 @@ END_HTML */ #include "TH1.h" #include "TH2.h" -#include "RooUnfoldResponse.h" +#include "../include/RooUnfoldResponse.h" using std::min; using std::cerr; diff --git a/src/RooUnfoldBinByBin.cxx b/src/RooUnfoldBinByBin.cxx index 684f36c..0052321 100644 --- a/src/RooUnfoldBinByBin.cxx +++ b/src/RooUnfoldBinByBin.cxx @@ -19,13 +19,13 @@ END_HTML */ ///////////////////////////////////////////////////////////// -#include "RooUnfoldBinByBin.h" +#include "../include/RooUnfoldBinByBin.h" #include #include "TH1.h" #include "TH2.h" -#include "RooUnfoldResponse.h" +#include "../include/RooUnfoldResponse.h" ClassImp (RooUnfoldBinByBin); diff --git a/src/RooUnfoldDagostini.cxx b/src/RooUnfoldDagostini.cxx index e5ce201..0ac3ce4 100644 --- a/src/RooUnfoldDagostini.cxx +++ b/src/RooUnfoldDagostini.cxx @@ -20,7 +20,7 @@ END_HTML */ ///////////////////////////////////////////////////////////// -#include "RooUnfoldDagostini.h" +#include "../include/RooUnfoldDagostini.h" #include @@ -29,7 +29,7 @@ END_HTML */ #include "TVectorD.h" #include "TMatrixD.h" -#include "RooUnfoldResponse.h" +#include "../include/RooUnfoldResponse.h" using std::cout; using std::cerr; diff --git a/src/RooUnfoldErrors.cxx b/src/RooUnfoldErrors.cxx index 4b3d623..ae2ba22 100644 --- a/src/RooUnfoldErrors.cxx +++ b/src/RooUnfoldErrors.cxx @@ -30,7 +30,7 @@ difficult to invert reliably. A warning will be displayed if this is the case. T END_HTML */ ///////////////////////////////////////////////////////////////// -#include "RooUnfoldErrors.h" +#include "../include/RooUnfoldErrors.h" #include #include @@ -42,9 +42,9 @@ END_HTML */ #include "TNtuple.h" #include "TAxis.h" -#include "RooUnfoldResponse.h" -#include "RooUnfold.h" -#include "RooUnfoldResponse.h" +#include "../include/RooUnfoldResponse.h" +#include "../include/RooUnfold.h" +#include "../include/RooUnfoldResponse.h" using std::cout; using std::cerr; diff --git a/src/RooUnfoldInvert.cxx b/src/RooUnfoldInvert.cxx index fde940e..92344fc 100644 --- a/src/RooUnfoldInvert.cxx +++ b/src/RooUnfoldInvert.cxx @@ -20,7 +20,7 @@ END_HTML */ ///////////////////////////////////////////////////////////// -#include "RooUnfoldInvert.h" +#include "../include/RooUnfoldInvert.h" #include @@ -30,7 +30,7 @@ END_HTML */ #include "TMatrixD.h" #include "TDecompSVD.h" -#include "RooUnfoldResponse.h" +#include "../include/RooUnfoldResponse.h" using std::cout; using std::cerr; diff --git a/src/RooUnfoldParms.cxx b/src/RooUnfoldParms.cxx index b2c5c34..f384ad0 100644 --- a/src/RooUnfoldParms.cxx +++ b/src/RooUnfoldParms.cxx @@ -27,7 +27,7 @@ return an rms. The chi squared values are calculated using the chi2() method in END_HTML */ //////////////////////////////////////////////////////////////// -#include "RooUnfoldParms.h" +#include "../include/RooUnfoldParms.h" #include #include @@ -38,9 +38,9 @@ return an rms. The chi squared values are calculated using the chi2() method in #include "TStyle.h" #include "TH1D.h" #include "TProfile.h" -#include "RooUnfold.h" +#include "../include/RooUnfold.h" #include "TRandom.h" -#include "RooUnfoldResponse.h" +#include "../include/RooUnfoldResponse.h" #include "TLatex.h" using std::cout; using std::cerr; diff --git a/src/RooUnfoldResponse.cxx b/src/RooUnfoldResponse.cxx index f158cf4..ea1a074 100644 --- a/src/RooUnfoldResponse.cxx +++ b/src/RooUnfoldResponse.cxx @@ -20,7 +20,7 @@ END_HTML */ ///////////////////////////////////////////////////////////// -#include "RooUnfoldResponse.h" +#include "../include/RooUnfoldResponse.h" #include #include diff --git a/src/RooUnfoldSvd.cxx b/src/RooUnfoldSvd.cxx index f1b9696..648ece9 100644 --- a/src/RooUnfoldSvd.cxx +++ b/src/RooUnfoldSvd.cxx @@ -23,7 +23,7 @@ END_HTML */ ///////////////////////////////////////////////////////////// -#include "RooUnfoldSvd.h" +#include "../include/RooUnfoldSvd.h" #include #include @@ -34,13 +34,9 @@ END_HTML */ #include "TH2.h" #include "TVectorD.h" #include "TMatrixD.h" -#if defined(HAVE_TSVDUNFOLD) || ROOT_VERSION_CODE < ROOT_VERSION(5,28,0) -#include "TSVDUnfold_local.h" /* Use local copy of TSVDUnfold.h */ -#else #include "TSVDUnfold.h" -#endif -#include "RooUnfoldResponse.h" +#include "../include/RooUnfoldResponse.h" using std::cout; using std::cerr; diff --git a/src/RooUnfoldTUnfold.cxx b/src/RooUnfoldTUnfold.cxx index 8952de1..a2682a3 100644 --- a/src/RooUnfoldTUnfold.cxx +++ b/src/RooUnfoldTUnfold.cxx @@ -24,8 +24,8 @@ END_HTML */ ///////////////////////////////////////////////////////////// -#include "RooUnfoldTUnfold.h" -#include "RooUnfoldResponse.h" +#include "../include/RooUnfoldTUnfold.h" +#include "../include/RooUnfoldResponse.h" #include diff --git a/src/TSVDUnfold.cxx b/src/TSVDUnfold.cxx deleted file mode 100644 index a4e4cd5..0000000 --- a/src/TSVDUnfold.cxx +++ /dev/null @@ -1,693 +0,0 @@ -// Author: Kerstin Tackmann, Andreas Hoecker, Heiko Lacker - -/********************************************************************************** - * * - * Project: TSVDUnfold - data unfolding based on Singular Value Decomposition * - * Package: ROOT * - * Class : TSVDUnfold * - * * - * Description: * - * Single class implementation of SVD data unfolding based on: * - * A. Hoecker, V. Kartvelishvili, * - * "SVD approach to data unfolding" * - * NIM A372, 469 (1996) [hep-ph/9509307] * - * * - * Authors: * - * Kerstin Tackmann - CERN, Switzerland * - * Andreas Hoecker - CERN, Switzerland * - * Heiko Lacker - Humboldt U, Germany * - * * - * Copyright (c) 2010: * - * CERN, Switzerland * - * Humboldt University, Germany * - * * - **********************************************************************************/ - - -//______________________________________________________________________________ -/* - - TSVDUnfold - - Data unfolding using Singular Value Decomposition (hep-ph/9509307) - Authors: Kerstin Tackmann, Andreas Hoecker, Heiko Lacker - -Begin_Html -

SVD Approach to Data Unfolding

-

-Reference: Nucl. Instrum. Meth. A372, 469 (1996) [hep-ph/9509307] -

-TSVDUnfold implements the singular value decomposition based unfolding method (see reference). Currently, the unfolding of one-dimensional histograms is supported, with the same number of bins for the measured and the unfolded spectrum. -

-The unfolding procedure is based on singular value decomposition of the response matrix. The regularisation of the unfolding is implemented via a discrete minimum-curvature condition. -

-Monte Carlo inputs: -

    -
  • xini: true underlying spectrum (TH1D, n bins) -
  • bini: reconstructed spectrum (TH1D, n bins) -
  • Adet: response matrix (TH2D, nxn bins) -
-Consider the unfolding of a measured spectrum bdat. The corresponding spectrum in the Monte Carlo is given by bini, with the true underlying spectrum given by xini. The detector response is described by Adet, with Adet filled with events (not probabilities) with the true observable on the y-axis and the reconstructed observable on the x-axis. -

-The measured distribution can be unfolded for any combination of resolution, efficiency and acceptance effects, provided an appropriate definition of xini and Adet.

-

-The unfolding can be performed by -

    -
    -TSVDUnfold *tsvdunf = new TSVDUnfold();
    -tsvdunf->Init( bdat, bini, xini, Adet );
    -TH1D* unfresult = tsvdunf->Unfold(kreg);
    -
    -
-where kreg determines the regularisation of the unfolding. In general, overregularisation (too small kreg) will bias the unfolded spectrum towards the Monte Carlo input, while underregularisation (too large kreg) will lead to large fluctuations in the unfolded spectrum. The optimal regularisation can be determined following guidelines in Nucl. Instrum. Meth. A372, 469 (1996) [hep-ph/9509307] using the distribution of the |d_i| that can be obtained by tsvdunf->GetD() and/or using pseudo-experiments. -

-Covariance matrices on the measured spectrum can be propagated to covariance matrices using the GetUnfoldCovMatrix method, which uses pseudo experiments for the propagation. In addition, GetAdetCovMatrix allows for the propagation of the statistical uncertainties on the response matrix using pseudo experiments. In addition, the distribution of singular values can be retrieved using tsvdunf->GetSV(). -End_Html */ -//_______________________________________________________________________ - - -#include - -#include "TSVDUnfold_local.h" -#include "TH1D.h" -#include "TH2D.h" -#include "TDecompSVD.h" -#include "TRandom3.h" -#include "TMath.h" - -ClassImp(TSVDUnfold) - -using namespace std; - -//_______________________________________________________________________ -TSVDUnfold::TSVDUnfold( const TH1D *bdat, const TH1D *bini, const TH1D *xini, const TH2D *Adet ) - : TObject (), - fNdim (0), - fDdim (2), - fNormalize (kFALSE), - fKReg (-1), - fDHist (NULL), - fSVHist (NULL), - fBdat (bdat), - fBini (bini), - fXini (xini), - fAdet (Adet), - fToyhisto (NULL), - fToymat (NULL), - fToyMode (kFALSE), - fMatToyMode (kFALSE) -{ - // Default constructor - - // Initialisation of TSVDUnfold - // User provides data and MC test spectra, as well as detector response matrix - if (bdat->GetNbinsX() != bini->GetNbinsX() || - bdat->GetNbinsX() != xini->GetNbinsX() || - bdat->GetNbinsX() != Adet->GetNbinsX() || - bdat->GetNbinsX() != Adet->GetNbinsY()) { - TString msg = "All histograms must have equal dimension.\n"; - msg += Form( " Found: dim(bdat)=%i\n", bdat->GetNbinsX() ); - msg += Form( " Found: dim(bini)=%i\n", bini->GetNbinsX() ); - msg += Form( " Found: dim(xini)=%i\n", xini->GetNbinsX() ); - msg += Form( " Found: dim(Adet)=%i,%i\n", Adet->GetNbinsX(), Adet->GetNbinsY() ); - msg += "Please start again!"; - - Fatal( "Init", msg, "%s" ); - } - - // Get the input histos - fNdim = bdat->GetNbinsX(); - fDdim = 2; // This is the derivative used to compute the curvature matrix -} - -//_______________________________________________________________________ -TSVDUnfold::TSVDUnfold( const TSVDUnfold& other ) - : TObject ( other ), - fNdim (other.fNdim), - fDdim (other.fDdim), - fNormalize (other.fNormalize), - fKReg (other.fKReg), - fDHist (other.fDHist), - fSVHist (other.fSVHist), - fBdat (other.fBdat), - fBini (other.fBini), - fXini (other.fXini), - fAdet (other.fAdet), - fToyhisto (other.fToyhisto), - fToymat (other.fToymat), - fToyMode (other.fToyMode), - fMatToyMode (other.fMatToyMode) -{ - // Copy constructor -} - -//_______________________________________________________________________ -TSVDUnfold::~TSVDUnfold() -{ - // Destructor -} - -//_______________________________________________________________________ -TH1D* TSVDUnfold::Unfold( Int_t kreg ) -{ - // Perform the unfolding - fKReg = kreg; - - // Make the histos - if (!fToyMode && !fMatToyMode) InitHistos( ); - - // Create vectors and matrices - TVectorD vb(fNdim), vbini(fNdim), vxini(fNdim), vberr(fNdim); - TMatrixD mA(fNdim, fNdim), mCurv(fNdim, fNdim), mC(fNdim, fNdim); - - Double_t eps = 1e-12; - Double_t sreg; - - // Copy histogams entries into vector - if (fToyMode) { H2V( fToyhisto, vb ); H2Verr( fToyhisto, vberr ); } - else { H2V( fBdat, vb ); H2Verr( fBdat, vberr ); } - - H2V( fBini, vbini ); - H2V( fXini, vxini ); - if (fMatToyMode) H2M( fToymat, mA ); - else H2M( fAdet, mA ); - - // Scale the MC vectors to data norm - Double_t scale = vb.Sum()/vbini.Sum(); - vbini *= scale; - vxini *= scale; - mA *= scale; - - // Fill and invert the second derivative matrix - FillCurvatureMatrix( mCurv, mC ); - - // Inversion of mC by help of SVD - TDecompSVD CSVD(mC); - TMatrixD CUort = CSVD.GetU(); - TMatrixD CVort = CSVD.GetV(); - TVectorD CSV = CSVD.GetSig(); - - TMatrixD CSVM(fNdim, fNdim); - for (Int_t i=0; i 0) vx *= 1.0/scale; - } - - // Get Curvature and also chi2 in case of MC unfolding - if (!fToyMode && !fMatToyMode) { - Info( "Unfold", "Unfolding param: %i",k+1 ); - Info( "Unfold", "Curvature of weight distribution: %f", GetCurvature( vw, mCurv ) ); - } - - TH1D* h = (TH1D*)fBdat->Clone("unfoldingresult"); - for(int i=1; i<=fNdim; i++){ - h->SetBinContent(i,0.); - h->SetBinError(i,0.); - } - V2H( vx, *h ); - - return h; -} - -//_______________________________________________________________________ -TH2D* TSVDUnfold::GetUnfoldCovMatrix( const TH2D* cov, Int_t ntoys, Int_t seed ) -{ - - fToyMode = true; - TH1D* unfres = 0; - TH2D* unfcov = (TH2D*)fAdet->Clone("unfcovmat"); - for(int i=1; i<=fNdim; i++) - for(int j=1; j<=fNdim; j++) - unfcov->SetBinContent(i,j,0.); - - // Code for generation of toys (taken from RooResult and modified) - // Calculate the elements of the upper-triangular matrix L that - // gives Lt*L = C, where Lt is the transpose of L (the "square-root method") - TMatrixD L(fNdim,fNdim); L *= 0; - - for (Int_t iPar= 0; iPar < fNdim; iPar++) { - - // Calculate the diagonal term first - L(iPar,iPar) = cov->GetBinContent(iPar+1,iPar+1); - for (Int_t k=0; k 0.0) L(iPar,iPar) = TMath::Sqrt(L(iPar,iPar)); - else L(iPar,iPar) = 0.0; - - // ...then the off-diagonal terms - for (Int_t jPar=iPar+1; jParGetBinContent(iPar+1,jPar+1); - for (Int_t k=0; kClone("toyhisto"); - TH1D *toymean = (TH1D*)fBdat->Clone("toymean"); - for (Int_t j=1; j<=fNdim; j++) toymean->SetBinContent(j,0.); - - // Get the mean of the toys first - for (int i=1; i<=ntoys; i++) { - - // create a vector of unit Gaussian variables - TVectorD g(fNdim); - for (Int_t k= 0; k < fNdim; k++) g(k) = random.Gaus(0.,1.); - - // Multiply this vector by Lt to introduce the appropriate correlations - g *= (*Lt); - - // Add the mean value offsets and store the results - for (int j=1; j<=fNdim; j++) { - fToyhisto->SetBinContent(j,fBdat->GetBinContent(j)+g(j-1)); - fToyhisto->SetBinError(j,fBdat->GetBinError(j)); - } - - unfres = Unfold(GetKReg()); - - for (Int_t j=1; j<=fNdim; j++) { - toymean->SetBinContent(j, toymean->GetBinContent(j) + unfres->GetBinContent(j)/ntoys); - } - } - - // Reset the random seed - random.SetSeed(seed); - - //Now the toys for the covariance matrix - for (int i=1; i<=ntoys; i++) { - - // Create a vector of unit Gaussian variables - TVectorD g(fNdim); - for (Int_t k= 0; k < fNdim; k++) g(k) = random.Gaus(0.,1.); - - // Multiply this vector by Lt to introduce the appropriate correlations - g *= (*Lt); - - // Add the mean value offsets and store the results - for (int j=1; j<=fNdim; j++) { - fToyhisto->SetBinContent( j, fBdat->GetBinContent(j)+g(j-1) ); - fToyhisto->SetBinError ( j, fBdat->GetBinError(j) ); - } - unfres = Unfold(GetKReg()); - - for (Int_t j=1; j<=fNdim; j++) { - for (Int_t k=1; k<=fNdim; k++) { - unfcov->SetBinContent(j,k,unfcov->GetBinContent(j,k) + ( (unfres->GetBinContent(j) - toymean->GetBinContent(j))* (unfres->GetBinContent(k) - toymean->GetBinContent(k))/(ntoys-1)) ); - } - } - } - delete Lt; - delete unfres; - fToyMode = kFALSE; - - return unfcov; -} - -//_______________________________________________________________________ -TH2D* TSVDUnfold::GetAdetCovMatrix( Int_t ntoys, Int_t seed ) -{ - - fMatToyMode = true; - TH1D* unfres = 0; - TH2D* unfcov = (TH2D*)fAdet->Clone("unfcovmat"); - for(int i=1; i<=fNdim; i++) - for(int j=1; j<=fNdim; j++) - unfcov->SetBinContent(i,j,0.); - - //Now the toys for the detector response matrix - TRandom3 random(seed); - - fToymat = (TH2D*)fAdet->Clone("toymat"); - TH1D *toymean = (TH1D*)fXini->Clone("toymean"); - for (Int_t j=1; j<=fNdim; j++) toymean->SetBinContent(j,0.); - - for (int i=1; i<=ntoys; i++) { - for (Int_t k=1; k<=fNdim; k++) { - for (Int_t m=1; m<=fNdim; m++) { - if (fAdet->GetBinContent(k,m)) { - fToymat->SetBinContent(k, m, random.Poisson(fAdet->GetBinContent(k,m))); - } - } - } - - unfres = Unfold(GetKReg()); - - for (Int_t j=1; j<=fNdim; j++) { - toymean->SetBinContent(j, toymean->GetBinContent(j) + unfres->GetBinContent(j)/ntoys); - } - } - - // Reset the random seed - random.SetSeed(seed); - - for (int i=1; i<=ntoys; i++) { - for (Int_t k=1; k<=fNdim; k++) { - for (Int_t m=1; m<=fNdim; m++) { - if (fAdet->GetBinContent(k,m)) - fToymat->SetBinContent(k, m, random.Poisson(fAdet->GetBinContent(k,m))); - } - } - - unfres = Unfold(GetKReg()); - - for (Int_t j=1; j<=fNdim; j++) { - for (Int_t k=1; k<=fNdim; k++) { - unfcov->SetBinContent(j,k,unfcov->GetBinContent(j,k) + ( (unfres->GetBinContent(j) - toymean->GetBinContent(j))*(unfres->GetBinContent(k) - toymean->GetBinContent(k))/(ntoys-1)) ); - } - } - } - delete unfres; - fMatToyMode = kFALSE; - - return unfcov; -} - -//_______________________________________________________________________ -TH1D* TSVDUnfold::GetD() const -{ - // Returns d vector - for (int i=1; i<=fDHist->GetNbinsX(); i++) { - if (fDHist->GetBinContent(i)<0.) fDHist->SetBinContent(i, TMath::Abs(fDHist->GetBinContent(i))); - } - return fDHist; -} - -//_______________________________________________________________________ -TH1D* TSVDUnfold::GetSV() const -{ - // Returns singular values vector - return fSVHist; -} - -//_______________________________________________________________________ -void TSVDUnfold::H2V( const TH1D* histo, TVectorD& vec ) -{ - // Fill 1D histogram into vector - for (Int_t i=0; iGetNbinsX(); i++) vec(i) = histo->GetBinContent(i+1); -} - -//_______________________________________________________________________ -void TSVDUnfold::H2Verr( const TH1D* histo, TVectorD& vec ) -{ - // Fill 1D histogram errors into vector - for (Int_t i=0; iGetNbinsX(); i++) vec(i) = histo->GetBinError(i+1); -} - -//_______________________________________________________________________ -void TSVDUnfold::V2H( const TVectorD& vec, TH1D& histo ) -{ - // Fill vector into 1D histogram - for(Int_t i=0; iGetNbinsX(); j++) { - for (Int_t i=0; iGetNbinsY(); i++) { - mat(i,j) = histo->GetBinContent(i+1,j+1); - } - } -} - -//_______________________________________________________________________ -TVectorD TSVDUnfold::VecDiv( const TVectorD& vec1, const TVectorD& vec2, Int_t zero ) -{ - // Divide entries of two vectors - TVectorD quot(vec1.GetNrows()); - for (Int_t i=0; i 0) tC(i,i-1) = 1.0; - if (i < ndim-1) tC(i,i+1) = 1.0; - tC(i,i) = -2.0; - } - tC(0,0) = -1.0; - tC(ndim-1,ndim-1) = -1.0; - } - else if (fDdim == 3) { - for (Int_t i=1; i 0) tC(i,i-1) = -4.0; - if (i < ndim-1) tC(i,i+1) = -4.0; - if (i > 1) tC(i,i-2) = 1.0; - if (i < ndim-2) tC(i,i+2) = 1.0; - tC(i,i) = 6.0; - } - tC(0,0) = 2.0; - tC(ndim-1,ndim-1) = 2.0; - tC(0,1) = -3.0; - tC(ndim-2,ndim-1) = -3.0; - tC(1,0) = -3.0; - tC(ndim-1,ndim-2) = -3.0; - tC(1,1) = 6.0; - tC(ndim-2,ndim-2) = 6.0; - } - else if (fDdim == 5) { - for (Int_t i=2; i < ndim-3; i++) { - tC(i,i-2) = 1.0; - tC(i,i-1) = -5.0; - tC(i,i) = 10.0; - tC(i,i+1) = -10.0; - tC(i,i+2) = 5.0; - tC(i,i+3) = -1.0; - } - } - else if (fDdim == 6) { - for (Int_t i = 3; i < ndim - 3; i++) { - tC(i,i-3) = 1.0; - tC(i,i-2) = -6.0; - tC(i,i-1) = 15.0; - tC(i,i) = -20.0; - tC(i,i+1) = 15.0; - tC(i,i+2) = -6.0; - tC(i,i+3) = 1.0; - } - } - - // Add epsilon to avoid singularities - for (Int_t i=0; iSumw2(); - - fSVHist = new TH1D( "sv", "Singular values of AC^-1", fNdim, 0, fNdim ); - fSVHist->Sumw2(); -} - -//_______________________________________________________________________ -void TSVDUnfold::RegularisedSymMatInvert( TMatrixDSym& mat, Double_t eps ) -{ - // naive regularised inversion cuts off small elements - - // init reduced matrix - const UInt_t n = mat.GetNrows(); - UInt_t nn = 0; - - UInt_t *ipos = new UInt_t[n]; - // UInt_t ipos[n]; - - // find max diagonal entries - Double_t ymax = 0; - for (UInt_t i=0; i ymax) ymax = TMath::Abs(mat[i][i]); - - for (UInt_t i=0; i eps) ipos[nn++] = i; - } - - // effective matrix - TMatrixDSym matwork( nn ); - for (UInt_t in=0; in - CERN, Switzerland * - * Andreas Hoecker - CERN, Switzerland * - * Heiko Lacker - Humboldt U, Germany * - * * - * Copyright (c) 2010: * - * CERN, Switzerland * - * Humboldt University, Germany * - * * - **********************************************************************************/ - -////////////////////////////////////////////////////////////////////////// -// // -// TSVDUnfold // -// // -// Data unfolding using Singular Value Decomposition (hep-ph/9509307) // -// Authors: Kerstin Tackmann, Andreas Hoecker, Heiko Lacker // -// // -////////////////////////////////////////////////////////////////////////// - -#ifndef TSVDUNFOLD_H -#define TSVDUNFOLD_H - -#ifndef ROOT_TObject -#include "TObject.h" -#endif -#ifndef ROOT_TMatrixD -#include "TMatrixD.h" -#endif -#ifndef ROOT_TVectorD -#include "TVectorD.h" -#endif -#ifndef ROOT_TMatrixDSym -#include "TMatrixDSym.h" -#endif - -class TH1D; -class TH2D; - -class TSVDUnfold : public TObject { - -public: - - // Constructor - // Initialisation of unfolding - // "bdat" - measured data distribution (number of events) - // "bini" - reconstructed MC distribution (number of events) - // "xini" - truth MC distribution (number of events) - // "Adet" - detector response matrix (number of events) - TSVDUnfold( const TH1D* bdat, const TH1D* bini, const TH1D* xini, const TH2D* Adet ); - TSVDUnfold( const TSVDUnfold& other ); - - // Destructor - virtual ~TSVDUnfold(); - - // Set option to normalize unfolded spectrum to unit area - // "normalize" - switch - void SetNormalize ( Bool_t normalize ) { fNormalize = normalize; } - - // Do the unfolding - // "kreg" - number of singular values used (regularisation) - TH1D* Unfold ( Int_t kreg ); - - // Determine for given input error matrix covariance matrix of unfolded - // spectrum from toy simulation - // "cov" - covariance matrix on the measured spectrum, to be propagated - // "ntoys" - number of pseudo experiments used for the propagation - // "seed" - seed for pseudo experiments - TH2D* GetUnfoldCovMatrix( const TH2D* cov, Int_t ntoys, Int_t seed = 1 ); - - // Determine covariance matrix of unfolded spectrum from finite statistics in - // response matrix - // "ntoys" - number of pseudo experiments used for the propagation - // "seed" - seed for pseudo experiments - TH2D* GetAdetCovMatrix( Int_t ntoys, Int_t seed=1 ); - - // Regularisation parameter - Int_t GetKReg() const { return fKReg; } - - // Obtain the distribution of |d| (for determining the regularization) - TH1D* GetD() const; - - // Obtain the distribution of singular values - TH1D* GetSV() const; - - // Helper functions - static Double_t ComputeChiSquared( const TH1D& truspec, const TH1D& unfspec, const TH2D& covmat, Double_t regpar = 0.01 ); - -private: - - // Helper functions for vector and matrix operations - void FillCurvatureMatrix( TMatrixD& tCurv, TMatrixD& tC ) const; - static Double_t GetCurvature ( const TVectorD& vec, const TMatrixD& curv ); - - void InitHistos ( ); - - // Helper functions - static void H2V ( const TH1D* histo, TVectorD& vec ); - static void H2Verr ( const TH1D* histo, TVectorD& vec ); - static void V2H ( const TVectorD& vec, TH1D& histo ); - static void H2M ( const TH2D* histo, TMatrixD& mat ); - static TMatrixD MatDivVec( const TMatrixD& mat, const TVectorD& vec, Int_t zero=0 ); - static TVectorD CompProd ( const TVectorD& vec1, const TVectorD& vec2 ); - - static TVectorD VecDiv ( const TVectorD& vec1, const TVectorD& vec2, Int_t zero = 0 ); - static void RegularisedSymMatInvert( TMatrixDSym& mat, Double_t eps = 1e-3 ); - - // Class members - Int_t fNdim; //! Truth and reconstructed dimensions - Int_t fDdim; //! Derivative for curvature matrix - Bool_t fNormalize; //! Normalize unfolded spectrum to 1 - Int_t fKReg; //! Regularisation parameter - TH1D* fDHist; // Distribution of d (for checking regularization) - TH1D* fSVHist; // Distribution of singular values - - // Input histos - const TH1D* fBdat; // measured distribution (data) - const TH1D* fBini; // reconstructed distribution (MC) - const TH1D* fXini; // truth distribution (MC) - const TH2D* fAdet; // Detector response matrix - - // Evaluation of covariance matrices - TH1D* fToyhisto; //! Toy MC histogram - TH2D* fToymat; //! Toy MC detector response matrix - Bool_t fToyMode; //! Internal switch for covariance matrix propagation - Bool_t fMatToyMode; //! Internal switch for evaluation of statistical uncertainties from response matrix - - - ClassDef( TSVDUnfold, 0 ) // Data unfolding using Singular Value Decomposition (hep-ph/9509307) -}; - -#endif From 8f194eb2b667d2c4504e51d2645d4b192a4a43fd Mon Sep 17 00:00:00 2001 From: kreczko Date: Wed, 4 Feb 2015 13:18:13 +0000 Subject: [PATCH 2/3] Added cmake config & macros as well as a simple BOOST test --- .gitignore | 17 + CMakeLists.txt | 85 ++++ GNUmakefile | 391 ------------------- ci/install.sh | 1 + ci/test.sh | 6 + cmake/Modules/FindROOT.cmake | 264 +++++++++++++ cmake/Modules/MacroCheckPackageLibs.cmake | 165 ++++++++ cmake/Modules/MacroCheckPackageVersion.cmake | 109 ++++++ cmake/Modules/MacroRootDict.cmake | 146 +++++++ cmake/Modules/README.md | 3 + include/RooUnfold_LinkDef.h | 2 - test/simpletest.cpp | 11 + 12 files changed, 807 insertions(+), 393 deletions(-) create mode 100644 CMakeLists.txt delete mode 100644 GNUmakefile create mode 100644 cmake/Modules/FindROOT.cmake create mode 100644 cmake/Modules/MacroCheckPackageLibs.cmake create mode 100644 cmake/Modules/MacroCheckPackageVersion.cmake create mode 100644 cmake/Modules/MacroRootDict.cmake create mode 100644 cmake/Modules/README.md create mode 100755 test/simpletest.cpp diff --git a/.gitignore b/.gitignore index b8faed3..2d3f533 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,19 @@ libRooUnfold.so tmp +/Release/ +Debug +Release +.cp* +.py* +.project +CMakeFiles +CMakeCache.txt +cmake_install.cmake +CTestTestfile.cmake +rootdict +RooUnfold_test +Makefile +*~ +*Dict.cxx +*Dict_rdict.pcm +Test* diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..d8cb657 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,85 @@ +# Check if cmake has the required version +CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0 FATAL_ERROR) + +set(PROJECT_NAME_STR RooUnfold) +set(PROJECT_LIB_NAME ${PROJECT_NAME_STR}) +PROJECT(${PROJECT_NAME_STR}) +include_directories(include) + +set(CINTFILE ${PROJECT_NAME_STR}Dict.cxx) +file(GLOB LINK_DEF_FILE include/*_LinkDef.h) +file(GLOB HEADER_FILES include/*.h) +list(REMOVE_ITEM HEADER_FILES ${LINK_DEF_FILE}) + + +if((CMAKE_SYSTEM_PROCESSOR MATCHES "i386") AND (CMAKE_SIZEOF_VOID_P EQUAL 8) AND (APPLE)) + set(CMAKE_OSX_ARCHITECTURES "x86_64") + MESSAGE(STATUS "Building ${PROJECT_NAME_STR} for ${CMAKE_OSX_ARCHITECTURES} architecture on ${CMAKE_SYSTEM_NAME}") +else() + MESSAGE(STATUS "Building ${PROJECT_NAME_STR} on ${CMAKE_SYSTEM_NAME}") +endif() +MESSAGE(STATUS "Using compiler ${CMAKE_CXX_COMPILER_ID}") +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") +MESSAGE(STATUS "Using CMAKE module path ${CMAKE_SOURCE_DIR}") + +# get ROOT +find_package(ROOT "5.34" REQUIRED) +MESSAGE(STATUS "** ROOT Include path: ${ROOT_INCLUDE_DIRS}") +MESSAGE(STATUS "** ROOT Library path: ${ROOT_LIBRARY_DIRS}") +MESSAGE(STATUS "** ROOT Libraries: ${ROOT_LIBRARIES}") + +include_directories(${ROOT_INCLUDE_DIRS}) +link_directories(${ROOT_LIBRARY_DIRS}) + +# load helper macros for using rootcint +INCLUDE( ${ROOT_DICT_MACROS_FILE} ) +set(ROOT_DICT_INPUT_HEADERS ${HEADER_FILES}) +set(ROOT_DICT_OUTPUT_DIR ${PROJECT_SOURCE_DIR}) +# and add LinkDef file to the end +LIST( APPEND ROOT_DICT_INPUT_HEADERS ${LINK_DEF_FILE} ) + +# generate dictionary sources using rootcint +GEN_ROOT_DICT_SOURCE( ${CINTFILE} ) + +# get boost +set(Boost_USE_MULTITHREADED ON) +find_package(Boost COMPONENTS + unit_test_framework + REQUIRED) +MESSAGE(STATUS "** Boost Include path: ${Boost_INCLUDE_DIR}") +MESSAGE(STATUS "** Boost Library path: ${Boost_LIBRARY_DIRS}") +MESSAGE(STATUS "** Boost Libraries: ${Boost_LIBRARIES}") +include_directories(${Boost_INCLUDE_DIRS}) +link_directories(${Boost_LIBRARY_DIRS}) + +#Check the compiler and set the compile and link flags +set(CMAKE_BUILD_TYPE Release) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -std=c++11") +# first attempt to make cmake work again on OS X +if((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND (APPLE)) + MESSAGE(STATUS "** std library for clang: libc++") + set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -stdlib=libc++") +endif() + +# adding the library +aux_source_directory(${PROJECT_SOURCE_DIR}/src SRC) +LIST(APPEND SRC ${ROOT_DICT_OUTPUT_SOURCES} ) +add_library(${PROJECT_LIB_NAME} SHARED ${SRC}) +target_link_libraries(${PROJECT_LIB_NAME} + ${Boost_LIBRARIES} + ${ROOT_LIBRARIES} + ) + +# tests +enable_testing() +set(PROJECT_TEST_NAME ${PROJECT_NAME_STR}_test) +include_directories(${COMMON_INCLUDES}) +file(GLOB TEST_SRC_FILES ${PROJECT_SOURCE_DIR}/test/*.cpp) +add_executable(${PROJECT_TEST_NAME} ${TEST_SRC_FILES}) +target_link_libraries(${PROJECT_TEST_NAME} + ${Boost_LIBRARIES} + ${ROOT_LIBRARIES} + ${PROJECT_LIB_NAME} + ) + +add_test(test1 ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${PROJECT_TEST_NAME}) diff --git a/GNUmakefile b/GNUmakefile deleted file mode 100644 index f7a9eb5..0000000 --- a/GNUmakefile +++ /dev/null @@ -1,391 +0,0 @@ -#=============================================================================== -# File and Version Information: -# $Id$ -# -# Description: -# Makefile for the RooUnfold package -# -# Instructions: -# o Make sure the ROOTSYS environment variable is set and points -# to your ROOT release, and that $ROOTSYS/bin is in your PATH. -# -# o run 'make ' -# - Default target makes shared library (libRooUnfold.so) for use -# in ROOT. -# - Add NOROOFIT=1 to build test programs (RooUnfoldTest*) -# without RooFit (this is default if RooFit is not available). -# - Add SHARED=1 to link test executables with shared library -# (libRooUnfold.so). Otherwise links with static library -# (libRooUnfold.a). -# - Add ROOTBUILD=debug for debug version. -# - Add VERBOSE=1 to show main commands as they are executed -# -# Build targets: -# help - give brief help -# shlib - make libRooUnfold.so (default target) -# include - make dependency files (*.d) -# lib - make libRooUnfold.a -# bin - make lib and example programs -# commands- show commands to make each type of target -# html - make documentation in htmldoc subdirectory -# cleanbin- delete test binaries and objects -# clean - delete all intermediate and final build objects -# -# Author: Tim Adye -# -#=============================================================================== - -# === ROOT setup =============================================================== - -ROOTSYS ?= ERROR_RootSysIsNotDefined - --include $(ROOTSYS)/test/Makefile.arch -ifeq ($(ROOTCONFIG),) -ROOTCONFIG = $(ROOTSYS)/bin/root-config -endif - -ifeq ($(ARCH),) -# === This section is just in case ROOT's test/Makefile.arch didn't work ======= -out := $(shell echo "$(ROOTSYS)/test/Makefile.arch not found - trying a basic Linux config" >&2) -ARCH = $(shell $(ROOTCONFIG) --arch) -ROOTLIBS = $(shell $(ROOTCONFIG) --libs) -CXXFLAGS = $(shell $(ROOTCONFIG) --cflags) -CXX = clang++ -CXXFLAGS += -Wall -fPIC -LD = clang++ -LDFLAGS = -SOFLAGS = -shared -ObjSuf = o -ExeSuf = -DllSuf = so -OutPutOpt = -o # keep whitespace after "-o" -ifneq ($(findstring debug,$(ROOTBUILD)),) -CXXFLAGS += -g -LDFLAGS += -g -endif -endif - -ifeq ($(PLATFORM),macosx) -# Fix stupid shared library option on MacOSX. This doesn't work (and we don't -# need it) because our linker output file specifies the full path. -SOFLAGS := $(subst -install_name $(CURDIR)/,,$(SOFLAGS)) -endif - -ROOTINCDIR = $(shell $(ROOTCONFIG) --incdir) -ROOTLIBDIR = $(shell $(ROOTCONFIG) --libdir) -ROOTINCLUDES = -I$(ROOTINCDIR) - -ROOTVERSION = $(shell $(ROOTCONFIG) --version) -ROOTMAJORVERSION = $(firstword $(subst ., ,$(ROOTVERSION))) - -ifeq ($(ROOTCINT),) -ifeq ($(ROOTMAJORVERSION),6) -ROOTCINT = rootcling -else -ROOTCINT = rootcint -endif -endif -ifeq ($(RLIBMAP),) -RLIBMAP = rlibmap -endif -ifeq ($(VERBOSE),1) -_ = -else -_ = @ -endif - -# === RooUnfold directories ======================================== - -PACKAGE = RooUnfold -SRCDIR = $(abspath $(CURDIR))/src/ -INCDIR = $(SRCDIR) -WORKDIR = $(CURDIR)/tmp/$(ARCH)/ -LIBDIR = $(CURDIR)/ -SHLIBDIR = $(CURDIR)/ -EXEDIR = $(CURDIR)/ -EXESRC = $(CURDIR)/examples/ -HTMLDOC = htmldoc -OBJDIR = $(WORKDIR)obj/ -DEPDIR = $(WORKDIR)dep/ - -# === RooUnfold options =================================================== - -# Only provide RooUnfoldTUnfold if TUnfold is available. -# TUnfold is included in ROOT 5.22 and later. -ifeq ($(HAVE_TUNFOLD),) -ifneq ($(wildcard $(ROOTINCDIR)/TUnfold.h),) -HAVE_TUNFOLD = 1 -endif -endif - -ifneq ($(HAVE_TUNFOLD),1) -CPPFLAGS += -DNOTUNFOLD -EXCLUDE += RooUnfoldTUnfold.cxx RooUnfoldTUnfold.h -endif - -# RooUnfoldDagostini is an interface to D'Agostini's implementation -# of his algorithm: http://www.roma1.infn.it/~dagos/bayes_distr.txt . -# To use this, put it in src/bayes.for and src/bayes_c.for. -ifeq ($(HAVE_DAGOSTINI),) -ifneq ($(wildcard $(SRCDIR)/bayes.for),) -HAVE_DAGOSTINI = 1 -endif -endif - -ifeq ($(HAVE_DAGOSTINI),1) -EXTRASRC += bayes.for -FDEP = $(SRCDIR)bayes_c.for -CPPFLAGS += -DHAVE_DAGOSTINI -else -EXCLUDE += RooUnfoldDagostini.cxx RooUnfoldDagostini.h -endif - -# TSVDUnfold is included in ROOT 5.28 and later. In earlier versions, use our own copy. -ifeq ($(HAVE_TSVDUNFOLD),) -ifeq ($(wildcard $(ROOTINCDIR)/TSVDUnfold.h),) -HAVE_TSVDUNFOLD = 1 -endif -endif - -ifeq ($(HAVE_TSVDUNFOLD),1) -CPPFLAGS += -DHAVE_TSVDUNFOLD -else -EXCLUDE += TSVDUnfold.cxx TSVDUnfold_local.h -endif - -# RooFit is included in ROOT if ROOT was compiled with --enable-roofit. -# We only use it for better-normalised test distributions in RooUnfoldTest -# (uses examples/RooUnfoldTestPdfRooFit.icc instead of examples/RooUnfoldTestPdf.icc). -ifeq ($(NOROOFIT),) -ifneq ($(shell $(ROOTCONFIG) --has-roofit),yes) -out := $(shell echo "This version of ROOT does not support RooFit. We will build the test programs without it." >&2) -NOROOFIT = 1 -endif -endif - -ifneq ($(NOROOFIT),) -CPPFLAGS += -DNOROOFIT -else -ROOFITLIBS += -lRooFit -# Different versions of ROOT require different libraries with RooFit, so -# include all the ones that exist. -# Note that if the ROOT shared libraries were linked against them -# (configure --enable-explicitlink ?), as is done in the CERN AFS versions, -# then these are not required. But they do no harm. -ROOFITLIBS += $(patsubst $(ROOTLIBDIR)/lib%.$(DllSuf),-l%,$(wildcard $(patsubst %,$(ROOTLIBDIR)/lib%.$(DllSuf),RooFitCore Thread Minuit Foam MathMore Html))) -endif - -# === Internal configuration =================================================== - -MAIN = $(filter-out $(EXCLUDE),$(notdir $(wildcard $(EXESRC)*.cxx))) -MAINEXE = $(addprefix $(EXEDIR),$(patsubst %.cxx,%$(ExeSuf),$(MAIN))) -LINKDEF = $(INCDIR)$(PACKAGE)_LinkDef.h -HLIST = $(filter-out $(addprefix $(INCDIR),$(EXCLUDE)) $(LINKDEF),$(wildcard $(INCDIR)*.h)) $(LINKDEF) -CINTFILE = $(WORKDIR)$(PACKAGE)Dict.cxx -CINTOBJ = $(OBJDIR)$(PACKAGE)Dict.o -LIBNAME = $(PACKAGE) -STATICLIBNAME = $(PACKAGE)_static -LIBFILE = $(LIBDIR)lib$(LIBNAME).a -STATICLIBFILE = $(LIBDIR)lib$(STATICLIBNAME).a -SHLIBFILE = $(SHLIBDIR)lib$(LIBNAME).$(DllSuf) -ROOTMAP = $(SHLIBDIR)lib$(LIBNAME).rootmap - -CPPFLAGS += -DMAKEBUILD -ifneq ($(findstring g++,$(CXX)),) -MFLAGS = -MM -endif -INCLUDES = -I$(INCDIR) -I$(HOME) -iquote$(INCDIR) -iquote$(HOME) -CXX += $(EXTRAINCLUDES) -LDFLAGS += $(EXTRALDFLAGS) - -ifneq ($(SHARED),) -LIBS = -L$(SHLIBDIR) -LINKLIB = $(SHLIBFILE) -LINKLIBOPT = -l$(LIBNAME) $(EXTRALIBS) -else -LIBS = -L$(LIBDIR) -LINKLIB = $(STATICLIBFILE) -LINKLIBOPT = -l$(STATICLIBNAME) $(EXTRALIBS) -endif - -# List of all object files to build -SRCLIST = $(filter-out $(EXCLUDE),$(notdir $(wildcard $(SRCDIR)*.cxx))) $(EXTRASRC) -OLIST = $(addprefix $(OBJDIR),$(addsuffix .o,$(basename $(SRCLIST)))) - -ifneq ($(filter %.for,$(SRCLIST)),) -GCCLIBS = -lg2c -endif - -ROOTLIBFILES := $(wildcard $(patsubst -l%,$(ROOTLIBDIR)/lib%.$(DllSuf),$(filter -l%,$(ROOTLIBS)))) - -ifeq ($(MFLAGS),) - -# Can't make dependency files, so make every compilation dependent on all headers. -HDEP = $(HLIST) - -else - -# List of all dependency files to make -DLIST = $(addprefix $(DEPDIR),$(patsubst %.cxx,%.d,$(filter %.cxx,$(SRCLIST) $(filter-out $(EXCLUDE),$(notdir $(wildcard $(EXESRC)*.cxx)))))) - -# If possible, limit ROOTLIBFILES to libraries that we actually use. -DLISTLIB = $(wildcard $(addprefix $(DEPDIR),$(patsubst %.cxx,%.d,$(filter %.cxx,$(SRCLIST))))) -ifneq ($(DLISTLIB),) -ROOTLIBMAPS := $(wildcard $(patsubst %.$(DllSuf),%.rootmap,$(ROOTLIBFILES))) -ifneq ($(ROOTLIBMAPS),) -ROOTLIBFILESUSED := $(patsubst %.rootmap,%.$(DllSuf),$(shell sed -n 's,^ *$(ROOTINCDIR)[^ ]*/\([^ /]*\)\.h .*,^Library\.\1:,p' $(DLISTLIB) | sort -u | grep -l -f- $(ROOTLIBMAPS))) -ifneq ($(ROOTLIBFILESUSED),) -ROOTLIBFILES := $(ROOTLIBFILESUSED) -endif -endif -endif - -endif - -ifeq ($(NOROOFIT),) -ifeq ($(DLIST),) -# Since we can't check the dependencies, include RooFit on all binaries -ROOFITCLIENTS = $(patsubst %.cxx,$(OBJDIR)%.o,$(MAIN)) -else -# List of programs that use RooFit. Should only be those in $(EXESRC) -ROOFITCLIENTS = $(patsubst $(DEPDIR)%.d,$(OBJDIR)%.o,$(shell fgrep -l '/RooAbsArg.h ' $(DLIST) 2>/dev/null)) -endif -endif - -# === Implicit rules =========================================================== - -# Implicit rule making all dependency Makefiles included at the end of this makefile -$(DEPDIR)%.d : $(SRCDIR)%.cxx - @echo "Making $@" - @mkdir -p $(DEPDIR) - @rm -f $@ - $(_)set -e; \ - $(CXX) $(MFLAGS) $(CPPFLAGS) $(INCLUDES) $(ROOTINCLUDES) $< \ - | sed 's,\($(notdir $*)\.o\) *:,$(OBJDIR)\1 $@ :,g' > $@; \ - [ -s $@ ] || rm -f $@ - -$(DEPDIR)%.d : $(EXESRC)%.cxx - @echo "Making $@" - @mkdir -p $(DEPDIR) - @rm -f $@ - $(_)set -e; \ - $(CXX) $(MFLAGS) $(CPPFLAGS) $(INCLUDES) $(ROOTINCLUDES) $< \ - | sed 's,\($(notdir $*)\.o\) *:,$(OBJDIR)\1 $@ :,g' > $@; \ - [ -s $@ ] || rm -f $@ - -# Implicit rule to compile all classes -$(OBJDIR)%.o : $(SRCDIR)%.cxx $(HDEP) - @echo "Compiling $<" - @mkdir -p $(OBJDIR) - $(_)$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@ $(INCLUDES) - -# Implicit rule to compile intermediate files -$(OBJDIR)%.o : $(WORKDIR)%.cxx $(HDEP) - @echo "Compiling $<" - @mkdir -p $(OBJDIR) - $(_)$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@ $(INCLUDES) - -# Implicit rule for Fortran (if any) -$(OBJDIR)%.o : $(SRCDIR)%.for $(FDEP) - @echo "Compiling $<" - @mkdir -p $(OBJDIR) - $(_)$(FC) $(FFFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@ - -# Implicit rule to compile main program -$(OBJDIR)%.o : $(EXESRC)%.cxx $(HDEP) - @echo "Compiling main program $<" - @mkdir -p $(OBJDIR) - $(_)$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@ $(INCLUDES) - -# === Explicit rules =========================================================== - -default : shlib - -help : - @echo "Usage: $(MAKE) [TARGET] [ROOTBUILD=debug] [VERBOSE=1] [NOROOFIT=1] [SHARED=1]" - @echo "Some TARGETs are: 'bin', 'html', 'clean', and 'commands'" - -# Rule to make ROOTCINT output file -$(CINTFILE) : $(HLIST) - @mkdir -p $(WORKDIR) - @mkdir -p $(OBJDIR) - @echo "Generating dictionary from $(LINKDEF)" - $(_)cd $(SRC) ; $(ROOTCINT) -f $(CINTFILE) -c -p $(CPPFLAGS) $(INCLUDES) $(HLIST) - -$(ROOTMAP) : $(SHLIBFILE) $(LINKDEF) - @echo "Making $@" - $(_)$(RLIBMAP) -o $@ -l $< -d $(ROOTLIBFILES) -c $(LINKDEF) - -# Rule to combine objects into a library -$(LIBFILE) : $(OLIST) $(CINTOBJ) - @echo "Making $@" - @mkdir -p $(LIBDIR) - @rm -f $@ - $(_)ar q $@ $^ - @ranlib $@ - -# Make symlink to static library so we can refer to that without picking up shared library. -# Assumes $(LIBFILE) and $(STATICLIBFILE) are in the same directory -$(STATICLIBFILE) : $(LIBFILE) - @rm -f $@ - $(_)ln -s $(patsubst $(dir $@)%,%,$<) $@ - -# Rule to combine objects into a shared library -$(SHLIBFILE) : $(OLIST) $(CINTOBJ) - @echo "Making $@" - @mkdir -p $(SHLIBDIR) - @rm -f $@ - $(_)$(LD) $(SOFLAGS) $(LDFLAGS) $^ $(OutPutOpt)$@ $(ROOTLIBS) $(GCCLIBS) - -$(MAINEXE) : $(EXEDIR)%$(ExeSuf) : $(OBJDIR)%.o $(LINKLIB) - @echo "Making executable $@" - @mkdir -p $(EXEDIR) - $(_)$(LD) $(LDFLAGS) $< $(OutPutOpt)$@ $(LIBS) $(LINKLIBOPT) $(ROOTLIBS) $(if $(findstring $<,$(ROOFITCLIENTS)),$(ROOFITLIBS)) $(GCCLIBS) - -# Useful build targets -include: $(DLIST) -lib: $(LIBFILE) -shlib: $(SHLIBFILE) #$(ROOTMAP) -bin: shlib $(MAINEXE) - -commands : - @echo "Make $(DEPDIR)%.d: $(CXX) $(MFLAGS) $(CPPFLAGS) $(INCLUDES) $(ROOTINCLUDES) $(SRCDIR)%.cxx | sed 's,\(%\.o\) *:,$(OBJDIR)\1 $(DEPDIR)%.d :,g' > $(DEPDIR)%.d" - @echo - @echo "Make dictionary: $(ROOTCINT) -f $(CINTFILE) -c -p $(INCLUDES) $(HLIST)" - @echo - @echo "Compile $(SRCDIR)%.cxx: $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(SRCDIR)%.cxx -o $(OBJDIR)%.o $(INCLUDES)" - @echo - @echo "Make $(SHLIBFILE): $(LD) $(SOFLAGS) $(LDFLAGS) *.o $(OutPutOpt)$(SHLIBFILE) $(ROOTLIBS) $(GCCLIBS)" - @echo - @echo "Make executable $(EXEDIR)RooUnfoldTest$(ExeSuf): $(LD) $(LDFLAGS) $(OBJDIR)RooUnfoldTest.o $(OutPutOpt)$(EXEDIR)RooUnfoldTest$(ExeSuf) $(LIBS) $(LINKLIBOPT) $(ROOTLIBS) $(ROOFITLIBS) $(GCCLIBS)" - -clean : cleanbin - rm -f $(DLIST) - rm -f $(CINTFILE) $(basename $(CINTFILE)).h - rm -f $(OLIST) $(CINTOBJ) - rm -f $(LIBFILE) - rm -f $(SHLIBFILE) $(ROOTMAP) - rm -f $(STATICLIBFILE) - -cleanbin : - rm -f $(addprefix $(OBJDIR),$(patsubst %.cxx,%.o,$(MAIN))) - rm -f $(MAINEXE) - -$(HTMLDOC)/index.html : $(SHLIBFILE) - @echo "Making HTML documentation in $(HTMLDOC)" - @( echo 'gSystem->Load("lib$(LIBNAME)");'; \ - echo 'THtml h;'; \ - echo 'h.SetProductName("$(PACKAGE)");'; \ - echo 'h.SetInputDir("$(SRCDIR)");'; \ - echo 'h.SetOutputDir("$(HTMLDOC)");'; \ - echo 'h.MakeAll();'; \ - echo '.q' ) \ - | root -l -b - -html : $(HTMLDOC)/index.html - -.PHONY : include shlib lib bin default clean cleanbin html - -ifneq ($(DLIST),) --include $(DLIST) -endif diff --git a/ci/install.sh b/ci/install.sh index 6d66005..0216142 100644 --- a/ci/install.sh +++ b/ci/install.sh @@ -29,4 +29,5 @@ echo "using CXX: ${CXX}" ls -lah /usr/bin/ | grep clang +cmake CMakelists.txt make diff --git a/ci/test.sh b/ci/test.sh index d6a33db..f9225a5 100644 --- a/ci/test.sh +++ b/ci/test.sh @@ -5,8 +5,14 @@ # in the .travis.yml in the top level folder of the project. set -e # Check if root and PyROOT work ok +echo "Checking ROOT installation" time root -l -q +echo "Checking PyROOT installation" time python -c 'import ROOT; ROOT.TBrowser()' # Check that RooUnfold can be imported +echo "Checking RooUnfold library" time python -c 'from ROOT import gSystem; gSystem.Load("libRooUnfold.so");from ROOT import RooUnfoldResponse' + +echo "Executing unit tests" +make test diff --git a/cmake/Modules/FindROOT.cmake b/cmake/Modules/FindROOT.cmake new file mode 100644 index 0000000..fdf29eb --- /dev/null +++ b/cmake/Modules/FindROOT.cmake @@ -0,0 +1,264 @@ +############################################################################### +# cmake module for finding ROOT +# +# requires: +# MacroCheckPackageLibs.cmake for checking package libraries +# +# Following cmake variables are returned by this module: +# +# ROOT_FOUND : set to TRUE if ROOT found +# If FIND_PACKAGE is called with REQUIRED and COMPONENTS arguments +# ROOT_FOUND is only set to TRUE if ALL components are found. +# If REQUIRED is NOT set components may or may not be available +# +# ROOT_LIBRARIES : list of ROOT libraries (NOT including COMPONENTS) +# ROOT_INCLUDE_DIRS : list of paths to be used with INCLUDE_DIRECTORIES +# ROOT_LIBRARY_DIRS : list of paths to be used with LINK_DIRECTORIES +# ROOT_COMPONENT_LIBRARIES : list of ROOT component libraries +# ROOT_${COMPONENT}_FOUND : set to TRUE or FALSE for each library +# ROOT_${COMPONENT}_LIBRARY : path to individual libraries +# +# +# Please note that by convention components should be entered exactly as +# the library names, i.e. the component name equivalent to the library +# $ROOTSYS/lib/libMathMore.so should be called MathMore and NOT: +# mathmore or Mathmore or MATHMORE +# +# However to follow the usual cmake convention it is agreed that the +# ROOT_${COMPONENT}_FOUND and ROOT_${COMPONENT}_LIBRARY variables are ALL +# uppercase, i.e. the MathMore component returns: ROOT_MATHMORE_FOUND and +# ROOT_MATHMORE_LIBRARY NOT ROOT_MathMore_FOUND or ROOT_MathMore_LIBRARY +# +# +# The additional ROOT components should be defined as follows: +# FIND_PACKAGE( ROOT COMPONENTS MathMore Gdml Geom ...) +# +# If components are required use: +# FIND_PACKAGE( ROOT REQUIRED COMPONENTS MathMore Gdml Geom ...) +# +# If only root is required and components are NOT required use: +# FIND_PACKAGE( ROOT REQUIRED ) +# FIND_PACKAGE( ROOT COMPONENTS MathMore Gdml Geom ... QUIET ) +# then you need to check for ROOT_MATHMORE_FOUND, ROOT_GDML_FOUND, etc. +# +# The variable ROOT_USE_COMPONENTS can also be used before calling +# FIND_PACKAGE, i.e.: +# SET( ROOT_USE_COMPONENTS MathMore Gdml Geom ) +# FIND_PACKAGE( ROOT REQUIRED ) # all ROOT_USE_COMPONENTS must also be found +# FIND_PACKAGE( ROOT ) # check for ROOT_FOUND, ROOT_MATHMORE_FOUND, etc. +# +# @author Jan Engels, DESY +############################################################################### + +# find root-config +SET( ROOT_CONFIG_EXECUTABLE ROOT_CONFIG_EXECUTABLE-NOTFOUND ) +MARK_AS_ADVANCED( ROOT_CONFIG_EXECUTABLE ) +FIND_PROGRAM( ROOT_CONFIG_EXECUTABLE root-config PATHS ${ROOT_DIR}/bin NO_DEFAULT_PATH ) +IF( NOT ROOT_DIR ) + FIND_PROGRAM( ROOT_CONFIG_EXECUTABLE root-config ) +ENDIF() + +IF( NOT ROOT_FIND_QUIETLY ) + MESSAGE( STATUS "Check for ROOT_CONFIG_EXECUTABLE: ${ROOT_CONFIG_EXECUTABLE}" ) +ENDIF() + + +IF( ROOT_CONFIG_EXECUTABLE ) + + # ============================================== + # === ROOT_PREFIX === + # ============================================== + + # get root prefix from root-config output + EXECUTE_PROCESS( COMMAND "${ROOT_CONFIG_EXECUTABLE}" --prefix + OUTPUT_VARIABLE ROOT_ROOT + RESULT_VARIABLE _exit_code + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + IF( NOT _exit_code EQUAL 0 ) + # clear variable if root-config exits with error + # it might contain garbage + SET( ROOT_ROOT ) + ENDIF() + + + + # ============================================== + # === ROOT_VERSION === + # ============================================== + + INCLUDE( MacroCheckPackageVersion ) + + EXECUTE_PROCESS( COMMAND "${ROOT_CONFIG_EXECUTABLE}" --version + OUTPUT_VARIABLE _version + RESULT_VARIABLE _exit_code + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + IF( _exit_code EQUAL 0 ) + + # set required variables for MacroCheckPackageVersion + STRING(REGEX REPLACE "^([0-9]+).*" "\\1" ROOT_VERSION_MAJOR "${_version}") + STRING(REGEX REPLACE "^[0-9]+.([0-9]+).*" "\\1" ROOT_VERSION_MINOR "${_version}") + STRING(REGEX REPLACE "^[0-9]+.[0-9]+.([0-9]+).*" "\\1" ROOT_VERSION_PATCH "${_version}") + + SET( ROOT_VERSION "${ROOT_VERSION_MAJOR}.${ROOT_VERSION_MINOR}.${ROOT_VERSION_PATCH}" ) + ENDIF() + + CHECK_PACKAGE_VERSION( ROOT ${ROOT_VERSION} ) + + # find rootcint + SET( ROOT_CINT_EXECUTABLE ROOT_CINT_EXECUTABLE-NOTFOUND ) + MARK_AS_ADVANCED( ROOT_CINT_EXECUTABLE ) + IF( ${ROOT_VERSION_MAJOR} EQUAL 6 OR ${ROOT_VERSION_MAJOR} GREATER 6) + set(ROOT_CINT_EXE_NAME rootcling) + ELSE() + set(ROOT_CINT_EXE_NAME rootcint) + ENDIF() + FIND_PROGRAM( ROOT_CINT_EXECUTABLE ${ROOT_CINT_EXE_NAME} PATHS ${ROOT_DIR}/bin NO_DEFAULT_PATH ) + IF( NOT ROOT_DIR ) + FIND_PROGRAM( ROOT_CINT_EXECUTABLE ${ROOT_CINT_EXE_NAME} ) + ENDIF() + MESSAGE( STATUS "Check for ROOT_CINT_EXECUTABLE: ${ROOT_CINT_EXECUTABLE}" ) + + + # ============================================== + # === ROOT_INCLUDE_DIR === + # ============================================== + + # get include dir from root-config output + EXECUTE_PROCESS( COMMAND "${ROOT_CONFIG_EXECUTABLE}" --incdir + OUTPUT_VARIABLE _inc_dir + RESULT_VARIABLE _exit_code + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + IF( NOT _exit_code EQUAL 0 ) + # clear _inc_dir if root-config exits with error + # it might contain garbage + SET( _inc_dir ) + ENDIF() + + + SET( ROOT_INCLUDE_DIRS ROOT_INCLUDE_DIRS-NOTFOUND ) + MARK_AS_ADVANCED( ROOT_INCLUDE_DIRS ) + + FIND_PATH( ROOT_INCLUDE_DIRS + NAMES TH1.h + PATHS ${ROOT_DIR}/include ${_inc_dir} + NO_DEFAULT_PATH + ) + + + + # ============================================== + # === ROOT_LIBRARIES === + # ============================================== + + # get library dir from root-config output + EXECUTE_PROCESS( COMMAND "${ROOT_CONFIG_EXECUTABLE}" --libdir + OUTPUT_VARIABLE ROOT_LIBRARY_DIR + RESULT_VARIABLE _exit_code + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + IF( NOT _exit_code EQUAL 0 ) + # clear ROOT_LIBRARY_DIR if root-config exits with error + # it might contain garbage + SET( ROOT_LIBRARY_DIR ) + ENDIF() + + + + # ========== standard root libraries ================= + + # standard root libraries (without components) + SET( _root_libnames ) + + # get standard root libraries from 'root-config --libs' output + EXECUTE_PROCESS( COMMAND "${ROOT_CONFIG_EXECUTABLE}" --noauxlibs --libs + OUTPUT_VARIABLE _aux + RESULT_VARIABLE _exit_code + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + IF( _exit_code EQUAL 0 ) + + # create a list out of the output + SEPARATE_ARGUMENTS( _aux ) + + # remove first item -L compiler flag + LIST( REMOVE_AT _aux 0 ) + + FOREACH( _lib ${_aux} ) + + # extract libnames from -l compiler flags + STRING( REGEX REPLACE "^-.(.*)$" "\\1" _libname "${_lib}") + + # fix for some root-config versions which export -lz even if using --noauxlibs + IF( NOT _libname STREQUAL "z" ) + + # append all library names into a list + LIST( APPEND _root_libnames ${_libname} ) + + ENDIF() + + ENDFOREACH() + + ENDIF() + + + + # ========== additional root components ================= + + # ---------- libraries -------------------------------------------------------- + INCLUDE( MacroCheckPackageLibs ) + + SET( ROOT_LIB_SEARCH_PATH ${ROOT_LIBRARY_DIR} ) + + # only standard libraries should be passed as arguments to CHECK_PACKAGE_LIBS + # additional components are set by cmake in variable PKG_FIND_COMPONENTS + # first argument should be the package name + CHECK_PACKAGE_LIBS( ROOT ${_root_libnames} ) + + + + + # ====== DL LIBRARY ================================================== + # workaround for cmake bug in 64 bit: + # see: http://public.kitware.com/mantis/view.php?id=10813 + IF( CMAKE_SIZEOF_VOID_P EQUAL 8 ) + FIND_LIBRARY( DL_LIB NAMES ${CMAKE_DL_LIBS} dl PATHS /usr/lib64 /lib64 NO_DEFAULT_PATH ) + ENDIF( CMAKE_SIZEOF_VOID_P EQUAL 8 ) + + FIND_LIBRARY( DL_LIB NAMES ${CMAKE_DL_LIBS} dl ) + MARK_AS_ADVANCED( DL_LIB ) + + IF( NOT ROOT_FIND_QUIETLY ) + MESSAGE( STATUS "Check for libdl.so: ${DL_LIB}" ) + ENDIF() + +ENDIF( ROOT_CONFIG_EXECUTABLE ) + +# Threads library +#FIND_PACKAGE( Threads REQUIRED) + + +# ---------- final checking --------------------------------------------------- +INCLUDE( FindPackageHandleStandardArgs ) +# set ROOT_FOUND to TRUE if all listed variables are TRUE and not empty +# ROOT_COMPONENT_VARIABLES will be set if FIND_PACKAGE is called with REQUIRED argument +FIND_PACKAGE_HANDLE_STANDARD_ARGS( ROOT DEFAULT_MSG ROOT_INCLUDE_DIRS ROOT_LIBRARIES ${ROOT_COMPONENT_VARIABLES} PACKAGE_VERSION_COMPATIBLE DL_LIB ) + +IF( ROOT_FOUND ) + LIST( APPEND ROOT_LIBRARIES ${DL_LIB} ) + + # file including MACROS for generating root dictionary sources + GET_FILENAME_COMPONENT( _aux ${CMAKE_CURRENT_LIST_FILE} PATH ) + SET( ROOT_DICT_MACROS_FILE ${_aux}/MacroRootDict.cmake ) + +ENDIF( ROOT_FOUND ) + +# ---------- cmake bug -------------------------------------------------------- +# ROOT_FIND_REQUIRED is not reset between FIND_PACKAGE calls, i.e. the following +# code fails when geartgeo component not available: (fixed in cmake 2.8) +# FIND_PACKAGE( ROOT REQUIRED ) +# FIND_PACKAGE( ROOT COMPONENTS geartgeo QUIET ) +SET( ROOT_FIND_REQUIRED ) + diff --git a/cmake/Modules/MacroCheckPackageLibs.cmake b/cmake/Modules/MacroCheckPackageLibs.cmake new file mode 100644 index 0000000..e805065 --- /dev/null +++ b/cmake/Modules/MacroCheckPackageLibs.cmake @@ -0,0 +1,165 @@ +############################################################################## +# macro for checkin package libraries in ${PKG_ROOT}/lib +# +# +# macro usage: +# CHECK_PACKAGE_LIBS( PACKAGE_NAME stdlib1 stdlib2 ... stdlibn ) +# only standard libraries should be passed as arguments to the macro +# component libraries are set by cmake in PKG_FIND_COMPONENTS (when +# calling FIND_PACKAGE with COMPONENTS argument) or through the +# variable PKG_USE_COMPONENTS +# +# +# required variables: +# PKG_ROOT : path to PKG root directory +# +# +# returns following variables: +# PKG_LIBRARY_DIRS : list of paths to be used with LINK_DIRECTORIES +# PGK_LIBRARIES : list of STANDARD libraries (NOT including COMPONENTS) +# PKG_COMPONENT_LIBRARIES : list of COMPONENT libraries +# PKG_${COMPONENT}_FOUND : set to TRUE or FALSE for each library +# PKG_${COMPONENT}_LIBRARY : path to each individual library +# +# +# PKG_LIBRARIES and PKG_LIBRARY_DIRS will be empty if any of the standard +# libraries is missing +# +# @author Jan Engels, Desy +############################################################################## + + +SET( CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE ) + +MACRO( CHECK_PACKAGE_LIBS _pkgname ) + + SET( _std_lib_missing FALSE ) + SET( _ext_lib_missing FALSE ) + + SET( _std_libnames ${ARGN} ) + SET( _ext_libnames ${${_pkgname}_FIND_COMPONENTS} ${${_pkgname}_USE_COMPONENTS} ) + + IF( _ext_libnames ) + SEPARATE_ARGUMENTS( _ext_libnames ) + LIST( REMOVE_DUPLICATES _ext_libnames ) + ENDIF() + + IF( NOT ${_pkgname}_FIND_QUIETLY ) + MESSAGE( STATUS "Check for ${_pkgname}_LIBRARIES: ${_std_libnames}" ) + IF( _ext_libnames ) + MESSAGE( STATUS "Check for ${_pkgname}_COMPONENT_LIBRARIES: ${_ext_libnames}" ) + ENDIF() + ENDIF() + + SET( ${_pkgname}_LIBRARY_DIRS ) + MARK_AS_ADVANCED( ${_pkgname}_LIBRARY_DIRS ) + + SET( ${_pkgname}_LIBRARIES ) + MARK_AS_ADVANCED( ${_pkgname}_LIBRARIES ) + + SET( ${_pkgname}_COMPONENT_LIBRARIES ) + MARK_AS_ADVANCED( ${_pkgname}_COMPONENT_LIBRARIES ) + + SET( ${_pkgname}_COMPONENT_VARIABLES ) + MARK_AS_ADVANCED( ${_pkgname}_COMPONENT_VARIABLES ) + + FOREACH( _libname ${_std_libnames} ${_ext_libnames} ) + + # flag to check if it is a standard or a component library + LIST( FIND _std_libnames "${_libname}" _aux ) + IF( ${_aux} LESS 0 ) + SET( _is_std_lib FALSE ) + ELSE() + SET( _is_std_lib TRUE ) + ENDIF() + + # libname in upper case + STRING( TOUPPER ${_libname} _ulibname ) + + SET( ${_pkgname}_${_ulibname}_LIBRARY ${_pkgname}_${_ulibname}_LIBRARY-NOTFOUND ) + MARK_AS_ADVANCED( ${_pkgname}_${_ulibname}_LIBRARY ) + + # WARNING: using PATH_SUFFIXES may cause problems when using variable CMAKE_FIND_ROOT_PATH + # this problem does not occur if expanding PATHS + # look in FindMySQL.cmake for more info + #FIND_LIBRARY( ${_pkgname}_${_ulibname}_LIBRARY NAMES ${_libname} PATHS + # ${${_pkgname}_ROOT} ${${_pkgname}_DIR} ${${_pkgname}_LIB_SEARCH_PATH} + # PATH_SUFFIXES lib64 lib + # NO_DEFAULT_PATH + #) + + FIND_LIBRARY( ${_pkgname}_${_ulibname}_LIBRARY NAMES ${_libname} PATHS + ${${_pkgname}_ROOT}/lib64 ${${_pkgname}_ROOT}/lib + ${${_pkgname}_DIR}/lib64 ${${_pkgname}_DIR}/lib + ${${_pkgname}_LIB_SEARCH_PATH} ${${_pkgname}_LIB_SEARCH_PATH}/lib64 ${${_pkgname}_LIB_SEARCH_PATH}/lib + NO_DEFAULT_PATH + ) + + IF( NOT ${_pkgname}_DIR ) + FIND_LIBRARY( ${_pkgname}_${_ulibname}_LIBRARY NAMES ${_libname} ) + ENDIF() + + IF( ${_pkgname}_FIND_REQUIRED ) + LIST( APPEND ${_pkgname}_COMPONENT_VARIABLES ${_pkgname}_${_ulibname}_LIBRARY ) + ENDIF() + + IF( ${_pkgname}_${_ulibname}_LIBRARY ) # if library found + + SET( ${_pkgname}_${_ulibname}_FOUND TRUE ) + + # split libraries in PKG_LIBRARIES and PKG_COMPONENT_LIBRARIES + IF( _is_std_lib ) + LIST( APPEND ${_pkgname}_LIBRARIES ${${_pkgname}_${_ulibname}_LIBRARY} ) + ELSE() + LIST( APPEND ${_pkgname}_COMPONENT_LIBRARIES ${${_pkgname}_${_ulibname}_LIBRARY} ) + ENDIF() + + GET_FILENAME_COMPONENT( _aux ${${_pkgname}_${_ulibname}_LIBRARY} PATH ) + LIST( APPEND ${_pkgname}_LIBRARY_DIRS ${_aux} ) + + IF( NOT ${_pkgname}_FIND_QUIETLY ) + MESSAGE( STATUS "Check for ${_pkgname}_${_ulibname}_LIBRARY: ${${_pkgname}_${_ulibname}_LIBRARY} -- ok" ) + ENDIF() + + ELSE() # library not found + + SET( ${_pkgname}_${_ulibname}_FOUND FALSE ) + + IF( _is_std_lib ) + SET( _std_lib_missing TRUE ) + ELSE() + SET( _ext_lib_missing TRUE ) + ENDIF() + + IF( NOT ${_pkgname}_FIND_QUIETLY ) + MESSAGE( STATUS "Check for ${_pkgname}_${_ulibname}_LIBRARY: ${_libname} -- failed" ) + ENDIF() + + ENDIF() + + ENDFOREACH() + + # clear PKG_LIBRARIES if standard library is missing + IF( _std_lib_missing ) + SET( ${_pkgname}_LIBRARIES ) + ENDIF() + + # clear PKG_COMPONENT_LIBRARIES if a component library is missing and + # FIND_PACKAGE called with REQUIRED argument + IF( _ext_lib_missing AND ${_pkgname}_FIND_REQUIRED ) + SET( ${_pkgname}_COMPONENT_LIBRARIES ) + ENDIF() + + # remove duplicate paths in PKG_LIBRARY_DIRS + IF( ${_pkgname}_LIBRARY_DIRS ) + LIST( REMOVE_DUPLICATES ${_pkgname}_LIBRARY_DIRS ) + ENDIF() + + # debug + #MESSAGE( STATUS "${_pkgname}_LIBRARIES: ${${_pkgname}_LIBRARIES}" ) + #MESSAGE( STATUS "${_pkgname}_COMPONENT_LIBRARIES: ${${_pkgname}_COMPONENT_LIBRARIES}" ) + #MESSAGE( STATUS "${_pkgname}_LIBRARY_DIRS: ${${_pkgname}_LIBRARY_DIRS}" ) + +ENDMACRO( CHECK_PACKAGE_LIBS _pkgname ) + + diff --git a/cmake/Modules/MacroCheckPackageVersion.cmake b/cmake/Modules/MacroCheckPackageVersion.cmake new file mode 100644 index 0000000..7cc13dc --- /dev/null +++ b/cmake/Modules/MacroCheckPackageVersion.cmake @@ -0,0 +1,109 @@ +############################################################################## +# macro for checking a package version +# +# this macro should be called from your PKGVersion.cmake or from a +# FindPKG.cmake module with the following arguments: +# _pkgname : The package name +# _iversion : The installed version of the package +# +# +# the following conventions are used: +# +# if FIND_PACKAGE is called with EXACT argument than the version has to +# match EXACTLY, i.e.: +# 1.5 == 1.5 +# 1.5 == 1.5.0 +# 1.5 == 1.5.0.0 +# 1.5.2 == 1.5.2.0 +# 1.5.2.1 == 1.5.2.1 +# 1.5.2 != 1.5.2.1 +# 1.5 != 1.5.0.1 +# +# +# otherwise a MINIMUM_REQUIRED version is checked for, i.e. the same +# behavior as with the cmake variable CMAKE_MINIMUM_REQUIRED, e.g.: +# searching: 1.2 --> installed: 1.5.2.2 --> compatible +# searching: 1.5 --> installed: 1.5.2.2 --> compatible +# searching: 1.5.2.1 --> installed: 1.5.2.2 --> compatible +# searching: 1.5.2.3 --> installed: 1.5.2.2 --> unsuitable +# searching: 1.7 --> installed: 1.5.2.2 --> unsuitable +# +# +# following variables are returned (internally to cmake): +# PACKAGE_VERSION_EXACT : set to TRUE if exact version was found +# PACKAGE_VERSION_COMPATIBLE : set to TRUE if version is compatible +# PACKAGE_VERSION_UNSUITABLE : set to TRUE if version found is unsuitable +# +# +# @author Jan Engels, Desy IT +############################################################################## + +# these variables are evaluated internally by the cmake command FIND_PACKAGE to mark this +# package as suitable or not depending on the required version +SET( PACKAGE_VERSION_EXACT FALSE ) +SET( PACKAGE_VERSION_COMPATIBLE TRUE ) +SET( PACKAGE_VERSION_UNSUITABLE FALSE ) + + +# cmake internal variable PACKAGE_FIND_NAME is not defined on FindPKG.cmake +# modules, therefore it is passed as an argument to the macro +# _iversion is the installed version of the package +# _sversion is the version searched by the user with FIND_PACKAGE +#MACRO( CHECK_PACKAGE_VERSION _pkgname _iversion ) +MACRO( CHECK_PACKAGE_VERSION _pkgname ) # left with one argument only for backwards compatibility + + IF( NOT "${ARGV1}" STREQUAL "" ) + SET( _iversion ${ARGV1} ) + ELSE() + SET( _iversion ${${_pkgname}_VERSION_MAJOR}.${${_pkgname}_VERSION_MINOR}.${${_pkgname}_VERSION_PATCH}.${${_pkgname}_VERSION_TWEAK} ) + ENDIF() + + #SET( _sversion_major ${${_pkgname}_FIND_VERSION_MAJOR} ) + #SET( _sversion_minor ${${_pkgname}_FIND_VERSION_MINOR} ) + + SET( _sversion ${${_pkgname}_FIND_VERSION} ) + + IF( NOT ${_pkgname}_FIND_QUIETLY ) + MESSAGE( STATUS "Check for ${_pkgname} (${_iversion})" ) + ENDIF() + + # only do work if FIND_PACKAGE called with a version argument + IF( _sversion ) + + #IF( NOT ${_pkgname}_FIND_QUIETLY ) + # MESSAGE( STATUS "Check for ${_pkgname}: looking for version ${_sversion}" ) + #ENDIF() + + IF( ${_iversion} VERSION_EQUAL ${_sversion} ) # if version matches EXACTLY + #IF( NOT ${_pkgname}_FIND_QUIETLY ) + # MESSAGE( STATUS "Check for ${_pkgname}: exact version found: ${_iversion}" ) + #ENDIF() + SET( PACKAGE_VERSION_EXACT TRUE ) + ELSE() # if version does not match EXACTLY, check if it is compatible/suitable + + # installed version must be greater or equal than version searched by the user, i.e. + # like with the CMAKE_MINIMUM_REQUIRED commando + # if user asks for version 1.2.5 then any version >= 1.2.5 is suitable/compatible + IF( NOT ${_sversion} VERSION_LESS ${_iversion} ) + SET( PACKAGE_VERSION_UNSUITABLE TRUE ) + ENDIF() + # ------------------------------------------------------------------------------------- + + IF( ${_pkgname}_FIND_VERSION_EXACT ) # if exact version was required search must fail!! + #IF( NOT ${_pkgname}_FIND_QUIETLY ) + # MESSAGE( "Check for ${_pkgname}: could not find exact version" ) + #ENDIF() + SET( PACKAGE_VERSION_UNSUITABLE TRUE ) + ENDIF() + + ENDIF() + + IF( PACKAGE_VERSION_UNSUITABLE ) + SET( PACKAGE_VERSION_COMPATIBLE FALSE ) + ENDIF() + + ENDIF( _sversion ) + +ENDMACRO( CHECK_PACKAGE_VERSION ) + + diff --git a/cmake/Modules/MacroRootDict.cmake b/cmake/Modules/MacroRootDict.cmake new file mode 100644 index 0000000..f5a741e --- /dev/null +++ b/cmake/Modules/MacroRootDict.cmake @@ -0,0 +1,146 @@ +IF(APPLE) + SET( LD_LIBRARY_PATH_VAR DYLD_LIBRARY_PATH ) +ELSE() + SET( LD_LIBRARY_PATH_VAR LD_LIBRARY_PATH ) +ENDIF() +SET( LD_LIBRARY_PATH_CONTENTS $ENV{${LD_LIBRARY_PATH_VAR}} ) +#MESSAGE( STATUS "LD_LIBRARY_PATH_CONTENTS: ${LD_LIBRARY_PATH_CONTENTS}" ) + +SET( ROOT_CINT_WRAPPER ${LD_LIBRARY_PATH_VAR}=${ROOT_LIBRARY_DIR}:${LD_LIBRARY_PATH_CONTENTS} ${ROOT_CINT_EXECUTABLE} ) + +IF( NOT DEFINED ROOT_DICT_OUTPUT_DIR ) + SET( ROOT_DICT_OUTPUT_DIR "${PROJECT_BINARY_DIR}/rootdict" ) +ENDIF() + +# clean generated header files with 'make clean' +SET_DIRECTORY_PROPERTIES( PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${ROOT_DICT_OUTPUT_DIR}" ) + +IF( NOT ROOT_FIND_QUIETLY ) + MESSAGE( STATUS "Check for ROOT_DICT_OUTPUT_DIR: ${PROJECT_BINARY_DIR}/rootdict" ) + MESSAGE( STATUS "Check for ROOT_DICT_CINT_DEFINITIONS: ${ROOT_DICT_CINT_DEFINITIONS}" ) +ENDIF() + + +# ============================================================================ +# helper macro to prepare input headers for GEN_ROOT_DICT_SOURCES +# sorts LinkDef.h to be the last header (required by rootcint) +# +# arguments: +# input_dir - directory to search for headers matching *.h +# +# returns: +# ROOT_DICT_INPUT_HEADERS - all header files found in input_dir with +# LinkDef.h as the last header (if found) +# +# ---------------------------------------------------------------------------- +MACRO( PREPARE_ROOT_DICT_HEADERS _input_dir ) + + FILE( GLOB ROOT_DICT_INPUT_HEADERS "${_input_dir}/*.h" ) + FILE( GLOB _linkdef_hdr "${_input_dir}/LinkDef.h" ) + + #LIST( FIND ROOT_DICT_INPUT_HEADERS ${_linkdef_hdr} _aux ) + #IF( ${_aux} EQUAL 0 OR ${_aux} GREATER 0 ) + # LIST( REMOVE_ITEM ROOT_DICT_INPUT_HEADERS "${_linkdef_hdr}" ) + # LIST( APPEND ROOT_DICT_INPUT_HEADERS "${_linkdef_hdr}" ) + #ENDIF() + + IF( _linkdef_hdr ) + LIST( REMOVE_ITEM ROOT_DICT_INPUT_HEADERS "${_linkdef_hdr}" ) + LIST( APPEND ROOT_DICT_INPUT_HEADERS "${_linkdef_hdr}") + ENDIF() + + #MESSAGE( STATUS "ROOT_DICT_INPUT_HEADERS: ${ROOT_DICT_INPUT_HEADERS}" ) + +ENDMACRO( PREPARE_ROOT_DICT_HEADERS ) + + + +# ============================================================================ +# helper macro to generate Linkdef.h files for rootcint +# +# arguments: +# namespace - prefix used for creating header _Linkdef.h +# ARGN - list of sources to be used for generating Linkdef.h +# +# returns: +# ROOT_DICT_INPUT_HEADERS - all header files + _LinkDef.h in the +# correct order to be used by macro GEN_ROOT_DICT_SOURCES +# +# ---------------------------------------------------------------------------- +MACRO( GEN_ROOT_DICT_LINKDEF_HEADER _namespace ) + + SET( _input_headers ${ARGN} ) + SET( _linkdef_header "${ROOT_DICT_OUTPUT_DIR}/${_namespace}_Linkdef.h" ) + + FOREACH( _header ${_input_headers} ) + #FILE( APPEND "${_linkdef_header}" "#pragma link C++ defined_in \"${_header}\";\n" ) + #SET( ${_namespace}_file_contents "${${_namespace}_file_contents} #pragma link C++ defined_in \\\"${_header}\\\"\\;\\\\n" ) + SET( ${_namespace}_file_contents "${${_namespace}_file_contents} #pragma link C++ defined_in \\\"${_header}\\\"\\;" ) + ENDFOREACH() + + ADD_CUSTOM_COMMAND( + OUTPUT ${_linkdef_header} + COMMAND mkdir -p ${ROOT_DICT_OUTPUT_DIR} + COMMAND echo "${${_namespace}_file_contents}" > ${_linkdef_header} + DEPENDS ${_input_headers} + COMMENT "generating: ${_linkdef_header}" + ) + + SET( ROOT_DICT_INPUT_HEADERS ${_input_headers} ${_linkdef_header} ) + +ENDMACRO() + + +# ============================================================================ +# macro for generating root dict sources with rootcint +# +# arguments: +# dict_src_filename - filename of the dictionary source (to be generated) +# +# requires following variables: +# ROOT_DICT_INPUT_HEADERS - list of headers needed to generate dict source +# * if LinkDef.h is in the list it must be at the end !! +# ROOT_DICT_INCLUDE_DIRS - list of include dirs to pass to rootcint -I.. +# ROOT_DICT_CINT_DEFINITIONS - extra definitions to pass to rootcint +# ROOT_DICT_OUTPUT_DIR - where dictionary source should be generated +# +# returns: +# ROOT_DICT_OUTPUT_SOURCES - list containing generated source and other +# previously generated sources + +# ---------------------------------------------------------------------------- +MACRO( GEN_ROOT_DICT_SOURCE _dict_src_filename ) + + # TODO check for ROOT_CINT_EXECUTABLE + + # need to prefix all include dirs with -I + set( _dict_includes ) + FOREACH( _inc ${ROOT_DICT_INCLUDE_DIRS} ) + SET( _dict_includes "${_dict_includes}\t-I${_inc}") #fg: the \t fixes a wired string expansion + #SET( _dict_includes ${_dict_includes} -I${_inc} ) + ENDFOREACH() + + STRING( REPLACE "/" "_" _dict_src_filename_nosc ${_dict_src_filename} ) + SET( _dict_src_file ${ROOT_DICT_OUTPUT_DIR}/${_dict_src_filename_nosc} ) + STRING( REGEX REPLACE "^(.*)\\.(.*)$" "\\1.h" _dict_hdr_file "${_dict_src_file}" ) + ADD_CUSTOM_COMMAND( + OUTPUT ${_dict_src_file} ${_dict_hdr_file} + COMMAND mkdir -p ${ROOT_DICT_OUTPUT_DIR} + COMMAND ${ROOT_CINT_WRAPPER} -f "${_dict_src_file}" -c -p ${ROOT_DICT_CINT_DEFINITIONS} ${_dict_includes} ${ROOT_DICT_INPUT_HEADERS} + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + DEPENDS ${ROOT_DICT_INPUT_HEADERS} + COMMENT "generating: ${_dict_src_file} ${_dict_hdr_file}" + ) + LIST( APPEND ROOT_DICT_OUTPUT_SOURCES ${_dict_src_file} ) + +ENDMACRO() + +# for backwards compatibility +MACRO( GEN_ROOT_DICT_SOURCES _dict_src_filename ) + MESSAGE( "USING DEPRECATED GEN_ROOT_DICT_SOURCES. PLEASE USE GEN_ROOT_DICT_SOURCE instead." ) + SET( ROOT_DICT_OUTPUT_SOURCES ) + GEN_ROOT_DICT_SOURCE( ${_dict_src_filename} ) +ENDMACRO() +# ============================================================================ + + diff --git a/cmake/Modules/README.md b/cmake/Modules/README.md new file mode 100644 index 0000000..cae8abf --- /dev/null +++ b/cmake/Modules/README.md @@ -0,0 +1,3 @@ +Additional modules taken from +http://ilcsoft.desy.de/eUtil/current/cmake4hep +https://svnsrv.desy.de/viewvc/aidasoft/cmake4hep/trunk/ diff --git a/include/RooUnfold_LinkDef.h b/include/RooUnfold_LinkDef.h index f50489e..e5b740e 100644 --- a/include/RooUnfold_LinkDef.h +++ b/include/RooUnfold_LinkDef.h @@ -15,8 +15,6 @@ #pragma link C++ class RooUnfoldParms+; #pragma link C++ class RooUnfoldInvert+; #pragma link C++ class RooUnfoldTUnfold+; -#ifdef HAVE_DAGOSTINI #pragma link C++ class RooUnfoldDagostini+; -#endif #endif diff --git a/test/simpletest.cpp b/test/simpletest.cpp new file mode 100755 index 0000000..ae29869 --- /dev/null +++ b/test/simpletest.cpp @@ -0,0 +1,11 @@ +#define BOOST_TEST_MODULE SimpleTest +#include +int add(int i, int j) { + return i + j; +} + +BOOST_AUTO_TEST_SUITE(SimpleTest) +BOOST_AUTO_TEST_CASE( one_and_one ) { + BOOST_REQUIRE(add(1, 1) == 2); +} +BOOST_AUTO_TEST_SUITE_END( ) From 1d7ed25b65f29f8305470a8d7fc769dbfdb84687 Mon Sep 17 00:00:00 2001 From: kreczko Date: Wed, 4 Feb 2015 15:47:39 +0000 Subject: [PATCH 3/3] moved Dagostini implementation to examples --- {src => examples}/RooUnfoldDagostini.cxx | 2 +- {include => examples}/RooUnfoldDagostini.h | 0 include/RooUnfold_LinkDef.h | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename {src => examples}/RooUnfoldDagostini.cxx (99%) rename {include => examples}/RooUnfoldDagostini.h (100%) diff --git a/src/RooUnfoldDagostini.cxx b/examples/RooUnfoldDagostini.cxx similarity index 99% rename from src/RooUnfoldDagostini.cxx rename to examples/RooUnfoldDagostini.cxx index 0ac3ce4..59ad432 100644 --- a/src/RooUnfoldDagostini.cxx +++ b/examples/RooUnfoldDagostini.cxx @@ -20,7 +20,7 @@ END_HTML */ ///////////////////////////////////////////////////////////// -#include "../include/RooUnfoldDagostini.h" +#include "RooUnfoldDagostini.h" #include diff --git a/include/RooUnfoldDagostini.h b/examples/RooUnfoldDagostini.h similarity index 100% rename from include/RooUnfoldDagostini.h rename to examples/RooUnfoldDagostini.h diff --git a/include/RooUnfold_LinkDef.h b/include/RooUnfold_LinkDef.h index e5b740e..97bc25c 100644 --- a/include/RooUnfold_LinkDef.h +++ b/include/RooUnfold_LinkDef.h @@ -15,6 +15,6 @@ #pragma link C++ class RooUnfoldParms+; #pragma link C++ class RooUnfoldInvert+; #pragma link C++ class RooUnfoldTUnfold+; -#pragma link C++ class RooUnfoldDagostini+; +//#pragma link C++ class RooUnfoldDagostini+; #endif