21 bool decayJPsiToElectrons =
false;
22 float numParticles = 1;
25 void geometry( TString tag, Bool_t agml=
true )
27 TString cmd =
"DETP GEOM "; cmd += tag +
" field=-5.0";
28 if ( !geant_maker ) geant_maker = (
St_geant_Maker *)chain->GetMaker(
"geant");
29 geant_maker -> LoadGeometry(cmd);
33 void command( TString cmd )
35 if ( !geant_maker ) geant_maker = (
St_geant_Maker *)chain->GetMaker(
"geant");
36 geant_maker -> Do( cmd );
39 void trig( Int_t n=1 )
43 for ( Int_t i=0; i<n; i++ ) {
49 Double_t masses[2] = { 0.00051099895000, 0.00051099895000} ;
51 if (!decayJPsiToElectrons){
52 masses[0] = 0.1056583755;
53 masses[1] = 0.1056583755;
56 TGenPhaseSpace genEvent;
59 W.SetXYZM( 0, 0, 30, 3.096 );
60 genEvent.SetDecay(W, 2, masses);
63 for (
int j = 0; j < numParticles; j++ ){
64 Double_t weight = genEvent.Generate();
65 TLorentzVector *pElectron = genEvent.GetDecay(0);
66 TLorentzVector *pPositron = genEvent.GetDecay(1);
67 lv = *pElectron + *pPositron;
70 if ( decayJPsiToElectrons )
74 ele->
SetPx(pElectron->Px());
75 ele->
SetPy(pElectron->Py());
76 ele->
SetPz(pElectron->Pz());
80 if ( decayJPsiToElectrons )
84 pos->
SetPx(pPositron->Px());
85 pos->
SetPy(pPositron->Py());
86 pos->
SetPz(pPositron->Pz());
91 cout <<
"ele eta = " << pElectron->Eta() << endl;
92 cout <<
"pos eta = " << pPositron->Eta() << endl;
120 gSystem->Load(
"libKinematics.so");
128 void jpsi( Int_t nevents=10000, Int_t rngSeed=12352342,
bool decayToElectrons =
true )
131 hMll =
new TH1F(
"hMll",
";Mll;counts [10MeV]", 200, 2.0, 4.0 );
132 decayJPsiToElectrons = decayToElectrons;
133 cout <<
"Generating: " << nevents <<
" events with seed: " << rngSeed << endl;
134 if ( decayToElectrons ){
135 cout <<
"Simulating J/psi->e+e-" << endl;
137 cout <<
"Simulating J/psi->mu+mu-" << endl;
139 gSystem->Load(
"libStarRoot.so" );
140 gROOT->SetMacroPath(
".:/star-sw/StRoot/macros/:./StRoot/macros:./StRoot/macros/graphics:./StRoot/macros/analysis:./StRoot/macros/test:./StRoot/macros/examples:./StRoot/macros/html:./StRoot/macros/qa:./StRoot/macros/calib:./StRoot/macros/mudst:/afs/rhic.bnl.gov/star/packages/DEV/StRoot/macros:/afs/rhic.bnl.gov/star/packages/DEV/StRoot/macros/graphics:/afs/rhic.bnl.gov/star/packages/DEV/StRoot/macros/analysis:/afs/rhic.bnl.gov/star/packages/DEV/StRoot/macros/test:/afs/rhic.bnl.gov/star/packages/DEV/StRoot/macros/examples:/afs/rhic.bnl.gov/star/packages/DEV/StRoot/macros/html:/afs/rhic.bnl.gov/star/packages/DEV/StRoot/macros/qa:/afs/rhic.bnl.gov/star/packages/DEV/StRoot/macros/calib:/afs/rhic.bnl.gov/star/packages/DEV/StRoot/macros/mudst:/afs/rhic.bnl.gov/star/ROOT/36/5.34.38/.sl73_x8664_gcc485/rootdeb/macros:/afs/rhic.bnl.gov/star/ROOT/36/5.34.38/.sl73_x8664_gcc485/rootdeb/tutorials");
142 gROOT->ProcessLine(
".L bfc.C");
144 TString simple =
"sdt20211016 y2024 geant gstar usexgeom agml ";
148 gSystem->Load(
"libVMC.so");
150 gSystem->Load(
"StarGeneratorUtil.so" );
151 gSystem->Load(
"StarGeneratorEvent.so" );
152 gSystem->Load(
"StarGeneratorBase.so" );
154 gSystem->Load(
"libMathMore.so" );
155 gSystem->Load(
"xgeometry.so" );
170 _primary -> SetFileName(
"jpsi.root");
171 chain -> AddBefore(
"geant", _primary );
180 _primary->
SetSigma( 0.1, 0.1, 0.1 );
187 command(
"gkine -4 0");
188 command(
"gfile o jpsi.fzd");
191 hNumHits =
new TH1F(
"hNumEvents",
"Nhits/plane/incident track vs event number",nevents + 1, -0.5, (
float)( nevents ) + 0.5 );
216 TFile * f =
new TFile(
"jpsi_gen.root",
"RECREATE" );
221 command(
"call agexit");
StarGenParticle * AddParticle()
void SetPx(Float_t px)
Set the x-component of the momentum.
void SetSigma(Double_t sx, Double_t sy, Double_t sz, Double_t rho=0)
Star Simple Kinematics Generator.
Yet another particle class.
virtual void Clear(Option_t *option="")
User defined functions.
void AddGenerator(StarGenerator *gener)
void SetPz(Float_t pz)
Set the z-component of the momentum.
Int_t Init()
Initialize generator.
void SetMass(Float_t mass)
Set the mass.
static void seed(UInt_t s)
Base class for event records.
Main steering class for event generation.
void SetPy(Float_t py)
Set the y-component of the momentum.
static void capture()
Capture gRandom random number generator.
Sparse class to hold track kinematics.
void SetVertex(Double_t x, Double_t y, Double_t z)
Set the x, y and z vertex position.