00001 //--------------------------------------------------------------- 00002 // Go4 Release Package v2.10-5 (build 21005) 00003 // 03-Nov-2005 00004 //--------------------------------------------------------------- 00005 // The GSI Online Offline Object Oriented (Go4) Project 00006 // Experiment Data Processing at DVEE department, GSI 00007 //--------------------------------------------------------------- 00008 // 00009 //Copyright (C) 2000- Gesellschaft f. Schwerionenforschung, GSI 00010 // Planckstr. 1, 64291 Darmstadt, Germany 00011 //Contact: http://go4.gsi.de 00012 //---------------------------------------------------------------- 00013 //This software can be used under the license agreements as stated 00014 //in Go4License.txt file which is part of the distribution. 00015 //---------------------------------------------------------------- 00016 /* template for user model class 00017 The only function, which should be redefined by used - UserFunction() 00018 In given example constructor provides a general interface to create 00019 several parameters. Amplitude parameters can be add, if necessary. 00020 Any kind of other constructors with predefine parameters set and names can be invented 00021 Here user function is Gaussian 00022 */ 00023 00024 00025 #include "TString.h" 00026 #include "TMath.h" 00027 #include "TModelTemplate.h" 00028 00029 TModelTemplate::TModelTemplate(const char* iName, Int_t iNPars, Bool_t AddAmplitude) : 00030 TGo4FitModel(iName,"Template for user model",AddAmplitude) { 00031 for (Int_t n=0;n<iNPars;n++) { 00032 TString s("Par"); s+=n; 00033 NewParameter(s.Data(),"model template parameter",0.); 00034 } 00035 } 00036 00037 Double_t TModelTemplate::UserFunction(Double_t* Coordinates, Double_t* Parameters) { 00038 Double_t pos = Parameters[0]; 00039 Double_t width = Parameters[1]; 00040 Double_t x = Coordinates[0]; 00041 return TMath::Exp(-0.5*(x-pos)*(x-pos)/width/width); 00042 } 00043 00044 ClassImp(TModelTemplate) 00045 00046 //----------------------------END OF GO4 SOURCE FILE ---------------------