fEntries initialized to 0 in constructor and new TList() for first call of
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 11 Sep 2003 08:31:05 +0000 (08:31 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 11 Sep 2003 08:31:05 +0000 (08:31 +0000)
AddGenerator

EVGEN/AliGenCocktail.cxx

index a0d3e9a..4e9a2e9 100644 (file)
@@ -39,10 +39,11 @@ AliGenCocktail::AliGenCocktail()
 // Constructor
     fName = "Cocktail";
     fTitle= "Particle Generator using cocktail of generators";
-    fEntries = new TList;
     flnk1 = 0;
     flnk2 = 0;
     fNGenerators=0;
+    fEntries = 0;
+    
 }
 
 AliGenCocktail::AliGenCocktail(const AliGenCocktail & cocktail):
@@ -62,6 +63,11 @@ void AliGenCocktail::
 AddGenerator(AliGenerator *Generator, char* Name, Float_t RateExp)
 {
 //
+// Add a generator to the list 
+// First check that list exists
+    if (!fEntries) fEntries = new TList();
+
+//
 //  Forward parameters to the new generator
     if(TestBit(kPtRange) && !(Generator->TestBit(kPtRange)) && !(Generator->TestBit(kMomentumRange))) 
        Generator->SetPtRange(fPtMin,fPtMax);