/////////////////////////////////////////////////////////////////////////////// // ROOT interface to CTEQ /////////////////////////////////////////////////////////////////////////////// #include "TCteq6.hh" TCteq6* TCteq6::fgInstance = 0; ClassImp(TCteq6) extern "C" { void* cteq6_common_block_address_(char*, int len); } //------------------------------------------------------------------------------ TCteq6::Cleaner::Cleaner() { } //------------------------------------------------------------------------------ TCteq6::Cleaner::~Cleaner() { if (TCteq6::fgInstance) { delete TCteq6::fgInstance; TCteq6::fgInstance = 0; } } //------------------------------------------------------------------------------ // constructor is not supposed to be called from the outside - only // Initialize() method //------------------------------------------------------------------------------ TCteq6::TCteq6() { // TCteq6 constructor: creates a TClonesArray in which it will store all // particles. Note that there may be only one functional TCteq6 object // at a time, so it's not use to create more than one instance of it. // initialize common-blocks fCtqpar1 = (Ctqpar1_t*) cteq6_common_block_address_((char*)"CTQPAR1",7); fCtqpar2 = (Ctqpar2_t*) cteq6_common_block_address_((char*)"CTQPAR2",7); } //------------------------------------------------------------------------------ TCteq6::~TCteq6() { } //------------------------------------------------------------------------------ TCteq6* TCteq6::Instance() { // model of automatic memory cleanup suggested by Jim Kowalkovski: // destructor for local static variable `cleaner' is always called in the end // of the job thus deleting the only TCteq6 instance static TCteq6::Cleaner cleaner; return fgInstance ? fgInstance : (fgInstance=new TCteq6()) ; } //_____________________________________________________________________________ Double_t TCteq6::Ctq6pdf(Int_t Iprtn, Double_t X, Double_t Q) { return ctq6pdf_(&Iprtn,&X,&Q); } //_____________________________________________________________________________ void TCteq6::Setctq6(Int_t ISet) { setctq6_(&ISet); } //_____________________________________________________________________________ void TCteq6::Readtbl(Int_t Lun) { readtbl_(&Lun); } //_____________________________________________________________________________ Int_t TCteq6::Nextun() { return nextun_(); } //_____________________________________________________________________________ void TCteq6::Polint(Double_t* Xa, Double_t* Ya, Int_t N, Double_t* X , Double_t* Y , Double_t* Dy) { polint_(Xa,Ya,&N,X,Y,Dy); } //_____________________________________________________________________________ Double_t TCteq6::Partonx6(Int_t Iprtn, Double_t X, Double_t Q) { return partonx6_(&Iprtn,&X,&Q); } //_____________________________________________________________________________ void TCteq6::Pdfset(const char* Parm, Double_t* Value) { // it is assumed that input array dimensioned [20][20] pdfset_(Parm, Value, 20L); } //_____________________________________________________________________________ void TCteq6::Structp(Double_t X , Double_t Q2 , Double_t P2 , Int_t IP2 , Double_t& UpV , Double_t& DnV , Double_t& USea , Double_t& DSea , Double_t& Str , Double_t& Charm, Double_t& Bottom, Double_t& Top , Double_t& Glue) { // returns photon structure function structp_(&X,&Q2,&P2,&IP2,&UpV,&DnV,&USea,&DSea,&Str,&Charm,&Bottom,&Top,&Glue); } //_____________________________________________________________________________ void TCteq6::Structm(Double_t X , Double_t Q , Double_t& UpV , Double_t& DnV , Double_t& USea , Double_t& DSea , Double_t& Str , Double_t& Charm, Double_t& Bottom, Double_t& Top , Double_t& Glue) { // returns proton structure function structm_(&X,&Q,&UpV,&DnV,&USea,&DSea,&Str,&Charm,&Bottom,&Top,&Glue); }