HerdSoftware  0.3.2
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 = GetLineRange(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::GetLineRange(const Cluster &cluster,
54  const SiliconDetectorGeoParams &geoParams) {
55  RefFrame::Axis axis = RefFrame::ToAxis(geoParams.SegmentationDirections().second);
56 
57  // get ladder size and position
58  float elementSize = geoParams.WaferSize()[axis] * geoParams.NWafersPerLadder()[axis];
59  float elementPos = geoParams.LadderPosition(
60  geoParams.LadderIDFromStripID(cluster.Hits()[cluster.SeedHitIndex()].VolumeID()))[RefFrame::ToCoo(axis)];
61 
62  return {elementPos - 0.5 * elementSize, elementPos + 0.5 * elementSize};
63 }
64 
65 template <>
66 inline std::pair<float, float> HWTrackingDetectorEventDisplay::GetLineRange(const Cluster &cluster,
67  const FitGeoParams &geoParams) {
68  RefFrame::Axis axis = RefFrame::ToAxis(geoParams.SegmentationDirections().second);
69 
70  // get ladder size and position
71  float elementSize = geoParams.MatSize()[axis];
72  float elementPos = geoParams.MatPosition(
73  geoParams.MatIDFromChannelID(cluster.Hits()[cluster.SeedHitIndex()].VolumeID()))[RefFrame::ToCoo(axis)];
74 
75  return {elementPos - 0.5 * elementSize, elementPos + 0.5 * elementSize};
76 }
77 
78 } // namespace Herd
virtual std::pair< RefFrame::Direction, RefFrame::Direction > SegmentationDirections() const
Return the segmentation directions of the tracking elements.
Definition: TrackingDetectorGeoParams.h:111
CssGeoParams.h CssGeoParams class declaration.
Definition: CaloPDCalibrationAlgo.h:24
const std::vector< Hit > & Hits() const
Gets the hits forming the cluster.
Definition: Cluster.h:54
Tracker cluster object for transient data model.
Definition: Cluster.h:30
Data structure for single silicon layer geometry parameters.
Definition: FitGeoParams.h:64
ContainedClass & at(const RefFrame::Side &side)
Accesses an element with validity check on the element index.
Definition: SidesArray.h:107
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
Axis ToAxis(Coo coo)
Associates an axis to a coordinate .
Definition: RefFrame.h:191
Axis
Aliases for the axes. RefFrame.h common/RefFrame.h.
Definition: RefFrame.h:36
TEvePointSet * TrkHitsYZ
Definition: HWTrackingDetectorEventDisplay.h:33
size_t SeedHitIndex() const
Gets the index of the seed hit within the hits vector.
Definition: Cluster.h:71
Coo ToCoo(Axis axis)
Associates a coordinate to an axis.
Definition: RefFrame.h:182
TEvePointSet * TrkHitsXZ
Definition: HWTrackingDetectorEventDisplay.h:32
An array that accepts side as subscripts.
Definition: SidesArray.h:72
TEveStraightLineSet * TrkHits3D
Definition: HWTrackingDetectorEventDisplay.h:36
std::pair< float, float > GetLineRange(const Cluster &cl, const TrackingGeoParams &geoParams)
unsigned int LadderIDFromStripID(unsigned int stripID) const
Retrieves the volume ID of the ladder containing the strip with the given volumeID.
Definition: SiliconDetectorGeoParams.cpp:185
Point MatPosition(unsigned int matID) const
Get position of a given mat.
Definition: FitGeoParams.h:156
Data structure for single silicon layer geometry parameters.
Definition: SiliconDetectorGeoParams.h:34
constexpr std::array< Side, NSides > Sides
Array of all the sides.
Definition: RefFrame.h:123
void ImportClusters(const ClustersColl &clColl, const SidesArray< std::vector< TrackingGeoParams >> &geoParamsColl)
Definition: HWTrackingDetectorEventDisplay.hpp:6
const AxesArray< float > & MatSize() const
Get the dimensions of the single mat.
Definition: FitGeoParams.h:125
const AxesArray< float > & WaferSize() const
Get the dimensions of the single wafer.
Definition: SiliconDetectorGeoParams.h:105
const AxesArray< int > & NWafersPerLadder() const
Get the number of wafers that make up a ladder. This is intended as number of wafers along each direc...
Definition: SiliconDetectorGeoParams.h:90
TEvePointSet * TrkHitsXY
Definition: HWTrackingDetectorEventDisplay.h:34
Point LadderPosition(unsigned int ladderID) const
Get position of a given ladder.
Definition: SiliconDetectorGeoParams.cpp:173