From 04bae0a025ce3010d7eccaeadb9298aaef2890b8 Mon Sep 17 00:00:00 2001 From: hristov Date: Tue, 10 Feb 2004 09:54:10 +0000 Subject: [PATCH] Using vertex from underlying event in AliSimulation (T.Kuhr) --- EVGEN/EVGENLinkDef.h | 1 - EVGEN/libEVGEN.pkg | 2 +- STEER/AliSimulation.cxx | 27 ++++++++++++++++++++++----- STEER/AliSimulation.h | 3 +++ {EVGEN => STEER}/AliVertexGenFile.cxx | 0 {EVGEN => STEER}/AliVertexGenFile.h | 0 STEER/STEERLinkDef.h | 1 + STEER/libSTEER.pkg | 2 +- 8 files changed, 28 insertions(+), 8 deletions(-) rename {EVGEN => STEER}/AliVertexGenFile.cxx (100%) rename {EVGEN => STEER}/AliVertexGenFile.h (100%) diff --git a/EVGEN/EVGENLinkDef.h b/EVGEN/EVGENLinkDef.h index f5c3e82d40d..ce645e77ffd 100644 --- a/EVGEN/EVGENLinkDef.h +++ b/EVGEN/EVGENLinkDef.h @@ -51,7 +51,6 @@ #pragma link C++ class AliGenSlowNucleons+; #pragma link C++ class AliSlowNucleonModel+; #pragma link C++ class AliSlowNucleonModelExp+; -#pragma link C++ class AliVertexGenFile+; #pragma link C++ class AliGenMUONCocktail+; #endif diff --git a/EVGEN/libEVGEN.pkg b/EVGEN/libEVGEN.pkg index 29330e1b073..b5c963f98a7 100644 --- a/EVGEN/libEVGEN.pkg +++ b/EVGEN/libEVGEN.pkg @@ -18,7 +18,7 @@ SRCS = AliGenHIJINGpara.cxx AliGenBox.cxx AliGenFixed.cxx \ AliStructFuncType.cxx AliGenSlowNucleons.cxx \ AliGenGeVSimEventHeader.cxx\ AliSlowNucleonModel.cxx AliSlowNucleonModelExp.cxx \ - AliVertexGenFile.cxx AliGenMUONCocktail.cxx + AliGenMUONCocktail.cxx # Headerfiles for this particular package (Path respect to own directory) HDRS= $(SRCS:.cxx=.h) diff --git a/STEER/AliSimulation.cxx b/STEER/AliSimulation.cxx index 853df4ef9b4..da034993db7 100644 --- a/STEER/AliSimulation.cxx +++ b/STEER/AliSimulation.cxx @@ -83,6 +83,7 @@ #include "AliRun.h" #include "AliModule.h" #include "AliGenerator.h" +#include "AliVertexGenFile.h" #include "AliRunDigitizer.h" #include "AliDigitizer.h" #include @@ -107,6 +108,7 @@ AliSimulation::AliSimulation(const char* configFileName, fConfigFileName(configFileName), fGAliceFileName("galice.root"), fBkgrdFileNames(NULL), + fUseBkgrdVertex(kTRUE), fRegionOfInterest(kTRUE) { // create simulation object with default parameters @@ -128,6 +130,7 @@ AliSimulation::AliSimulation(const AliSimulation& sim) : fConfigFileName(sim.fConfigFileName), fGAliceFileName(sim.fGAliceFileName), fBkgrdFileNames(NULL), + fUseBkgrdVertex(sim.fUseBkgrdVertex), fRegionOfInterest(sim.fRegionOfInterest) { // copy constructor @@ -258,12 +261,26 @@ Bool_t AliSimulation::RunSimulation(Int_t nEvents) } fGAliceFileName = runLoader->GetFileName(); + if (!gAlice->Generator()) { + Error("RunSimulation", "gAlice has no generator object. " + "Check your config file: %s", fConfigFileName.Data()); + return kFALSE; + } + + // get vertex from background file in case of merging + if (fUseBkgrdVertex && + fBkgrdFileNames && (fBkgrdFileNames->GetEntriesFast() > 0)) { + Int_t signalPerBkgrd = fBkgrdFileNames->At(0)->GetUniqueID(); + const char* fileName = ((TObjString*) + (fBkgrdFileNames->At(0)))->GetName(); + Info("RunSimulation", "The vertex will be taken from the background " + "file %s with nSignalPerBackground = %d", + fileName, signalPerBkgrd); + AliVertexGenFile* vtxGen = new AliVertexGenFile(fileName, signalPerBkgrd); + gAlice->Generator()->SetVertexGenerator(vtxGen); + } + if (!fRunSimulation) { - if (!gAlice->Generator()) { - Error("RunSimulation", "gAlice has no generator object. " - "Check your config file: %s", fConfigFileName.Data()); - return kFALSE; - } gAlice->Generator()->SetTrackingFlag(0); } diff --git a/STEER/AliSimulation.h b/STEER/AliSimulation.h index bda4d911bf5..4fdd4aa874e 100644 --- a/STEER/AliSimulation.h +++ b/STEER/AliSimulation.h @@ -28,6 +28,8 @@ public: void SetMakeSDigits(const char* detectors) {fMakeSDigits = detectors;}; void MergeWith(const char* fileName, Int_t nSignalPerBkgrd = 1); + void SetUseBkgrdVertex(Bool_t useBkgrdVertex) + {fUseBkgrdVertex = useBkgrdVertex;}; void SetRegionOfInterest(Bool_t flag) {fRegionOfInterest = flag;}; void SetMakeDigits(const char* detectors) {fMakeDigits = detectors;}; @@ -57,6 +59,7 @@ private: TString fConfigFileName; // name of the config file TString fGAliceFileName; // name of the galice file TObjArray* fBkgrdFileNames; // names of background files for merging + Bool_t fUseBkgrdVertex; // use vertex from background in case of merging Bool_t fRegionOfInterest; // digitization in region of interest ClassDef(AliSimulation, 1) // class for running generation, simulation and digitization diff --git a/EVGEN/AliVertexGenFile.cxx b/STEER/AliVertexGenFile.cxx similarity index 100% rename from EVGEN/AliVertexGenFile.cxx rename to STEER/AliVertexGenFile.cxx diff --git a/EVGEN/AliVertexGenFile.h b/STEER/AliVertexGenFile.h similarity index 100% rename from EVGEN/AliVertexGenFile.h rename to STEER/AliVertexGenFile.h diff --git a/STEER/STEERLinkDef.h b/STEER/STEERLinkDef.h index e9fef675c20..1d7988d9392 100644 --- a/STEER/STEERLinkDef.h +++ b/STEER/STEERLinkDef.h @@ -80,6 +80,7 @@ #pragma link C++ class AliMC+; #pragma link C++ class AliSimulation+; #pragma link C++ class AliReconstruction+; +#pragma link C++ class AliVertexGenFile+; #endif diff --git a/STEER/libSTEER.pkg b/STEER/libSTEER.pkg index 1c6621d06d2..ee83df94db6 100644 --- a/STEER/libSTEER.pkg +++ b/STEER/libSTEER.pkg @@ -17,7 +17,7 @@ AliGausCorr.cxx AliTrackReference.cxx AliESD.cxx \ AliTrackMap.cxx AliTrackMapper.cxx AliCollisionGeometry.cxx \ AliMemoryWatcher.cxx AliBarrelTrack.cxx \ AliESDtrack.cxx AliESDCaloTrack.cxx AliESDMuonTrack.cxx AliESDv0.cxx AliESDcascade.cxx AliESDvertex.cxx AliESDpid.cxx \ -AliMC.cxx AliSimulation.cxx AliReconstruction.cxx +AliMC.cxx AliSimulation.cxx AliReconstruction.cxx AliVertexGenFile.cxx HDRS:= $(SRCS:.cxx=.h) DHDR= STEERLinkDef.h -- 2.43.0