[ROOT] In TPythia6 TClonesArray not well delete

From: Maria Jesus MORA (mora@subatech.in2p3.fr)
Date: Tue Jul 11 2000 - 16:23:39 MEST


Hi ,

    I am using TPythia6 to control the decay of particles. For each
event I make decay one particle and I retrieve the information with the
function ImportParticles. This ImportParticle give me a list
"TClonesArray" of particles "TMCParticle". Of course, at the end of the
event I empty this list with the function Delete. But sometimes the
particles are not remove and I find in a new event  a old particle....

as exemple...
in event 20843 we find the decay eta (221)-> gamma (22) + gamma (22)+
muon(13) !!!
but in fact this muon comes fron the event 20842  when eta (221) ->
muon(13) + antimuon (-13)+ gamma(22)

event 20842
(11, 221) <-  0, =>[  2,  4]:  p=(  4.443,  0.000,   -2.227) ; E=
5.000 ; m=  0.547 ; V=(0,0,0); t=0, tau=0
( 1,  22) <-  1, =>[  0,  0]:  p=(  0.793, -0.098,   -0.389) ; E=
0.889 ; m=  0.000 ; V=(0,0,0); t=0, tau=0
( 1, -13) <-  1, =>[  0,  0]:  p=(  3.053,  0.180,   -1.446) ; E=
3.385 ; m=  0.106 ; V=(0,0,0); t=0, tau=0
( 1,  13) <-  1, =>[  0,  0]:  p=(  0.596, -0.082,   -0.392) ; E=
0.726 ; m=  0.106 ; V=(0,0,0); t=0, tau=0
( 1,  22) <-  2, =>[  0,  0]:  p=(  0.962, -0.003,   -0.605) ; E=
1.137 ; m=  0.000 ; V=(0.000730588,1.12372e-05,-0.000403107);
t=0.000836193, tau=0
20843
(11, 221) <-  0, =>[  2,  3]:  p=(  4.443,  0.000,   -2.227) ; E=
5.000 ; m=  0.547 ; V=(0,0,0); t=0, tau=0
( 1,  22) <-  1, =>[  0,  0]:  p=(  3.982, -0.130,   -2.103) ; E=
4.505 ; m=  0.000 ; V=(0,0,0); t=0, tau=0
( 1,  22) <-  1, =>[  0,  0]:  p=(  0.461,  0.130,   -0.123) ; E=
0.495 ; m=  0.000 ; V=(0,0,0); t=0, tau=0
( 1,  13) <-  1, =>[  0,  0]:  p=(  0.596, -0.082,   -0.392) ; E=
0.726 ; m=  0.106 ; V=(0,0,0); t=0, tau=0




I think that it is a TPhythia6 problem beacause if I create a new
TPythia6 object in each event, the problem with the old particles in new
event is still there. May be i'm doing something wrong....Do I need to
do some special thing to "reset" the pythia events?
I send my main program. I run ROOT Version   2.23/12 in Linux
Thank you in advance,

Maria MORA


//__________________________________________________________________________---

//
#ifndef __CINT__
#include "TROOT.h"
#include "TFile.h"
#include "TDirectory.h"
#include "TPythia6.h"
#include "TClonesArray.h"
#include "TMCParticle.h"
#include "TParticle.h"
#include "TMath.h"
#include "TStopwatch.h"
#include "TRandom.h"
#include <iostream.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <ctype.h>

extern "C" void py1ent_(Int_t&, Int_t&, Double_t&, Double_t&,
Double_t&);
extern void InitGui(); // loads the device dependent graphics system
VoidFuncPtr_t initfuncs[] = { InitGui, 0 };


TRandom Random01;
///////////////////////////////////////////////////////////////////////////////////////////////

void DecayParticle(TPythia6 *pythia, Int_t &idpart, Double_t &mom,
Double_t &theta,Double_t &phi)
{
  Int_t temp = 0;
  py1ent_(temp, idpart, mom, theta, phi);
}
///////////////////////////////////////////////////////////////////////////////////////////

int main(int argc, char *argv[])
{
  TROOT root("pythia simul","PITHIA/SIMULATION", initfuncs);
#else
{
#endif
   TPythia6 *pitia = new TPythia6() ;
   TClonesArray * ParticleList = new TClonesArray() ;
   TMCParticle *particle = new TMCParticle() ;

  // Meson definition : identify number and mass(GeV)
  Int_t IdEta     = 221 ;   Float_t MassEta     = 0.5473;

  // counter definition
  Int_t i, cpar;
  Int_t Entries, IdParticle ;


// Event Loop
  for( i = 0; i<=50000; i++)
  {
    DecayParticle(pitia, IdEta, 5., 90., 0.) ;
    ParticleList = (TClonesArray *)pitia->ImportParticles() ;
    Entries = ParticleList->GetEntries() ;

// Loop in generated and decay particles
   for(cpar=1; cpar<Entries; cpar++)
    {
      particle = (TMCParticle *) ParticleList->At(cpar) ;
      IdParticle = particle->GetKF() ;

      if(IdParticle == 13) // muon
      {
 cout<<i <<endl;
 ParticleList->ls() ;
      }
    }  // end of Loop in generated and decay particles

    ParticleList->Delete() ;

  }// End in Event Loop


    return 1;
}



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:29 MET