10 #include "KVElasticScatter.h"
11 #include "KVMultiDetArray.h"
13 #include "KVDetector.h"
36 fIntLayer = fNDets = 0;
46 Warning(
"KVElasticScatter",
"gMultiDetArray does not refer to a valid multidetector array");
47 printf(
"Define it before using this class, and put it in simulation mode : gMultiDetArray->SetSimMode(kTRUE)");
57 KVElasticScatter::~KVElasticScatter()
84 fMultiLayer = (fTarget->NumberOfLayers() > 1);
125 Error(
"SetDetector",
"Detector %s is unknown!", det);
129 if (!fDetector->GetNode()->GetForwardTrajectories()) {
130 Error(
"SetDetector",
"There is no forwards trajectory from detector %s:", det);
133 if (fDetector->GetNode()->GetForwardTrajectories()->GetEntries() > 1) {
134 Error(
"SetDetector",
"Ambiguous: there is more than one forwards trajectory from detector %s:", det);
135 fDetector->GetNode()->GetForwardTrajectories()->ls();
138 auto traj = (
KVGeoDNTrajectory*)fDetector->GetNode()->GetForwardTrajectories()->First();
141 fAlignedDetectors.Clear();
143 traj->IterateBackFrom();
147 while ((gdn = traj->GetNextNode()) && gdn != fDetector->GetNode()) {
149 fAlignedDetectors.Add(
d);
151 if (fDetInd.HasParameter(
d->GetType())) {
155 newname.
Form(
"%s_%d",
d->GetType(), j++);
156 while (fDetInd.HasParameter(newname.
Data()))
157 newname.
Form(
"%s_%d",
d->GetType(), j++);
158 fDetInd.SetValue(newname.
Data(), i);
161 fDetInd.SetValue(
d->GetType(), i);
186 "<KVElasticScatter::SetTargetScatteringLayer> : No target set. Set run first."
190 fIntLayer = fTarget->GetLayerIndex(
name);
192 fTarget->SetInteractionLayer(fIntLayer, fBeamDirection);
220 if (!fProj.IsDefined()) {
222 "<KVElasticScatter::CalculateScattering> : Set projectile properties first"
228 "<KVElasticScatter::CalculateScattering> : Set projectile energy first"
234 "<KVElasticScatter::CalculateScattering> : Set detector first" <<
240 "<KVElasticScatter::CalculateScattering> : No target set. Set run first."
257 new TH1F(
"hDepth",
"Depth (mg/cm2)", 500, 0.,
258 fTarget->GetTotalEffectiveThickness());
259 fTheta =
new TH1F(
"hTheta",
"Theta (deg.)", 500, 0., 0.);
265 fHistos =
new TObjArray(fAlignedDetectors.GetSize());
272 TIter n(&fAlignedDetectors);
273 while ((
d = (KVDetector*)
n())) {
276 TH1F(
Form(
"hEloss_%s",
d->GetName()),
"Eloss (MeV)", fBinE, 0., 0.));
284 fProj.SetEnergy(fEnergy);
291 fTarget->SetInteractionLayer(fIntLayer, fBeamDirection);
294 fTarget->GetInteractionPoint(&fProj);
300 TVector3 IP = fTarget->GetInteractionPoint();
305 fKinematics->SetTarget(t);
312 fKinematics->SetEDiss(fExx);
317 for (
int i = 0; i <
N; i++) {
319 fTarget->SetIncoming();
320 fTarget->DetectParticle(&fProj);
321 fKinematics->SetProjectile(fProj);
322 if (!has_outgoing) fOutgoing = fProj;
324 fKinematics->SetOutgoing(fOutgoing);
326 fKinematics->CalculateKinematics();
331 fDetector->GetRandomAngles(th, ph);
338 fKinematics->GetELab(3, th, 3, e1, e2);
340 fOutgoing.SetTheta(th);
341 fOutgoing.SetPhi(ph);
342 xsec =
TMath::Abs(fKinematics->GetXSecRuthLab(fOutgoing.GetTheta()));
343 fTheta->Fill(fOutgoing.GetTheta(), xsec);
345 fTarget->SetOutgoing();
347 fTarget->DetectParticle(&fOutgoing);
348 fDepth->Fill(IP.
z());
353 while ((
d = (KVDetector*)
n())) {
354 auto cew =
d->GetCentreOfEntranceWindow();
355 d->DetectParticle(&fOutgoing, &cew);
357 ((
TH1F*)(*fHistos)[j++])->Fill(
d->GetEnergy(), xsec);
361 fProj.SetEnergy(fEnergy);
363 fProj.GetParameters()->Clear();
364 fOutgoing.GetParameters()->Clear();
367 fTarget->SetInteractionLayer(fIntLayer, fBeamDirection);
370 fTarget->GetInteractionPoint(&fProj);
374 targ_mat = fTarget->GetLayer(fTarget->GetInteractionPoint());
377 fKinematics->SetTarget(t);
380 IP = fTarget->GetInteractionPoint();
401 return (fDetInd.HasParameter(
type) ? GetEnergy(fDetInd.GetIntValue(
type)) : 0);
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
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 Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
char * Form(const char *fmt,...)
Relativistic binary kinematics calculator.
Calculate elastic scattering spectra in multidetector arrays.
void SetDetector(const Char_t *det)
Set name of detector which will detect particle.
TH1F * GetEnergy()
Return pointer to energy loss histogram for chosen detector (in MeV)
void CalculateScattering(Int_t N)
void SetEbinning(Int_t nbins=500)
void SetProjectile(Int_t Z, Int_t A)
Set projectile Z and A.
void SetRun(Int_t run)
Set detector parameters, target, etc. for run.
void SetTargetScatteringLayer(const Char_t *name)
void SetEnergy(Double_t E)
Set energy of projectile in MeV.
Path taken by particles through multidetector geometry.
Information on relative positions of detectors & particle trajectories.
KVDetector * GetDetector() const
virtual KVDetector * GetDetector(const Char_t *name) const
Return detector in this structure with given name.
Description of physical materials used to construct detectors & targets; interface to range tables.
virtual void SetParameters(UInt_t n, Bool_t physics_parameters_only=kFALSE)
virtual void SetSimMode(Bool_t on=kTRUE)
Description of properties and kinematics of atomic nuclei.
void SetZ(Int_t z, Char_t mt=-1)
void SetZandA(Int_t z, Int_t a)
Set atomic number and mass number.
void SetRandomized(Bool_t r=kTRUE)
const char * Data() const
void Form(const char *fmt,...)
Double_t Max(Double_t a, Double_t b)