LDMX Software
HcalGeometryTest.cxx
1#include <catch2/catch_approx.hpp>
2#include <catch2/catch_test_macros.hpp>
3
4using Catch::Approx;
5
6#include "Framework/Configure/Python.h"
8#include "Framework/Process.h"
10
11namespace hcal {
12namespace test {
13
22 private:
23 std::string hcal_sim_hits_pass_name_{""};
24
25 public:
26 HcalCheckPositionMap(const std::string& name, framework::Process& p)
27 : framework::Analyzer(name, p) {}
29
30 void configure(framework::config::Parameters& parameters) override {
31 hcal_sim_hits_pass_name_ =
32 parameters.get<std::string>("hcal_sim_hits_pass_name", "");
33 }
34
35 void onProcessStart() final override {}
36
37 void analyze(const framework::Event& event) final override {
38 const auto sim_hits = event.getCollection<ldmx::SimCalorimeterHit>(
39 "HcalSimHits", hcal_sim_hits_pass_name_);
40
41 CHECK(sim_hits.size() > 0);
42 return;
43 }
44}; // HcalCheckPositionMap
45
46} // namespace test
47} // namespace hcal
48
50
51
54TEST_CASE("Hcal Geometry test", "[Hcal][functionality]") {
55 const std::string config_file{"hcal_geometry_test_config.py"};
56 char** args{nullptr};
57 auto cfg{framework::config::run("ldmxcfg.Process.last_process", config_file,
58 args, 0)};
59 auto p{std::make_unique<framework::Process>(cfg)};
60 p->run();
61}
Base classes for all user event processing components to extend.
#define DECLARE_ANALYZER(CLASS)
Macro which allows the framework to construct an analyzer given its name during configuration.
Class which represents the process under execution.
Class which stores simulated calorimeter hit information.
Base class for a module which does not produce a data product.
Implements an event buffer system for storing event data.
Definition Event.h:40
Class which represents the process under execution.
Definition Process.h:34
Class encapsulating parameters for configuring a processor.
Definition Parameters.h:26
const T & get(const std::string &name) const
Retrieve the parameter of the given name.
Definition Parameters.h:75
void onProcessStart() final override
Callback for the EventProcessor to take any necessary action when the processing of events starts,...
void configure(framework::config::Parameters &parameters) override
Callback for the EventProcessor to configure itself from the given set of parameters.
void analyze(const framework::Event &event) final override
Process the event and make histograms or summaries.
Stores simulated calorimeter hit information.
Parameters run(const std::string &root_object, const std::string &pythonScript, char *args[], int nargs)
run the python script and extract the parameters
Definition Python.cxx:300