]> git.uio.no Git - u/mrichter/AliRoot.git/blame - DIME/TDime.cxx
corrections Mikael
[u/mrichter/AliRoot.git] / DIME / TDime.cxx
CommitLineData
de4b745b 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
16/* $Id:*/
17
18#include <TROOT.h>
19#include <TObjArray.h>
20#include <TParticle.h>
21#include <TClonesArray.h>
ce0b9758 22#include "DCommon.h"
de4b745b 23#include "TDime.h"
24
25#ifndef WIN32
26# define dimeinit dimeinit_
27# define dimegenerate dimegenerate_
28# define type_of_call
29#else
30# define dimeinit DIMEINIT
31# define dimegenerate DIMEGENERATE
32# define type_of_call _stdcall
33#endif
34
35#ifndef WIN32
36extern "C" void type_of_call dimeinit();
37extern "C" void type_of_call dimegenerate();
38#else
39#endif
40
41
42
43ClassImp(TDime)
44
45
46TDime::TDime():
47 TGenerator("Dime","Dime"),
48 fEfrm(5500.)
49{
50// Default constructor
51}
52
53//______________________________________________________________________________
54TDime::TDime(Double_t efrm) :
55 TGenerator("Dime","Dime"),
56 fEfrm(efrm)
57{
58// TDime constructor:
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.
61}
62
63//______________________________________________________________________________
64TDime::~TDime()
65{
66// Destructor
67}
68
69 void TDime::Initialize()
70{
71 VARS.rts = fEfrm;
72 CUTS.rmax = 1.8;
73 CUTS.rmin = -1.8;
74 CUTS.ecut = 2.;
ce0b9758 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 ");
de4b745b 81 dimeinit();
82}
83
84void TDime::GenerateEvent()
85{
86 dimegenerate();
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]);
91 //}
92
93}
94
95TObjArray* TDime::ImportParticles(Option_t *option)
96{
97//
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
101// the subclasses.
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.
107//
108 fParticles->Clear();
109 Int_t nump = 0;
110
111 Int_t numpart = HEPEUP.NUP;
112 printf("\n TDime: DIME stack contains %d particles.", numpart);
113
114 if (!strcmp(option,"") || !strcmp(option,"Final")) {
115 for (Int_t i = 0; i < numpart; i++) {
116
117 if (HEPEUP.ISTUP[i] == 1) {
118//
119// Use the common block values for the TParticle constructor
120//
121 nump++;
122 TParticle* p = new TParticle(
123 HEPEUP.IDUP[i], HEPEUP.MOTHUP[i][0], HEPEUP.MOTHUP[i][1] ,
124 -1, -1, -1,
125 HEPEUP.PUP[i][0], HEPEUP.PUP[i][1], HEPEUP.PUP[i][2], HEPEUP.PUP[i][3] ,
126 0., 0., 0., 0.0);
127 fParticles->Add(p);
128 }
129 }
130 }
131 else if (!strcmp(option,"All")) {
132 nump = numpart;
133 for (Int_t i = 0; i < numpart; i++) {
134 Int_t iParent = HEPEUP.MOTHUP[i][0]-1;
135 if (iParent >= 0) {
136 TParticle *mother = (TParticle*) (fParticles->UncheckedAt(iParent));
137 mother->SetLastDaughter(i);
138 if (mother->GetFirstDaughter()==-1)
139 mother->SetFirstDaughter(i);
140 }
141
142 TParticle* p = new TParticle(
143 HEPEUP.IDUP[i], HEPEUP.MOTHUP[i][0]-1, HEPEUP.MOTHUP[i][1]-1 ,
144 -1, -1, -1,
145 HEPEUP.PUP[i][0], HEPEUP.PUP[i][1], HEPEUP.PUP[i][2], HEPEUP.PUP[i][3] ,
146 0., 0., 0., 0.);
147 fParticles->Add(p);
148 }
149 }
150 return fParticles;
151}
152
153Int_t TDime::ImportParticles(TClonesArray *particles, Option_t *option)
154{
155//
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
159// the subclasses.
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.
165//
166 if (particles == 0) return 0;
167 TClonesArray &particlesR = *particles;
168 particlesR.Clear();
169 Int_t nump = 0;
170
171 Int_t numpart = HEPEUP.NUP;
172 printf("\n TDime: DIME stack contains %d particles.", numpart);
173
174 if (!strcmp(option,"") || !strcmp(option,"Final")) {
175 for (Int_t i = 0; i < numpart; i++) {
176 if (HEPEUP.ISTUP[i] == 1) {
177//
178// Use the common block values for the TParticle constructor
179//
180 nump++;
181 new(particlesR[i])
182 TParticle(
183 HEPEUP.IDUP[i], HEPEUP.MOTHUP[i][0], HEPEUP.MOTHUP[i][1] ,
184 -1, -1, -1,
185 HEPEUP.PUP[i][0], HEPEUP.PUP[i][1], HEPEUP.PUP[i][2], HEPEUP.PUP[i][3] ,
186 0., 0., 0., 0.0);
187 }
188 }
189 }
190 else if (!strcmp(option,"All")) {
191 nump = numpart;
192 for (Int_t i = 0; i < numpart; i++) {
193
194 Int_t iParent = HEPEUP.MOTHUP[i][0]-1;
195
196 if (iParent >= 0) {
197 TParticle *mother = (TParticle*) (particlesR.UncheckedAt(iParent));
198 mother->SetLastDaughter(i);
199 if (mother->GetFirstDaughter()==-1)
200 mother->SetFirstDaughter(i);
201 }
202
203 new(particlesR[i]) TParticle(
204 HEPEUP.IDUP[i], HEPEUP.MOTHUP[i][0], HEPEUP.MOTHUP[i][1] ,
205 -1, -1, -1,
206 HEPEUP.PUP[i][0], HEPEUP.PUP[i][1], HEPEUP.PUP[i][2], HEPEUP.PUP[i][3] ,
207 0., 0., 0., 0.0
208 );
209 }
210 }
211 return nump;
212}
213