ATLAS Offline Software
MMT_Hit.cxx
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3  */
4 
11 #include <cmath>
12 
13 MMT_Hit::MMT_Hit(const hitData_entry &entry, const MuonGM::MuonDetectorManager* detManager, const std::shared_ptr<MMT_Parameters> par, const std::vector<ROOT::Math::XYZVector> &planeCoordinates) {
14  m_sector = par->getSector();
15 
16  std::string module(1, m_sector);
17  module += (std::abs(entry.station_eta) == 1) ? "M1" : "M2";
18  m_module = module;
19 
20  m_station_name = "MM";
22  m_VMM_chip = entry.VMM_chip;
23  m_MMFE_VMM = entry.MMFE_VMM;
24  m_ART_ASIC = std::ceil(1.*entry.MMFE_VMM/2);
25  m_station_eta = entry.station_eta;
26  m_station_phi = entry.station_phi;
27  m_multiplet = entry.multiplet;
28  m_gasgap = entry.gasgap;
29  m_plane = entry.plane;
30  m_strip = entry.strip;
31  m_localX = entry.localX;
32  m_BC_time = entry.BC_time;
33  m_age = entry.BC_time;
34  m_Y = -1.;
35  m_Z = -1.;
36  m_R = -1.;
37  m_Rp = -1.;
38  m_isNoise = false;
39  m_time = entry.gtime;
40  m_RZslope = -1.;
41  m_YZslope = -1.;
42  m_PitchOverZ = -1.;
43  m_shift = -1.;
44 
45  if(m_strip > 8191 || m_strip<0){
46  m_strip = 0;
47  }
48  int istrip = (std::abs(m_station_eta)-1) * (64*8*10) + m_strip; //here needed the absolute index of the strip on the sector layer (m_strip is only up to 5119)
49 
50  // region represent the index of the mmfe8 in the plane
51  int region = int(float(istrip)/(64*8));
52  // map of mmfe8s layer,radius(MMFE8 index on sector)
53  unsigned int mmfe8s[8][16];
54  // loop on layers
55  for( unsigned int L=0; L<8; L++){
56  // loop on pcbs
57  for(unsigned int p=1; p<9; p++){
58  // loop on sides
59  for(unsigned int s=0; s<2; s++){ //loop on 0 (Left) and 1 (Right), same convention used also later
60  unsigned int R = (L%2==s) ? (p-1)*2 : (p-1)*2+1;
61  mmfe8s[L][R]=s;
62  }
63  }
64  }
65  // re-assigning as seems not to work with new stand-alone run with RecoTf from HITS samples
66  m_MMFE_VMM = region; // index of the MMFE8 board on the layer
67  m_VMM_chip = int(1. *istrip /64.); // index of the VMM chip on the layer
68  // art asic id
69  if(!int(m_plane/2.)%2){
70  if (mmfe8s[m_plane][region]==1){ //Right
71  m_ART_ASIC = 1-int(region/8);
72  }else{
73  m_ART_ASIC = int(region/8);
74  }
75  }else{
76  if (mmfe8s[m_plane][region]==0){ //Left
77  m_ART_ASIC = 1-int(region/8);
78  }else{
79  m_ART_ASIC = int(region/8);
80  }
81  }
82 
83  // if Right side add 2 to the ART Asic Index
84  if(mmfe8s[m_plane][region]==0){
85  m_ART_ASIC+=2;
86  }
87 
89  const MuonGM::MMReadoutElement* readout = detManager->getMMReadoutElement(strip_id);
90  Amg::Vector3D globalPos(0.0, 0.0, 0.0);
91  if(readout->stripGlobalPosition(strip_id, globalPos)) {
92 
93  MMDetectorHelper aHelper;
94  char side = (globalPos.z() > 0.) ? 'A' : 'C';
96  MMReadoutParameters roP = mm->GetReadoutParameters();
97 
98  m_R = globalPos.perp();
99  m_Z = globalPos.z();
101  m_RZslope = m_R / m_Z;
102 
103  int eta = std::abs(m_station_eta)-1;
104  double base = par->getYbase(m_plane, eta);
105  m_Y = base + m_strip*roP.stripPitch - roP.stripPitch/2.;
106  m_YZslope = m_Y / m_Z;
107 
108  double index = std::round((std::abs(m_RZslope)-0.1)/5e-04); // 0.0005 is approx. the step in slope achievable with a road size of 8 strips
109  double roundedSlope = 0.1 + index*((0.6 - 0.1)/1000.);
110  m_Rp = roP.distanceFromZAxis + roundedSlope*(planeCoordinates[m_plane].Z() - planeCoordinates[0].Z());
111  m_shift = m_Rp / m_Z;
112  }
113 }
114 
116  : m_sector (hit->m_sector),
117  m_module (hit->m_module),
118  m_station_name (hit->m_station_name),
119  m_VMM_chip (hit->m_VMM_chip),
120  m_MMFE_VMM (hit->m_MMFE_VMM),
121  m_ART_ASIC (hit->m_ART_ASIC),
122  m_plane (hit->m_plane),
123  m_station_eta (hit->m_station_eta),
124  m_station_phi (hit->m_station_phi),
125  m_multiplet (hit->m_multiplet),
126  m_gasgap (hit->m_gasgap),
127  m_strip (hit->m_strip),
128  m_localX (hit->m_localX),
129  m_RZslope (hit->m_RZslope),
130  m_YZslope (hit->m_YZslope),
131  m_BC_time (hit->m_BC_time),
132  m_age (hit->m_age),
133  m_Y (hit->m_Y),
134  m_Z (hit->m_Z),
135  m_PitchOverZ (hit->m_PitchOverZ),
136  m_R (hit->m_R),
137  m_Rp (hit->m_Rp),
138  m_isNoise (hit->m_isNoise),
139  m_time (hit->m_time),
140  m_shift (hit->m_shift)
141 {
142 }
143 
144 bool MMT_Hit::isX() const {
145  int id = this->getPlane();
146  return (id == 0 || id == 1 || id == 6 || id == 7);
147 }
148 
149 bool MMT_Hit::isU() const {
150  int id = this->getPlane();
151  return (id == 2 || id == 4);
152 }
153 
154 bool MMT_Hit::isV() const {
155  int id = this->getPlane();
156  return (id == 3 || id == 5);
157 }
158 
159 bool MMT_Hit::verifyHit() const {
160  /*
161  * Put here all Hit checks, probably redundant if digitization is ok
162  */
163  if (this->getBC() < 0.) return false;
164  else if (std::isinf(this->getRZSlope())) return false;
165  else if (this->getChannel() < 1 || this->getChannel() > 8192) return false;
166  else return true;
167 }
base
std::string base
Definition: hcg.cxx:78
MMT_Hit::m_station_eta
int m_station_eta
Definition: MMT_Hit.h:65
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
MMT_Hit::m_YZslope
double m_YZslope
Definition: MMT_Hit.h:71
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
MMDetectorDescription.h
MMT_Hit::m_sector
char m_sector
Definition: MMT_Hit.h:59
IDTPM::R
float R(const U &p)
Definition: TrackParametersHelper.h:101
MMT_Hit::m_R
double m_R
Definition: MMT_Hit.h:74
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
index
Definition: index.py:1
MMT_Hit::m_RZslope
double m_RZslope
Definition: MMT_Hit.h:71
MMT_Hit::m_Rp
double m_Rp
Definition: MMT_Hit.h:74
MuonGM::round
float round(const float toRound, const unsigned int decimals)
Definition: Mdt.cxx:27
MMT_Hit.h
MMT_Hit::m_ART_ASIC
int m_ART_ASIC
Definition: MMT_Hit.h:63
MMT_Hit::m_Y
double m_Y
Definition: MMT_Hit.h:73
MuonGM::MuonDetectorManager::mmIdHelper
const MmIdHelper * mmIdHelper() const
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h:236
MMT_Hit
Definition: MMT_Hit.h:14
MMT_Hit::isV
bool isV() const
Definition: MMT_Hit.cxx:154
MMT_Hit::m_Z
double m_Z
Definition: MMT_Hit.h:73
MMT_Hit::verifyHit
bool verifyHit() const
Definition: MMT_Hit.cxx:159
MMT_Hit::m_module
std::string m_module
Definition: MMT_Hit.h:60
TRT::Hit::side
@ side
Definition: HitInfo.h:83
MMT_Hit::m_age
int m_age
Definition: MMT_Hit.h:72
MMT_Hit::m_shift
float m_shift
Definition: MMT_Hit.h:76
MMT_Hit::m_PitchOverZ
double m_PitchOverZ
Definition: MMT_Hit.h:73
python.PyAthena.module
module
Definition: PyAthena.py:134
MMReadoutElement.h
MMT_Hit::m_gasgap
int m_gasgap
Definition: MMT_Hit.h:68
MMDetectorDescription
Definition: MMDetectorDescription.h:45
MMT_Hit::m_plane
int m_plane
Definition: MMT_Hit.h:64
MMT_Hit::m_VMM_chip
int m_VMM_chip
Definition: MMT_Hit.h:61
MMT_Hit::getChannel
int getChannel() const
Definition: MMT_Hit.h:23
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
MuonGM::MMReadoutElement::stripGlobalPosition
bool stripGlobalPosition(const Identifier &id, Amg::Vector3D &gpos) const
Definition: MMReadoutElement.h:282
MMT_Hit::isU
bool isU() const
Definition: MMT_Hit.cxx:149
MMReadoutParameters::stripPitch
double stripPitch
Definition: MMDetectorDescription.h:19
MMT_Hit::m_station_phi
int m_station_phi
Definition: MMT_Hit.h:66
MMT_Hit::m_MMFE_VMM
int m_MMFE_VMM
Definition: MMT_Hit.h:62
MMDetectorHelper::Get_MMDetector
MMDetectorDescription * Get_MMDetector(char type, int ieta, int iphi, int layer=1, char side='A')
Definition: MMDetectorHelper.cxx:41
MMT_Hit::m_multiplet
int m_multiplet
Definition: MMT_Hit.h:67
MMT_Hit::m_station_name
std::string m_station_name
Definition: MMT_Hit.h:60
GetAllXsec.entry
list entry
Definition: GetAllXsec.py:132
MMT_Hit::m_time
float m_time
Definition: MMT_Hit.h:76
MMT_Hit::MMT_Hit
MMT_Hit(const hitData_entry &entry, const MuonGM::MuonDetectorManager *detManager, const std::shared_ptr< MMT_Parameters > par, const std::vector< ROOT::Math::XYZVector > &planeCoordinates)
Definition: MMT_Hit.cxx:13
createCoolChannelIdFile.par
par
Definition: createCoolChannelIdFile.py:29
MMT_Hit::getBC
int getBC() const
Definition: MMT_Hit.h:22
MMT_Hit::isX
bool isX() const
Definition: MMT_Hit.cxx:144
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
MuonDetectorManager.h
MuonChannelDesign.h
python.SystemOfUnits.mm
int mm
Definition: SystemOfUnits.py:83
MMT_Hit::m_BC_time
int m_BC_time
Definition: MMT_Hit.h:72
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
MuonGM::MuonDetectorManager
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h:49
MMT_Hit::getRZSlope
double getRZSlope() const
Definition: MMT_Hit.h:29
MuonGM::MuonDetectorManager::getMMReadoutElement
const MMReadoutElement * getMMReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
Definition: MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx:255
MMT_Hit::m_strip
int m_strip
Definition: MMT_Hit.h:69
MuonGM::MMReadoutElement
An MMReadoutElement corresponds to a single STGC module; therefore typicaly a barrel muon station con...
Definition: MMReadoutElement.h:23
hitData_entry
Definition: MMT_struct.h:69
MMT_Hit::getPlane
int getPlane() const
Definition: MMT_Hit.h:27
MMT_Hit::m_localX
double m_localX
Definition: MMT_Hit.h:70
MMDetectorHelper
Definition: MMDetectorHelper.h:24
MMReadoutParameters::distanceFromZAxis
double distanceFromZAxis
Definition: MMDetectorDescription.h:26
MMT_Hit::m_isNoise
bool m_isNoise
Definition: MMT_Hit.h:75
MmIdHelper::channelID
Identifier channelID(int stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int channel) const
Definition: MmIdHelper.cxx:736
MMDetectorHelper.h
MMReadoutParameters
Definition: MMDetectorDescription.h:18