StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
AgStarParticle.cxx
1 #include "AgStarParticle.h"
2 #include <stdio.h>
3 #include <cstring>
4 //____________________________________________________________________________________
5 #define address_of_agcpart F77_NAME( address_of_agcpart, ADDRESS_OF_AGCPART )
6 #define address_of_agcloca F77_NAME( address_of_agcloca, ADDRESS_OF_AGCLOCA )
7 #define axparticle F77_NAME( axparticle, AXPARTICLE )
8 struct Agcpart_t
9 {
10 
11  int code; // geant3 code
12  int type; // g3 particle type
13  float mass; // particle mass
14  float charge; // particle charge
15  float lifetime; // particle lifetime
16  float bratio[6]; // branching ratio for up to six modes
17  int mode[6]; // up to six decay modes
18  int pdgid; // pdg code
19  int ecode; // no clue...
20 };
21 extern "C" Agcpart_t* address_of_agcpart();
22 extern "C" void type_of_call axparticle();
23 
24 /*
25  COMMON/AGCLOCA/ AG_BEGSCR,AG_UBUF(100),AG_PAR(100),AG_AA(20),
26  >AG_ZZ(20),AG_WW(20),AG_NWBUF, AG_XHMAX,AG_YHMAX,AG_ZHMAX,AG_RHMAX,
27  >AG_FHMAX,AG_FHMIN,AG_NBITS,AG_BIN,AG_TYPE, AG_IROT,AG_NPAR,
28  >AG_ISET,AG_IDET,AG_JDU,AG_IRESER, AG_ENDSCR, AG_TITLE,AG_EXNAME,
29  >AG_PARLIST,AG_MATERIAL,AG_MIXTURE, AG_COMPONENT,AG_MEDIUM,
30  >AG_OPTION
31  */
32 
33 struct Agcloca_t {
34 
35  int begin; // begining of common block scratch area
36  int ubuf[100]; // user buffer
37  int par[100]; // parameter list
38  float aa[20]; //
39  float zz[20];
40  float ww[20];
41  int nwbuf; // Number of words in user buffer
42  float xhmax;
43  float yhmax;
44  float zhmax;
45  float rhmax;
46  float fhmax;
47  float fhmin;
48  int nbits;
49  float bin;
50  int type;
51  int irot;
52  int npar;
53  int iset;
54  int idet;
55  int jdu;
56  int ireser;
57  int end; // end of common block scratch area
58  char title[20];
59  char exname[20];
60  char parlist[20];
61  char material[20];
62  char mixture[20];
63  char component[20];
64  char medium[20];
65  char option[4];
66 
67 };
68 extern "C" Agcloca_t* address_of_agcloca();
69 
70 
71 //____________________________________________________________________________________
72 void AgStarParticle::Add( const char* name, const int g3id, const int type, const float mass, const float charge, const float lifetime, const float* bratio, const int* mode, const int pdgid )
73 {
74  Agcpart_t &agcpart = *(address_of_agcpart());
75  Agcloca_t &ag = *(address_of_agcloca());
76 
77  //sprintf( ag.title, "%-20s", name );
78  strncpy( ag.title, name, 20 );
79 
80  agcpart.code = g3id;
81  agcpart.type = type;
82  agcpart.mass = mass;
83  agcpart.charge = charge;
84  agcpart.lifetime = lifetime;
85  for ( int i=0;i<6;i++ ) {
86  if ( bratio ) {
87  agcpart.bratio[i] = bratio[i];
88  agcpart.mode[i] = mode[i];
89  }
90  else {
91  agcpart.bratio[i] = 0;
92  agcpart.mode[i] = 0;
93  }
94  }
95  agcpart.pdgid = pdgid;
96  axparticle();
97 
98 };
99 
100 
static void Add(const char *name, const int g3id, const int type, const float mass, const float charge, const float lifetime=0., const float *bratio=0, const int *mode=0, const int pdgid=0)