Number of produced primaries is set in the header.
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 15 Aug 2007 16:06:37 +0000 (16:06 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 15 Aug 2007 16:06:37 +0000 (16:06 +0000)
PYTHIA6/AliGenPythia.cxx
PYTHIA6/AliGenPythia.h

index 53275b9..b1ef23a 100644 (file)
@@ -568,7 +568,7 @@ void AliGenPythia::Generate()
 //
        Int_t i;
        
-
+       fNprimaries = 0;
        Int_t np = fParticles->GetEntriesFast();
        
        if (np == 0) continue;
@@ -755,7 +755,8 @@ void AliGenPythia::Generate()
                              polar[0], polar[1], polar[2],
                              kPPrimary, nt, 1., ks);
                    pParent[i] = nt;
-                   KeepTrack(nt); 
+                   KeepTrack(nt);
+                   fNprimaries++;
                } //  PushTrack loop
            }
        } else {
@@ -951,6 +952,7 @@ Int_t  AliGenPythia::GenerateMB()
                      origin[0], origin[1], origin[2], tof, 
                      polar[0], polar[1], polar[2],
                      kPPrimary, nt, 1., ks);
+           fNprimaries++;
            //
            // Special Treatment to store color-flow
            //
@@ -1039,6 +1041,10 @@ void AliGenPythia::MakeHeader()
 //
 // Event Vertex 
     fHeader->SetPrimaryVertex(fVertex);
+    
+//
+// Number of primaries
+    fHeader->SetNProduced(fNprimaries);
 //
 // Jets that have triggered
 
@@ -1102,17 +1108,6 @@ void AliGenPythia::MakeHeader()
     AddHeader(fHeader);
 }
 
-void AliGenPythia::AddHeader(AliGenEventHeader* header)
-{
-    // Add header to container or runloader
-    if (fContainer) {
-       fContainer->AddHeader(header);
-    } else {
-       AliRunLoader::GetRunLoader()->GetHeader()->SetGenEventHeader(header);   
-    }
-}
-
-
 Bool_t AliGenPythia::CheckTrigger(TParticle* jet1, TParticle* jet2)
 {
 // Check the kinematic trigger condition
index 91bb5c3..e4dfabb 100644 (file)
@@ -160,8 +160,7 @@ class AliGenPythia : public AliGenMC
     
 
     void     GetSubEventTime();
-    void     AddHeader(AliGenEventHeader* header);
-    
+
  protected:
     // adjust the weight from kinematic cuts
     void     AdjustWeights() const;