Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:09:11

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2016-2020 CERN for the benefit of the Acts project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include "Acts/Definitions/Algebra.hpp"
0012 namespace Acts {
0013 
0014 /// @brief pair of ints for definition of a cell
0015 struct DigitizationCell final {
0016   // identification and data
0017   std::size_t channel0 = 0;
0018   std::size_t channel1 = 1;
0019   float data = 0.;
0020 
0021   // construct them
0022   DigitizationCell(std::size_t ch0, std::size_t ch1, float d = 0.)
0023       : channel0(ch0), channel1(ch1), data(d) {}
0024 
0025   /// To merge cells in case they are at the same position
0026   /// @param dc the cell to be added to the current cell
0027   /// @param analogueReadout flag indicating if we have analogue readout
0028   /// @note this function is needed because possible derived classes may
0029   /// calculate the energy deposit differently. Furthermore this allows to apply
0030   /// an energy cut, because the energy deposit can also be stored for digital
0031   /// readout.
0032   void addCell(const DigitizationCell& dc, bool analogueReadout) {
0033     if (analogueReadout) {
0034       data += dc.data;
0035     }
0036   }
0037 
0038   /// the deposited energy
0039   /// @note this function is needed because possible derived classes may
0040   /// calculate the energy deposit differently. Furthermore this allows to apply
0041   /// an energy cut, because the energy deposit can also be stored for digital
0042   /// readout.
0043   double depositedEnergy() const { return data; }
0044 };
0045 
0046 /// @brief DigitizationStep for further handling
0047 struct DigitizationStep final {
0048   double stepLength{0.};   /// this is the path length within the cell
0049   double driftLength{0.};  /// this is the path length of the setp center to the
0050                            /// readout surface
0051   DigitizationCell stepCell;     /// this is the cell identifier of the segment
0052   Vector3 stepEntry;             /// this is the Entry point into the segment
0053   Vector3 stepExit;              /// this is the Exit point from the segment
0054   Vector2 stepReadoutProjected;  /// this is the projected position at the
0055                                  /// readout surface
0056   Vector2 stepCellCenter;        /// this is the cell position
0057 
0058   /// Standard constructor
0059   DigitizationStep()
0060       : stepCell(0, 0),
0061         stepEntry(0., 0., 0.),
0062         stepExit(0., 0., 0.),
0063         stepReadoutProjected(0., 0.),
0064         stepCellCenter(0., 0.) {}
0065 
0066   /// Constructor with arguments
0067   ///
0068   /// @param sl step length of this step
0069   /// @param dl drift length of this step
0070   /// @param dc is the digitization zell (with indices)
0071   /// @param entryP is the entry position into the cell
0072   /// @param exitP is the exit position from the cell
0073   /// @param projectedPosition is the position on the readout surface
0074   /// @param cellPosition is the nominal position of the cell
0075   DigitizationStep(double sl, double dl, const DigitizationCell& dc,
0076                    const Vector3& entryP, const Vector3& exitP,
0077                    const Vector2& projectedPosition,
0078                    const Vector2& cellPosition)
0079       : stepLength(sl),
0080         driftLength(dl),
0081         stepCell(dc),
0082         stepEntry(entryP),
0083         stepExit(exitP),
0084         stepReadoutProjected(projectedPosition),
0085         stepCellCenter(cellPosition) {}
0086 };
0087 
0088 }  // namespace Acts