Thank you Pasha,
I think it may be the best way, BUT if I do so, everything
is working FINE. I want to understand why in CINT session script isn't
interpreted well.
Best regards,
Stanislav
On Fri, 2 Aug 2002, Pasha Murat (630)840-8237@169G wrote:
> Stanislav: try to compile your code using ROOT script compiler and
> debug it with the symbolic debugger. This procedure normally
> takes less than 5 minutes and gives direct answer about what the
> problem is.
> -best, Pasha
>
> Stanislav NESTEROV wrote:
> >
> > Hi Rene,
> > I've try to run script that uses TLorentzVector and TVector3, and in
> > some very simple cases this script is aborted via segfault.
> >
> > This is it (at the end it crashes on tmp=vpk[0]+vpk[3])
> >
> > To run this script see
> > "/afs/cern.ch/user/n/nesterov/public/"
> > for neccessary files (pi_nodedx_all.root).
> > ----------------------------------------------------------------------
> > #define PIM 139.56995*1e-3
> > #define KM 493.677*1e-3
> > #define PZM 134.9764*1e-3
> > #define NTPNUM "h96"
> > void testLorentz(){
> > gSystem->Load("libPhysics.so");
> > Double_t M[4] = {KM,KM,KM,KM};
> > Double_t M1122[4] = {KM,KM,PIM,PIM};
> > TFile f("pi_nodedx_all.root");
> > TTree * tree = (TTree*)f.Get(NTPNUM);
> >
> > if (!tree) {cout <<"Bad luck"<<endl; return;}
> > Float_t ptpi[4],thtpi[4],phpi[4];
> > tree->SetBranchAddress("Ptpi",ptpi);
> > tree->SetBranchAddress("Phipi",phpi);
> > tree->SetBranchAddress("Thtpi",thtpi);
> > TVector3 p[4];
> > TLorentzVector v[4],g,vpk[4];
> > for (Int_t i=0;i<tree->GetEntries();i++)
> > {
> > if (i%1000 == 0 ) cout <<i<<endl;
> > tree->GetEntry(i);
> > for (Int_t j=0;j<4;j++) // Setting vectors;
> > {
> > p[j].SetPtThetaPhi(TMath::Abs(ptpi[j]),thtpi[j],phpi[j]);
> > v[j].SetVectM(p[j],M[j]);
> > }
> > g = v[0]+v[1]+v[2]+v[3];
> >
> > Float_t lb=g.M();
> > if ((lb<2.11)) {
> > TLorentzVector tmp; // Local declaration
> > for (Int_t j=0;j<4;j++) {
> > vpk[j].SetVectM(p[j],M1122[j]);
> > }
> > tmp = vpk[0]+vpk[3]; // Seg. fault!!!!!!!!!
> > cout<<"Success"<<endl;
> > }
> >
> > }
> > }
> > ---------------------------------------------------------
> >
> > 1) If I moved `tmp' declaration outside if(lb<2.11) scope, everything is
> > OK.
> >
> > 2) If I go into debug mode and jump onto local declaration -- everything
> > is OK
> >
> > 3) If I don't read tree values --- everything is OK.
> >
> > It's just mistics!!
> >
> > Best regards,
> > Stanislav.
>
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:03 MET