@@ -37,6 +37,27 @@ class GeneratorStarlight_class : public Generator
3737 public :
3838 GeneratorStarlight_class (){};
3939 ~GeneratorStarlight_class () = default ;
40+
41+ void setupDpmjet (std ::string dpmjetconf ){
42+ if (dpmjetconf .size () == 0 )return ;
43+ //Copy necesary files to the working directory
44+ TString pathDPMJET = gSystem -> ExpandPathName ("$DPMJET_ROOT/dpmdata" );
45+ system (TString ::Format ("cp -r %s ." ,pathDPMJET .Data ()));
46+ system (TString ::Format ("cp %s ./my.input" ,dpmjetconf .c_str ()));
47+
48+ //Reset four seeds of the DPMJET random generator in the config
49+ std ::mt19937 gen (generateRandomSeed ());
50+ std ::uniform_int_distribution < > dist (1 , 168 );
51+
52+ std ::string command = "awk -i inplace -v nums=\"" ;
53+ for (int i = 0 ; i < 4 ; ++ i )command += TString ::Format ("%d.0 " , dist (gen ));
54+ command += " \" \' " ;
55+ command += "BEGIN {split(nums, newvals);}" ;
56+ command += "{if ($1 == \"RNDMINIT\") {printf \"%-16s%-9s%-9s%-9s%-9s\\n\", $1, newvals[1], newvals[2], newvals[3], newvals[4];}" ;
57+ command += " else {print $0;}}\' \"my.input\" " ;
58+ system (command .c_str ());
59+ }
60+
4061 void selectConfiguration (std ::string val ) { mSelectedConfiguration = val ; };
4162 void setExtraParams (std ::string val ) { mExtraParams = val ; };
4263 void setCollisionSystem (float energyCM , int beam1Z , int beam1A , int beam2Z , int beam2A ) {eCM = energyCM ; projZ = beam1Z ; projA = beam1A ; targZ = beam2Z ; targA = beam2A ;};
@@ -48,6 +69,10 @@ class GeneratorStarlight_class : public Generator
4869 return true;
4970 }
5071 int getPdgMother (){return mPdgMother ;}
72+ double getPhotonEnergy (){
73+ //std::cout << mEvent.getGamma().gamma.GetE() << std::endl;
74+ return mEvent .getGamma ().gamma .GetE ();
75+ }
5176
5277 bool Init () override
5378 {
@@ -305,7 +330,14 @@ class GeneratorStarlight_class : public Generator
305330 }
306331 return true;
307332 }
308-
333+
334+ protected :
335+ float eCM = 5020 ; //CMS energy
336+ int projA = 208 ; //Beam
337+ int targA = 208 ;
338+ int projZ = 82 ;
339+ int targZ = 82 ;
340+
309341 private :
310342 starlight * mStarLight = 0x0 ;
311343 inputParameters mInputParameters ; // simulation input information.
@@ -316,11 +348,7 @@ class GeneratorStarlight_class : public Generator
316348 std ::string mExtraParams = "" ;
317349 int mPdgMother = -1 ;
318350 bool mDecayEvtGen = 0 ;
319- float eCM = 5020 ; //CMS energy
320- int projA = 208 ; //Beam
321- int targA = 208 ;
322- int projZ = 82 ;
323- int targZ = 82 ;
351+
324352
325353 };
326354
@@ -331,29 +359,12 @@ class GeneratorStarlight_class : public Generator
331359FairGenerator *
332360 GeneratorStarlight (std ::string configuration = "empty" ,float energyCM = 5020 , int beam1Z = 82 , int beam1A = 208 , int beam2Z = 82 , int beam2A = 208 , std ::string extrapars = "" ,std ::string dpmjetconf = "" )
333361{
334- if (dpmjetconf .size () != 0 ){
335- //Copy necesary files to the working directory
336- TString pathDPMJET = gSystem -> ExpandPathName ("$DPMJET_ROOT/dpmdata" );
337- system (TString ::Format ("cp -r %s ." ,pathDPMJET .Data ()));
338- system (TString ::Format ("cp %s ./my.input" ,dpmjetconf .c_str ()));
339-
340- //Reset four seeds of the DPMJET random generator in the config
341- std ::mt19937 gen (generateRandomSeed ());
342- std ::uniform_int_distribution < > dist (1 , 168 );
343-
344- std ::string command = "awk -i inplace -v nums=\"" ;
345- for (int i = 0 ; i < 4 ; ++ i )command += TString ::Format ("%d.0 " , dist (gen ));
346- command += " \" \' " ;
347- command += "BEGIN {split(nums, newvals);}" ;
348- command += "{if ($1 == \"RNDMINIT\") {printf \"%-16s%-9s%-9s%-9s%-9s\\n\", $1, newvals[1], newvals[2], newvals[3], newvals[4];}" ;
349- command += " else {print $0;}}\' \"my.input\" " ;
350- system (command .c_str ());
351- }
352362
353363 auto gen = new o2 ::eventgen ::GeneratorStarlight_class ();
354364 gen -> selectConfiguration (configuration );
355365 gen -> setCollisionSystem (energyCM , beam1Z , beam1A , beam2Z , beam2A );
356366 gen -> setExtraParams (extrapars );
367+ gen -> setupDpmjet (dpmjetconf );
357368 return gen ;
358369}
359370
0 commit comments