ATLAS Offline Software
sTgcPrepDataCnv_p2.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_p2.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  return data;
48 }
49 
51  Muon::sTgcPrepData *transObj,
52  MsgStream & log ) {
53  *transObj = createsTgcPrepData (persObj,
54  transObj->identify(),
55  transObj->detectorElement(),
56  log);
57 }
58 
60  Muon::sTgcPrepData_p2 *persObj,
61  MsgStream & ) {
62  persObj->m_locX = transObj->localPosition()[Trk::locX];
63  persObj->m_locY = transObj->localPosition()[Trk::locY];
64  persObj->m_errorMat = transObj->localCovariance()(0,0);
65 
66  persObj->m_charge = transObj->charge();
67  persObj->m_time = transObj->time();
68 
69  persObj->m_stripNumbers = transObj->stripNumbers();
70  persObj->m_stripTimes = transObj->stripTimes();
71  persObj->m_stripCharges = transObj->stripCharges();
72 
74  Identifier32::value_type clusIdCompact = transObj->identify().get_identifier32().get_compact(); // unsigned int
75  std::vector<signed char> rdoListPers;
76  const std::vector<Identifier>& rdoListTrans = transObj->rdoList();
77  for ( const auto& rdo_id : rdoListTrans ) {
78  // get the difference with respect to the 32-bit cluster identifier
79  // (this only works if the absolute value of the difference is smaller than 128)
80  Identifier32::value_type rdoIdCompact = rdo_id.get_identifier32().get_compact(); // unsigned int
81  int diff = (int)(rdoIdCompact-clusIdCompact);
82  rdoListPers.push_back((signed char)diff);
83  }
84 
85  persObj->m_rdoList = rdoListPers;
86 
87 }
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
Muon::sTgcPrepData_p2::m_locY
float m_locY
Definition: sTgcPrepData_p2.h:30
Amg::MatrixX
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Definition: EventPrimitives.h:29
Muon::sTgcPrepData_p2
Definition: sTgcPrepData_p2.h:19
Trk::locX
@ locX
Definition: ParamDefs.h:43
Trk::locY
@ locY
local cartesian
Definition: ParamDefs.h:44
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
Identifier32::value_type
unsigned int value_type
Definition: Identifier32.h:33
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition: GeoPrimitives.h:48
Muon::sTgcPrepData_p2::m_locX
float m_locX
Equivalent to localPosition (locX) in the base class.
Definition: sTgcPrepData_p2.h:27
Trk::PrepRawData::localCovariance
const Amg::MatrixX & localCovariance() const
return const ref to the error matrix
Muon::sTgcPrepData_p2::m_errorMat
float m_errorMat
1-d ErrorMatrix in the base class.
Definition: sTgcPrepData_p2.h:28
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_p2::m_rdoList
std::vector< signed char > m_rdoList
Store offsets.
Definition: sTgcPrepData_p2.h:23
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_p2::createsTgcPrepData
static Muon::sTgcPrepData createsTgcPrepData(const Muon::sTgcPrepData_p2 *persObj, const Identifier clusId, const MuonGM::sTgcReadoutElement *m_detEl, MsgStream &log)
Definition: sTgcPrepDataCnv_p2.cxx:16
Muon::sTgcPrepData_p2::m_stripNumbers
std::vector< uint16_t > m_stripNumbers
cluster quantities
Definition: sTgcPrepData_p2.h:36
Identifier32::get_compact
value_type get_compact(void) const
Get the compact id.
Definition: Identifier32.h:171
Muon::sTgcPrepData_p2::m_charge
int m_charge
Definition: sTgcPrepData_p2.h:31
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
MuonGM::sTgcReadoutElement
An sTgcReadoutElement corresponds to a single STGC module; therefore typicaly a barrel muon station c...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/sTgcReadoutElement.h:28
Muon::sTgcPrepData::time
short int time() const
Definition: sTgcPrepData.h:156
Muon::sTgcPrepData_p2::m_stripTimes
std::vector< short int > m_stripTimes
Definition: sTgcPrepData_p2.h:37
sTgcPrepDataCnv_p2::persToTrans
void persToTrans(const Muon::sTgcPrepData_p2 *persObj, Muon::sTgcPrepData *transObj, MsgStream &log)
Definition: sTgcPrepDataCnv_p2.cxx:50
Muon::sTgcPrepData_p2::m_time
short int m_time
Definition: sTgcPrepData_p2.h:32
Trk::PrepRawData::identify
Identifier identify() const
return the identifier
Trk::PrepRawData::localPosition
const Amg::Vector2D & localPosition() const
return the local position reference
Muon::sTgcPrepData_p2::m_stripCharges
std::vector< int > m_stripCharges
Definition: sTgcPrepData_p2.h:38
Muon::sTgcPrepData::detectorElement
virtual const MuonGM::sTgcReadoutElement * detectorElement() const override final
Returns the detector element corresponding to this PRD.
Definition: sTgcPrepData.h:139
sTgcPrepDataCnv_p2::transToPers
void transToPers(const Muon::sTgcPrepData *transObj, Muon::sTgcPrepData_p2 *persObj, MsgStream &log)
Definition: sTgcPrepDataCnv_p2.cxx:59
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
sTgcPrepDataCnv_p2.h
calibdata.copy
bool copy
Definition: calibdata.py:27
Identifier::get_identifier32
Identifier32 get_identifier32(void) const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
python.PyAthena.obj
obj
Definition: PyAthena.py:135
Muon::sTgcPrepData
Class to represent sTgc measurements.
Definition: sTgcPrepData.h:20
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