#ifndef TStrawTrkWireManager_hxx #define TStrawTrkWireManager_hxx #include #include #include class TGeoManager; class TGeoNode; namespace COMET { class IStrawTrkWireManager; class IStrawTrkWireInfo; class IGeometryId; class IChannelId; } /// Contains information of a straw tube (wire) geometry class COMET::IStrawTrkWireInfo { public: IStrawTrkWireInfo(); virtual ~IStrawTrkWireInfo(); public: int GetNodeId() const {return fNodeId;} int GetSequenceId() const {return fSequenceId;} int GetStationId() const {return fStationId;} int GetManifoldId() const {return fManifoldId;} int GetStrawId() const {return fStrawId;} double GetLength() const {return fLength;} TVector3 GetPosition() const {return fPosition;} TVector3 GetEnd0Pos() const {return fEnd0Pos;} TVector3 GetEnd1Pos() const {return fEnd1Pos;} bool GetDirectionIsY() const {return fDirectionIsY;} int GetGlobalLayerId() const {return fGlobalLayerId;} int GetGlobalSubLayerId() const {return fGlobalSubLayerId;} void SetNodeId (const int nodeId) {fNodeId = nodeId;} void SetSequenceId (const int sequenceId) {fSequenceId = sequenceId;} void SetStationId (const int stationId) {fStationId = stationId;} void SetManifoldId (const int manifoldId) {fManifoldId = manifoldId;} void SetStrawId (const int strawId) {fStrawId = strawId;} void SetLength (const double length) {fLength = length;} void SetPosition (const TVector3& position){fPosition = position;} void SetEnd0Pos (const TVector3& end0) {fEnd0Pos = end0;} void SetEnd1Pos (const TVector3& end1) {fEnd1Pos = end1;} void SetDirectionIsY (const bool set) {fDirectionIsY = set;} void SetGlobalLayerId (const int glayerId) {fGlobalLayerId = glayerId;} void SetGlobalSubLayerId(const int gsublayerId) {fGlobalSubLayerId = gsublayerId;} private: int fNodeId; int fSequenceId; int fStationId; int fManifoldId; int fStrawId; double fLength; TVector3 fPosition; TVector3 fEnd0Pos; TVector3 fEnd1Pos; bool fDirectionIsY; ///< If not, direction is X or Z depending on the Phase-I or Phase-II int fGlobalLayerId; int fGlobalSubLayerId; }; // ----------------------------------------------------------------------------------------------------------- /// Managing all the straw tracker information class COMET::IStrawTrkWireManager { public: typedef std::vector < std::vector < std::vector > > INodeIdMap; typedef std::vector IWireInfoContainer; typedef std::map ISequenceIdMap; private: int fNumberOfChannels; int fNumberOfStations; int fNumberOfManifolds; int fNumberOfSubLayers; int fNumberOfStraws; /// The manifold ID located on -Z size in the detector solenoid coordinates. int fManifoldIdOfFrontLayer; /// Center position Z in the detector solenoid coordinates of each station std::vector fStationPositionZInDS; /// Center position Z in the detector solenoid coordinates of each global layer std::vector fGlobalLayerPositionZInDS; /// Direction flag (is Y) of each global layer std::vector fGlobalLayerDirectionIsY; /// Center position Z in the detector solenoid coordinates of each global sublayer /// because every layer has two sub layers, which is utilized in tracking std::vector fGlobalSubLayerPositionZInDS; /// Direction flag (is Y) of each global sublayer std::vector fGlobalSubLayerDirectionIsY; std::vector fGlobalSubLayerId2GlobalLayerId; std::vector fGlobalLayerId2StationId; INodeIdMap fNodeIdMap; IWireInfoContainer fStrawTrkInfo; ISequenceIdMap fSequenceIdMap; ///< Map of (NodeId, SequenceId) public: IStrawTrkWireManager(); virtual ~IStrawTrkWireManager(); /// Initialise the straw configuration (number of stations, manifolds, and straws, and wire position in straw) /// from the ROOT geometry and geometry id. int Init(const INodeIdMap& strawTrkMap); int GetSequenceIdFromStrawTrk (const int& station, const int& manifold, const int& straw) const; int GetSequenceIdFromGlobalPosition (const TVector3& global) const; int GetSequenceIdFromGlobalPosition (const double* global) const; int GetSequenceIdFromNodeId (const int& nodeId) const; int GetSequenceIdFromChannelId (const IChannelId& chanId) const; int GetSequenceIdFromGeomId (const IGeometryId& geomId) const; int GetStationIdFromSequenceId (const int& sequenceId) const; int GetManifoldIdFromSequenceId (const int& sequenceId) const; int GetStrawIdFromSequenceId (const int& sequenceId) const; int GetGlobalLayerIdFromSequenceId (const int& sequenceId) const; int GetGlobalSubLayerIdFromSequenceId(const int& sequenceId) const; bool IsValid(int sequenceId) const; int GetStationIdFromGlobalLayerId (const int glayerId) const; int GetStationIdFromGlobalSubLayerId (const int gsublayerId) const; int GetGlobalLayerIdFromGlobalSubLayerId(const int gsublayerId) const; TVector3 GetWirePosition (const IGeometryId& id) const; TVector3 GetWirePosition (const int& station, const int& manifold, const int& straw) const; TVector3 GetWireEnd0 (const int& station, const int& manifold, const int& straw) const; TVector3 GetWireEnd1 (const int& station, const int& manifold, const int& straw) const; bool GetWireDirectionIsY(const int& station, const int& manifold, const int& straw) const; Double_t GetGlobalLayerPositionZInDS (const int& station, const int& manifold) const; Double_t GetGlobalSubLayerPositionZInDS(const int& station, const int& manifold, const int& straw) const; TVector3 GetWirePosition (int sequenceId) const; TVector3 GetWireEnd0 (int sequenceId) const; TVector3 GetWireEnd1 (int sequenceId) const; bool GetWireDirectionIsY(int sequenceId) const; Double_t GetStationPositionZInDS (int sequenceId) const; Double_t GetGlobalLayerPositionZInDS (int sequenceId) const; Double_t GetGlobalSubLayerPositionZInDS(int sequenceId) const; Double_t GetStationPositionZInDSFromStationId (int stationId) const; Double_t GetGlobalLayerPositionZInDSFromGlobalLayerId (int glayerId) const; bool GetGlobalLayerDirectionIsYFromGlobalLayerId (int glayerId) const; Double_t GetGlobalSubLayerPositionZInDSFromGlobalSubLayerId(int gsublayerId) const; bool GetGlobalSubLayerDirectionIsYFromGlobalSubLayerId (int gsublayerId) const; double GetDistanceFromWire (const TVector3& global) const; double GetDistanceFromWire (int sequenceId, const TVector3& global) const; TVector3 GetLocalPosition (int sequenceId, const TVector3& global) const; TVector3 GetLocalVector (int sequenceId, const TVector3& globalvec) const; int GetStationIdFromGeomId (const IGeometryId& id) const; int GetManifoldIdFromGeomId (const IGeometryId& id) const; int GetStrawIdFromGeomId (const IGeometryId& id) const; int GetGlobalLayerIdFromGeomId (const IGeometryId& id) const; int GetGlobalSubLayerIdFromGeomId(const IGeometryId& id) const; int GetNumberOfChannels () const {return fNumberOfChannels;} int GetNumberOfStations () const {return fNumberOfStations;} int GetNumberOfManifolds () const {return fNumberOfManifolds;} int GetNumberOfStraws () const {return fNumberOfStraws;} int GetManifoldIdOfFrontLayer () const {return fManifoldIdOfFrontLayer;} int GetNumberOfGlobalLayers () const {return (int)fGlobalLayerPositionZInDS.size(); } int GetNumberOfGlobalSubLayers() const {return (int)fGlobalSubLayerPositionZInDS.size(); } bool SetNodeIdMap (const INodeIdMap& nodeMap); private: /// Make the copy constructor private. IStrawTrkWireManager(const IStrawTrkWireManager&) {MayNotUse("Copy Constructor");} /// return the WireInfo @ `wire` const COMET::IStrawTrkWireInfo& GetStrawTrkInfo (int sequenceId) const {return fStrawTrkInfo[sequenceId];}; }; #endif