Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions LTF/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ROOTINCLUDES=
ifdef WITH_ROOT
WITH_ROOT=-D__WITH_ROOT__
ROOTLIBS=$(shell root-config --libs)
ROOTINCLUDES=-I$(shell root-config --incdir)
ROOTINCLUDES=-I$(shell root-config --incdir) $(WITH_ROOT)
endif

# take eigen from local copy in 'Eigen_copy' or from
Expand All @@ -34,7 +34,9 @@ endif

###########################################################
# all
all: slib bin
all:
$(MAKE) slib
$(MAKE) bin


###########################################################
Expand All @@ -61,7 +63,7 @@ bin: $(programs)

$(programs): %: %.cxx
@mkdir -p bin
$(CXX) $< -o bin/$(notdir $@) -O0 -g -Wall -Wno-sign-compare -Wno-unused-variable -Wl,-rpath,$(PWD)/lib -std=gnu++17 -I. -I$(EIGEN_INCLUDE) $(ROOTINCLUDES) -Llib/ -lLTF -lstdc++ $(ROOTLIBS)
$(CXX) $< -o bin/$(notdir $@) -O0 -g -Wall -Wno-sign-compare -Wno-unused-variable -Wl,-rpath,$(PWD)/lib -std=gnu++17 -I. -I$(EIGEN_INCLUDE) $(ROOTINCLUDES) -Llib/ -lLTF -lstdc++ $(ROOTLIBS)


###########################################################
Expand Down
2 changes: 1 addition & 1 deletion LTF/example1_LTF_gaus.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

#include "LTF/LTF.h"
#include "LTF/LTF_ROOTTools.h"
#include <TSystem.h>

void PrintAsciiTable(const map<double,TH1D*>&, TH1D* data);

Expand All @@ -36,7 +37,6 @@ void PrintAsciiTable(const map<double,TH1D*>&, TH1D* data);
int example1_LTF_gaus() {
using namespace std;

gStyle->SetOptStat(0);
gSystem->Load("libLTF.so");
TH1D::AddDirectory(false);
TH1::SetDefaultSumw2(true);
Expand Down
2 changes: 1 addition & 1 deletion LTF/example2_LTF_gaus2D.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "LTF/LTF.h"
#include "LTF/LTF_ROOTTools.h"
#include <TH1D.h>
#include <TSystem.h>
#include <string>

using namespace std;
Expand All @@ -40,7 +41,6 @@ void PrintAsciiTable(const map<vector<double>,TH1D*>& templates, TH1D* data);
//! main
int example2_LTF_gaus2D() {

gStyle->SetOptStat(0);
gSystem->Load("libLTF.so");
TH1D::AddDirectory(false);
TH1::SetDefaultSumw2(true);
Expand Down
2 changes: 1 addition & 1 deletion LTF/example3_LTF_gaus_sigma.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#if defined __WITH_ROOT__ || defined __CLING__
#include "LTF/LTF.h"
#include "LTF/LTF_ROOTTools.h"
#include <TSystem.h>
#include <TH1D.h>
#include <string>

Expand All @@ -40,7 +41,6 @@ void PrintAsciiTable(const map<vector<double>,TH1D*>& templates, TH1D* data);
//! main
int example2_LTF_gaus_sigma() {

gStyle->SetOptStat(0);
gSystem->Load("libLTF.so");
TH1D::AddDirectory(false);
TH1::SetDefaultSumw2(true);
Expand Down
4 changes: 3 additions & 1 deletion LTF/src/LTF_ROOTTools.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ TH1D* LTF_ROOTTools::MakeHistogram(const Eigen::VectorXd& values, vector<double>
TH1D* hist = bins.empty() ?
new TH1D("hist","hist",values.size(),0,values.size() ) :
new TH1D("hist","hist",bins.size()-1, &bins[0]);
if ( bins.size() && values.size() != bins.size()-1 ) {cout<<"ERROR! binning and number of entries does not fit!"<<endl;exit(1);}
if ( bins.size() && int(values.size()+1) != int(bins.size()) ) {cout<<"ERROR! binning and number of entries does not fit!"<<endl;exit(1);}
for ( size_t i = 0 ;i<bins.size()-1; i++ ) {
hist->SetBinContent(i+1, values(i));
if ( V.size() ) {
Expand Down Expand Up @@ -512,6 +512,8 @@ void LTF_ROOTTools::plotLiTeFit(const LTF::LiTeFit& fit, const vector<double>& b
void LTF_ROOTTools::plotLiTeFit_2D(const LTF::LiTeFit& fit, const vector<double> bins )
{

gStyle->SetOptStat(0);
gSystem->mkdir("plots");
auto& M = fit.M;
if ( M.cols() != 3 ) {cout<<"Error! only 2-dim plotting implemented."<<endl;exit(1);}
Eigen::VectorXd reference_values1 = M.col(1);
Expand Down
10 changes: 5 additions & 5 deletions LTF/src/LTF_Tools.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,20 @@ std::vector<std::vector<double > > LTF_Tools::read_correlations(std::string file
//!
std::vector<std::vector<double > > LTF_Tools::corr_to_cov( const std::vector<std::vector<double > >& corr, const std::vector<double >& percenterr, const std::vector<double >& data) {
std::vector<double > err(data.size());
for ( int i = 0 ; i<err.size() ; i++ )
for ( size_t i = 0 ; i<err.size() ; i++ )
err[i] = percenterr[i]/100.*data[i];

std::vector<std::vector<double > > cov(err.size());
for ( int i = 0 ; i<err.size() ; i++ ) {
for ( size_t i = 0 ; i<err.size() ; i++ ) {
cov[i].resize(err.size());
for ( int j = 0 ; j<err.size() ; j++ ) {
for ( size_t j = 0 ; j<err.size() ; j++ ) {
cov[i][j] = corr[i][j]*err[i]*err[j];
//if ( corr[i][j] != 0 ) cout<<i<<", "<<j<<"\t"<<corr[i][j]<<"\t"<<percenterr[i]<<"\t"<<data[i]<<"\te: "<<err[i]<<"\tcov: "<<cov[i][j]<<endl;
}
}

for ( int i = 0 ; i<err.size() ; i++ ) {
for ( int j = 0 ; j<i ; j++ ) {
for ( size_t i = 0 ; i<err.size() ; i++ ) {
for ( size_t j = 0 ; j<i ; j++ ) {
if ( fabs((cov[i][j] / cov[j][i]-1.) > 1e-3) )
cout<<i<<", "<<j<<"\t"<<corr[i][j]<<"\t"<<percenterr[i]<<"\t"<<data[i]<<"\te: "<<err[i]<<"\tcov: "<<cov[i][j]<<"\t ratio ij/ji: "<<(cov[i][j] / cov[j][i]-1.)<<endl;
}
Expand Down