From e7c989e4b7fb4940e1b7175670324ca85b25f6fc Mon Sep 17 00:00:00 2001 From: cvetan Date: Sat, 26 Jul 2008 20:53:00 +0000 Subject: [PATCH] Moving set/get energy in cms, projectile, target propertie to the very base AliGenerator class. Now all this is available to AliSimulation in order to write correctly the GRP entry. Please note that in case of generators which do not derive from AliGeNMC the user has to setp explicitly energy in cms, projectile and target in order to get a correct GRP entry. --- EVGEN/AliGenMC.cxx | 32 +++++++++++++++----------------- EVGEN/AliGenMC.h | 15 ++------------- PYTHIA6/AliGenPythia.cxx | 4 ++-- PYTHIA6/AliGenPythiaPlus.cxx | 4 ++-- STEER/AliGenerator.cxx | 18 ++++++++++++++++-- STEER/AliGenerator.h | 25 +++++++++++++++++++++++-- STEER/AliSimulation.cxx | 14 ++++++++------ TDPMjet/AliGenDPMjet.cxx | 6 +++--- THijing/AliGenHijing.cxx | 4 ++-- THydjet/AliGenHydjet.cxx | 2 +- 10 files changed, 74 insertions(+), 50 deletions(-) diff --git a/EVGEN/AliGenMC.cxx b/EVGEN/AliGenMC.cxx index 61166d587fc..466f44b2143 100644 --- a/EVGEN/AliGenMC.cxx +++ b/EVGEN/AliGenMC.cxx @@ -52,20 +52,19 @@ AliGenMC::AliGenMC() fXingAngleY(0.), fForceDecay(kAll), fMaxLifeTime(1.e-15), - fAProjectile(1), - fZProjectile(1), - fATarget(1), - fZTarget(1), - fProjectile("P"), - fTarget("P"), fDyBoost(0.), fGeometryAcceptance(0), fPdgCodeParticleforAcceptanceCut(0), fNumberOfAcceptedParticles(0), - fNprimaries(0), - fEnergyCMS(0) + fNprimaries(0) { // Default Constructor + fAProjectile = 1; + fZProjectile = 1; + fATarget = 1; + fZTarget = 1; + fProjectile = "P"; + fTarget = "P"; } AliGenMC::AliGenMC(Int_t npart) @@ -88,22 +87,21 @@ AliGenMC::AliGenMC(Int_t npart) fXingAngleY(0.), fForceDecay(kAll), fMaxLifeTime(1.e-15), - fAProjectile(1), - fZProjectile(1), - fATarget(1), - fZTarget(1), - fProjectile("P"), - fTarget("P"), fDyBoost(0.), fGeometryAcceptance(0), fPdgCodeParticleforAcceptanceCut(0), fNumberOfAcceptedParticles(0), - fNprimaries(0), - fEnergyCMS(0) + fNprimaries(0) { // Constructor // - for (Int_t i=0; i<8; i++) fParentSelect[i]=fChildSelect[i]=0; + fAProjectile = 1; + fZProjectile = 1; + fATarget = 1; + fZTarget = 1; + fProjectile = "P"; + fTarget = "P"; + for (Int_t i=0; i<8; i++) fParentSelect[i]=fChildSelect[i]=0; } AliGenMC::~AliGenMC() diff --git a/EVGEN/AliGenMC.h b/EVGEN/AliGenMC.h index ae136b9fdea..beb5177570a 100644 --- a/EVGEN/AliGenMC.h +++ b/EVGEN/AliGenMC.h @@ -60,11 +60,6 @@ class AliGenMC : public AliGenerator virtual void SetCrossingAngle(Float_t phiX, Float_t phiY) {fXingAngleX = phiX; fXingAngleY = phiY;} virtual void Boost(); virtual void AddHeader(AliGenEventHeader* header); - virtual void GetProjectile(TString& tar, Int_t& a, Int_t& z) const - {tar = fProjectile; a = fAProjectile; z = fZProjectile;} - virtual void GetTarget(TString& tar, Int_t& a, Int_t& z) const - {tar = fTarget; a = fATarget; z = fZTarget;} - virtual Float_t GetEnergyCMS() const { return fEnergyCMS; } protected: // check if particle is selected as parent particle @@ -94,23 +89,17 @@ class AliGenMC : public AliGenerator Float_t fXingAngleY; // Crossing angle Y Decay_t fForceDecay; // Decay channel forced Float_t fMaxLifeTime; // Maximum lifetime for unstable particles - Int_t fAProjectile; // Projectile A - Int_t fZProjectile; // Projectile Z - Int_t fATarget; // Target A - Int_t fZTarget; // Target Z - TString fProjectile; // Projectile - TString fTarget; // Target Double_t fDyBoost; // dy for boost into lab frame AliGeometry* fGeometryAcceptance; // Geometry to which particles must be simulated Int_t fPdgCodeParticleforAcceptanceCut; // Abs(PDG Code) of the particle to which the GeometryAcceptance must be applied Int_t fNumberOfAcceptedParticles; // Number of accepted particles in GeometryAcceptance with the right Abs(PdgCode) Int_t fNprimaries; // Number of produced and stored particles - Float_t fEnergyCMS; //Centre of mass energy + private: AliGenMC(const AliGenMC &MC); AliGenMC & operator=(const AliGenMC & rhs); - ClassDef(AliGenMC,6) // AliGenerator implementation for generators using MC methods + ClassDef(AliGenMC,7) // AliGenerator implementation for generators using MC methods }; #endif diff --git a/PYTHIA6/AliGenPythia.cxx b/PYTHIA6/AliGenPythia.cxx index 89872b79fcd..175c7d89ac8 100644 --- a/PYTHIA6/AliGenPythia.cxx +++ b/PYTHIA6/AliGenPythia.cxx @@ -130,7 +130,7 @@ AliGenPythia::AliGenPythia(): { // Default Constructor - SetEnergyCMS(5500.); + fEnergyCMS = 5500.; SetNuclei(0,0); if (!AliPythiaRndm::GetPythiaRandom()) AliPythiaRndm::SetPythiaRandom(GetRandom()); @@ -221,7 +221,7 @@ AliGenPythia::AliGenPythia(Int_t npart) // semimuonic decay // structure function GRVHO // - SetEnergyCMS(5500.); + fEnergyCMS = 5500.; fName = "Pythia"; fTitle= "Particle Generator using PYTHIA"; SetForceDecay(); diff --git a/PYTHIA6/AliGenPythiaPlus.cxx b/PYTHIA6/AliGenPythiaPlus.cxx index dcecd7b4261..6ac8faa176e 100644 --- a/PYTHIA6/AliGenPythiaPlus.cxx +++ b/PYTHIA6/AliGenPythiaPlus.cxx @@ -128,7 +128,7 @@ AliGenPythiaPlus::AliGenPythiaPlus(): { // Default Constructor - SetEnergyCMS(5500.); + fEnergyCMS = 5500.; SetNuclei(0,0); if (!AliPythiaRndm::GetPythiaRandom()) AliPythiaRndm::SetPythiaRandom(GetRandom()); @@ -217,7 +217,7 @@ AliGenPythiaPlus::AliGenPythiaPlus(AliPythiaBase* pythia) // semimuonic decay // structure function GRVHO // - SetEnergyCMS(5500.); + fEnergyCMS = 5500.; fName = "Pythia"; fTitle= "Particle Generator using PYTHIA"; SetForceDecay(); diff --git a/STEER/AliGenerator.cxx b/STEER/AliGenerator.cxx index 207db954456..e94345f16bf 100644 --- a/STEER/AliGenerator.cxx +++ b/STEER/AliGenerator.cxx @@ -81,7 +81,14 @@ AliGenerator::AliGenerator(): fVertex(3), fStack(0), fContainer(0), - fCollisionGeometry(0) + fCollisionGeometry(0), + fEnergyCMS(0), + fAProjectile(0), + fZProjectile(0), + fATarget(0), + fZTarget(0), + fProjectile(""), + fTarget("") { // // Default constructor @@ -142,7 +149,14 @@ AliGenerator::AliGenerator(Int_t npart): fVertex(3), fStack(0), fContainer(0), - fCollisionGeometry(0) + fCollisionGeometry(0), + fEnergyCMS(0), + fAProjectile(0), + fZProjectile(0), + fATarget(0), + fZTarget(0), + fProjectile(""), + fTarget("") { // // Standard constructor diff --git a/STEER/AliGenerator.h b/STEER/AliGenerator.h index 7a84c6d5936..13a5ce63442 100644 --- a/STEER/AliGenerator.h +++ b/STEER/AliGenerator.h @@ -34,6 +34,7 @@ class AliGenerator : public TNamed, public AliRndm { public: + AliGenerator(); AliGenerator(Int_t npart); virtual ~AliGenerator(); @@ -87,6 +88,18 @@ class AliGenerator : public TNamed, public AliRndm virtual Bool_t NeedsCollisionGeometry() const {return kFALSE;} virtual AliCollisionGeometry* CollisionGeometry() const {return fCollisionGeometry;} virtual void SetCollisionGeometry(AliCollisionGeometry* geom) {fCollisionGeometry = geom;} + + virtual Float_t GetEnergyCMS() const { return fEnergyCMS; } + virtual void SetEnergyCMS(Float_t energy = 0) { fEnergyCMS = energy; } + virtual void GetProjectile(TString& tar, Int_t& a, Int_t& z) const + {tar = fProjectile; a = fAProjectile; z = fZProjectile;} + virtual void GetTarget(TString& tar, Int_t& a, Int_t& z) const + {tar = fTarget; a = fATarget; z = fZTarget;} + virtual void SetProjectile(TString proj="", Int_t a = 0, Int_t z = 0) + {fProjectile = proj; fAProjectile = a; fZProjectile = z;} + virtual void SetTarget(TString tar="", Int_t a = 0, Int_t z = 0) + {fTarget = tar; fATarget = a; fZTarget = z;} + protected: virtual void PushTrack(Int_t done, Int_t parent, Int_t pdg, Float_t *pmom, Float_t *vpos, Float_t *polar, @@ -99,7 +112,7 @@ class AliGenerator : public TNamed, public AliRndm TMCProcess mech, Int_t &ntr, Float_t weight = 1, Int_t is = 0); virtual void KeepTrack(Int_t itrack); virtual void SetHighWaterMark(Int_t nt); - + protected: TGenerator* fMCEvGen; //!Pointer to the generator Float_t fThetaMin; //Minimum theta of generation in radians @@ -142,11 +155,19 @@ class AliGenerator : public TNamed, public AliRndm kMomentumRange = BIT(19) }; + Float_t fEnergyCMS; // Centre of mass energy + Int_t fAProjectile; // Projectile A + Int_t fZProjectile; // Projectile Z + Int_t fATarget; // Target A + Int_t fZTarget; // Target Z + TString fProjectile; // Projectile + TString fTarget; // Target + private: AliGenerator(const AliGenerator &gen); AliGenerator & operator=(const AliGenerator &gen); - ClassDef(AliGenerator,3) // Base class for event generators + ClassDef(AliGenerator,4) // Base class for event generators }; #endif diff --git a/STEER/AliSimulation.cxx b/STEER/AliSimulation.cxx index b329bae0e9c..a56444f4a0b 100644 --- a/STEER/AliSimulation.cxx +++ b/STEER/AliSimulation.cxx @@ -141,7 +141,6 @@ #include "AliHLTSimulation.h" #include "AliQADataMakerSteer.h" #include "AliSysInfo.h" -#include "AliGenMC.h" #include "AliMagF.h" ClassImp(AliSimulation) @@ -1887,7 +1886,7 @@ void AliSimulation::WriteGRPEntry() grpMap->Add(new TObjString("fAliceStartTime"),new TObjString("0")); grpMap->Add(new TObjString("fAliceStopTime"),new TObjString("9999")); - const AliGenMC *gen = static_cast(gAlice->Generator()); + const AliGenerator *gen = gAlice->Generator(); if (gen) { grpMap->Add(new TObjString("fAliceBeamEnergy"),new TObjString(Form("%f",gen->GetEnergyCMS()))); TString projectile; @@ -1896,12 +1895,17 @@ void AliSimulation::WriteGRPEntry() TString target; gen->GetTarget(target,a,z); TString beamType = projectile + "-" + target; - grpMap->Add(new TObjString("fAliceBeamType"),new TObjString(beamType.Data())); + if (!beamType.CompareTo("-")) { + grpMap->Add(new TObjString("fAliceBeamType"),new TObjString("UNKNOWN")); + } + else { + grpMap->Add(new TObjString("fAliceBeamType"),new TObjString(beamType.Data())); + } } else { AliWarning("Unknown beam type and energy!"); grpMap->Add(new TObjString("fAliceBeamEnergy"),new TObjString("UNKNOWN")); - grpMap->Add(new TObjString("fAliceBeamType"),new TObjString("UNKNOWN")); + grpMap->Add(new TObjString("fAliceBeamType"),new TObjString("0")); } UInt_t detectorPattern = 0; @@ -1956,8 +1960,6 @@ void AliSimulation::WriteGRPEntry() AliCDBId id("GRP/GRP/Data", man->GetRun(), man->GetRun()); AliCDBMetaData *metadata= new AliCDBMetaData(); - // Get root version - const char* rootv = gROOT->GetVersion(); metadata->SetResponsible("alice-off@cern.ch"); metadata->SetComment("Automatically produced GRP entry for Monte Carlo"); diff --git a/TDPMjet/AliGenDPMjet.cxx b/TDPMjet/AliGenDPMjet.cxx index 5f0fba8a9db..32624e68615 100644 --- a/TDPMjet/AliGenDPMjet.cxx +++ b/TDPMjet/AliGenDPMjet.cxx @@ -61,7 +61,7 @@ AliGenDPMjet::AliGenDPMjet() fProcess(kDpmMb) { // Constructor - SetEnergyCMS(5500.); + fEnergyCMS = 5500.; AliDpmJetRndm::SetDpmJetRandom(GetRandom()); } @@ -88,7 +88,7 @@ AliGenDPMjet::AliGenDPMjet(Int_t npart) { // Default PbPb collisions at 5. 5 TeV // - SetEnergyCMS(5500.); + fEnergyCMS = 5500.; fName = "DPMJET"; fTitle= "Particle Generator using DPMJET"; SetTarget(); @@ -117,7 +117,7 @@ AliGenDPMjet::AliGenDPMjet(const AliGenDPMjet &/*Dpmjet*/) fProcess(kDpmMb) { // Dummy copy constructor - SetEnergyCMS(5500.); + fEnergyCMS = 5500.; } //______________________________________________________________________________ diff --git a/THijing/AliGenHijing.cxx b/THijing/AliGenHijing.cxx index a6797c7b56f..1ffbd0ac531 100644 --- a/THijing/AliGenHijing.cxx +++ b/THijing/AliGenHijing.cxx @@ -75,7 +75,7 @@ AliGenHijing::AliGenHijing() fNoHeavyQuarks(kFALSE) { // Constructor - SetEnergyCMS(5500.); + fEnergyCMS = 5500.; AliHijingRndm::SetHijingRandom(GetRandom()); } @@ -119,7 +119,7 @@ AliGenHijing::AliGenHijing(Int_t npart) { // Default PbPb collisions at 5. 5 TeV // - SetEnergyCMS(5500.); + fEnergyCMS = 5500.; fName = "Hijing"; fTitle= "Particle Generator using HIJING"; // diff --git a/THydjet/AliGenHydjet.cxx b/THydjet/AliGenHydjet.cxx index 77b1de52f14..6f10a334048 100755 --- a/THydjet/AliGenHydjet.cxx +++ b/THydjet/AliGenHydjet.cxx @@ -36,7 +36,6 @@ ClassImp(AliGenHydjet) AliGenHydjet::AliGenHydjet(Int_t npart) : AliGenMC(npart), //initial parameters - fEnergyCMS(5500.), //Energy cms fFrame("CMS"), // Reference frame fAtomicWeigth(207), // Projectile-Target atomic weight fIfbtype(0), // centrality type @@ -63,6 +62,7 @@ AliGenHydjet::AliGenHydjet(Int_t npart) : { // Default PbPb collisions at 5. 5 TeV // + fEnergyCMS = 5500.; //Energy cms fName = "Hydjet"; fTitle = "Particle Generator using Hydjet"; // Set random number generator -- 2.39.3