16 #include "test/Geometry/geometry_unit_test_base.h" 70 config.SetConfigurationPath(argv[iParam]);
72 std::cerr <<
"FHiCL configuration file path required as first argument!" <<
std::endl;
78 if (++iParam < argc) config.SetMainTesterParameterSetPath(argv[iParam]);
82 if (++iParam < argc) {
83 config.SetServiceParameterSetPath(
"DetectorPropertiesService", argv[iParam]);
119 unsigned int const nWaveformTicks = detp.NumberTimeSamples();
120 unsigned int const nReadoutWindowTicks = detp.ReadOutWindowSize();
122 mf::LogVerbatim(
"detp_test") <<
"Electric field in the active volume: " << detp.Efield()
124 <<
"\nSampling rate: " << TDCtick <<
" ns" 125 <<
"\nArgon temperature: " << detp.Temperature() <<
" K" 126 <<
"\nArgon density: " << detp.Density() <<
" kg/dm^3 (at " << detp.Temperature() <<
" K)" 127 <<
"\nArgon density: " << detp.Density(87.0) <<
" kg/dm^3 (at 87 K)" 128 <<
"\nDrift velocity: " << driftVelocity <<
" cm/us" 129 <<
"\nReadout window: " << nReadoutWindowTicks <<
" ticks (" 130 << (nReadoutWindowTicks * TDCtick / 1000) <<
" us)" 131 <<
"\nTPC waveform length: " << nWaveformTicks <<
" ticks (" 132 << (nWaveformTicks * TDCtick / 1000) <<
" us)";
135 unsigned int headerColWidth = 0U;
136 for (
auto planeID : geom.IteratePlaneIDs()) {
138 if (headerColWidth <
l) headerColWidth =
l;
143 bool allSameDrift =
true;
145 auto driftDistances = geom.makeTPCData<
double>();
146 for (
auto const&
TPC : geom.IterateTPCs()) {
147 auto const driftDistance =
TPC.DriftDistance();
148 driftDistances[
TPC.ID()] = driftDistance;
149 allSameDrift = allSameDrift & check.
equal(driftDistance, driftDistances.first());
154 auto const driftDistance = driftDistances.first();
155 auto const driftTime = driftDistance / driftVelocity;
156 mf::LogVerbatim(
"detp_test") <<
"Drift distance: " << driftDistance <<
" cm" 157 <<
"\nDrift time: " << driftTime <<
" us, " 158 << (driftTime / (TDCtick / 1000.)) <<
" ticks";
163 std::array<unsigned int, 4U>
const columnSizes = {{headerColWidth, 9U, 13U, 7U}};
164 log <<
std::setw(columnSizes[0]) <<
"Drift:" 165 <<
" | " <<
std::setw(columnSizes[1]) <<
"time [us]" 166 <<
" | " <<
std::setw(columnSizes[2]) <<
"distance [cm]" 167 <<
" | " <<
std::setw(columnSizes[3]) <<
"ticks";
170 for (
auto const&
TPCID : geom.IterateTPCIDs()) {
171 auto const driftDistance = driftDistances[
TPCID];
172 auto const driftTime = driftDistance / driftVelocity;
175 <<
" | " <<
std::setw(columnSizes[2]) << driftDistance <<
" | " 176 <<
std::setw(columnSizes[3]) << (driftTime / (TDCtick / 1000.));
181 if (nErrors > 0) {
mf::LogError(
"detp_test") << nErrors <<
" errors detected!"; }
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
Provides simple real number checks.
Helper functions for support of LArPropertiesService in LArSoft tests.
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
int main(int argc, char const **argv)
Runs the test.
Class for approximate comparisons.
bool check(const std::vector< std::vector< float > > &outputs)
Helper functions for support of DetectorClocksService in LArSoft tests.
testing::BasicGeometryEnvironmentConfiguration< geo::ChannelMapStandardAlg > TesterConfiguration
Environment for a geometry test.
Description of geometry of one entire detector.
Class used for the conversion of times between different formats and references.
Q_EXPORT QTSManip setw(int w)
Class holding a configuration for a test environment.
testing::TesterEnvironment< testing::BasicEnvironmentConfiguration > TestEnvironment
virtual double DriftVelocity(double efield=0., double temperature=0.) const =0
Properties related to liquid argon environment in the detector.
Implementation of detinfo::DetectorClocks interface with fixed settings from configuration.
Access the description of detector geometry.
IDparameter< geo::TPCID > TPCID
Member type of validated geo::TPCID parameter.
constexpr bool equal(Value_t a, Value_t b) const
Returns whether a and b are no farther than the threshold.
double sampling_rate(DetectorClocksData const &data)
Returns the period of the TPC readout electronics clock.
QTextStream & endl(QTextStream &s)