ATLAS Offline Software
Loading...
Searching...
No Matches
MMPrepDataCnv_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
7
8namespace {
9 template <class T> T copy(const T& obj) { return T{obj}; }
10}
11
16 Identifier clusId,
17 const MuonGM::MMReadoutElement* detEl,
18 MsgStream & ) {
19 // Fill localposition
20 Amg::Vector2D localPos{persObj->m_locX, 0.};
21 // copy the list of identifiers of the cluster
22 std::vector<Identifier> rdoList;
23 unsigned int clusIdCompact = clusId.get_identifier32().get_compact();
24 std::vector<signed char> rdoListPers = persObj->m_rdoList;
25 for ( auto& diff : rdoListPers ) {
26 Identifier rdoId (clusIdCompact + diff);
27 rdoList.push_back(std::move(rdoId));
28 }
29 auto cmat = Amg::MatrixX(1,1);
30 cmat(0,0) = static_cast<double>(persObj->m_errorMat);
31
32 Muon::MMPrepData data (clusId,
33 0, //collectionHash
34 std::move(localPos),
35 std::move(rdoList),
36 std::move(cmat),
37 detEl,
38 copy(persObj->m_time),
39 copy(persObj->m_charge),
40 copy(persObj->m_driftDist),
41 copy(persObj->m_stripNumbers),
42 copy(persObj->m_stripTimes),
43 copy(persObj->m_stripCharges));
44
45 // se the microTPC parameters
46 data.setMicroTPC(copy(persObj->m_angle),
47 copy(persObj->m_chisqProb));
48 // set the drift distances
49 data.setDriftDist(copy(persObj->m_stripDriftDist),
50 copy(persObj->m_stripDriftErrors_0_0),
51 copy(persObj->m_stripDriftErrors_1_1));
52 data.setAuthor(static_cast<Muon::MMPrepData::Author>(persObj->m_author));
53
54 return data;
55}
56
57void MMPrepDataCnv_p1::persToTrans( const Muon::MMPrepData_p1 *persObj, Muon::MMPrepData *transObj, MsgStream & log ) {
58 *transObj = createMMPrepData (persObj,
59 transObj->identify(),
60 transObj->detectorElement(),
61 log);
62 transObj->setAuthor(static_cast<Muon::MMPrepData::Author>(persObj->m_author));
63}
64
65void MMPrepDataCnv_p1::transToPers( const Muon::MMPrepData *transObj, Muon::MMPrepData_p1 *persObj, MsgStream &) {
66 persObj->m_locX = transObj->localPosition()[Trk::locX];
67 persObj->m_errorMat = (transObj->localCovariance())(0,0);
68
69 persObj->m_time = (short int) transObj->time();
70 persObj->m_charge = (int) transObj->charge();
71 persObj->m_driftDist = (float) transObj->driftDist();
72
73 persObj->m_angle = (float) transObj->angle();
74 persObj->m_chisqProb = (float) transObj->chisqProb();
75
76 persObj->m_stripNumbers = transObj->stripNumbers();
77 persObj->m_stripTimes = transObj->stripTimes();
78 persObj->m_stripCharges = transObj->stripCharges();
79
80 persObj->m_stripDriftDist = transObj->stripDriftDist();
81 persObj->m_stripDriftErrors_0_0 = transObj->stripDriftErrors_0_0();
82 persObj->m_stripDriftErrors_1_1 = transObj->stripDriftErrors_1_1();
83
84 persObj->m_author = static_cast<int>(transObj->author());
85
87 Identifier32::value_type clusIdCompact = transObj->identify().get_identifier32().get_compact(); // unsigned int
88 std::vector<signed char> rdoListPers;
89 const std::vector<Identifier>& rdoListTrans = transObj->rdoList();
90 for ( const auto& rdo_id : rdoListTrans ) {
91 // get the difference with respect to the 32-bit cluster identifier
92 // (this only works if the absolute value of the difference is smaller than 128)
93 Identifier32::value_type rdoIdCompact = rdo_id.get_identifier32().get_compact(); // unsigned int
94 int diff = (int)(rdoIdCompact-clusIdCompact);
95 rdoListPers.push_back((signed char)diff);
96 }
97
98 persObj->m_rdoList = rdoListPers;
99}
100
101
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.
void persToTrans(const Muon::MMPrepData_p1 *persObj, Muon::MMPrepData *transObj, MsgStream &log)
static Muon::MMPrepData createMMPrepData(const Muon::MMPrepData_p1 *persObj, Identifier clusId, const MuonGM::MMReadoutElement *detEl, MsgStream &log)
function used to create an MMPrepDataObject when converting Pers to trans
void transToPers(const Muon::MMPrepData *transObj, Muon::MMPrepData_p1 *persObj, MsgStream &log)
An MMReadoutElement corresponds to a single STGC module; therefore typicaly a barrel muon station con...
We don't write out (from Trk::PrepRawData) m_indexAndHash (can be recomputed), m_clusId (can be recom...
std::vector< short int > m_stripTimes
std::vector< float > m_stripDriftErrors_1_1
std::vector< signed char > m_rdoList
Store offsets.
std::vector< float > m_stripDriftErrors_0_0
std::vector< uint16_t > m_stripNumbers
these are the parameters of the muTPC reconstruction
float m_errorMat
1-d ErrorMatrix in the base class.
std::vector< int > m_stripCharges
float m_locX
Equivalent to localPosition (locX) in the base class.
std::vector< float > m_stripDriftDist
Class to represent MM measurements.
Definition MMPrepData.h:22
Author author() const
Definition MMPrepData.h:272
std::vector< float > stripDriftErrors_0_0() const
const std::vector< uint16_t > & stripNumbers() const
returns the list of strip numbers
Definition MMPrepData.h:247
const std::vector< short int > & stripTimes() const
returns the list of times
Definition MMPrepData.h:252
float angle() const
Returns the microTPC angle.
Definition MMPrepData.h:237
float driftDist() const
Returns the Drift Distance.
Definition MMPrepData.h:232
virtual const MuonGM::MMReadoutElement * detectorElement() const override final
Returns the detector element corresponding to this PRD.
Definition MMPrepData.h:206
short int time() const
Returns the time (in ns)
Definition MMPrepData.h:222
const std::vector< float > & stripDriftDist() const
returns the list of drift distances
Definition MMPrepData.h:262
const std::vector< int > & stripCharges() const
returns the list of charges
Definition MMPrepData.h:257
int charge() const
Returns the AD.
Definition MMPrepData.h:227
void setAuthor(Author author)
float chisqProb() const
Returns the microTPC chisq Prob.
Definition MMPrepData.h:242
std::vector< float > stripDriftErrors_1_1() const
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)
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Eigen::Matrix< double, 2, 1 > Vector2D
@ locX
Definition ParamDefs.h:37
bool copy
Definition calibdata.py:26