LDMX Software
EcalSD.h
Go to the documentation of this file.
1
8#ifndef SIMCORE_ECALSD_H_
9#define SIMCORE_ECALSD_H_
10
11// LDMX
13#include "DetDescr/EcalID.h"
15#include "SimCore/G4User/TrackMap.h"
17#include "SimCore/SDs/SensitiveDetector.h"
18
19// Geant4
20// TODO: do we really need both the G4Polyhedron and G4Polyhedra includes?
21#include "G4Polyhedra.hh"
22#include "G4Polyhedron.hh"
23#include "G4Step.hh"
24#include "G4StepPoint.hh"
25#include "G4VSolid.hh"
26
27// ROOT
28#include "TMath.h"
29
30namespace simcore {
31
37class EcalSD : public SensitiveDetector {
38 public:
40 static const std::string COLLECTION_NAME;
41
48 EcalSD(const std::string& name, simcore::ConditionsInterface& ci,
50
54 virtual ~EcalSD() = default;
55
61 virtual bool isSensDet(G4LogicalVolume* vol) const override {
62 auto region = vol->GetRegion();
63 if (region and region->GetName().contains("CalorimeterRegion")) {
64 return vol->GetName().contains("Si");
65 }
66 return false;
67 }
68
74 G4bool ProcessHits(G4Step* aStep, G4TouchableHistory* ROhist) override;
75
79 virtual void saveHits(framework::Event& event) override;
80
84 virtual void onFinishedEvent() override { hits_.clear(); }
85
86 private:
88 std::map<ldmx::EcalID, ldmx::SimCalorimeterHit> hits_;
95};
96
97} // namespace simcore
98
99#endif
Class that translates raw positions of ECal module hits into cells in a hexagonal readout.
Class that defines an ECal detector ID with a cell number.
Class which stores simulated calorimeter hit information.
Class which implements the user tracking action.
Implements an event buffer system for storing event data.
Definition Event.h:42
Class encapsulating parameters for configuring a processor.
Definition Parameters.h:29
Handle to the conditions system, provided at construction to classes which require it.
ECal sensitive detector that uses an EcalHexReadout to create the hits_.
Definition EcalSD.h:37
static const std::string COLLECTION_NAME
Name of output collection of hits_.
Definition EcalSD.h:40
std::map< ldmx::EcalID, ldmx::SimCalorimeterHit > hits_
map of hits to add to the event (will be squashed)
Definition EcalSD.h:88
virtual void onFinishedEvent() override
Clear the map of hits we have accumulated.
Definition EcalSD.h:84
virtual bool isSensDet(G4LogicalVolume *vol) const override
Should the input volume be consider apart of this sensitive detector?
Definition EcalSD.h:61
EcalSD(const std::string &name, simcore::ConditionsInterface &ci, const framework::config::Parameters &p)
Class constructor.
Definition EcalSD.cxx:7
virtual void saveHits(framework::Event &event) override
Add our hits to the event bus.
Definition EcalSD.cxx:126
int max_origin_track_id_
maximum track ID to be considered an "origin"
Definition EcalSD.h:94
bool enable_hit_contribs_
enable hit contribs
Definition EcalSD.h:90
G4bool ProcessHits(G4Step *aStep, G4TouchableHistory *ROhist) override
Process steps to create hits_.
Definition EcalSD.cxx:15
bool compress_hit_contribs_
compress hit contribs
Definition EcalSD.h:92
virtual ~EcalSD()=default
Class destructor.
Dynamically loaded Geant4 SensitiveDetector for saving hits in specific volumes within the simulation...
Dynamically loadable photonuclear models either from SimCore or external libraries implementing this ...