00001 // -*- C++ -*- $Id: PData.cxx,v 1.2 2000/01/17 23:37:31 burnett Exp $ 00002 // 00003 // This file is part of Gismo 2 00004 // 00005 // File: PData.cpp 00006 00007 // Contents ------------------------------------------------------------ 00008 // 00009 // PData::PData 00010 // PData::printOn 00011 // 00012 // Description 00013 // 00014 // implement the PData class 00015 // 00016 // End ----------------------------------------------------------------- 00017 00018 #include "gismo/PData.h" 00019 #include "DecayEntry.h" 00020 #include "PDTEntry.h" 00021 00022 #include <string.h> 00023 #include <stdio.h> 00024 00025 00026 00027 PData::PData(const char * name, PDTEntry* data) 00028 { 00029 _name = new char[strlen(name)+1]; 00030 strcpy(_name,name); 00031 theData = data; 00032 antiParticle = this; //default is its own antiparticle 00033 } 00034 00035 PData::~PData() 00036 { 00037 delete [] _name; 00038 if( theData==0 ) return; // already deleted 00039 delete theData; 00040 if( antiParticle != this ) 00041 antiParticle->theData = 0; // tag so won't try to delete again 00042 } 00043 00044 void PData::printOn(std::ostream& cout) const 00045 { 00046 char form[50]; 00047 sprintf(form, "%5ld %-9s%8.4f %11.3e " 00048 ,idCode() , name() , mass() , width() ); 00049 cout << '\n'; 00050 cout << form; 00051 for(const DecayEntry *de = decayInfo(); 00052 de; 00053 de=de->next) { 00054 de->printOn(cout); 00055 cout << '\n'<<" "; 00056 00057 } 00058 } 00059 00060 const char * 00061 PData::name()const{return _name;} 00062 00063 PData* 00064 PData::anti()const{return antiParticle;} 00065 00066 float 00067 PData::charge()const{return (float)theData->charge;} 00068 00069 long 00070 PData::idCode()const{return theData->idCode;} 00071 00072 float 00073 PData::mass()const {return theData->mass;} 00074 00075 float 00076 PData::width()const{return theData->width;} 00077 00078 float 00079 PData::widthCut()const{return theData->widthCut;} 00080 00081 float 00082 PData::lifeTime() const{return theData->lifeTime;} 00083 00084 float 00085 PData::spin()const{return (float)theData->spin;} 00086 00087 const DecayEntry* 00088 PData::decayInfo()const{return theData->decayInfo;} 00089 00090 Interactor* 00091 PData::interaction()const{return theData->interaction();} 00092 00093 float 00094 PData::sumBR()const{return theData->sumBR;} 00095
1.2.3 written by Dimitri van Heesch,
© 1997-2000