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), hcalGeometry_{hcalGeom} {}
14
15std::vector<ldmx::HcalDigiID> HcalTriggerGeometry::contentsOfQuad(
16 ldmx::HcalTriggerID triggerCell) const {
17 std::vector<ldmx::HcalDigiID> retval;
18 for (int iStrip = 0; iStrip < 4; iStrip++) {
19 int strip = iStrip + 4 * triggerCell.superstrip();
20 if (strip >= hcalGeometry_->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 iStrip = 0; iStrip < 8; iStrip++) {
31 for (int iLayer = 0; iLayer < 2; iLayer++) {
32 int strip = iStrip + 8 * triggerCell.superstrip();
33 if (strip >= hcalGeometry_->getNumStrips(triggerCell.section())) continue;
34 int tlayer = triggerCell.layer();
35 int player = 2 * (tlayer + iStrip) - tlayer % 2;
36 if (player >= hcalGeometry_->getNumLayers(triggerCell.section()))
37 continue;
38 retval.push_back(ldmx::HcalDigiID(triggerCell.section(), player, strip,
39 triggerCell.end()));
40 }
41 }
42 return retval;
43}
44
45ldmx::HcalTriggerID HcalTriggerGeometry::belongsToQuad(
46 ldmx::HcalDigiID precisionCell) const {
47 return ldmx::HcalTriggerID(precisionCell.section(), precisionCell.layer(),
48 precisionCell.strip() / 4, precisionCell.end());
49}
50
51ldmx::HcalTriggerID HcalTriggerGeometry::belongsToSTQ(
52 ldmx::HcalDigiID precisionCell) const {
53 // 2x2 groups of quads, with "superlayers" like:
54 // 0 1 0 1 2 3 2 3 ...
55 // V H V H V H V H ...
56 int layer = precisionCell.layer();
57 int superlayer = 2 * (layer / 4) + (layer % 4) % 2;
58 return ldmx::HcalTriggerID(precisionCell.section(), superlayer,
59 precisionCell.strip() / 8, precisionCell.end());
60}
61
63 public:
67 HcalTriggerGeometryProvider(const std::string& name,
68 const std::string& tagname,
69 const framework::config::Parameters& parameters,
70 framework::Process& process)
71 : ConditionsObjectProvider(HcalTriggerGeometry::CONDITIONS_OBJECT_NAME,
72 tagname, parameters, process),
73 hcalTriggerGeometry_{nullptr} {}
74
77 if (hcalTriggerGeometry_ != nullptr) delete hcalTriggerGeometry_;
78 hcalTriggerGeometry_ = nullptr;
79 }
80
87 virtual std::pair<const framework::ConditionsObject*,
90 if (hcalTriggerGeometry_ == nullptr) {
91 std::pair<const framework::ConditionsObject*, framework::ConditionsIOV>
92 cond_hcal_geom = requestParentCondition(
94 const ldmx::HcalGeometry* hcalgeom =
95 dynamic_cast<const ldmx::HcalGeometry*>(cond_hcal_geom.first);
96 hcalTriggerGeometry_ = new HcalTriggerGeometry(hcalgeom);
97 }
98 return std::make_pair(hcalTriggerGeometry_,
100 context.getRun(), context.getRun(), true, true));
101 }
102
108
109 private:
110 HcalTriggerGeometry* hcalTriggerGeometry_;
111};
112
113} // namespace hcal
114DECLARE_CONDITIONS_PROVIDER_NS(hcal, HcalTriggerGeometryProvider);
Base class for provider of conditions information like pedestals, gains, electronics maps,...
#define DECLARE_CONDITIONS_PROVIDER_NS(NS, 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:27
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.