@@ -93,13 +93,18 @@ long int *GlueXUserEventInformation::fStartingSeeds = 0;
93
93
G4Mutex GlueXUserEventInformation::fMutex = G4MUTEX_INITIALIZER;
94
94
95
95
GlueXUserEventInformation::GlueXUserEventInformation (hddm_s::HDDM *hddmevent)
96
- : fKeepEvent(true ),
96
+ : fOutputRecord(0 ),
97
+ fKeepEvent(true ),
97
98
fNprimaries(0 ),
98
99
fNvertices(0 )
99
100
{
101
+ fEventSequenceNo = HddmOutput::incrementEventNo ();
100
102
if (hddmevent == 0 ) {
103
+ int runNo = GetRunNo ();
101
104
fOutputRecord = new hddm_s::HDDM ();
102
- fOutputRecord ->addPhysicsEvents ();
105
+ hddm_s::PhysicsEventList pev = fOutputRecord ->addPhysicsEvents ();
106
+ pev (0 ).setEventNo (fEventSequenceNo );
107
+ pev (0 ).setRunNo (runNo);
103
108
}
104
109
else {
105
110
fOutputRecord = hddmevent;
@@ -120,12 +125,6 @@ GlueXUserEventInformation::~GlueXUserEventInformation()
120
125
}
121
126
if (fKeepEvent ) {
122
127
hddm_s::PhysicsEventList pev = fOutputRecord ->getPhysicsEvents ();
123
- int runno = HddmOutput::getRunNo ();
124
- if (runno > 0 )
125
- pev (0 ).setRunNo (runno);
126
- if (pev (0 ).getEventNo () == 0 ) {
127
- pev (0 ).setEventNo (HddmOutput::incrementEventNo ());
128
- }
129
128
if (fWriteNoHitEvents || pev (0 ).getHitViews ().size () > 0 ) {
130
129
HddmOutput::WriteOutputHDDM (*fOutputRecord );
131
130
}
@@ -452,19 +451,16 @@ void GlueXUserEventInformation::SetRandomSeeds()
452
451
453
452
hddm_s::PhysicsEventList pev = fOutputRecord ->getPhysicsEvents ();
454
453
hddm_s::ReactionList rea = pev (0 ).getReactions ();
455
- long int eventNo = GetEventSequenceNo ();
456
454
if (rea.size () == 0 ) {
457
455
rea = pev (0 ).addReactions ();
458
456
}
459
457
hddm_s::RandomList rnd = rea (0 ).getRandoms ();
460
458
if (rnd.size () > 0 ) {
461
459
fEventSeeds [0 ] = rnd (0 ).getSeed1 ();
462
460
fEventSeeds [1 ] = rnd (0 ).getSeed2 ();
463
- if (pev (0 ).getEventNo () > 0 )
464
- eventNo = pev (0 ).getEventNo ();
465
461
G4Random::setTheSeeds (fEventSeeds );
466
462
#if VERBOSE_RANDOMS
467
- G4cout << " New event " << eventNo << " with starting seeds "
463
+ G4cout << " New event " << pev ( 0 ). getEventNo () << " with starting seeds "
468
464
<< fEventSeeds [0 ] << " , " << fEventSeeds [1 ] << G4endl;
469
465
#endif
470
466
}
@@ -486,7 +482,7 @@ void GlueXUserEventInformation::SetRandomSeeds()
486
482
rnd (0 ).setSeed3 (709975946 + pev (0 ).getEventNo ());
487
483
rnd (0 ).setSeed4 (912931182 + pev (0 ).getEventNo ());
488
484
#if VERBOSE_RANDOMS
489
- G4cout << " New event " << eventNo << " with starting seeds "
485
+ G4cout << " New event " << pev ( 0 ). getEventNo () << " with starting seeds "
490
486
<< fEventSeeds [0 ] << " , " << fEventSeeds [1 ] << G4endl;
491
487
#endif
492
488
}
@@ -495,7 +491,8 @@ void GlueXUserEventInformation::SetRandomSeeds()
495
491
int GlueXUserEventInformation::GetRunNo ()
496
492
{
497
493
if (fOutputRecord && fOutputRecord ->getPhysicsEvents ().size () > 0 ) {
498
- return fOutputRecord ->getPhysicsEvent ().getRunNo ();
494
+ hddm_s::PhysicsEventList pev = fOutputRecord ->getPhysicsEvents ();
495
+ return pev (0 ).getRunNo ();
499
496
}
500
497
G4RunManager *runmgr = G4RunManager::GetRunManager ();
501
498
if (runmgr != 0 && runmgr->GetCurrentRun () != 0 ) {
@@ -504,13 +501,13 @@ int GlueXUserEventInformation::GetRunNo()
504
501
return 0 ;
505
502
}
506
503
507
- long int GlueXUserEventInformation::GetEventSequenceNo ()
504
+ long int GlueXUserEventInformation::GetEventNo ()
508
505
{
509
- G4RunManager *runmgr = G4RunManager::GetRunManager ();
510
- if (runmgr != 0 && runmgr-> GetCurrentEvent () != 0 ) {
511
- return runmgr-> GetCurrentEvent ()-> GetEventID ();
506
+ if ( fOutputRecord && fOutputRecord -> getPhysicsEvents (). size () > 0 ) {
507
+ hddm_s::PhysicsEventList pev = fOutputRecord -> getPhysicsEvents ();
508
+ return pev ( 0 ). getEventNo ();
512
509
}
513
- return 0 ;
510
+ return fEventSequenceNo ;
514
511
}
515
512
516
513
double GlueXUserEventInformation::GetBeamPhotonEnergy ()
0 commit comments