// Author: Andrew M. Rogers <mailto, NSCL 08/01/2008
//* Copyright (C) 2006-2008 Andrew M. Rogers

#include <math.h>

#include "TNucleus.h"

#include <TH1D.h>


ClassImp(TNucleus);

//////////////////////////////////////////////////////////////////////////
/* BEGIN_HTML
   <p>
   An object to hold nuclear data.
   </p>
   END_HTML */
//////////////////////////////////////////////////////////////////////////


const Char_t *kElements[119] = {"n" ,"H" ,"He","Li","Be","B" ,"C" ,"N" ,"O" ,"F" ,
				"Ne","Na","Mg","Al","Si","P" ,"S" ,"Cl","Ar","K" ,
				"Ca","Sc","Ti","V" ,"Cr","Mn","Fe","Co","Ni","Cu",
				"Zn","Ga","Ge","As","Se","Br","Kr","Rb","Sr","Y" ,
				"Zr","Nb","Mo","Tc","Ru","Rh","Pd","Ag","Cd","In",
				"Sn","Sb","Te","I" ,"Xe","Cs","Ba","La","Ce","Pr",
				"Nd","Pm","Sm","Eu","Gd","Tb","Dy","Ho","Er","Tm",
				"Yb","Lu","Hf","Ta","W" ,"Re","Os","Ir","Pt","Au",
				"Hg","Tl","Pb","Bi","Po","At","Rn","Fr","Ra","Ac",
				"Th","Pa","U" ,"Np","Pu","Am","Cm","Bk","Cf","Es",
				"Fm","Md","No","Lr","Rf","Db","Sg","Bh","Hs","Mt",
				"Ea","Eb","Ec","Ed","Ee","Ef","Eg","Eh","Ei"};

//______________________________________________________________________________
TNucleus::TNucleus(Int_t Z, Int_t A)
{
  // -- Default Constuctor.

  fSep  = new THashList();
  fQVal = new THashList();

  Clear();
  if(Z>-1 && Z<120){
    fZ  = Z;
    fA  = A;
    fN  = A-Z;
    fNZ = fN-Z;
    fElement = (Char_t*)kElements[Z];
    Char_t title[50];
    sprintf(title,"%i%s",A,fElement);
    SetNameTitle("ntemp",title);
  }else{
    printf("ERROR:  Z is not known.\n");
  }  
}


//______________________________________________________________________________
TNucleus::TNucleus(const char *name, const char *title, Int_t Z, Int_t A)
{
  // -- Constuctor.

  fSep  = new THashList();
  fQVal = new THashList();

  Clear();
  if(Z>-1 && Z<120){
    fZ  = Z;
    fA  = A;
    fN  = A-Z;
    fNZ = fN-Z;
    fElement = (Char_t*)kElements[Z];
    SetNameTitle(name,title);
  }else{
    printf("ERROR:  Z is not known.\n");
  }
  
}


//______________________________________________________________________________
TNucleus::TNucleus(const TNucleus &nuc) : TNamed(nuc)
{
  // -- Copy constructor.

  ((TNucleus&)nuc).Copy(*this);
 
}


//______________________________________________________________________________
void TNucleus::Copy(TObject &nuc)const
{
  // --
  //
  
  ((TNucleus&)nuc).fNZ         = fNZ;
  ((TNucleus&)nuc).fN          = fN;
  ((TNucleus&)nuc).fA          = fA;    
  ((TNucleus&)nuc).fElement    = fElement;
  ((TNucleus&)nuc).fMassEx     = fMassEx;
  ((TNucleus&)nuc).fMassExUnc  = fMassExUnc;
  ((TNucleus&)nuc).fBE         = fBE;
  ((TNucleus&)nuc).fBEUnc      = fBEUnc;
  ((TNucleus&)nuc).fBetaDE     = fBetaDE;
  ((TNucleus&)nuc).fBetaDEUnc  = fBetaDEUnc;
  ((TNucleus&)nuc).fAMass      = fAMass;
  ((TNucleus&)nuc).fAMassUnc   = fAMassUnc;

  //  fSep.Copy(((TNucleus&)nuc).fSep);
  //  fQVal.Copy(((TNucleus&)nuc).fQVal);

}


//______________________________________________________________________________
Double_t TNucleus::GetSepE(Char_t *type)
{
  // -- Get the seperation energy for the given removal type.
  // Valid removal types are: n, p, 2n, 2p

  TH1D *htmp = (TH1D*)fSep->FindObject(type);
  if(htmp==0) {printf("ERROR:  Cannot get separation energy. Invalid type %s.\n",type); return sqrt(-1.0);}
  return htmp->GetBinContent(0);
}


//______________________________________________________________________________
Double_t TNucleus::GetSepEUnc(Char_t *type)
{
  // -- Get the seperation energy for the given removal type.
  // Valid removal types are: "n", "p", "2n", "2p"

  TH1D *htmp = (TH1D*)fSep->FindObject(type);
  if(htmp==0) {printf("ERROR:  Cannot get separation energy uncertainty. Invalid type %s.\n",type); return sqrt(-1.0);}
  return htmp->GetBinContent(1);
}


//______________________________________________________________________________
Double_t TNucleus::GetQVal(Char_t *type)
{
  // -- Get the Q-value for the given reaction type.
  // Valid reaction types are: "a", "2B-", "ep", "B- n", "4B-", "d,a", "p,a", "n,a" 

  TH1D *htmp = (TH1D*)fQVal->FindObject(type);
  if(htmp==0) {printf("ERROR:  Cannot get Q-value. Invalid type %s.\n",type); return sqrt(-1.0);}
  return htmp->GetBinContent(0);
}


//______________________________________________________________________________
Double_t TNucleus::GetQValUnc(Char_t *type)
{
  // -- Get the Q-value uncertainty for the given reaction type.
  // Valid reaction types are: "a", "2B-", "ep", "B- n", "4B-", "d,a", "p,a", "n,a" 

  TH1D *htmp = (TH1D*)fQVal->FindObject(type);
  if(htmp==0) {printf("ERROR:  Cannot get Q-value uncertainty. Invalid type %s.\n",type); return sqrt(-1.0);}
  return htmp->GetBinContent(1);
}


//______________________________________________________________________________
void TNucleus::Print(Option_t *option)
{
  // -- Print nuclear data.

  if(strcmp(option,"NoHeader")!=0){
    printf("%4s %3s %3s %3s %4s %26s %21s %21s %24s\n",
	   "N-Z","N","Z","A","EL"," ------MASS EXCESS------ "," -BINDING ENERGY/A- ",
	   " -BETA-DECAY ENERGY- ","  -----ATOMIC MASS----- ");
    printf("%38s %24s %21s %26s \n","(keV)","(keV)","(keV)","(micro-u)");
  }
  printf("%4i %3i %3i %3i %4s %13.5lf %11.5lf %11.3lf %9.3lf %11.3lf %9.3lf %12.5lf %11.3lf\n",
	 fNZ,fN,fZ,fA,fElement,fMassEx,fMassExUnc,fBE,fBEUnc,fBetaDE,fBetaDEUnc,fAMass,fAMassUnc);
  
}


//______________________________________________________________________________
void TNucleus::Clear(Option_t *option)
{
  // --
  
  Int_t    valI = -99;
  Double_t valD = sqrt(-1.0);
  fNZ        = valI;
  fN         = valI;
  fZ         = valI;
  fA         = valI;
  fElement   = "NONE";
  fMassEx    = valD;
  fMassExUnc = valD;
  fBE        = valD;
  fBEUnc     = valD;
  fBetaDE    = valD;
  fBetaDEUnc = valD;
  fAMass     = valD;
  fAMassUnc  = valD;
  
  fSep->Clear();
  fQVal->Clear();

}

Last change: Sun Dec 21 13:31:59 2008
Last generated: 2008-12-21 13:31

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.