Thanks Rene -- I ended up switching to TPythia6, and that was a lot easier to use. I guess it handles the particle list on its own so I don't have to mess around with it. Thanks! Joe Quoting Rene Brun <brun@pcbrun.cern.ch>: > Hi Joe, > > By default, TPythia::GenerateEvent produces TMCParticle not TParticle. > See example below to access the TPCParticle data. > > Rene Brun > > { > // dynamically link the shared libraries > gSystem->Load("$PYTHIA/libPythia.so"); // Pythia library > gSystem->Load("libEG.so"); // Root Event Generator > interface > gSystem->Load("libEGPythia.so"); // Root interface to Pythia > > TPythia *myPythia = new TPythia(); > TMCParticle *myParticle; > > // Assume I've completed all initialization > > myPythia->Initialize("CMS","p","p",14000); > myPythia.GenerateEvent(); > int numParticles = myPythia.GetNumberOfParticles(); > TObjArray *particles = myPythia.GetListOfParticles(); > for(int i = 0; i < numParticles; i++) { > myParticle = (TMCParticle*)particles->At(i); > int KS = myParticle->GetKS(); > float px = myParticle->GetPx(); > float py = myParticle->GetPy(); > float pz = myParticle->GetPz(); > printf("i=%4d, KS=%d, px=%g, py=%g, pz=%g\n",i,KS,px,py,pz); > } > } > > > On Fri, 26 Jul 2002, Joseph Tuggle wrote: > > > Hi, > > > > When I use the TPythia class to generate events, I seem to get > > uninitialized variables instead of actual values. Here is an > example... > > > > TPythia myPythia; > > TParticle *myParticle; > > > > // Assume I've completed all initialization > > > > myPythia.GenerateEvent(); > > int numParticles = myPythia.GetNumberOfParticles(); > > for(int i = 0; i < numParticles; i++) { > > myParticle = myPythia.GetParticle(i); > > float px = myParticle->Px(); > > } > > > > Now, if I look at px, py, pz, etc, they all seem to be uninitialized. > > > Same for Vx, Vy, Vz, and so on. Is there something simple I'm > missing? > > > > Thanks, > > Joe > > > > > >
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:01 MET