From e2bddf811ad12c11b37a16097ff0362c24d2ae57 Mon Sep 17 00:00:00 2001 From: morsch Date: Tue, 18 Nov 2003 10:03:38 +0000 Subject: [PATCH] Some protections needed for stand-allone use added. --- PYTHIA6/AliGenPythia.cxx | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/PYTHIA6/AliGenPythia.cxx b/PYTHIA6/AliGenPythia.cxx index 5c9f412364a..346e299a2b8 100644 --- a/PYTHIA6/AliGenPythia.cxx +++ b/PYTHIA6/AliGenPythia.cxx @@ -153,6 +153,8 @@ void AliGenPythia::Init() SetMC(AliPythia::Instance()); fPythia=(AliPythia*) fMCEvGen; + printf("Pythia Init %p", fPythia); + // fParentWeight=1./Float_t(fNpart); // @@ -313,7 +315,7 @@ void AliGenPythia::Generate() if (fQuench) { fPythia->SetMSTJ(1, 0); } - + printf("Pythia pyevnt %p", fPythia); fPythia->Pyevnt(); if (fQuench) { @@ -322,11 +324,13 @@ void AliGenPythia::Generate() fPythia->Pyexec(); } + if (gAlice) { + if (gAlice->GetEvNumber()>=fDebugEventFirst && + gAlice->GetEvNumber()<=fDebugEventLast) fPythia->Pylist(1); + } - if (gAlice->GetEvNumber()>=fDebugEventFirst && - gAlice->GetEvNumber()<=fDebugEventLast) fPythia->Pylist(1); fTrials++; - + printf("Pythia import t %p %p ", fPythia, fParticles); fPythia->ImportParticles(fParticles,"All"); Boost(); @@ -627,11 +631,13 @@ void AliGenPythia::AdjustWeights() { // Adjust the weights after generation of all events // - TParticle *part; - Int_t ntrack=gAlice->GetMCApp()->GetNtrack(); - for (Int_t i=0; iGetMCApp()->Particle(i); - part->SetWeight(part->GetWeight()*fKineBias); + if (gAlice) { + TParticle *part; + Int_t ntrack=gAlice->GetMCApp()->GetNtrack(); + for (Int_t i=0; iGetMCApp()->Particle(i); + part->SetWeight(part->GetWeight()*fKineBias); + } } } @@ -672,7 +678,7 @@ void AliGenPythia::MakeHeader() jets[3][i]); } } - gAlice->SetGenEventHeader(fHeader); + if (gAlice) gAlice->SetGenEventHeader(fHeader); } -- 2.31.1