39 double constexpr
tolerance = std::numeric_limits<double>::epsilon();
50 using Parameters = EDProducer::Table<Config>;
51 explicit AssembleMoreProductsRobust(Parameters
const&
config);
61 double const expTrkEff_;
64 std::map<SubRunNumber_t, SummedValue<unsigned>> trkEffNum_{};
65 std::map<SubRunNumber_t, SummedValue<unsigned>> trkEffDenom_{};
66 std::map<SubRunNumber_t, SummedValue<unsigned>> nParticles_{};
67 std::map<SubRunNumber_t, SummedValue<unsigned>> seenParticles_{};
71 AssembleMoreProductsRobust::AssembleMoreProductsRobust(
74 , trkEffTag_{
config().trkEffTag()}
75 , expTrkEff_{
config().trkEff()}
76 , nParticlesTag_{
config().nParticlesTag()}
77 , seenParticlesTag_{
config().seenParticlesTag()}
79 produces<Fraction, art::InSubRun>(
"TrkEffValue");
80 produces<Fraction, art::InSubRun>(
"ParticleRatio");
88 trkEffRef.emplace_range(sr.
subRun(), 1, 101);
90 auto const srn = sr.
subRun();
92 auto& trkEffNum = trkEffNum_[srn];
93 auto& trkEffDenom = trkEffDenom_[srn];
95 trkEffNum.update(
h,
h->num());
96 trkEffDenom.update(
h,
h->denom());
103 std::make_unique<Fraction>(trkEffNum.value(), trkEffDenom.value());
104 BOOST_CHECK_CLOSE_FRACTION(expTrkEff_, trkEff->value(),
tolerance);
112 AssembleMoreProductsRobust::endSubRun(
art::SubRun& sr)
115 auto& nParticles = nParticles_[srn];
116 auto& seenParticles = seenParticles_[srn];
120 if (sr.
getByLabel(nParticlesTag_, nParticlesH)) {
121 nParticles.update(nParticlesH);
125 auto const& seenParticlesH = sr.
getValidHandle<
unsigned>(seenParticlesTag_);
126 seenParticles.update(seenParticlesH);
130 std::make_unique<Fraction>(seenParticles.value(), nParticles.value()),
134 seenParticles.clear();
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
#define DEFINE_ART_MODULE(klass)
std::enable_if_t< detail::are_handles< T, U >::value, bool > disjoint_ranges(T const &a, U const &b)
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
IDNumber_t< Level::SubRun > SubRunNumber_t
SubRunNumber_t subRun() const
constexpr auto subRunFragment()
std::enable_if_t< detail::are_handles< T, U >::value, bool > overlapping_ranges(T const &a, U const &b)
std::enable_if_t< detail::are_handles< T, U >::value, bool > same_ranges(T const &a, U const &b)
ProductID put(std::unique_ptr< PROD > &&edp, FullSemantic< Level::Run > const semantic)
h
training ###############################