StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StarUrQMD.cxx
1 #include "StarUrQMD.h"
2 ClassImp(StarUrQMD);
3 
4 #include "StarCallf77.h"
5 #include "StarGenerator/EVENT/StarGenPPEvent.h"
6 #include "StarGenerator/EVENT/StarGenEPEvent.h"
7 #include "StarGenerator/EVENT/StarGenParticle.h"
8 
9 #include "StarGenerator/UTIL/StarRandom.h"
10 #include <map>
11 #include <iostream>
12 
13 // ---------------------------------------------------------------------------
15 extern "C" {
16  Double_t ranfstar_( Int_t *idummy ){ return StarRandom::Instance().flat(); };
17  Double_t pyrstar_ ( Int_t *idummy ){ return StarRandom::Instance().flat(); };
18  // StarRandom &ranf_ = StarRandom::Instance();
19  // StarRandom &pyr_ = StarRandom::Instance();
20 };
21 
22 // ---------------------------------------------------------------------------
23 // ---------------------------------------------------------------------------
24 // ---------------------------------------------------------------------------
25 StarUrQMD::StarUrQMD( const Char_t *name ) : StarGenerator(name)
26 {
27 
28 
29  assert( 2+2==5 ); // UrQMD is not ready for prime time
30 
32  //JFN 11/19/12 15:50- I can't find any documentation on UrQMD status codes (or even if the status information is stored) so we are going to do this in a very general way just to clean it up for later.
33  for ( UInt_t i=0; i<200; i++)
34  {
35  mStatusCode[i+100] = StarGenParticle::kFinal;
36  }
37  //JFN 11/19/12 15:53- This next bit is for reference
38  /*mStatusCode[0] = StarGenParticle::kNull;
39  mStatusCode[1] = StarGenParticle::kFinal;
40  mStatusCode[2] = StarGenParticle::kDocumentation;
41  mStatusCode[3] = StarGenParticle::kDocumentation;*/
42 
43 }
44 // ---------------------------------------------------------------------------
45 // ---------------------------------------------------------------------------
46 // ---------------------------------------------------------------------------
48 {
49  // Proton mass:
50  Double_t ProtonMass = 0.938272046;
51  // Neutron mass:
52  Double_t NeutronMass = 0.939565378;
53 
54  // Map typical species run at RHIC
55  map<TString,Int_t> A, Z;
56  A["p"] = 1; Z["p"] = 1;
57  A["n"] = 1; Z["n"] = 0;
58  A["d"] = 2; Z["d"] = 1;
59  A["He3"]= 3; Z["He3"]= 2;
60  A["Au"] = 197; Z["Au"] = 79;
61  A["Cu"] = 64; Z["Cu"] = 29;
62  A["U"] = 238; Z["U"] = 92;
63 
64  A["proton"] =1; Z["proton"] =1;
65  A["neutron"] =1; Z["neutron"] =0;
66  A["deuteron"] =2; Z["deuteron"] =1;
67  A["e-"] =0; Z["e-"] =0;
68  A["electron"] =0; Z["electron"] =0;
69  A["e+"] =0; Z["e+"] =0;
70  A["positron"] =0; Z["positron"] =0;
71 
72 
73  TString myBlue = mBlue;
74  TString myYell = mYell;
75 
76  stringstream Blue;
77  stringstream Yell;
78 
79  Blue << A[myBlue] << " " << Z[myBlue];
80  Yell << A[myYell] << " " << Z[myYell];
81 
82  InputParametersString["pro"] = Blue.str().c_str();
83  InputParametersString["tar"] = Yell.str().c_str();
84 
85  stringstream impactParameters;
86  impactParameters << mImpactMin << " " << mImpactMax;
87  InputParametersString["IMP"] = impactParameters.str().c_str();
88 
89  //
90  // Create a new event record for either pp or eo events
91  //
92  if ( ( mBlue == "proton" ) && ( mYell == "proton" ) ) mEvent = new StarGenPPEvent();
93  else mEvent = new StarGenEPEvent();
94 
96  std::map< TString, string > particle;
98  particle["proton"] = "P ";
99  particle["e-"] = "E- ";
100 
102  if ( mFrame=="COM" )
103  {
104  InputParametersDouble["ecm"]=mRootS;
105  }
106  if ( mFrame=="3MOM" || mFrame=="4MOM" || mFrame=="5MOM" )
107  {
109  mRootS = ( sqrt(pow(((Z[myBlue]*ProtonMass)+((A[myBlue]-Z[myBlue])*NeutronMass)),2) + sqrt( pow(mBlueMomentum.Px(),2) + pow(mBlueMomentum.Py(),2) + pow(mBlueMomentum.Pz(),2))) + sqrt(pow(((Z[myYell]*ProtonMass)+((A[myYell]-Z[myYell])*NeutronMass)),2) + sqrt( pow(mYellMomentum.Px(),2) + pow(mYellMomentum.Py(),2) + pow(mYellMomentum.Pz(),2))));
110  InputParametersDouble["ecm"]=mRootS;
111  }
112 
117  // PI0 111
118  // PI+ 211
119  StableParticles.push_back("101");
120  // ETA 221
121  StableParticles.push_back("102");
122  // K+ 321
123  StableParticles.push_back("");
124  // K_SHORT 310
125  StableParticles.push_back("");
126  // K_LONG 130
127  StableParticles.push_back("");
128  // LAMBDA0 3122
129  StableParticles.push_back("27");
130  // SIGMA0 3212
131  // SIGMA- 3112
132  // SIGMA+ 3222
133  StableParticles.push_back("40");
134  // Xi- 3312
135  // Xi0 3322
136  StableParticles.push_back("49");
137  // OMEGA- 3334
138  StableParticles.push_back("55");
139 
141  InitializeUrQMD();
142 
143  return StMaker::Init();
144 }
145 // ----------------------------------------------------------------------------
146 //
147 // ----------------------------------------------------------------------------
149 {
151  GenerateEvent();
152 
153  // Blue beam is a proton, running PP
154  if ( ( mBlue == "proton" ) && ( mYell == "proton" ) ) FillPP( mEvent );
155  // Otherwise, runnin EP
156  else FillEP( mEvent );
157 
158  //Do Stuff with the particles
159  mNumberOfParticles = 1;
160  //mNumberOfParticles = isys().ncoll(1); //JFN 11/28/12- this is wrong
161  for ( Int_t idx=1; idx<=mNumberOfParticles; idx++ )
162  {
163 
164  Int_t id = isys().uid(idx); // or isys().itypd(idx). It isn't clear which is right
165  Int_t stat = StarGenParticle::kFinal; //JFN 11/25/12 12:28pm- for the moment I am setting every status to be a final state particle.
166  //Int_t stat = mStatusCode[ hepevt().isthep(idx) ]; */@
167  // if ( !stat ) {
168  // stat = StarGenParticle::kUnknown;
169  // }
170  Int_t m1 = itdelay().ityptd(idx,1);
171  Int_t m2 = itdelay().ityptd(idx,2);
172  Int_t d1 = 0; //JFN- I don't think daughter information is preserved
173  Int_t d2 = 0;
174  Double_t px = coor().px(idx);
175  Double_t py = coor().py(idx);
176  Double_t pz = coor().pz(idx);
177  Double_t E = coor().p0(idx);
178  Double_t M = coor().fmass(idx);
179  Double_t vx = px/M;
180  Double_t vy = py/M;
181  Double_t vz = pz/M;
182  Double_t vt = sqrt(E*2/M); //E=m*v^2/2, v=sqrt(E*2/M)
183 
184  mEvent -> AddParticle( stat, id, m1, m2, d1, d2, px, py, pz, E, M, vx, vy, vz, vt );
185  }
186 
187  return kStOK;
188 }
189 // ----------------------------------------------------------------------------
190 //
191 // ----------------------------------------------------------------------------
193 /*Int_t StarUrQMD::Clear()
194 {
195  return kStOK;
196 }*/
197 // ----------------------------------------------------------------------------
198 //
199 // ----------------------------------------------------------------------------
201 {
202 
203  // Fill the event-wise information
204  StarGenPPEvent *myevent = (StarGenPPEvent *)event;
205  myevent -> idBlue = 0;
206  myevent -> idYell = 0;
207  myevent -> process = 0;
208  /*myevent -> idBlue = hwbeam().ipart1; // Int //JFN 11/26/12- "Blue beam ID". I don't know the ID convention
209  myevent -> idYell = hwbeam().ipart2;
210  myevent -> process = hwproc().iproc; //JFN 11/26/12- in principle there are process and subprocess ids because they get written in the headers of the output files, but I cant figure out where they are stored*/
211  myevent -> subprocess = 0;
212 
213  myevent -> idParton1 = -999;
214  myevent -> idParton2 = -999;
215  myevent -> xParton1 = 0;
216  myevent -> xParton2 = 0;
217  myevent -> xPdf1 = -999;
218  myevent -> xPdf2 = -999;
219  myevent -> Q2fac = -999;
220  myevent -> Q2ren = -999;
221  myevent -> valence1 = 0;
222  myevent -> valence2 = 0;
223 
224  myevent -> sHat = 0;
225  myevent -> tHat = 0;
226  myevent -> uHat = 0;
227  myevent -> ptHat = -999;
228  myevent -> thetaHat = -999;
229  myevent -> phiHat = -999;
230 
231  myevent -> weight = -999;
232 
233 }
234 // ----------------------------------------------------------------------------
235 //
236 // ----------------------------------------------------------------------------
238 {
240 }
241 // ----------------------------------------------------------------------------
242 //
243 // ----------------------------------------------------------------------------
248  {
253  //SetEnVars();
254 
256  std::ofstream inputfile;
257  inputfile.open( "UrQMD.in" );
258  for(map<TString,Int_t>::iterator i = InputParametersInt.begin(); i != InputParametersInt.end(); i++)
259  {
260  inputfile << i->first << " " << i->second << endl;
261  }
262  for(map<TString,Double_t>::iterator i = InputParametersDouble.begin(); i != InputParametersDouble.end(); i++)
263  {
264  inputfile << i->first << " " << i->second << endl;
265  }
266  for(map<TString,TString>::iterator i = InputParametersString.begin(); i != InputParametersString.end(); i++)
267  {
268  inputfile << i->first << " " << i->second << endl;
269  }
271  for(unsigned int i = 0; i< StableParticles.size(); i++)
272  {
273  inputfile << "stb " << StableParticles[i] << endl;
274  }
276  inputfile << "tim 200 200" << endl;
278  inputfile << "f13 \n f14 \n f15 \n f16 \n f17 \n f18 \n f19 \n f20" << endl;
280  inputfile << "nev 1000" << endl;
282  inputfile << "rsd 111" << endl;
284  inputfile << "xxx and done" << endl;
285  inputfile.close();
286 
288  iurqmd();
289  }
290 // ----------------------------------------------------------------------------
291 //
292 // ----------------------------------------------------------------------------
295 /*void GenerateEvent()
296  {
298  genevt();
299 
301  //ProcessEvent();
302  }*/
Double_t mRootS
CMS energy or incident beam momentum for fixed target collisions.
static StarRandom & Instance()
Obtain the single instance of the random number generator.
Definition: StarRandom.cxx:87
TString mYell
Name of the yellow beam particle (-z)
Event record class tailored to PP kinematics.
TLorentzVector mYellMomentum
4-Momentum of the yellow beam
ABC for defining event generator interfaces.
Definition: StarGenerator.h:34
StarGenEvent * mEvent
Generated event.
Double_t mImpactMin
Minimum impact parameter in a HI collision.
Double_t mImpactMax
Maximum impact parameter in a HI collision.
TLorentzVector mBlueMomentum
4-Momentum of the blue beam
StarUrQMD(const Char_t *name="UrQMD3_3_1")
Definition: StarUrQMD.cxx:25
Double_t flat() const
Return a random number uniformly distributed between 0 and 1.
Definition: StarRandom.cxx:68
Int_t Init()
Definition: StarUrQMD.cxx:47
Base class for event records.
Definition: StarGenEvent.h:81
void InitializeUrQMD()
Definition: StarUrQMD.cxx:247
Event record class tailored to DIS kinemaics.
Definition: Stypes.h:40
Int_t Generate()
Definition: StarUrQMD.cxx:148
void FillEP(StarGenEvent *event)
(Optional) Method to fill a DIS event
Definition: StarUrQMD.cxx:237
TString mFrame
Frame of the collision, i.e. CMS, FIXT, 3MOM, 4MOM, 5MOM.
TString mBlue
Name of the blue beam particle (+z)
void FillPP(StarGenEvent *event)
JFN 11/18/12 13:24 - I think having a clear function is optional, and UrQMD doesn&#39;t have any explicit...
Definition: StarUrQMD.cxx:200