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"),
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()
98 //for (Int_t i = 0; i < HEPEUP.NUP; i++) {
99 //printf("%5d %5d %5d %5d %5d %13.3f %13.3f\n", i,
100 // HEPEUP.IDUP[i], HEPEUP.ISTUP[i], HEPEUP.MOTHUP[i][0],
101 // HEPEUP.ICOLUP[i][0], HEPEUP.PUP[i][2], HEPEUP.VTIMUP[i]);
106 TObjArray* TDime::ImportParticles(Option_t *option)
109 // Default primary creation method. It reads the /HEPEVT/ common block which
110 // has been filled by the GenerateEvent method. If the event generator does
111 // not use the HEPEVT common block, This routine has to be overloaded by
113 // The function loops on the generated particles and store them in
114 // the TClonesArray pointed by the argument particles.
115 // The default action is to store only the stable particles (ISTHEP = 1)
116 // This can be demanded explicitly by setting the option = "Final"
117 // If the option = "All", all the particles are stored.
122 Int_t numpart = HEPEUP.NUP;
123 printf("\n TDime: DIME stack contains %d particles.", numpart);
125 if (!strcmp(option,"") || !strcmp(option,"Final")) {
126 for (Int_t i = 0; i < numpart; i++) {
128 if (HEPEUP.ISTUP[i] == 1) {
130 // Use the common block values for the TParticle constructor
133 TParticle* p = new TParticle(
134 HEPEUP.IDUP[i], HEPEUP.MOTHUP[i][0], HEPEUP.MOTHUP[i][1] ,
136 HEPEUP.PUP[i][0], HEPEUP.PUP[i][1], HEPEUP.PUP[i][2], HEPEUP.PUP[i][3] ,
142 else if (!strcmp(option,"All")) {
144 for (Int_t i = 0; i < numpart; i++) {
145 Int_t iParent = HEPEUP.MOTHUP[i][0]-1;
147 TParticle *mother = (TParticle*) (fParticles->UncheckedAt(iParent));
148 mother->SetLastDaughter(i);
149 if (mother->GetFirstDaughter()==-1)
150 mother->SetFirstDaughter(i);
153 TParticle* p = new TParticle(
154 HEPEUP.IDUP[i], HEPEUP.MOTHUP[i][0]-1, HEPEUP.MOTHUP[i][1]-1 ,
156 HEPEUP.PUP[i][0], HEPEUP.PUP[i][1], HEPEUP.PUP[i][2], HEPEUP.PUP[i][3] ,
164 Int_t TDime::ImportParticles(TClonesArray *particles, Option_t *option)
167 // Default primary creation method. It reads the /HEPEVT/ common block which
168 // has been filled by the GenerateEvent method. If the event generator does
169 // not use the HEPEVT common block, This routine has to be overloaded by
171 // The function loops on the generated particles and store them in
172 // the TClonesArray pointed by the argument particles.
173 // The default action is to store only the stable particles (ISTHEP = 1)
174 // This can be demanded explicitly by setting the option = "Final"
175 // If the option = "All", all the particles are stored.
177 if (particles == 0) return 0;
178 TClonesArray &particlesR = *particles;
182 Int_t numpart = HEPEUP.NUP;
183 printf("\n TDime: DIME stack contains %d particles.", numpart);
185 if (!strcmp(option,"") || !strcmp(option,"Final")) {
186 for (Int_t i = 0; i < numpart; i++) {
187 if (HEPEUP.ISTUP[i] == 1) {
189 // Use the common block values for the TParticle constructor
194 HEPEUP.IDUP[i], HEPEUP.MOTHUP[i][0], HEPEUP.MOTHUP[i][1] ,
196 HEPEUP.PUP[i][0], HEPEUP.PUP[i][1], HEPEUP.PUP[i][2], HEPEUP.PUP[i][3] ,
201 else if (!strcmp(option,"All")) {
203 for (Int_t i = 0; i < numpart; i++) {
205 Int_t iParent = HEPEUP.MOTHUP[i][0]-1;
208 TParticle *mother = (TParticle*) (particlesR.UncheckedAt(iParent));
209 mother->SetLastDaughter(i);
210 if (mother->GetFirstDaughter()==-1)
211 mother->SetFirstDaughter(i);
214 new(particlesR[i]) TParticle(
215 HEPEUP.IDUP[i], HEPEUP.MOTHUP[i][0], HEPEUP.MOTHUP[i][1] ,
217 HEPEUP.PUP[i][0], HEPEUP.PUP[i][1], HEPEUP.PUP[i][2], HEPEUP.PUP[i][3] ,