I am new root user. I have created a small program . it is a Garfield ++ program but uses root also.
I am getting Error : segmentation fault. The actual error is big but last section looks like this.
The lines below might hint at the cause of the crash.
If they do not help you then please submit a bug report at
http://root.cern.ch/bugs. Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.
===========================================================
#5 0x00007f9398ca708e in std::_Rb_tree<char const*, std::pair<char const* const, std::set<int, std::less<int>, std::allocator<int> > >, std::_Select1st<std::pair<char const* const, std::set<int, std::less<int>, std::allocator<int> > > >, NameMap::G__charptr_less, std::allocator<std::pair<char const* const, std::set<int, std::less<int>, std::allocator<int> > > > >::find(char const* const&) () from /usr/lib/x86_64-linux-gnu/libCint.so.5.34
===========================================================
Segmentation fault (core dumped)
My program is as follows:
#include <iostream>
#include <fstream>
#include <cmath>
#include "/home/varun/softwares/garfield++/Include/GeometrySimple.hh"
#include "/home/varun/softwares/garfield++/Include/SolidTube.hh"
#include "/home/varun/softwares/garfield++/Include/ViewGeometry.hh"
#include "/home/varun/softwares/garfield++/Include/MediumMagboltz.hh"
using namespace Garfield;
int main( int argc, char* argv[]){
MediumGas* gas = new MediumGas();
gas->LoadGasFile("ar_93_co2_7.gas");
GeometrySimple* geo = new GeometrySimple();
double rMin = 0., rMax = 0.5, halfLength = 10.;
SolidTube* tube = new SolidTube(0., 0., 0., rMin, rMax, halfLength);
geo->AddSolid(tube,gas);
ViewGeometry* view = new ViewGeometry();
view->SetGeometry(geo);
view->Plot();
}
In your code, ROOT is used internally by the Garfield code. Your request should be addressed first to the Garfield support service, because they know how ROOT is used internally and may give hints or running examples.
As a first step, you should at least try to understand which line of your code gives the problem. And also post the complete error messages, as there may be other information meaningful to the persons giving support.
I have tried my best to understand the problem. But reading through the internet did not help.
I am new to c++. So i do not understand much of error in segmentation fault.
Here is my another program , and complete error msg. Program runs fine until it is asked to plot.
There is some issue with TeoGeoManager ( root class) and Viewcell ( Garfield ++ ) .
RandomEngineRoot:
Generator type: TRandom3
Seed: 2087288260
MediumGas::LoadGasFile:
Gas file could not be opened.
MediumGas::PrintGas:
Gas composition: Ar
Pressure: 760 Torr
Temperature: 293.15 K
Gas file:
Pressure: 760 Torr
Temperature: 293.15 K
Electric field range: 100 - 100000 V/cm in 19 steps.
Magnetic field: 0
Angle between E and B: 1.5708
Available electron transport data:
none
Available ion transport data:
none
GeometrySimple::PrintSolids:
1 solid
Index Type Medium
0 tube Ar
Info in <TGeoManager::TGeoManager>: Geometry ViewCellGeoManager, Cell Layout created
Info in <TGeoManager::SetTopVolume>: Top volume is World. Master volume is World
Info in <TGeoNavigator::BuildCache>: --- Maximum geometry depth set to 100
*** Break *** segmentation violation
===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
#0 0x00007f3c6b58eb4c in __libc_waitpid (pid=18044, stat_loc=stat_loc
entry=0x7fff533f6640, options=options
entry=0) at ../sysdeps/unix/sysv/linux/waitpid.c:31
#1 0x00007f3c6b5142e2 in do_system (line=<optimized out>) at ../sysdeps/posix/system.c:148
#2 0x00007f3c6d2e03a3 in TUnixSystem::StackTrace() () from /usr/lib/x86_64-linux-gnu/libCore.so
#3 0x00007f3c6d2e207c in TUnixSystem::DispatchSignals(ESignals) () from /usr/lib/x86_64-linux-gnu/libCore.so
#4 <signal handler called>
#5 0x0000000000456ebc in Garfield::ViewCell::Plot(bool) ()
#6 0x000000000045802c in Garfield::ViewCell::Plot3d() ()
#7 0x000000000040dddf in main ()
===========================================================
The lines below might hint at the cause of the crash.
If they do not help you then please submit a bug report at
[root.cern.ch/bugs](http://root.cern.ch/bugs). Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.
===========================================================
#5 0x0000000000456ebc in Garfield::ViewCell::Plot(bool) ()
#6 0x000000000045802c in Garfield::ViewCell::Plot3d() ()
#7 0x000000000040dddf in main ()
===========================================================
Segmentation fault (core dumped)
Hi,
usually a segmentation fault occurs when you try to access a region of memory in a not proper way; i.e., you declare an array with dimension 5 and try to access the 7th position.
I would suggest to put a lot of cout in your code, so you can find which method fails to execute.