ATLAS Offline Software
Loading...
Searching...
No Matches
PixelClusterOnTrackCnv_p2.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
12
14 //std::cout<<"READING PixelClusterOnTrackCnv_p2"<<std::endl;
15
16 if(!m_isInitialized) {
17 if (this->initialize(log) != StatusCode::SUCCESS) {
18 log << MSG::FATAL << "Could not initialize PixelClusterOnTrackCnv_p2 " << endmsg;
19 }
20 }
21
23 m_elCnv.persToTrans(&persObj->m_prdLink,&rio,log);
24
25 Trk::LocalParameters localParams;
26 fillTransFromPStore( &m_localParCnv, persObj->m_localParams, &localParams, log );
27
28 Trk::ErrorMatrix dummy;
29 Amg::MatrixX localCovariance;
30 fillTransFromPStore( &m_errorMxCnv, persObj->m_localErrMat, &dummy, log );
31 EigenHelpers::vectorToEigenMatrix(dummy.values, localCovariance, "PixelClusterOnTrackCnv_p2");
32
33 *transObj = InDet::PixelClusterOnTrack(rio,
34 localParams,
35 localCovariance,
36 persObj->m_idDE,
37 m_pixId->pixel_id(persObj->m_id),
38 persObj->m_energyLoss,
39 persObj->m_isFake,
40 persObj->m_hasClusterAmbiguity,
41 persObj->m_isbroad
42 );
43
44 // Attempt to call supertool to fill in detElements
45 m_eventCnvTool->recreateRIO_OnTrack(transObj);
46 if (transObj->detectorElement()==nullptr)
47 log << MSG::WARNING<<"Unable to reset DetEl for this RIO_OnTrack, "
48 << "probably because of a problem with the Identifier/IdentifierHash : ("
49 << transObj->identify()<<"/"<<transObj->idDE()<<endmsg;
50
51}
52
53
55 if (transObj==nullptr or persObj==nullptr) return;
56
57 persObj->m_id = transObj->identify().get_compact();
58 persObj->m_localParams = toPersistent( &m_localParCnv, &transObj->localParameters(), log );
60 EigenHelpers::eigenMatrixToVector(pMat.values, transObj->localCovariance(), "PixelClusterOnTrackCnv_p2");
61 persObj->m_localErrMat = toPersistent( &m_errorMxCnv, &pMat, log );
62 persObj->m_idDE = transObj->idDE();
63 persObj->m_isbroad = transObj->isBroadCluster();
64 persObj->m_hasClusterAmbiguity = transObj->hasClusterAmbiguity();
65 persObj->m_isFake = transObj->isFake();
66 persObj->m_energyLoss = transObj->energyLoss();
67
68 static const SG::InitializedReadHandleKey<InDet::PixelClusterContainer> pixelClusContName("PixelClusters");
70 bool isFound{m_eventCnvTool->getHashAndIndex<InDet::PixelClusterContainer, InDet::PixelClusterOnTrack>(transObj, pixelClusContName, hashAndIndex)};
71 //in the case of track overlay, the final output container has a different name which we use instead
72 if(m_eventCnvTool->doTrackOverlay()){
73 persObj->m_prdLink.m_contName = (isFound ? "Bkg_PixelClusters" : "");
74 if(!isFound){ //in this case the input collection is called Bkg_PixelClusters as well
75 static const SG::InitializedReadHandleKey<InDet::PixelClusterContainer> pixelClusContName("Bkg_PixelClusters");
76 isFound=m_eventCnvTool->getHashAndIndex<InDet::PixelClusterContainer, InDet::PixelClusterOnTrack>(transObj, pixelClusContName, hashAndIndex);
77 persObj->m_prdLink.m_contName = (isFound ? "Bkg_PixelClusters" : "");
78 }
79 }
80 else persObj->m_prdLink.m_contName = (isFound ? pixelClusContName.key() : "");
81 persObj->m_prdLink.m_elementIndex = hashAndIndex;
82}
83
84StatusCode PixelClusterOnTrackCnv_p2::initialize(MsgStream &/*log*/) {
85 // Do not initialize again:
86 m_isInitialized=true;
87
88 // Get Storegate, ID helpers, and so on
89 ISvcLocator* svcLocator = Gaudi::svcLocator();
90 SmartIF<StoreGateSvc> detStore{svcLocator->service("DetectorStore")};
91 CHECK( detStore.isValid() );
92 CHECK( detStore->retrieve(m_pixId, "PixelID") );
93
94 return StatusCode::SUCCESS;
95}
96
97
#define endmsg
Helpers for checking error return status codes and reporting errors.
#define CHECK(...)
Evaluate an expression and check for errors.
ElementLink< InDet::PixelClusterContainer > ElementLinkToIDCPixelClusterContainer
This is an Identifier helper class for the Pixel subdetector.
void fillTransFromPStore(CNV **cnv, const TPObjRef &ref, TRANS_T *trans, MsgStream &log) const
TPObjRef toPersistent(CNV **cnv, const typename CNV::TransBase_t *transObj, MsgStream &log) const
value_type get_compact() const
Get the compact id.
ElementLinkInt_p1 m_prdLink
Link to PRD.
IdentifierHash::value_type m_idDE
Specific class to represent the pixel measurements.
virtual const InDetDD::SiDetectorElement * detectorElement() const override final
returns the detector element, assoicated with the PRD of this class
bool isFake() const
returns whether this cluster is likely to be the fake mirror image of a ganged pixel.
bool hasClusterAmbiguity() const
returns whether there was an ambiguity associated with this pixel cluster.
float energyLoss() const
returns the energy loss in MeV associated to this cluster.
virtual IdentifierHash idDE() const override
returns the DE hashID*
void transToPers(const InDet ::PixelClusterOnTrack *transObj, InDet ::PixelClusterOnTrack_p2 *persObj, MsgStream &log)
ToolHandle< Trk::IEventCnvSuperTool > m_eventCnvTool
LocalParametersCnv_p1 * m_localParCnv
ElementLinkCnv_p1< ElementLinkToIDCPixelClusterContainer > m_elCnv
void persToTrans(const InDet ::PixelClusterOnTrack_p2 *persObj, InDet ::PixelClusterOnTrack *transObj, MsgStream &log)
StatusCode initialize(MsgStream &log)
ReadHandleKey that initializes during construction.
const std::string & key() const
Return the StoreGate ID for the referenced object.
std::vector< float > values
const LocalParameters & localParameters() const
Interface method to get the LocalParameters.
const Amg::MatrixX & localCovariance() const
Interface method to get the localError.
Identifier identify() const
return the identifier -extends MeasurementBase
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
static void eigenMatrixToVector(VECTOR &vec, COVARIANCE &cov, const char *)
void initialize()