LDMX Software
HcalTriggerGeometry.cxx
1#include "Hcal/HcalTriggerGeometry.h"
2
3#include <iostream>
4#include <sstream>
5
9
10namespace hcal {
11
12HcalTriggerGeometry::HcalTriggerGeometry(const ldmx::HcalGeometry* hcalGeom)
13 : ConditionsObject(CONDITIONS_OBJECT_NAME), hcal_geometry_{hcalGeom} {}
14
15std::vector<ldmx::HcalDigiID> HcalTriggerGeometry::contentsOfQuad(
16 ldmx::HcalTriggerID triggerCell) const {
17 std::vector<ldmx::HcalDigiID> retval;
18 for (int i_strip = 0; i_strip < 4; i_strip++) {
19 int strip = i_strip + 4 * triggerCell.superstrip();
20 if (strip >= hcal_geometry_->getNumStrips(triggerCell.section())) break;
21 retval.push_back(ldmx::HcalDigiID(
22 triggerCell.section(), triggerCell.layer(), strip, triggerCell.end()));
23 }
24 return retval;
25}
26
27std::vector<ldmx::HcalDigiID> HcalTriggerGeometry::contentsOfSTQ(
28 ldmx::HcalTriggerID triggerCell) const {
29 std::vector<ldmx::HcalDigiID> retval;
30 for (int i_strip = 0; i_strip < 8; i_strip++) {
31 for (int i_layer = 0; i_layer < 2; i_layer++) {
32 int strip = i_strip + 8 * triggerCell.superstrip();
33 if (strip >= hcal_geometry_->getNumStrips(triggerCell.section()))
34 continue;
35 int tlayer = triggerCell.layer();
36 int player = 2 * (tlayer + i_strip) - tlayer % 2;
37 if (player >= hcal_geometry_->getNumLayers(triggerCell.section()))
38 continue;
39 retval.push_back(ldmx::HcalDigiID(triggerCell.section(), player, strip,
40 triggerCell.end()));
41 }
42 }
43 return retval;
44}
45
46ldmx::HcalTriggerID HcalTriggerGeometry::belongsToQuad(
47 ldmx::HcalDigiID precisionCell) const {
48 return ldmx::HcalTriggerID(precisionCell.section(), precisionCell.layer(),
49 precisionCell.strip() / 4, precisionCell.end());
50}
51
52ldmx::HcalTriggerID HcalTriggerGeometry::belongsToSTQ(
53 ldmx::HcalDigiID precisionCell) const {
54 // 2x2 groups of quads, with "superlayers" like:
55 // 0 1 0 1 2 3 2 3 ...
56 // V H V H V H V H ...
57 int layer = precisionCell.layer();
58 int superlayer = 2 * (layer / 4) + (layer % 4) % 2;
59 return ldmx::HcalTriggerID(precisionCell.section(), superlayer,
60 precisionCell.strip() / 8, precisionCell.end());
61}
62
64 public:
68 HcalTriggerGeometryProvider(const std::string& name,
69 const std::string& tagname,
70 const framework::config::Parameters& parameters,
71 framework::Process& process)
72 : ConditionsObjectProvider(HcalTriggerGeometry::CONDITIONS_OBJECT_NAME,
73 tagname, parameters, process),
74 hcal_trigger_geometry_{nullptr} {}
75
78 if (hcal_trigger_geometry_ != nullptr) delete hcal_trigger_geometry_;
79 hcal_trigger_geometry_ = nullptr;
80 }
81
88 virtual std::pair<const framework::ConditionsObject*,
91 if (hcal_trigger_geometry_ == nullptr) {
92 std::pair<const framework::ConditionsObject*, framework::ConditionsIOV>
93 cond_hcal_geom = requestParentCondition(
95 const ldmx::HcalGeometry* hcalgeom =
96 dynamic_cast<const ldmx::HcalGeometry*>(cond_hcal_geom.first);
97 hcal_trigger_geometry_ = new HcalTriggerGeometry(hcalgeom);
98 }
99 return std::make_pair(hcal_trigger_geometry_,
101 context.getRun(), context.getRun(), true, true));
102 }
103
109
110 private:
111 HcalTriggerGeometry* hcal_trigger_geometry_;
112};
113
114} // namespace hcal
Base class for provider of conditions information like pedestals, gains, electronics maps,...
#define DECLARE_CONDITIONS_PROVIDER(CLASS)
Macro which allows the framework to construct a producer given its name during configuration.
Class that provides header information about an event such as event number and timestamp.
Class that translates HCal ID into positions of strip hits.
be configured to load conditions objects from CSV files.
Class which defines the run/event/type range for which a given condition is valid,...
Base class for all providers of conditions objects.
Base class for all conditions objects, very simple.
Class which represents the process under execution.
Definition Process.h:36
Class encapsulating parameters for configuring a processor.
Definition Parameters.h:29
virtual ~HcalTriggerGeometryProvider()
Destructor.
virtual std::pair< const framework::ConditionsObject *, framework::ConditionsIOV > getCondition(const ldmx::EventHeader &context)
Provides access to the HcalGeometry or HcalTriggerGeometry.
virtual void releaseConditionsObject(const framework::ConditionsObject *co)
Take no action on release, as the object is permanently owned by the Provider.
HcalTriggerGeometryProvider(const std::string &name, const std::string &tagname, const framework::config::Parameters &parameters, framework::Process &process)
Class constructor.
defines the relationship between HCal strips and CMB quad trigger primitives and provides geometry in...
Provides header information an event such as event number and timestamp.
Definition EventHeader.h:44
int getRun() const
Return the run number.
Definition EventHeader.h:84
Extension of HcalAbstractID providing access to HCal digi information.
Definition HcalDigiID.h:13
int strip() const
Get the value of the 'strip' field from the ID.
Definition HcalDigiID.h:99
int section() const
Get the value of the 'section' field from the ID.
Definition HcalDigiID.h:75
int layer() const
Get the value of the layer field from the ID.
Definition HcalDigiID.h:81
int end() const
Get the value of the 'end' field from the ID.
Definition HcalDigiID.h:105
Implementation of HCal strip readout.
static constexpr const char * CONDITIONS_OBJECT_NAME
Conditions object: The name of the python configuration calling this class (Hcal/python/HcalGeometry....
Extension of DetectorID providing access to HCal trigger cell.
int superstrip() const
Get the value of the 'superstrip' field from the ID.
int end() const
Get the value of the 'end' field from the ID.
int layer() const
Get the value of the layer field from the ID.