ATLAS Offline Software
Loading...
Searching...
No Matches
MMPrepDataCnv_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
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 data.setQuality(static_cast<Muon::MMPrepData::Quality>(persObj->m_quality));
54
55 return data;
56}
57
58void MMPrepDataCnv_p2::persToTrans( const Muon::MMPrepData_p2 *persObj, Muon::MMPrepData *transObj, MsgStream & log ) {
59 *transObj = createMMPrepData (persObj,
60 transObj->identify(),
61 transObj->detectorElement(),
62 log);
63}
64
65void MMPrepDataCnv_p2::transToPers( const Muon::MMPrepData *transObj, Muon::MMPrepData_p2 *persObj, MsgStream &) {
66 persObj->m_locX = transObj->localPosition()[Trk::locX];
67 persObj->m_errorMat = (transObj->localCovariance())(0,0);
68
69 persObj->m_time = static_cast<short int>(transObj->time());
70 persObj->m_charge = static_cast<int>(transObj->charge());
71 persObj->m_driftDist = static_cast<float>(transObj->driftDist());
72
73 persObj->m_angle = static_cast<float>(transObj->angle());
74 persObj->m_chisqProb = static_cast<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<short>(transObj->author());
85 persObj->m_quality = static_cast<uint8_t>(transObj->quality());
86
88 Identifier32::value_type clusIdCompact = transObj->identify().get_identifier32().get_compact(); // unsigned int
89 std::vector<signed char> rdoListPers;
90 const std::vector<Identifier>& rdoListTrans = transObj->rdoList();
91 for ( const auto& rdo_id : rdoListTrans ) {
92 // get the difference with respect to the 32-bit cluster identifier
93 // (this only works if the absolute value of the difference is smaller than 128)
94 Identifier32::value_type rdoIdCompact = rdo_id.get_identifier32().get_compact(); // unsigned int
95 int diff = static_cast<int>(rdoIdCompact-clusIdCompact);
96 rdoListPers.push_back(static_cast<signed char>(diff));
97 }
98
99 persObj->m_rdoList = rdoListPers;
100}
101
102
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 transToPers(const Muon::MMPrepData *transObj, Muon::MMPrepData_p2 *persObj, MsgStream &log)
static Muon::MMPrepData createMMPrepData(const Muon::MMPrepData_p2 *persObj, Identifier clusId, const MuonGM::MMReadoutElement *detEl, MsgStream &log)
function used to create an MMPrepDataObject when converting Pers to trans
void persToTrans(const Muon::MMPrepData_p2 *persObj, Muon::MMPrepData *transObj, 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< signed char > m_rdoList
Store offsets.
std::vector< short int > m_stripTimes
std::vector< float > m_stripDriftErrors_0_0
float m_locX
Equivalent to localPosition (locX) in the base class.
std::vector< uint16_t > m_stripNumbers
these are the parameters of the muTPC reconstruction
std::vector< float > m_stripDriftErrors_1_1
float m_errorMat
1-d ErrorMatrix in the base class.
std::vector< int > m_stripCharges
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
Quality quality() const
Definition MMPrepData.h:168
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
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