9 #include "CLHEP/Units/PhysicalConstants.h" 10 using namespace CLHEP;
17 thisFactory = factory +
" " + variation;
23 description =
"generic flux detector";
24 identifiers.push_back(
"id");
36 string fname = system +
"__hit_" + variation +
".txt";
37 if(verbosity > 1) cout <<
" > Loading TEXT definitions for <" << SD <<
">..." << endl;
39 ifstream IN(fname.c_str());
43 if(getenv(
"GEMC_DATA_DIR") != NULL)
45 string maybeHere = (string) getenv(
"GEMC_DATA_DIR") +
"/" + fname;
47 IN.open(maybeHere.c_str());
48 if(!IN && verbosity > 2)
50 cout <<
" !!! Error: Failed to open hit file " << fname <<
" for sensitive detector: >" 51 << SD <<
"<. Maybe the filename doesn't exist? Exiting." << endl;
54 if(!IN && verbosity > 2)
56 cout <<
" !!! Error: Failed to open hit file " << fname <<
" for sensitive detector: >" 57 << SD <<
"<. Maybe the filename doesn't exist? Exiting." << endl;
78 description = gt.
data[1];
82 for(
unsigned i=0; i<ids.size(); i++)
83 identifiers.push_back(ids[i]);
116 cout << *
this << endl;;
124 if(factory ==
"MYSQL")
127 QSqlDatabase db =
openGdb(gemcOpt);
128 string tname = system +
"__hit";
130 if(verbosity > 1) cout <<
" > Loading MYSQL definitions for <" << SD <<
">..." ;
132 string dbexecute =
"select name, description, identifiers, signalThreshold, timeWindow, prodThreshold, maxStep, riseTime, fallTime, mvToMeV, pedestal, delay from " + tname ;
133 dbexecute +=
" where variation ='" + variation +
"'";
134 dbexecute +=
" and name = '" + SD +
"'";
137 if(!q.exec(dbexecute.c_str()))
139 cout <<
" !!! Failed to execute MYSQL query " << dbexecute <<
". This is a fatal error. Exiting." << endl;
140 qDebug() << q.lastError();
146 cout <<
" ** WARNING: sensitive detector \"" << SD <<
"\" not found in factory " << factory
147 <<
" for variation " << variation << endl << endl;
161 for(
unsigned i=0; i<ids.size(); i++)
162 identifiers.push_back(ids[i]);
196 cout << *
this << endl;
206 cout <<
" > Sensitive detector " << SD.
name <<
": " << endl << endl ;
207 for(
unsigned int i=0; i<SD.
identifiers.size(); i++)
209 cout <<
" identifier element name: " << SD.
identifiers[i] << endl;
211 cout << endl <<
" > Signal Threshold: " << SD.
signalThreshold/MeV <<
" MeV." << endl ;
212 cout <<
" > Production Threshold: " << SD.
prodThreshold/mm <<
" mm." << endl ;
213 cout <<
" > Time Window for: " << SD.
timeWindow/ns <<
" ns." << endl ;
214 cout <<
" > Maximum Acceptable Step: " << SD.
maxStep/mm <<
" mm." << endl ;
215 cout <<
" > Signal Rise Time: " << SD.
riseTime/ns <<
" ns." << endl ;
216 cout <<
" > Signal Fall Time: " << SD.
fallTime/ns <<
" ns." << endl ;
217 cout <<
" > Signal MeV to mV: " << SD.
mvToMeV <<
" mV/MeV" << endl ;
218 cout <<
" > Signal Pedestal: " << SD.
pedestal <<
" mV" << endl ;
219 cout <<
" > Signal Delay " << SD.
delay/ns <<
" ns." << endl ;
vector< string > get_strings(string input)
returns a vector of strings from a stringstream, space is delimiter
double delay
time from PMT face to signal
void closeGdb(QSqlDatabase db)
QSqlDatabase openGdb(goptions gemcOpt)
string qv_tostring(QVariant input)
double get_number(string v, int warn_no_unit)
Returns number with dimension from string, i.e. 100*cm.
ostream & operator<<(ostream &stream, sensitiveID SD)
string name
Sensitive Detector name. This has to match the bank name.
double prodThreshold
Geant4 Production Threshold in the detector.
map< string, aopt > optMap
Options map.
double mvToMeV
from MeV to mV constant
double maxStep
Geant4 Maximum Acceptable Step in the detector.
double timeWindow
If two steps happens within the same TimeWindow, they belong to the same Hit.
double signalThreshold
Minimum energy of the hit to be recorded in the output stream.
vector< string > identifiers
vector of strings that uniquely identify the detector element
double fallTime
fall time of the PMT signal
double riseTime
rise time of the PMT signal