89 maxGlauberDataSets =-1;
90 cntGlauberDataSets = 0;
96 if ( !getenv(
"G4DPMJET2_5DATA") )
98 G4cout <<
"ENVIRONMENT VARIABLE G4DPMJET2_5DATA NOT SET " <<
G4endl;
100 "Please setenv G4DPMJET2_5DATA to point to the dpmjet2.5 data files.");
102 glauberDataSetDir = getenv(
"G4DPMJET2_5DATA");
107 theCurrentGlauberDataSet = 0;
109 usingLocalGlauberDataSet =
false;
137 G4int G4GlaubAADataSetHandler::GetIndexID (
const G4int AP,
const G4int AT)
const
143 G4String G4GlaubAADataSetHandler::GetProjectileStringID (
const G4int AP)
const
145 std::ostringstream os;
151 G4String G4GlaubAADataSetHandler::GetTargetStringID (
const G4int AT)
const
153 std::ostringstream os;
163 G4String ID = GetProjectileStringID(AP) +
"_" + GetTargetStringID(AT);
186 G4String glauberID = GetStringID(AP,AT);
187 G4String filename = glauberDataSetDir +
"/" + glauberID +
".glaubaadat";
188 std::ifstream glauberFile(filename);
199 G4int asci = glauberFile.peek();
200 if (asci >= 48 && asci <= 57) i = asci - 48;
201 else if (asci >= 65 && asci <= 90) i = asci - 55;
203 G4cerr <<
"ERROR IN G4GlaubAADataSetHandler::LoadGlauberDataReturnPtr"
206 G4cerr <<
"IDENTIFIED AS GLAUBER FILE TYPE " <<i <<
G4endl;
212 glauberFile >>(*glauberData);
217 G4int AP1 = glauberData->GetAP();
218 G4int AT1 = glauberData->GetAT();
219 G4bool found = AP1==AP && AT1==AT;
228 theCurrentGlauberDataSet = glauberData;
229 if (CheckIfSpace()) {
230 G4int n = GetIndexID(AP,AT);
231 theIndex.insert (G4GlaubAADataSetIndex::value_type(n,glauberData));
232 cntGlauberDataSets++;
233 usingLocalGlauberDataSet =
false;
234 if (verboseLevel >=2) {
235 G4cout <<
"****************************************"
236 <<
"****************************************"
238 G4cout <<
"In G4GlaubAADataSetHandler::LoadGlauberDataReturnPtr"
240 G4cout <<
"LOADED GLAUBER DATA SET FOR PROJECTILE A = " <<AP
241 <<
" & TARGET A = " <<AT <<
G4endl;
242 G4cout <<
"AS RECORD NUMBER = " <<theIndex.size() <<
G4endl;
243 G4cout <<
"****************************************"
244 <<
"****************************************"
249 usingLocalGlauberDataSet =
true;
250 if (verboseLevel >=2) {
251 G4cout <<
"****************************************"
252 <<
"****************************************"
254 G4cout <<
"In G4GlaubAADataSetHandler::LoadGlauberDataReturnPtr"
256 G4cout <<
"LOADED GLAUBER DATA SET FOR PROJECTILE A = " <<AP
257 <<
" & TARGET A = " <<AT <<
" TEMPORARILY" <<
G4endl;
258 G4cout <<
"****************************************"
259 <<
"****************************************"
265 G4cerr <<
"WARNING IN G4GlaubAADataSetHandler::LoadGlauberData"
267 G4cerr <<
"GLAUBER FILE " <<filename <<
" LOOKED LIKE IT SHOULD CONTAIN"
269 G4cerr <<
"DATA FOR AP = " <<AP <<
" AND AT = " <<AT <<
G4endl;
270 G4cerr <<
"BUT CONTAINED AP = " <<AP1 <<
" AND AT = " <<AT1 <<
G4endl;
294 for (G4GlaubAADataSetIndex::iterator it=theIndex.begin(); it!=theIndex.end();
298 cntGlauberDataSets--;
309 const G4int AT)
const
311 G4int glauberID = GetIndexID (AP,AT);
312 G4GlaubAADataSetIndex::const_iterator it = theIndex.find(glauberID);
313 if (it == theIndex.end()) {
314 G4String glauberStrID = GetStringID(AP,AT);
315 G4String filename = glauberDataSetDir +
"/" + glauberStrID +
317 std::ifstream glauberFile;
318 glauberFile.open(filename);
338 G4bool G4GlaubAADataSetHandler::CheckIfSpace ()
const
340 if ( maxGlauberDataSets >= 0 &&
341 ( (
G4int) theIndex.size() ) >= maxGlauberDataSets) {
342 G4cout <<
"WARNING: G4GlaubAADataSetHandler::CheckIfSpace:"
344 G4cout <<
"MAXIMUM NUMBER OF GLAUBER DATASETS REACHED : "
345 <<maxGlauberDataSets <<
G4endl;;
360 if (n > -1 && cntGlauberDataSets > n) {
361 G4cerr <<
"ERROR IN G4GlaubAADataSetHandler::SetMaxGlauberDataSets"
363 G4cerr <<
"MAXIMUM NUMBER OF GLAUBER DATA SETS WOULD BE EXCEEDED IF YOU"
365 G4cerr <<
"SET THIS VALUE. ATTEMPTED TO SET TO " <<n
366 <<
"WHEN VALUE ALREADY" <<cntGlauberDataSets
371 maxGlauberDataSets =
n;
389 G4int glauberID = GetIndexID (AP,AT);
390 G4GlaubAADataSetIndex::iterator it = theIndex.find(glauberID);
391 if (it == theIndex.end()) {
398 if (theCurrentGlauberDataSet != 0) {
416 theCurrentGlauberDataSet = it->second;
430 return theCurrentGlauberDataSet;
436 if (usingLocalGlauberDataSet)
delete theCurrentGlauberDataSet;
437 theCurrentGlauberDataSet = 0;
439 usingLocalGlauberDataSet =
false;
447 if (ppn1*
GeV > 1.0*
eV) ppn = ppn1;
448 else if (ppnCurrent*
GeV > 1.0*
eV) ppn = ppnCurrent;
460 if (ppn1*
GeV > 1.0*
eV) ppn = ppn1;
461 else if (ppnCurrent*
GeV > 1.0*
eV) ppn = ppnCurrent;