1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
19 #include <TObjArray.h>
20 #include <TParticle.h>
21 #include <TClonesArray.h>
26 # define dimeinit dimeinit_
27 # define dimegenerate dimegenerate_
30 # define dimeinit DIMEINIT
31 # define dimegenerate DIMEGENERATE
32 # define type_of_call _stdcall
36 extern "C" void type_of_call dimeinit();
37 extern "C" void type_of_call dimegenerate();
47 TGenerator("Dime","Dime"),
50 // Default constructor
53 //______________________________________________________________________________
54 TDime::TDime(Double_t efrm) :
55 TGenerator("Dime","Dime"),
59 // Note that there may be only one functional TDime object
60 // at a time, so it's not use to create more than one instance of it.
63 //______________________________________________________________________________
69 void TDime::Initialize()
76 strncpy(FLAGS.pflag, "rho ", len);
77 strncpy(FLAGS.fsi, "true ", len);
78 strncpy(FLAGS.ppbar, "false ", len);
79 strncpy(FLAGS.cuts, "true ", len);
80 strncpy(FLAGS.unw, "true ", len);
81 strncpy(FF.formf, "orexp ", len);
86 void TDime::GenerateEvent()
89 //for (Int_t i = 0; i < HEPEUP.NUP; i++) {
90 //printf("%5d %5d %5d %5d %5d %13.3f %13.3f\n", i,
91 // HEPEUP.IDUP[i], HEPEUP.ISTUP[i], HEPEUP.MOTHUP[i][0],
92 // HEPEUP.ICOLUP[i][0], HEPEUP.PUP[i][2], HEPEUP.VTIMUP[i]);
97 TObjArray* TDime::ImportParticles(Option_t *option)
100 // Default primary creation method. It reads the /HEPEVT/ common block which
101 // has been filled by the GenerateEvent method. If the event generator does
102 // not use the HEPEVT common block, This routine has to be overloaded by
104 // The function loops on the generated particles and store them in
105 // the TClonesArray pointed by the argument particles.
106 // The default action is to store only the stable particles (ISTHEP = 1)
107 // This can be demanded explicitly by setting the option = "Final"
108 // If the option = "All", all the particles are stored.
113 Int_t numpart = HEPEUP.NUP;
114 printf("\n TDime: DIME stack contains %d particles.", numpart);
116 if (!strcmp(option,"") || !strcmp(option,"Final")) {
117 for (Int_t i = 0; i < numpart; i++) {
119 if (HEPEUP.ISTUP[i] == 1) {
121 // Use the common block values for the TParticle constructor
124 TParticle* p = new TParticle(
125 HEPEUP.IDUP[i], HEPEUP.MOTHUP[i][0], HEPEUP.MOTHUP[i][1] ,
127 HEPEUP.PUP[i][0], HEPEUP.PUP[i][1], HEPEUP.PUP[i][2], HEPEUP.PUP[i][3] ,
133 else if (!strcmp(option,"All")) {
135 for (Int_t i = 0; i < numpart; i++) {
136 Int_t iParent = HEPEUP.MOTHUP[i][0]-1;
138 TParticle *mother = (TParticle*) (fParticles->UncheckedAt(iParent));
139 mother->SetLastDaughter(i);
140 if (mother->GetFirstDaughter()==-1)
141 mother->SetFirstDaughter(i);
144 TParticle* p = new TParticle(
145 HEPEUP.IDUP[i], HEPEUP.MOTHUP[i][0]-1, HEPEUP.MOTHUP[i][1]-1 ,
147 HEPEUP.PUP[i][0], HEPEUP.PUP[i][1], HEPEUP.PUP[i][2], HEPEUP.PUP[i][3] ,
155 Int_t TDime::ImportParticles(TClonesArray *particles, Option_t *option)
158 // Default primary creation method. It reads the /HEPEVT/ common block which
159 // has been filled by the GenerateEvent method. If the event generator does
160 // not use the HEPEVT common block, This routine has to be overloaded by
162 // The function loops on the generated particles and store them in
163 // the TClonesArray pointed by the argument particles.
164 // The default action is to store only the stable particles (ISTHEP = 1)
165 // This can be demanded explicitly by setting the option = "Final"
166 // If the option = "All", all the particles are stored.
168 if (particles == 0) return 0;
169 TClonesArray &particlesR = *particles;
173 Int_t numpart = HEPEUP.NUP;
174 printf("\n TDime: DIME stack contains %d particles.", numpart);
176 if (!strcmp(option,"") || !strcmp(option,"Final")) {
177 for (Int_t i = 0; i < numpart; i++) {
178 if (HEPEUP.ISTUP[i] == 1) {
180 // Use the common block values for the TParticle constructor
185 HEPEUP.IDUP[i], HEPEUP.MOTHUP[i][0], HEPEUP.MOTHUP[i][1] ,
187 HEPEUP.PUP[i][0], HEPEUP.PUP[i][1], HEPEUP.PUP[i][2], HEPEUP.PUP[i][3] ,
192 else if (!strcmp(option,"All")) {
194 for (Int_t i = 0; i < numpart; i++) {
196 Int_t iParent = HEPEUP.MOTHUP[i][0]-1;
199 TParticle *mother = (TParticle*) (particlesR.UncheckedAt(iParent));
200 mother->SetLastDaughter(i);
201 if (mother->GetFirstDaughter()==-1)
202 mother->SetFirstDaughter(i);
205 new(particlesR[i]) TParticle(
206 HEPEUP.IDUP[i], HEPEUP.MOTHUP[i][0], HEPEUP.MOTHUP[i][1] ,
208 HEPEUP.PUP[i][0], HEPEUP.PUP[i][1], HEPEUP.PUP[i][2], HEPEUP.PUP[i][3] ,