ATLAS Offline Software
Loading...
Searching...
No Matches
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
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 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}
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...
std::vector< int > m_stripCharges
std::vector< short int > m_stripTimes
float m_locX
Equivalent to localPosition (locX) in the base class.
float m_errorMat
1-d ErrorMatrix in the base class.
std::vector< signed char > m_rdoList
Store offsets.
std::vector< uint16_t > m_stripNumbers
cluster quantities
Class to represent sTgc measurements.
int charge() const
Returns the bcBitMap of this PRD bit2 for Previous BC, bit1 for Current BC, bit0 for Next BC.
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)
static Muon::sTgcPrepData createsTgcPrepData(const Muon::sTgcPrepData_p2 *persObj, const Identifier clusId, const MuonGM::sTgcReadoutElement *m_detEl, MsgStream &log)
void transToPers(const Muon::sTgcPrepData *transObj, Muon::sTgcPrepData_p2 *persObj, MsgStream &log)
void persToTrans(const Muon::sTgcPrepData_p2 *persObj, Muon::sTgcPrepData *transObj, 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