12 #include <type_traits>
16 #include "CLHEP/Random/JamesRandom.h"
22 using Parameters = fhicl::Table<sbnd::crt::CRTDetSimParams>;
29 std::string config_path;
30 if (++iParam < argc) config_path = argv[iParam];
33 char const* fhicl_env = getenv(
"FHICL_FILE_PATH");
34 std::string search_path = fhicl_env? std::string(fhicl_env) +
":":
".:";
37 fhicl::intermediate_table table;
38 table = fhicl::parse_document(argv[iParam], policy);
41 fhicl::ParameterSet params;
42 params = fhicl::ParameterSet::make(table);
44 fhicl::ParameterSet
p = params.get<fhicl::ParameterSet>(
"testcrtsim");
48 Parameters detsim_params(p.template get<fhicl::ParameterSet>(
"DetSimParams"));
53 int main(
int argc,
char const** argv) {
66 CLHEP::HepJamesRandom engine(
SEED);
101 <<
"\nq1 " << q1 << std::endl;
104 std::cout <<
"Signal saturated with a 1.5 MeV deposited energy?" << std::endl;
108 if (q0 < 0 or q1 < 0) {
109 std::cout <<
"Predicted ADCs are negative?" << std::endl;
118 double original_adc = 2000;
122 std::cout <<
"original_adc " << original_adc
123 <<
"\nadc " << adc << std::endl;
125 if (adc > static_cast<uint16_t>(original_adc)) {
126 std::cout <<
"ADC value after waveform emulation is larger?" << std::endl;
uint32_t getChannelTriggerTicks(float t0, float npeMean, float r)
Parameters get_parameters(int argc, char const **argv)
fhicl::Atom< uint32_t > AdcSaturation
void ChargeResponse(double eDep, double d0, double d1, double distToReadout, long &npe0, long &npe1, double &q0, double &q1)
fhicl::Table< sbnd::crt::CRTDetSimParams > Parameters
constexpr long SEED
Basic unit tests for the CRT detector simulation.
int main(int argc, char **argv)
Base class for unit tests using FHiCL configuration.
uint16_t WaveformEmulation(const uint32_t &time_delay, const double &adc)
const CRTDetSimParams & Params()
BEGIN_PROLOG could also be cout