4 #include "KVDetectionSimulator.h"
5 #include "KVGeoNavigator.h"
17 KVBase(Form("DetectionSimulator_%s", a->GetName()),
18 Form("Simulate detection of particles or events in detector array %s", a->GetTitle())),
19 fArray(a), fCalcTargELoss(kTRUE)
109 auto part_to_detect = (
KVNucleus*)part.GetFrame(detection_frame,
kFALSE);
112 part_to_detect->SetE0();
113 part.SetParameter(
"SIM:Z", part.GetZ());
114 part.SetParameter(
"SIM:A", part.GetA());
115 part.SetParameter(
"SIM:ENERGY", part_to_detect->GetE());
116 part.SetParameter(
"SIM:THETA", part_to_detect->GetTheta());
117 part.SetParameter(
"SIM:PHI", part_to_detect->GetPhi());
122 part.SetParameter(
"UNDETECTED",
"NEUTRON");
126 part.SetParameter(
"UNDETECTED",
"NOT IN RANGE TABLE");
129 part.SetParameter(
"UNDETECTED",
"AT REST");
134 auto ebef = part_to_detect->GetE();
136 auto eLostInTarget = ebef - part_to_detect->GetE();
137 part.SetParameter(
"ENERGY LOSS IN TARGET", eLostInTarget);
139 part.SetParameter(
"UNDETECTED",
"STOPPED IN TARGET");
147 if (part.GetZ() == 0) {
149 part.SetParameter(
"UNDETECTED",
"NEUTRON");
152 if (part.GetParameters()->HasParameter(
"DEADZONE")) {
154 part.SetParameter(
"UNDETECTED",
"DEAD ZONE");
158 part.SetParameter(
"UNDETECTED",
"NO HIT");
169 part.SetParameter(
"RESIDUAL ENERGY", part_to_detect->GetE());
170 if (part.GetParameters()->HasParameter(
"DEADZONE"))
171 part.SetParameter(
"DETECTED",
"DEADZONE");
173 part.SetParameter(
"DETECTED",
"PUNCH THROUGH");
176 part.SetParameter(
"DETECTED",
"OK");
179 if (!nvl.IsEmpty()) {
180 for (
Int_t ii = 0; ii < nvl.GetNpar(); ++ii) {
181 part.SetParameter(nvl.GetNameAt(ii), nvl.GetDoubleValue(ii));
188 part_to_detect->SetMomentum(*part_to_detect->GetPInitial());
232 KVDetector* last_detector =
nullptr;
247 last_detector = curDet;
257 traj =
Form(
"%s/", det_name.
Data());
261 part->
SetParameter(
"GROUP", (
int)curDet->GetGroupNumber());
269 part->
SetParameter(
"STOPPING DETECTOR", last_detector->GetName());
R__EXTERN TGeoManager * gGeoManager
char * Form(const char *fmt,...)
Class for iterating over nuclei in events accessed through base pointer/reference.
Base class for KaliVeda framework.
Simulate detection of events in a detector array.
KVTarget * GetTarget() const
void DetectEvent(KVEvent *event, const Char_t *detection_frame="")
Double_t GetMinKECutOff() const
KVNameValueList PropagateParticle(KVNucleus *)
TString fDetectionFrame
when true, only consider geometry, not particle energies
KVRangeTableGeoNavigator * get_array_navigator() const
name of kinematical frame used in last call to DetectEvent()
Bool_t IncludeTargetEnergyLoss() const
KVDetectorEvent fHitGroups
array used for detection
Bool_t fGeoFilter
whether to include energy loss in target, if defined
void AddGroup(KVGroup *grp)
Abstract base class container for multi-particle events.
Bool_t IsTracking() const
void ResetTrackID(Int_t id=0)
virtual KVDetector * GetDetector(const Char_t *name) const
Return detector in this structure with given name.
Base class for describing the geometry of a detector array.
Handles lists of named parameters with different types, a list of KVNamedParameter objects.
void SetValue(const Char_t *name, value_type value)
Int_t GetNpar() const
return the number of stored parameters
Bool_t HasStringParameter(const Char_t *name) const
const Char_t * GetStringValue(const Char_t *name) const
Bool_t HasParameter(const Char_t *name) const
KVHashList * GetList() const
A generic named parameter storing values of different types.
Double_t GetDouble() const
Description of properties and kinematics of atomic nuclei.
KVNameValueList * GetParameters() const
void SetParameter(const Char_t *name, ValType value) const
void PropagateParticle(KVNucleus *, TVector3 *TheOrigin=0) override
We start a new track to represent the particle's trajectory through the array.
Bool_t CheckIonForRangeTable(Int_t Z, Int_t A)
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
void Begin(TString delim) const
KVString Next(Bool_t strip_whitespace=kFALSE) const
void DetectParticle(KVNucleus *, TVector3 *norm=0) override
const char * GetName() const override
const char * Data() const
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
TString & Prepend(char c, Ssiz_t rep=1)