HerdSoftware  0.4.0
HWTrackingDetectorEventDisplay.hpp
Go to the documentation of this file.
2 
3 namespace Herd {
4 
5 template <class TrackingGeoParams>
7  const SidesArray<std::vector<TrackingGeoParams>> &geoParamsColl) {
8 
9  if (TrkHits3D)
10  TrkHits3D = new TEveStraightLineSet("Clusters");
11 
12  TrkHitsXY->Reset();
13  TrkHitsXZ->Reset();
14  TrkHitsYZ->Reset();
15 
16  TEvePointSet *TrkHits = nullptr;
17 
18  for (auto side : RefFrame::Sides) {
19  auto &sideColl = clColl.at(side);
20 
21  for (size_t iLayer = 0; iLayer < sideColl.size(); iLayer++) {
22  auto geoParams = geoParamsColl.at(side).at(iLayer);
23 
24  if (RefFrame::ToAxis(geoParams.NormalDirection()) != RefFrame::Axis::Y &&
25  RefFrame::ToAxis(geoParams.SegmentationDirections().first) != RefFrame::Axis::Y) {
26  TrkHits = TrkHitsXZ;
27  } else if (RefFrame::ToAxis(geoParams.NormalDirection()) != RefFrame::Axis::X &&
28  RefFrame::ToAxis(geoParams.SegmentationDirections().first) != RefFrame::Axis::X) {
29  TrkHits = TrkHitsYZ;
30  } else if (RefFrame::ToAxis(geoParams.NormalDirection()) != RefFrame::Axis::Z &&
31  RefFrame::ToAxis(geoParams.SegmentationDirections().first) != RefFrame::Axis::Z) {
32  TrkHits = TrkHitsXY;
33  }
34 
35  for (auto &cluster : sideColl.at(iLayer)) {
36  auto longitudinalRange = LineRange(cluster, geoParams);
37  auto clusterPos = cluster.COGPosition(geoParams);
38  TrkHits->SetNextPoint(clusterPos[RefFrame::Coo::X], clusterPos[RefFrame::Coo::Y], clusterPos[RefFrame::Coo::Z]);
39 
40  auto lineStart = clusterPos, lineEnd = clusterPos;
41  lineStart[RefFrame::ToCoo(geoParams.SegmentationDirections().second)] = longitudinalRange.first;
42  lineEnd[RefFrame::ToCoo(geoParams.SegmentationDirections().second)] = longitudinalRange.second;
43  TrkHits3D->AddLine(lineStart[RefFrame::Coo::X], lineStart[RefFrame::Coo::Y], lineStart[RefFrame::Coo::Z],
44  lineEnd[RefFrame::Coo::X], lineEnd[RefFrame::Coo::Y], lineEnd[RefFrame::Coo::Z]);
45  }
46  }
47  }
48 
49  return;
50 }
51 
52 template <>
53 inline std::pair<float, float> HWTrackingDetectorEventDisplay::LineRange(const Cluster &cluster,
54  const ScdGeoParams &geoParams) {
55  RefFrame::Axis axis = RefFrame::ToAxis(geoParams.SegmentationDirections().second);
56 
57  // get ladder size and position
58  float elementSize =
59  geoParams.WaferSize()[axis] *
60  (geoParams.LadderBonding() == ScdGeoParams::BondingType::NONE ? 1 : geoParams.NWafersPerBondedLadder()[axis]);
61  float elementPos = geoParams.LadderPosition(
62  geoParams.LadderIDFromStripID(cluster.Hits()[cluster.SeedHitIndex()].VolumeID()))[RefFrame::ToCoo(axis)];
63 
64  return {elementPos - 0.5 * elementSize, elementPos + 0.5 * elementSize};
65 }
66 
67 template <>
68 inline std::pair<float, float> HWTrackingDetectorEventDisplay::LineRange(const Cluster &cluster,
69  const FitGeoParams &geoParams) {
70  RefFrame::Axis axis = RefFrame::ToAxis(geoParams.SegmentationDirections().second);
71 
72  // get ladder size and position
73  float elementSize = geoParams.MatSize()[axis];
74  float elementPos = geoParams.MatPosition(
75  geoParams.MatIDFromChannelID(cluster.Hits()[cluster.SeedHitIndex()].VolumeID()))[RefFrame::ToCoo(axis)];
76 
77  return {elementPos - 0.5 * elementSize, elementPos + 0.5 * elementSize};
78 }
79 
80 } // namespace Herd
Herd::FitGeoParams::MatPosition
Point MatPosition(unsigned int matID) const
Get position of a given mat.
Definition: FitGeoParams.h:174
Herd::RefFrame::Coo::Y
@ Y
Herd::RefFrame::Coo::X
@ X
Herd::Cluster::SeedHitIndex
size_t SeedHitIndex() const
Gets the index of the seed hit within the hits vector.
Definition: Cluster.h:77
Herd::RefFrame::Sides
constexpr std::array< Side, NSides > Sides
Array of all the sides.
Definition: RefFrame.h:121
Herd::RefFrame::Axis::X
@ X
Herd::ScdGeoParams::NWafersPerBondedLadder
const AxesArray< int > & NWafersPerBondedLadder() const
Get the number of wafers that make up a ladder.
Definition: ScdGeoParams.h:136
Herd::Cluster
Tracker cluster object for transient data model.
Definition: Cluster.h:30
Herd::HWTrackingDetectorEventDisplay::TrkHitsXY
TEvePointSet * TrkHitsXY
Definition: HWTrackingDetectorEventDisplay.h:34
Herd::TrackingDetectorGeoParams::SegmentationDirections
virtual std::pair< RefFrame::Direction, RefFrame::Direction > SegmentationDirections() const
Return the segmentation directions of the tracking elements.
Definition: TrackingDetectorGeoParams.h:114
Herd
CssGeoParams.h CssGeoParams class declaration.
Definition: CaloPDCalibrationAlgo.h:22
Herd::ScdGeoParams::LadderPosition
Point LadderPosition(unsigned int ladderID) const
Get position of a given ladder.
Definition: ScdGeoParams.cpp:186
Herd::RefFrame::Axis::Y
@ Y
Herd::RefFrame::ToCoo
constexpr Coo ToCoo(Axis axis)
Associates a coordinate to an axis.
Definition: RefFrame.h:180
Herd::HWTrackingDetectorEventDisplay::TrkHitsXZ
TEvePointSet * TrkHitsXZ
Definition: HWTrackingDetectorEventDisplay.h:32
Herd::ScdGeoParams::LadderBonding
BondingType LadderBonding() const
Definition: ScdGeoParams.h:344
Herd::FitGeoParams
Data structure for single silicon layer geometry parameters.
Definition: FitGeoParams.h:66
Herd::Cluster::Hits
const std::vector< Hit > & Hits() const
Gets the hits forming the cluster.
Definition: Cluster.h:56
Herd::RefFrame::Axis::Z
@ Z
Herd::RefFrame::Coo::Z
@ Z
Herd::ScdGeoParams::LadderIDFromStripID
unsigned int LadderIDFromStripID(unsigned int stripID) const
Retrieves the volume ID of the ladder containing the strip with the given volumeID.
Definition: ScdGeoParams.cpp:191
HWTrackingDetectorEventDisplay.h
Herd::RefFrame::Axis
Axis
Aliases for the axes.
Definition: RefFrame.h:34
Herd::RefFrame::ToAxis
constexpr Axis ToAxis(Coo coo)
Associates an axis to a coordinate .
Definition: RefFrame.h:189
Herd::HWTrackingDetectorEventDisplay::TrkHitsYZ
TEvePointSet * TrkHitsYZ
Definition: HWTrackingDetectorEventDisplay.h:33
Herd::FitGeoParams::MatIDFromChannelID
unsigned int MatIDFromChannelID(unsigned int channelID) const
Retrieves the volume ID of the mat containing the sipm with the given channelID.
Definition: FitGeoParams.cpp:34
Herd::SidesArray::at
ContainedClass & at(const RefFrame::Side &side)
Accesses an element with validity check on the element index.
Definition: SidesArray.h:107
Herd::HWTrackingDetectorEventDisplay::TrkHits3D
TEveStraightLineSet * TrkHits3D
Definition: HWTrackingDetectorEventDisplay.h:36
Herd::ScdGeoParams::BondingType::NONE
@ NONE
Herd::HWTrackingDetectorEventDisplay::ImportClusters
void ImportClusters(const ClustersColl &clColl, const SidesArray< std::vector< TrackingGeoParams >> &geoParamsColl)
Definition: HWTrackingDetectorEventDisplay.hpp:6
Herd::FitGeoParams::MatSize
const AxesArray< float > & MatSize() const
Get the dimensions of the single mat.
Definition: FitGeoParams.h:135
Herd::HWTrackingDetectorEventDisplay::LineRange
std::pair< float, float > LineRange([[maybe_unused]] const Cluster &cl, [[maybe_unused]] const TrackingGeoParams &geoParams)=delete
Herd::ScdGeoParams
Data structure for single silicon layer geometry parameters.
Definition: ScdGeoParams.h:35
Herd::SidesArray
An array that accepts side as subscripts.
Definition: SidesArray.h:72
Herd::ScdGeoParams::WaferSize
const AxesArray< float > & WaferSize() const
Get the dimensions of the single wafer.
Definition: ScdGeoParams.h:179