/////////////////////////////////////////////////////////////////////
//  Pluto Standard Models
//
//
//                             Author:  I. Froehlich
//                             Written: 27.6.2007
//                             Revised: 
//////////////////////////////////////////////////////////////////////

#include "PDataBase.h"
#include "PStdModels.h"

#include "PHadronDecayM1.h"
#include "PHadronDecayM2.h"
#include "PHadronDecayM3.h"
#include "PHadronDecayM1N.h"
#include "PEEDirectDecay.h"
#include "PBreitWigner.h"
#include "PFixedDecay.h"
#include "PFixedProduction.h"
#include "PGenBod.h"
#include "PFermiMomentum.h"
#include "PPropagator.h"
#include "PSaid.h"

PStdModels::PStdModels() {
    generic_physics_done = kFALSE;
    Info("PStdModels()", "(%s), Standard model filler", PRINT_CTOR);
}

PStdModels::~PStdModels() {
}

void PStdModels::Add(PDistributionManagerUtil *pdmutil) {
	
    if (!generic_physics_done) {
	generic_physics_done = kTRUE;
	//Include the standard Pluto distributions
	GenericPhysics(pdmutil);
    } else {
	pdmutil->Add(GetModels());
    }
}

double f_eta_decay(double *x, double *) {
    // QED helicity angle (Bratkovskaya, Toneev et al.)
    return (1+x[0]*x[0])/2;
}

Double_t f_delta_decay(Double_t *x, Double_t *) {
    //    return (1+3*x[0]*x[0])/4; 
    //    return (1+1.35*x[0]*x[0])/4.; 
    return (1+1.35*x[0]*x[0])/2.35; //faster 
}

Double_t f_delta_decay2(Double_t *x, Double_t *) {
    return (5.-3.*(1.35/3.)*x[0]*x[0])/5; //(1.35/3.) is the damping factor
}

void PStdModels::GenericPhysics(PDistributionManagerUtil *pdmutil) {
    //First, add a set of groups, which helps to switch 
    //off certain aspects of physics

    pdmutil->AddGroup("root", "Root group");

    pdmutil->AddSubGroup("eta_physics",     "Physics about eta production, and decay", "root");
    //AddGroup("dilepton_physics", "Physics about the decay of dileptons"); //at the moment not more...
    pdmutil->AddSubGroup("helicity_angles", "Helicity angles of dileptons", "root");
    pdmutil->AddSubGroup("resonances_pw",   "Partial waves of resonances", "root");
    pdmutil->AddSubGroup("particle_models", "Mass sampling of particles", "root");
    pdmutil->AddSubGroup("decay_models",    "Phase space mass sampling & decay partial widths", "root");
    pdmutil->AddSubGroup("polar_angles",    "Polar angles in elementary particle production", "root");
    pdmutil->AddSubGroup("genbod_models",   "Momentum sampling", "root");

//    AddGroup("mass_sampling", "Sampling of dileptons and resonances");
//    SetGroup("mass_sampling");
//    Add((new PEtaModels())->GetModels());

    pdmutil->SetGroup("particle_models");

    //**** rho/omega propagator used e.g. for pion beam plugin
    PPropagator *Rho0Propagator = new 
	PPropagator("Rho0Propagator@rho0_prop/propagator",
		    "Complex rho0 propagator",-1);
    
    PPropagator *OmegaPropagator = new 
	PPropagator("OmegaPropagator@w_prop/propagator",
		    "Complex omega propagator",-1);

    pdmutil->Add(Rho0Propagator);
    pdmutil->Add(OmegaPropagator);

    //**** Complex BW for rho/omega interference 
    int ipid[11], decaykey;
    ipid[0]  = makeStaticData()->GetParticleID("rho0");
    ipid[1]  = makeStaticData()->GetParticleID("e+");
    ipid[2]  = makeStaticData()->GetParticleID("e-");
    decaykey = makeStaticData()->GetDecayKey(ipid, 2);
    int pkey = makeStaticData()->GetParticleKey("rho0");
    PComplexBreitWigner *pmodel2 = new PComplexBreitWigner("rho0_pionff",
							   "Pion form factor", pkey);
    pmodel2->Add("rho0, parent");
    pmodel2->AddAmplitude(makeStaticData()->GetDecayIdxByKey(decaykey), 1, 0);

    ipid[0] = makeStaticData()->GetParticleID("w");
    int decaykey_omega = makeStaticData()->GetDecayIdx(ipid, 2);

    pmodel2->AddInterference(makeStaticData()->GetDecayIdxByKey(decaykey),
			     makeStaticData()->GetParticleKey("w"), decaykey_omega, 0.0388954, -1.60015);

    pdmutil->Add(pmodel2);

    pkey = makeStaticData()->GetParticleKey("w");
    PComplexBreitWigner *pmodel3 = new PComplexBreitWigner("w_pionff", "Pion form factor", pkey);
    pmodel3->Add("w, parent");
    pdmutil->Add(pmodel3);


    //////////////Standard models after THIS point
    pdmutil->Add(GetModels());
    pdmutil->SetGroup("decay_models");

    //Alternative models for the rho:    
    ipid[0]=makeStaticData()->GetParticleID("rho0");
    ipid[1]=makeStaticData()->GetParticleID("e+");
    ipid[2]=makeStaticData()->GetParticleID("e-");
    decaykey = makeStaticData()->GetDecayKey(ipid, 2);
    PEEDirectDecay *pmodel = new PEEDirectDecay("rho_picutoff_e-_e+",
						"Dilepton direct decay with pion cutoff", decaykey);
    pmodel->SetPiCutoff(1);
    pmodel->Add("rho0, parent");
    pmodel->Add("e+, daughter");
    pmodel->Add("e-, daughter");
    pdmutil->Add(pmodel);

    pmodel = new PEEDirectDecay("rho_hardpicutoff_e-_e+",
				"Dilepton direct decay with pion cutoff (step function)", decaykey);
    pmodel->SetPiCutoff(2);
    pmodel->Add("rho0, parent");
    pmodel->Add("e+, daughter");
    pmodel->Add("e-, daughter");
    pdmutil->Add(pmodel);

    ipid[1]=makeStaticData()->GetParticleID("mu+");
    ipid[2]=makeStaticData()->GetParticleID("mu-");

    decaykey = makeStaticData()->GetDecayKey(ipid, 2);
    
    PEEDirectDecay *pmodel_mumu = new PEEDirectDecay("rho_picutoff_mu-_mu+",
						     "Dimuon direct decay with pion cutoff", decaykey);
    pmodel_mumu->SetPiCutoff(1);
    pmodel_mumu->Add("rho0, parent");
    pmodel_mumu->Add("mu+, daughter");
    pmodel_mumu->Add("mu-, daughter");
    pdmutil->Add(pmodel_mumu);

    //    linkDB();
    
    //
    // Eta Physics
    //

    pdmutil->SetGroup("eta_physics");

    //Eta polar angle
    //Ref.17
    TF2 *eta_angles = new TF2("eta_angles",
			      "(1+(3.74041e+01-2.76688e+01*y+5.07488e+00*y*y)*0.5*(3*x*x-1))/2 ", -1, 1, 0, 10);
    gROOT->GetListOfFunctions()->Remove(eta_angles);
    PAngularDistribution *pp_eta_prod_angle = 
	new PAngularDistribution("pp_eta_prod_angle",
				 "Eta polar angles in pp reactions for direct production");
    pp_eta_prod_angle->Add("eta,  daughter, primary");
    pp_eta_prod_angle->Add("p,    daughter");
    pp_eta_prod_angle->Add("p,    daughter");
    pp_eta_prod_angle->Add("q,    parent,   reference");
    pp_eta_prod_angle->SetRotate(kFALSE);
    pp_eta_prod_angle->SetAngleFunction(eta_angles);
    pdmutil->Add(pp_eta_prod_angle);
    

    PAngularDistribution *pp_ns_eta_prod_angle = 
	new PAngularDistribution("pp_ns_eta_prod_angle", 
				 "Eta polar angles in pp reactions via N*");
    pp_ns_eta_prod_angle->Add("eta,  daughter,    primary");
    pp_ns_eta_prod_angle->Add("p,    daughter");
    pp_ns_eta_prod_angle->Add("NS11+,parent");
    pp_ns_eta_prod_angle->Add("p,    parent,      sibling"); //the missing p is the sibling of the N*
    pp_ns_eta_prod_angle->Add("q,    grandparent, reference");
    pp_ns_eta_prod_angle->SetAngleFunction(eta_angles);
    pdmutil->Add(pp_ns_eta_prod_angle);

    //pp alignment for eta production
    TF2 *pp_angles2=new TF2("pp_angles2", 
			    "(1+(5.037074-4.537543*y+1.010214*y*y)*0.5*(3*x*x-1))/2 ", -1, 1, 0, 10);
    gROOT->GetListOfFunctions()->Remove(pp_angles2);
    PAngularDistribution *pp_eta_pp_align = 
	new PAngularDistribution("pp_eta_pp_align",
				 "pp alignment in pp reactions for direct eta production");
    pp_eta_pp_align->Add("eta,  daughter");
    pp_eta_pp_align->Add("p,    daughter,    primary");
    pp_eta_pp_align->Add("p,    daughter,    align");
    pp_eta_pp_align->Add("q,    parent,      mass_reference");
    pp_eta_pp_align->SetRotate(kFALSE);//DISTO measured just with boost, no rotation
    pp_eta_pp_align->SetAngleFunction(pp_angles2);
    pdmutil->Add(pp_eta_pp_align);
    
    PAngularDistribution *pp_ns_eta_pp_align = 
	new PAngularDistribution("pp_ns_eta_pp_align",
				 "pp alignment in pp reactions for eta production via N*");
    pp_ns_eta_pp_align->Add("eta,    daughter");
    pp_ns_eta_pp_align->Add("p,      daughter,    primary");
    pp_ns_eta_pp_align->Add("NS11+,  parent");
    pp_ns_eta_pp_align->Add("p,      parent,      sibling, align"); //the missing p is the sibling of the N*
    pp_ns_eta_pp_align->Add("q,      grandparent, mass_reference");
    pp_ns_eta_pp_align->SetRotate(kFALSE);//DISTO measured just with boost, no rotation
    pp_ns_eta_pp_align->SetAngleFunction(pp_angles2);
    pdmutil->Add(pp_ns_eta_pp_align);
    
    //matrix element for eta -> pi+pi-pi0
    PDalitzDistribution *eta_hadronic_decay =
	new PDalitzDistribution("eta_hadronic_decay",
				"Eta matrix element for decay into charged pions");
    eta_hadronic_decay->Add("eta,    parent");
    eta_hadronic_decay->Add("pi0,    daughter,    primary");
    eta_hadronic_decay->Add("pi+,    daughter");
    eta_hadronic_decay->Add("pi-,    daughter");
    eta_hadronic_decay->SetSlopes(-0.94, 0.11);
    eta_hadronic_decay->SetMax(2.05);
    pdmutil->Add(eta_hadronic_decay);

    //
    // Anisotropic dilepton decay
    //

    pdmutil->SetGroup("helicity_angles");
    //Ref.7
    TF1 *pseudoscalar_decay = new TF1("helicity", f_eta_decay, -1, 1, 1);
    gROOT->GetListOfFunctions()->Remove(pseudoscalar_decay);
    PAngularDistribution *eta_dilepton_helicity = 
	new PAngularDistribution("eta_dilepton_helicity",
				 "Helicity angle of the dilepton decay of eta");
    eta_dilepton_helicity->Add("dilepton","PARENT");
    eta_dilepton_helicity->Add("e+",  "DAUGHTER");
    eta_dilepton_helicity->Add("e-",  "DAUGHTER", "primary");
    eta_dilepton_helicity->Add("g", "PARENT", "SIBLING"); //added to distinguish double-dalitz
    eta_dilepton_helicity->Add("eta", "GRANDPARENT", "base_reference");
    eta_dilepton_helicity->SetAngleFunction(pseudoscalar_decay);
    eta_dilepton_helicity->NeverAbort(kTRUE);
    pdmutil->Add(eta_dilepton_helicity);
    
    PAngularDistribution *etaprime_dilepton_helicity = 
	new PAngularDistribution("etaprime_dilepton_helicity",
				 "Helicity angle of the dilepton decay of etaprime");
    etaprime_dilepton_helicity->Add("dilepton","PARENT");
    etaprime_dilepton_helicity->Add("e+",  "DAUGHTER");
    etaprime_dilepton_helicity->Add("e-",  "DAUGHTER", "primary");
    etaprime_dilepton_helicity->Add("eta'", "GRANDPARENT", "base_reference");
    etaprime_dilepton_helicity->SetAngleFunction(pseudoscalar_decay);
    etaprime_dilepton_helicity->NeverAbort(kTRUE);
    pdmutil->Add(etaprime_dilepton_helicity);
    
    PAngularDistribution *pi0_dilepton_helicity =
	new PAngularDistribution("pi0_dilepton_helicity",
				 "Helicity angle of the dilepton decay of pi0");
    pi0_dilepton_helicity->Add("dilepton","PARENT");
    pi0_dilepton_helicity->Add("e+",  "DAUGHTER");
    pi0_dilepton_helicity->Add("e-",  "DAUGHTER", "primary");
    pi0_dilepton_helicity->Add("pi0", "GRANDPARENT", "base_reference");
    pi0_dilepton_helicity->SetAngleFunction(pseudoscalar_decay);
    pi0_dilepton_helicity->NeverAbort(kTRUE);
    pdmutil->Add(pi0_dilepton_helicity);

    //Resonances

    pdmutil->SetGroup("resonances_pw");

    TF1 * pw_decay = new TF1("pw", f_delta_decay, -1, 1, 1);
    gROOT->GetListOfFunctions()->Remove(pw_decay);
    PScatterDistribution *delta_waves1 = 
	new PScatterDistribution("pp_delta_waves1", "Delta+ PW pi0 scattering");
    delta_waves1->Add("D+",   "PARENT");
    delta_waves1->Add("pi0",  "DAUGHTER", "primary");
    delta_waves1->Add("p",    "DAUGHTER");
    delta_waves1->Add("q",    "GRANDPARENT");
    delta_waves1->Add("N",    "GRANDGRANDPARENT", "beam");
    delta_waves1->Add("N",    "GRANDGRANDPARENT", "target");
    delta_waves1->SetAngleFunction(pw_decay);
    pdmutil->Add(delta_waves1);

    PScatterDistribution *delta_waves2 = 
	new PScatterDistribution("pp_delta_waves2", "Delta+ PW pi+ scattering");
    delta_waves2->Add("D+",   "PARENT");
    delta_waves2->Add("pi+",  "DAUGHTER", "primary");
    delta_waves2->Add("n",    "DAUGHTER");
    delta_waves2->Add("q",    "GRANDPARENT");
    delta_waves2->Add("N",    "GRANDGRANDPARENT", "beam");
    delta_waves2->Add("N",    "GRANDGRANDPARENT", "target");
    delta_waves2->SetAngleFunction(pw_decay);
    pdmutil->Add(delta_waves2);

    PScatterDistribution *delta_waves3 = 
	new PScatterDistribution("pp_delta_waves3", "Delta++ PW pi+ scattering");
    delta_waves3->Add("D++",  "PARENT");
    delta_waves3->Add("pi+",  "DAUGHTER", "primary");
    delta_waves3->Add("p",    "DAUGHTER");
    delta_waves3->Add("q",    "GRANDPARENT");
    delta_waves3->Add("N",    "GRANDGRANDPARENT", "beam");
    delta_waves3->Add("N",    "GRANDGRANDPARENT", "target");
    delta_waves3->SetAngleFunction(pw_decay);
    pdmutil->Add(delta_waves3);

    TF1 *pw_decay2 = new TF1("pw", f_delta_decay2, -1, 1, 1);
    gROOT->GetListOfFunctions()->Remove(pw_decay2);
    PScatterDistribution *delta_waves1dil = 
	new PScatterDistribution("pp_delta_waves1dil", "Delta+ PW DiLepton scattering");
    delta_waves1dil->Add("D+",        "PARENT");
    delta_waves1dil->Add("dilepton",  "DAUGHTER", "primary");
    delta_waves1dil->Add("p",         "DAUGHTER");
    delta_waves1dil->Add("q",         "GRANDPARENT");
    delta_waves1dil->Add("N",         "GRANDGRANDPARENT", "beam");
    delta_waves1dil->Add("N",         "GRANDGRANDPARENT", "target");
    delta_waves1dil->SetAngleFunction(pw_decay2);
    pdmutil->Add(delta_waves1dil);


    PScatterDistribution *delta_waves1a = 
	new PScatterDistribution("pp_delta_waves1a", "Delta0 PW pi0 scattering");
    delta_waves1a->Add("D0",   "PARENT");
    delta_waves1a->Add("pi0",  "DAUGHTER", "primary");
    delta_waves1a->Add("n",    "DAUGHTER");
    delta_waves1a->Add("q",    "GRANDPARENT");
    delta_waves1a->Add("N",    "GRANDGRANDPARENT", "beam");
    delta_waves1a->Add("N",    "GRANDGRANDPARENT", "target");
    delta_waves1a->SetAngleFunction(pw_decay);
    pdmutil->Add(delta_waves1a);

    PScatterDistribution *delta_waves2a = 
	new PScatterDistribution("pp_delta_waves2a", "Delta0 PW pi- scattering");
    delta_waves2a->Add("D0",   "PARENT");
    delta_waves2a->Add("pi-",  "DAUGHTER", "primary");
    delta_waves2a->Add("p",    "DAUGHTER");
    delta_waves2a->Add("q",    "GRANDPARENT");
    delta_waves2a->Add("N",    "GRANDGRANDPARENT", "beam");
    delta_waves2a->Add("N",    "GRANDGRANDPARENT", "target");
    delta_waves2a->SetAngleFunction(pw_decay);
    pdmutil->Add(delta_waves2a);

    PScatterDistribution *delta_waves3a = new PScatterDistribution("pp_delta_waves3a", "Delta- PW pi- scattering");
    delta_waves3a->Add("D-",   "PARENT");
    delta_waves3a->Add("pi-",  "DAUGHTER", "primary");
    delta_waves3a->Add("n",    "DAUGHTER");
    delta_waves3a->Add("q",    "GRANDPARENT");
    delta_waves3a->Add("N",    "GRANDGRANDPARENT", "beam");
    delta_waves3a->Add("N",    "GRANDGRANDPARENT", "target");
    delta_waves3a->SetAngleFunction(pw_decay);
    pdmutil->Add(delta_waves3a);


    PScatterDistribution *delta_waves2dil = 
	new PScatterDistribution("pp_delta_waves2dil", "Delta0 PW DiLepton scattering");
    delta_waves2dil->Add("D0",        "PARENT");
    delta_waves2dil->Add("dilepton",  "DAUGHTER", "primary");
    delta_waves2dil->Add("n",         "DAUGHTER");
    delta_waves2dil->Add("q",         "GRANDPARENT");
    delta_waves2dil->Add("N",         "GRANDGRANDPARENT", "beam");
    delta_waves2dil->Add("N",         "GRANDGRANDPARENT", "target");
    delta_waves2dil->SetAngleFunction(pw_decay2);
    pdmutil->Add(delta_waves2dil);

    pdmutil->SetGroup("polar_angles");
    TF1 *dummy = new TF1("dummy", "1", -1, 1);
    gROOT->GetListOfFunctions()->Remove(dummy);
    PDeltaAngularDistribution *delta_production = 
	new PDeltaAngularDistribution("NN_delta+_angle", "N+N->N+Delta angular distribution");
    delta_production->Add("N,grandparent,beam");
    delta_production->Add("N,grandparent,target");
    delta_production->Add("q,parent");
    delta_production->Add("N,daughter");
    delta_production->Add("D+,daughter,primary");
    delta_production->SetAngleFunction(dummy);
    pdmutil->Add(delta_production);

    PDeltaAngularDistribution *delta_production2 = 
	new PDeltaAngularDistribution("NN_delta++_angle", "N+N->N+Delta angular distribution");
    delta_production2->Add("N", "GRANDPARENT", "beam");
    delta_production2->Add("N", "GRANDPARENT", "target");
    delta_production2->Add("q", "PARENT");
    delta_production2->Add("N,   DAUGHTER");
    delta_production2->Add("D++, daughter, primary");
    delta_production2->SetAngleFunction(dummy);
    pdmutil->Add(delta_production2);

    PDeltaAngularDistribution *delta_production3 = 
	new PDeltaAngularDistribution("NN_delta0_angle","N+N->N+Delta angular distribution");
    delta_production3->Add("N", "GRANDPARENT", "beam");
    delta_production3->Add("N", "GRANDPARENT", "target");
    delta_production3->Add("q", "PARENT");
    delta_production3->Add("N,   DAUGHTER");
    delta_production3->Add("D0,  daughter, primary");
    delta_production3->SetAngleFunction(dummy);
    pdmutil->Add(delta_production3);

    PSaid *said = new PSaid ("pp_elastic", "PP elastic scattering with SAID");
    said->Add("q", "PARENT");
    said->Add("p", "GRANDPARENT", "beam");
    said->Add("p", "GRANDPARENT", "target");
    said->Add("p,   daughter");
    said->Add("p,   daughter, primary");
    said->SetAngleFunction(dummy);
    pdmutil->Add(said);

    PPiOmegaAngularDistribution *omega_production = 
	new PPiOmegaAngularDistribution("pi+n_wp_angle", "pi+ + n --> w + p angular distribution");
    omega_production->Add("pi+", "GRANDPARENT", "beam");
    omega_production->Add("n",   "GRANDPARENT", "target");
    omega_production->Add("q",   "PARENT");
    omega_production->Add("p",   "DAUGHTER");
    omega_production->Add("w",   "DAUGHTER", "primary");
    omega_production->SetAngleFunction(dummy);
    omega_production->SetVersion(PI_OMEGA_piNNw);
    pdmutil->Add(omega_production);

    PPiOmegaAngularDistribution *omega_production2 = 
	new PPiOmegaAngularDistribution("pi-p_wn_angle", "pi- + p --> w + n angular distribution");
    omega_production2->Add("pi-", "GRANDPARENT", "beam");
    omega_production2->Add("p",   "GRANDPARENT", "target");
    omega_production2->Add("q",   "PARENT");
    omega_production2->Add("n",   "DAUGHTER");
    omega_production2->Add("w",   "DAUGHTER", "primary");
    omega_production2->SetAngleFunction(dummy);
    omega_production2->SetVersion(PI_OMEGA_piNNw);
    pdmutil->Add(omega_production2);

    PPiOmegaAngularDistribution *omega_production3 = 
	new PPiOmegaAngularDistribution("pi+p_pi+wp_angle", "pi+ + p -> pi+ + p + w angular distribution");
    omega_production3->Add("pi+", "GRANDPARENT", "beam");
    omega_production3->Add("p",   "GRANDPARENT", "target");
    omega_production3->Add("q",   "PARENT");
    omega_production3->Add("p",   "DAUGHTER");
    omega_production3->Add("pi+", "DAUGHTER");
    omega_production3->Add("w",   "DAUGHTER", "primary");
    omega_production3->SetAngleFunction(dummy);
    omega_production3->SetVersion(PI_OMEGA_piPPpiw);
    pdmutil->Add(omega_production3);

    
    PPiOmegaAngularDistribution *omega_production4 = 
	new PPiOmegaAngularDistribution("pi+p_D++w_angle", "pi+ + p -> D++ + w angular distribution");
    omega_production4->Add("pi+", "GRANDPARENT", "beam");
    omega_production4->Add("p",   "GRANDPARENT", "target");
    omega_production4->Add("q",   "PARENT");
    omega_production4->Add("D++", "DAUGHTER");
    omega_production4->Add("w",   "DAUGHTER", "primary");
    omega_production4->SetAngleFunction(dummy);
    omega_production4->SetVersion(PI_OMEGA_piPDw);
    pdmutil->Add(omega_production4);


    //some updates on the vector mesons mass shape:
    pdmutil->Add(new PHadronDecayM3("w_phasespace_pi+_pi-_pi0",   "Width including 3-body p.s.", -1));
    pdmutil->Add(new PHadronDecayM3("phi_phasespace_pi+_pi-_pi0", "Width including 3-body p.s.", -1));

    PEEDirectDecay *ee = (PEEDirectDecay *) 
	pdmutil->GetDistribution("w_ee_e-_e+");
    if (ee) 
	ee->SetHadronicPS(1);
    else 
	Warning("GenericPhysics", "[w_ee_e-_e+] not found");
    ee = (PEEDirectDecay *) pdmutil->GetDistribution("phi_ee_e-_e+");
    if (ee) 
	ee->SetHadronicPS(1);
    else 
	Warning("GenericPhysics","[phi_ee_e-_e+] not found");

    pdmutil->ExpandGroup("user");

};


TObjArray *PStdModels::GetModels(void) {

    arr = new TObjArray();

    Info("GetModels", "Read std models");

    /***********************************************
     * Loop over the particles                     *
     * for each particle we check one of the       *
     * build-in models                             *
     ***********************************************/
    Int_t header      = makeDataBase()->GetEntry("std_set");
    Int_t particlekey = -1;
    Int_t genbod_key  = makeStaticData()->MakeDirectoryEntry("modeldef", NMODEL_NAME, LMODEL_NAME, "genbod");

    Double_t unstable_width = *(makeStaticData()->GetBatchValue("_system_unstable_width"));

    while (makeDataBase()->MakeListIterator(header, "snpart", "slink", &particlekey)) {
	Int_t pid = makeStaticData()->GetParticleIDByKey(particlekey);

	//cout << "pid:" << pid << endl;
	Int_t decaykey=-1;

	while ((makeStaticData()->GetParticleNChannelsByKey(particlekey)>0) && 
	       (makeDataBase()->MakeListIterator(particlekey, "pnmodes", "link", &decaykey))) {


	    /***********************************************
	     * Loop over the decay modes                   *
	     * for each mode we check one of the           *
	     * build-in models                             *
	     ***********************************************/

	    int decay_has_composite = 0;
	    Int_t tid[11];
	    tid[0] = 10; 
	    makeStaticData()->GetDecayModeByKey(decaykey, tid); // retrieve current mode info
	    
	    for (int p=1; p<=tid[0]; p++) {
		if (tid[p] > 1000)
		    decay_has_composite = 1;
	    }

	    if (!makeDynamicData()->GetDecayModelByKey(decaykey)) { 
		//Check first if we are alraedy done

		model = NULL;

		if ((tid[0] == 2) && (!decay_has_composite)) {
		    /* 2 decay products */
		    
		    /* Dalitz Decays */
		    if (PData::IsDalitz(pid, tid[1], tid[2])) {
			id = new TString(makeStaticData()->GetParticleName(pid));
			id->Append("_dalitz");
			if (makeStaticData()->IsParticle(tid[1],"dimuon") ||
			    makeStaticData()->IsParticle(tid[2],"dimuon"))
			    id->Append("_mumu");
			PDalitzDecay *pmodel = new PDalitzDecay((char*)id->Data(), "Dalitz decay", decaykey);
			model = (PChannelModel*) pmodel;
			//	makeDataBase()->SetParamInt (decaykey, "maxmesh",new Int_t(2000)); //take into account strong var.
		    }

		    int n1=1, n2=1;
		    if (makeStaticData()->
			GetParticleTotalWidth(tid[1]) < unstable_width) 
			n1 = 0; // too narrow 
		    
		    if (makeStaticData()->
			GetParticleTotalWidth(tid[2]) < unstable_width ) 
			n2 = 0; // too narrow
		    
		    int h = makeStaticData()->IsParticleHadron(tid[1])*
			makeStaticData()->IsParticleHadron(tid[2]);

		    /* Decay of a hadron in 1 stable and 1 unstable product */
		    if ((h && n1 && !n2) || (h && !n1 && n2)) {
			id = new TString(makeStaticData()->GetParticleName(pid));
			id->Append("_m1_");
			id->Append(makeStaticData()->GetParticleName(tid[1]));
			id->Append("_");
			id->Append(makeStaticData()->GetParticleName(tid[2]));
			PHadronDecayM1 *pmodel = new PHadronDecayM1((char*)id->Data(),
								    "1 unstable hadron (2-body ps)", decaykey);
			model = (PChannelModel*) pmodel;
		    }
		    /* Decay of a hadron in unstable products */
		    if ((h && n1 && n2) || (h && n1 && n2)) {
			id = new TString(makeStaticData()->GetParticleName(pid));
			id->Append("_m2_");
			id->Append(makeStaticData()->GetParticleName(tid[1]));
			id->Append("_");
			id->Append(makeStaticData()->GetParticleName(tid[2]));
			PHadronDecayM2 *pmodel = new PHadronDecayM2((char*)id->Data(),
								    "2 unstable hadrons (2-body ps)", decaykey);
			model = (PChannelModel*) pmodel;
		    }

		    /* Decay in stable products */
		    if (h && !n1 && !n2) {
			id = new TString(makeStaticData()->GetParticleName(pid));
			id->Append("_fix_");
			id->Append(makeStaticData()->GetParticleName(tid[1]));
			id->Append("_");
			id->Append(makeStaticData()->GetParticleName(tid[2]));
			PHadronDecay *pmodel = new PHadronDecay((char*)id->Data(),
								"2-body fixed mass, partial width", decaykey);
			model = (PChannelModel*) pmodel;
		    }
		    /* Decay in ee */
		    if ((PData::IsDirectEE(pid,tid[1],tid[2]) ||
			 PData::IsDirectMuMu(pid,tid[1],tid[2]))
			&& (!makeStaticData()->IsParticle(pid, "eta")
			    && !makeStaticData()->IsParticle(pid, "J/Psi") 
			    && !makeStaticData()->IsParticle(pid, "Psi'") 
			    && !makeStaticData()->IsParticle(pid, "sigma") //Not included  
			)) {
			id = new TString(makeStaticData()->GetParticleName(pid));
			id->Append("_ee_");
			id->Append(makeStaticData()->GetParticleName(tid[1]));
			id->Append("_");
			id->Append(makeStaticData()->GetParticleName(tid[2]));
			PEEDirectDecay *pmodel = 
			    new PEEDirectDecay((char*)id->Data(),
					       "Dilepton direct decay",decaykey);
			model = (PChannelModel*) pmodel;
			makeDataBase()->SetParamInt (particlekey, "maxmesh", new Int_t(2000)); //-> take into accoutn strong variations
			makeDataBase()->SetParamInt (decaykey, "maxmesh", new Int_t(2000)); 
		    }
		} /* END 2 products */

		if ((tid[0] == 3) && (!decay_has_composite)) {
		    int h=makeStaticData()->IsParticleHadron(tid[1])*
			makeStaticData()->IsParticleHadron(tid[2])*
			makeStaticData()->IsParticleHadron(tid[3]);
		    /* 3 decay products */

		    Int_t ust = 0;
		    if (makeStaticData()->
			GetParticleTotalWidth(tid[1]) > unstable_width)  ust++; 
		    if (makeStaticData()->
			GetParticleTotalWidth(tid[2]) > unstable_width ) ust++; 
		    if (makeStaticData()->
			GetParticleTotalWidth(tid[3]) > unstable_width ) ust++; 

		    if (h && (ust) && (*(makeStaticData()->GetBatchValue("_system_force_m1n")))) {

			id = new TString(makeStaticData()->GetParticleName(pid));
			id->Append("_m3_");
			id->Append(makeStaticData()->GetParticleName(tid[1]));
			id->Append("_");
			id->Append(makeStaticData()->GetParticleName(tid[2]));
			id->Append("_");
			id->Append(makeStaticData()->GetParticleName(tid[3]));
			PHadronDecayM3 *pmodel = 
			    new PHadronDecayM3((char*)id->Data(), "3-body phase space", decaykey);
			model = (PChannelModel*) pmodel;

			if (ust == 1) {
			    AddModel(arr, model, pid, tid);
			    
			    id = new TString(makeStaticData()->GetParticleName(pid));
			    id->Append("_m1n_");
			    id->Append(makeStaticData()->GetParticleName(tid[1]));
			    id->Append("_");
			    id->Append(makeStaticData()->GetParticleName(tid[2]));
			    id->Append("_");
			    id->Append(makeStaticData()->GetParticleName(tid[3]));
			    PHadronDecayM1N *pmodel = 
				new PHadronDecayM1N((char*)id->Data(), 
						    "N-body phase space with unstable hadron ", decaykey);
			    model = (PChannelModel*) pmodel;
			}
		    } else if (h && (ust)) {
			
			id = new TString(makeStaticData()->GetParticleName(pid));
			id->Append("_m1n_");
			id->Append(makeStaticData()->GetParticleName(tid[1]));
			id->Append("_");
			id->Append(makeStaticData()->GetParticleName(tid[2]));
			id->Append("_");
			id->Append(makeStaticData()->GetParticleName(tid[3]));
			PHadronDecayM1N *pmodel = 
			    new PHadronDecayM1N((char*)id->Data(),
						"N-body phase space with unstable hadron ", decaykey);
			
			model = (PChannelModel*) pmodel;
			
			if (ust == 1) {
			    AddModel(arr, model, pid, tid);
			    
			    id = new TString(makeStaticData()->GetParticleName(pid));
			    id->Append("_m3_");
			    id->Append(makeStaticData()->GetParticleName(tid[1]));
			    id->Append("_");
			    id->Append(makeStaticData()->GetParticleName(tid[2]));
			    id->Append("_");
			    id->Append(makeStaticData()->GetParticleName(tid[3]));
			    PHadronDecayM3 *pmodel = 
				new PHadronDecayM3((char*)id->Data(), "3-body phase space", decaykey);
			    
			    model = (PChannelModel*) pmodel;
			}
		    } 
		}

		// N>3 models
		if ((tid[0] > 3) && (!decay_has_composite)) {
		    int n1 = 0;
		    for (int j=0; j<tid[0]; j++) {
			if ((makeStaticData()->
			    GetParticleTotalWidth(tid[1+j])> unstable_width) &&
			    makeStaticData()->IsParticleHadron(tid[j+1])) n1++;
		    }
		    if (n1 == 1) {
			id = new TString(makeStaticData()->GetParticleName(pid));
			id->Append("_m1n_");
			for (int p=1; p<=tid[0]; p++) {
			    id->Append(makeStaticData()->GetParticleName(tid[p]));
			    if (p != tid[0]) id->Append("_");
			}
			PHadronDecayM1N *pmodel = 
			    new PHadronDecayM1N((char*)id->Data(),
						"N-body phase space with unstable hadron ", decaykey);
			model = (PChannelModel*) pmodel;
		    }
		}
    
		if (!model && !decay_has_composite && tid[0]>1) {
		    //Add dummy model			
		    id = new TString(makeStaticData()->GetParticleName(pid));
		    id->Append("_fixed_");
		    for (int p=1; p<=tid[0]; p++) {
			id->Append(makeStaticData()->GetParticleName(tid[p]));
			if (p != tid[0]) id->Append("_");
		    }

		    PFixedDecay *pmodel = 
			new PFixedDecay((char*)id->Data(), "Fixed product masses", decaykey);
		    model = (PChannelModel*) pmodel;
		    model->SetGroupID("decay_models");
		}

		if (!model && !decay_has_composite && tid[0] == 1) {
		    //beam fusion
		    id = new TString(makeStaticData()->GetParticleName(pid));
		    id->Append("_prod_");		    
		    id->Append(makeStaticData()->GetParticleName(tid[1]));		
		    id->Append("@");
		    id->Append(makeStaticData()->GetParticleName(pid));
		    id->Append("#prod#");
		
		    id->Append(makeStaticData()->GetParticleName(tid[1]));
		
		    PFixedProduction *pmodel = 
		      new PFixedProduction((char*)id->Data(), "Particle Production (fusion)", -2);

		    //pmodel->Add(makeStaticData()->GetParticleName(pid),"parent");
		    //pmodel->Add(makeStaticData()->GetParticleName(tid[1]),"daughter");
		    model = (PChannelModel*) pmodel;
		    model->SetGroupID("decay_models");
		}

		if (model) {
		    AddModel(arr, model, pid, tid);
		} 


		if ((tid[0] == 2) && (decay_has_composite) && ( PData::IsN(tid[1]) ||  PData::IsN(tid[2]) )) {
		    //add fermi model
		    id = new TString(makeStaticData()->GetParticleName(pid));
		    id->Append("_fermi_");
		    for (int p=1; p<=tid[0]; p++) {
			id->Append(makeStaticData()->GetParticleName(tid[p]));
			if (p != tid[0]) id->Append("_");
		    }
		    PFermiMomentum *pmodel = new PFermiMomentum(
			(char*)id->Data(), "Quasi-free particle production", -1);
		    if (pid < 1000) 
			pmodel->Add(makeStaticData()->GetParticleName(pid), "parent");
		    else {
			pmodel->Add("q", "parent");  //"White" decay of composite
			pmodel->Add(makeStaticData()->GetParticleName(pid%1000), "grandparent", "beam");
			pmodel->Add(makeStaticData()->GetParticleName(pid/1000), "grandparent", "target");
		    }
		    for (int num=0; num<tid[0]; num++) {
			if (tid[1+num] < 1000) 
			    pmodel->Add(makeStaticData()->GetParticleName(tid[1+num]), "daughter", "spectator");
			else {
			    //This is the quasi-reaction
			    pmodel->Add("q", "daughter", "composite"); 
			    pmodel->Add(makeStaticData()->GetParticleName(tid[1+num]/1000), "granddaughter", "p1");
			    pmodel->Add(makeStaticData()->GetParticleName(tid[1+num]%1000), "granddaughter", "p2");
			}
		    }

		    pmodel->SetGroupID("genbod_models");
		    arr->Add((TObject *)pmodel);		    
		}
	    } //END check for existing primary model

	    if (!makeDynamicData()->GetDecayModelByKey(decaykey, genbod_key)) { 

		if (!decay_has_composite && tid[0]>1) {
		    //Adding PGENBOD by default
		    id = new TString(makeStaticData()->GetParticleName(pid));
		    id->Append("_genbod_");
		    for (int p=1; p<=tid[0]; p++) {
			id->Append(makeStaticData()->GetParticleName(tid[p]));
			if (p != tid[0]) id->Append("_");
		    }
		    id->Append("@");
		    id->Append(makeStaticData()->GetParticleName(pid));
		    id->Append("#genbod#");
		    for (int p=1; p<=tid[0]; p++) {
			id->Append(makeStaticData()->GetParticleName(tid[p]));
			if (p != tid[0]) id->Append("#");
		    }
		    id->Append("&genbod");
		    PGenBod *pmodel = new PGenBod((char*)id->Data(), "Pluto build-in genbod", -2);
		    //if (pid<1000) 
		    pmodel->Add(makeStaticData()->GetParticleName(pid), "parent");
		    //else pmodel->Add("q","parent");  //"White" decay of composite
		    for (int num=0; num<tid[0]; num++)
			pmodel->Add(makeStaticData()->GetParticleName(tid[1+num]), "daughter");
		    pmodel->SetGroupID("genbod_models");
		    arr->Add((TObject *)pmodel);

// 		    //Now check for a possible "reflected" particle
// 		    if (pid > PLUTO_COMPOSITE) {
// 			//parent is composite, add the reflected [clone]
// 			int id1=pid%1000, id2=pid/1000;
// 			Int_t xpid = id1*1000 + id2;
// 			if (makeStaticData()->IsParticleValid(xpid)) {
// 			    id = new TString(makeStaticData()->GetParticleName(xpid));
// 			    id->Append("_genbod_");
// 			    for (int p=1;p<=tid[0];p++) {
// 				id->Append(makeStaticData()->GetParticleName(tid[p]));
// 				if (p!=tid[0]) id->Append("_");
// 			    }
// 			    id->Append("@");
// 			    id->Append(makeStaticData()->GetParticleName(xpid));
// 			    id->Append("#genbod#");
// 			    for (int p=1;p<=tid[0];p++) {
// 				id->Append(makeStaticData()->GetParticleName(tid[p]));
// 				if (p!=tid[0]) id->Append("#");
// 			    }
// 			    id->Append("&genbod");
// 			    PGenBod *pmodel = new PGenBod((char*)id->Data(),"Pluto build-in genbod [clone]",-2);
// 			    pmodel->Add("dummy","parent");
// 			    pmodel->SetGroupID("genbod_models");
// 			    arr->Add((TObject *)pmodel);
// 			}
// 		    }

		} 
	    }

	} //END decay mode iterator

	model = NULL;

	if (!makeDynamicData()->GetParticleModel(pid)) { //check first if we done

	    /* Breit-Wigner model */
	    if (makeStaticData()->IsParticleHadron(pid) &&
		makeStaticData()->GetParticleTotalWidth(pid) > unstable_width) {
		id = new TString(makeStaticData()->GetParticleName(pid));
		id->Append("_bw");
		de = new TString(makeStaticData()->GetParticleName(pid));
		// de->Append(" <PBreitWigner>");
		PBreitWigner *pmodel = new PBreitWigner((char*)id->Data(), (char*)de->Data(), particlekey);
		model = (PChannelModel*) pmodel;
	    }

	    if (model) {
		model->Add(makeStaticData()->GetParticleName(pid), "daughter");
		model->SetGroupID("particle_models");
		arr->Add((TObject *)model);
	    }   
	}
    } //END particle iterator
    makeStaticData()->SetFreezeOut();

    return arr;
};

void PStdModels::AddModel(TObjArray *arr, PChannelModel *model, int pid, int *tid) {

    //If a model has been identified we make it known to the PChannel world
    if (pid < 1000) 
	model->Add(makeStaticData()->GetParticleName(pid), "parent");
    else 
	model->Add("q", "parent");  //"White" decay of composite
    for (int num=0; num<tid[0]; num++)
	model->Add(makeStaticData()->GetParticleName(tid[1+num]), "daughter");
    model->SetGroupID("decay_models");
    arr->Add((TObject *)model);

}

ClassImp(PStdModels)



 PStdModels.cc:1
 PStdModels.cc:2
 PStdModels.cc:3
 PStdModels.cc:4
 PStdModels.cc:5
 PStdModels.cc:6
 PStdModels.cc:7
 PStdModels.cc:8
 PStdModels.cc:9
 PStdModels.cc:10
 PStdModels.cc:11
 PStdModels.cc:12
 PStdModels.cc:13
 PStdModels.cc:14
 PStdModels.cc:15
 PStdModels.cc:16
 PStdModels.cc:17
 PStdModels.cc:18
 PStdModels.cc:19
 PStdModels.cc:20
 PStdModels.cc:21
 PStdModels.cc:22
 PStdModels.cc:23
 PStdModels.cc:24
 PStdModels.cc:25
 PStdModels.cc:26
 PStdModels.cc:27
 PStdModels.cc:28
 PStdModels.cc:29
 PStdModels.cc:30
 PStdModels.cc:31
 PStdModels.cc:32
 PStdModels.cc:33
 PStdModels.cc:34
 PStdModels.cc:35
 PStdModels.cc:36
 PStdModels.cc:37
 PStdModels.cc:38
 PStdModels.cc:39
 PStdModels.cc:40
 PStdModels.cc:41
 PStdModels.cc:42
 PStdModels.cc:43
 PStdModels.cc:44
 PStdModels.cc:45
 PStdModels.cc:46
 PStdModels.cc:47
 PStdModels.cc:48
 PStdModels.cc:49
 PStdModels.cc:50
 PStdModels.cc:51
 PStdModels.cc:52
 PStdModels.cc:53
 PStdModels.cc:54
 PStdModels.cc:55
 PStdModels.cc:56
 PStdModels.cc:57
 PStdModels.cc:58
 PStdModels.cc:59
 PStdModels.cc:60
 PStdModels.cc:61
 PStdModels.cc:62
 PStdModels.cc:63
 PStdModels.cc:64
 PStdModels.cc:65
 PStdModels.cc:66
 PStdModels.cc:67
 PStdModels.cc:68
 PStdModels.cc:69
 PStdModels.cc:70
 PStdModels.cc:71
 PStdModels.cc:72
 PStdModels.cc:73
 PStdModels.cc:74
 PStdModels.cc:75
 PStdModels.cc:76
 PStdModels.cc:77
 PStdModels.cc:78
 PStdModels.cc:79
 PStdModels.cc:80
 PStdModels.cc:81
 PStdModels.cc:82
 PStdModels.cc:83
 PStdModels.cc:84
 PStdModels.cc:85
 PStdModels.cc:86
 PStdModels.cc:87
 PStdModels.cc:88
 PStdModels.cc:89
 PStdModels.cc:90
 PStdModels.cc:91
 PStdModels.cc:92
 PStdModels.cc:93
 PStdModels.cc:94
 PStdModels.cc:95
 PStdModels.cc:96
 PStdModels.cc:97
 PStdModels.cc:98
 PStdModels.cc:99
 PStdModels.cc:100
 PStdModels.cc:101
 PStdModels.cc:102
 PStdModels.cc:103
 PStdModels.cc:104
 PStdModels.cc:105
 PStdModels.cc:106
 PStdModels.cc:107
 PStdModels.cc:108
 PStdModels.cc:109
 PStdModels.cc:110
 PStdModels.cc:111
 PStdModels.cc:112
 PStdModels.cc:113
 PStdModels.cc:114
 PStdModels.cc:115
 PStdModels.cc:116
 PStdModels.cc:117
 PStdModels.cc:118
 PStdModels.cc:119
 PStdModels.cc:120
 PStdModels.cc:121
 PStdModels.cc:122
 PStdModels.cc:123
 PStdModels.cc:124
 PStdModels.cc:125
 PStdModels.cc:126
 PStdModels.cc:127
 PStdModels.cc:128
 PStdModels.cc:129
 PStdModels.cc:130
 PStdModels.cc:131
 PStdModels.cc:132
 PStdModels.cc:133
 PStdModels.cc:134
 PStdModels.cc:135
 PStdModels.cc:136
 PStdModels.cc:137
 PStdModels.cc:138
 PStdModels.cc:139
 PStdModels.cc:140
 PStdModels.cc:141
 PStdModels.cc:142
 PStdModels.cc:143
 PStdModels.cc:144
 PStdModels.cc:145
 PStdModels.cc:146
 PStdModels.cc:147
 PStdModels.cc:148
 PStdModels.cc:149
 PStdModels.cc:150
 PStdModels.cc:151
 PStdModels.cc:152
 PStdModels.cc:153
 PStdModels.cc:154
 PStdModels.cc:155
 PStdModels.cc:156
 PStdModels.cc:157
 PStdModels.cc:158
 PStdModels.cc:159
 PStdModels.cc:160
 PStdModels.cc:161
 PStdModels.cc:162
 PStdModels.cc:163
 PStdModels.cc:164
 PStdModels.cc:165
 PStdModels.cc:166
 PStdModels.cc:167
 PStdModels.cc:168
 PStdModels.cc:169
 PStdModels.cc:170
 PStdModels.cc:171
 PStdModels.cc:172
 PStdModels.cc:173
 PStdModels.cc:174
 PStdModels.cc:175
 PStdModels.cc:176
 PStdModels.cc:177
 PStdModels.cc:178
 PStdModels.cc:179
 PStdModels.cc:180
 PStdModels.cc:181
 PStdModels.cc:182
 PStdModels.cc:183
 PStdModels.cc:184
 PStdModels.cc:185
 PStdModels.cc:186
 PStdModels.cc:187
 PStdModels.cc:188
 PStdModels.cc:189
 PStdModels.cc:190
 PStdModels.cc:191
 PStdModels.cc:192
 PStdModels.cc:193
 PStdModels.cc:194
 PStdModels.cc:195
 PStdModels.cc:196
 PStdModels.cc:197
 PStdModels.cc:198
 PStdModels.cc:199
 PStdModels.cc:200
 PStdModels.cc:201
 PStdModels.cc:202
 PStdModels.cc:203
 PStdModels.cc:204
 PStdModels.cc:205
 PStdModels.cc:206
 PStdModels.cc:207
 PStdModels.cc:208
 PStdModels.cc:209
 PStdModels.cc:210
 PStdModels.cc:211
 PStdModels.cc:212
 PStdModels.cc:213
 PStdModels.cc:214
 PStdModels.cc:215
 PStdModels.cc:216
 PStdModels.cc:217
 PStdModels.cc:218
 PStdModels.cc:219
 PStdModels.cc:220
 PStdModels.cc:221
 PStdModels.cc:222
 PStdModels.cc:223
 PStdModels.cc:224
 PStdModels.cc:225
 PStdModels.cc:226
 PStdModels.cc:227
 PStdModels.cc:228
 PStdModels.cc:229
 PStdModels.cc:230
 PStdModels.cc:231
 PStdModels.cc:232
 PStdModels.cc:233
 PStdModels.cc:234
 PStdModels.cc:235
 PStdModels.cc:236
 PStdModels.cc:237
 PStdModels.cc:238
 PStdModels.cc:239
 PStdModels.cc:240
 PStdModels.cc:241
 PStdModels.cc:242
 PStdModels.cc:243
 PStdModels.cc:244
 PStdModels.cc:245
 PStdModels.cc:246
 PStdModels.cc:247
 PStdModels.cc:248
 PStdModels.cc:249
 PStdModels.cc:250
 PStdModels.cc:251
 PStdModels.cc:252
 PStdModels.cc:253
 PStdModels.cc:254
 PStdModels.cc:255
 PStdModels.cc:256
 PStdModels.cc:257
 PStdModels.cc:258
 PStdModels.cc:259
 PStdModels.cc:260
 PStdModels.cc:261
 PStdModels.cc:262
 PStdModels.cc:263
 PStdModels.cc:264
 PStdModels.cc:265
 PStdModels.cc:266
 PStdModels.cc:267
 PStdModels.cc:268
 PStdModels.cc:269
 PStdModels.cc:270
 PStdModels.cc:271
 PStdModels.cc:272
 PStdModels.cc:273
 PStdModels.cc:274
 PStdModels.cc:275
 PStdModels.cc:276
 PStdModels.cc:277
 PStdModels.cc:278
 PStdModels.cc:279
 PStdModels.cc:280
 PStdModels.cc:281
 PStdModels.cc:282
 PStdModels.cc:283
 PStdModels.cc:284
 PStdModels.cc:285
 PStdModels.cc:286
 PStdModels.cc:287
 PStdModels.cc:288
 PStdModels.cc:289
 PStdModels.cc:290
 PStdModels.cc:291
 PStdModels.cc:292
 PStdModels.cc:293
 PStdModels.cc:294
 PStdModels.cc:295
 PStdModels.cc:296
 PStdModels.cc:297
 PStdModels.cc:298
 PStdModels.cc:299
 PStdModels.cc:300
 PStdModels.cc:301
 PStdModels.cc:302
 PStdModels.cc:303
 PStdModels.cc:304
 PStdModels.cc:305
 PStdModels.cc:306
 PStdModels.cc:307
 PStdModels.cc:308
 PStdModels.cc:309
 PStdModels.cc:310
 PStdModels.cc:311
 PStdModels.cc:312
 PStdModels.cc:313
 PStdModels.cc:314
 PStdModels.cc:315
 PStdModels.cc:316
 PStdModels.cc:317
 PStdModels.cc:318
 PStdModels.cc:319
 PStdModels.cc:320
 PStdModels.cc:321
 PStdModels.cc:322
 PStdModels.cc:323
 PStdModels.cc:324
 PStdModels.cc:325
 PStdModels.cc:326
 PStdModels.cc:327
 PStdModels.cc:328
 PStdModels.cc:329
 PStdModels.cc:330
 PStdModels.cc:331
 PStdModels.cc:332
 PStdModels.cc:333
 PStdModels.cc:334
 PStdModels.cc:335
 PStdModels.cc:336
 PStdModels.cc:337
 PStdModels.cc:338
 PStdModels.cc:339
 PStdModels.cc:340
 PStdModels.cc:341
 PStdModels.cc:342
 PStdModels.cc:343
 PStdModels.cc:344
 PStdModels.cc:345
 PStdModels.cc:346
 PStdModels.cc:347
 PStdModels.cc:348
 PStdModels.cc:349
 PStdModels.cc:350
 PStdModels.cc:351
 PStdModels.cc:352
 PStdModels.cc:353
 PStdModels.cc:354
 PStdModels.cc:355
 PStdModels.cc:356
 PStdModels.cc:357
 PStdModels.cc:358
 PStdModels.cc:359
 PStdModels.cc:360
 PStdModels.cc:361
 PStdModels.cc:362
 PStdModels.cc:363
 PStdModels.cc:364
 PStdModels.cc:365
 PStdModels.cc:366
 PStdModels.cc:367
 PStdModels.cc:368
 PStdModels.cc:369
 PStdModels.cc:370
 PStdModels.cc:371
 PStdModels.cc:372
 PStdModels.cc:373
 PStdModels.cc:374
 PStdModels.cc:375
 PStdModels.cc:376
 PStdModels.cc:377
 PStdModels.cc:378
 PStdModels.cc:379
 PStdModels.cc:380
 PStdModels.cc:381
 PStdModels.cc:382
 PStdModels.cc:383
 PStdModels.cc:384
 PStdModels.cc:385
 PStdModels.cc:386
 PStdModels.cc:387
 PStdModels.cc:388
 PStdModels.cc:389
 PStdModels.cc:390
 PStdModels.cc:391
 PStdModels.cc:392
 PStdModels.cc:393
 PStdModels.cc:394
 PStdModels.cc:395
 PStdModels.cc:396
 PStdModels.cc:397
 PStdModels.cc:398
 PStdModels.cc:399
 PStdModels.cc:400
 PStdModels.cc:401
 PStdModels.cc:402
 PStdModels.cc:403
 PStdModels.cc:404
 PStdModels.cc:405
 PStdModels.cc:406
 PStdModels.cc:407
 PStdModels.cc:408
 PStdModels.cc:409
 PStdModels.cc:410
 PStdModels.cc:411
 PStdModels.cc:412
 PStdModels.cc:413
 PStdModels.cc:414
 PStdModels.cc:415
 PStdModels.cc:416
 PStdModels.cc:417
 PStdModels.cc:418
 PStdModels.cc:419
 PStdModels.cc:420
 PStdModels.cc:421
 PStdModels.cc:422
 PStdModels.cc:423
 PStdModels.cc:424
 PStdModels.cc:425
 PStdModels.cc:426
 PStdModels.cc:427
 PStdModels.cc:428
 PStdModels.cc:429
 PStdModels.cc:430
 PStdModels.cc:431
 PStdModels.cc:432
 PStdModels.cc:433
 PStdModels.cc:434
 PStdModels.cc:435
 PStdModels.cc:436
 PStdModels.cc:437
 PStdModels.cc:438
 PStdModels.cc:439
 PStdModels.cc:440
 PStdModels.cc:441
 PStdModels.cc:442
 PStdModels.cc:443
 PStdModels.cc:444
 PStdModels.cc:445
 PStdModels.cc:446
 PStdModels.cc:447
 PStdModels.cc:448
 PStdModels.cc:449
 PStdModels.cc:450
 PStdModels.cc:451
 PStdModels.cc:452
 PStdModels.cc:453
 PStdModels.cc:454
 PStdModels.cc:455
 PStdModels.cc:456
 PStdModels.cc:457
 PStdModels.cc:458
 PStdModels.cc:459
 PStdModels.cc:460
 PStdModels.cc:461
 PStdModels.cc:462
 PStdModels.cc:463
 PStdModels.cc:464
 PStdModels.cc:465
 PStdModels.cc:466
 PStdModels.cc:467
 PStdModels.cc:468
 PStdModels.cc:469
 PStdModels.cc:470
 PStdModels.cc:471
 PStdModels.cc:472
 PStdModels.cc:473
 PStdModels.cc:474
 PStdModels.cc:475
 PStdModels.cc:476
 PStdModels.cc:477
 PStdModels.cc:478
 PStdModels.cc:479
 PStdModels.cc:480
 PStdModels.cc:481
 PStdModels.cc:482
 PStdModels.cc:483
 PStdModels.cc:484
 PStdModels.cc:485
 PStdModels.cc:486
 PStdModels.cc:487
 PStdModels.cc:488
 PStdModels.cc:489
 PStdModels.cc:490
 PStdModels.cc:491
 PStdModels.cc:492
 PStdModels.cc:493
 PStdModels.cc:494
 PStdModels.cc:495
 PStdModels.cc:496
 PStdModels.cc:497
 PStdModels.cc:498
 PStdModels.cc:499
 PStdModels.cc:500
 PStdModels.cc:501
 PStdModels.cc:502
 PStdModels.cc:503
 PStdModels.cc:504
 PStdModels.cc:505
 PStdModels.cc:506
 PStdModels.cc:507
 PStdModels.cc:508
 PStdModels.cc:509
 PStdModels.cc:510
 PStdModels.cc:511
 PStdModels.cc:512
 PStdModels.cc:513
 PStdModels.cc:514
 PStdModels.cc:515
 PStdModels.cc:516
 PStdModels.cc:517
 PStdModels.cc:518
 PStdModels.cc:519
 PStdModels.cc:520
 PStdModels.cc:521
 PStdModels.cc:522
 PStdModels.cc:523
 PStdModels.cc:524
 PStdModels.cc:525
 PStdModels.cc:526
 PStdModels.cc:527
 PStdModels.cc:528
 PStdModels.cc:529
 PStdModels.cc:530
 PStdModels.cc:531
 PStdModels.cc:532
 PStdModels.cc:533
 PStdModels.cc:534
 PStdModels.cc:535
 PStdModels.cc:536
 PStdModels.cc:537
 PStdModels.cc:538
 PStdModels.cc:539
 PStdModels.cc:540
 PStdModels.cc:541
 PStdModels.cc:542
 PStdModels.cc:543
 PStdModels.cc:544
 PStdModels.cc:545
 PStdModels.cc:546
 PStdModels.cc:547
 PStdModels.cc:548
 PStdModels.cc:549
 PStdModels.cc:550
 PStdModels.cc:551
 PStdModels.cc:552
 PStdModels.cc:553
 PStdModels.cc:554
 PStdModels.cc:555
 PStdModels.cc:556
 PStdModels.cc:557
 PStdModels.cc:558
 PStdModels.cc:559
 PStdModels.cc:560
 PStdModels.cc:561
 PStdModels.cc:562
 PStdModels.cc:563
 PStdModels.cc:564
 PStdModels.cc:565
 PStdModels.cc:566
 PStdModels.cc:567
 PStdModels.cc:568
 PStdModels.cc:569
 PStdModels.cc:570
 PStdModels.cc:571
 PStdModels.cc:572
 PStdModels.cc:573
 PStdModels.cc:574
 PStdModels.cc:575
 PStdModels.cc:576
 PStdModels.cc:577
 PStdModels.cc:578
 PStdModels.cc:579
 PStdModels.cc:580
 PStdModels.cc:581
 PStdModels.cc:582
 PStdModels.cc:583
 PStdModels.cc:584
 PStdModels.cc:585
 PStdModels.cc:586
 PStdModels.cc:587
 PStdModels.cc:588
 PStdModels.cc:589
 PStdModels.cc:590
 PStdModels.cc:591
 PStdModels.cc:592
 PStdModels.cc:593
 PStdModels.cc:594
 PStdModels.cc:595
 PStdModels.cc:596
 PStdModels.cc:597
 PStdModels.cc:598
 PStdModels.cc:599
 PStdModels.cc:600
 PStdModels.cc:601
 PStdModels.cc:602
 PStdModels.cc:603
 PStdModels.cc:604
 PStdModels.cc:605
 PStdModels.cc:606
 PStdModels.cc:607
 PStdModels.cc:608
 PStdModels.cc:609
 PStdModels.cc:610
 PStdModels.cc:611
 PStdModels.cc:612
 PStdModels.cc:613
 PStdModels.cc:614
 PStdModels.cc:615
 PStdModels.cc:616
 PStdModels.cc:617
 PStdModels.cc:618
 PStdModels.cc:619
 PStdModels.cc:620
 PStdModels.cc:621
 PStdModels.cc:622
 PStdModels.cc:623
 PStdModels.cc:624
 PStdModels.cc:625
 PStdModels.cc:626
 PStdModels.cc:627
 PStdModels.cc:628
 PStdModels.cc:629
 PStdModels.cc:630
 PStdModels.cc:631
 PStdModels.cc:632
 PStdModels.cc:633
 PStdModels.cc:634
 PStdModels.cc:635
 PStdModels.cc:636
 PStdModels.cc:637
 PStdModels.cc:638
 PStdModels.cc:639
 PStdModels.cc:640
 PStdModels.cc:641
 PStdModels.cc:642
 PStdModels.cc:643
 PStdModels.cc:644
 PStdModels.cc:645
 PStdModels.cc:646
 PStdModels.cc:647
 PStdModels.cc:648
 PStdModels.cc:649
 PStdModels.cc:650
 PStdModels.cc:651
 PStdModels.cc:652
 PStdModels.cc:653
 PStdModels.cc:654
 PStdModels.cc:655
 PStdModels.cc:656
 PStdModels.cc:657
 PStdModels.cc:658
 PStdModels.cc:659
 PStdModels.cc:660
 PStdModels.cc:661
 PStdModels.cc:662
 PStdModels.cc:663
 PStdModels.cc:664
 PStdModels.cc:665
 PStdModels.cc:666
 PStdModels.cc:667
 PStdModels.cc:668
 PStdModels.cc:669
 PStdModels.cc:670
 PStdModels.cc:671
 PStdModels.cc:672
 PStdModels.cc:673
 PStdModels.cc:674
 PStdModels.cc:675
 PStdModels.cc:676
 PStdModels.cc:677
 PStdModels.cc:678
 PStdModels.cc:679
 PStdModels.cc:680
 PStdModels.cc:681
 PStdModels.cc:682
 PStdModels.cc:683
 PStdModels.cc:684
 PStdModels.cc:685
 PStdModels.cc:686
 PStdModels.cc:687
 PStdModels.cc:688
 PStdModels.cc:689
 PStdModels.cc:690
 PStdModels.cc:691
 PStdModels.cc:692
 PStdModels.cc:693
 PStdModels.cc:694
 PStdModels.cc:695
 PStdModels.cc:696
 PStdModels.cc:697
 PStdModels.cc:698
 PStdModels.cc:699
 PStdModels.cc:700
 PStdModels.cc:701
 PStdModels.cc:702
 PStdModels.cc:703
 PStdModels.cc:704
 PStdModels.cc:705
 PStdModels.cc:706
 PStdModels.cc:707
 PStdModels.cc:708
 PStdModels.cc:709
 PStdModels.cc:710
 PStdModels.cc:711
 PStdModels.cc:712
 PStdModels.cc:713
 PStdModels.cc:714
 PStdModels.cc:715
 PStdModels.cc:716
 PStdModels.cc:717
 PStdModels.cc:718
 PStdModels.cc:719
 PStdModels.cc:720
 PStdModels.cc:721
 PStdModels.cc:722
 PStdModels.cc:723
 PStdModels.cc:724
 PStdModels.cc:725
 PStdModels.cc:726
 PStdModels.cc:727
 PStdModels.cc:728
 PStdModels.cc:729
 PStdModels.cc:730
 PStdModels.cc:731
 PStdModels.cc:732
 PStdModels.cc:733
 PStdModels.cc:734
 PStdModels.cc:735
 PStdModels.cc:736
 PStdModels.cc:737
 PStdModels.cc:738
 PStdModels.cc:739
 PStdModels.cc:740
 PStdModels.cc:741
 PStdModels.cc:742
 PStdModels.cc:743
 PStdModels.cc:744
 PStdModels.cc:745
 PStdModels.cc:746
 PStdModels.cc:747
 PStdModels.cc:748
 PStdModels.cc:749
 PStdModels.cc:750
 PStdModels.cc:751
 PStdModels.cc:752
 PStdModels.cc:753
 PStdModels.cc:754
 PStdModels.cc:755
 PStdModels.cc:756
 PStdModels.cc:757
 PStdModels.cc:758
 PStdModels.cc:759
 PStdModels.cc:760
 PStdModels.cc:761
 PStdModels.cc:762
 PStdModels.cc:763
 PStdModels.cc:764
 PStdModels.cc:765
 PStdModels.cc:766
 PStdModels.cc:767
 PStdModels.cc:768
 PStdModels.cc:769
 PStdModels.cc:770
 PStdModels.cc:771
 PStdModels.cc:772
 PStdModels.cc:773
 PStdModels.cc:774
 PStdModels.cc:775
 PStdModels.cc:776
 PStdModels.cc:777
 PStdModels.cc:778
 PStdModels.cc:779
 PStdModels.cc:780
 PStdModels.cc:781
 PStdModels.cc:782
 PStdModels.cc:783
 PStdModels.cc:784
 PStdModels.cc:785
 PStdModels.cc:786
 PStdModels.cc:787
 PStdModels.cc:788
 PStdModels.cc:789
 PStdModels.cc:790
 PStdModels.cc:791
 PStdModels.cc:792
 PStdModels.cc:793
 PStdModels.cc:794
 PStdModels.cc:795
 PStdModels.cc:796
 PStdModels.cc:797
 PStdModels.cc:798
 PStdModels.cc:799
 PStdModels.cc:800
 PStdModels.cc:801
 PStdModels.cc:802
 PStdModels.cc:803
 PStdModels.cc:804
 PStdModels.cc:805
 PStdModels.cc:806
 PStdModels.cc:807
 PStdModels.cc:808
 PStdModels.cc:809
 PStdModels.cc:810
 PStdModels.cc:811
 PStdModels.cc:812
 PStdModels.cc:813
 PStdModels.cc:814
 PStdModels.cc:815
 PStdModels.cc:816
 PStdModels.cc:817
 PStdModels.cc:818
 PStdModels.cc:819
 PStdModels.cc:820
 PStdModels.cc:821
 PStdModels.cc:822
 PStdModels.cc:823
 PStdModels.cc:824
 PStdModels.cc:825
 PStdModels.cc:826
 PStdModels.cc:827
 PStdModels.cc:828
 PStdModels.cc:829
 PStdModels.cc:830
 PStdModels.cc:831
 PStdModels.cc:832
 PStdModels.cc:833
 PStdModels.cc:834
 PStdModels.cc:835
 PStdModels.cc:836
 PStdModels.cc:837
 PStdModels.cc:838
 PStdModels.cc:839
 PStdModels.cc:840
 PStdModels.cc:841
 PStdModels.cc:842
 PStdModels.cc:843
 PStdModels.cc:844
 PStdModels.cc:845
 PStdModels.cc:846
 PStdModels.cc:847
 PStdModels.cc:848
 PStdModels.cc:849
 PStdModels.cc:850
 PStdModels.cc:851
 PStdModels.cc:852
 PStdModels.cc:853
 PStdModels.cc:854
 PStdModels.cc:855
 PStdModels.cc:856
 PStdModels.cc:857
 PStdModels.cc:858
 PStdModels.cc:859
 PStdModels.cc:860
 PStdModels.cc:861
 PStdModels.cc:862
 PStdModels.cc:863
 PStdModels.cc:864
 PStdModels.cc:865
 PStdModels.cc:866
 PStdModels.cc:867
 PStdModels.cc:868
 PStdModels.cc:869
 PStdModels.cc:870
 PStdModels.cc:871
 PStdModels.cc:872
 PStdModels.cc:873
 PStdModels.cc:874
 PStdModels.cc:875
 PStdModels.cc:876
 PStdModels.cc:877
 PStdModels.cc:878
 PStdModels.cc:879
 PStdModels.cc:880
 PStdModels.cc:881
 PStdModels.cc:882
 PStdModels.cc:883
 PStdModels.cc:884
 PStdModels.cc:885