10 #include "KVElasticCountRates.h"
11 #include "KVMultiDetArray.h"
13 #include "KVDetector.h"
17 #include "KVNucleus.h"
35 fAngularRange = {theta_min, theta_max, phi_min, phi_max};
43 bool KVElasticCountRates::initial_checks_and_reset()
45 fArrayHistos.Delete();
47 fGlobalMap =
new TH2F(
"hGlobalMap",
"X-section in x(vert)-y(hori) plane",
48 500, -fAngularRange.GetThetaMax(), fAngularRange.GetThetaMax(),
49 500, -fAngularRange.GetThetaMax(), fAngularRange.GetThetaMax());
57 void KVElasticCountRates::reset_before_new_scattering()
59 det_sim.ClearHitGroups();
67 std::pair<double, double> KVElasticCountRates::get_random_angles_for_scattering(
const KV2Body&)
71 fAngularRange.GetRandomAngles(theta, phi,
"random");
80 void KVElasticCountRates::detect_particle_fill_histograms(
KVNucleus* ejectile,
double theta,
double phi,
double xsec)
83 auto detectors = det_sim.PropagateParticle(ejectile);
84 FillHistograms(&detectors, theta, phi, xsec);
91 void KVElasticCountRates::end_of_run()
93 PrintResults(fBeamIntensity);
114 for (
int i = 0; i < ndets; i++) {
120 histo =
new TH1F(detname,
Form(
"Eloss in %s", detname.
Data()), GetEbinning(), 0, 0);
121 fArrayHistos.Add(histo);
127 histo =
new TH1F(detname +
"_dW",
Form(
"Solid angle of %s", detname.
Data()), GetEbinning(), 0, 0);
128 fArrayHistos.Add(histo);
133 histo2 =
new TH2F(detname +
"_map",
Form(
"Map of %s", detname.
Data()), 100, 0, 0, 100, 0, 0);
134 fArrayHistos.Add(histo2);
136 histo2->
Fill(theta, phi, xsec);
160 count_rate(
TString n,
double c,
double e,
double t,
double p,
double f,
double d,
double i)
161 : detector(
n), counts(
c), energy(
e), theta(t), phi(
p), fluence(
f), dissipation(
d), intXsec(i) {}
164 printf(
"%s \t: N=%8.2f/sec. \t <E>=%7.1f MeV \t Tot.Xsec=%9.3E barn \t fluence=%9.3E/sec./cm**2 \t dissip.=%9.3E MeV/sec./cm**2\n",
165 detector.
Data(), counts, energy, intXsec, fluence, dissipation);
191 bool compare_count_rates(count_rate a, count_rate b)
194 return a.theta <
b.theta;
206 TIter it(&fArrayHistos);
210 std::vector<count_rate> count_rates;
212 while ((
h = (
TH1F*)it())) {
214 if (!
name.EndsWith(
"_dW") && !
name.EndsWith(
"_map")) {
217 double intXsec =
h->
Integral() * fVolume / fNtirages;
219 double rate = fAtomicDensity * beam_intensity * intXsec;
225 count_rates.push_back(
226 count_rate(
name, rate, emean, map->
GetMean(), map->
GetMean(2), fluence, dissipation, intXsec)
231 std::sort(count_rates.begin(), count_rates.end(), compare_count_rates);
233 for (std::vector<count_rate>::iterator it = count_rates.begin(); it != count_rates.end(); ++it) {
247 nl.
SetName(
"Generated by KVElasticCountRates::PutResultsInList method");
250 TIter it(&fArrayHistos);
253 nl.
SetValue(
"Intensity(pps)", beam_intensity);
255 std::vector<count_rate> count_rates;
257 while ((
h = (
TH1F*)it())) {
259 if (!
name.EndsWith(
"_dW") && !
name.EndsWith(
"_map")) {
262 double intXsec =
h->
Integral() * fVolume / fNtirages;
264 double rate = fAtomicDensity * beam_intensity * intXsec;
270 count_rates.push_back(
271 count_rate(
name, rate, emean, map->
GetMean(), map->
GetMean(2), fluence, dissipation, intXsec)
276 std::sort(count_rates.begin(), count_rates.end(), compare_count_rates);
278 for (std::vector<count_rate>::iterator it = count_rates.begin(); it != count_rates.end(); ++it) {
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t b
char * Form(const char *fmt,...)
Relativistic binary kinematics calculator.
Extension of TDatime to handle various useful date formats.
Base class for detector geometry description, interface to energy-loss calculations.
virtual Double_t GetEntranceWindowSurfaceArea()
Return surface area of first layer of detector in cm2.
void Clear(Option_t *opt="") override
Calculate elastic scattering count rates in the detectors of multidetector arrays ,...
void PrintResults(Double_t beam_intensity=1.e+07)
Print mean energy deposit & counting rate for given beam intensity in particles per second.
KVNameValueList PutResultsInList(Double_t beam_intensity=1.e+07)
Print mean energy deposit & counting rate for given beam intensity in particles per second.
void FillHistograms(const KVNameValueList *, double theta, double phi, double xsec)
virtual KVDetector * GetDetector(const Char_t *name) const
Return detector in this structure with given name.
Handles lists of named parameters with different types, a list of KVNamedParameter objects.
Double_t GetDoubleValue(const Char_t *name) const
void SetValue(const Char_t *name, value_type value)
const Char_t * GetNameAt(Int_t idx) const
Int_t GetNpar() const
return the number of stored parameters
const Char_t * GetStringValue(const Char_t *name) const
Bool_t HasParameter(const Char_t *name) const
Description of properties and kinematics of atomic nuclei.
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
const char * AsSQLString() const
virtual Double_t GetMean(Int_t axis=1) const
TObject * FindObject(const char *name) const override
virtual Int_t Fill(const char *name, Double_t w)
virtual Double_t Integral(Int_t binx1, Int_t binx2, Option_t *option="") const
virtual Int_t Fill(const char *namex, const char *namey, Double_t w)
virtual void SetTitle(const char *title="")
const char * GetName() const override
virtual void SetName(const char *name)
const char * Data() const
RVec< PromoteType< T > > cos(const RVec< T > &v)
RVec< PromoteType< T > > sin(const RVec< T > &v)
constexpr Double_t DegToRad()
Utility class used by KVElasticCountRates to store results.