10 #include "KVElasticScatter.h"
11 #include "KVMultiDetArray.h"
13 #include "KVDetector.h"
36 fIntLayer = fNDets = 0;
45 Warning(
"KVElasticScatter",
"gMultiDetArray does not refer to a valid multidetector array");
46 printf(
"Define it before using this class, and put it in simulation mode : gMultiDetArray->SetSimMode(kTRUE)");
56 KVElasticScatter::~KVElasticScatter()
83 fMultiLayer = (fTarget->NumberOfLayers() > 1);
125 Error(
"SetDetector",
"Detector %s is unknown!", det);
129 if(!fDetector->GetNode()->GetForwardTrajectories())
131 Error(
"SetDetector",
"There is no forwards trajectory from detector %s:",det);
134 if(fDetector->GetNode()->GetForwardTrajectories()->GetEntries()>1)
136 Error(
"SetDetector",
"Ambiguous: there is more than one forwards trajectory from detector %s:",det);
137 fDetector->GetNode()->GetForwardTrajectories()->ls();
140 auto traj = (
KVGeoDNTrajectory*)fDetector->GetNode()->GetForwardTrajectories()->First();
143 fAlignedDetectors.Clear();
145 traj->IterateBackFrom();
149 while ((gdn = traj->GetNextNode()) && gdn!=fDetector->GetNode()) {
151 fAlignedDetectors.Add(
d);
153 if (fDetInd.HasParameter(
d->GetType())) {
157 newname.
Form(
"%s_%d",
d->GetType(), j++);
158 while (fDetInd.HasParameter(newname.
Data()))
159 newname.
Form(
"%s_%d",
d->GetType(), j++);
160 fDetInd.SetValue(newname.
Data(), i);
163 fDetInd.SetValue(
d->GetType(), i);
188 "<KVElasticScatter::SetTargetScatteringLayer> : No target set. Set run first."
192 fIntLayer = fTarget->GetLayerIndex(
name);
194 fTarget->SetInteractionLayer(fIntLayer, fBeamDirection);
222 if (!fProj.IsDefined()) {
224 "<KVElasticScatter::CalculateScattering> : Set projectile properties first"
230 "<KVElasticScatter::CalculateScattering> : Set projectile energy first"
236 "<KVElasticScatter::CalculateScattering> : Set detector first" <<
242 "<KVElasticScatter::CalculateScattering> : No target set. Set run first."
259 new TH1F(
"hDepth",
"Depth (mg/cm2)", 500, 0.,
260 fTarget->GetTotalEffectiveThickness());
261 fTheta =
new TH1F(
"hTheta",
"Theta (deg.)", 500, 0., 0.);
267 fHistos =
new TObjArray(fAlignedDetectors.GetSize());
274 TIter n(&fAlignedDetectors);
275 while ((
d = (KVDetector*)
n())) {
278 TH1F(
Form(
"hEloss_%s",
d->GetName()),
"Eloss (MeV)", fBinE, 0., 0.));
286 fProj.SetEnergy(fEnergy);
293 fTarget->SetInteractionLayer(fIntLayer, fBeamDirection);
296 fTarget->GetInteractionPoint(&fProj);
302 TVector3 IP = fTarget->GetInteractionPoint();
307 fKinematics->SetTarget(t);
313 fKinematics->SetEDiss(fExx);
318 for (
int i = 0; i <
N; i++) {
320 fTarget->SetIncoming();
321 fTarget->DetectParticle(&fProj);
322 fKinematics->SetProjectile(fProj);
323 fKinematics->SetOutgoing(fProj);
324 fKinematics->CalculateKinematics();
329 fDetector->GetRandomAngles(th, ph);
336 fKinematics->GetELab(3, th, 3, e1, e2);
340 xsec =
TMath::Abs(fKinematics->GetXSecRuthLab(fProj.GetTheta()));
341 fTheta->Fill(fProj.GetTheta(), xsec);
343 fTarget->SetOutgoing();
344 fTarget->DetectParticle(&fProj);
345 fDepth->Fill(IP.
z());
350 while ((
d = (KVDetector*)
n())) {
351 auto cew =
d->GetCentreOfEntranceWindow();
352 d->DetectParticle(&fProj, &cew);
354 ((
TH1F*)(*fHistos)[j++])->Fill(
d->GetEnergy(), xsec);
358 fProj.SetEnergy(fEnergy);
360 fProj.GetParameters()->Clear();
363 fTarget->SetInteractionLayer(fIntLayer, fBeamDirection);
366 fTarget->GetInteractionPoint(&fProj);
370 targ_mat = fTarget->GetLayer(fTarget->GetInteractionPoint());
373 fKinematics->SetTarget(t);
376 IP = fTarget->GetInteractionPoint();
397 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)