45 #include "GENIE/Utils/StringUtils.h" 47 #include "GENIE/Framework/Utils/StringUtils.h" 50 #include "cetlib_except/exception.h" 59 , fTimeBetweenBuckets(1e9/53.103e6)
60 , fBucketTimeSigma(0.750)
61 , fNBucketsPerBatch(84)
62 , fNFilledBucketsPerBatch(81)
63 , fDisallowedBatchMask(6,0)
66 std::vector<double> bi(6,1.0);
76 if ( config ==
"" )
return;
83 std::transform(configLocal.begin(),configLocal.end(),configLocal.begin(),::tolower);
86 std::vector<std::string> strs =
89 strs.erase(std::remove_if(strs.begin(), strs.end(),
95 std::ostringstream msgx;
97 for (
size_t j=0; j<strs.size(); ++j) {
98 msgx <<
" [" <<
std::setw(3) << j <<
"] -->" << strs[j] <<
"<--\n";
104 size_t nstrs = strs.size();
105 for (
size_t i=0; i<nstrs; ++i) {
106 if ( strs[i] ==
"numi" ) {
113 std::vector<double> bi(6,1.0);
116 if ( strs[i] ==
"booster" ) {
123 std::vector<double> bi(1,1.0);
126 if ( strs[i].find(
"intensity") != std::string::npos ) {
129 std::vector<double> bi;
131 for (
size_t jj=i+1; jj<nstrs; ++jj) {
134 size_t pos = strs[jj].find_first_not_of(
"0123456789.-+eE");
135 if ( pos != std::string::npos )
break;
137 double val = atof(strs[jj].c_str());
140 <<
"EvtTimeFNALBeam 'intensity' value [" << (jj-i-1)
141 <<
"]=" << val <<
" '" << strs[jj] <<
"' " 142 <<
"can't be less than zero, setting to zero";
151 <<
"EvtTimeFNALBeam error 'intensity' option didn't seem to have values";
156 if ( strs[i] ==
"bdisallowed" ) {
158 <<
"EvtTimeFNALBeam sorry 'bdisallowed' option not yet implemented";
161 if ( i+1 >= nstrs ) {
163 <<
"EvtTimeFNALBeam sorry too few values for '" << strs[i] <<
"'";
166 const char* arg = strs[i+1].c_str();
175 <<
"unknown EvtTimeFNALBeam config key '" << strs[i] <<
"'";
186 <<
"set nfilled to match buckets per batch";
205 bool disallowed =
true;
209 while ( disallowed ) {
211 for (ibatch=0; ibatch<nbatch; ++ibatch) {
231 std::ostringstream
msg;
232 msg <<
"EvtTimeFNALBeam config: \n" 238 <<
" Relative Fractions: ";
244 if (skip) msg <<
"{{";
246 if (skip) msg <<
"}}";
263 size_t ndis = disallow.size();
275 size_t nbi = bi.size();
276 for (
size_t i=0; i < nbi; ++i) {
virtual ~EvtTimeFNALBeam()
void msg(const char *fmt,...)
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
void SetBatchIntensities(std::vector< double > bi)
double fGlobalOffset
always displaced by this (in ns)
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
configurable FNAL Beam time distribution
EvtTimeFNALBeam(const std::string &config)
double fBucketTimeSigma
how wide is distribution in bucket
interface for event time distribution
virtual void PrintConfig(bool verbose=true)
provide a means of printing the configuration
void CalculateCPDF(std::vector< double > batchi)
QTextStream & flush(QTextStream &s)
virtual void Config(const std::string &config)
Q_EXPORT QTSManip setw(int w)
int fNFilledBucketsPerBatch
virtual double TimeOffset()
std::vector< int > fDisallowedBatchMask
disallow individual batches
vector< string > Split(string input, string delim)
double fTimeBetweenBuckets
time between buckets
MaybeLogger_< ELseverityLevel::ELsev_success, false > LogDebug
A class for generating concrete EvtTimeShiftI derived classes based on the factory pattern...
Physics generators for neutrinos, cosmic rays, and others.
std::vector< double > fCummulativeBatchPDF
summed prob for batches
void SetDisallowedBatchMask(std::vector< int > disallow)
QTextStream & endl(QTextStream &s)
#define TIMESHIFTREG3(_ns, _name, _fqname)