93 maxGlauberDataSets =-1;
94 cntGlauberDataSets = 0;
100 if ( !getenv(
"G4DPMJET2_5DATA") )
102 G4cout <<
"ENVIRONMENT VARIABLE G4DPMJET2_5DATA NOT SET " <<
G4endl;
104 "Please setenv G4DPMJET2_5DATA to point to the dpmjet2.5 data files.");
106 glauberDataSetDir = getenv(
"G4DPMJET2_5DATA");
111 theCurrentGlauberDataSet = 0;
113 usingLocalGlauberDataSet =
false;
142 G4GlaubAADataSetHandler::GetIndexID (
const G4int AP,
const G4int AT)
const
149 G4GlaubAADataSetHandler::GetProjectileStringID (
const G4int AP)
const
151 std::ostringstream os;
157 G4String G4GlaubAADataSetHandler::GetTargetStringID (
const G4int AT)
const
159 std::ostringstream os;
169 G4String ID = GetProjectileStringID(AP) +
"_" + GetTargetStringID(AT);
192 G4String glauberID = GetStringID(AP,AT);
193 G4String filename = glauberDataSetDir +
"/" + glauberID +
".glaubaadat";
194 std::ifstream glauberFile(filename);
205 G4int asci = glauberFile.peek();
206 if (asci >= 48 && asci <= 57) i = asci - 48;
207 else if (asci >= 65 && asci <= 90) i = asci - 55;
209 G4cerr <<
"ERROR IN G4GlaubAADataSetHandler::LoadGlauberDataReturnPtr"
212 G4cerr <<
"IDENTIFIED AS GLAUBER FILE TYPE " <<i <<
G4endl;
218 glauberFile >>(*glauberData);
223 G4int AP1 = glauberData->GetAP();
224 G4int AT1 = glauberData->GetAT();
225 G4bool found = AP1==AP && AT1==AT;
234 theCurrentGlauberDataSet = glauberData;
235 if (CheckIfSpace()) {
236 G4int n = GetIndexID(AP,AT);
237 theIndex.insert (G4GlaubAADataSetIndex::value_type(n,glauberData));
238 cntGlauberDataSets++;
239 usingLocalGlauberDataSet =
false;
240 if (verboseLevel >=2) {
241 G4cout <<
"****************************************"
242 <<
"****************************************"
244 G4cout <<
"In G4GlaubAADataSetHandler::LoadGlauberDataReturnPtr"
246 G4cout <<
"LOADED GLAUBER DATA SET FOR PROJECTILE A = " <<AP
247 <<
" & TARGET A = " <<AT <<
G4endl;
248 G4cout <<
"AS RECORD NUMBER = " <<theIndex.size() <<
G4endl;
249 G4cout <<
"****************************************"
250 <<
"****************************************"
255 usingLocalGlauberDataSet =
true;
256 if (verboseLevel >=2) {
257 G4cout <<
"****************************************"
258 <<
"****************************************"
260 G4cout <<
"In G4GlaubAADataSetHandler::LoadGlauberDataReturnPtr"
262 G4cout <<
"LOADED GLAUBER DATA SET FOR PROJECTILE A = " <<AP
263 <<
" & TARGET A = " <<AT <<
" TEMPORARILY" <<
G4endl;
264 G4cout <<
"****************************************"
265 <<
"****************************************"
271 G4cerr <<
"WARNING IN G4GlaubAADataSetHandler::LoadGlauberData"
273 G4cerr <<
"GLAUBER FILE " <<filename <<
" LOOKED LIKE IT SHOULD CONTAIN"
275 G4cerr <<
"DATA FOR AP = " <<AP <<
" AND AT = " <<AT <<
G4endl;
276 G4cerr <<
"BUT CONTAINED AP = " <<AP1 <<
" AND AT = " <<AT1 <<
G4endl;
300 for (G4GlaubAADataSetIndex::iterator it=theIndex.begin(); it!=theIndex.end();
304 cntGlauberDataSets--;
315 const G4int AT)
const
317 G4int glauberID = GetIndexID (AP,AT);
318 G4GlaubAADataSetIndex::const_iterator it = theIndex.find(glauberID);
319 if (it == theIndex.end()) {
320 G4String glauberStrID = GetStringID(AP,AT);
321 G4String filename = glauberDataSetDir +
"/" + glauberStrID +
323 std::ifstream glauberFile;
324 glauberFile.open(filename);
344 G4bool G4GlaubAADataSetHandler::CheckIfSpace ()
const
346 if ( maxGlauberDataSets >= 0 &&
347 ( (
G4int) theIndex.size() ) >= maxGlauberDataSets) {
348 G4cout <<
"WARNING: G4GlaubAADataSetHandler::CheckIfSpace:"
350 G4cout <<
"MAXIMUM NUMBER OF GLAUBER DATASETS REACHED : "
351 <<maxGlauberDataSets <<
G4endl;;
366 if (n > -1 && cntGlauberDataSets > n) {
367 G4cerr <<
"ERROR IN G4GlaubAADataSetHandler::SetMaxGlauberDataSets"
369 G4cerr <<
"MAXIMUM NUMBER OF GLAUBER DATA SETS WOULD BE EXCEEDED IF YOU"
371 G4cerr <<
"SET THIS VALUE. ATTEMPTED TO SET TO " <<n
372 <<
"WHEN VALUE ALREADY" <<cntGlauberDataSets
377 maxGlauberDataSets =
n;
395 G4int glauberID = GetIndexID (AP,AT);
396 G4GlaubAADataSetIndex::iterator it = theIndex.find(glauberID);
397 if (it == theIndex.end()) {
403 theCurrentGlauberDataSet =
405 if (theCurrentGlauberDataSet != 0) {
423 theCurrentGlauberDataSet = it->second;
437 return theCurrentGlauberDataSet;
443 if (usingLocalGlauberDataSet)
delete theCurrentGlauberDataSet;
444 theCurrentGlauberDataSet = 0;
446 usingLocalGlauberDataSet =
false;
454 if (ppn1*
GeV > 1.0*
eV) ppn = ppn1;
455 else if (ppnCurrent*
GeV > 1.0*
eV) ppn = ppnCurrent;
467 if (ppn1*
GeV > 1.0*
eV) ppn = ppn1;
468 else if (ppnCurrent*
GeV > 1.0*
eV) ppn = ppnCurrent;
G4bool IsGlauberDataSetAvailable(const G4int AP, const G4int AT) const
G4GlaubAADataSetHandler()
void SetMaxGlauberDataSets(const G4int n)
Definition of the G4ParamType1GlaubAADataSet class.
void ResetCurrentGlauberDataSet()
G4GlaubAADataSet * GetCurrentGlauberDataSet() const
Definition of the G4FullGlaubAADataSet class.
virtual ~G4GlaubAADataSetHandler()
struct ccdpm25dtumat dtumat_
G4GLOB_DLL std::ostream G4cout
G4double GetValueN(const G4double v, const G4double ppn1=0.0)
G4double GetValueM(const G4double v, const G4double ppn1=0.0)
G4int UnloadAllGlauberData()
void SetVerboseLevel(const G4int i)
G4bool SetCurrentGlauberDataSet(const G4int AP, const G4int AT, const G4double ppn=0.0)
Definition of the G4DPMJET2_5Interface class.
Definition of the G4GlaubAADataSetHandler class.
static G4GlaubAADataSetHandler * getInstance()
G4GLOB_DLL std::ostream G4cerr