ATLAS Offline Software
Loading...
Searching...
No Matches
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
12namespace {
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
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}
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
void diff(const Jet &rJet1, const Jet &rJet2, std::map< std::string, double > varDiff)
Difference between jets - Non-Class function required by trigger.
Definition Jet.cxx:631
value_type get_compact() const
Get the compact id.
unsigned int value_type
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
An sTgcReadoutElement corresponds to a single STGC module; therefore typicaly a barrel muon station c...
float m_locX
Equivalent to localPosition (locX) in the base class.
std::vector< signed char > m_rdoList
Store offsets.
float m_errorMat
2-d ErrorMatrix in the base class.
std::vector< int > m_stripCharges
std::vector< short int > m_stripTimes
std::vector< uint16_t > m_stripNumbers
cluster quantities
Class to represent sTgc measurements.
Quality quality() const
int charge() const
Returns the bcBitMap of this PRD bit2 for Previous BC, bit1 for Current BC, bit0 for Next BC.
Author author() const
const std::vector< uint16_t > & stripNumbers() const
returns the list of strip numbers
short int time() const
const std::vector< int > & stripCharges() const
returns the list of charges
virtual const MuonGM::sTgcReadoutElement * detectorElement() const override final
Returns the detector element corresponding to this PRD.
const std::vector< short int > & stripTimes() const
returns the list of times
const Amg::Vector2D & localPosition() const
return the local position reference
Identifier identify() const
return the identifier
const Amg::MatrixX & localCovariance() const
return const ref to the error matrix
const std::vector< Identifier > & rdoList() const
return the List of rdo identifiers (pointers)
void persToTrans(const Muon::sTgcPrepData_p3 *persObj, Muon::sTgcPrepData *transObj, MsgStream &log)
static Muon::sTgcPrepData createsTgcPrepData(const Muon::sTgcPrepData_p3 *persObj, const Identifier clusId, const MuonGM::sTgcReadoutElement *m_detEl, MsgStream &log)
void transToPers(const Muon::sTgcPrepData *transObj, Muon::sTgcPrepData_p3 *persObj, MsgStream &log)
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Eigen::Matrix< double, 2, 1 > Vector2D
@ locY
local cartesian
Definition ParamDefs.h:38
@ locX
Definition ParamDefs.h:37
bool copy
Definition calibdata.py:26