ATLAS Offline Software
TrackRecordCnv_p1.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 
11 
12 
13 void
14 TrackRecordCnv_p1::persToTrans(const TrackRecord_p1* persObj, TrackRecord* transObj, MsgStream &log) const
15 {
16  log << MSG::DEBUG << "TrackRecordCnv_p1::persToTrans called " << endmsg;
17 
18  transObj->SetPDGCode(persObj->PDG_code());
19  transObj->SetEnergy((double) persObj->energy());
20  transObj->SetMomentum(CLHEP::Hep3Vector(persObj->momentumX(), persObj->momentumY(), persObj->momentumZ() ));
21  transObj->SetPosition(CLHEP::Hep3Vector(persObj->positionX(), persObj->positionY(), persObj->positionZ() ));
22  const int oldStatus = 1; // Given how TrackRecords are used currently; this will be correct for all but some very exotic samples.
23  transObj->SetStatus(HepMC::new_particle_status_from_old(oldStatus, persObj->barCode()));
24  transObj->SetTime((double) persObj->time());
25  transObj->SetBarcode(persObj->barCode()); // FIXME barcode-based
26  transObj->SetID(HepMC::INVALID_PARTICLE_ID); // FIXME Currently in order to set ID values correctly one would need to look into the McEventCollection
27  transObj->SetVolName(persObj->volName());
28 }
29 
30 
31 void
32 TrackRecordCnv_p1::transToPers(const TrackRecord* transObj, TrackRecord_p1* persObj, MsgStream &log) const
33 {
34  log << MSG::DEBUG << "TrackRecordCnv_p1::transToPers called " << endmsg;
35  persObj->m_PDG_code = transObj->GetPDGCode();
36  persObj->m_energy = (float) transObj->GetEnergy();
37  CLHEP::Hep3Vector mom = transObj->GetMomentum();
38  persObj->m_momentumX = (float) mom.x();
39  persObj->m_momentumY = (float) mom.y();
40  persObj->m_momentumZ = (float) mom.z();
41  CLHEP::Hep3Vector pos = transObj->GetPosition();
42  persObj->m_positionX = (float) pos.x();
43  persObj->m_positionY = (float) pos.y();
44  persObj->m_positionZ = (float) pos.z();
45  persObj->m_time = (float) transObj->GetTime();
46  persObj->m_barCode = HepMC::barcode(transObj); // FIXME barcode-based
47  persObj->m_volName = transObj->GetVolName();
48 }
49 
TrackRecord::SetID
void SetID(int uniqueID)
Set uniqueID.
Definition: TrackRecord.h:127
TrackRecord_p1::energy
float energy() const
Definition: TrackRecord_p1.h:16
TrackRecordCnv_p1::transToPers
virtual void transToPers(const TrackRecord *transObj, TrackRecord_p1 *persObj, MsgStream &log) const override
Definition: TrackRecordCnv_p1.cxx:32
TrackRecordCnv_p1.h
TrackRecord_p1::m_momentumX
float m_momentumX
Definition: TrackRecord_p1.h:31
TrackRecord_p1::momentumY
float momentumY() const
Definition: TrackRecord_p1.h:18
HepMC::INVALID_PARTICLE_ID
constexpr int INVALID_PARTICLE_ID
Definition: MagicNumbers.h:57
TrackRecord_p1::momentumZ
float momentumZ() const
Definition: TrackRecord_p1.h:19
TrackRecord_p1::positionY
float positionY() const
Definition: TrackRecord_p1.h:21
TrackRecord_p1::time
float time() const
Definition: TrackRecord_p1.h:23
TrackRecord::SetPDGCode
void SetPDGCode(int pcode)
Set PDG code.
Definition: TrackRecord.h:103
TrackRecord_p1::m_volName
std::string m_volName
Definition: TrackRecord_p1.h:35
TrackRecord_p1::barCode
int barCode() const
Definition: TrackRecord_p1.h:24
TrackRecord_p1::m_momentumY
float m_momentumY
Definition: TrackRecord_p1.h:31
TrackRecord::SetVolName
void SetVolName(const std::string &theName)
Set Volume name.
Definition: TrackRecord.h:115
TrackRecord_p1::m_positionZ
float m_positionZ
Definition: TrackRecord_p1.h:32
TrackRecord_p1::m_time
float m_time
Definition: TrackRecord_p1.h:33
TrackRecord::GetTime
double GetTime() const
Time.
Definition: TrackRecord.h:106
ParticleGun_EoverP_Config.mom
mom
Definition: ParticleGun_EoverP_Config.py:63
TrackRecord_p1::m_positionX
float m_positionX
Definition: TrackRecord_p1.h:32
TrackRecord::GetPosition
CLHEP::Hep3Vector GetPosition() const
Position.
Definition: TrackRecord.h:88
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
HepMC::barcode
int barcode(const T *p)
Definition: Barcode.h:16
TrackRecord_p1::momentumX
float momentumX() const
Definition: TrackRecord_p1.h:17
TrackRecord_p1::m_energy
float m_energy
Definition: TrackRecord_p1.h:30
TrackRecord::SetTime
void SetTime(double time)
Set time.
Definition: TrackRecord.h:109
TrackRecordCnv_p1::persToTrans
virtual void persToTrans(const TrackRecord_p1 *persObj, TrackRecord *transObj, MsgStream &log) const override
Definition: TrackRecordCnv_p1.cxx:14
TrackRecord::SetPosition
void SetPosition(CLHEP::Hep3Vector p)
Set position.
Definition: TrackRecord.h:91
TrackRecord::SetBarcode
void SetBarcode(int barcode)
Set barcode.
Definition: TrackRecord.h:138
TrackRecord_p1::positionX
float positionX() const
Definition: TrackRecord_p1.h:20
TrackRecord_p1::volName
const std::string & volName() const
Definition: TrackRecord_p1.h:25
TrackRecord_p1::m_positionY
float m_positionY
Definition: TrackRecord_p1.h:32
TrackRecord_p1.h
TrackRecord.h
TrackRecord::SetMomentum
void SetMomentum(CLHEP::Hep3Vector e)
Set momentum.
Definition: TrackRecord.h:97
MagicNumbers.h
TrackRecord::GetEnergy
double GetEnergy() const
Energy.
Definition: TrackRecord.h:82
TrackRecord::GetMomentum
CLHEP::Hep3Vector GetMomentum() const
Momentum.
Definition: TrackRecord.h:94
TrackRecord
Definition: TrackRecord.h:12
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
TrackRecord_p1::m_momentumZ
float m_momentumZ
Definition: TrackRecord_p1.h:31
TrackRecord::SetStatus
void SetStatus(int status)
Set status.
Definition: TrackRecord.h:121
TrackRecord_p1::m_PDG_code
int m_PDG_code
Definition: TrackRecord_p1.h:29
TrackRecord::GetVolName
const std::string & GetVolName() const
Volume name.
Definition: TrackRecord.h:112
TrackRecord_p1::PDG_code
int PDG_code() const
Definition: TrackRecord_p1.h:15
TrackRecord_p1::positionZ
float positionZ() const
Definition: TrackRecord_p1.h:22
DEBUG
#define DEBUG
Definition: page_access.h:11
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
TrackRecord_p1::m_barCode
int m_barCode
Definition: TrackRecord_p1.h:34
TrackRecord::SetEnergy
void SetEnergy(double e)
Set energy.
Definition: TrackRecord.h:85
TrackRecord::GetPDGCode
int GetPDGCode() const
PDG Code.
Definition: TrackRecord.h:100
TrackRecord_p1
Definition: TrackRecord_p1.h:9
readCCLHist.float
float
Definition: readCCLHist.py:83
HepMC::new_particle_status_from_old
int new_particle_status_from_old(const int oldStatus, const int barcode)
Get particle status in the new scheme from the barcode and status in the old scheme.
Definition: MagicNumbers.h:405