[ROOT] What cause the root crash quietly?

From: Datao Gong (dtgong@physics.umn.edu)
Date: Fri Mar 07 2003 - 03:23:12 MET


Hi,Rooter,
I make 3 2D array to hold the event count which i get it from
a root file. But i found if i make the size of 2D array a little
bit large, for example 20X20. Root crash quietly. I use Root 3.03
on OSF1.

My code is as below, if necessary, i also can prove the root file, which
is a little bit  large, 400k byte

Thank you

Gong Datao

===========================================
//.x loadmass.C

//void test_ks_sen()
{
  Int_t i,j;
 TFile *f = new TFile("../mc/c3kskpmass2.root");
  TH2F *kssen,*mcs,*bkg;
  if(mcs = (TH2F*)(gROOT->FindObject("mcs")))delete mcs;
  if(bkg = (TH2F*)(gROOT->FindObject("bkg")))delete bkg;
  if(kssen = (TH2F*)(gROOT->FindObject("kssen")))delete kssen;

  Int_t times = 20;
  Float_t step = 0.5/times;
   Int_t mc[20][20],bk[20][20];
   Int_t b1,b2,sb,b,s;
   Int_t b_b1,b_b2,b_sb,b_b,b_s;
   char cut[100];

  mcs = new TH2F("mcs","MC etac signal events
number",times,0.1,0.6,times,0.1,0.6);
  bkg = new TH2F("bkg","Events number in sideband (from 2.6 to 2.8
Gev)",times,0.1,0.6,times,0.1,0.6);
  kssen = new TH2F("kssen","Pt cut signal
sensitivity",times,0.1,0.6,times,0.1,0.6);

   cout<<"MC...."<<endl;
   for(i = 0;i<times;++i){
    Float_t th1 = i*step+0.1;
      for(j=0;j<times;++j){
       Float_t th2 = j*step+0.1;

sprintf(cut,"Evis<6&&Ksfltch2>0.5&&Ksspt2ch>-0.5&&abs(Ksmass-0.497672)<0.010&&Ccen<%f&&Pt<%f",th1,th2);
       TCut ptcut(cut);
       sb = (kskp2->Query("Ksmass",ptcut))->GetRowCount();
       cout<<i<<" "<<j<<" "<<sb<<endl;
       mcs->SetBinContent(i+1,j+1,sb);
       mc[i][j]=sb;
      }
  }
  mcs->SetZTitle("MC Signal Count");
  mcs->SetYTitle("Pt cut threshold");
  mcs->SetXTitle("Ccen cut threshold");
  mcs->Draw("Lego");
  c1->SetGrid();

  cout<<"Bkg...."<<endl;
  TFile *f2 = new TFile("c3kskpmass.root");
   for(i = 0;i<times;i++){
       Float_t th1 = i*step+0.1;
      for(j=0;j<times;++j){
       Float_t th2 = j*step+0.1;

sprintf(cut,"Evis<6&&Ksfltch2>0.5&&Ksspt2ch>-0.5&&((Mass>2.6&&Mass<2.8))&&abs(Ksmass-0.497672)<0.010&&Ccen<%f&&Pt<%f",th1,th2);
       TCut ptcut2(cut);
      sb = (kskp->Query("Ksmass",ptcut2))->GetRowCount();
      cout<<i<<" "<<j<<" "<<sb<<endl;
      bkg->SetBinContent(i+1,j+1,sb);
      bk[i][j]=sb;
     }
  }

  bkg->SetZTitle("Background events");
  bkg->SetYTitle("Pt cut threshold");
  bkg->SetXTitle("Ccen cut threshold");
  bkg->Draw("Lego");
  c1->SetGrid();

  for(i = 0; i<times; i++){
      for(j=0;j<times;++j){

        Float_t sen = mc[i][j]*mc[i][j]*1.0/bk[i][j];
        kssen->SetBinContent(i+1,j+1,sen);
      }
  }
  kssen->SetZTitle("S^2/B");
  kssen->SetYTitle("Pt cut threshold");
  kssen->SetXTitle("Cc cut threshold");
  kssen->Draw("Lego");

}



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