KaliVeda  1.12/06
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 
27 //KVIDINDRACsI
28 //
29 //Identification in CsI R-L matrices of INDRA
30 //
32 
33 
34 
37 {
38  CsIGrid = 0;
39 
40  fThresMin[0][0] = 1;
41  fThresMax[0][0] = 2; // protons
42  fThresMin[0][1] = 2;
43  fThresMax[0][1] = 6; // deutons
44  fThresMin[0][2] = 5;
45  fThresMax[0][2] = 11; // tritons
46  fThresMin[0][3] = -1;
47  fThresMax[0][3] = -1; // 4H - NO!
48  fThresMin[1][0] = -1;
49  fThresMax[1][0] = -1; // 1He - NO!
50  fThresMin[1][1] = -1;
51  fThresMax[1][1] = -1; // 2He - NO!
52  fThresMin[1][2] = 20;
53  fThresMax[1][2] = 40; // 3He
54  fThresMin[1][3] = 1;
55  fThresMax[1][3] = 3; // alphas
56 
57  /* in principle all CsI R-L telescopes can identify mass & charge */
58  SetHasMassID(kTRUE);
59 }
60 
61 
62 
63 
74 
76 {
77  // Particle identification and code setting using identification grid
78  //
79  // Note that gamma identification code is no longer attributed here: in case a gamma is identified,
80  // the IDR->IDcode will be the same general ID code as for all CsI particles,
81  // but IDR->IDquality == KVIDGCsI::kICODE10
82  //
83  // The KVIdentificationResult is first Clear()ed; then it is filled with IDtype = GetType()
84  // of this identification telescope, IDattempted = true, and the results of the identification
85  // procedure.
86 
87  IDR->Clear();
88  IDR->IDattempted = true;
89  IDR->SetIDType(GetType());
90 
91  //perform identification
92  Double_t csir, csil;
93  GetIDGridCoords(csil, csir, CsIGrid, x, y);
94  CsIGrid->Identify(csil, csir, IDR);
95  IDR->SetGridName(CsIGrid->GetName());
96 
97  // set general ID code
98  IDR->IDcode = GetIDCode();
99 
100  return kTRUE;
101 }
102 
103 
104 
116 
118 {
119  // For filtering simulations
120  // If n->GetEnergy() is above threshold for mass identification, we set
121  // n->IsAMeasured(kTRUE) (and n->IsZMeasured(kTRUE)).
122  // Otherwise, we just set n->IsZMeasured(kTRUE) and use the A given by
123  // the mass formula for the particle
124  //
125  // individual thresholds defined for 1H, 2H, 3H, 3He, 4He
126  // for A>5 identification if CsI energy > 40 MeV
127  //
128  // If A is not measured, we make sure the KE of the particle corresponds to the simulated one
129 
130  n->SetZMeasured();
131 
132  if (n->GetA() > 5) {
133  if (GetDetector(1)->GetEnergy() > 40)
134  n->SetAMeasured();
135  else {
136  double e = n->GetE();
137  n->SetZ(n->GetZ());
138  n->SetE(e);
139  }
140  return;
141  }
142  if (fThresMin[n->GetZ() - 1][n->GetA() - 1] > 0) {
143  Bool_t okmass = gRandom->Uniform() < smootherstep(fThresMin[n->GetZ() - 1][n->GetA() - 1], fThresMax[n->GetZ() - 1][n->GetA() - 1], GetDetector(1)->GetEnergy());
144  if (okmass) {
145  n->SetAMeasured();
146  }
147  }
148  else {
149  double e = n->GetE();
150  n->SetZ(n->GetZ());
151  n->SetE(e);
152  }
153 }
154 
155 
156 
157 
159 
160 float KVIDINDRACsI::clamp(float x, float lowerlimit, float upperlimit)
161 {
162  if (x < lowerlimit)
163  x = lowerlimit;
164  if (x > upperlimit)
165  x = upperlimit;
166  return x;
167 }
168 
169 
170 
173 
174 float KVIDINDRACsI::smootherstep(float edge0, float edge1, float x)
175 {
176  // Scale, and clamp x to 0..1 range
177  x = clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);
178  // Evaluate polynomial
179  return x * x * x * (x * (x * 6 - 15) + 10);
180 }
181 
182 
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
#define e(i)
bool Bool_t
double Double_t
const Bool_t kTRUE
R__EXTERN TRandom * gRandom
const Char_t * GetType() const
Definition: KVBase.h:170
virtual void Identify(Double_t, Double_t, KVIdentificationResult *) const =0
const Char_t * GetName() const
Definition: KVIDGraph.cpp:1320
float clamp(float x, float lowerlimit, float upperlimit)
Int_t fThresMin[2][4]
min ID thresholds (smooth step)
Definition: KVIDINDRACsI.h:31
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:32
void SetIdentificationStatus(KVReconstructedNucleus *n)
KVIDGraph * CsIGrid
telescope's grid
Definition: KVIDINDRACsI.h:29
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
void SetGridName(const Char_t *n)
void Clear(Option_t *opt="")
Reset to initial values.
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