Message: Problem with Physics Interface (PI)? Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question Problem with Physics Interface (PI)? 

Keywords: PI AIDA-compatible
Forum: Analysis
Date: 08 Mar, 2007
From: Shahrokh <Shahrokh>

Hello friends;

I am trying to use Physics Interface (PiUltraLite-1.3.12) to analysis in
my application. At first, I decide to learn PI as much as possible, and
then I implement my application using with PI. 
To learn PI, I implement a running code that write out a file with xml 
format. This file includes N-tuple and some histograms. 
N-tuple is filled with random numbers and then the histograms are 
drawn using with N-tuple. It is compiled and run finely and created 
a file with the name of Gaussian.aida. This file is opened by jas3. 
For this purpose, I use packages as follows:

JAIDA-3.2.4
Jas3-0.8.2
AIDAJNI-3.2.3
Jdk-1_5_0

The file (gausAidaWrite.cc), that I compile and run, follows:

#include <iostream.h>
#include <cmath>

#include "AIDA/AIDA.h"

using namespace AIDA;

//prototype randgauss()
double randgauss(double, double, double, double);

//define randgauss()
double randgauss( double min, double max, double sigma, double center)
{
  double random= (min+ (max-min)*(double)rand()/RAND_MAX);

  double tmp=(random-center)/sigma;
  double gauss=std::exp(-tmp*tmp/2);
  return gauss;
}


int main()
{
	IAnalysisFactory *analysisFactory = AIDA_createAnalysisFactory();

	ITreeFactory *treeFactory = analysisFactory->createTreeFactory();

	ITree *tree = treeFactory->create("gaussian.aida", "xml", false, true);

	tree->mkdir("/tuples");
	tree->cd("/tuples");
	cout<<"path at now:"<<tree->pwd()<<endl;

//tuples
	ITupleFactory* tupleFactory = analysisFactory->createTupleFactory(*tree);

	ITuple* tuple = tupleFactory->create("tuplePhoton", "the characteristics of photons ", "double r1,  r2,  r3");


	for(int i=0; i<24; i++)
	{
		double r1=0.;
		double r2=0.;
		double r3=0.;
		double min=0., max=1.0, sigma=1.0, center=0.;
		r1=randgauss(min, max, sigma, center);
		r2=randgauss(min, max, sigma, center)+10;
		r3=randgauss(min, max, sigma, center)+100;
		tuple->fill(0,r1);
		tuple->fill(1,r2);
		tuple->fill(2,r3);
		tuple->addRow();
	}

	//read column 2 from tuple
	tuple->start();
	while(tuple->next())
	{
	   cout<<tuple->getDouble(2)<<endl;
      	}

	//histograms
	tree->mkdir("/histograms");
	tree->cd("/histograms");

	int Col1=tuple->findColumn("r1");
	int Col2=tuple->findColumn("r2");
	int Col3=tuple->findColumn("r3");

        IHistogramFactory *histoFactory = analysisFactory->createHistogramFactory(*tree);

        IHistogram1D* histo1DCol1 = histoFactory->createHistogram1D("test 1d","Some random distribution", 10000, tuple->columnMin(Col1),tuple->columnMax(Col1));
        IHistogram1D* histo1DCol2 = histoFactory->createHistogram1D("test 2d","Some random distribution", 10000, tuple->columnMin(Col2),tuple->columnMax(Col2));
        IHistogram1D* histo1DCol3 = histoFactory->createHistogram1D("test 3d","Some random distribution", 10000, tuple->columnMin(Col3),tuple->columnMax(Col3));

        tuple->start();
	while(tuple->next())
	{
	   histo1DCol1->fill(tuple->getDouble(Col1));
           histo1DCol2->fill(tuple->getDouble(Col2));
           histo1DCol3->fill(tuple->getDouble(Col3));
	}

        tree->commit();
	tree->close();

	delete analysisFactory;


	return 0;
}

As mentioned above, this code is run finely using with AIDAJNI and JAIDA. 
Nevertheless, when I run this code after doing the following commands, 
I get “segmentation fault” message. I compile this code finely and do not 
indicate that anything is wrong. 
My operating system is Scientific Linux 3.0.7 (Linux 2.4.21-40.EL i686 i686 i386 GNU/Linux).

[shahrokh@ws1 shahrokh]$ echo $HOME
/home/shahrokh
[shahrokh@ws1 shahrokh]$ mkdir $HOME/PiUltraLite-1.3.12
[shahrokh@ws1 shahrokh]$ cd ./PiUltraLite-1.3.12/
[shahrokh@ws1 PiUltraLite-1.3.12]$ tar zxf pi-1.3.12-UltraLite+HBook-slc3_ia32_gcc323.tgz
[shahrokh@ws1 PiUltraLite-1.3.12]$ cd /home/shahrokh/Desktop/EmailForPI/
[shahrokh@ws1 EmailForPI]$ g++ -c gausAidaWrite.cc -I${HOME}/PiUltraLite-1.3.12/include -Wno-deprecated
[shahrokh@ws1 EmailForPI]$ g++ -o gausAidaWrite gausAidaWrite.o -L${HOME}/PiUltraLite-1.3.12/lib   -llcg_AIDA_AnalysisFactory   -llcg_PluginManager   -llcg_SealBase   -llcg_AIDA_Plugin
[shahrokh@ws1 EmailForPI]$ export LD_LIBRARY_PATH=${HOME}/PiUltraLite-1.3.12/lib
[shahrokh@ws1 EmailForPI]$ export SEAL_PLUGINS=${HOME}/PiUltraLite-1.3.12/lib/modules
[shahrokh@ws1 EmailForPI]$ export PI_DIR=/home/shahrokh/PiUltraLite-1.3.12
[shahrokh@ws1 EmailForPI]$ export PYTHONPATH=/home/shahrokh/PiUltraLite-1.3.12/python/
[shahrokh@ws1 EmailForPI]$ ./gausAidaWrite
path at now:/tuples/
100.736
100.981
100.962
100.821
100.635
100.773
101
100.724
100.992
100.976
100.829
100.872
100.958
100.744
100.961
100.656
100.871
100.803
100.998
100.998
100.666
100.864
100.877
100.999
[shahrokh@ws1 EmailForPI]$ ./gausAidaWrite
Segmentation fault
[shahrokh@ws1 EmailForPI]$



As you see, at first time my executable code is run finely. 
Afterward I get “segmentation fault” message at all.  
In addition, when I debug my code using with gdb, I get the following result:

[shahrokh@ws1 EmailForPI]$ gdb gausAidaWrite
GNU gdb Red Hat Linux (6.3.0.0-1.90rh)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"...(no debugging symbols found)
Using host libthread_db library "/lib/tls/libthread_db.so.1".

(gdb) run
Starting program: /home/shahrokh/Desktop/EmailForPI/gausAidaWrite
[Thread debugging using libthread_db enabled]
[New Thread -1218554560 (LWP 22106)]
path at now:/tuples/


Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1218554560 (LWP 22106)]
0x00df0f69 in pi::AIDA_Tuple_native::CompiledExpressionManager::findIncludePaths ()
   from /home/shahrokh/PiUltraLite-1.3.12/lib/liblcg_AIDA_Tuple_native.so
Current language:  auto; currently c++
(gdb) quit
The program is running.  Exit anyway? (y or n) y
[shahrokh@ws1 EmailForPI]$

Is PI compatible with JAS and OpenScientist? If ok, why do I get this message?
I believe that I can compile my code with each of the AIDA-compliant packages 
without need to change my code; but I do not sure. Is this ok?
What is the problem? There is not any other indication of error so I do not know how to proceed.

Please help me.
Thanks a lot.
Shahrokh.

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

 Add Message Add Message
to: "Problem with Physics Interface (PI)?"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]