1#include "DQM/SampleValidation.h"
3#include "Math/Vector3D.h"
4#include "SimCore/Event/SimParticle.h"
10 target_scoring_plane_coll_name_ =
11 ps.
get<std::string>(
"target_scoring_plane_coll_name");
12 target_scoring_plane_passname_ =
13 ps.
get<std::string>(
"target_scoring_plane_passname");
14 sim_particles_coll_name_ = ps.
get<std::string>(
"sim_particles_coll_name");
15 sim_particles_passname_ = ps.
get<std::string>(
"sim_particles_passname");
21 target_scoring_plane_coll_name_, target_scoring_plane_passname_));
23 sim_particles_coll_name_, sim_particles_passname_)};
25 std::vector<int> primary_daughters;
27 double hard_thresh{9999.0};
30 for (
auto const& it : particle_map) {
32 std::vector<int> parents_track_ids = p.
getParents();
38 for (
auto const& parent_track_id : parents_track_ids) {
39 if (parent_track_id == 0) {
40 ROOT::Math::XYZVector momentum_vec(momentum[0], momentum[1],
45 momentum_vec.Theta() * (180 / 3.14159));
47 hard_thresh = (2500. / 4000.) * energy;
48 primary_daughters = daughters;
50 if (sphit.getTrackID() == it.first && sphit.getPosition()[2] < 0) {
58 std::vector<std::vector<int>> hardbrem_daughters;
60 for (
auto const& it : particle_map) {
61 int trackid = it.first;
64 ROOT::Math::XYZVector momentum_vec(momentum[0], momentum[1], momentum[2]);
65 for (
auto const& primary_daughter : primary_daughters) {
66 if (trackid == primary_daughter) {
77 momentum_vec.Theta() * (180 / 3.14159));
85 for (
auto const& it : particle_map) {
86 int trackid = it.first;
89 ROOT::Math::XYZVector momentum_vec(momentum[0], momentum[1], momentum[2]);
90 for (
const std::vector<int>& daughter_track_id : hardbrem_daughters) {
91 for (
const int& daughter_id : daughter_track_id) {
92 if (trackid == daughter_id) {
98 momentum_vec.Theta() * (180 / 3.14159));
100 std::sqrt(momentum_vec.Perp2()));
109float SampleValidation::pdgidLabel(
const int pdgid) {
113 if (pdgid == -11) label = 0;
114 if (pdgid == 11) label = 1;
115 if (pdgid == -13) label = 2;
116 if (pdgid == 13) label = 3;
117 if (pdgid == 22) label = 4;
118 if (pdgid == 2212) label = 5;
119 if (pdgid == 2112) label = 6;
120 if (pdgid == 211) label = 7;
121 if (pdgid == -211) label = 8;
122 if (pdgid == 111) label = 9;
123 if (pdgid == 321) label = 10;
124 if (pdgid == -321) label = 11;
125 if (pdgid == 130) label = 12;
126 if (pdgid == 310) label = 13;
127 if (pdgid == 3122 || pdgid == 3222 || pdgid == 3212 || pdgid == 3112 ||
128 pdgid == 3322 || pdgid == 3312) {
136 if (pdgid > 1000000000) {
137 if (((pdgid / 10) % 1000) <= 4) {
144 if (pdgid == 622) label = 17;
146 if (pdgid == 17) label = 18;
147 if (pdgid == -17) label = 19;
149 ldmx_log(debug) <<
"Unrecognized PDG ID: " << pdgid
150 <<
", assigning to 'else'";
#define DECLARE_ANALYZER(CLASS)
Macro which allows the framework to construct an analyzer given its name during configuration.
Class which encapsulates information from a hit in a simulated tracking detector.
virtual void configure(framework::config::Parameters &ps) override
Callback for the EventProcessor to configure itself from the given set of parameters.
virtual void analyze(const framework::Event &event) override
Process the event and make histograms or summaries.
HistogramPool histograms_
helper object for making and filling histograms
Implements an event buffer system for storing event data.
const std::vector< ContentType > & getCollection(const std::string &collectionName, const std::string &passName) const
Get a collection (std::vector) of objects from the event bus.
void fill(const std::string &name, const T &val)
Fill a 1D histogram.
Class encapsulating parameters for configuring a processor.
const T & get(const std::string &name) const
Retrieve the parameter of the given name.
Class representing a simulated particle.
double getEnergy() const
Get the energy of this particle [MeV].
std::vector< int > getParents() const
Get a vector containing the track IDs of the parent particles.
std::vector< double > getVertex() const
Get a vector containing the vertex of this particle in mm.
std::vector< int > getDaughters() const
Get a vector containing the track IDs of all daughter particles.
int getPdgID() const
Get the PDG ID of this particle.
std::vector< double > getEndPoint() const
Get the end_point of this particle where it was destroyed or left the world volume [mm].
std::vector< double > getMomentum() const
Get a vector containing the momentum of this particle [MeV].
Represents a simulated tracker hit in the simulation.