/
geant.cxx
67 lines (55 loc) · 2.66 KB
/
geant.cxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/* ----------------------------------------------------------------- */
/* geant.c */
/* */
/* It looks like GEANT pass initialization/run is always the same.*/
/* Therefore it makes sense to pack it into a standard call with */
/* several parameters describing wanted behaviour. */
/* */
/* A.Kisselev, PNPI, St.Petersburg, Russia. */
/* e-mail: kisselev@hermes.desy.de */
/* ----------------------------------------------------------------- */
#include <cassert>
//#include <cunistd>
#include <cstring>
#include <htclib.h>
//#include <geant.h>
// NB: if e+/e- included make sure that energy losses in the Kalman
// filter are taken into account properly; if neutral particles in
// decay chains are used later, will need to restructure; but since
// GEANT particle ID is encoded in htcTrack.status[1], it will be
// backwards compatible anyway;
t_particle_group particle_groups[] = {
{(char*)"pion", 0.1395700, _DEDX_HADRON_,
// Changed to string letters in order to match GEANT4;
{{(char*)"pi+", 8, 211}, {(char*)"pi-", 9, -211}}},
{(char*)"kaon", 0.493677, _DEDX_HADRON_,
{{(char*)"K+", 11, 321}, {(char*)"K-", 12, -321}}},
{(char*)"proton", 0.93827231, _DEDX_HADRON_,
{{(char*)"Proton", 14, 2212}, {(char*)"Antiproton",15, -2212}}},
{(char*)"electron", 5.109990615E-4, _DEDX_ELECTRON_,
{{(char*)"Positron", 2, -11}, {(char*)"Electron", 3, 11}}}};
int particle_group_num = sizeof(particle_groups)/sizeof(particle_groups[0]);
/* ================================================================= */
/* Particle names are compared ignoring case; */
t_particle *get_particle_by_name(const char *name)
{
for(int gr=0; gr<particle_group_num; gr++)
for(int ch=0; ch<2; ch++)
{
t_particle *particle = particle_groups[gr].members + ch;
if (!strcasecmp(particle->name, name))
return particle;
} /*for gr..ch*/
return NULL;
} /* get_particle_by_name */
/* ----------------------------------------------------------------- */
t_particle_group *get_particle_group_by_name(const char *grname)
{
for(int gr=0; gr<particle_group_num; gr++)
{
t_particle_group *pgroup = particle_groups + gr;
if (!strcmp(pgroup->grname, grname)) return pgroup;
} /*for gr*/
return NULL;
} /* get_particle_group_by_name */
/* ================================================================= */