ATLAS Offline Software
PadOfflineData.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
6 //Local includes
12 #include "TVector3.h"
13 
14 #include <math.h>
15 
16 namespace NSWL1 {
17 
19  PadData(),
20  m_id(id),m_detMgr(detMgr),m_time(time),m_bc_tag(bc_tag)
21  {
22  }
23 
25  // PaddOfflineData doesn't own the helper, so nothing to do here
26  }
27 
32  float PadOfflineData::time() const { return m_time; }
33 
35  int PadOfflineData::sideId() const {
36  if (m_detMgr) return (m_detMgr->stgcIdHelper()->stationEta(m_id)<0)? 0 : 1;
37  return -1;
38  }
39 
41  if (m_detMgr) return std::abs(m_detMgr->stgcIdHelper()->stationEta(m_id));
42  return -1;
43  }
44 
46  if(m_detMgr) { return m_detMgr->stgcIdHelper()->stationPhi(m_id); }
47  return -1;
48  }
49 
51  if(m_detMgr) { return m_detMgr->stgcIdHelper()->isSmall(m_id) ? 0 : 1; }
52  return -1;
53  }
54 
56  if (m_detMgr) return m_detMgr->stgcIdHelper()->multilayer(m_id);
57  return -1;
58  }
59 
61  if (m_detMgr) return m_detMgr->stgcIdHelper()->gasGap(m_id);
62  return -1;
63  }
64 
66  if (m_detMgr) return m_detMgr->stgcIdHelper()->channel(m_id);
67  return -1;
68  }
69 
71  if (m_detMgr) return m_detMgr->stgcIdHelper()->padEta(m_id);
72  return -1;
73  }
74 
76  if (m_detMgr) return m_detMgr->stgcIdHelper()->padPhi(m_id);
77  return -1;
78  }
79 
81  float phiAngle=-999;
82  switch( this->sectorType() ){
83 
84  case(0)://S
85  phiAngle=(2*this->sectorId()-1 )*(M_PI/8);
86  break;
87 
88  case(1)://L
89  phiAngle=(this->sectorId()-1)*(M_PI/4);
90  break;
91 
92  default:
93  break;
94  }
95 
96  if(phiAngle > M_PI) phiAngle-=2*M_PI;
97 
98  return phiAngle;
99  }
100 
101  int PadOfflineData::padNumber() const {//pad numbers from Y.R
102  if(m_detMgr == nullptr ) return nullPadNumber;
103  int modId=moduleId();//id to use pad encoding {1,2,3}/S {4,5,6} L
104  if(sectorType() ==1) modId+=3;
105  return 1000*modId+(padPhiId()-1)*18+padEtaId();
106  }
108  if(m_detMgr == nullptr ) return -1;
109  if(this->sectorType() == 0 ){//S
110  return this->sectorId()*2;
111  }
112  else{//L
113  return 2*this->sectorId()-1;
114  }
115  }
116 
118  if (m_detMgr ==nullptr) return;
120  const Trk::PlaneSurface &surface = rdoEl->surface(this->Identity());
121  std::array<Amg::Vector2D, 4> local_pad_corners{make_array<Amg::Vector2D, 4>(Amg::Vector2D::Zero())};
122  //From MuonPadDesign... read pad local corners
123  bool check=rdoEl->padCorners(this->Identity(),local_pad_corners);
124  if(! check ){
125  std::cout<<"Unable to get pad corners!"<<std::endl;
126  return;
127  }
128  Amg::Vector3D pad_corner_global{Amg::Vector3D::Zero()};
129  for(unsigned int i=0; i<4; i++) {
130  surface.localToGlobal(local_pad_corners.at(i), pad_corner_global, pad_corner_global);
131  this->m_cornerXyz[i][0] = pad_corner_global.x();
132  this->m_cornerXyz[i][1] = pad_corner_global.y();
133  this->m_cornerXyz[i][2] = pad_corner_global.z();
134  }
135  return;
136  }
137 
138 
139 }
MuonGM::sTgcReadoutElement::padCorners
bool padCorners(const Identifier &id, std::array< Amg::Vector2D, 4 > &corners) const
pad corners
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/sTgcReadoutElement.h:358
sTgcIdHelper::multilayer
int multilayer(const Identifier &id) const
Definition: sTgcIdHelper.cxx:1017
tdr_compat_enum.h
NSWL1::PadOfflineData::padNumber
int padNumber() const
Definition: PadOfflineData.cxx:101
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
sTgcReadoutElement.h
NSWL1::PadOfflineData::moduleId
int moduleId() const
get the physics module (ranging from 1 at lowest R to 3 at highest R)
Definition: PadOfflineData.cxx:40
M_PI
#define M_PI
Definition: ActiveFraction.h:11
NSWL1::PadOfflineData::stationPhiAngle
float stationPhiAngle() const
Definition: PadOfflineData.cxx:80
Identifier::get_identifier32
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
NSWL1::PadData
abstract class to interface the data hit fragment output from the Pad TDS
Definition: PadData.h:30
NSWL1::PadOfflineData::sectorType
int sectorType() const
get the sector type (ranging from 0 to 1, Small and Large)
Definition: PadOfflineData.cxx:50
MuonGM::MuonClusterReadoutElement::surface
virtual const Trk::PlaneSurface & surface() const override
access to chamber surface (phi orientation), uses the first gas gap
Definition: MuonClusterReadoutElement.h:123
Identifier32::get_compact
value_type get_compact() const
Get the compact id.
Definition: Identifier32.h:44
NSWL1::PadOfflineData::m_detMgr
const MuonGM::MuonDetectorManager * m_detMgr
Definition: PadOfflineData.h:40
NSWL1::PadOfflineData::padEtaId
int padEtaId() const
get the pad eta channel
Definition: PadOfflineData.cxx:70
MuonIdHelper::isSmall
bool isSmall(const Identifier &id) const
Definition: MuonIdHelper.cxx:831
sTGCenumeration.h
NSWL1::PadOfflineData::PadOfflineData
PadOfflineData(Identifier id, float time, uint16_t bc_tag, const MuonGM::MuonDetectorManager *detMgr)
Definition: PadOfflineData.cxx:18
sTgcIdHelper::channel
int channel(const Identifier &id) const override
Definition: sTgcIdHelper.cxx:1027
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:93
lumiFormat.i
int i
Definition: lumiFormat.py:85
MuonGM::sTgcReadoutElement
An sTgcReadoutElement corresponds to a single STGC module; therefore typicaly a barrel muon station c...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/sTgcReadoutElement.h:30
NSWL1::PadOfflineData::Identity
Identifier Identity() const
methods for retrieving the bare data
Definition: PadOfflineData.cxx:30
sTgcIdHelper::gasGap
int gasGap(const Identifier &id) const override
get the hashes
Definition: sTgcIdHelper.cxx:1020
MuonGM::MuonDetectorManager::stgcIdHelper
const sTgcIdHelper * stgcIdHelper() const
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h:241
NSWL1::PadOfflineData::channelId
int channelId() const
get the channel
Definition: PadOfflineData.cxx:65
NSWL1::PadOfflineData::m_time
float m_time
signal arrival time after electronics delay is applied
Definition: PadOfflineData.h:41
NSWL1::nullPadNumber
const int nullPadNumber
Definition: tdr_compat_enum.h:21
NSWL1::PadOfflineData::triggerSectorNumber
int triggerSectorNumber() const
Definition: PadOfflineData.cxx:107
NSWL1::PadOfflineData::padPhiId
int padPhiId() const
get the pad phi channel
Definition: PadOfflineData.cxx:75
MuonIdHelper::stationPhi
int stationPhi(const Identifier &id) const
Definition: MuonIdHelper.cxx:810
NSWL1::PadOfflineData::id
uint32_t id() const
get the 32 bit word identifing the fragment
Definition: PadOfflineData.cxx:29
NSWL1::PadOfflineData::sideId
int sideId() const
helper methods decoding the hit fragment position within the NSW detector
Definition: PadOfflineData.cxx:35
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:227
NSWL1::PadOfflineData::multipletId
int multipletId() const
get the multiplet (ranging from 1 to 2, 1 is at lowest |z|)
Definition: PadOfflineData.cxx:55
PadOfflineData.h
MuonIdHelper::stationEta
int stationEta(const Identifier &id) const
Definition: MuonIdHelper.cxx:805
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
LArNewCalib_Delay_OFC_Cali.check
check
Definition: LArNewCalib_Delay_OFC_Cali.py:267
NSWL1::PadOfflineData::m_cornerXyz
float m_cornerXyz[4][3]
Definition: PadOfflineData.h:73
sTgcIdHelper::padPhi
int padPhi(const Identifier &id) const
Definition: sTgcIdHelper.cxx:679
NSWL1::PadOfflineData::m_bc_tag
uint16_t m_bc_tag
BC Tag.
Definition: PadOfflineData.h:42
NSWL1::PadOfflineData::time
float time() const
get the arrival time after the delay is applied
Definition: PadOfflineData.cxx:32
MuonGM::MuonDetectorManager
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h:50
Trk::PlaneSurface
Definition: PlaneSurface.h:64
PlaneSurface.h
NSWL1::PadOfflineData::m_id
const Identifier m_id
offline identifier of the PAD hit
Definition: PadOfflineData.h:39
sTgcIdHelper::padEta
int padEta(const Identifier &id) const
Definition: sTgcIdHelper.cxx:669
MuonGM::MuonDetectorManager::getsTgcReadoutElement
const sTgcReadoutElement * getsTgcReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
Definition: MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx:259
NSWL1::PadOfflineData::gasGapId
int gasGapId() const
get the gas gap (ranging from 1 to 4, 1 is at lowest |z|)
Definition: PadOfflineData.cxx:60
NSWL1::PadOfflineData::sectorId
int sectorId() const
get the sector (ranging from 1 to 8)
Definition: PadOfflineData.cxx:45
NSWL1::PadOfflineData::BC_Tag
uint16_t BC_Tag() const
get the BCID
Definition: PadOfflineData.cxx:31
Trk::PlaneSurface::localToGlobal
virtual void localToGlobal(const Amg::Vector2D &locp, const Amg::Vector3D &mom, Amg::Vector3D &glob) const override final
Specified for PlaneSurface: LocalToGlobal method without dynamic memory allocation.
Definition: PlaneSurface.cxx:204
NSWL1::PadOfflineData::~PadOfflineData
~PadOfflineData()
Definition: PadOfflineData.cxx:24
NSWL1
A trigger trigger candidate for a stgc sector.
Definition: NSWL1Simulation.cxx:9
generate::Zero
void Zero(TH1D *hin)
Definition: generate.cxx:32
NSWL1::PadOfflineData::fillGeometricInformation
void fillGeometricInformation()
Definition: PadOfflineData.cxx:117
Identifier
Definition: IdentifierFieldParser.cxx:14