Locked History Actions

attachment:MakeKTUY05RootFile.C of 核図表

Attachment 'MakeKTUY05RootFile.C'

Download

#include <cstdio>
#include <cstring>
#include <iostream>
#include "TFile.h"
#include "TTree.h"

using namespace std;

Int_t MakeKTUYRootFile(){
  FILE  *fp   = fopen("./KTUY05_m246.dat","r");
  TFile *f    = new TFile("./KTUY05_m246.root","RECREATE");
  TTree *tree = new TTree("KTUY05_m246","KTUY05_m246 data from ascii file");

  char line[46];

  struct DataOfKTUY05_t {
    Int_t ZZ, NN, AA;
    Float_t Mcal, Esh, alpha2, alpha4, alpha6, Sn, S2n, Sp, S2p;
    Int_t  bSn, bS2n, bSp, bS2p, bBound, bExst;
    DataOfKTUY05_t () : ZZ(), NN(), AA(), Mcal(), Esh(),
      alpha2(), alpha4(), alpha6(), Sn(), S2n(), Sp(), S2p(), 
      bSn(), bS2n(), bSp(), bS2p(), bBound(), bExst() {}
  };
  DataOfKTUY05_t ktuydata[131][201], ktuydata_r, ktuydata_w;
  
  tree->Branch("KTUY05",&ktuydata_w.ZZ,"ZZ/I:NN:AA:Mcal/F:Esh:alpha2:alpha4:alpha6:Sn:S2n:Sp:S2p:bSn/I:bS2n:bSp:bS2p:bBound:bExst");
  fgets(&line,46,fp);
  while (fgets(&line,46,fp)) {
    sscanf(&line[0],"%d%d%f%f%f%f%f",
           &ktuydata_r.ZZ,
           &ktuydata_r.NN,
           &ktuydata_r.Mcal,
           &ktuydata_r.Esh,
           &ktuydata_r.alpha2,
           &ktuydata_r.alpha4,
           &ktuydata_r.alpha6);
    ktuydata_r.bExst = 1;
    ktuydata_r.AA = ktuydata_r.ZZ + ktuydata_r.NN;
    ktuydata[ktuydata_r.ZZ][ktuydata_r.NN] = ktuydata_r;
  }

  for (Int_t i=2; i <= 130; i++) {
    for (Int_t j=2; j <= 200; j++) {
      if (ktuydata[i][j-1].bExst & ktuydata[i][j].bExst) {
        ktuydata[i][j].bSn = 1;
        ktuydata[i][j].Sn  = ktuydata[i][j-1].Mcal - ktuydata[i][j].Mcal + 8.071;
      }
      if (ktuydata[i-1][j].bExst & ktuydata[i][j].bExst) {
        ktuydata[i][j].bSp = 1;
        ktuydata[i][j].Sp  = ktuydata[i-1][j].Mcal - ktuydata[i][j].Mcal + 7.289;
      }
      if (ktuydata[i][j-2].bExst & ktuydata[i][j].bExst) {
        ktuydata[i][j].bS2n = 1;
        ktuydata[i][j].S2n  = ktuydata[i][j-2].Mcal - ktuydata[i][j].Mcal + 2.* 8.071;
      }
      if (ktuydata[i-2][j].bExst & ktuydata[i][j].bExst) {
        ktuydata[i][j].bS2p = 1;
        ktuydata[i][j].S2p  = ktuydata[i-2][j].Mcal - ktuydata[i][j].Mcal + 2.* 7.289;
      }
      if (( ktuydata[i][j].bSn  & ( ktuydata[i][j].Sn  <= 0.0)) ||
          ( ktuydata[i][j].bSp  & ( ktuydata[i][j].Sp  <= 0.0)) ||
          ( ktuydata[i][j].bS2n & ( ktuydata[i][j].S2n <= 0.0)) ||
          ( ktuydata[i][j].bS2p & ( ktuydata[i][j].S2p <= 0.0))) {
        ktuydata[i][j].bBound = 0;
      }else{
        if ( ktuydata[i][j].bSn  ||
             ktuydata[i][j].bSp  ||
             ktuydata[i][j].bS2n ||
             ktuydata[i][j].bS2p ) {
          ktuydata[i][j].bBound = 1;
        }else{
          ktuydata[i][j].bBound = 0;
        }
      }
    }
  }

//  for (Int_t i=1; i <= 130; i++) {
//    for (Int_t j=1; j <= 200; j++) {
//      cout << i << " " <<  j << " "
//         << ktuydata[i][j].Mcal << " " 
//         << ktuydata[i][j].Sn << " "
//         << ktuydata[i][j].Sp << " "
//         << ktuydata[i][j].S2n << " "
//         << ktuydata[i][j].S2p << " "
//         << ktuydata[i][j].bBound << " " << endl;
//    }
//  }
  
  ktuydata[75][188].bBound = 0;

  for (Int_t i=1; i <= 130; i++) {
    for (Int_t j=1; j <= 200; j++) {
      if (ktuydata[i][j].bExst) {
        ktuydata_w = ktuydata[i][j];
        tree->Fill();
      }
    }
  }
  
  tree->Print();
  fclose(fp);
  f->Write();

  delete tree;
  delete f;
  return 0;
}

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2011-08-15 12:31:59, 11.7 KB) [[attachment:DrawKTUY05DripLine.C]]
  • [get | view] (2011-08-15 12:30:05, 4.2 KB) [[attachment:DrawStableNuclei.C]]
  • [get | view] (2011-08-15 10:52:12, 0.4 KB) [[attachment:Ini.C]]
  • [get | view] (2011-08-15 11:22:39, 423.9 KB) [[attachment:KTUY05_m246.dat]]
  • [get | view] (2011-08-15 11:21:45, 13.3 KB) [[attachment:KTUY05_m246.png]]
  • [get | view] (2011-08-15 11:19:56, 325.8 KB) [[attachment:KTUY05_m246.root]]
  • [get | view] (2011-08-15 12:44:15, 14.4 KB) [[attachment:KTUY_stable.png]]
  • [get | view] (2011-08-15 12:44:47, 9.9 KB) [[attachment:KTUYdl_stable.png]]
  • [get | view] (2011-08-15 11:40:48, 37.7 KB) [[attachment:LiseMassExcess.png]]
  • [get | view] (2011-08-15 11:55:08, 14.6 KB) [[attachment:LiseMassExcessType.png]]
  • [get | view] (2011-08-15 11:19:33, 3.1 KB) [[attachment:MakeKTUY05RootFile.C]]
  • [get | view] (2011-08-15 10:53:14, 1.2 KB) [[attachment:MakeStableNucleiRootFile.C]]
  • [get | view] (2011-08-11 17:37:50, 25.6 KB) [[attachment:NuclearWalletCardsSearch_GetStableNuclei.png]]
  • [get | view] (2011-09-03 04:16:45, 1.2 KB) [[attachment:PlotKTUY.C]]
  • [get | view] (2011-08-15 10:53:26, 0.5 KB) [[attachment:PlotStable.C]]
  • [get | view] (2011-08-15 10:49:44, 8.6 KB) [[attachment:StableNuclei.png]]
  • [get | view] (2011-08-15 10:53:40, 6.0 KB) [[attachment:StableNuclei.root]]
  • [get | view] (2011-08-11 17:50:57, 36.5 KB) [[attachment:StableNuclei.txt]]
  • [get | view] (2013-11-01 17:25:58, 15.2 KB) [[attachment:evenz_oddn_jpi.dat]]
  • [get | view] (2013-11-01 08:50:14, 12.0 KB) [[attachment:first2plus.dat]]
  • [get | view] (2013-11-01 09:06:27, 43.2 KB) [[attachment:first2plus_ss.png]]
  • [get | view] (2013-11-01 17:25:07, 14.7 KB) [[attachment:oddz_evenn_jpi.dat]]
  • [get | view] (2013-11-01 17:26:05, 2.0 KB) [[attachment:plot_evenz_oddn_jpi.C]]
  • [get | view] (2013-11-01 17:26:10, 11.9 KB) [[attachment:plot_evenz_oddn_jpi.png]]
  • [get | view] (2013-11-01 08:49:50, 1.5 KB) [[attachment:plot_first2plus.C]]
  • [get | view] (2013-11-01 08:50:03, 11.5 KB) [[attachment:plot_first2plus.png]]
  • [get | view] (2013-11-01 17:25:18, 2.0 KB) [[attachment:plot_oddz_evenn_jpi.C]]
  • [get | view] (2013-11-01 17:25:23, 11.8 KB) [[attachment:plot_oddz_evenn_jpi.png]]

You are not allowed to attach a file to this page.