10 Int_t hid( Int_t z, Int_t a, Int_t l=0 )
36 double _vxyz[3] = { 0, 0, 0 };
37 double _sxyz[3] = { 0, 0, 0 };
40 unsigned int _seed = 0;
42 double _eventtime = 0;
44 double _magfield = -5.005;
48 int _pid[50]={1,2,3,8,9,11,12,14,15,10017,10007,45,50045,49,50049,37,61053,61054,62053,62054};
49 TString _pnm[50]={
"gamma",
"positron",
"electron",
"pi+",
"pi-",
"K+",
"K-",
"proton",
"antiproton",
"eta",
"pi0",
"deuteron",
"antideuteron",
"he3",
"antihe3",
"D0",
"HyperT_2body",
"HyperT_bar_2body",
"HyperT_3body",
"HyperT_bar_3body"};
50 TString _part =
"pi+";
56 bool _rapiditymode =
false;
60 TString _geometry =
"y2016x";
62 TString SDT =
"sdt20140610";
64 const int maxEvents = 1000;
74 TString sid = gSystem->Getenv(
"JOBID"); sid.Resize(8);
75 TString six = gSystem->Getenv(
"JOBINDEX");
77 unsigned long long id = gROOT->ProcessLine(Form(
"0x%s", sid.Data() ) );
78 unsigned int id1 = (0xffff&id);
79 unsigned int id2 = gROOT->ProcessLine( six.Data() );
88 void geometry( TString tag, Bool_t agml=
true )
90 TString cmd =
"DETP GEOM "; cmd += tag;
91 if ( !geant_maker ) geant_maker = (
St_geant_Maker *)chain->GetMaker(
"geant");
92 geant_maker -> LoadGeometry(cmd);
98 void command( TString cmd )
100 if ( !geant_maker ) geant_maker = (
St_geant_Maker *)chain->GetMaker(
"geant");
101 geant_maker -> Do( cmd );
109 for (
int i=0; i<n; i++ ) {
111 if ( i+1 > maxEvents )
break;
119 cout <<
"_unprimaries = " << _unprimaries << endl;
121 _primary->
SetVertex( _vxyz[0], _vxyz[1], _vxyz[2] );
129 if ( _fpart < 1.0 ) {
130 npart = int(_unprimaries * _fpart) ;
131 if ( npart < _npart ) npart = _npart;
133 else npart = int(_fpart);
135 if(i==0) _part_save=_part;
136 if(_part_save ==
"antideuteron" || _part_save ==
"he3" || _part_save ==
"antihe3"){
144 cout << Form(
"run=%i event=%i seed=%i part=%s npart=%i %i vxyz=%f %f %f",
151 _vxyz[0],_vxyz[1],_vxyz[2]) << endl;
153 command( Form(
"RUNG %i %i", _runnumber, _evtnumber-1 ) );
154 chain->SetDateTime(
int(_eventtime),
int( 100000*(_eventtime-
int(_eventtime)) ) );
158 if ( 0==ptDist ) kinematics->
Kine( npart, _part, _ptmn, _ptmx, _etamn, _etamx );
161 if ( ptDist ) kinematics->
Dist( npart, _part, ptDist, etaDist );
167 if (StarMagField::Instance() && StarMagField::Instance()->IsLocked()) {
168 float scale = StarMagField::Instance()->GetFactor();
169 delete StarMagField::Instance();
171 cout <<
"New mag field. Don't lock, let it be updated" << endl;
191 gSystem->Load(
"libKinematics.so");
196 kinematics->SetAttr(
"rapidity", 1 );
203 void runEmbeddingSimulation2016(
204 const char* tagfile=
"/star/data100/GRID/daq/2014/st_physics_adc_15161060_raw_5000043.tags.root",
206 unsigned int rngSeed=1234,
214 _tagfile = TFile::Open(tagfile);
215 _tags = (TTree*) _tagfile -> Get(
"MoreTags");
217 _tags->SetBranchAddress(
"RunId", &_runnumber );
218 _tags->SetBranchAddress(
"EvtId", &_evtnumber );
219 _tags->SetBranchAddress(
"VX", &_vxyz[0] );
220 _tags->SetBranchAddress(
"VY", &_vxyz[1] );
221 _tags->SetBranchAddress(
"VZ", &_vxyz[2] );
222 _tags->SetBranchAddress(
"nRefMult", &_unprimaries );
224 _tags->SetBranchAddress(
"EvtTime", &_eventtime );
225 _tags->SetBranchAddress(
"ProdTime", &_prodtime );
226 _tags->SetBranchAddress(
"magField", &_magfield );
231 SDT = Form(
"sdt%i",
int(_eventtime));
232 if ( DBV ==
"" ) DBV = Form(
"dbv%i",
int(_prodtime));
235 if ( nevents < 0 ) nevents = _tags->GetEntries();
237 cout <<
"####################################################################" << endl;
238 cout <<
"## Processing nevents = " << nevents << endl;
239 cout <<
"## geometry : " << _geometry.Data() << endl;
240 cout <<
"## sdt timestamp: " << SDT.Data() << endl;
241 cout <<
"## dbv timestamp: " << DBV.Data() << endl;
242 cout <<
"####################################################################" << endl;
256 gROOT->ProcessLine(
".L bfc.C");
258 TString simple = _geometry; simple +=
" ";
259 simple += SDT; simple +=
" ";
260 simple += DBV; simple +=
" ";
261 simple +=
" geant gstar usexgeom agml misalign newtpcalignment bigbig ";
272 gSystem->Load(
"libVMC.so");
274 gSystem->Load(
"StarGeneratorUtil.so" );
275 gSystem->Load(
"StarGeneratorEvent.so" );
276 gSystem->Load(
"StarGeneratorBase.so" );
277 gSystem->Load(
"StarGeneratorDecay.so" );
278 gSystem->Load(
"libPythia8_1_62.so");
279 gSystem->Load(
"libMathMore.so" );
282 gSystem->Load(
"gstar.so" );
283 command(
"call gstar");
301 _primary -> SetFileName(
"kinematics.starsim.root");
302 chain -> AddBefore(
"geant", _primary );
313 pdb.
AddParticle(
"HyperT_2body",
new TParticlePDG(
"HyperpT_2body",
"HyperTriton --> He3 pi-", 2.99131,
false, 0.0, +3.0,
"hypernucleus", +hid(1,3,1), 0, 61053 ));
314 pdb.
AddParticle(
"HyperT_bar_2body",
new TParticlePDG(
"HyperT_bar_2body",
"AntiHyperTriton --> He3bar pi+", 2.99131,
false, 0.0, -3.0,
"hypernucleus", -hid(1,3,1), 0, 61054 ));
315 pdb.
AddParticle(
"HyperT_3body",
new TParticlePDG(
"HyperT_3body",
"HyperTriton --> d p pi-", 2.99131,
false, 0.0, +3.0,
"hypernucleus", +hid(1,3,1), 0, 62053 ));
316 pdb.
AddParticle(
"HyperT_bar_3body",
new TParticlePDG(
"HyperT_bar_3body",
"AntiHyperTriton --> dbar pbar pi+", 2.99131,
false, 0.0, -3.0,
"hypernucleus", -hid(1,3,1), 0, 62054 ));
318 pdb.
AddParticle(
"deuteron",
new TParticlePDG(
"deuteron",
"Deuteron", 1.876,
true, 0.0, 3.0,
"hion", hid(1,2,0), 0, 45 ));
319 pdb.
AddParticle(
"antideuteron",
new TParticlePDG(
"antideuteron",
"anti Deuteron", 1.876,
true, 0.0, -3.0,
"hion", -hid(1,2,0), 0, 50045 ));
320 pdb.
AddParticle(
"he3",
new TParticlePDG(
"he3",
"Helium-3", 2.809,
true, 0.0, 6.0,
"hion", hid(2,3,0), 0, 49 ));
321 pdb.
AddParticle(
"antihe3",
new TParticlePDG(
"antihe3",
"anti Helium-3", 2.809,
true, 0.0, -6.0,
"hion", -hid(2,3,0), 0, 50049 ));
340 data.
AddParticleToG3(
"D0", 0.186483E+01, 0.41010E-12, 0., 3, 421, 37, 0, 0 );
346 decayPy8->
Set(
"421:onMode = off");
347 decayPy8->
Set(
"421:onIfMatch = 211 321");
350 data.
AddParticleToG3(
"eta",5.47853e-01, 0.50244E-18, 0., 3, 221, 17, 0, 0 );
356 decayPy8->
Set(
"221:onMode = off");
357 decayPy8->
Set(
"221:onIfMatch = 22 11 -11");
360 data.
AddParticleToG3(
"pi0",1.34977e-01, 0.85200E-16, 0., 3, 111, 7, 0, 0 );
366 decayPy8->
Set(
"111:onMode = off");
367 decayPy8->
Set(
"111:onIfMatch = 22 11 -11");
369 if(_part ==
"deuteron" || _part ==
"antideuteron"){
370 data.
AddParticleToG3(
"deuteron", 0.1876E+01, 0.10000E+16, 1., 8, 1000010020, 45, 0, 0 );
371 TParticlePDG* deuteron = data.
GetParticle(
"deuteron");
374 if(_part ==
"antideuteron"){
375 data.
AddParticleToG3(
"antideuteron", 0.1876E+01, 0.10000E+16, -1., 8, -1000010020, 50045, 0, 0 );
376 TParticlePDG* antideuteron = data.
GetParticle(
"antideuteron");
377 antideuteron->Print();
390 geometry(Form(
" field=%f %s", _magfield, _geometry.Data()));
391 command(
"gkine -4 0");
399 command(Form(
"gfile o %s", fzdfile));
406 command(
"call agexit");
420 TTable* gtable = (
TTable* ) chain->GetDataSet(
"g2t_track");
428 for (
int itable=1; itable<ntable; itable++ )
430 g2t_track_st*
track = (g2t_track_st*)gtable->
At(itable);
431 if ( 0 == track->eg_label ) { Etest += track->e; }
434 cout <<
"Egener = " << Etotal << endl;
435 cout <<
"Egeant = " << Etest << endl;
436 cout <<
"Violation = " << 100*(Etest / Etotal - 1) <<
"%" << endl;
441 void runEmbeddingSimulation2016(
443 const unsigned int seed,
459 if ( dbv ) DBV = dbv;
462 for (indx=0;indx<50;indx++) {
463 if ( _pid[indx] == pid ) {
468 if ( indx == 50 ) cout<<
"WRONG GeantID: "<<pid<<
" !!!"<<endl;
472 if ( _part.Contains(
"D0") )
474 ptDist =
new TF1(
"ptDist",
"(1/[0])/(1+(x/[0])^2)^[1]",_ptmn,_ptmx);
475 ptDist->SetParameter(0, 3.0);
476 ptDist->SetParameter(1, 5.0);
478 etaDist =
new TF1(
"etaDist",
"1.0",_etamn,_etamx);
484 runEmbeddingSimulation2016( tagfile, fzdfile, seed, ne );
void SetSigma(Double_t sx, Double_t sy, Double_t sz, Double_t rho=0)
void Print(const Option_t *opts="head") const
Star Simple Kinematics Generator.
Yet another particle class.
virtual void Clear(Option_t *option="")
User defined functions.
Float_t GetEnergy()
Get the energy.
static StarParticleData & instance()
Returns a reference to the single instance of this class.
TParticlePDG * GetParticle(const Char_t *name)
Get a particle by name.
Interface to PDG information.
void AddGenerator(StarGenerator *gener)
Connects VMC to class(es) which handle particle decays.
void Dist(Int_t ntrack, const Char_t *type, TF1 *pt, TF1 *y, TF1 *phi=0)
void AddParticle(const Char_t *name, TParticlePDG *particle)
Add a particle to the database.
Int_t Init()
Initialize generator.
virtual Long_t GetNRows() const
Returns the number of the used rows for the wrapped table.
static void seed(UInt_t s)
Base class for event records.
StarGenEvent * event()
Return a pointer to the event.
Main steering class for event generation.
void AddDecayer(Int_t pdgid, TVirtualMCDecayer *decayer)
void SetDebug(int dbg=1)
Set the debug level.
void Print(const Option_t *opts="") const
Print the particle.
const void * At(Int_t i) const
Returns a pointer to the i-th row of the table.
static void capture()
Capture gRandom random number generator.
Sparse class to hold track kinematics.
void Kine(Int_t ntrack, const Char_t *type="pi+,pi-,K+,K-,proton,antiproton", Double_t ptlow=0.0, Double_t pthigh=500.0, Double_t ylow=-10.0, Double_t yhigh=+10.0, Double_t philow=0.0, Double_t phihigh=TMath::TwoPi())
TParticlePDG * AddParticleToG3(const char *name, const double mass, const double lifetime, const double charge, const int tracktype, const int pdgcode, const int g3code, const double *bratio=0, const int *mode=0)
void Set(const char *cmd)
Modify pythia8 behavior.
void SetVertex(Double_t x, Double_t y, Double_t z)
Set the x, y and z vertex position.