KaliVeda  1.13/01
Heavy-Ion Analysis Toolkit
KVIDINDRACsI.cpp
Go to the documentation of this file.
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 
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;
88  GetIDGridCoords(X, Y, CsIGrid, x, y);
89  IDR->SetGridName(CsIGrid->GetName());
90  if (CsIGrid->IsIdentifiable(X, Y, &IDR->Rejecting_Cut)) {
91  CsIGrid->Identify(X, Y, IDR);
92  }
93  else {
94  // gamma rejection
96  IDR->Z = 0;
97  IDR->A = 0;
98  IDR->IDOK = kTRUE;
99  IDR->SetComment("gamma");
100  }
101 
102  // set general ID code
103  IDR->IDcode = GetIDCode();
104 
105  return kTRUE;
106 }
107 
108 
109 
126 
128 {
129  // For filtering simulations (only implemented for Rapide-Lente identification)
130  //
131  // FILTERING WITH RAPIDE-LENTE IDENTIFICATIONS
132  // If n->GetEnergy() is above threshold for mass identification, we set
133  // n->IsAMeasured(kTRUE) (and n->IsZMeasured(kTRUE)).
134  // Otherwise, we just set n->IsZMeasured(kTRUE) and use the A given by
135  // the mass formula for the particle
136  //
137  // individual thresholds defined for 1H, 2H, 3H, 3He, 4He
138  // for A>5 identification if CsI energy > 40 MeV
139  //
140  // If A is not measured, we make sure the KE of the particle corresponds to the simulated one
141  //
142  // FILTERING WITH OTHER IDENTIFICATION
143  // The nucleus is declared to be Z & A identified, whatever its identity or energy
144 
145  n->SetZMeasured();
146 
147  if (fRapideLente) {
148  if (n->GetA() > 5) {
149  if (GetDetector(1)->GetEnergy() > 40)
150  n->SetAMeasured();
151  else {
152  double e = n->GetE();
153  n->SetZ(n->GetZ());
154  n->SetE(e);
155  }
156  return;
157  }
158  if (fThresMin[n->GetZ() - 1][n->GetA() - 1] > 0) {
159  Bool_t okmass = gRandom->Uniform() < smootherstep(fThresMin[n->GetZ() - 1][n->GetA() - 1], fThresMax[n->GetZ() - 1][n->GetA() - 1], GetDetector(1)->GetEnergy());
160  if (okmass) {
161  n->SetAMeasured();
162  }
163  }
164  else {
165  double e = n->GetE();
166  n->SetZ(n->GetZ());
167  n->SetE(e);
168  }
169  }
170  else //
171  n->SetAMeasured();
172 }
173 
174 
175 
176 
178 
179 float KVIDINDRACsI::clamp(float x, float lowerlimit, float upperlimit)
180 {
181  if (x < lowerlimit)
182  x = lowerlimit;
183  if (x > upperlimit)
184  x = upperlimit;
185  return x;
186 }
187 
188 
189 
192 
193 float KVIDINDRACsI::smootherstep(float edge0, float edge1, float x)
194 {
195  // Scale, and clamp x to 0..1 range
196  x = clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);
197  // Evaluate polynomial
198  return x * x * x * (x * (x * 6 - 15) + 10);
199 }
200 
201 
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
#define e(i)
bool Bool_t
double Double_t
const Bool_t kTRUE
R__EXTERN TRandom * gRandom
virtual const Char_t * GetType() const
Definition: KVBase.h:176
virtual void Identify(Double_t, Double_t, KVIdentificationResult *) const =0
virtual Bool_t IsIdentifiable(Double_t, Double_t, TString *rejected_by=nullptr) const
Definition: KVIDGraph.cpp:1269
const Char_t * GetName() const
Definition: KVIDGraph.cpp:1332
float clamp(float x, float lowerlimit, float upperlimit)
Int_t fThresMin[2][4]
min ID thresholds (smooth step)
Definition: KVIDINDRACsI.h:33
virtual Bool_t Identify(KVIdentificationResult *, Double_t x=-1., Double_t y=-1.)
Int_t fThresMax[2][4]
max ID thresholds (smooth step)
Definition: KVIDINDRACsI.h:34
void SetIdentificationStatus(KVReconstructedNucleus *n)
Bool_t fRapideLente
set to true when using rapide-lente grid i.e. KVIDGCsI
Definition: KVIDINDRACsI.h:32
KVIDGraph * CsIGrid
telescope's grid
Definition: KVIDINDRACsI.h:31
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)
Double_t y[n]
Double_t x[n]
const Int_t n