From 9aac4678febde63a182fd2f13492fca9d97de11c Mon Sep 17 00:00:00 2001 From: Omar Moreno Date: Wed, 21 Oct 2020 10:13:02 -0700 Subject: [PATCH 1/7] Move source files to subdirectory. --- src/{ => Hcal}/HcalDigiProducer.cxx | 2 +- src/{ => Hcal}/HcalVetoProcessor.cxx | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename src/{ => Hcal}/HcalDigiProducer.cxx (99%) rename src/{ => Hcal}/HcalVetoProcessor.cxx (100%) diff --git a/src/HcalDigiProducer.cxx b/src/Hcal/HcalDigiProducer.cxx similarity index 99% rename from src/HcalDigiProducer.cxx rename to src/Hcal/HcalDigiProducer.cxx index 08d3195..9551734 100644 --- a/src/HcalDigiProducer.cxx +++ b/src/Hcal/HcalDigiProducer.cxx @@ -3,7 +3,7 @@ #include "TTree.h" #include "Hcal/HcalDigiProducer.h" -#include "Framework/Exception.h" +#include "Framework/Exception/Exception.h" #include "Framework/RandomNumberSeedService.h" #include diff --git a/src/HcalVetoProcessor.cxx b/src/Hcal/HcalVetoProcessor.cxx similarity index 100% rename from src/HcalVetoProcessor.cxx rename to src/Hcal/HcalVetoProcessor.cxx From ae220c8ce477fa9cca0f1731ae35b010c9f675b3 Mon Sep 17 00:00:00 2001 From: Omar Moreno Date: Wed, 21 Oct 2020 10:18:13 -0700 Subject: [PATCH 2/7] Update header paths. --- CMakeLists.txt | 2 +- include/Hcal/HcalDigiProducer.h | 4 ++-- include/Hcal/HcalVetoProcessor.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0ad2e14..02b0b9f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,7 +14,7 @@ find_package(ROOT CONFIG REQUIRED) setup_library(name Hcal dependencies ROOT::Physics - DARK::Framework DARK::Event DARK::Tools DARK::DetDescr + Framework::Framework Event::Event Tools::Tools DetDescr::DetDescr python_install_path ${PYTHON_INSTALL_PREFIX} ) diff --git a/include/Hcal/HcalDigiProducer.h b/include/Hcal/HcalDigiProducer.h index 89e4d8b..f64e8a3 100644 --- a/include/Hcal/HcalDigiProducer.h +++ b/include/Hcal/HcalDigiProducer.h @@ -14,10 +14,10 @@ // LDMX #include "DetDescr/DetectorID.h" #include "DetDescr/HcalID.h" -#include "Event/EventDef.h" +#include "Framework/EventDef.h" #include "Framework/EventProcessor.h" #include "Tools/NoiseGenerator.h" -#include "Framework/Parameters.h" +#include "Framework/Configure/Parameters.h" namespace ldmx { diff --git a/include/Hcal/HcalVetoProcessor.h b/include/Hcal/HcalVetoProcessor.h index 16d0dfe..cd716a5 100644 --- a/include/Hcal/HcalVetoProcessor.h +++ b/include/Hcal/HcalVetoProcessor.h @@ -18,7 +18,7 @@ #include "Event/HcalVetoResult.h" #include "Event/HcalHit.h" #include "Framework/EventProcessor.h" -#include "Framework/Parameters.h" +#include "Framework/Configure/Parameters.h" namespace ldmx { From 99f3f39a5d8a4cccf21d9363077e1fdf605736f2 Mon Sep 17 00:00:00 2001 From: Omar Moreno Date: Tue, 10 Nov 2020 15:15:50 -0800 Subject: [PATCH 3/7] Use PYTHON_PACKAGE_NAME instead. --- CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 02b0b9f..64bc864 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,8 @@ find_package(ROOT CONFIG REQUIRED) setup_library(name Hcal dependencies ROOT::Physics Framework::Framework Event::Event Tools::Tools DetDescr::DetDescr - python_install_path ${PYTHON_INSTALL_PREFIX} ) -setup_test(dependencies DARK::Hcal) +setup_python(package_name ${PYTHON_PACKAGE_NAME}/Hcal) + +setup_test(dependencies Hcal::Hcal) From 95305bf8e9a3c7aac427d2fc2891ec0586975bda Mon Sep 17 00:00:00 2001 From: Omar Moreno Date: Mon, 14 Dec 2020 13:18:43 -0800 Subject: [PATCH 4/7] Move HcalHit and HcalVetoResult to Hcal module. --- CMakeLists.txt | 21 ++++++- include/Hcal/Event/HcalHit.h | 97 +++++++++++++++++++++++++++++ include/Hcal/Event/HcalVetoResult.h | 73 ++++++++++++++++++++++ src/Hcal/Event/HcalHit.cxx | 22 +++++++ src/Hcal/Event/HcalVetoResult.cxx | 37 +++++++++++ 5 files changed, 249 insertions(+), 1 deletion(-) create mode 100644 include/Hcal/Event/HcalHit.h create mode 100644 include/Hcal/Event/HcalVetoResult.h create mode 100644 src/Hcal/Event/HcalHit.cxx create mode 100644 src/Hcal/Event/HcalVetoResult.cxx diff --git a/CMakeLists.txt b/CMakeLists.txt index 64bc864..60ea1f9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,26 @@ project(Hcal VERSION 2.1.0 # Search and configure ROOT find_package(ROOT CONFIG REQUIRED) -setup_library(name Hcal +option(BUILD_EVENT_ONLY "Build the event library." ON) +if(BUILD_EVENT_ONLY) + + register_event_object( module_path "Hcal/Event" namespace "ldmx" class "HcalVetoResult" ) + register_event_object( module_path "Hcal/Event" namespace "ldmx" class "HcalHit" type "collection") + + file(GLOB EVENT_SRC_FILES ${PROJECT_SOURCE_DIR}/src/Hcal/Event/*.cxx) + + # Generate the files needed to build the event classes. + setup_library(module Hcal + name Event + dependencies ROOT::Core Event::Event + # Event::Event SimCore::Event + sources ${EVENT_SRC_FILES} + register_target) + return() + +endif() + +setup_library(module Hcal dependencies ROOT::Physics Framework::Framework Event::Event Tools::Tools DetDescr::DetDescr ) diff --git a/include/Hcal/Event/HcalHit.h b/include/Hcal/Event/HcalHit.h new file mode 100644 index 0000000..86a3942 --- /dev/null +++ b/include/Hcal/Event/HcalHit.h @@ -0,0 +1,97 @@ +/** + * @file HcalHit.h + * @brief Class that stores Stores reconstructed hit information from the HCAL + * @author Jeremy Mans, University of Minnesota + */ + +#ifndef HCAL_EVENT_HCALHIT_H_ +#define HCAL_EVENT_HCALHIT_H_ + +// LDMX +#include "Event/CalorimeterHit.h" + +namespace ldmx { + + /** + * @class HcalHit + * @brief Stores reconstructed hit information from the HCAL + * + * @note This class represents the reconstructed hit information + * from the HCAL, providing particular information for the HCAL, + * above and beyond what is available in the CalorimeterHit. + */ + class HcalHit : public CalorimeterHit { + + public: + + /** + * Class constructor. + */ + HcalHit() { + } + + /** + * Class destructor. + */ + virtual ~HcalHit() { + } + + /** + * Clear the data in the object. + */ + void Clear(); + + /** + * Print out the object. + */ + void Print() const; + + /** + * Get the number of photoelectrons estimated for this hit. + * @return Number of photoelectrons, including noise which affects the estimate. + */ + float getPE() const { + return pe_; + } + + /** + * Get the minimum number of photoelectrons estimated for this hit if two sided readout. + * @return Minimum number of photoelectrons, including noise which affects the estimate. + */ + float getMinPE() const { + return minpe_; + } + + /** + * Set the number of photoelectrons estimated for this hit. + * @param pe Number of photoelectrons, including noise which affects the estimate. + */ + void setPE(float pe) { + pe_ = pe; + } + + /** + * Set the minimum number of photoelectrons estimated for this hit. + * @param pe Minimum number of photoelectrons, including noise which affects the estimate. + */ + void setMinPE(float minpe) { + minpe_ = minpe; + } + + private: + + /** The number of PE estimated for this hit. */ + float pe_{0}; + + /** The minimum number of PE estimated for this hit, different from pe_ when you have two ended readout */ + float minpe_{-99}; + + /** + * The ROOT class definition. + */ + ClassDef(HcalHit, 2); + }; + +} + +#endif /* HCAL_EVENT_HCALHIT_H_ */ diff --git a/include/Hcal/Event/HcalVetoResult.h b/include/Hcal/Event/HcalVetoResult.h new file mode 100644 index 0000000..6b70b08 --- /dev/null +++ b/include/Hcal/Event/HcalVetoResult.h @@ -0,0 +1,73 @@ +/** + * @file HcalVetoResult.h + * @brief Class used to encapsulate the results obtained from + * HcalVetoProcessor. + * @author Omar Moreno, SLAC National Accelerator Laboratory + */ + +#ifndef HCAL_EVENT_HCALVETORESULT_H_ +#define HCAL_EVENT_HCALVETORESULT_H_ + +//----------// +// ROOT // +//----------// +#include "TObject.h" //For ClassDef + +//----------// +// LDMX // +//----------// +#include "Hcal/Event/HcalHit.h" + +namespace ldmx { + + class HcalVetoResult { + + public: + + /** Constructor */ + HcalVetoResult(); + + /** Destructor */ + ~HcalVetoResult(); + + /** Reset the object. */ + void Clear(); + + /** Print out the object */ + void Print() const; + + /** Checks if the event passes the Hcal veto. */ + bool passesVeto() const { return passesVeto_; }; + + /** @return The maximum PE HcalHit. */ + inline HcalHit getMaxPEHit() const { return maxPEHit_; } + + /** + * Sets whether the Hcal veto was passed or not. + * + * @param passesVeto Veto result. + */ + inline void setVetoResult(const bool& passesVeto = true) { passesVeto_ = passesVeto; } + + /** + * Set the maximum PE hit. + * + * @param maxPEHit The maximum PE HcalHit + */ + inline void setMaxPEHit(const HcalHit maxPEHit) { maxPEHit_ = maxPEHit; } + + private: + + /** Reference to max PE hit. */ + HcalHit maxPEHit_; + + /** Flag indicating whether the event passes the Hcal veto. */ + bool passesVeto_{false}; + + ClassDef(HcalVetoResult, 2); + + }; // HcalVetoResult +} + + +#endif // HCAL_EVENT_HCALVETORESULT_H_ diff --git a/src/Hcal/Event/HcalHit.cxx b/src/Hcal/Event/HcalHit.cxx new file mode 100644 index 0000000..f12a1ad --- /dev/null +++ b/src/Hcal/Event/HcalHit.cxx @@ -0,0 +1,22 @@ +#include "Hcal/Event/HcalHit.h" + +// STL +#include + +ClassImp(ldmx::HcalHit) + +namespace ldmx { + + void HcalHit::Clear() { + CalorimeterHit::Clear(); + pe_ = 0; + minpe_ = -99; + } + + void HcalHit::Print() const { + std::cout << "HcalHit { " << "id: " << std::hex << getID() << std::dec + << ", energy: " << getEnergy() << "MeV, time: " << getTime() + << "ns, amplitude: " << getAmplitude() << ", pe: " << getPE() << "}" << std::endl; + + } +} diff --git a/src/Hcal/Event/HcalVetoResult.cxx b/src/Hcal/Event/HcalVetoResult.cxx new file mode 100644 index 0000000..8f4f2df --- /dev/null +++ b/src/Hcal/Event/HcalVetoResult.cxx @@ -0,0 +1,37 @@ +/** + * @file HcalVetoResult.h + * @brief Class used to encapsulate the results obtained from + * HcalVetoProcessor. + * @author Omar Moreno, SLAC National Accelerator Laboratory + */ + +#include "Hcal/Event/HcalVetoResult.h" + +//----------------// +// C++ StdLib // +//----------------// +#include + +//-------------// +// ldmx-sw // +//-------------// +#include "Hcal/Event/HcalHit.h" + +ClassImp(ldmx::HcalVetoResult) + +namespace ldmx { + + HcalVetoResult::HcalVetoResult() {} + + HcalVetoResult::~HcalVetoResult() {} + + void HcalVetoResult::Clear() { + passesVeto_ = false; + } + + void HcalVetoResult::Print() const { + std::cout << "[ HcalVetoResult ]: Passes veto : " + << " Passes veto: " << passesVeto_ << std::endl; + maxPEHit_.Print(); + } +} From 10a2a7b64c10da7835983954d1b0f4268eab275c Mon Sep 17 00:00:00 2001 From: Omar Moreno Date: Tue, 15 Dec 2020 11:05:17 -0800 Subject: [PATCH 5/7] Let the setup_library macro find the event classes. --- CMakeLists.txt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 60ea1f9..f3b025f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,14 +18,10 @@ if(BUILD_EVENT_ONLY) register_event_object( module_path "Hcal/Event" namespace "ldmx" class "HcalVetoResult" ) register_event_object( module_path "Hcal/Event" namespace "ldmx" class "HcalHit" type "collection") - file(GLOB EVENT_SRC_FILES ${PROJECT_SOURCE_DIR}/src/Hcal/Event/*.cxx) - # Generate the files needed to build the event classes. setup_library(module Hcal name Event dependencies ROOT::Core Event::Event - # Event::Event SimCore::Event - sources ${EVENT_SRC_FILES} register_target) return() From 5ec50ef56728ddb4aabf3b419ecaa57602f246f8 Mon Sep 17 00:00:00 2001 From: Omar Moreno Date: Tue, 15 Dec 2020 14:44:36 -0800 Subject: [PATCH 6/7] Pass name of event bus and dictionary. --- CMakeLists.txt | 4 ++-- include/Hcal/Event/HcalHit.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f3b025f..1307eaa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ if(BUILD_EVENT_ONLY) # Generate the files needed to build the event classes. setup_library(module Hcal name Event - dependencies ROOT::Core Event::Event + dependencies ROOT::Core Recon::Event register_target) return() @@ -29,7 +29,7 @@ endif() setup_library(module Hcal dependencies ROOT::Physics - Framework::Framework Event::Event Tools::Tools DetDescr::DetDescr + Framework::Framework Recon::Event Tools::Tools DetDescr::DetDescr ) setup_python(package_name ${PYTHON_PACKAGE_NAME}/Hcal) diff --git a/include/Hcal/Event/HcalHit.h b/include/Hcal/Event/HcalHit.h index 86a3942..79aee85 100644 --- a/include/Hcal/Event/HcalHit.h +++ b/include/Hcal/Event/HcalHit.h @@ -8,7 +8,7 @@ #define HCAL_EVENT_HCALHIT_H_ // LDMX -#include "Event/CalorimeterHit.h" +#include "Recon/Event/CalorimeterHit.h" namespace ldmx { From 1465d720e39968e5fecf766f16dea19416552692 Mon Sep 17 00:00:00 2001 From: Omar Moreno Date: Wed, 16 Dec 2020 14:03:56 -0800 Subject: [PATCH 7/7] Remove call to setup_test macro. --- CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1307eaa..12b91c4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,5 +33,3 @@ setup_library(module Hcal ) setup_python(package_name ${PYTHON_PACKAGE_NAME}/Hcal) - -setup_test(dependencies Hcal::Hcal)