KaliVeda
Toolkit for HIC analysis
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 "TRandom.h"
22 #include <KVIDGCsI.h>
23 #include <KVINDRADetector.h>
24 #include <KVReconstructedNucleus.h>
25 
27 
28 
29 
32 {
33  CsIGrid = 0;
34 
35  // thresholds used by filter for Rapide-Lente identifications
36  fThresMin[0][0] = 1;
37  fThresMax[0][0] = 2; // protons
38  fThresMin[0][1] = 2;
39  fThresMax[0][1] = 6; // deutons
40  fThresMin[0][2] = 5;
41  fThresMax[0][2] = 11; // tritons
42  fThresMin[0][3] = -1;
43  fThresMax[0][3] = -1; // 4H - NO!
44  fThresMin[1][0] = -1;
45  fThresMax[1][0] = -1; // 1He - NO!
46  fThresMin[1][1] = -1;
47  fThresMax[1][1] = -1; // 2He - NO!
48  fThresMin[1][2] = 20;
49  fThresMax[1][2] = 40; // 3He
50  fThresMin[1][3] = 1;
51  fThresMax[1][3] = 3; // alphas
52 
53  /* in principle all CsI telescopes can identify mass & charge */
54  SetHasMassID(kTRUE);
55 }
56 
57 
58 
59 
68 
70 {
71  // Particle identification and code setting using identification grid
72  //
73  // Note that gamma identification code is no longer attributed here: in case a gamma is identified,
74  // the IDR->IDcode will be the same general ID code as for all CsI particles,
75  // but IDR->IDquality == KVIDGCsI::kICODE10
76  //
77 
78  //perform identification
80 
81  if(IDR->IDOK)
82  {
83  if(IDR->Z==0)
84  {
85  // well-identified particle with Z=0 is a gamma
87  IDR->Z = 0;
88  IDR->A = 0;
89  IDR->IDOK = kTRUE;
90  IDR->SetComment("gamma");
91  }
92  }
93  else if (IDR->Rejecting_Cut.Contains("gamma")) {
94  // gamma identification
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 
127 
129 {
130  // For filtering simulations
131  //
132  // If energy loss in CsI is above threshold for mass identification, we set
133  // IDR->Aident=true (and IDR->Zident=true).
134  // Otherwise, we just set IDR->Zident=true and A will be given by mass formula for the particle
135  //
136  // individual thresholds defined for 1H, 2H, 3H, 3He, 4He
137  // for A>5 identification if CsI energy > 40 MeV
138 
140  if (!IDR->IDOK) return; // check for weird identifications of non-existent nuclei
141 
142  IDR->Zident = true;
143 
144  if (IDR->A > 5) {
145  if (GetDetector(1)->GetEnergy() > 40)
146  IDR->Aident = true;
147  return;
148  }
149  if (fThresMin[IDR->Z - 1][IDR->A - 1] > 0) {
150  Bool_t okmass = gRandom->Uniform() < smootherstep(fThresMin[IDR->Z - 1][IDR->A - 1],
151  fThresMax[IDR->Z - 1][IDR->A - 1], GetDetector(1)->GetEnergy());
152  if (okmass) {
153  IDR->Aident = true;
154  }
155  }
156 }
157 
158 
159 
160 
162 
163 float KVIDINDRACsI::clamp(float x, float lowerlimit, float upperlimit)
164 {
165  if (x < lowerlimit)
166  x = lowerlimit;
167  if (x > upperlimit)
168  x = upperlimit;
169  return x;
170 }
171 
172 
173 
176 
177 float KVIDINDRACsI::smootherstep(float edge0, float edge1, float x)
178 {
179  // Scale, and clamp x to 0..1 range
180  x = clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);
181  // Evaluate polynomial
182  return x * x * x * (x * (x * 6 - 15) + 10);
183 }
184 
185 
bool Bool_t
constexpr Bool_t kFALSE
double Double_t
constexpr Bool_t kTRUE
R__EXTERN TRandom * gRandom
char * Form(const char *fmt,...)
Bool_t Identify(KVIdentificationResult *, Double_t x=-1., Double_t y=-1.) override
float clamp(float x, float lowerlimit, float upperlimit)
Int_t fThresMin[2][4]
min ID thresholds (smooth step)
Definition: KVIDINDRACsI.h:34
Int_t fThresMax[2][4]
max ID thresholds (smooth step)
Definition: KVIDINDRACsI.h:35
void SetIdentificationStatus(KVIdentificationResult *IDR, const KVNucleus *) override
float smootherstep(float edge0, float edge1, float x)
Scale, and clamp x to 0..1 range.
virtual Bool_t Identify(KVIdentificationResult *, Double_t x=-1., Double_t y=-1.)
KVDetector * GetDetector(UInt_t n) const
virtual UShort_t GetIDCode()
virtual void SetIdentificationStatus(KVIdentificationResult *IDR, const KVNucleus *)
Full result of one attempted particle identification.
Bool_t IDOK
general quality of identification, =kTRUE if acceptable identification made
void SetComment(const Char_t *c)
TString Rejecting_Cut
name of cut in grid which rejected particle for identification
Bool_t Aident
= kTRUE if A of particle established
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
Bool_t Zident
=kTRUE if Z of particle established
Description of properties and kinematics of atomic nuclei.
Definition: KVNucleus.h:123
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]
ClassImp(TPyArg)