/////////////////////////////////////////////////////////////////////
//
// General purpose resonance mass sampling 
// Resonance shapes can be defined by a TF1-object
// This class allows to "play" around with different resonance shapes
// in coupled-channel calculations
//
//                                  Author:  Froehlich
/////////////////////////////////////////////////////////////////////


using namespace std;
#include <sstream>
#include <iostream>
#include <iomanip>

#include "PMassSampling.h"


ClassImp(PMassSampling)

PMassSampling::PMassSampling()  {
}

PMassSampling::PMassSampling(const Char_t *id, const Char_t *de, Int_t key) :
    PHadronModel(id, de, key) {
    
    shape1 = NULL;
}

PDistribution *PMassSampling::Clone(const char *) const {
    return new PMassSampling((const PMassSampling &)* this);
}

Bool_t PMassSampling::SampleMass(Double_t *mass, Int_t *) {
    if (!shape1) {
	Warning("SampleMass", "(%s): no TF1 found", GetDescription());
	mass[0] = 0;
	return kFALSE;
    }
    mass[0] = shape1->GetRandom();
    return kTRUE;
}

Double_t PMassSampling::GetWeight(Double_t *mass, Int_t *) {
    if (!shape1) {
	Warning("GetWeight", "(%s): no TF1 found", GetDescription());
	return 0;
    }
    return shape1->Eval(mass[0]);
}

 PMassSampling.cc:1
 PMassSampling.cc:2
 PMassSampling.cc:3
 PMassSampling.cc:4
 PMassSampling.cc:5
 PMassSampling.cc:6
 PMassSampling.cc:7
 PMassSampling.cc:8
 PMassSampling.cc:9
 PMassSampling.cc:10
 PMassSampling.cc:11
 PMassSampling.cc:12
 PMassSampling.cc:13
 PMassSampling.cc:14
 PMassSampling.cc:15
 PMassSampling.cc:16
 PMassSampling.cc:17
 PMassSampling.cc:18
 PMassSampling.cc:19
 PMassSampling.cc:20
 PMassSampling.cc:21
 PMassSampling.cc:22
 PMassSampling.cc:23
 PMassSampling.cc:24
 PMassSampling.cc:25
 PMassSampling.cc:26
 PMassSampling.cc:27
 PMassSampling.cc:28
 PMassSampling.cc:29
 PMassSampling.cc:30
 PMassSampling.cc:31
 PMassSampling.cc:32
 PMassSampling.cc:33
 PMassSampling.cc:34
 PMassSampling.cc:35
 PMassSampling.cc:36
 PMassSampling.cc:37
 PMassSampling.cc:38
 PMassSampling.cc:39
 PMassSampling.cc:40
 PMassSampling.cc:41
 PMassSampling.cc:42
 PMassSampling.cc:43
 PMassSampling.cc:44
 PMassSampling.cc:45
 PMassSampling.cc:46
 PMassSampling.cc:47
 PMassSampling.cc:48
 PMassSampling.cc:49
 PMassSampling.cc:50
 PMassSampling.cc:51
 PMassSampling.cc:52