All coding rule violations except RS3 corrected (AM)
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 9 Jun 2000 20:28:51 +0000 (20:28 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 9 Jun 2000 20:28:51 +0000 (20:28 +0000)
EVGEN/AliGenCocktail.cxx
EVGEN/AliGenCocktail.h

index 26b0218..c9dad73 100644 (file)
 
 /*
 $Log$
+Revision 1.4  1999/09/29 09:24:12  fca
+Introduction of the Copyright and cvs Log
+
 */
 
-#include "AliGenerator.h"
 #include "AliGenCocktail.h"
+#include "AliGenCocktailEntry.h"
 #include "AliRun.h"
-#include <TDirectory.h>
-#include <TFile.h>
-#include <TTree.h>
 #include <stdlib.h>
-ClassImp(AliGenCocktailEntry)
-void AliGenCocktailEntry::PrintInfo()
-{
-printf("\n Generator: %s Generated Events: %d First: %d Last: %d",
-       (const char *) fName, fGenerator->NumberParticles(), fFirst, fLast);
-}
 
 ClassImp(AliGenCocktail)
 
 AliGenCocktail::AliGenCocktail()
                  :AliGenerator()
 {
+// Constructor
     fEntries = new TList;
     fNGenerators=0;
 }
 
+AliGenCocktail::AliGenCocktail(const AliGenCocktail & cocktail)
+{
+// copy constructor
+}
 
 AliGenCocktail::~AliGenCocktail()
 {
+// Destructor
     delete fEntries;
 }
 
@@ -66,65 +66,69 @@ AddGenerator(AliGenerator *Generator, TString Name, Float_t RateExp)
     Generator->SetTrackingFlag(fTrackIt);    
 //
 //  Add generator to list   
-    AliGenCocktailEntry *Entry = 
+    AliGenCocktailEntry *entry = 
        new AliGenCocktailEntry(Generator, Name, RateExp);
-     fEntries->Add(Entry);
+     fEntries->Add(entry);
      fNGenerators++;
  }
 
   void AliGenCocktail::Init()
-  {
-      TIter next(fEntries);
-      AliGenCocktailEntry *Entry;
-     //
-     // Loop over generators and initialize
-     while((Entry = (AliGenCocktailEntry*)next())) {
-       Entry->Generator()->Init();
-     }  
- }
+{
+// Initialisation
+    TIter next(fEntries);
+    AliGenCocktailEntry *entry;
+    //
+    // Loop over generators and initialize
+    while((entry = (AliGenCocktailEntry*)next())) {
+       entry->Generator()->Init();
+    }  
+}
 
  void AliGenCocktail::Generate()
- {
-     TIter next(fEntries);
-     AliGenCocktailEntry *Entry;
-     AliGenCocktailEntry *e1;
-     AliGenCocktailEntry *e2;
-     TClonesArray *PartArray = gAlice->Particles();
-     //
-     // Loop over generators and generate events
-     Int_t igen=0;
-     while((Entry = (AliGenCocktailEntry*)next())) {
-        igen++;
-        if (igen ==1) {
-            Entry->SetFirst(0);
-        } else {
-            Entry->SetFirst((PartArray->GetEntriesFast())+1);
-        }
-        Entry->Generator()->Generate();
-        Entry->SetLast(PartArray->GetEntriesFast());
-     }  
-     next.Reset();
-     while((Entry = (AliGenCocktailEntry*)next())) {
-        Entry->PrintInfo();
-     }
-     for (Entry=FirstGenerator();
-         Entry;
-         Entry=NextGenerator()
-        ) {
-        Entry->PrintInfo();
-     }
-     for (FirstGeneratorPair(e1,e2);
-         (e1&&e2);
-         NextGeneratorPair(e1,e2)
-        ){
-        printf("\n -----------------------------");
-        e1->PrintInfo();
-        e2->PrintInfo();
-     }
- }
+{
+//
+// Generate event 
+    TIter next(fEntries);
+    AliGenCocktailEntry *entry;
+    AliGenCocktailEntry *e1;
+    AliGenCocktailEntry *e2;
+    TClonesArray *partArray = gAlice->Particles();
+    //
+    // Loop over generators and generate events
+    Int_t igen=0;
+    while((entry = (AliGenCocktailEntry*)next())) {
+       igen++;
+       if (igen ==1) {
+           entry->SetFirst(0);
+       } else {
+           entry->SetFirst((partArray->GetEntriesFast())+1);
+       }
+       entry->Generator()->Generate();
+       entry->SetLast(partArray->GetEntriesFast());
+    }  
+    next.Reset();
+    while((entry = (AliGenCocktailEntry*)next())) {
+       entry->PrintInfo();
+    }
+    for (entry=FirstGenerator();
+        entry;
+        entry=NextGenerator()
+       ) {
+       entry->PrintInfo();
+    }
+    for (FirstGeneratorPair(e1,e2);
+        (e1&&e2);
+        NextGeneratorPair(e1,e2)
+       ){
+       printf("\n -----------------------------");
+       e1->PrintInfo();
+       e2->PrintInfo();
+    }
+}
 
 AliGenCocktailEntry *  AliGenCocktail::FirstGenerator()
 {
+// Iterator over generators: Initialisation
     flnk1 = fEntries->FirstLink();
     if (flnk1) {
        return (AliGenCocktailEntry*) (flnk1->GetObject());
@@ -135,6 +139,7 @@ AliGenCocktailEntry *  AliGenCocktail::FirstGenerator()
 
 AliGenCocktailEntry*  AliGenCocktail::NextGenerator()
 {
+// Iterator over generators: Increment
     flnk1 = flnk1->Next();
     if (flnk1) {
        return (AliGenCocktailEntry*) (flnk1->GetObject());
@@ -146,6 +151,7 @@ AliGenCocktailEntry*  AliGenCocktail::NextGenerator()
 void AliGenCocktail::
 FirstGeneratorPair(AliGenCocktailEntry*& e1, AliGenCocktailEntry*& e2)
 {
+// Iterator over generator pairs: Initialisation
     flnk2 = flnk1 = fEntries->FirstLink();
     if (flnk1) {
        e2 = e1 = (AliGenCocktailEntry*) (flnk1->GetObject());
@@ -157,6 +163,7 @@ FirstGeneratorPair(AliGenCocktailEntry*& e1, AliGenCocktailEntry*& e2)
 void AliGenCocktail::
 NextGeneratorPair(AliGenCocktailEntry*& e1, AliGenCocktailEntry*& e2)
 {
+// Iterator over generators: Increment
     flnk2 = flnk2->Next();
     if (flnk2) {
        e1 = (AliGenCocktailEntry*) (flnk1->GetObject());
@@ -176,29 +183,35 @@ NextGeneratorPair(AliGenCocktailEntry*& e1, AliGenCocktailEntry*& e2)
 
 void AliGenCocktail::Streamer(TBuffer &R__b)
 {
-   // Stream an object of class AliGenCocktail.
-     TIter next(fEntries);
-     AliGenCocktailEntry *Entry;
-
-   if (R__b.IsReading()) {
-      Version_t R__v = R__b.ReadVersion(); if (R__v) { }
-      AliGenerator::Streamer(R__b);
-      R__b >> fNGenerators;
-      R__b >> fEntries;
+    // Stream an object of class AliGenCocktail.
+    TIter next(fEntries);
+    AliGenCocktailEntry *entry;
+    
+    if (R__b.IsReading()) {
+       Version_t R__v = R__b.ReadVersion(); if (R__v) { }
+       AliGenerator::Streamer(R__b);
+       R__b >> fNGenerators;
+       R__b >> fEntries;
 // Stream generation related information
-      while((Entry = (AliGenCocktailEntry*)next())) {
-         Entry->Streamer(R__b);
-      }  
-   } else {
-       R__b.WriteVersion(AliGenCocktail::IsA());
-       AliGenerator::Streamer(R__b);
-       R__b << fNGenerators;
-       R__b << fEntries;
+       while((entry = (AliGenCocktailEntry*)next())) {
+           entry->Streamer(R__b);
+       }  
+    } else {
+       R__b.WriteVersion(AliGenCocktail::IsA());
+       AliGenerator::Streamer(R__b);
+       R__b << fNGenerators;
+       R__b << fEntries;
 // Stream generation related information
-      while((Entry = (AliGenCocktailEntry*)next())) {
-         Entry->Streamer(R__b);
-      }  
-   }
+       while((entry = (AliGenCocktailEntry*)next())) {
+           entry->Streamer(R__b);
+       }  
+    }
+}
+
+AliGenCocktail& AliGenCocktail::operator=(const  AliGenCocktail& rhs)
+{
+// Assignment operator
+    return *this;
 }
 
 
index 2b24503..277fa65 100644 (file)
@@ -5,88 +5,17 @@
 
 /* $Id$ */
 
-///////////////////////////////////////////////////////////
-//                                                       //
-//  Class to generate the particles for the MC           //
-//  The base class is empty                              //
-//                                                       //
-///////////////////////////////////////////////////////////
-
 #include "AliGenerator.h"
 
-#include <TClass.h>
-#include <TNamed.h>
-#include <TF1.h>
-#include <TArrayF.h>
-#include <TTree.h>
-
-class AliGenCocktailEntry : public TObject
-{
- protected:
-    AliGenerator *fGenerator;
-    Int_t fNGenerated;
-    Int_t fFirst;
-    Int_t fLast;
-    Float_t fRate;
-    Float_t fKineBias;
-    Float_t fBias;
-    TString fName;
- public:
-    AliGenCocktailEntry()
-       {
-           fGenerator =0;
-           fNGenerated=0;
-           fFirst=-1;
-           fLast=-1;
-           fRate=0;
-           fKineBias=1;
-           fBias=1;
-           fName="unknown";
-       }
-    
-    AliGenCocktailEntry
-       (AliGenerator* Generator, TString Name, Float_t RateExp)
-       {
-           fGenerator=Generator;
-           fNGenerated=0;
-           fFirst=-1;
-           fLast=-1;
-           fRate=RateExp;
-           fName=Name;
-//         
-           fKineBias=1;
-           fBias=1;
-
-       }
-    ~AliGenCocktailEntry(){;}
-    AliGenerator* Generator() {return fGenerator;}
-    void SetGenerator(AliGenerator* generator){fGenerator=generator;}
-    void SetFirst(Int_t first){fFirst=first;}
-    void SetLast (Int_t last ){fLast =last;}
-    Int_t GetFirst(){return fFirst;}
-    Int_t GetLast (){return fLast;}
-    Float_t Rate(){return fRate;}
-    void  PrintInfo();
- private:
-    ClassDef(AliGenCocktailEntry,1)
-};
+class AliGenCocktailEntry;
 
 
 class AliGenCocktail : public AliGenerator
 {
- protected:
-    //
-    // Number of generators booked
-
-    Int_t fNGenerators;
-    //
-    // List of Generators
-    TList  *fEntries;
-    // Iterators
-    TObjLink *flnk1;
-    TObjLink *flnk2;
  public:
     AliGenCocktail();
+    AliGenCocktail(const AliGenCocktail &cocktail);
+     
     virtual ~AliGenCocktail();
     virtual void Init();
     virtual void Generate();
@@ -98,10 +27,17 @@ class AliGenCocktail : public AliGenerator
     // Iterators
     AliGenCocktailEntry*  FirstGenerator();
     AliGenCocktailEntry*  NextGenerator();
-    void FirstGeneratorPair(AliGenCocktailEntry*&, AliGenCocktailEntry*&);
-    void NextGeneratorPair (AliGenCocktailEntry*&, AliGenCocktailEntry*&);
-    ClassDef(AliGenCocktail,1)
+    void FirstGeneratorPair(AliGenCocktailEntry*&e1, AliGenCocktailEntry*&e2);
+    void NextGeneratorPair (AliGenCocktailEntry*&e1, AliGenCocktailEntry*&e2);
+    AliGenCocktail & operator=(const AliGenCocktail & rhs);
+    
+ protected:
+    Int_t fNGenerators;   // Number of generators booked
+    TList  *fEntries;     // List of Generators
+    TObjLink *flnk1;      // Iterator for first generator
+    TObjLink *flnk2;      // Iterator for second generator
 //
+    ClassDef(AliGenCocktail,1) // Particle cocktail generator a la SHAKER
 };
 
 #endif