Skip to content

Commit

Permalink
updated interface to FrequencySyncSignal to pass one of engine status…
Browse files Browse the repository at this point in the history
… longs as seed, to guarantee reproducibility of RFs
  • Loading branch information
maureeungaro committed Jan 10, 2024
1 parent 8f99566 commit fc876b1
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 23 deletions.
11 changes: 8 additions & 3 deletions release_notes/5.5.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
# clas12_tags 5.5

- updated uRwell digitization
- added uRwell geometry and digitization
- FADC time is double not int. Precision is 62.5ps
- FT Cal and FT Hodo timing fix
- -v, --v, -version, --version will show the version of gemc and some introspection:
- target and beamline vacuum windows now native geant4 volumes
- fixed width of scattering chamber vacuum window and added beamline vacuum window
- added instrospection: -v, --v, -version, --version will show the version of gemc and the following:
- field persistence for 2 and 3d maps is float instead of double
- updated RICH hitprocess
- updated interface to FrequencySyncSignal to pass one of engine status longs as seed, to guarantee reproducibility of RFs

```
> gemc version: gemc 5.4
> gemc version: gemc 5.5
> Environment:
Expand Down
6 changes: 2 additions & 4 deletions source/gemc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,9 @@ int main( int argc, char **argv )
// The screen log verbosity is controlled by LOG_VERBOSITY
gui_splash gemc_splash(gemcOpt);
gemc_splash.message(" Initializing GEant4 MonteCarlo version " + string(GEMC_VERSION));


// random seed initialization
// notice MTwistEngine cannot print 2 seeds, it only print the whole engine status which is huge
// G4Random::setTheEngine(new CLHEP::MTwistEngine);
G4Random::setTheEngine(new CLHEP::MixMaxRng);

G4int seed;
Expand All @@ -149,7 +147,7 @@ int main( int argc, char **argv )

CLHEP::HepRandom::setTheSeed(seed);
gemc_splash.message(" Seed initialized to: " + stringify(seed));

// Construct the default G4 run manager
gemc_splash.message(" Instantiating Run Manager...");
G4RunManager *runManager = new G4RunManager;
Expand Down
10 changes: 5 additions & 5 deletions source/hitprocess/clas12/uRwell/uRwell_hitprocess.cc
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,15 @@ map<string, double>uRwell_HitProcess :: integrateDgt(MHit* aHit, int hitn)
dgtz["layer"] = identity[3].id;
dgtz["component"] = identity[4].id;
if(identity[4].id ==-15000){
dgtz["ADC"] = 0;
dgtz["time"] = 0;
dgtz["ADC_ADC"] = 0;
dgtz["ADC_time"] = 0;
}else{
dgtz["ADC"] = (1.0*(int) (uRwellC.gain*1e6*tInfos.eTot/uRwellC.w_i));
dgtz["time"] = identity[4].time;
dgtz["ADC_ADC"] = (1.0*(int) (uRwellC.gain*1e6*tInfos.eTot/uRwellC.w_i));
dgtz["ADC_time"] = identity[4].time;
}
dgtz["ADC_ped"] = 0;

// cout<<dgtz["sector"]<<" "<<dgtz["layer"]<<" "<<dgtz["component"]<<" "<<dgtz["ADC"]<<endl;
// cout<<dgtz["sector"]<<" "<<dgtz["layer"]<<" "<<dgtz["component"]<<" "<<dgtz["ADC_ADC"]<<endl;

// define conditions to reject hit
if (rejectHitConditions) {
Expand Down
26 changes: 21 additions & 5 deletions source/src/MEventAction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// mlibrary
#include "frequencySyncSignal.h"

// c++
#include <iostream>
using namespace std;

Expand Down Expand Up @@ -180,7 +181,6 @@ MEventAction::MEventAction(goptions opts, map<string, double> gpars)

if(RFSETUP == "clas12_ccdb") {
setup_clas12_RF(rw.getRunNumber(evtN));
//rfvalue_strings = {"4.008", "44", "22"};

} else if(RFSETUP != "no") {
rfvalue_strings = getStringVectorFromString(RFSETUP);
Expand Down Expand Up @@ -551,17 +551,33 @@ void MEventAction::EndOfEventAction(const G4Event* evt)
if(firstParticleVertex.z() > referenceRFPosition.z()) additionalTime = -additionalTime;
}
}


CLHEP::HepRandomEngine* currentEngine = CLHEP::HepRandom::getTheEngine();
const long *engineStatus = currentEngine->getSeeds();

// find the number of elements in engineStatus. This assumes the values are greater than 100
int nelements = 0;
while (engineStatus[nelements] > 100) {
nelements++;
}

if (nelements < 3) {
cout << "Error: engineStatus has less than 3 elements" << endl;
exit(1);
}

int g4rseed = engineStatus[2];

// getting time window
string rfsetup_string = to_string(gen_action->getTimeWindow()) + " " ;
string rfsetup_string = to_string(g4rseed) + " " + to_string(gen_action->getTimeWindow()) + " " ;

// getting start time of the event
rfsetup_string += to_string(gen_action->getStartTime() + additionalTime) + " " ;
rfsetup_string += to_string(gen_action->getStartTime() + additionalTime) + " " ;

if(RFSETUP == "clas12_ccdb"){
setup_clas12_RF(rw.runNo);
}

for(unsigned i=0; i<rfvalue_strings.size(); i++) {
rfsetup_string += rfvalue_strings[i] + " " ;
}
Expand Down
7 changes: 1 addition & 6 deletions source/utilities/string_utilities.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ double scan_number(const char *str)

// checking if the number is a valid digit, w/o commas (for example 1,000 is not valid). Exiting if something is wrong, except if the string is "none"
while(char c=str[i++]) if(!(isdigit(c) || c=='.' || c=='-' || c=='+' || c=='e' || c=='E')) {
cout << "WARNING: Unexpected alphanumberic character found in number string:" << str << endl;
cout << "WARNING: Unexpected alphanumeric character found in number string:" << str << endl;
cout << "Exiting " << endl; exit(4);
}

Expand Down Expand Up @@ -164,8 +164,3 @@ ostream &operator<<(ostream &stream, map<string, string> smap)

return stream;
}





0 comments on commit fc876b1

Please sign in to comment.