ATLAS Offline Software
sTgcPrepDataCnv_p3.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 //
7 // file: sTgcPrepDataCnv_p3.cxx
8 //
9 //-----------------------------------------------------------------------------
10 
12 namespace {
13  template <class T> T copy(const T& obj) { return T{obj}; }
14 }
15 
17  const Identifier clusId,
18  const MuonGM::sTgcReadoutElement* detEl,
19  MsgStream & ) {
20  Amg::Vector2D localPos{persObj->m_locX, persObj->m_locY};
21 
22 
23  // copy the list of identifiers of the cluster
24  std::vector<Identifier> rdoList;
25  unsigned int clusIdCompact = clusId.get_identifier32().get_compact();
26  std::vector<signed char> rdoListPers = persObj->m_rdoList;
27  for ( auto& diff : rdoListPers ) {
28  Identifier rdoId (clusIdCompact + diff);
29  rdoList.push_back(rdoId);
30  }
31 
32  auto cmat = Amg::MatrixX(1,1);
33  cmat(0,0) = static_cast<double>(persObj->m_errorMat);
34 
35  Muon::sTgcPrepData data (clusId,
36  0, // collectionHash
37  std::move(localPos),
38  std::move(rdoList),
39  std::move(cmat),
40  detEl,
41  copy(persObj->m_charge),
42  copy(persObj->m_time),
43  copy(persObj->m_stripNumbers),
44  copy(persObj->m_stripTimes),
45  copy(persObj->m_stripCharges));
46 
47  data.setAuthor(static_cast<Muon::sTgcPrepData::Author>(persObj->m_author));
48  data.setQuality(static_cast<Muon::sTgcPrepData::Quality>(persObj->m_quality));
49 
50  return data;
51 }
52 
54  Muon::sTgcPrepData *transObj,
55  MsgStream & log ) {
56  *transObj = createsTgcPrepData (persObj,
57  transObj->identify(),
58  transObj->detectorElement(),
59  log);
60 }
61 
63  Muon::sTgcPrepData_p3 *persObj,
64  MsgStream & ) {
65  persObj->m_locX = transObj->localPosition()[Trk::locX];
66  persObj->m_locY = transObj->localPosition()[Trk::locY];
67  persObj->m_errorMat = transObj->localCovariance()(0,0);
68 
69  persObj->m_charge = transObj->charge();
70  persObj->m_time = transObj->time();
71 
72  persObj->m_stripNumbers = transObj->stripNumbers();
73  persObj->m_stripTimes = transObj->stripTimes();
74  persObj->m_stripCharges = transObj->stripCharges();
75 
76  persObj->m_author = static_cast<uint8_t>(transObj->author());
77  persObj->m_quality = static_cast<uint8_t>(transObj->quality());
78 
80  Identifier32::value_type clusIdCompact = transObj->identify().get_identifier32().get_compact(); // unsigned int
81  std::vector<signed char> rdoListPers;
82  const std::vector<Identifier>& rdoListTrans = transObj->rdoList();
83  for ( const auto& rdo_id : rdoListTrans ) {
84  // get the difference with respect to the 32-bit cluster identifier
85  // (this only works if the absolute value of the difference is smaller than 128)
86  Identifier32::value_type rdoIdCompact = rdo_id.get_identifier32().get_compact(); // unsigned int
87  int diff = static_cast<int>(rdoIdCompact-clusIdCompact);
88  rdoListPers.push_back(static_cast<signed char>(diff));
89  }
90 
91  persObj->m_rdoList = rdoListPers;
92 
93 }
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
Amg::MatrixX
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Definition: EventPrimitives.h:27
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:557
Trk::locX
@ locX
Definition: ParamDefs.h:37
Trk::locY
@ locY
local cartesian
Definition: ParamDefs.h:38
sTgcPrepDataCnv_p3::transToPers
void transToPers(const Muon::sTgcPrepData *transObj, Muon::sTgcPrepData_p3 *persObj, MsgStream &log)
Definition: sTgcPrepDataCnv_p3.cxx:62
Muon::sTgcPrepData_p3::m_charge
int m_charge
Definition: sTgcPrepData_p3.h:31
Muon::sTgcPrepData_p3::m_locX
float m_locX
Equivalent to localPosition (locX) in the base class.
Definition: sTgcPrepData_p3.h:27
Muon::sTgcPrepData_p3::m_errorMat
float m_errorMat
2-d ErrorMatrix in the base class.
Definition: sTgcPrepData_p3.h:28
Muon::sTgcPrepData_p3::m_rdoList
std::vector< signed char > m_rdoList
Store offsets.
Definition: sTgcPrepData_p3.h:23
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition: GeoPrimitives.h:48
sTgcPrepDataCnv_p3.h
Trk::PrepRawData::localCovariance
const Amg::MatrixX & localCovariance() const
return const ref to the error matrix
Muon::sTgcPrepData_p3::m_locY
float m_locY
Definition: sTgcPrepData_p3.h:30
Identifier::get_identifier32
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
Trk::PrepRawData::rdoList
const std::vector< Identifier > & rdoList() const
return the List of rdo identifiers (pointers)
mc.diff
diff
Definition: mc.SFGenPy8_MuMu_DD.py:14
Muon::sTgcPrepData::author
Author author() const
Definition: sTgcPrepData.h:115
Muon::sTgcPrepData_p3::m_stripNumbers
std::vector< uint16_t > m_stripNumbers
cluster quantities
Definition: sTgcPrepData_p3.h:36
Muon::sTgcPrepData_p3::m_stripCharges
std::vector< int > m_stripCharges
Definition: sTgcPrepData_p3.h:38
Identifier32::get_compact
value_type get_compact() const
Get the compact id.
Definition: Identifier32.h:44
Muon::sTgcPrepData_p3::m_author
uint8_t m_author
Definition: sTgcPrepData_p3.h:39
Muon::sTgcPrepData::stripNumbers
const std::vector< uint16_t > & stripNumbers() const
returns the list of strip numbers
Definition: sTgcPrepData.h:158
Muon::sTgcPrepData::stripCharges
const std::vector< int > & stripCharges() const
returns the list of charges
Definition: sTgcPrepData.h:160
sTgcPrepDataCnv_p3::createsTgcPrepData
static Muon::sTgcPrepData createsTgcPrepData(const Muon::sTgcPrepData_p3 *persObj, const Identifier clusId, const MuonGM::sTgcReadoutElement *m_detEl, MsgStream &log)
Definition: sTgcPrepDataCnv_p3.cxx:16
sTgcPrepDataCnv_p3::persToTrans
void persToTrans(const Muon::sTgcPrepData_p3 *persObj, Muon::sTgcPrepData *transObj, MsgStream &log)
Definition: sTgcPrepDataCnv_p3.cxx:53
MuonGM::sTgcReadoutElement
An sTgcReadoutElement corresponds to a single STGC module; therefore typicaly a barrel muon station c...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/sTgcReadoutElement.h:30
Muon::sTgcPrepData::time
short int time() const
Definition: sTgcPrepData.h:156
Trk::PrepRawData::identify
Identifier identify() const
return the identifier
Trk::PrepRawData::localPosition
const Amg::Vector2D & localPosition() const
return the local position reference
Muon::sTgcPrepData_p3::m_time
short int m_time
Definition: sTgcPrepData_p3.h:32
Muon::sTgcPrepData_p3
Definition: sTgcPrepData_p3.h:19
Muon::sTgcPrepData::detectorElement
virtual const MuonGM::sTgcReadoutElement * detectorElement() const override final
Returns the detector element corresponding to this PRD.
Definition: sTgcPrepData.h:139
Muon::sTgcPrepData::Author
Author
Definition: sTgcPrepData.h:100
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
Muon::sTgcPrepData_p3::m_stripTimes
std::vector< short int > m_stripTimes
Definition: sTgcPrepData_p3.h:37
Muon::sTgcPrepData::Quality
Quality
Definition: sTgcPrepData.h:108
calibdata.copy
bool copy
Definition: calibdata.py:27
python.PyAthena.obj
obj
Definition: PyAthena.py:132
Muon::sTgcPrepData
Class to represent sTgc measurements.
Definition: sTgcPrepData.h:20
Muon::sTgcPrepData::quality
Quality quality() const
Definition: sTgcPrepData.h:112
Muon::sTgcPrepData_p3::m_quality
uint8_t m_quality
Definition: sTgcPrepData_p3.h:40
Muon::sTgcPrepData::charge
int charge() const
Returns the bcBitMap of this PRD bit2 for Previous BC, bit1 for Current BC, bit0 for Next BC.
Definition: sTgcPrepData.h:154
Muon::sTgcPrepData::stripTimes
const std::vector< short int > & stripTimes() const
returns the list of times
Definition: sTgcPrepData.h:159
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35
Identifier32::value_type
unsigned int value_type
Definition: Identifier32.h:28
Identifier
Definition: IdentifierFieldParser.cxx:14