ATLAS Offline Software
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 
8 namespace {
9  template <class T> T copy(const T& obj) { return T{obj}; }
10 }
11 
15 createMMPrepData ( const Muon::MMPrepData_p1 *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 
54  return data;
55 }
56 
57 void 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 
65 void 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 
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_p1::m_stripCharges
std::vector< int > m_stripCharges
Definition: MMPrepData_p1.h:41
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_p1::m_angle
float m_angle
Definition: MMPrepData_p1.h:35
Trk::locX
@ locX
Definition: ParamDefs.h:37
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition: GeoPrimitives.h:48
Trk::PrepRawData::localCovariance
const Amg::MatrixX & localCovariance() const
return const ref to the error matrix
MMPrepDataCnv_p1.h
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
Muon::MMPrepData_p1::m_stripTimes
std::vector< short int > m_stripTimes
Definition: MMPrepData_p1.h:40
Muon::MMPrepData_p1::m_stripNumbers
std::vector< uint16_t > m_stripNumbers
these are the parameters of the muTPC reconstruction
Definition: MMPrepData_p1.h:39
Muon::MMPrepData_p1::m_stripDriftDist
std::vector< float > m_stripDriftDist
Definition: MMPrepData_p1.h:43
Muon::MMPrepData_p1::m_charge
int m_charge
Definition: MMPrepData_p1.h:32
MMPrepDataCnv_p1::createMMPrepData
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
Definition: MMPrepDataCnv_p1.cxx:15
Identifier32::get_compact
value_type get_compact() const
Get the compact id.
Definition: Identifier32.h:44
Muon::MMPrepData::stripDriftErrors_0_0
std::vector< float > stripDriftErrors_0_0() const
Definition: MMPrepData.cxx:116
Muon::MMPrepData::angle
float angle() const
Returns the microTPC angle.
Definition: MMPrepData.h:237
Muon::MMPrepData_p1::m_stripDriftErrors_1_1
std::vector< float > m_stripDriftErrors_1_1
Definition: MMPrepData_p1.h:44
Muon::MMPrepData_p1::m_time
short int m_time
Definition: MMPrepData_p1.h:31
Muon::MMPrepData::stripCharges
const std::vector< int > & stripCharges() const
returns the list of charges
Definition: MMPrepData.h:257
Muon::MMPrepData::detectorElement
virtual const MuonGM::MMReadoutElement * detectorElement() const override final
Returns the detector element corresponding to this PRD.
Definition: MMPrepData.h:206
MMPrepData.h
MMPrepDataCnv_p1::persToTrans
void persToTrans(const Muon::MMPrepData_p1 *persObj, Muon::MMPrepData *transObj, MsgStream &log)
Definition: MMPrepDataCnv_p1.cxx:57
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
Muon::MMPrepData::stripDriftErrors_1_1
std::vector< float > stripDriftErrors_1_1() const
Definition: MMPrepData.cxx:125
Muon::MMPrepData_p1::m_chisqProb
float m_chisqProb
Definition: MMPrepData_p1.h:36
Trk::PrepRawData::localPosition
const Amg::Vector2D & localPosition() const
return the local position reference
Muon::MMPrepData_p1::m_driftDist
float m_driftDist
Definition: MMPrepData_p1.h:33
Muon::MMPrepData::time
short int time() const
Returns the time (in ns)
Definition: MMPrepData.h:222
Muon::MMPrepData_p1
We don't write out (from Trk::PrepRawData) m_indexAndHash (can be recomputed), m_clusId (can be recom...
Definition: MMPrepData_p1.h:20
Muon::MMPrepData::Author
Author
Definition: MMPrepData.h:156
Muon::MMPrepData_p1::m_rdoList
std::vector< signed char > m_rdoList
Store offsets.
Definition: MMPrepData_p1.h:24
Muon::MMPrepData_p1::m_stripDriftErrors_0_0
std::vector< float > m_stripDriftErrors_0_0
Definition: MMPrepData_p1.h:44
Muon::MMPrepData_p1::m_author
int m_author
Definition: MMPrepData_p1.h:46
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_p1::m_errorMat
float m_errorMat
1-d ErrorMatrix in the base class.
Definition: MMPrepData_p1.h:29
calibdata.copy
bool copy
Definition: calibdata.py:27
Muon::MMPrepData::author
Author author() const
Definition: MMPrepData.h:272
MMPrepDataCnv_p1::transToPers
void transToPers(const Muon::MMPrepData *transObj, Muon::MMPrepData_p1 *persObj, MsgStream &log)
Definition: MMPrepDataCnv_p1.cxx:65
Muon::MMPrepData::setAuthor
void setAuthor(Author author)
Definition: MMPrepData.cxx:96
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_p1::m_locX
float m_locX
Equivalent to localPosition (locX) in the base class.
Definition: MMPrepData_p1.h:28
readCCLHist.float
float
Definition: readCCLHist.py:83
Muon::MMPrepData::chisqProb
float chisqProb() const
Returns the microTPC chisq Prob.
Definition: MMPrepData.h:242
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