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()
75 strcpy(FLAGS.pflag, "rho ");
76 strcpy(FLAGS.fsi, "true ");
77 strcpy(FLAGS.ppbar, "false ");
78 strcpy(FLAGS.cuts, "true ");
79 strcpy(FLAGS.unw, "true ");
80 strcpy(FF.formf, "orexp ");
84 void TDime::GenerateEvent()
87 //for (Int_t i = 0; i < HEPEUP.NUP; i++) {
88 //printf("%5d %5d %5d %5d %5d %13.3f %13.3f\n", i,
89 // HEPEUP.IDUP[i], HEPEUP.ISTUP[i], HEPEUP.MOTHUP[i][0],
90 // HEPEUP.ICOLUP[i][0], HEPEUP.PUP[i][2], HEPEUP.VTIMUP[i]);
95 TObjArray* TDime::ImportParticles(Option_t *option)
98 // Default primary creation method. It reads the /HEPEVT/ common block which
99 // has been filled by the GenerateEvent method. If the event generator does
100 // not use the HEPEVT common block, This routine has to be overloaded by
102 // The function loops on the generated particles and store them in
103 // the TClonesArray pointed by the argument particles.
104 // The default action is to store only the stable particles (ISTHEP = 1)
105 // This can be demanded explicitly by setting the option = "Final"
106 // If the option = "All", all the particles are stored.
111 Int_t numpart = HEPEUP.NUP;
112 printf("\n TDime: DIME stack contains %d particles.", numpart);
114 if (!strcmp(option,"") || !strcmp(option,"Final")) {
115 for (Int_t i = 0; i < numpart; i++) {
117 if (HEPEUP.ISTUP[i] == 1) {
119 // Use the common block values for the TParticle constructor
122 TParticle* p = new TParticle(
123 HEPEUP.IDUP[i], HEPEUP.MOTHUP[i][0], HEPEUP.MOTHUP[i][1] ,
125 HEPEUP.PUP[i][0], HEPEUP.PUP[i][1], HEPEUP.PUP[i][2], HEPEUP.PUP[i][3] ,
131 else if (!strcmp(option,"All")) {
133 for (Int_t i = 0; i < numpart; i++) {
134 Int_t iParent = HEPEUP.MOTHUP[i][0]-1;
136 TParticle *mother = (TParticle*) (fParticles->UncheckedAt(iParent));
137 mother->SetLastDaughter(i);
138 if (mother->GetFirstDaughter()==-1)
139 mother->SetFirstDaughter(i);
142 TParticle* p = new TParticle(
143 HEPEUP.IDUP[i], HEPEUP.MOTHUP[i][0]-1, HEPEUP.MOTHUP[i][1]-1 ,
145 HEPEUP.PUP[i][0], HEPEUP.PUP[i][1], HEPEUP.PUP[i][2], HEPEUP.PUP[i][3] ,
153 Int_t TDime::ImportParticles(TClonesArray *particles, Option_t *option)
156 // Default primary creation method. It reads the /HEPEVT/ common block which
157 // has been filled by the GenerateEvent method. If the event generator does
158 // not use the HEPEVT common block, This routine has to be overloaded by
160 // The function loops on the generated particles and store them in
161 // the TClonesArray pointed by the argument particles.
162 // The default action is to store only the stable particles (ISTHEP = 1)
163 // This can be demanded explicitly by setting the option = "Final"
164 // If the option = "All", all the particles are stored.
166 if (particles == 0) return 0;
167 TClonesArray &particlesR = *particles;
171 Int_t numpart = HEPEUP.NUP;
172 printf("\n TDime: DIME stack contains %d particles.", numpart);
174 if (!strcmp(option,"") || !strcmp(option,"Final")) {
175 for (Int_t i = 0; i < numpart; i++) {
176 if (HEPEUP.ISTUP[i] == 1) {
178 // Use the common block values for the TParticle constructor
183 HEPEUP.IDUP[i], HEPEUP.MOTHUP[i][0], HEPEUP.MOTHUP[i][1] ,
185 HEPEUP.PUP[i][0], HEPEUP.PUP[i][1], HEPEUP.PUP[i][2], HEPEUP.PUP[i][3] ,
190 else if (!strcmp(option,"All")) {
192 for (Int_t i = 0; i < numpart; i++) {
194 Int_t iParent = HEPEUP.MOTHUP[i][0]-1;
197 TParticle *mother = (TParticle*) (particlesR.UncheckedAt(iParent));
198 mother->SetLastDaughter(i);
199 if (mother->GetFirstDaughter()==-1)
200 mother->SetFirstDaughter(i);
203 new(particlesR[i]) TParticle(
204 HEPEUP.IDUP[i], HEPEUP.MOTHUP[i][0], HEPEUP.MOTHUP[i][1] ,
206 HEPEUP.PUP[i][0], HEPEUP.PUP[i][1], HEPEUP.PUP[i][2], HEPEUP.PUP[i][3] ,