ATLAS Offline Software
sTgcPrepDataCnv_p1.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_p1.cxx
8 //
9 //-----------------------------------------------------------------------------
10 
13 namespace{
14  template <class T> T copy(const T& obj) { return T{obj}; }
15 }
16 
18  const Identifier clusId,
19  const MuonGM::sTgcReadoutElement* detEl,
20  MsgStream & ) {
21  Amg::Vector2D localPos{persObj->m_locX, 0.};
22  // copy the list of identifiers of the cluster
23  std::vector<Identifier> rdoList;
24  unsigned int clusIdCompact = clusId.get_identifier32().get_compact();
25  std::vector<signed char> rdoListPers = persObj->m_rdoList;
26  for ( auto& diff : rdoListPers ) {
27  Identifier rdoId (clusIdCompact + diff);
28  rdoList.push_back(std::move(rdoId));
29  }
30 
31  auto cmat = Amg::MatrixX(1,1);
32  cmat(0,0) = static_cast<double>(persObj->m_errorMat);
33 
34  Muon::sTgcPrepData data (clusId,
35  0, // collectionHash
36  std::move(localPos),
37  std::move(rdoList),
38  std::move(cmat),
39  detEl,
40  copy(persObj->m_charge),
41  copy(persObj->m_time),
42  copy(persObj->m_stripNumbers),
43  copy(persObj->m_stripTimes),
44  copy(persObj->m_stripCharges));
45 
46  return data;
47 }
48 
50  Muon::sTgcPrepData *transObj,
51  MsgStream & log ) {
52  *transObj = createsTgcPrepData (persObj,
53  transObj->identify(),
54  transObj->detectorElement(),
55  log);
56 }
57 
59  Muon::sTgcPrepData_p1 *persObj,
60  MsgStream & ) {
61 
62  persObj->m_locX = transObj->localPosition()[Trk::locX];
63  persObj->m_errorMat = transObj->localCovariance()(0,0);
64 
65  persObj->m_charge = transObj->charge();
66  persObj->m_time = transObj->time();
67 
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 }
88 
89 
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
sTgcPrepDataCnv_p1::persToTrans
void persToTrans(const Muon::sTgcPrepData_p1 *persObj, Muon::sTgcPrepData *transObj, MsgStream &log)
Definition: sTgcPrepDataCnv_p1.cxx:49
Amg::MatrixX
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Definition: EventPrimitives.h:29
Trk::locX
@ locX
Definition: ParamDefs.h:43
Muon::sTgcPrepData_p1::m_time
short int m_time
Definition: sTgcPrepData_p1.h:36
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_p1::m_rdoList
std::vector< signed char > m_rdoList
Store offsets.
Definition: sTgcPrepData_p1.h:28
Trk::PrepRawData::localCovariance
const Amg::MatrixX & localCovariance() const
return const ref to the error matrix
Muon::sTgcPrepData_p1::m_stripCharges
std::vector< int > m_stripCharges
Definition: sTgcPrepData_p1.h:42
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_p1::m_locX
float m_locX
Equivalent to localPosition (locX) in the base class.
Definition: sTgcPrepData_p1.h:32
TgcPrepData.h
Muon::sTgcPrepData_p1::m_stripTimes
std::vector< short int > m_stripTimes
Definition: sTgcPrepData_p1.h:41
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_p1::createsTgcPrepData
static Muon::sTgcPrepData createsTgcPrepData(const Muon::sTgcPrepData_p1 *persObj, const Identifier clusId, const MuonGM::sTgcReadoutElement *m_detEl, MsgStream &log)
Definition: sTgcPrepDataCnv_p1.cxx:17
sTgcPrepDataCnv_p1::transToPers
void transToPers(const Muon::sTgcPrepData *transObj, Muon::sTgcPrepData_p1 *persObj, MsgStream &log)
Definition: sTgcPrepDataCnv_p1.cxx:58
Identifier32::get_compact
value_type get_compact(void) const
Get the compact id.
Definition: Identifier32.h:171
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
Muon::sTgcPrepData_p1::m_stripNumbers
std::vector< uint16_t > m_stripNumbers
cluster quantities
Definition: sTgcPrepData_p1.h:40
Muon::sTgcPrepData_p1::m_errorMat
float m_errorMat
1-d ErrorMatrix in the base class.
Definition: sTgcPrepData_p1.h:33
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
Trk::PrepRawData::identify
Identifier identify() const
return the identifier
Trk::PrepRawData::localPosition
const Amg::Vector2D & localPosition() const
return the local position reference
Muon::sTgcPrepData::detectorElement
virtual const MuonGM::sTgcReadoutElement * detectorElement() const override final
Returns the detector element corresponding to this PRD.
Definition: sTgcPrepData.h:139
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
Muon::sTgcPrepData_p1::m_charge
int m_charge
Definition: sTgcPrepData_p1.h:35
Muon::sTgcPrepData_p1
We don't write out (from Trk::PrepRawData) m_indexAndHash (can be recomputed),.
Definition: sTgcPrepData_p1.h:24
calibdata.copy
bool copy
Definition: calibdata.py:27
sTgcPrepDataCnv_p1.h
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