[ROOT] segmentation violation , Any idea?

From: Eduard De La Cruz Burelo (eduard@fnal.gov)
Date: Mon Mar 17 2003 - 12:54:13 MET


Hello

I have trying to figure out the problem but I have a few days working on 
it without find the problem. I have a macro ( Loop() )similar which is 
created by MakeClass(), but I have included a few structures, like these 
ones:

struct track_C {

   Double_t Par[5]; //Parameters
   Double_t EMatrix[5][5]; //Error's Matrix
   Double_t Chisq = 0; //X^2
   //int Nhits;
};
struct track_C_list {
   track_C trklist[300];
   int ntracks; // number of tracks
};

I also included in MyClass.C a script to fill this information:

track_C MyClass::FillTrack(TMBTrks* Trks)
{

     track_C trck;

     Double_t *trpars = 0;
     Double_t *trerrs = 0;

       trpars = Trks->trpars();
       trerrs = Trks->trerrs();

       trck.Par[0] = trpars[0];
       trck.Par[1] = trpars[1];
       trck.Par[2] = trpars[2];
       trck.Par[3] = trpars[3];
       trck.Par[4] = trpars[4];

       trck.EMatrix[0][0] = trerrs[0];
       trck.EMatrix[0][1] = trerrs[1];
       trck.EMatrix[0][2] = trerrs[2];
       trck.EMatrix[0][3] = trerrs[3];
       trck.EMatrix[0][4] = trerrs[4];
       trck.EMatrix[1][1] = trerrs[5];
       trck.EMatrix[1][2] = trerrs[6];
       trck.EMatrix[1][3] = trerrs[7];
       trck.EMatrix[1][4] = trerrs[8];
       trck.EMatrix[2][2] = trerrs[9];
       trck.EMatrix[2][3] = trerrs[10];
       trck.EMatrix[2][4] = trerrs[11];
       trck.EMatrix[3][3] = trerrs[12];
       trck.EMatrix[3][4] = trerrs[13];
       trck.EMatrix[4][4] = trerrs[14];


       trck.EMatrix[1][0] = trerrs[1];
       trck.EMatrix[2][0] = trerrs[2];
       trck.EMatrix[2][1] = trerrs[6];
       trck.EMatrix[3][0] = trerrs[3];
       trck.EMatrix[3][1] = trerrs[7];
       trck.EMatrix[3][2] = trerrs[10];
       trck.EMatrix[4][0] = trerrs[4];
       trck.EMatrix[4][1] = trerrs[8];
       trck.EMatrix[4][2] = trerrs[11];
       trck.EMatrix[4][3] = trerrs[13];

       trck.Chisq = Trks->getChi2Ndf();

     return trck;
}

if I do not use the function FillTrack, everything run fine, I can make 
histograms, fill root tuples, etc., but if I use this function, I get:

root [2] t.MyLoopMC();
  Number of events : 11000
Event: 1
  <------- New event --------->
  We have 4 muons
Starting loop 1 ...
Starting loop 2 ...
Starting loop 2 ...
Starting loop 2 ...
  Matching ...
  done
0 ---  5
Starting loop 1 ...
Starting loop 1 ...
Starting loop 2 ...
  Matching ...
  done
4 ---  5
  <------- Finishing New event --------->
Event 2
  <------- New event --------->
  We have 4 muons
Starting loop 1 ...
Starting loop 1 ...
Starting loop 1 ...
  <------- Finishing New event --------->

  *** Break *** segmentation violation
Root > Function MyLoopMC() busy flag cleared

As you can see I look for two muons and then I make a matching with MC, 
that work fine, but after the second event I get a segmentation 
violation and I can not find where is the problem because the event get 
the end, but the next one does not start, and there is nothing between them.

If anybody have an idea about what could be the problem please let me 
know. Any help is welcome.

Thanks a lot

Eduard

P.S.I am using Version 3.03/07



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:10 MET