Possibility to set a minimum number of embedded events from the same file (to reduce...
authorloizides <loizides@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 24 Sep 2013 10:36:43 +0000 (10:36 +0000)
committerloizides <loizides@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 24 Sep 2013 10:36:43 +0000 (10:36 +0000)
PWGJE/EMCALJetTasks/AliJetEmbeddingFromAODTask.cxx
PWGJE/EMCALJetTasks/AliJetEmbeddingFromAODTask.h
PWGJE/EMCALJetTasks/AliJetEmbeddingFromPYTHIATask.cxx
PWGJE/EMCALJetTasks/AliJetEmbeddingFromPYTHIATask.h

index 8fa8a62..5d621be 100644 (file)
@@ -98,7 +98,8 @@ AliJetEmbeddingFromAODTask::AliJetEmbeddingFromAODTask() :
   fHistAODFileError(0),
   fHistNotEmbedded(0),
   fHistEmbeddingQA(0),
-  fHistRejectedEvents(0)
+  fHistRejectedEvents(0),
+  fEmbeddingCount(0)
 {
   // Default constructor.
   SetSuffix("AODEmbedding");
@@ -167,7 +168,8 @@ AliJetEmbeddingFromAODTask::AliJetEmbeddingFromAODTask(const char *name, Bool_t
   fHistAODFileError(0),
   fHistNotEmbedded(0),
   fHistEmbeddingQA(0),
-  fHistRejectedEvents(0)
+  fHistRejectedEvents(0),
+  fEmbeddingCount(0)
 {
   // Standard constructor.
   SetSuffix("AODEmbedding");
@@ -336,6 +338,8 @@ Bool_t AliJetEmbeddingFromAODTask::OpenNextFile()
   
   if (fHistFileMatching)
     fHistFileMatching->Fill(fCurrentFileID, fCurrentAODFileID-1);
+
+  fEmbeddingCount = 0;
   
   return kTRUE;
 }
@@ -416,6 +420,8 @@ Bool_t AliJetEmbeddingFromAODTask::GetNextEntry()
   if (!fCurrentAODTree)
     return kFALSE;
 
+  fEmbeddingCount++;
+
   return kTRUE;
 }
 
index a37c798..080e9eb 100644 (file)
@@ -117,6 +117,7 @@ class AliJetEmbeddingFromAODTask : public AliJetModelBaseTask {
   TH1           *fHistNotEmbedded     ;//! File ID not embedded
   TH1           *fHistEmbeddingQA     ;//! Embedding QA
   TH1           *fHistRejectedEvents  ;//! Rejected events
+  Int_t          fEmbeddingCount      ;//! Number of embedded events from the current file
 
  private:
   AliJetEmbeddingFromAODTask(const AliJetEmbeddingFromAODTask&);            // not implemented
index ea08446..3475716 100644 (file)
@@ -30,6 +30,7 @@ AliJetEmbeddingFromPYTHIATask::AliJetEmbeddingFromPYTHIATask() :
   fAnchorRun(-1),
   fFileTable(0),
   fUseAsVetoTable(kTRUE),
+  fMinEntriesFromFile(0),
   fCurrentPtHardBin(-1),
   fPtHardBinParam(0),
   fHistPtHardBins(0)
@@ -50,6 +51,7 @@ AliJetEmbeddingFromPYTHIATask::AliJetEmbeddingFromPYTHIATask(const char *name, B
   fAnchorRun(-1),
   fFileTable(0),
   fUseAsVetoTable(kTRUE),
+  fMinEntriesFromFile(0),
   fCurrentPtHardBin(-1),
   fPtHardBinParam(0),
   fHistPtHardBins(0)
@@ -131,16 +133,18 @@ Bool_t AliJetEmbeddingFromPYTHIATask::ExecOnce()
 //________________________________________________________________________
 Bool_t AliJetEmbeddingFromPYTHIATask::GetNextEntry()
 {
-  Int_t newPtHard = GetRandomPtHardBin();
-
-  new (fPtHardBinParam) TParameter<int>("PYTHIAPtHardBin", newPtHard);
-
-  if (fHistPtHardBins)
-    fHistPtHardBins->SetBinContent(newPtHard+1, fHistPtHardBins->GetBinContent(newPtHard+1)+1);
-
-  if (newPtHard != fCurrentPtHardBin) {
-    fCurrentPtHardBin = newPtHard;
-    if (!OpenNextFile()) return kFALSE;
+  if (fEmbeddingCount >= fMinEntriesFromFile) {
+    Int_t newPtHard = GetRandomPtHardBin();
+    
+    new (fPtHardBinParam) TParameter<int>("PYTHIAPtHardBin", newPtHard);
+    
+    if (fHistPtHardBins)
+      fHistPtHardBins->SetBinContent(newPtHard+1, fHistPtHardBins->GetBinContent(newPtHard+1)+1);
+    
+    if (newPtHard != fCurrentPtHardBin) {
+      fCurrentPtHardBin = newPtHard;
+      if (!OpenNextFile()) return kFALSE;
+    }
   }
 
   return AliJetEmbeddingFromAODTask::GetNextEntry();
index 367c9b9..e2c084f 100644 (file)
@@ -28,6 +28,7 @@ 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 ; }
 
  protected:
   Bool_t         ExecOnce()           ;// intialize task
@@ -41,6 +42,7 @@ class AliJetEmbeddingFromPYTHIATask : public AliJetEmbeddingFromAODTask {
   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
 
@@ -50,6 +52,6 @@ class AliJetEmbeddingFromPYTHIATask : public AliJetEmbeddingFromAODTask {
   AliJetEmbeddingFromPYTHIATask(const AliJetEmbeddingFromPYTHIATask&);            // not implemented
   AliJetEmbeddingFromPYTHIATask &operator=(const AliJetEmbeddingFromPYTHIATask&); // not implemented
 
-  ClassDef(AliJetEmbeddingFromPYTHIATask, 2) // Jet embedding from PYTHIA task
+  ClassDef(AliJetEmbeddingFromPYTHIATask, 3) // Jet embedding from PYTHIA task
 };
 #endif