1 #include "KVDetector.h"
7 #include "KVTelescope.h"
9 #include "KVCalibrator.h"
20 #include "KVCalibratedSignal.h"
21 #include "KVDetectorSignalExpression.h"
22 #include "KVZDependentCalibratedSignal.h"
45 fActiveLayer =
nullptr;
47 fIDTelescopes->SetCleanup(
kTRUE);
49 fIDTelAlign->SetCleanup(
kTRUE);
51 fIdentP = fUnidentP = 0;
53 fDepthInTelescope = 0.;
54 fELossF = fEResF = fRangeF = 0;
56 fAlignedDetectors[0] = 0;
57 fAlignedDetectors[1] = 0;
61 fParentStrucList.SetCleanup();
63 fNode.SetDetector(
this);
65 fDetSignals.SetOwner();
68 fDetSignals.ReplaceObjects();
112 #if ROOT_VERSION_CODE >= ROOT_VERSION(3,4,0)
120 #if ROOT_VERSION_CODE >= ROOT_VERSION(3,4,0)
136 TIter next(fAbsorbers);
142 Int_t in_actif = fAbsorbers->IndexOf(fActiveLayer);
151 KVDetector::~KVDetector()
216 if (kvp->
GetKE() <= 0.)
227 std::vector<Double_t> thickness;
237 thickness[i++] =
abs->GetThickness();
239 abs->SetThickness(
T);
250 abs->SetThickness(thickness[i++]);
287 std::vector<Double_t> thickness;
297 thickness[i++] =
abs->GetThickness();
299 abs->SetThickness(
T);
309 abs->SetThickness(thickness[i++]);
349 Einc =
abs->GetParticleEIncFromERes(&clone_part, norm);
352 clone_part.
SetKE(Einc);
369 if (!strcmp(opt,
"data")) {
388 cout <<
"(Belongs to an unidentified particle)";
391 else if (!strcmp(opt,
"all")) {
402 cout <<
" ### ACTIVE LAYER ### " << endl;
406 cout <<
" #################### " << endl;
409 cout <<
option <<
" --- Detected particles:" << endl;
413 cout <<
option <<
" --- Detector belongs to the following Identification Telescopes:" << endl;
505 Error(
"AddCalibrator",
"Detector:%s has no signal %s, required as input by calibrator %s to provide output %s",
517 Warning(
"AddCalibrator",
"%s : output signal not defined for calibrator %s. No output signal created.",
606 if (strncmp(opt,
"N", 1)) {
656 Error(
"GetAbsorber",
"No absorber list");
660 Error(
"GetAbsorber",
"Nothing in absorber list");
664 Error(
"GetAbsorber",
"i=%d but only %d absorbers in list", i,
683 if (
K->GetOutputSignalType() !=
"") {
772 while ((idt = next())) {
851 if (!transmission) solution =
kEmin;
866 if (transmission && ERES > 0.) {
883 return (EINC - ERES);
926 ELOSS = (ELOSS < 0. ?
GetEnergy() : ELOSS);
927 if (ELOSS <= 0)
return 0;
934 UInt_t last_positive_difference_z = 1;
936 if (mass_formula > -1)
941 while (zmax > zmin + 1) {
947 if (difference < 0.0) {
950 z += (
UInt_t)((zmax - z) / 2 + 0.5);
956 last_positive_difference_z = z;
957 z -= (
UInt_t)((z - zmin) / 2 + 0.5);
961 if (difference < 0) {
964 z = last_positive_difference_z;
1036 if (!mat)
return 0.;
1046 range += this_range;
1048 Einc = mat->
GetERes(Z, A, Einc);
1052 range += this_range;
1141 if (!(ph =
LoadPlugin(
"KVDetector", det_type))) {
1179 Double_t dist_to_back = depth + layer_thickness;
1255 med =
abs->GetGeoMedium();
1258 if (thick == 0.0)
continue;
1260 for (
int i = 0; i < 8; i++) {
1261 vertices[2 * i] = coords[i].
X();
1262 vertices[2 * i + 1] = coords[i].
Y();
1267 else vol_name =
Form(
"%s_%d_%s",
GetName(), no_abs,
abs->GetType());
1273 Double_t trans_z = -tot_thick_det / 2. + depth_in_det + dz;
1275 mother_vol->
AddNode(vol, 1, tr);
1281 depth_in_det += thick;
1351 cout <<
"(" <<
v.X() <<
"," <<
v.Y() <<
"," <<
v.Z() <<
")";
1379 auto printvec = [](
const TVector3 &
v) {
1380 cout <<
"(" <<
v.X() <<
"," <<
v.Y() <<
"," <<
v.Z() <<
")";
1386 cout <<
"DETECTOR COORDINATES (in cm):" << endl;
1387 cout <<
"=================================" << endl;
1389 printvec(coords[0]);
1392 printvec(coords[1]);
1395 printvec(coords[2]);
1398 printvec(coords[3]);
1401 cout <<
"DETECTOR DIMENSIONS (in cm):" << endl;
1402 cout <<
"================================" << endl;
1407 cout <<
" AB = " <<
c << endl;
1408 cout <<
" BC = " <<
b << endl;
1409 cout <<
" CD = " <<
d << endl;
1410 cout <<
" AD = " <<
a << endl;
1412 cout <<
"DETECTOR SURFACE AREA = ";
1414 surf =
sqrt(surf) / 400.0;
1415 cout << surf <<
" cm2" << endl;
1435 0., 1.e+04, 2,
"KVDetector",
"EResDet");
1460 0., 1.e+04, 2,
"KVDetector",
"RangeDet");
1485 0., 1.e+04, 2,
"KVDetector",
"ELossActive");
1556 return Einc -
GetERes(Z, A, Einc);
1572 if (Einc <= 0.)
return 0.;
1576 if (eres < 0.) eres = 0.;
1629 if (Z < 1)
return 0.;
1684 if (Z < 1 || Eres <= 0.)
return 0.;
1686 if (Einc <= 0.)
return 0.;
1707 if (Z < 1 || Eres <= 0.)
return 0.;
1733 if (maxmin < 0.) maxmin =
abs->GetEmaxValid(Z, A);
1735 if (
abs->GetEmaxValid(Z, A) < maxmin) maxmin =
abs->GetEmaxValid(Z, A);
1780 TEnv fEnvFile(envrc);
1784 while (!layers.
End()) {
1791 thick = dens = press = 0.;
1793 if (pS !=
"" && tS !=
"") {
1800 else if (tS !=
"") {
1805 else if (dS !=
"") {
1857 if (!
GetGroup() || direction > 1)
return 0x0;
1869 if (!
GetGroup() || direction > 1)
return;
1937 punch->
SetTitle(
Form(
"Simple Punch-through %s (MeV) (mass formula %d)",
GetName(), massform));
1940 for (
int Z = 1; Z <= 92; Z++) {
1962 punch->
SetTitle(
Form(
"Simple Punch-through %s (AMeV) (mass formula %d)",
GetName(), massform));
1965 for (
int Z = 1; Z <= 92; Z++) {
2020 if (strcmp(
name,
"")) {
2110 pn->
Align(
nullptr, newshape);
2136 for (
int iabs = 0; iabs < nabs; ++iabs) {
2173 return (ds !=
nullptr);
const Bool_t kIterBackward
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
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
R__EXTERN TGeoManager * gGeoManager
char * Form(const char *fmt,...)
virtual const Char_t * GetType() const
virtual Bool_t IsType(const Char_t *typ) const
virtual void SetType(const Char_t *str)
Double_t ProtectedGetX(const TF1 *func, Double_t val, int &status, Double_t xmin=0.0, Double_t xmax=0.0) const
static TPluginHandler * LoadPlugin(const Char_t *base, const Char_t *uri="0")
Output signal from detector obtained by calibration.
virtual Bool_t IsAvailableFor(const KVNameValueList ¶ms) const
Base class for all detector calibrations.
TString GetInputSignalType() const
void SetDetector(KVDetector *d)
TString GetOutputSignalType() const
Signal output from a mathematical combination of other signals.
Base class for output signal data produced by a detector.
virtual Bool_t IsExpression() const
virtual Bool_t IsRaw() const
virtual Bool_t GetValueNeedsExtraParameters() const
virtual Double_t GetValue(const KVNameValueList ¶ms="") const
Base class for detector geometry description.
static KVDetector * MakeDetector(const Char_t *name, Float_t thick)
virtual const Char_t * GetArrayName()
virtual Bool_t IsOK() const
void SetMatrix(const TGeoHMatrix *m)
KVPosition fEWPosition
position of entrance window i.e. first volume in detector geometry
virtual Double_t GetMaxDeltaE(Int_t Z, Int_t A)
KVUniqueNameList fParentStrucList
list of geometry structures which directly contain this detector
Int_t GetNumberOfAbsorberLayers() const
virtual void GetVerticesInOwnFrame(TVector3 *, Double_t, Double_t)
virtual Double_t GetERes(Int_t Z, Int_t A, Double_t Einc)
virtual Double_t GetELostByParticle(KVNucleus *, TVector3 *norm=0)
Double_t ELossActive(Double_t *x, Double_t *par)
TList * GetTelescopesForIdentification()
virtual void AddIDTelescope(TObject *idt)
Add ID telescope to list of telescopes to which detector belongs.
KVList * GetAlignedIDTelescopes()
KVList * fCalibrators
list of associated calibrator objects
KVGeoStrucElement * GetParentStructure(const Char_t *type, const Char_t *name="") const
KVGroup * GetGroup() const
void AddDetectorSignal(KVDetectorSignal *ds)
virtual Double_t GetRange(Int_t Z, Int_t A, Double_t Einc)
virtual void SetEnergyLoss(Double_t e) const
Bool_t ReplaceCalibrator(const Char_t *type, KVCalibrator *cal, const KVNameValueList &opts="")
virtual Double_t GetTotalDeltaE(Int_t Z, Int_t A, Double_t Einc)
virtual TGeoVolume * GetGeoVolume()
virtual Double_t GetEnergy() const
virtual TF1 * GetEResFunction(Int_t Z, Int_t A)
virtual Double_t GetEIncOfMaxDeltaE(Int_t Z, Int_t A)
virtual TGraph * DrawPunchThroughEsurAVsZ(Int_t massform=KVNucleus::kBetaMass)
void AddAbsorber(KVMaterial *)
virtual Double_t GetEnergyLoss() const
virtual Double_t GetEResAfterDetector() const
KVList * fIDTelescopes
list of ID telescopes to which detector belongs
void SetShape(TGeoBBox *s)
void AddParentStructure(KVGeoStrucElement *elem)
Double_t GetTheta() const
Double_t fEResforEinc
used by GetIncidentEnergy & GetCorrectedEnergy
KVList * fIDTelAlign
list of ID telescopes made of this detector and all aligned detectors placed in front of it
virtual Int_t FindZmin(Double_t ELOSS=-1., Char_t mass_formula=-1)
TF1 * fELossF
parametric function dE in active layer vs. incident energy
TList * fAlignedDetectors[2]
stores lists of aligned detectors in both directions
virtual void Clear(Option_t *opt="")
const KVPosition & GetEntranceWindow() const
KVMaterial * GetAbsorber(Int_t i) const
Returns pointer to the i-th absorber in the detector (i=0 first absorber, i=1 second,...
void remove_signal_for_calibrator(KVCalibrator *K)
KVList * fAbsorbers
list of absorbers making up the detector
TList * fIDTele4Ident
list of ID telescopes used for particle ID
TF1 * fEResF
parametric function Eres residual energy after all layers of detector
virtual Double_t GetSmallestEmaxValid(Int_t Z, Int_t A)
Bool_t HasSameStructureAs(const KVDetector *) const
void SetThickness(Double_t thick)
virtual void AddToGeometry()
virtual Double_t GetIncidentEnergy(Int_t Z, Int_t A, Double_t delta_e=-1.0, enum SolType type=kEmax)
virtual KVDetectorSignal * GetDetectorSignal(const KVString &type) const
virtual void ReadDefinitionFromFile(const Char_t *)
Double_t GetTotalThicknessInCM()
Bool_t IsCalibrated() const
virtual TF1 * GetELossFunction(Int_t Z, Int_t A)
void SetActiveLayer(KVMaterial *actif)
Bool_t BelongsToUnidentifiedParticle() const
Double_t RangeDet(Double_t *x, Double_t *par)
KVMaterial * GetActiveLayer() const
virtual void RemoveCalibrators()
virtual Double_t GetEntranceWindowSurfaceArea()
Return surface area of first layer of detector in cm2.
virtual TGraph * DrawPunchThroughEnergyVsZ(Int_t massform=KVNucleus::kBetaMass)
KVUniqueNameList fDetSignals
list of signals associated with detector
virtual Double_t GetPunchThroughEnergy(Int_t Z, Int_t A)
Int_t fUnidentP
temporary counters, determine state of identified/unidentified particle flags
TF1 * fRangeF
parametric function range of particles in detector
Bool_t AddDetectorSignalExpression(const KVString &type, const KVString &_expr)
virtual Double_t GetParticleEIncFromERes(KVNucleus *, TVector3 *norm=0)
virtual void SetEResAfterDetector(Double_t e)
void SetActiveLayerMatrix(const TGeoHMatrix *)
Set ROOT geometry global matrix transformation to coordinate frame of active layer volume.
virtual void Copy(TObject &obj) const
void RemoveParentStructure(KVGeoStrucElement *elem)
const KVSeqCollection & GetListOfDetectorSignals() const
KVList * fParticles
list of particles hitting detector in an event
virtual TList * GetAlignedDetectors(UInt_t direction=1)
KVGeoDetectorNode * GetNode()
void SetEntranceWindowMatrix(const TGeoHMatrix *)
Set ROOT geometry global matrix transformation to coordinate frame of entrance window.
virtual Double_t GetDeltaE(Int_t Z, Int_t A, Double_t Einc)
Double_t EResDet(Double_t *x, Double_t *par)
Double_t fDepthInTelescope
used to store depth of detector in parent telescope
KVMaterial * fActiveLayer
The active absorber in the detector.
void AddHit(KVNucleus *part)
KVCalibrator * GetCalibrator(const Char_t *name, const Char_t *type) const
virtual Double_t GetIncidentEnergyFromERes(Int_t Z, Int_t A, Double_t Eres)
Int_t fIdentP
temporary counters, determine state of identified/unidentified particle flags
virtual Double_t GetDeltaEFromERes(Int_t Z, Int_t A, Double_t Eres)
void SetEntranceWindowShape(TGeoBBox *)
Set ROOT geometry shape of entrance window.
void ResetAlignedDetectors(UInt_t direction=1)
virtual void DetectParticle(KVNucleus *, TVector3 *norm=0)
void SetActiveLayerShape(TGeoBBox *)
Set ROOT geometry shape of active layer volume.
void SetAnalysed(Bool_t b=kTRUE)
TString fFName
dynamically generated full name of detector
virtual void Print(Option_t *option="") const
Bool_t fSingleLayer
=kTRUE if detector has a single absorber layer
virtual Double_t GetLinearRange(Int_t Z, Int_t A, Double_t Einc)
virtual TF1 * GetRangeFunction(Int_t Z, Int_t A)
virtual Double_t GetCorrectedEnergy(KVNucleus *, Double_t e=-1., Bool_t transmission=kTRUE)
void init()
default initialisations
Bool_t AddCalibrator(KVCalibrator *cal, const KVNameValueList &opts="")
Double_t fTotThickness
used to store value calculated by GetTotalThicknessInCM
TGeoBBox * GetShape() const
virtual void SetMaterial(const Char_t *type)
Path taken by particles through multidetector geometry.
const KVSeqCollection * GetIDTelescopes() const
const Char_t * GetFullPathToNode() const
Base class describing elements of array geometry.
Group of detectors which can be treated independently of all others in array.
const KVGeoDNTrajectory * GetTrajectoryForReconstruction(const KVGeoDNTrajectory *t, const KVGeoDetectorNode *n) const
Extended TList class which owns its objects by default.
Description of physical materials used to construct detectors & targets; interface to range tables.
virtual void SetThickness(Double_t thick)
virtual Double_t GetThickness() const
virtual Double_t GetPunchThroughEnergy(Int_t Z, Int_t A)
virtual void SetMaterial(const Char_t *type)
virtual Double_t GetERes(Int_t Z, Int_t A, Double_t Einc)
virtual Double_t GetDeltaE(Int_t Z, Int_t A, Double_t Einc)
virtual void Clear(Option_t *opt="")
Reset absorber - set stored energy lost by particles in absorber to zero.
virtual Double_t GetLinearRange(Int_t Z, Int_t A, Double_t Einc)
Handles lists of named parameters with different types, a list of KVNamedParameter objects.
void SetValue(const Char_t *name, value_type value)
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.
void SetZ(Int_t z, Char_t mt=-1)
void SetMassFormula(UChar_t mt)
Int_t GetZ() const
Return the number of proton / atomic number.
TVector3 * GetPInitial() const
TVector3 GetMomentum() const
KVNameValueList * GetParameters() const
Double_t GetEnergy() const
void SetKE(Double_t ecin)
void SetMomentum(const TVector3 *v)
void SetE0(TVector3 *e=0)
void SetEnergy(Double_t e)
Base class used for handling geometry in a multidetector array.
virtual void SetShape(TGeoBBox *)
Bool_t ROOTGeo() const
Returns kTRUE if ROOT geometry is used, kFALSE if not.
void GetCornerCoordinates(TVector3 *, Double_t=0)
virtual Double_t GetDistance(void) const
virtual Double_t GetSurfaceArea(int npoints=100000) const
virtual void SetMatrix(const TGeoHMatrix *)
virtual TGeoBBox * GetShape() const
void GetCornerCoordinatesInOwnFrame(TVector3 *, Double_t=0)
KaliVeda extensions to ROOT collection classes.
virtual void Clear(Option_t *option="")
virtual Int_t GetSize() const
virtual TObject * At(Int_t idx) const
KVSeqCollection * GetSubListWithType(const Char_t *retvalue) const
virtual TObject * FindObjectByType(const Char_t *) const
virtual void Add(TObject *obj)
virtual TObject * Remove(TObject *obj)
Remove object from list.
virtual void Delete(Option_t *option="")
virtual TObject * FindObject(const char *name) const
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
void Begin(TString delim) const
void RBegin(TString delim) const
KVString Next(Bool_t strip_whitespace=kFALSE) const
KVString RNext(Bool_t strip_whitespace=kFALSE) const
Associates two detectors placed one behind the other.
Int_t GetDetectorRank(KVDetector *kvd)
returns position (1=front, 2=next, etc.) detector in the telescope structure
Double_t GetDepthInCM(Int_t ndet) const
virtual void Add(TObject *obj)
Handle several calibrations valid for different Z ranges.
virtual void Print(Option_t *option, const char *wildcard, Int_t recurse=1) const
void ls(Option_t *option="") const override
virtual void AddAll(const TCollection *col)
virtual Int_t GetEntries() const
virtual const char * GetValue(const char *name, const char *dflt) const
virtual void SetRange(Double_t xmin, Double_t xmax)
void SetTitle(const char *title="") override
virtual void SetNpx(Int_t npx=100)
virtual Double_t GetX(Double_t y, Double_t xmin=0, Double_t xmax=0, Double_t epsilon=1.E-10, Int_t maxiter=100, Bool_t logx=false) const
virtual void GetRange(Double_t &xmin, Double_t &xmax) const
virtual void SetParameters(const Double_t *params)
virtual Double_t Eval(Double_t x, Double_t y=0, Double_t z=0, Double_t t=0) const
virtual Double_t GetMaximum(Double_t xmin=0, Double_t xmax=0, Double_t epsilon=1.E-10, Int_t maxiter=100, Bool_t logx=false) const
virtual Double_t GetMaximumX(Double_t xmin=0, Double_t xmax=0, Double_t epsilon=1.E-10, Int_t maxiter=100, Bool_t logx=false) const
virtual Double_t GetDX() const
virtual Double_t GetFacetArea(Int_t index=0) const
virtual Double_t GetDY() const
TClass * IsA() const override
TGeoVolume * MakeArb8(const char *name, TGeoMedium *medium, Double_t dz, Double_t *vertices=nullptr)
void RefreshPhysicalNodes(Bool_t lock=kTRUE)
TGeoPhysicalNode * MakePhysicalNode(const char *path=nullptr)
TGeoVolumeAssembly * MakeVolumeAssembly(const char *name)
TGeoVolume * GetTopVolume() const
TObjArray * GetListOfPhysicalNodes()
virtual Int_t GetDefaultColor() const
TGeoMaterial * GetMaterial() const
Bool_t Align(TGeoMatrix *newmat=nullptr, TGeoShape *newshape=nullptr, Bool_t check=kFALSE, Double_t ovlp=0.001)
TGeoShape * GetShape(Int_t level=-1) const
void SetAngles(Double_t phi, Double_t theta, Double_t psi)
virtual Double_t GetRmin() const
virtual Double_t GetRmax() const
virtual TGeoNode * AddNode(TGeoVolume *vol, Int_t copy_no, TGeoMatrix *mat=nullptr, Option_t *option="")
void SetLineColor(Color_t lcolor) override
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
void SetName(const char *name="") override
void SetTitle(const char *title="") override
void Clear(Option_t *option="") override
void Add(TObject *obj) override
TObject * Clone(const char *newname="") const override
const char * GetName() const override
virtual void SetName(const char *name)
TObject * FindObject(const char *name) const override
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
virtual const char * ClassName() const
virtual void Warning(const char *method, const char *msgfmt,...) const
virtual Bool_t InheritsFrom(const char *classname) const
virtual void Error(const char *method, const char *msgfmt,...) const
Longptr_t ExecPlugin(int nargs)
const char * Data() const
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Expr< UnaryOp< Sqrt< T >, SMatrix< T, D, D2, R >, T >, T, D, D2, R > sqrt(const SMatrix< T, D, D2, R > &rhs)
T Mag(const SVector< T, D > &rhs)
RVec< PromoteType< T > > abs(const RVec< T > &v)
RVec< PromoteTypes< T0, T1 > > pow(const T0 &x, const RVec< T1 > &v)
double dist(AxisAngle const &r1, AxisAngle const &r2)