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(int& success);
47 TGenerator("Dime","Dime"),
54 // Default constructor
57 //______________________________________________________________________________
58 TDime::TDime(Double_t efrm) :
59 TGenerator("Dime","Dime"),
67 // Note that there may be only one functional TDime object
68 // at a time, so it's not use to create more than one instance of it.
71 //______________________________________________________________________________
77 void TDime::Initialize()
84 // strncpy(FLAGS.pflag, "rho ", len);
85 strncpy(FLAGS.pflag, fProcess.Data(), len);
86 strncpy(FLAGS.fsi, "true ", len);
87 strncpy(FLAGS.ppbar, "false ", len);
88 strncpy(FLAGS.cuts, "true ", len);
89 strncpy(FLAGS.unw, "true ", len);
90 strncpy(FF.formf, "orexp ", len);
95 void TDime::GenerateEvent()
100 //for (Int_t i = 0; i < HEPEUP.NUP; i++) {
101 //printf("%5d %5d %5d %5d %5d %13.3f %13.3f\n", i,
102 // HEPEUP.IDUP[i], HEPEUP.ISTUP[i], HEPEUP.MOTHUP[i][0],
103 // HEPEUP.ICOLUP[i][0], HEPEUP.PUP[i][2], HEPEUP.VTIMUP[i]);
108 TObjArray* TDime::ImportParticles(Option_t *option)
111 // Default primary creation method. It reads the /HEPEVT/ common block which
112 // has been filled by the GenerateEvent method. If the event generator does
113 // not use the HEPEVT common block, This routine has to be overloaded by
115 // The function loops on the generated particles and store them in
116 // the TClonesArray pointed by the argument particles.
117 // The default action is to store only the stable particles (ISTHEP = 1)
118 // This can be demanded explicitly by setting the option = "Final"
119 // If the option = "All", all the particles are stored.
124 Int_t numpart = HEPEUP.NUP;
125 printf("\n TDime: DIME stack contains %d particles.", numpart);
127 if (!strcmp(option,"") || !strcmp(option,"Final")) {
128 for (Int_t i = 0; i < numpart; i++) {
130 if (HEPEUP.ISTUP[i] == 1) {
132 // Use the common block values for the TParticle constructor
135 TParticle* p = new TParticle(
136 HEPEUP.IDUP[i], HEPEUP.MOTHUP[i][0], HEPEUP.MOTHUP[i][1] ,
138 HEPEUP.PUP[i][0], HEPEUP.PUP[i][1], HEPEUP.PUP[i][2], HEPEUP.PUP[i][3] ,
144 else if (!strcmp(option,"All")) {
146 for (Int_t i = 0; i < numpart; i++) {
147 Int_t iParent = HEPEUP.MOTHUP[i][0]-1;
149 TParticle *mother = (TParticle*) (fParticles->UncheckedAt(iParent));
150 mother->SetLastDaughter(i);
151 if (mother->GetFirstDaughter()==-1)
152 mother->SetFirstDaughter(i);
155 TParticle* p = new TParticle(
156 HEPEUP.IDUP[i], HEPEUP.MOTHUP[i][0]-1, HEPEUP.MOTHUP[i][1]-1 ,
158 HEPEUP.PUP[i][0], HEPEUP.PUP[i][1], HEPEUP.PUP[i][2], HEPEUP.PUP[i][3] ,
166 Int_t TDime::ImportParticles(TClonesArray *particles, Option_t *option)
169 // Default primary creation method. It reads the /HEPEVT/ common block which
170 // has been filled by the GenerateEvent method. If the event generator does
171 // not use the HEPEVT common block, This routine has to be overloaded by
173 // The function loops on the generated particles and store them in
174 // the TClonesArray pointed by the argument particles.
175 // The default action is to store only the stable particles (ISTHEP = 1)
176 // This can be demanded explicitly by setting the option = "Final"
177 // If the option = "All", all the particles are stored.
179 if (particles == 0) return 0;
180 TClonesArray &particlesR = *particles;
184 Int_t numpart = HEPEUP.NUP;
185 printf("\n TDime: DIME stack contains %d particles.", numpart);
187 if (!strcmp(option,"") || !strcmp(option,"Final")) {
188 for (Int_t i = 0; i < numpart; i++) {
189 if (HEPEUP.ISTUP[i] == 1) {
191 // Use the common block values for the TParticle constructor
196 HEPEUP.IDUP[i], HEPEUP.MOTHUP[i][0], HEPEUP.MOTHUP[i][1] ,
198 HEPEUP.PUP[i][0], HEPEUP.PUP[i][1], HEPEUP.PUP[i][2], HEPEUP.PUP[i][3] ,
203 else if (!strcmp(option,"All")) {
205 for (Int_t i = 0; i < numpart; i++) {
207 Int_t iParent = HEPEUP.MOTHUP[i][0]-1;
210 TParticle *mother = (TParticle*) (particlesR.UncheckedAt(iParent));
211 mother->SetLastDaughter(i);
212 if (mother->GetFirstDaughter()==-1)
213 mother->SetFirstDaughter(i);
216 new(particlesR[i]) TParticle(
217 HEPEUP.IDUP[i], HEPEUP.MOTHUP[i][0], HEPEUP.MOTHUP[i][1] ,
219 HEPEUP.PUP[i][0], HEPEUP.PUP[i][1], HEPEUP.PUP[i][2], HEPEUP.PUP[i][3] ,