Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-11 07:52:11

0001 //==========================================================================
0002 //  AIDA Detector description implementation 
0003 //--------------------------------------------------------------------------
0004 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
0005 // All rights reserved.
0006 //
0007 // For the licensing terms see $DD4hepINSTALL/LICENSE.
0008 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
0009 //
0010 //  Created: Jun 28, 2013
0011 //  Author:  Christian Grefe, CERN
0012 //           David Blyth, ANL
0013 //
0014 //==========================================================================
0015 
0016 /// Framework include files
0017 #include <DDSegmentation/CartesianStripX.h>
0018 
0019 namespace dd4hep {
0020 namespace DDSegmentation {
0021 /// default constructor using an encoding string
0022 CartesianStripX::CartesianStripX(const std::string& cellEncoding) : CartesianStrip(cellEncoding) {
0023     // define type and description
0024     _type = "CartesianStripX";
0025     _description = "Cartesian segmentation on the local X axis";
0026 
0027     // register all necessary parameters
0028     registerParameter("strip_size_x", "Cell size in X", _stripSizeX, 1., SegmentationParameter::LengthUnit);
0029     registerParameter("offset_x", "Cell offset in X", _offsetX, 0., SegmentationParameter::LengthUnit, true);
0030     registerIdentifier("identifier_x", "Cell ID identifier for X", _xId, "strip");
0031 }
0032 
0033 /// Default constructor used by derived classes passing an existing decoder
0034 CartesianStripX::CartesianStripX(const BitFieldCoder* decode) : CartesianStrip(decode) {
0035     // define type and description
0036     _type = "CartesianStripX";
0037     _description = "Cartesian segmentation on the local X axis";
0038 
0039     // register all necessary parameters
0040     registerParameter("strip_size_x", "Cell size in X", _stripSizeX, 1., SegmentationParameter::LengthUnit);
0041     registerParameter("offset_x", "Cell offset in X", _offsetX, 0., SegmentationParameter::LengthUnit, true);
0042     registerIdentifier("identifier_x", "Cell ID identifier for X", _xId, "strip");
0043 }
0044 
0045 /// destructor
0046 CartesianStripX::~CartesianStripX() {}
0047 
0048 /// determine the position based on the cell ID
0049 Vector3D CartesianStripX::position(const CellID& cID) const {
0050     Vector3D cellPosition;
0051     cellPosition.X = binToPosition(_decoder->get(cID, _xId), _stripSizeX, _offsetX);
0052     return cellPosition;
0053 }
0054 
0055 /// determine the cell ID based on the position
0056 CellID CartesianStripX::cellID(const Vector3D& localPosition, const Vector3D& /* globalPosition */,
0057                                const VolumeID& vID) const {
0058     CellID cID = vID;
0059     _decoder->set(cID, _xId, positionToBin(localPosition.X, _stripSizeX, _offsetX));
0060     return cID;
0061 }
0062 
0063 std::vector<double> CartesianStripX::cellDimensions(const CellID&) const {
0064     return {_stripSizeX};
0065 }
0066 
0067 }  // namespace DDSegmentation
0068 } /* namespace dd4hep */