ATLAS Offline Software
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 
8 namespace {
9  template <class T> T copy(const T& obj) { return T{obj}; }
10 }
11 
15 createMMPrepData ( const Muon::MMPrepData_p2 *persObj,
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 
58 void 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 
65 void 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 
Muon::MMPrepData_p2::m_locX
float m_locX
Equivalent to localPosition (locX) in the base class.
Definition: MMPrepData_p2.h:28
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
Muon::MMPrepData::driftDist
float driftDist() const
Returns the Drift Distance.
Definition: MMPrepData.h:232
Muon::MMPrepData_p2::m_charge
int m_charge
Definition: MMPrepData_p2.h:32
Muon::MMPrepData
Class to represent MM measurements.
Definition: MMPrepData.h:22
Amg::MatrixX
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Definition: EventPrimitives.h:27
Muon::MMPrepData_p2::m_quality
uint8_t m_quality
Definition: MMPrepData_p2.h:47
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:557
Trk::locX
@ locX
Definition: ParamDefs.h:37
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition: GeoPrimitives.h:48
Muon::MMPrepData_p2::m_driftDist
float m_driftDist
Definition: MMPrepData_p2.h:33
MMPrepDataCnv_p2::createMMPrepData
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
Definition: MMPrepDataCnv_p2.cxx:15
Trk::PrepRawData::localCovariance
const Amg::MatrixX & localCovariance() const
return const ref to the error matrix
Muon::MMPrepData_p2::m_stripCharges
std::vector< int > m_stripCharges
Definition: MMPrepData_p2.h:41
Identifier::get_identifier32
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
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
MMPrepDataCnv_p2::transToPers
void transToPers(const Muon::MMPrepData *transObj, Muon::MMPrepData_p2 *persObj, MsgStream &log)
Definition: MMPrepDataCnv_p2.cxx:65
Muon::MMPrepData_p2::m_stripTimes
std::vector< short int > m_stripTimes
Definition: MMPrepData_p2.h:40
Muon::MMPrepData_p2::m_angle
float m_angle
Definition: MMPrepData_p2.h:35
Muon::MMPrepData::quality
Quality quality() const
Definition: MMPrepData.h:168
Identifier32::get_compact
value_type get_compact() const
Get the compact id.
Definition: Identifier32.h:44
MMPrepDataCnv_p2.h
Muon::MMPrepData::stripDriftErrors_0_0
std::vector< float > stripDriftErrors_0_0() const
Definition: MMPrepData.cxx:116
Muon::MMPrepData_p2::m_time
short int m_time
Definition: MMPrepData_p2.h:31
Muon::MMPrepData::angle
float angle() const
Returns the microTPC angle.
Definition: MMPrepData.h:237
Muon::MMPrepData::stripCharges
const std::vector< int > & stripCharges() const
returns the list of charges
Definition: MMPrepData.h:257
Muon::MMPrepData_p2::m_author
short m_author
Definition: MMPrepData_p2.h:46
Muon::MMPrepData::detectorElement
virtual const MuonGM::MMReadoutElement * detectorElement() const override final
Returns the detector element corresponding to this PRD.
Definition: MMPrepData.h:206
Muon::MMPrepData_p2::m_stripNumbers
std::vector< uint16_t > m_stripNumbers
these are the parameters of the muTPC reconstruction
Definition: MMPrepData_p2.h:39
Muon::MMPrepData_p2
We don't write out (from Trk::PrepRawData) m_indexAndHash (can be recomputed), m_clusId (can be recom...
Definition: MMPrepData_p2.h:20
Muon::MMPrepData_p2::m_stripDriftErrors_1_1
std::vector< float > m_stripDriftErrors_1_1
Definition: MMPrepData_p2.h:45
MMPrepData.h
Muon::MMPrepData::stripNumbers
const std::vector< uint16_t > & stripNumbers() const
returns the list of strip numbers
Definition: MMPrepData.h:247
Muon::MMPrepData::stripTimes
const std::vector< short int > & stripTimes() const
returns the list of times
Definition: MMPrepData.h:252
Trk::PrepRawData::identify
Identifier identify() const
return the identifier
MMPrepDataCnv_p2::persToTrans
void persToTrans(const Muon::MMPrepData_p2 *persObj, Muon::MMPrepData *transObj, MsgStream &log)
Definition: MMPrepDataCnv_p2.cxx:58
Muon::MMPrepData::stripDriftErrors_1_1
std::vector< float > stripDriftErrors_1_1() const
Definition: MMPrepData.cxx:125
Trk::PrepRawData::localPosition
const Amg::Vector2D & localPosition() const
return the local position reference
Muon::MMPrepData_p2::m_chisqProb
float m_chisqProb
Definition: MMPrepData_p2.h:36
Muon::MMPrepData::time
short int time() const
Returns the time (in ns)
Definition: MMPrepData.h:222
Muon::MMPrepData_p2::m_rdoList
std::vector< signed char > m_rdoList
Store offsets.
Definition: MMPrepData_p2.h:24
Muon::MMPrepData_p2::m_stripDriftErrors_0_0
std::vector< float > m_stripDriftErrors_0_0
Definition: MMPrepData_p2.h:44
Muon::MMPrepData::Author
Author
Definition: MMPrepData.h:156
Muon::MMPrepData::Quality
Quality
Definition: MMPrepData.h:164
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
MuonGM::MMReadoutElement
An MMReadoutElement corresponds to a single STGC module; therefore typicaly a barrel muon station con...
Definition: MMReadoutElement.h:25
Muon::MMPrepData_p2::m_errorMat
float m_errorMat
1-d ErrorMatrix in the base class.
Definition: MMPrepData_p2.h:29
calibdata.copy
bool copy
Definition: calibdata.py:27
Muon::MMPrepData::author
Author author() const
Definition: MMPrepData.h:272
Muon::MMPrepData::stripDriftDist
const std::vector< float > & stripDriftDist() const
returns the list of drift distances
Definition: MMPrepData.h:262
python.PyAthena.obj
obj
Definition: PyAthena.py:132
Muon::MMPrepData::charge
int charge() const
Returns the AD.
Definition: MMPrepData.h:227
Muon::MMPrepData::chisqProb
float chisqProb() const
Returns the microTPC chisq Prob.
Definition: MMPrepData.h:242
Muon::MMPrepData_p2::m_stripDriftDist
std::vector< float > m_stripDriftDist
Definition: MMPrepData_p2.h:43
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35
Identifier32::value_type
unsigned int value_type
Definition: Identifier32.h:28
Identifier
Definition: IdentifierFieldParser.cxx:14