|
||||
File indexing completed on 2024-11-15 09:35:26
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 // Author : F.Gaede 0011 // 0012 //========================================================================== 0013 #ifndef DDREC_CELLIDPOSITIONCONVERTER_H 0014 #define DDREC_CELLIDPOSITIONCONVERTER_H 0015 0016 #include "DD4hep/Detector.h" 0017 #include "DD4hep/Readout.h" 0018 #include "DD4hep/VolumeManager.h" 0019 0020 #include "DDSegmentation/Segmentation.h" 0021 0022 #include <set> 0023 #include <string> 0024 0025 0026 namespace dd4hep { 0027 namespace rec { 0028 0029 typedef DDSegmentation::CellID CellID; 0030 typedef DDSegmentation::VolumeID VolumeID; 0031 0032 /** Utility for position to cellID and cellID to position conversions. 0033 * (Correctly re-implements some of the functionality of the deprecated IDDecoder). 0034 * 0035 * @author F.Gaede, DESY 0036 * @date May 2017 0037 */ 0038 0039 class CellIDPositionConverter { 0040 #if defined(G__ROOT) 0041 CellIDPositionConverter() = default ; 0042 #else 0043 CellIDPositionConverter() = delete ; 0044 #endif 0045 CellIDPositionConverter(const CellIDPositionConverter&) = delete ; 0046 void operator=(const CellIDPositionConverter&) = delete ; 0047 0048 public: 0049 0050 /// The constructor - takes the main description object. 0051 CellIDPositionConverter(const Detector& description ) : _description( &description ) { 0052 _volumeManager = VolumeManager::getVolumeManager(description); 0053 } 0054 0055 /// Destructor 0056 virtual ~CellIDPositionConverter(){} ; 0057 0058 /** Return the nominal global position for a given cellID of a sensitive volume. 0059 * No Alignment corrections are applied. 0060 * If no sensitive volume is found, (0,0,0) is returned. 0061 */ 0062 Position positionNominal(const CellID& cellID) const; 0063 0064 /** Return the global position for a given cellID of a sensitive volume. 0065 * Alignment corrections are applied (TO BE DONE). 0066 * If no sensitive volume is found, (0,0,0) is returned. 0067 */ 0068 Position position(const CellID& cellID) const; 0069 0070 0071 /** Return the global cellID for the given global position. 0072 * Note: this call is rather slow - only use it when really needed ! 0073 * 0074 */ 0075 CellID cellID(const Position& global) const; 0076 0077 0078 0079 /** Find the context with DetElement, placements etc for a given cellID of a sensitive volume. 0080 * Returns NULL if not found (e.g. if the cellID does not correspond to a sensitive volume). 0081 */ 0082 const VolumeManagerContext* findContext(const CellID& cellID) const; 0083 0084 0085 0086 /** Find the DetElement that contains the given point - if no DetElement is found, an 0087 * invalid DetElement is returned. Uses the optionally given DetElement as start for the search. 0088 */ 0089 DetElement findDetElement(const Position& global, 0090 const DetElement& det=DetElement() ) const; 0091 0092 0093 /** Find the lowest daughter Placement in the given Placement that 0094 * contains the point (in the coordinate system of the mother placement). 0095 * Return the local coordinates in this daughter Placement and collect all volIDs 0096 * on the way. 0097 */ 0098 PlacedVolume findPlacement(const Position& point, const PlacedVolume& mother, double locPos[3], PlacedVolume::VolIDs& volIDs) const ; 0099 0100 0101 /** Find the readout object for the given DetElement. If the DetElement is sensitive the corresondig 0102 * Readout is returned, else a recursive search in the daughter volumes (nodes) of this DetElement's 0103 * volume is performed and the first Readout object is returned. 0104 * 0105 */ 0106 Readout findReadout(const DetElement& det) const ; 0107 0108 0109 /** Return this PlacedVolume's Readout or, if the volume is not sensitive, recursively search for 0110 * a Readout object in the daughter nodes (volumes). 0111 */ 0112 Readout findReadout(const PlacedVolume& pv) const ; 0113 0114 /** Returns the segmentation.cellDimensions. 0115 * 0116 */ 0117 std::vector<double> cellDimensions(const CellID& cell) const ; 0118 0119 protected: 0120 VolumeManager _volumeManager{} ; 0121 const Detector* _description ; 0122 0123 }; 0124 0125 } /* namespace rec */ 0126 } /* namespace dd4hep */ 0127 0128 0129 0130 0131 0132 0133 0134 #endif // DDREC_CELLIDPOSITIONCONVERTER_H
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |