13#include "CLHEP/Geometry/Point3D.h"
16#include "GaudiKernel/MsgStream.h"
40 static const double dRcut = 1.0e-7;
41 static const double dTcut = 1.0;
49 unsigned int endBC = 0;
50 unsigned int endId = 0;
51 unsigned int endHit = 0;
52 HepGeom::Point3D<double> lastEnd(0.0, 0.0, 0.0);
57 if ( it->particleLink().barcode() != lastBarcode ) {
61 lastBarcode = it->particleLink().barcode();
62 persCont->
m_barcode.push_back(
static_cast<barcodeType
>(lastBarcode));
65 persCont->
m_nBC.push_back(idx - endBC);
70 if ( (
int)it->GetParticleEncoding() != lastId ) {
74 lastId = it->GetParticleEncoding();
75 persCont->
m_id.push_back(lastId);
78 persCont->
m_nId.push_back(idx - endId);
83 const HepGeom::Point3D<double> hitStart(it->GetPreStepX(), it->GetPreStepY(), it->GetPreStepZ());
84 const double t = it->GetGlobalTime();
86 const double dRLast = lastEnd.distance(hitStart);
87 const double dTLast = fabs(t - lastT);
89 if (dRLast >= dRcut || dTLast >= dTcut) {
98 persCont->
m_nHits.push_back(idx - endHit);
103 persCont->
m_hitId.push_back( it->GetHitID() );
104 persCont->
m_kinEne.push_back( it->GetKineticEnergy() );
107 persCont->
m_hitEne.push_back( it->GetEnergyDeposit() );
108 persCont->
m_endX.push_back( it->GetPostStepX() );
109 persCont->
m_endY.push_back( it->GetPostStepY() );
110 persCont->
m_endZ.push_back( it->GetPostStepZ() );
112 lastEnd = HepGeom::Point3D<double>(it->GetPostStepX(), it->GetPostStepY(), it->GetPostStepZ());
117 persCont->
m_nBC.push_back(idx - endBC);
118 persCont->
m_nId.push_back(idx - endId);
119 persCont->
m_nHits.push_back(idx - endHit);
124 std::unique_ptr<TRTUncompressedHitCollection> trans(std::make_unique<TRTUncompressedHitCollection>(
"DefaultCollectionName",persObj->
m_nHits.size()));
126 return(trans.release());
134 unsigned int hitCount = 0;
135 unsigned int idxBC = 0;
136 unsigned int idxId = 0;
137 unsigned int endHit = 0;
138 unsigned int endBC = 0;
139 unsigned int endId = 0;
141 for (
unsigned int i = 0; i < persCont->
m_nHits.size(); i++) {
145 const unsigned int start = endHit;
146 endHit += persCont->
m_nHits[i];
150 for (
unsigned int j = start; j < endHit; j++) {
152 if (j >= endBC + persCont->
m_nBC[idxBC])
153 endBC += persCont->
m_nBC[idxBC++];
155 if (j >= endId + persCont->
m_nId[idxId])
156 endId += persCont->
m_nId[idxId++];
158 const double eneLoss = persCont->
m_hitEne[hitCount];
160 HepGeom::Point3D<double> endThis(persCont->
m_endX[j], persCont->
m_endY[j], persCont->
m_endZ[j]);
168 eneLoss, endLast.x(), endLast.y(), endLast.z(), endThis.x(), endThis.y(), endThis.z(),
171 endLast = std::move(endThis);
AtlasHitsVector< TRTUncompressedHit > TRTUncompressedHitCollection
CONT::const_iterator const_iterator
const_iterator begin() const
void Emplace(Args &&... args)
const_iterator end() const
Persistent representation of a link.
a link optimized in size for a GenParticle in a McEventCollection
void setExtendedBarCode(const ExtendedBarCode &extBarcode)
Alter the persistent part of the link.
void setTruthSuppressionType(EBC_SUPPRESSED_TRUTH truthSupp)
Return whether the truth particle has been suppressed.
virtual TRTUncompressedHitCollection * createTransient(const TRT_HitCollection_p2 *persObj, MsgStream &log)
virtual void transToPers(const TRTUncompressedHitCollection *transCont, TRT_HitCollection_p2 *persCont, MsgStream &log)
virtual void persToTrans(const TRT_HitCollection_p2 *persCont, TRTUncompressedHitCollection *transCont, MsgStream &log)
std::vector< float > m_endY
std::vector< float > m_meanTime
std::vector< unsigned short > m_nBC
std::vector< float > m_endX
std::vector< float > m_kinEne
std::vector< float > m_endZ
std::vector< float > m_hit1_startZ
std::vector< unsigned long > m_barcode
std::vector< float > m_hitEne
std::vector< unsigned long > m_hitId
std::vector< unsigned short > m_nId
std::vector< float > m_hit1_startX
std::vector< unsigned short > m_nHits
std::vector< float > m_hit1_startY
bool is_truth_suppressed_pileup(const T &p)
Method to establish if a particle (or barcode) corresponds to truth-suppressed pile-up.