]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
More performance improvements
authorsaiola <salvatore.aiola@cern.ch>
Tue, 2 Sep 2014 12:48:37 +0000 (08:48 -0400)
committersaiola <salvatore.aiola@cern.ch>
Tue, 2 Sep 2014 12:48:51 +0000 (08:48 -0400)
PWGJE/EMCALJetTasks/AliJetEmbeddingFromPYTHIATask.cxx
PWGJE/EMCALJetTasks/AliJetEmbeddingFromPYTHIATask.h

index d22f676d4346080014f6a49c868d04d99e6588ad..fcab34bf2191e274427b0ee637bd73f831c23fb3 100644 (file)
@@ -30,9 +30,10 @@ AliJetEmbeddingFromPYTHIATask::AliJetEmbeddingFromPYTHIATask() :
   fAnchorRun(-1),
   fFileTable(0),
   fUseAsVetoTable(kTRUE),
-  fMinEntriesFromFile(0),
+  fMinEntriesPerPtHardBin(1),
   fCurrentPtHardBin(-1),
   fPtHardBinParam(0),
+  fPtHardBinCount(0),
   fHistPtHardBins(0)
 {
   // Default constructor.
@@ -51,9 +52,10 @@ AliJetEmbeddingFromPYTHIATask::AliJetEmbeddingFromPYTHIATask(const char *name, B
   fAnchorRun(-1),
   fFileTable(0),
   fUseAsVetoTable(kTRUE),
-  fMinEntriesFromFile(0),
+  fMinEntriesPerPtHardBin(1),
   fCurrentPtHardBin(-1),
   fPtHardBinParam(0),
+  fPtHardBinCount(0),
   fHistPtHardBins(0)
 {
   // Standard constructor.
@@ -133,15 +135,16 @@ Bool_t AliJetEmbeddingFromPYTHIATask::ExecOnce()
 //________________________________________________________________________
 Bool_t AliJetEmbeddingFromPYTHIATask::GetNextEntry()
 {
-  if (fEmbeddingCount >= fMinEntriesFromFile) {
-    Int_t newPtHard = GetRandomPtHardBin();
-    
-    new (fPtHardBinParam) TParameter<int>("PYTHIAPtHardBin", newPtHard);
-    
+  if (fPtHardBinCount >= fMinEntriesPerPtHardBin) {
     if (fHistPtHardBins)
-      fHistPtHardBins->SetBinContent(newPtHard+1, fHistPtHardBins->GetBinContent(newPtHard+1)+1);
+      fHistPtHardBins->SetBinContent(fCurrentPtHardBin+1, fHistPtHardBins->GetBinContent(fCurrentPtHardBin+1)+fPtHardBinCount);
+
+    fPtHardBinCount = 0;
+
+    Int_t newPtHard = GetRandomPtHardBin();
     
     if (newPtHard != fCurrentPtHardBin) {
+      new (fPtHardBinParam) TParameter<int>("PYTHIAPtHardBin", newPtHard);
       fCurrentPtHardBin = newPtHard;
       if (!OpenNextFile()) return kFALSE;
     }
index cb9cb9d5514801507f6a698a365e3e42ec44e33c..8ec11c843742c7ff32875d928dd41e37abb59241 100644 (file)
@@ -1,8 +1,6 @@
 #ifndef ALIJETEMBEDDINGFROMPYTHIATASK_H
 #define ALIJETEMBEDDINGFROMPYTHIATASK_H
 
-// $Id$
-
 #include "AliJetEmbeddingFromAODTask.h"
 #include <TArrayD.h>
 
@@ -28,30 +26,31 @@ class AliJetEmbeddingFromPYTHIATask : public AliJetEmbeddingFromAODTask {
   void           SetLHC11hAnchorRuns(Bool_t a=kTRUE)               { fLHC11hAnchorRun                           = a ; }
   void           SetFileTable(THashTable *t)                       { fFileTable                                 = t ; }
   void           SetUseAsVetoTable(Bool_t v)                       { fUseAsVetoTable                            = v ; }
-  void           SetMinEntriesFromFile(Int_t r)                    { fMinEntriesFromFile                        = r ; }
+  void           SetMinEntriesPerPtHardBin(Int_t r)                { fMinEntriesPerPtHardBin                    = r ; }
 
  protected:
-  Bool_t         ExecOnce()           ;// intialize task
-  Bool_t         GetNextEntry()       ;// get next entry in current tree
-  Int_t          GetRandomPtHardBin() ;// get a radnom pt hard bin according to fPtHardBinScaling
-  TFile         *GetNextFile()        ;// get next file
-
-  TString        fPYTHIAPath          ;// Path of the PYTHIA production
-  TArrayD        fPtHardBinScaling    ;// Pt hard bin scaling
-  Bool_t         fLHC11hAnchorRun     ;// LHC11h anchor runs
-  Int_t          fAnchorRun           ;// Anchor run
-  THashTable    *fFileTable           ;// Table of allowed/vetoed files
-  Bool_t         fUseAsVetoTable      ;// Use fFileTable as a veto table
-  Int_t          fMinEntriesFromFile  ;// Minimum number of embedded events before changing file
-  Int_t          fCurrentPtHardBin    ;//!Pt hard bin of the current open file
-  TParameter<int> *fPtHardBinParam    ;//!Pt hard bin param
-
-  TH1           *fHistPtHardBins      ;//!Embeded pt hard bin distribution
+  Bool_t           ExecOnce()               ;// intialize task
+  Bool_t           GetNextEntry()           ;// get next entry in current tree
+  Int_t            GetRandomPtHardBin()     ;// get a radnom pt hard bin according to fPtHardBinScaling
+  TFile           *GetNextFile()            ;// get next file
+
+  TString          fPYTHIAPath              ;// Path of the PYTHIA production
+  TArrayD          fPtHardBinScaling        ;// Pt hard bin scaling
+  Bool_t           fLHC11hAnchorRun         ;// LHC11h anchor runs
+  Int_t            fAnchorRun               ;// Anchor run
+  THashTable      *fFileTable               ;// Table of allowed/vetoed files
+  Bool_t           fUseAsVetoTable          ;// Use fFileTable as a veto table
+  Int_t            fMinEntriesPerPtHardBin  ;// Minimum number of embedded events before changing pt hard bin
+  Int_t            fCurrentPtHardBin        ;//!Pt hard bin of the current open file
+  TParameter<int> *fPtHardBinParam          ;//!Pt hard bin param
+  Int_t            fPtHardBinCount          ;//!Number of event embedded from the current pt hard bin
+
+  TH1             *fHistPtHardBins          ;//!Embeded pt hard bin distribution
 
  private:
   AliJetEmbeddingFromPYTHIATask(const AliJetEmbeddingFromPYTHIATask&);            // not implemented
   AliJetEmbeddingFromPYTHIATask &operator=(const AliJetEmbeddingFromPYTHIATask&); // not implemented
 
-  ClassDef(AliJetEmbeddingFromPYTHIATask, 3) // Jet embedding from PYTHIA task
+  ClassDef(AliJetEmbeddingFromPYTHIATask, 4) // Jet embedding from PYTHIA task
 };
 #endif