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