diff --git a/DQM/include/DQM/HCalDQM.h b/DQM/include/DQM/HCalDQM.h index 94f0260ff..a209025c5 100644 --- a/DQM/include/DQM/HCalDQM.h +++ b/DQM/include/DQM/HCalDQM.h @@ -1,6 +1,5 @@ #ifndef _DQM_HCAL_DQM_H_ #define _DQM_HCAL_DQM_H_ - //----------// // STL // //----------// @@ -14,6 +13,8 @@ /*~~~~~~~~~~~~~~~*/ /* Framework */ /*~~~~~~~~~~~~~~~*/ +#include + #include "DetDescr/HcalGeometry.h" #include "DetDescr/HcalID.h" #include "Framework/Configure/Parameters.h" @@ -24,11 +25,10 @@ #include "Hcal/Event/HcalVetoResult.h" #include "SimCore/Event/SimCalorimeterHit.h" #include "Tools/AnalysisUtils.h" -#include namespace dqm { class HCalDQM : public framework::Analyzer { -public: + public: /** Constructor */ HCalDQM(const std::string &name, framework::Process &process); @@ -40,7 +40,7 @@ class HCalDQM : public framework::Analyzer { * * @param parameters Set of parameters used to configure this processor. */ - void configure(framework::config::Parameters ¶meters) final override; + void configure(framework::config::Parameters ¶meters) override; /** * Process the event and make histograms ro summaries. @@ -66,7 +66,7 @@ class HCalDQM : public framework::Analyzer { return false; } -private: + private: /// Hcal Sim Hits collection name std::string sim_coll_name_; @@ -90,6 +90,6 @@ class HCalDQM : public framework::Analyzer { double max_hit_time_; }; -} // namespace dqm +} // namespace dqm -#endif // _DQM_HCAL_DQM_H_ +#endif // _DQM_HCAL_DQM_H_ diff --git a/DQM/include/DQM/HcalGeometryVerifier.h b/DQM/include/DQM/HcalGeometryVerifier.h index c49b0954b..b0899d477 100644 --- a/DQM/include/DQM/HcalGeometryVerifier.h +++ b/DQM/include/DQM/HcalGeometryVerifier.h @@ -14,7 +14,6 @@ #include "SimCore/Event/SimCalorimeterHit.h" namespace dqm { - class HcalGeometryVerifier : public framework::Analyzer { public: HcalGeometryVerifier(const std::string &name, framework::Process &process) diff --git a/DQM/include/DQM/PhotoNuclearDQM.h b/DQM/include/DQM/PhotoNuclearDQM.h index 72fe7085b..10607789c 100644 --- a/DQM/include/DQM/PhotoNuclearDQM.h +++ b/DQM/include/DQM/PhotoNuclearDQM.h @@ -6,9 +6,7 @@ /*~~~~~~~~~~~~~~~*/ #include "Framework/Configure/Parameters.h" #include "Framework/EventProcessor.h" - #include "SimCore/Event/SimParticle.h" - namespace dqm { // Forward declarations within the ldmx workspace @@ -16,7 +14,6 @@ class Event; class SimParticle; class PhotoNuclearDQM : public framework::Analyzer { - // Classification schemes for PN events enum class CompactEventType { single_neutron = 0, @@ -50,12 +47,12 @@ class PhotoNuclearDQM : public framework::Analyzer { multibody = 20, }; -public: + public: /// Constructor PhotoNuclearDQM(const std::string &name, framework::Process &process); /// Destructor - ~PhotoNuclearDQM(); + virtual ~PhotoNuclearDQM(); /** * Configure this analyzer using the user specified parameters. @@ -63,30 +60,28 @@ class PhotoNuclearDQM : public framework::Analyzer { * @param parameters Set of parameters used to configure this * analyzer. */ - void configure(framework::config::Parameters ¶meters) final override; + void configure(framework::config::Parameters ¶meters) override; /** * Process the event and create the histogram summaries. * * @param event The event to analyze. */ - void analyze(const framework::Event &event) final override; + void analyze(const framework::Event &event) override; /// Method executed before processing of events begins. - void onProcessStart(); + void onProcessStart() override; -private: + private: /** Method used to classify events. Note: Assumes that daughters is sorted by * kinetic energy. */ - EventType - classifyEvent(const std::vector daughters, - double threshold); + EventType classifyEvent( + const std::vector daughters, double threshold); /** Method used to classify events in a compact manner. */ - CompactEventType - classifyCompactEvent(const ldmx::SimParticle *pnGamma, - const std::vector daughters, - double threshold); + CompactEventType classifyCompactEvent( + const ldmx::SimParticle *pnGamma, + const std::vector daughters, double threshold); /** * Fill the recoil electron-histograms @@ -105,9 +100,9 @@ class PhotoNuclearDQM : public framework::Analyzer { * The products are sorted by kinetic energy, in descending order. * **/ - std::vector - findDaughters(const std::map particleMap, - const ldmx::SimParticle *parent) const; + std::vector findDaughters( + const std::map &particleMap, + const ldmx::SimParticle *parent) const; /** * @@ -125,10 +120,10 @@ class PhotoNuclearDQM : public framework::Analyzer { **/ void findSubleadingKinematics( const ldmx::SimParticle *pnGamma, - const std::vector &pnDaughters, // + const std::vector &pnDaughters, // const EventType eventType); -public: + public: /** * Check if the PDG code corresponds to a light ion. * @@ -140,9 +135,7 @@ class PhotoNuclearDQM : public framework::Analyzer { * */ constexpr bool isLightIon(const int pdgCode) const { - // - // TODO: Is the < check necessary? - if (pdgCode > 1000000000 && pdgCode < 10000000000) { + if (pdgCode > 1000000000) { // Check if the atomic number is less than or equal to 4 return ((pdgCode / 10) % 1000) <= 4; } @@ -153,6 +146,6 @@ class PhotoNuclearDQM : public framework::Analyzer { bool count_light_ions_; }; -} // namespace dqm +} // namespace dqm -#endif // _DQM_ECAL_PN_H_ +#endif // _DQM_ECAL_PN_H_ diff --git a/DQM/python/dqm.py b/DQM/python/dqm.py index f65b5803d..ecb71a0b7 100644 --- a/DQM/python/dqm.py +++ b/DQM/python/dqm.py @@ -198,7 +198,7 @@ def __init__(self,name="HcalInefficiencyAnalyzer", num_sections=5, for section in range(num_sections): section_name = section_names[section] self.build1DHistogram(f"inefficiency_{section_name}", - "fInefficiency ({section_name})", + f"Inefficiency ({section_name})", *inefficiency_layer_bins ) diff --git a/DQM/src/DQM/HCalDQM.cxx b/DQM/src/DQM/HCalDQM.cxx index 1cad2dc0c..64093c44d 100644 --- a/DQM/src/DQM/HCalDQM.cxx +++ b/DQM/src/DQM/HCalDQM.cxx @@ -24,11 +24,8 @@ void HCalDQM::analyze(const framework::Event &event) { sim_coll_name_, sim_pass_name_)}; analyzeSimHits(hcalSimHits); analyzeRecHits(hcalHits); - const auto &geometry = getCondition( - ldmx::HcalGeometry::CONDITIONS_OBJECT_NAME); } void HCalDQM::analyzeSimHits(const std::vector &hits) { - const auto &geometry = getCondition( ldmx::HcalGeometry::CONDITIONS_OBJECT_NAME); @@ -36,7 +33,6 @@ void HCalDQM::analyzeSimHits(const std::vector &hits) { int hitMultiplicity{0}; for (const auto &hit : hits) { - ldmx::HcalID id(hit.getID()); if (skipHit(id)) { continue; @@ -48,7 +44,6 @@ void HCalDQM::analyzeSimHits(const std::vector &hits) { simEnergyPerBar[id] += energy; } const auto orientation{geometry.getScintillatorOrientation(id)}; - const auto section{id.section()}; const auto layer{id.layer()}; const auto strip{id.strip()}; const auto pos{hit.getPosition()}; @@ -62,15 +57,15 @@ void HCalDQM::analyzeSimHits(const std::vector &hits) { histograms_.fill("sim_layer:strip", layer, strip); histograms_.fill("sim_energy", energy); switch (orientation) { - case ldmx::HcalGeometry::ScintillatorOrientation::horizontal: - histograms_.fill("sim_along_x", x); - break; - case ldmx::HcalGeometry::ScintillatorOrientation::vertical: - histograms_.fill("sim_along_y", y); - break; - case ldmx::HcalGeometry::ScintillatorOrientation::depth: - histograms_.fill("sim_along_z", z); - break; + case ldmx::HcalGeometry::ScintillatorOrientation::horizontal: + histograms_.fill("sim_along_x", x); + break; + case ldmx::HcalGeometry::ScintillatorOrientation::vertical: + histograms_.fill("sim_along_y", y); + break; + case ldmx::HcalGeometry::ScintillatorOrientation::depth: + histograms_.fill("sim_along_z", z); + break; } } @@ -85,14 +80,12 @@ void HCalDQM::analyzeSimHits(const std::vector &hits) { histograms_.fill("sim_total_energy", total_energy); } void HCalDQM::analyzeRecHits(const std::vector &hits) { - const auto &geometry = getCondition( ldmx::HcalGeometry::CONDITIONS_OBJECT_NAME); float totalPE{0}; float maxPE{-1}; float maxPETime{-1}; - float E{0}; float totalE{0}; int vetoableHitMultiplicity{0}; int hitMultiplicity{0}; @@ -125,17 +118,16 @@ void HCalDQM::analyzeRecHits(const std::vector &hits) { const auto y{hit.getYPos()}; const auto z{hit.getZPos()}; switch (orientation) { - case ldmx::HcalGeometry::ScintillatorOrientation::horizontal: - histograms_.fill("along_x", x); - break; - case ldmx::HcalGeometry::ScintillatorOrientation::vertical: - histograms_.fill("along_y", y); - break; - case ldmx::HcalGeometry::ScintillatorOrientation::depth: - histograms_.fill("along_z", z); - break; + case ldmx::HcalGeometry::ScintillatorOrientation::horizontal: + histograms_.fill("along_x", x); + break; + case ldmx::HcalGeometry::ScintillatorOrientation::vertical: + histograms_.fill("along_y", y); + break; + case ldmx::HcalGeometry::ScintillatorOrientation::depth: + histograms_.fill("along_z", z); + break; } - totalE += e; totalPE += pe; @@ -159,6 +151,6 @@ void HCalDQM::analyzeRecHits(const std::vector &hits) { histograms_.fill("vetoable_hit_multiplicity", vetoableHitMultiplicity); } -} // namespace dqm +} // namespace dqm DECLARE_ANALYZER_NS(dqm, HCalDQM) diff --git a/DQM/src/DQM/HcalGeometryVerfifier.cxx b/DQM/src/DQM/HcalGeometryVerfifier.cxx index b6ca69e95..543d3cc5b 100644 --- a/DQM/src/DQM/HcalGeometryVerfifier.cxx +++ b/DQM/src/DQM/HcalGeometryVerfifier.cxx @@ -19,7 +19,7 @@ void HcalGeometryVerifier::analyze(const framework::Event &event) { hcalRecHitsCollection_, hcalRecHitsPassName_); for (const auto &hit : hcalSimHits) { - const ldmx::HcalID id{hit.getID()}; + const ldmx::HcalID id{static_cast(hit.getID())}; const auto position{hit.getPosition()}; auto ok{hit_ok(id, {position[0], position[1], position[2]})}; histograms_.fill("passes_sim", ok); @@ -42,7 +42,7 @@ void HcalGeometryVerifier::analyze(const framework::Event &event) { } } for (const auto &hit : hcalRecHits) { - const ldmx::HcalID id{hit.getID()}; + const ldmx::HcalID id{static_cast(hit.getID())}; auto ok{hit_ok(id, {hit.getXPos(), hit.getYPos(), hit.getZPos()})}; histograms_.fill("passes_rec", ok); switch (id.section()) { diff --git a/DQM/src/DQM/HcalInefficiencyDQM.cxx b/DQM/src/DQM/HcalInefficiencyDQM.cxx index 92302404b..14ea2c862 100644 --- a/DQM/src/DQM/HcalInefficiencyDQM.cxx +++ b/DQM/src/DQM/HcalInefficiencyDQM.cxx @@ -29,10 +29,14 @@ void HcalInefficiencyAnalyzer::analyze(const framework::Event &event) { bool vetoedByBack{firstLayersHit[ldmx::HcalID::HcalSection::BACK] != failedVeto}; - bool vetoedByTop{firstLayersHit[ldmx::HcalID::HcalSection::TOP]}; - bool vetoedByBottom{firstLayersHit[ldmx::HcalID::HcalSection::BOTTOM]}; - bool vetoedByRight{firstLayersHit[ldmx::HcalID::HcalSection::RIGHT]}; - bool vetoedByLeft{firstLayersHit[ldmx::HcalID::HcalSection::LEFT]}; + bool vetoedByTop{firstLayersHit[ldmx::HcalID::HcalSection::TOP] != + failedVeto}; + bool vetoedByBottom{firstLayersHit[ldmx::HcalID::HcalSection::BOTTOM] != + failedVeto}; + bool vetoedByRight{firstLayersHit[ldmx::HcalID::HcalSection::RIGHT] != + failedVeto}; + bool vetoedByLeft{firstLayersHit[ldmx::HcalID::HcalSection::LEFT] != + failedVeto}; bool vetoedBySide{vetoedByTop || vetoedByBottom || vetoedByRight || vetoedByLeft}; @@ -61,7 +65,6 @@ void HcalInefficiencyAnalyzer::analyze(const framework::Event &event) { void HcalInefficiencyAnalyzer::configure( framework::config::Parameters ¶meters) { - hcalSimHitsCollection_ = parameters.getParameter("sim_coll_name"); hcalRecHitsCollection_ = @@ -71,6 +74,6 @@ void HcalInefficiencyAnalyzer::configure( pe_veto_threshold = parameters.getParameter("pe_veto_threshold"); max_hit_time_ = parameters.getParameter("max_hit_time"); } -} // namespace dqm +} // namespace dqm DECLARE_ANALYZER_NS(dqm, HcalInefficiencyAnalyzer); diff --git a/DQM/src/DQM/PhotoNuclearDQM.cxx b/DQM/src/DQM/PhotoNuclearDQM.cxx index f0a9e11fc..218e944d2 100644 --- a/DQM/src/DQM/PhotoNuclearDQM.cxx +++ b/DQM/src/DQM/PhotoNuclearDQM.cxx @@ -15,11 +15,11 @@ //----------// // LDMX // //----------// +#include + #include "Framework/Event.h" #include "Tools/AnalysisUtils.h" -#include - namespace dqm { PhotoNuclearDQM::PhotoNuclearDQM(const std::string &name, @@ -28,7 +28,7 @@ PhotoNuclearDQM::PhotoNuclearDQM(const std::string &name, PhotoNuclearDQM::~PhotoNuclearDQM() {} std::vector PhotoNuclearDQM::findDaughters( - const std::map particleMap, + const std::map &particleMap, const ldmx::SimParticle *parent) const { std::vector pnDaughters; for (const auto &daughterTrackID : parent->getDaughters()) { @@ -60,7 +60,6 @@ std::vector PhotoNuclearDQM::findDaughters( return pnDaughters; } void PhotoNuclearDQM::findRecoilProperties(const ldmx::SimParticle *recoil) { - histograms_.fill("recoil_vertex_x", recoil->getVertex()[0]); histograms_.fill("recoil_vertex_y", recoil->getVertex()[1]); histograms_.fill("recoil_vertex_z", recoil->getVertex()[2]); @@ -138,7 +137,6 @@ void PhotoNuclearDQM::findSubleadingKinematics( const ldmx::SimParticle *pnGamma, const std::vector &pnDaughters, const PhotoNuclearDQM::EventType eventType) { - // Note: Assumes sorted by energy double subleading_ke{-9999}; @@ -177,27 +175,27 @@ void PhotoNuclearDQM::findSubleadingKinematics( } void PhotoNuclearDQM::onProcessStart() { std::vector labels = {"", - "Nothing hard", // 0 - "1 n", // 1 - "2 n", // 2 - "#geq 3 n", // 3 - "1 #pi", // 4 - "2 #pi", // 5 - "1 #pi_{0}", // 6 - "1 #pi A", // 7 - "1 #pi 2 A", // 8 - "2 #pi A", // 9 - "1 #pi_{0} A", // 10 - "1 #pi_{0} 2 A", // 11 - "#pi_{0} #pi A", // 12 - "1 p", // 13 - "2 p", // 14 - "pn", // 15 - "K^{0}_{L} X", // 16 - "K X", // 17 - "K^{0}_{S} X", // 18 - "exotics", // 19 - "multi-body", // 20 + "Nothing hard", // 0 + "1 n", // 1 + "2 n", // 2 + "#geq 3 n", // 3 + "1 #pi", // 4 + "2 #pi", // 5 + "1 #pi_{0}", // 6 + "1 #pi A", // 7 + "1 #pi 2 A", // 8 + "2 #pi A", // 9 + "1 #pi_{0} A", // 10 + "1 #pi_{0} 2 A", // 11 + "#pi_{0} #pi A", // 12 + "1 p", // 13 + "2 p", // 14 + "pn", // 15 + "K^{0}_{L} X", // 16 + "K X", // 17 + "K^{0}_{S} X", // 18 + "exotics", // 19 + "multi-body", // 20 ""}; std::vector hists = { @@ -214,12 +212,12 @@ void PhotoNuclearDQM::onProcessStart() { } labels = {"", - "1 n", // 0 - "K#pm X", // 1 - "1 K^{0}", // 2 - "2 n", // 3 - "Soft", // 4 - "Other", // 5 + "1 n", // 0 + "K#pm X", // 1 + "1 K^{0}", // 2 + "2 n", // 3 + "Soft", // 4 + "Other", // 5 ""}; hists = { @@ -235,11 +233,11 @@ void PhotoNuclearDQM::onProcessStart() { } std::vector n_labels = {"", - "nn", // 0 - "pn", // 1 - "#pi^{+}n", // 2 - "#pi^{0}n", // 3 - "other", // 4 + "nn", // 0 + "pn", // 1 + "#pi^{+}n", // 2 + "#pi^{0}n", // 3 + "other", // 4 ""}; TH1 *hist = histograms_.get("1n_event_type"); @@ -305,38 +303,38 @@ void PhotoNuclearDQM::analyze(const framework::Event &event) { static_cast(eventTypeComp2000MeV)); switch (eventType) { - case EventType::single_neutron: - if (eventType == EventType::single_neutron) { + case EventType::single_neutron: if (pnDaughters.size() > 1) { auto secondHardestPdgID{abs(pnDaughters[1]->getPdgID())}; auto nEventType{-10}; if (secondHardestPdgID == 2112) { - nEventType = 0; // n + n + nEventType = 0; // n + n } else if (secondHardestPdgID == 2212) { - nEventType = 1; // p + n + nEventType = 1; // p + n } else if (secondHardestPdgID == 211) { - nEventType = 2; // Pi+/- + n + nEventType = 2; // Pi+/- + n } else if (secondHardestPdgID == 111) { - nEventType = 3; // Pi0 + n + nEventType = 3; // Pi0 + n } else { - nEventType = 4; // other + nEventType = 4; // other } histograms_.fill("1n_event_type", nEventType); } - } - [[fallthrough]]; // Remaining code is important for 1n as well - case EventType::two_neutrons: - case EventType::charged_kaon: - case EventType::klong: - case EventType::kshort: - findSubleadingKinematics(pnGamma, pnDaughters, eventType); - break; + [[fallthrough]]; // Remaining code is important for 1n as well + case EventType::two_neutrons: + case EventType::charged_kaon: + case EventType::klong: + case EventType::kshort: + findSubleadingKinematics(pnGamma, pnDaughters, eventType); + break; + default: // Nothing to do + break; } } PhotoNuclearDQM::EventType PhotoNuclearDQM::classifyEvent( const std::vector daughters, double threshold) { - short n{0}, p{0}, pi{0}, pi0{0}, exotic{0}, k0l{0}, kp{0}, k0s{0}, lambda{0}; + short n{0}, p{0}, pi{0}, pi0{0}, exotic{0}, k0l{0}, kp{0}, k0s{0}; // Loop through all of the PN daughters and extract kinematic // information. @@ -413,7 +411,7 @@ PhotoNuclearDQM::EventType PhotoNuclearDQM::classifyEvent( return EventType::single_charged_pion_and_two_nucleons; } else if (pi == 2 && nucleons == 1) { return EventType::two_charged_pions_and_nucleon; - } // else + } // else else if (pi0 == 1 && nucleons == 2) { return EventType::single_neutral_pion_and_two_nucleons; } else if (pi0 == 1 && nucleons == 1 && pi == 1) { @@ -498,6 +496,6 @@ PhotoNuclearDQM::CompactEventType PhotoNuclearDQM::classifyCompactEvent( return PhotoNuclearDQM::CompactEventType::other; } -} // namespace dqm +} // namespace dqm DECLARE_ANALYZER_NS(dqm, PhotoNuclearDQM)