Pluto v6.3.0
Loading...
Searching...
No Matches
PScatterCrossSection.cc
Go to the documentation of this file.
1
2//
3//
4// Author: I. Froehlich
6
7
8using namespace std;
9#include <sstream>
10#include <iostream>
11#include <iomanip>
12
14#include "PDynamicData.h"
15
17
19 Fatal("PScatterCrossSection", "Wrong ctor called");
20};
21
22PScatterCrossSection::PScatterCrossSection(const Char_t *id, const Char_t *de) :
23 PAngularDistribution(id, de) {
24
25 beam = target = NULL;
26 pf2 = NULL;
27 qmax = 0.0;
28 qmin = -1;
29 npx = npy = -1;
30
31 TF1 *dummy = new TF1("dummy", "1", -1, 1);
32 SetAngleFunction(dummy);
33
34};
35
37 return new PScatterCrossSection((const PScatterCrossSection &)* this);
38};
39
40void PScatterCrossSection::SetNpx(Int_t my_npx) {
41 npx = my_npx;
42 if (pf2) pf2->SetNpx(npx);
43};
44
45void PScatterCrossSection::SetNpy(Int_t my_npy) {
46 npy = my_npy;
47 if (pf2) pf2->SetNpy(npy);
48};
49
51 if (qmin < 0) {
52 Error("MakeVars", "Range of the c.m. energy not defined");
53 return kFALSE;
54 }
55 if (!pf2) {
56 pf2 = new PF2("", -1., 1., qmin, qmax);
57 if (npx > 0) pf2->SetNpx(npx);
58 if (npy > 0) pf2->SetNpy(npy);
59 }
60
63 return kTRUE;
64};
65
66Bool_t PScatterCrossSection::AddEquation(char *command) {
67 if (!MakeVars()) return kFALSE;
68 return pf2->Add(command);
69};
70
71Bool_t PScatterCrossSection::AddHistogram(TH1 *histo, char *command) {
72 if (!MakeVars()) return kFALSE;
73 return pf2->Add(histo, command);
74};
75
76Bool_t PScatterCrossSection::AddHistogram(TH2 *histo, char *command) {
77 if (!MakeVars()) return kFALSE;
78 return pf2->Add(histo, command);
79};
80
82 if (!PAngularDistribution:: Init()) return kFALSE;
83
84 if (!beam || !target) {
85 Warning("Init", "beam or target not found");
86 return kFALSE;
87 }
88
89 return kTRUE;
90};
91
93
95
96 if (!pf2) {
97 Error("Prepare", "Function not defined");
98 return kFALSE;
99 }
100
101 pf2->GetRandom2(costheta, q);
102
103 Double_t m_t = target->M();
104 Double_t m_b = beam->M();
105
106 //momentum fixed target:
107 Double_t mom_b = sqrt( pow( (q*q-m_b*m_b-m_t*m_t)/(2*m_t) ,2) - m_b*m_b );
108
109 //cout << costheta << ":" << q << ":" << mom_b << endl;
110
111 if (std::isnan(mom_b)) {
112 return kFALSE;
113 }
114
115 //return kTRUE;
116 //Make a copy of beam and target:
117 PParticle my_beam(beam);
118 PParticle my_target(target);
119
120 my_beam.Boost(-my_target.BoostVector());
121 my_beam.SetMom(mom_b);
122 my_beam.Boost(my_target.BoostVector());
123
124 beam->SetVect(my_beam.Vect());
125 beam->SetM(m_b);
126
127 parent->Reconstruct();
128
129 return kTRUE;
130};
131
132
133
135 return costheta;
136}
PDynamicData * makeDynamicData()
ClassImp(PScatterCrossSection) PScatterCrossSection
PStaticData * makeStaticData()
Bool_t Prepare(void)
PParticle * GetBatchParticle(const char *name, Int_t make_val=1)
Definition PF2.h:12
void SetMom(Double_t mom=0.)
void SetNpx(Int_t my_npx)
void SetNpy(Int_t my_npy)
Bool_t AddHistogram(TH2 *histo, char *command)
PDistribution * Clone(const char *delme=NULL) const
Bool_t AddEquation(char *command)
Double_t * GetBatchValue(const char *name, Int_t make_val=1)
TH1F * histo