KaliVeda
Toolkit for HIC analysis
Loading...
Searching...
No Matches
KVIDINDRACsI.cpp
1/***************************************************************************
2 KVIDINDRACsI.cpp - description
3 -------------------
4 begin : Fri Feb 20 2004
5 copyright : (C) 2004 by J.D. Frankland
6 email : frankland@ganil.fr
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#include "KVIDINDRACsI.h"
19#include "TMath.h"
20#include "KVIdentificationResult.h"
21#include <KVIDGCsI.h>
22#include <KVINDRADetector.h>
23#include <KVReconstructedNucleus.h>
24
26
27
28
29
31{
32 CsIGrid = 0;
33
34 // thresholds used by filter for Rapide-Lente identifications
35 fThresMin[0][0] = 1;
36 fThresMax[0][0] = 2; // protons
37 fThresMin[0][1] = 2;
38 fThresMax[0][1] = 6; // deutons
39 fThresMin[0][2] = 5;
40 fThresMax[0][2] = 11; // tritons
41 fThresMin[0][3] = -1;
42 fThresMax[0][3] = -1; // 4H - NO!
43 fThresMin[1][0] = -1;
44 fThresMax[1][0] = -1; // 1He - NO!
45 fThresMin[1][1] = -1;
46 fThresMax[1][1] = -1; // 2He - NO!
47 fThresMin[1][2] = 20;
48 fThresMax[1][2] = 40; // 3He
49 fThresMin[1][3] = 1;
50 fThresMax[1][3] = 3; // alphas
51
52 /* in principle all CsI telescopes can identify mass & charge */
53 SetHasMassID(kTRUE);
54}
55
56
57
58
69
71{
72 // Particle identification and code setting using identification grid
73 //
74 // Note that gamma identification code is no longer attributed here: in case a gamma is identified,
75 // the IDR->IDcode will be the same general ID code as for all CsI particles,
76 // but IDR->IDquality == KVIDGCsI::kICODE10
77 //
78 // The KVIdentificationResult is first Clear()ed; then it is filled with IDtype = GetType()
79 // of this identification telescope, IDattempted = true, and the results of the identification
80 // procedure.
81
82 IDR->Clear();
83 IDR->IDattempted = true;
84 IDR->SetIDType(GetType());
85
86 //perform identification
87 Double_t X, Y;
90 if (CsIGrid->IsIdentifiable(X, Y, &IDR->Rejecting_Cut)) {
91 CsIGrid->Identify(X, Y, IDR);
92 }
93 else if (IDR->Rejecting_Cut.Contains("gamma")) {
94 // gamma rejection
96 IDR->Z = 0;
97 IDR->A = 0;
98 IDR->IDOK = kTRUE;
99 IDR->SetComment("gamma");
100 }
101 else {
102 // rejected by some arbitrary cut line/contour
104 IDR->Z = 0;
105 IDR->A = 0;
106 IDR->IDOK = kFALSE;
107 IDR->SetComment(Form("rejected by cut:%s", IDR->Rejecting_Cut.Data()));
108 }
109
110 // set general ID code
111 IDR->IDcode = GetIDCode();
112
113 return kTRUE;
114}
115
116
117
134
136{
137 // For filtering simulations (only implemented for Rapide-Lente identification)
138 //
139 // FILTERING WITH RAPIDE-LENTE IDENTIFICATIONS
140 // If n->GetEnergy() is above threshold for mass identification, we set
141 // n->IsAMeasured(kTRUE) (and n->IsZMeasured(kTRUE)).
142 // Otherwise, we just set n->IsZMeasured(kTRUE) and use the A given by
143 // the mass formula for the particle
144 //
145 // individual thresholds defined for 1H, 2H, 3H, 3He, 4He
146 // for A>5 identification if CsI energy > 40 MeV
147 //
148 // If A is not measured, we make sure the KE of the particle corresponds to the simulated one
149 //
150 // FILTERING WITH OTHER IDENTIFICATION
151 // The nucleus is declared to be Z & A identified, whatever its identity or energy
152
153 n->SetZMeasured();
154
155 if (fRapideLente) {
156 if (n->GetA() > 5) {
157 if (GetDetector(1)->GetEnergy() > 40)
158 n->SetAMeasured();
159 else {
160 double e = n->GetE();
161 n->SetZ(n->GetZ());
162 n->SetE(e);
163 }
164 return;
165 }
166 if (fThresMin[n->GetZ() - 1][n->GetA() - 1] > 0) {
167 Bool_t okmass = gRandom->Uniform() < smootherstep(fThresMin[n->GetZ() - 1][n->GetA() - 1], fThresMax[n->GetZ() - 1][n->GetA() - 1], GetDetector(1)->GetEnergy());
168 if (okmass) {
169 n->SetAMeasured();
170 }
171 }
172 else {
173 double e = n->GetE();
174 n->SetZ(n->GetZ());
175 n->SetE(e);
176 }
177 }
178 else //
179 n->SetAMeasured();
180}
181
182
183
184
186
187float KVIDINDRACsI::clamp(float x, float lowerlimit, float upperlimit)
188{
189 if (x < lowerlimit)
190 x = lowerlimit;
191 if (x > upperlimit)
192 x = upperlimit;
193 return x;
194}
195
196
197
200
201float KVIDINDRACsI::smootherstep(float edge0, float edge1, float x)
202{
203 // Scale, and clamp x to 0..1 range
204 x = clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);
205 // Evaluate polynomial
206 return x * x * x * (x * (x * 6 - 15) + 10);
207}
208
209
#define e(i)
bool Bool_t
constexpr Bool_t kFALSE
double Double_t
constexpr Bool_t kTRUE
#define X(type, name)
R__EXTERN TRandom * gRandom
char * Form(const char *fmt,...)
virtual const Char_t * GetType() const
Definition KVBase.h:177
virtual void Identify(Double_t, Double_t, KVIdentificationResult *) const =0
virtual Bool_t IsIdentifiable(Double_t, Double_t, TString *rejected_by=nullptr) const
const Char_t * GetName() const
float clamp(float x, float lowerlimit, float upperlimit)
Int_t fThresMin[2][4]
min ID thresholds (smooth step)
virtual Bool_t Identify(KVIdentificationResult *, Double_t x=-1., Double_t y=-1.)
Int_t fThresMax[2][4]
max ID thresholds (smooth step)
void SetIdentificationStatus(KVReconstructedNucleus *n)
Bool_t fRapideLente
set to true when using rapide-lente grid i.e. KVIDGCsI
KVIDGraph * CsIGrid
telescope's grid
float smootherstep(float edge0, float edge1, float x)
Scale, and clamp x to 0..1 range.
KVDetector * GetDetector(UInt_t n) const
virtual UShort_t GetIDCode()
void GetIDGridCoords(Double_t &X, Double_t &Y, KVIDGraph *grid, Double_t x=-1, Double_t y=-1)
Full result of one attempted particle identification.
Bool_t IDattempted
=kTRUE if identification was attempted
Bool_t IDOK
general quality of identification, =kTRUE if acceptable identification made
void SetGridName(const Char_t *n)
void SetComment(const Char_t *c)
void Clear(Option_t *opt="")
Reset to initial values.
TString Rejecting_Cut
name of cut in grid which rejected particle for identification
Int_t A
A of particle found (if Aident==kTRUE)
Int_t Z
Z of particle found (if Zident==kTRUE)
Int_t IDquality
specific quality code returned by identification procedure
Int_t IDcode
a general identification code for this type of identification
void SetIDType(const Char_t *t)
Nuclei reconstructed from data measured by a detector array .
virtual Double_t Uniform(Double_t x1, Double_t x2)
const char * Data() const
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Double_t y[n]
Double_t x[n]
const Int_t n
ClassImp(TPyArg)