Skip to content

Commit 766d6d8

Browse files
committed
Generators will tell its length/time units to AliGenMC for Boost method
AliGenMC::Boost() method assumes m/s for length/time units. In case the generator uses other units it must set the AliGenMC::SetGeneratorUnitsForMeterSecond(lgtC, timeC) with lgtC and timeC being the coefficients translating generator's units to m/s.
1 parent dab2acd commit 766d6d8

File tree

7 files changed

+44
-7
lines changed

7 files changed

+44
-7
lines changed

EVGEN/AliGenMC.cxx

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "AliRun.h"
3434
#include "AliGeometry.h"
3535
#include "AliDecayer.h"
36+
#include "AliLog.h"
3637

3738
ClassImp(AliGenMC)
3839

@@ -57,6 +58,8 @@ AliGenMC::AliGenMC()
5758
fForceDecay(kAll),
5859
fMaxLifeTime(1.e-15),
5960
fDyBoost(0.),
61+
fSpace2TimeCoeff(1.),
62+
fTime2SpaceCoeff(1.),
6063
fGeometryAcceptance(0),
6164
fPdgCodeParticleforAcceptanceCut(0),
6265
fNumberOfAcceptedParticles(0),
@@ -92,6 +95,8 @@ AliGenMC::AliGenMC(Int_t npart)
9295
fForceDecay(kAll),
9396
fMaxLifeTime(1.e-15),
9497
fDyBoost(0.),
98+
fSpace2TimeCoeff(1.),
99+
fTime2SpaceCoeff(1.),
95100
fGeometryAcceptance(0),
96101
fPdgCodeParticleforAcceptanceCut(0),
97102
fNumberOfAcceptedParticles(0),
@@ -426,8 +431,8 @@ void AliGenMC::Boost()
426431
Double_t vy = iparticle->Vy();
427432
Double_t vz = iparticle->Vz();
428433

429-
Double_t ctb = gamma * ct - gb * vz;
430-
Double_t vzb = -gb * ct + gamma * vz;
434+
Double_t ctb = gamma * ct - gb * vz * fSpace2TimeCoeff;
435+
Double_t vzb = -gb * ct * fTime2SpaceCoeff + gamma * vz;
431436

432437
iparticle->SetProductionVertex(vx, vy, vzb, ctb * c_1);
433438
}
@@ -482,3 +487,15 @@ void AliGenMC::AddHeader(AliGenEventHeader* header)
482487
if (gAlice) gAlice->SetGenEventHeader(header);
483488
}
484489
}
490+
491+
void AliGenMC::SetGeneratorUnitsForMeterSecond(double lengthC, double timeC)
492+
{
493+
// set scaling coeffs to convert length and time units used by generator to
494+
// m and s. We store only their ratio, relevant for the Boost
495+
if (timeC<1e-30 || lengthC<1e-30) {
496+
AliFatal("Provided lenght and time units must be positive");
497+
}
498+
AliInfoF("Boost will scale length by %e and time by %e to obtain meter and second",lengthC,timeC);
499+
fSpace2TimeCoeff = lengthC/timeC;
500+
fTime2SpaceCoeff = timeC/lengthC;
501+
}

EVGEN/AliGenMC.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ class AliGenMC : public AliGenerator
6363
virtual void BeamCrossAngle();
6464
virtual void AddHeader(AliGenEventHeader* header);
6565

66+
virtual void SetGeneratorUnitsForMeterSecond(double lengthC=1., double timeC=1.);
67+
6668
protected:
6769
// check if particle is selected as parent particle
6870
Bool_t ParentSelected(Int_t ip) const;
@@ -92,16 +94,18 @@ class AliGenMC : public AliGenerator
9294
Decay_t fForceDecay; // Decay channel forced
9395
Float_t fMaxLifeTime; // Maximum lifetime for unstable particles
9496
Double_t fDyBoost; // dy for boost into lab frame
97+
Double_t fSpace2TimeCoeff; // coeff to convert lenght/time units used by generator to m/s
98+
Double_t fTime2SpaceCoeff; // coeff to convert time/length units used by generator to s/m
9599
AliGeometry* fGeometryAcceptance; // Geometry to which particles must be simulated
96100
Int_t fPdgCodeParticleforAcceptanceCut; // Abs(PDG Code) of the particle to which the GeometryAcceptance must be applied
97101
Int_t fNumberOfAcceptedParticles; // Number of accepted particles in GeometryAcceptance with the right Abs(PdgCode)
98102
Int_t fNprimaries; // Number of produced and stored particles
99-
103+
100104
private:
101105
AliGenMC(const AliGenMC &MC);
102106
AliGenMC & operator=(const AliGenMC & rhs);
103107

104-
ClassDef(AliGenMC,7) // AliGenerator implementation for generators using MC methods
108+
ClassDef(AliGenMC,8) // AliGenerator implementation for generators using MC methods
105109
};
106110
#endif
107111

PYTHIA6/AliPythia6/AliGenPythia.cxx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,10 @@ void AliGenPythia::SetEventListRange(Int_t eventFirst, Int_t eventLast)
394394
void AliGenPythia::Init()
395395
{
396396
// Initialisation
397-
397+
398+
// Coeffs to go from mm / mm to meter / second
399+
SetGeneratorUnitsForMeterSecond(1.e-3, 1e-3/TMath::C());
400+
398401
SetMC(AliPythia::Instance());
399402
fPythia=(AliPythia*) fMCEvGen;
400403

PYTHIA6/AliPythia6/AliGenPythiaPlus.cxx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,10 @@ void AliGenPythiaPlus::Init()
328328

329329
// SetMC(AliPythia::Instance());
330330
// fPythia=(AliPythia*) fMCEvGen;
331-
331+
332+
// Coeffs to go from mm / mm to meter / second
333+
SetGeneratorUnitsForMeterSecond(1.e-3, 1e-3/TMath::C());
334+
332335
//
333336
fParentWeight=1./Float_t(fNpart);
334337
//

TAmpt/TAmpt/AliGenAmpt.cxx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,9 @@ void AliGenAmpt::Init()
161161
{
162162
// Initialisation
163163

164+
// Coeffs to go to from cm/s to meter/seconds
165+
SetGeneratorUnitsForMeterSecond(1.e-2, 1.);
166+
164167
fFrame.Resize(8);
165168
fTarget.Resize(8);
166169
fProjectile.Resize(8);

TDPMjet/AliGenDPMjet.cxx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,10 @@ AliGenDPMjet::~AliGenDPMjet()
176176
void AliGenDPMjet::Init()
177177
{
178178
// Initialization
179-
179+
180+
// Coeffs to go from mm / mm to meter / second
181+
SetGeneratorUnitsForMeterSecond(1.e-3, 1e-3/TMath::C());
182+
180183
if(fEnergyCMS>0. && fBeamEn<0.1) fBeamEn = fEnergyCMS/2;
181184
SetMC(new TDPMjet(fProcess, fAProjectile, fZProjectile, fATarget, fZTarget,
182185
fBeamEn,fEnergyCMS));

THijing/AliGenHijing.cxx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,10 @@ AliGenHijing::~AliGenHijing()
166166
void AliGenHijing::Init()
167167
{
168168
// Initialisation
169+
170+
// Coeffs to go from mm / mm to meter / second
171+
SetGeneratorUnitsForMeterSecond(1.e-3, 1e-3/TMath::C());
172+
169173
fFrame.Resize(8);
170174
fTarget.Resize(8);
171175
fProjectile.Resize(8);

0 commit comments

Comments
 (0)