ATLAS Offline Software
Loading...
Searching...
No Matches
Muon::MuonEDMPrinterTool Class Reference

Helper tool to print EDM objects to string in a fix format. More...

#include <MuonEDMPrinterTool.h>

Inheritance diagram for Muon::MuonEDMPrinterTool:
Collaboration diagram for Muon::MuonEDMPrinterTool:

Public Member Functions

 MuonEDMPrinterTool (const std::string &, const std::string &, const IInterface *)
 constructor
 ~MuonEDMPrinterTool ()=default
 destructor
StatusCode initialize ()
 AlgTool initilize.
std::string print (const Trk::Track &track) const
 print track parameters to string
std::string printStations (const Trk::Track &track) const
 print stations on track to string
std::string print (const Trk::MuonTrackSummary &summary) const
 print stations on track to string
std::string print (const MuonSegment &segment) const
 print segment parameters to string
std::string print (const std::vector< const MuonSegment * > &segs) const
 print vector of segments
std::string print (std::vector< std::unique_ptr< MuonSegment > > &segs) const
std::string print (const Trk::MeasurementBase &measurement) const
 print Muon MeasurementBase to string
std::string print (const Trk::PrepRawData &prd) const
 print Muon PrepRawData to string
std::string print (const std::vector< const Trk::MeasurementBase * > &measurements) const
 print vector of measurement base to string
std::string print (const MuonSegmentCombinationCollection &combiCol) const
 print MuonSegmentCombinationCollection
std::string print (const MuonSegmentCombination &combi) const
 print MuonSegmentCombination
std::string print (const MuonPattern &pattern) const
 print MuonPattern
std::string print (const MuonPatternCollection &patCol) const
 print MuonPatternCollection
std::string print (const MuonPrdPatternCollection &patCol) const
 print MuonPatternCollection
std::string print (const MuonPatternCombination &pattern) const
 print MuonPatternCombination
std::string print (const MuonPatternCombinationCollection &combiCol) const
 print MuonPatternCombinationCollection
std::string print (const MuonPatternChamberIntersect &intersect) const
 print MuonPatternChamberIntersect
std::string print (const Trk::TrackStateOnSurface &tsos) const
 print the track state on surface to the string
std::string printMeasurements (const Trk::Track &track) const
 print measurements on track to string
std::string printData (const Trk::MeasurementBase &measurement) const
 print data part of Muon MeasurementBase to string
std::string printId (const Trk::MeasurementBase &measurement) const
 print identifier part of Muon MeasurementBase to string
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Static Public Member Functions

static const InterfaceID & interfaceID ()
 access to tool interface
static std::string printPatRec (const Trk::Track &track)
 produce a string indicating who produced the track
static std::string print (const Trk::TrackParameters &pars)
 print Trk::TrackParameters
static std::string print (const Trk::ResidualPull &resPull)
 print ResidualPull object to string
static std::string print (const Trk::MaterialEffectsBase &mat)
 print the material effects object to the string
static std::string print (const Trk::AlignmentEffectsOnTrack &aeot)
 print the alignment effects on track object to the string

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc
ServiceHandle< IMuonEDMHelperSvcm_edmHelperSvc
ToolHandle< Trk::IResidualPullCalculatorm_pullCalculator
SG::ReadCondHandleKey< MuonGM::MuonDetectorManagerm_DetectorManagerKey
SG::ReadHandleKey< MdtPrepDataContainerm_mdtKey
SG::ReadHandleKey< RpcPrepDataContainerm_rpcKey
SG::ReadHandleKey< TgcPrepDataContainerm_tgcKey
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Helper tool to print EDM objects to string in a fix format.

Definition at line 43 of file MuonEDMPrinterTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ MuonEDMPrinterTool()

Muon::MuonEDMPrinterTool::MuonEDMPrinterTool ( const std::string & ty,
const std::string & na,
const IInterface * pa )

constructor

Definition at line 35 of file MuonEDMPrinterTool.cxx.

36 : AthAlgTool(ty, na, pa)
37{
38 declareInterface<MuonEDMPrinterTool>(this);
39}
AthAlgTool()
Default constructor:

◆ ~MuonEDMPrinterTool()

Muon::MuonEDMPrinterTool::~MuonEDMPrinterTool ( )
default

destructor

Member Function Documentation

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ initialize()

StatusCode Muon::MuonEDMPrinterTool::initialize ( )

AlgTool initilize.

Definition at line 41 of file MuonEDMPrinterTool.cxx.

41 {
42 if (parent() != toolSvc()) {
43 ATH_MSG_FATAL("There's no need to make this tool private");
44 return StatusCode::FAILURE;
45 }
46 ATH_CHECK(m_idHelperSvc.retrieve());
47 ATH_CHECK(m_edmHelperSvc.retrieve());
48 ATH_CHECK(m_pullCalculator.retrieve());
49
50 ATH_CHECK(m_DetectorManagerKey.initialize());
51 ATH_CHECK(m_mdtKey.initialize(!m_mdtKey.empty()));
52 ATH_CHECK(m_rpcKey.initialize(!m_rpcKey.empty()));
53 ATH_CHECK(m_tgcKey.initialize(!m_tgcKey.empty()));
54
55
56 return StatusCode::SUCCESS;
57}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_FATAL(x)
SG::ReadHandleKey< MdtPrepDataContainer > m_mdtKey
ServiceHandle< IMuonEDMHelperSvc > m_edmHelperSvc
SG::ReadHandleKey< RpcPrepDataContainer > m_rpcKey
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager > m_DetectorManagerKey
ToolHandle< Trk::IResidualPullCalculator > m_pullCalculator
SG::ReadHandleKey< TgcPrepDataContainer > m_tgcKey
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ interfaceID()

const InterfaceID & Muon::MuonEDMPrinterTool::interfaceID ( )
inlinestatic

access to tool interface

Definition at line 55 of file MuonEDMPrinterTool.h.

56 {
57 static const InterfaceID IID_MuonEDMPrinterTool("Muon::MuonEDMPrinterTool", 1, 0);
58 return IID_MuonEDMPrinterTool;
59 }

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ print() [1/21]

std::string Muon::MuonEDMPrinterTool::print ( const MuonPattern & pattern) const

print MuonPattern

Definition at line 585 of file MuonEDMPrinterTool.cxx.

586{
587 std::ostringstream sout;
588
589 unsigned int nhits = pattern.numberOfContainedPrds();
590 sout << "MuonPattern with " << nhits << " hits" << std::setprecision(5) << " theta "
591 << pattern.globalDirection().theta() << " phi " << pattern.globalDirection().phi() << std::setprecision(1)
592 << " r " << std::setw(5) << (int)pattern.globalPosition().perp() << " z " << std::setw(5)
593 << (int)pattern.globalPosition().z() << std::endl;
594 for (unsigned int i = 0; i < nhits; ++i) {
595 const Trk::PrepRawData* prd = pattern.prd(i);
596 if (!prd) {
597 sout << " ERROR found zero pointer on MuonPattern " << std::endl;
598 continue;
599 }
600 sout << " " << print(*prd);
601 if (i < nhits - 1) sout << std::endl;
602 }
603 return sout.str();
604}
std::string print(const Trk::Track &track) const
print track parameters to string

◆ print() [2/21]

std::string Muon::MuonEDMPrinterTool::print ( const MuonPatternChamberIntersect & intersect) const

print MuonPatternChamberIntersect

&& !detEls.count(detEl)

&& !detEls.count(detEl2)

Definition at line 696 of file MuonEDMPrinterTool.cxx.

697{
698 std::ostringstream sout;
699
700 std::string chIdString("Unknown id");
701 double chTheta(-99.);
702 double chPhi(-99.);
703 // if the intersect is not empty use the Identifier of first hit as chamber ID
704 const Trk::PrepRawData* firstPrd = nullptr;
705 if (!intersect.prepRawDataVec().empty() && intersect.prepRawDataVec().front()) {
706 firstPrd = intersect.prepRawDataVec().front();
707 chIdString = m_idHelperSvc->toStringChamber(firstPrd->identify());
708 chTheta = firstPrd->detectorElement()->center().theta();
709 chPhi = firstPrd->detectorElement()->center().phi();
710 } else {
711 return chIdString;
712 }
713 Identifier chId = m_idHelperSvc->chamberId(firstPrd->identify());
714 int neta = 0;
715 int nphi = 0;
716 bool isMdt = false;
717
718 unsigned int nchannelsEta = 0;
719 unsigned int nchannelsPhi = 0;
720 std::set<const Trk::TrkDetElementBase*> detEls;
721 std::vector<const Trk::PrepRawData*>::const_iterator hit = intersect.prepRawDataVec().begin();
722 std::vector<const Trk::PrepRawData*>::const_iterator hit_end = intersect.prepRawDataVec().end();
723 for (; hit != hit_end; ++hit) {
724 const Trk::PrepRawData* prd = *hit;
725 if (!prd) {
726 sout << " ERROR found zero pointer on MuonPatternChamberIntersect " << std::endl;
727 continue;
728 }
729 const Identifier& id = prd->identify();
730 if (m_idHelperSvc->measuresPhi(id))
731 ++nphi;
732 else
733 ++neta;
734 if (!isMdt && m_idHelperSvc->isMdt(id)) isMdt = true;
735
736 if (!detEls.count(prd->detectorElement())) {
737 detEls.insert(prd->detectorElement());
738
739 if (isMdt && detEls.empty()) {
740
741 SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey};
742 const MuonGM::MuonDetectorManager* MuonDetMgr{*DetectorManagerHandle};
743 if (MuonDetMgr == nullptr) {
744 ATH_MSG_DEBUG("Cannot retrieve DetectorManager ");
745 } else {
746
747 Identifier idml1 = m_idHelperSvc->mdtIdHelper().channelID(id, 1, 1, 1);
748 Identifier idml2 = m_idHelperSvc->mdtIdHelper().channelID(id, 2, 1, 1);
749 const MuonGM::MdtReadoutElement* detEl1 = MuonDetMgr->getMdtReadoutElement(idml1);
750 const MuonGM::MdtReadoutElement* detEl2 = nullptr;
751 if (m_idHelperSvc->mdtIdHelper().numberOfMultilayers(id) == 2) {
752 detEl2 = MuonDetMgr->getMdtReadoutElement(idml2);
753 } else {
754 ATH_MSG_DEBUG("A single multilayer for this station " << m_idHelperSvc->toString(id));
755 }
756 if (detEl1 ) {
757 detEls.insert(detEl1);
758 nchannelsEta += detEl1->getNLayers() * detEl1->getNtubesperlayer();
759 } else {
760 ATH_MSG_DEBUG("Couldn't find first detector element ");
761 }
762 if (detEl2 ) {
763 detEls.insert(detEl2);
764 nchannelsEta += detEl2->getNLayers() * detEl2->getNtubesperlayer();
765 }
766 }
767 } else if (m_idHelperSvc->isTgc(id)) {
768 const MuonGM::TgcReadoutElement* detEl =
769 dynamic_cast<const MuonGM::TgcReadoutElement*>(prd->detectorElement());
770 if (detEl) {
771 for (int i = 1; i <= detEl->nGasGaps(); ++i) {
772 nchannelsEta += detEl->nWireGangs(i);
773 nchannelsPhi += detEl->nStrips(i);
774 }
775 }
776 } else if (m_idHelperSvc->isRpc(id)) {
777 const MuonGM::RpcReadoutElement* detEl =
778 dynamic_cast<const MuonGM::RpcReadoutElement*>(prd->detectorElement());
779 if (detEl) {
780 nchannelsPhi += detEl->nGasGapPerLay() * detEl->NphiStripPanels() * detEl->NphiStrips();
781 nchannelsEta += detEl->NetaStrips();
782 }
783 }
784 }
785 }
786
787 unsigned int nchHitsEta = 0;
788 unsigned int nchHitsPhi = 0;
789
790
791 if (isMdt && !m_mdtKey.empty()) {
792 SG::ReadHandle mdtPrdContainer{m_mdtKey};
793 const MdtPrepDataCollection *coll = mdtPrdContainer->indexFindPtr(m_idHelperSvc->moduleHash(chId));
794 if (coll != nullptr) {
795 nchHitsEta = coll->size();
796 }
797 } else if (m_idHelperSvc->isRpc(chId) && !m_rpcKey.empty()) {
798 SG::ReadHandle rpcPrdContainer{m_rpcKey};
799 const RpcPrepDataCollection* coll = rpcPrdContainer->indexFindPtr(m_idHelperSvc->moduleHash(chId));
800 if (coll != nullptr) {
801 for (const RpcPrepData* prd : *coll) {
802 if (m_idHelperSvc->measuresPhi(prd->identify()))
803 ++nchHitsPhi;
804 else
805 ++nchHitsEta;
806 }
807 }
808 } else if (m_idHelperSvc->isTgc(chId) && !m_tgcKey.empty()) {
809 SG::ReadHandle tgcPrdContainer{m_tgcKey};
810 const TgcPrepDataCollection *coll = tgcPrdContainer->indexFindPtr(m_idHelperSvc->moduleHash(chId));
811 if (coll != nullptr) {
812 for (const TgcPrepData* prd : *coll) {
813 if (m_idHelperSvc->measuresPhi(prd->identify()))
814 ++nchHitsPhi;
815 else
816 ++nchHitsEta;
817 }
818 }
819 }
820
821 sout.setf(std::ios::left);
822 sout << std::setw(33) << chIdString << " neta " << std::setw(3) << neta;
823 if (!isMdt)
824 sout << " nphi " << std::setw(3) << nphi;
825 else
826 sout << " ";
827
828 double scaleEta = nchannelsEta != 0 ? 1. / nchannelsEta : 0.;
829 double scalePhi = nchannelsPhi != 0 ? 1. / nchannelsPhi : 0.;
830 sout << " occupancy eta " << std::fixed << std::setprecision(2) << std::setw(5) << scaleEta * nchHitsEta;
831 if (!isMdt)
832 sout << " phi " << std::fixed << std::setw(5) << scalePhi * nchHitsPhi;
833 else
834 sout << " ";
835
836 sout << std::setprecision(2) << " pat theta " << std::setw(5) << intersect.intersectDirection().theta()
837 << " ch theta " << std::setw(5) << chTheta << " ch phi " << std::setw(6) << chPhi << std::setprecision(1)
838 << " r " << std::setw(5) << (int)intersect.intersectPosition().perp() << " z " << std::setw(5)
839 << (int)intersect.intersectPosition().z();
840
841 return sout.str();
842}
#define ATH_MSG_DEBUG(x)
int getNLayers() const
Returns the number of tube layers inside the multilayer.
int getNtubesperlayer() const
Returns the number of tubes in each tube layer.
const MdtReadoutElement * getMdtReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
int nGasGapPerLay() const
returns the number of gasgaps
int NphiStripPanels() const
returns the number of phi strip panels (1 or 2)
int NphiStrips() const
returns the number of phi strips
int NetaStrips() const
returns the number of eta strips
int nWireGangs(int gasGap) const
Returns the number of wire gangs (Random grouping of wires) in a given gas gap.
int nGasGaps() const
Returns the number of gas gaps associated with the readout element (2 or 3)
int nStrips(int gasGap) const
Returns the number of strips in a given gas gap.
virtual const TrkDetElementBase * detectorElement() const =0
return the detector element corresponding to this PRD The pointer will be zero if the det el is not d...
Identifier identify() const
return the identifier
virtual const Amg::Vector3D & center() const =0
Return the center of the element.
std::optional< double > intersect(const AmgVector(N)&posA, const AmgVector(N)&dirA, const AmgVector(N)&posB, const AmgVector(N)&dirB)
Calculates the point B' along the line B that's closest to a second line A.
MuonPrepDataCollection< TgcPrepData > TgcPrepDataCollection
MuonPrepDataCollection< MdtPrepData > MdtPrepDataCollection
MuonPrepDataCollection< RpcPrepData > RpcPrepDataCollection

◆ print() [3/21]

std::string Muon::MuonEDMPrinterTool::print ( const MuonPatternCollection & patCol) const

print MuonPatternCollection

Definition at line 607 of file MuonEDMPrinterTool.cxx.

608{
609 std::ostringstream sout;
610
611 sout << "MuonPatternCollection with " << patCol.size() << " patterns " << std::endl;
615 --it_last;
616 for (; it != it_end; ++it) {
617 if (!*it) {
618 sout << " WARNING, zero pointer detected in MuonPatternCollection!!! " << std::endl;
619 continue;
620 }
621 sout << " " << print(**it);
622 if (it != it_last) sout << std::endl;
623 }
624 return sout.str();
625}
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.

◆ print() [4/21]

std::string Muon::MuonEDMPrinterTool::print ( const MuonPatternCombination & pattern) const

print MuonPatternCombination

Definition at line 670 of file MuonEDMPrinterTool.cxx.

671{
672 std::ostringstream sout;
673
674 unsigned int nchambers = combi.chamberData().size();
675 sout << "MuonPatternCombination with " << nchambers << " chambers ";
676 const Trk::TrackParameters* pars = combi.trackParameter();
677 if (pars) {
678 sout << " " << print(*pars);
679 } else {
680 sout << " -> combi has no parameters ";
681 }
682 if (!combi.chamberData().empty()) sout << std::endl;
683 std::vector<MuonPatternChamberIntersect>::const_iterator chit = combi.chamberData().begin();
684 std::vector<MuonPatternChamberIntersect>::const_iterator chit_end = combi.chamberData().end();
685 std::vector<MuonPatternChamberIntersect>::const_iterator chit_last = chit_end;
686 --chit_last;
687 for (; chit != chit_end; ++chit) {
688 const MuonPatternChamberIntersect& chamberIntersect = *chit;
689 sout << print(chamberIntersect);
690 if (chit != chit_last) sout << std::endl;
691 }
692 return sout.str();
693}
ParametersBase< TrackParametersDim, Charged > TrackParameters

◆ print() [5/21]

std::string Muon::MuonEDMPrinterTool::print ( const MuonPatternCombinationCollection & combiCol) const

print MuonPatternCombinationCollection

Definition at line 649 of file MuonEDMPrinterTool.cxx.

650{
651 std::ostringstream sout;
652
653 sout << "MuonPatternCombinationCollection with combis " << combiCol.size() << std::endl;
657 --it_last;
658 for (; it != it_end; ++it) {
659 if (!*it) {
660 sout << " WARNING, zero pointer detected in MuonPatternCombinationCollection!!! " << std::endl;
661 continue;
662 }
663 sout << print(**it);
664 if (it != it_last) sout << std::endl;
665 }
666 return sout.str();
667}

◆ print() [6/21]

std::string Muon::MuonEDMPrinterTool::print ( const MuonPrdPatternCollection & patCol) const

print MuonPatternCollection

Definition at line 628 of file MuonEDMPrinterTool.cxx.

629{
630 std::ostringstream sout;
631
632 sout << "MuonPrdPatternCollection with " << patCol.size() << " patterns " << std::endl;
636 --it_last;
637 for (; it != it_end; ++it) {
638 if (!*it) {
639 sout << " WARNING, zero pointer detected in MuonPatternCollection!!! " << std::endl;
640 continue;
641 }
642 sout << " " << print(**it);
643 if (it != it_last) sout << std::endl;
644 }
645 return sout.str();
646}

◆ print() [7/21]

std::string Muon::MuonEDMPrinterTool::print ( const MuonSegment & segment) const

print segment parameters to string

Definition at line 315 of file MuonEDMPrinterTool.cxx.

316{
317
318 std::ostringstream sout;
319
320 // get first none-trigger id
321 Identifier chid = m_edmHelperSvc->chamberId(segment);
322 int nphi = 0;
323 int ntrigEta = 0;
324 int neta = 0;
325
326 const MuonGM::MdtReadoutElement* mdtDetEl = nullptr;
327 Identifier shortestTubeId;
328 double shortestTubeLen = 1e9;
329
330 std::vector<const Trk::MeasurementBase*>::const_iterator hit = segment.containedMeasurements().begin();
331 std::vector<const Trk::MeasurementBase*>::const_iterator hit_end = segment.containedMeasurements().end();
332 for (; hit != hit_end; ++hit) {
333 Identifier id;
334 const Trk::RIO_OnTrack* rot = dynamic_cast<const Trk::RIO_OnTrack*>(*hit);
335 if (rot)
336 id = rot->identify();
337 else {
338 const CompetingMuonClustersOnTrack* crot = dynamic_cast<const CompetingMuonClustersOnTrack*>(*hit);
339 if (crot) id = crot->containedROTs().front()->identify();
340 }
341 if (!id.is_valid()) continue;
342 bool measuresPhi = m_idHelperSvc->measuresPhi(id);
343 bool isTrigger = m_idHelperSvc->isTrigger(id);
344 if (measuresPhi)
345 ++nphi;
346 else if (!isTrigger)
347 ++neta;
348
349 if (!isTrigger) {
350 const MdtDriftCircleOnTrack* mdt = dynamic_cast<const MdtDriftCircleOnTrack*>(rot);
351 if (mdt && mdt->prepRawData()) {
352 double tubelen = 0.5 * mdt->prepRawData()->detectorElement()->tubeLength(id);
353 if (tubelen < shortestTubeLen) {
354 shortestTubeId = id;
355 shortestTubeLen = tubelen;
356 mdtDetEl = mdt->prepRawData()->detectorElement();
357 }
358 }
359 } else {
360 if (!measuresPhi) ++ntrigEta;
361 }
362 }
363
364 sout << m_idHelperSvc->toStringChamber(chid);
365
366 const Trk::FitQuality* fq = segment.fitQuality();
367 if (fq) {
368 sout << std::setprecision(2) << " chi2 " << std::setw(7) << fq->chiSquared();
369 } else {
370 sout << " no fit Quality ";
371 }
372
373 sout << " neta " << std::setw(2) << neta << " nphi " << std::setw(2) << nphi << " nTrigEta " << std::setw(2)
374 << ntrigEta;
375
376 const MuonSegmentQuality* q = dynamic_cast<const MuonSegmentQuality*>(fq);
377 if (q) sout << std::setw(2) << " nholes " << q->numberOfHoles();
378
379
380 sout << " theta " << std::fixed << std::setprecision(5) << std::setw(7) << segment.globalDirection().theta()
381 << " phi " << std::fixed << std::setprecision(3) << std::setw(6) << segment.globalDirection().phi();
382
383 if (segment.hasFittedT0())
384 sout << " T0 " << std::fixed << std::setprecision(2) << std::setw(5) << segment.time() << " err "
385 << std::setw(5) << segment.errorTime();
386
387 if (mdtDetEl) {
388 double posAlongTube = std::abs((mdtDetEl->globalToLocalTransf(shortestTubeId)*segment.globalPosition()).z());
389 double distFromEdge = posAlongTube - shortestTubeLen;
390 if (distFromEdge < -100.)
391 sout << " inside chamber";
392 else if (distFromEdge < -1.)
393 sout << " close to edge";
394 else if (distFromEdge < 0.0001)
395 sout << " on edge";
396 else
397 sout << " outside chamber";
398 }
399 return sout.str();
400}
virtual const MdtPrepData * prepRawData() const override final
Returns the PrepRawData used to create this corrected measurement.
Amg::Transform3D globalToLocalTransf(const int tubeLayer, const int tube) const
bool hasFittedT0() const
returns whether the segment has a fitted t0
virtual const Amg::Vector3D & globalPosition() const override final
global position
double chiSquared() const
returns the of the overall track fit
Definition FitQuality.h:56
Identifier identify() const
return the identifier -extends MeasurementBase
const FitQuality * fitQuality() const
return the FitQuality object, returns NULL if no FitQuality is defined
const std::vector< const Trk::MeasurementBase * > & containedMeasurements() const
returns the vector of Trk::MeasurementBase objects
float errorTime() const
access to the error on the measured time
float time() const
access to the measured time

◆ print() [8/21]

std::string Muon::MuonEDMPrinterTool::print ( const MuonSegmentCombination & combi) const

print MuonSegmentCombination

Definition at line 559 of file MuonEDMPrinterTool.cxx.

560{
561 std::ostringstream sout;
562
563 unsigned int nstations = combi.numberOfStations();
564 sout << "SegmentCombination with stations " << nstations << std::endl;
565
566 // loop over chambers in combi
567 for (unsigned int i = 0; i < nstations; ++i) {
568
569 // loop over segments in station
571
572 // check if not empty
573 if (!stationSegs || stationSegs->empty()) continue;
574
575 // get chamber identifier, chamber index and station index
576 // Identifier chid = m_edmHelperSvc->chamberId( *stationSegs->front() );
577 sout << print(*stationSegs);
578 if (i != nstations - 1) sout << std::endl;
579 }
580
581 return sout.str();
582}
SegmentVec * stationSegments(unsigned int index) const
Access to segments in a given station.
unsigned int numberOfStations() const
Number of stations with segment.
std::vector< std::unique_ptr< MuonSegment > > SegmentVec

◆ print() [9/21]

std::string Muon::MuonEDMPrinterTool::print ( const MuonSegmentCombinationCollection & combiCol) const

print MuonSegmentCombinationCollection

Definition at line 538 of file MuonEDMPrinterTool.cxx.

539{
540 std::ostringstream sout;
541
542 sout << "MuonSegmentCombinationCollection with combis " << combiCol.size() << std::endl;
546 --it_last;
547 for (; it != it_end; ++it) {
548 if (!*it) {
549 sout << " WARNING, zero pointer detected in MuonSegmentCombinationCollection!!! " << std::endl;
550 continue;
551 }
552 sout << print(**it);
553 if (it != it_last) sout << std::endl;
554 }
555 return sout.str();
556}

◆ print() [10/21]

std::string Muon::MuonEDMPrinterTool::print ( const std::vector< const MuonSegment * > & segs) const

print vector of segments

Definition at line 494 of file MuonEDMPrinterTool.cxx.

495{
496
497 std::ostringstream sout;
498
499 std::vector<const MuonSegment*>::const_iterator it = segs.begin();
500 std::vector<const MuonSegment*>::const_iterator it_end = segs.end();
501 std::vector<const MuonSegment*>::const_iterator it_last = it_end;
502 --it_last;
503 for (; it != it_end; ++it) {
504 if (!*it) {
505 sout << " WARNING, zero pointer detected in MuonSegment vector!!! " << std::endl;
506 continue;
507 }
508 sout << print(**it);
509 if (it != it_last) sout << std::endl;
510 }
511
512 return sout.str();
513}

◆ print() [11/21]

std::string Muon::MuonEDMPrinterTool::print ( const std::vector< const Trk::MeasurementBase * > & measurements) const

print vector of measurement base to string

Definition at line 455 of file MuonEDMPrinterTool.cxx.

456{
457
458 std::ostringstream sout;
459
460 // first loop to get width of Id's for nice alignment
461 std::vector<std::string> idStrings;
462 std::vector<std::string> dataStrings;
463 unsigned int idWidth = 0;
464
465 std::vector<const Trk::MeasurementBase*>::const_iterator hit = measurements.begin();
466 std::vector<const Trk::MeasurementBase*>::const_iterator hit_end = measurements.end();
467 // std::vector< const Trk::MeasurementBase* >::const_iterator hit_last = hit_end;
468 for (; hit != hit_end; ++hit) {
469 if (!*hit) {
470 sout << " WARNING, zero pointer detected in MeasurementBase vector!!! " << std::endl;
471 continue;
472 }
473 // Identifier part
474 std::string idStr = printId(**hit);
475 idStrings.push_back(idStr);
476 if (idStr.length() > idWidth) idWidth = idStr.length();
477 // Data part
478 std::string dataStr = printData(**hit);
479 dataStrings.push_back(dataStr);
480 }
481
482
483 // second loop to print out aligned strings
484 unsigned int n = idStrings.size();
485 for (unsigned int i = 0; i < n; ++i) {
486 sout << std::left << std::setw(idWidth) << idStrings[i] << std::right << " " << dataStrings[i];
487 if (i != n - 1) sout << std::endl;
488 }
489
490 return sout.str();
491}
std::string printData(const Trk::MeasurementBase &measurement) const
print data part of Muon MeasurementBase to string
std::string printId(const Trk::MeasurementBase &measurement) const
print identifier part of Muon MeasurementBase to string

◆ print() [12/21]

std::string Muon::MuonEDMPrinterTool::print ( const Trk::AlignmentEffectsOnTrack & aeot)
static

print the alignment effects on track object to the string

Definition at line 995 of file MuonEDMPrinterTool.cxx.

995 {
996 std::stringstream aeot_string;
997 aeot_string<<"dTrans: "<<aeot.deltaTranslation()<<" +- "<<aeot.sigmaDeltaTranslation();
998 aeot_string<<" dAngle: "<<aeot.deltaAngle()<<" +- "<<aeot.sigmaDeltaAngle();
999 return aeot_string.str();
1000}
double sigmaDeltaAngle() const
returns the
double deltaAngle() const
returns the
double sigmaDeltaTranslation() const
returns the
double deltaTranslation() const
returns the

◆ print() [13/21]

std::string Muon::MuonEDMPrinterTool::print ( const Trk::MaterialEffectsBase & mat)
static

print the material effects object to the string

Definition at line 969 of file MuonEDMPrinterTool.cxx.

969 {
970 std::stringstream mat_string{};
971 const Trk::MaterialEffectsOnTrack* matOnTrk = dynamic_cast<const Trk::MaterialEffectsOnTrack*>(&mat);
972 if (matOnTrk) {
973 const Trk::ScatteringAngles* scatAng = matOnTrk->scatteringAngles();
974 if (scatAng) {
975 mat_string<<" dPhi: "<<scatAng->deltaPhi()<<" +- "<<scatAng->sigmaDeltaPhi()<< " / ";
976 mat_string<<" dTheta: "<<scatAng->deltaTheta()<<" +- "<<scatAng->sigmaDeltaTheta()<<" ";
977 }
978 const Trk::EnergyLoss* eloss = matOnTrk->energyLoss();
979 if (eloss) {
980 mat_string<<" deltaE: "<<eloss->deltaE();
981 if (std::abs(std::abs(eloss->sigmaMinusDeltaE()) - std::abs(eloss->sigmaPlusDeltaE())) > std::numeric_limits<float>::epsilon()) {
982 mat_string<<" +/- "<<eloss->sigmaPlusDeltaE()<<"/"<<eloss->sigmaMinusDeltaE();
983 } else {
984 mat_string<<" +- "<<eloss->sigmaDeltaE();
985 }
986 mat_string<<" Ion: "<<eloss->meanIoni()<<" +- "<<eloss->sigmaIoni();
987 mat_string<<" Rad: "<<eloss->meanRad()<<" +- "<<eloss->sigmaRad();
988 mat_string<<" Length "<<eloss->length();
989 }
990 mat_string<<" ";
991
992 }
993 return mat_string.str();
994}
double meanRad() const
double length() const
double sigmaPlusDeltaE() const
returns the positive side
double sigmaMinusDeltaE() const
returns the negative side
double sigmaIoni() const
double meanIoni() const
double sigmaDeltaE() const
returns the symmatric error
double sigmaRad() const
double deltaE() const
returns the
const EnergyLoss * energyLoss() const
returns the energy loss object.
const ScatteringAngles * scatteringAngles() const
returns the MCS-angles object.
double sigmaDeltaPhi() const
returns the
double deltaPhi() const
returns the
double sigmaDeltaTheta() const
returns the
double deltaTheta() const
returns the

◆ print() [14/21]

std::string Muon::MuonEDMPrinterTool::print ( const Trk::MeasurementBase & measurement) const

print Muon MeasurementBase to string

Definition at line 448 of file MuonEDMPrinterTool.cxx.

449{
450 return printId(measurement) + " " + printData(measurement);
451}

◆ print() [15/21]

std::string Muon::MuonEDMPrinterTool::print ( const Trk::MuonTrackSummary & summary) const

print stations on track to string

Definition at line 60 of file MuonEDMPrinterTool.cxx.

61{
62
63 std::ostringstream sout;
64 // create detailed track summary
65 typedef Trk::MuonTrackSummary::ChamberHitSummary ChamberHitSummary;
66
67 sout << "Hits: eta " << summary.netaHits() << " phi " << summary.nphiHits() << " holes " << summary.nholes()
68 << " outliers " << summary.noutliers() << " pseudo " << summary.npseudoMeasurements() << " scatterers "
69 << summary.nscatterers() << " close Hits " << summary.ncloseHits() << std::endl;
70
71
72 const std::vector<ChamberHitSummary>& chamberHitSummary = summary.chamberHitSummary();
73 sout.setf(std::ios::left);
74 std::vector<ChamberHitSummary>::const_iterator chit = chamberHitSummary.begin();
75 std::vector<ChamberHitSummary>::const_iterator chit_end = chamberHitSummary.end();
76 std::vector<ChamberHitSummary>::const_iterator chit_last = chit_end - 1;
77 for (; chit != chit_end; ++chit) {
78 const Identifier& chId = chit->chamberId();
79 bool isMdt = m_idHelperSvc->isMdt(chId);
80
81 sout << " " << std::setw(35) << m_idHelperSvc->toStringChamber(chId);
82
83 const ChamberHitSummary::Projection& first = isMdt ? chit->mdtMl1() : chit->etaProjection();
84 const ChamberHitSummary::Projection& second = isMdt ? chit->mdtMl2() : chit->phiProjection();
85
86
87 std::string firstString = isMdt ? "ml1 " : "eta ";
88 std::string secondString = isMdt ? "ml2 " : "phi ";
89
90 sout << " Hits: " << firstString << std::setw(3) << first.nhits << " " << secondString << std::setw(3)
91 << second.nhits;
92
93 if (first.nholes || second.nholes) {
94 sout << " Holes: ";
95 if (first.nholes != 0) sout << firstString << std::setw(3) << first.nholes;
96 if (second.nholes != 0) {
97 if (first.nholes != 0) sout << " ";
98 sout << secondString << std::setw(3) << second.nholes;
99 }
100 }
101 if (first.noutliers || second.noutliers) {
102 sout << " Outliers: ";
103 if (first.noutliers != 0) sout << firstString << std::setw(3) << first.noutliers << " ";
104 if (second.noutliers != 0) {
105 if (first.noutliers != 0) sout << " ";
106 sout << secondString << std::setw(3) << second.noutliers;
107 }
108 }
109
110 if (first.ndeltas || second.ndeltas) {
111 sout << " Deltas: ";
112 if (first.ndeltas != 0) sout << firstString << std::setw(3) << first.ndeltas << " ";
113 if (second.ndeltas != 0) {
114 if (first.ndeltas != 0) sout << " ";
115 sout << secondString << std::setw(3) << second.ndeltas;
116 }
117 }
118
119 if (first.ncloseHits || second.ncloseHits) {
120 sout << " Close Hits: ";
121 if (first.ncloseHits != 0) sout << firstString << std::setw(3) << first.ncloseHits << " ";
122 if (second.ncloseHits != 0) {
123 if (first.ncloseHits != 0) sout << " ";
124 sout << secondString << std::setw(3) << second.ncloseHits;
125 }
126 }
127
128 if (chit != chit_last) sout << std::endl;
129 }
130
131 return sout.str();
132}
bool first
Definition DeMoScan.py:534

◆ print() [16/21]

std::string Muon::MuonEDMPrinterTool::print ( const Trk::PrepRawData & prd) const

print Muon PrepRawData to string

Definition at line 403 of file MuonEDMPrinterTool.cxx.

404{
405
406 std::ostringstream sout;
407
408 Identifier id = prd.identify();
409 sout << m_idHelperSvc->toString(id) << " ";
410
411 const Amg::Vector3D* pos = nullptr;
412 const MuonCluster* cl = dynamic_cast<const MuonCluster*>(&prd);
413 if (cl)
414 pos = &cl->globalPosition();
415 else {
416 const MdtPrepData* mdt = dynamic_cast<const MdtPrepData*>(&prd);
417 if (mdt)
418 pos = &mdt->detectorElement()->surface(id).center();
419 else {
420 const CscStripPrepData* strip = dynamic_cast<const CscStripPrepData*>(&prd);
421 if (strip) pos = &strip->globalPosition();
422 }
423 }
424 if (!pos)
425 sout << " unknown type of muon prepdata " << std::endl;
426 else {
427 double h_r = pos->perp();
428 double h_z = pos->z();
429 double h_phi = pos->phi();
430 double h_theta = pos->theta();
431 double error = std::sqrt(prd.localCovariance()(0, 0));
432
433 // add time for RPC
434 double rpcTime = 0.0;
435 const RpcPrepData* rpc = dynamic_cast<const RpcPrepData*>(&prd);
436 if (rpc) rpcTime = rpc->time();
437
438 sout << "r " << std::fixed << std::setprecision(0) << std::setw(5) << h_r << " z " << std::fixed
439 << std::setprecision(0) << std::setw(5) << h_z << " theta " << std::fixed << std::setprecision(3)
440 << std::setw(4) << h_theta << " phi " << std::fixed << std::setprecision(3) << std::setw(4) << h_phi
441 << " error " << std::fixed << std::setprecision(2) << std::setw(5) << error;
442 if (rpc) sout << " time " << std::fixed << std::setprecision(2) << std::setw(5) << rpcTime;
443 }
444 return sout.str();
445}
const Amg::MatrixX & localCovariance() const
return const ref to the error matrix
Eigen::Matrix< double, 3, 1 > Vector3D
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]

◆ print() [17/21]

std::string Muon::MuonEDMPrinterTool::print ( const Trk::ResidualPull & resPull)
static

print ResidualPull object to string

Definition at line 861 of file MuonEDMPrinterTool.cxx.

862{
863 std::ostringstream sout;
864
865 const std::vector<double>& residual = resPull.residual();
866 const std::vector<double>& pull = resPull.pull();
867 for (unsigned int i = 0; i < residual.size(); ++i) {
868 if (residual[i] != 999. && residual[i] != -999.)
869 sout << " residual " << std::setprecision(3) << std::setw(8) << residual[i] << " ";
870 }
871 sout << " pull ";
872 for (unsigned int i = 0; i < pull.size(); ++i) sout << std::setprecision(3) << std::setw(8) << pull[i] << " ";
873 return sout.str();
874}
const std::vector< double > & residual() const
return residual vector
const std::vector< double > & pull() const
return pull vector

◆ print() [18/21]

std::string Muon::MuonEDMPrinterTool::print ( const Trk::Track & track) const

print track parameters to string

Definition at line 279 of file MuonEDMPrinterTool.cxx.

280{
281
282 std::ostringstream sout;
283
284 sout << printPatRec(track);
285
286 const Trk::FitQuality* fq = track.fitQuality();
287 if (fq) {
288 sout << std::setprecision(4) << " : chi2 " << fq->chiSquared() << " ndof " << fq->numberDoF();
289 } else {
290 sout << " no fit Quality ";
291 }
292 const Trk::Perigee* pp = track.perigeeParameters();
293 if (pp) {
294 sout << " " << print(*pp);
295 } else {
296 sout << " no perigee ";
297 }
298 sout <<std::endl;
299 sout<<"----- Track states -------"<<std::endl;
300 unsigned int n{1};
301 for (const Trk::TrackStateOnSurface* tsos : *track.trackStateOnSurfaces()) {
302 if (tsos->measurementOnTrack()) sout<<" **** "<<std::setw(3)<<n<<" Measurement: "<<print(*tsos->measurementOnTrack())<<std::endl;
303 if (tsos->materialEffectsOnTrack()) sout<<" **** "<<std::setw(3)<<n<<" Material: "<<print(*tsos->materialEffectsOnTrack())<<std::endl;
304 if (tsos->alignmentEffectsOnTrack()) sout<<" **** "<<std::setw(3)<<n<<" AEOT: "<<print(*tsos->alignmentEffectsOnTrack())<<std::endl;
305 if (tsos->trackParameters()) sout<<" **** "<<std::setw(3)<<n<<" Parameters: "<<print(*tsos->trackParameters())<<std::endl;
306 ++n;
307 }
308 sout<<"-----------------------------"<<std::endl;
309
310 return sout.str();
311}
static std::string printPatRec(const Trk::Track &track)
produce a string indicating who produced the track
int numberDoF() const
returns the number of degrees of freedom of the overall track or vertex fit as integer
Definition FitQuality.h:60
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee

◆ print() [19/21]

std::string Muon::MuonEDMPrinterTool::print ( const Trk::TrackParameters & pars)
static

print Trk::TrackParameters

Definition at line 845 of file MuonEDMPrinterTool.cxx.

846{
847 std::ostringstream sout;
848 sout << "r " << std::fixed << std::setprecision(0) << std::setw(5)
849 << pars.position().perp()
850 << " z " << std::fixed << std::setprecision(0) << std::setw(6) << pars.position().z() << " theta "
851 << std::fixed << std::setprecision(5) << std::setw(7) << pars.momentum().theta()<< " eta "
852 << std::fixed << std::setprecision(5) << std::setw(7) << pars.momentum().eta() << " phi " << std::fixed
853 << std::setprecision(3) << std::setw(6) << pars.momentum().phi() << " q*p(GeV) " << std::scientific
854 << std::setprecision(3) << std::setw(10) << pars.momentum().mag() * pars.charge() * 1e-3 << " pT(GeV) "
855 << std::scientific << std::setprecision(3) << std::setw(9) << pars.momentum().perp() * 1e-3;
856
857 return sout.str();
858}

◆ print() [20/21]

std::string Muon::MuonEDMPrinterTool::print ( const Trk::TrackStateOnSurface & tsos) const

print the track state on surface to the string

Definition at line 1002 of file MuonEDMPrinterTool.cxx.

1002 {
1003 std::stringstream tsos_str{};
1004 if (tsos.measurementOnTrack()) tsos_str<<"Measurement: "<<print(*tsos.measurementOnTrack())<<"\t";
1005 if (tsos.materialEffectsOnTrack()) tsos_str<<"Material "<<print(*tsos.materialEffectsOnTrack())<<"\t";
1006 if (tsos.trackParameters()) tsos_str<<"Parameters: "<<print(*tsos.trackParameters())<<"\t";
1007
1008 return tsos_str.str();
1009}
const MeasurementBase * measurementOnTrack() const
returns MeasurementBase const overload
const TrackParameters * trackParameters() const
return ptr to trackparameters const overload
const MaterialEffectsBase * materialEffectsOnTrack() const
return material effects const overload

◆ print() [21/21]

std::string Muon::MuonEDMPrinterTool::print ( std::vector< std::unique_ptr< MuonSegment > > & segs) const

Definition at line 516 of file MuonEDMPrinterTool.cxx.

517{
518
519 std::ostringstream sout;
520
521 std::vector<std::unique_ptr<MuonSegment> >::iterator it = segs.begin();
522 std::vector<std::unique_ptr<MuonSegment> >::iterator it_end = segs.end();
523 std::vector<std::unique_ptr<MuonSegment> >::iterator it_last = it_end;
524 --it_last;
525 for (; it != it_end; ++it) {
526 if (!*it) {
527 sout << " WARNING, zero pointer detected in MuonSegment vector!!! " << std::endl;
528 continue;
529 }
530 sout << print(**it);
531 if (it != it_last) sout << std::endl;
532 }
533
534 return sout.str();
535}

◆ printData()

std::string Muon::MuonEDMPrinterTool::printData ( const Trk::MeasurementBase & measurement) const

print data part of Muon MeasurementBase to string

Definition at line 878 of file MuonEDMPrinterTool.cxx.

879{
880 std::ostringstream sout;
881
882 // print position of hit
883 double h_r = measurement.globalPosition().perp();
884 double h_z = measurement.globalPosition().z();
885 double h_phi = measurement.globalPosition().phi();
886 double h_theta = measurement.globalPosition().theta();
887 double error = std::sqrt(measurement.localCovariance()(0, 0));
888 const Trk::LocalParameters& lpars = measurement.localParameters();
889 double local_pos = lpars.contains(Trk::locX) ? lpars[Trk::locX] : (lpars.contains(Trk::locY) ? lpars[Trk::locY] : 0.);
890 sout << "r " << std::fixed << std::setprecision(0) << std::setw(5) << h_r << " z " << std::fixed
891 << std::setprecision(0) << std::setw(5) << h_z << " phi " << std::fixed << std::setprecision(3) << std::setw(4)
892 << h_phi << " theta " << std::fixed << std::setprecision(3) << std::setw(4) << h_theta
893 << " lPos " << std::fixed << std::setprecision(2) << std::setw(5) << local_pos
894 << " error " << std::fixed << std::setprecision(2) << std::setw(5) << error;
895
896
897 // print measurement data
898 const Trk::RIO_OnTrack* rot = dynamic_cast<const Trk::RIO_OnTrack*>(&measurement);
899 if (rot) {
900 // add drift time for MDT
901 const MdtDriftCircleOnTrack* mdt = dynamic_cast<const MdtDriftCircleOnTrack*>(rot);
902 if (mdt) {
903 sout << " r_drift " << std::fixed << std::setprecision(2) << std::setw(5) << mdt->driftRadius();
904
905 } else {
906 // add time for RPC
907 const RpcClusterOnTrack* rpc = dynamic_cast<const RpcClusterOnTrack*>(rot);
908 if (rpc) {
909 const RpcPrepData* rpcPRD = rpc->prepRawData();
910 if (rpcPRD) {
911 sout << " time " << std::fixed << std::setprecision(2) << std::setw(5) << rpcPRD->time();
912 }
913 }
914 }
915 } else { // !rot
916 // if we get here: not a ROT, maybe a CROT
917 const CompetingMuonClustersOnTrack* crot = dynamic_cast<const CompetingMuonClustersOnTrack*>(&measurement);
918 if (crot) {
919 unsigned int nlayers = 0;
920 unsigned int nhits = 0;
921 std::set<Identifier> layers;
922 std::vector<double> rpcTimes;
923 const std::vector<const MuonClusterOnTrack*>& rots = crot->containedROTs();
924 nhits = rots.size();
925 rpcTimes.reserve(nhits);
926 std::vector<const MuonClusterOnTrack*>::const_iterator itR = rots.begin(), itR_end = rots.end();
927 for (; itR != itR_end; ++itR) {
928 Identifier layerId = m_idHelperSvc->layerId((*itR)->identify());
929 layers.insert(layerId);
930 const RpcClusterOnTrack* rpc = dynamic_cast<const RpcClusterOnTrack*>(*itR);
931 const RpcPrepData* rpcPRD = rpc ? rpc->prepRawData() : nullptr;
932 if (rpcPRD) rpcTimes.push_back(rpcPRD->time());
933 }
934 nlayers = layers.size();
935 sout << " CompRot: hits " << nhits << " layers " << nlayers;
936 // add time for RPC
937 if (!rpcTimes.empty()) {
938 sout << (rpcTimes.size() == 1 ? " time" : " times") << std::fixed << std::setprecision(2);
939 std::vector<double>::iterator itD = rpcTimes.begin(), itD_end = rpcTimes.end();
940 for (; itD != itD_end; ++itD) sout << " " << std::setw(5) << *itD;
941 }
942 } // if crot
943 } // else !rot
944
945 return sout.str();
946} // printData( Trk::MeasurementBase )
double driftRadius() const
Returns the value of the drift radius.
bool contains(ParamDefs par) const
The simple check for the clients whether the parameter is contained.
const LocalParameters & localParameters() const
Interface method to get the LocalParameters.
virtual const Amg::Vector3D & globalPosition() const =0
Interface method to get the global Position.
const Amg::MatrixX & localCovariance() const
Interface method to get the localError.
layers(flags, cells_name, *args, **kw)
Here we define wrapper functions to set up all of the standard corrections.
@ locY
local cartesian
Definition ParamDefs.h:38
@ locX
Definition ParamDefs.h:37

◆ printId()

std::string Muon::MuonEDMPrinterTool::printId ( const Trk::MeasurementBase & measurement) const

print identifier part of Muon MeasurementBase to string

Definition at line 950 of file MuonEDMPrinterTool.cxx.

951{
952 std::string idStr;
953 Identifier id = m_edmHelperSvc->getIdentifier(measurement);
954 if (!id.is_valid()) {
955 const Trk::PseudoMeasurementOnTrack* pseudo = dynamic_cast<const Trk::PseudoMeasurementOnTrack*>(&measurement);
956 if (pseudo)
957 idStr = "pseudo measurement";
958 else
959 idStr = "no Identifier";
960 } else if (!m_idHelperSvc->isMuon(id)) {
961 idStr = "Id hit";
962 } else {
963 idStr = m_idHelperSvc->toString(id);
964 }
965
966 return idStr;
967}

◆ printMeasurements()

std::string Muon::MuonEDMPrinterTool::printMeasurements ( const Trk::Track & track) const

print measurements on track to string

Definition at line 154 of file MuonEDMPrinterTool.cxx.

155{
156 std::ostringstream sout;
157 const Trk::TrackStates* states = track.trackStateOnSurfaces();
158 if (!states) return "";
163 // Build map of AEOTs and the measurements they affect
164 std::multimap<const Trk::MeasurementBase*, const Trk::AlignmentEffectsOnTrack*> measAndTheirAlignmentEffects;
165 const Trk::MeasurementBase* m = nullptr;
166 const Trk::AlignmentEffectsOnTrack* aeot = nullptr;
167 for (; it != it_end; ++it) {
168 aeot = (*it)->alignmentEffectsOnTrack();
169 if (aeot) {
170 // Now get the list of identifiers which this AEOT impacts.
171 const std::vector<Identifier>& identifiers = aeot->vectorOfAffectedTSOS();
172 it2 = states->begin();
173 it2_end = states->end();
174 for (; it2 != it2_end; ++it2) {
175 m = (*it2)->measurementOnTrack();
176 if (m) {
177 Identifier id = m_edmHelperSvc->getIdentifier(*m);
178 if ((id.is_valid() && (std::find(identifiers.begin(), identifiers.end(), id) != identifiers.end()))
179 || (aeot->effectsLastFromNowOn() && it2 > it))
180 {
181 // Either this measurement is explicitly listed, OR it is in a TSOS after an AEOT whose effects
182 // last from now on.
183 measAndTheirAlignmentEffects.insert(
184 std::pair<const Trk::MeasurementBase*, const Trk::AlignmentEffectsOnTrack*>(m, aeot));
185 }
186 }
187 }
188 }
189 }
190 // std::cout << " measAndTheirAlignmentEffects " << measAndTheirAlignmentEffects.size() << std::endl;
191
192 // Reset
193 it = states->begin();
194 it_end = states->end();
195 // first loop to get width of Id's for nice alignment
196 std::vector<std::string> idStrings;
197 std::vector<std::string> dataStrings;
198 unsigned int idWidth = 0;
199 for (; it != it_end; ++it) {
200 m = (*it)->measurementOnTrack();
201 if (m) {
202 // Identifier part
203 std::string idStr = printId(*m);
204 idStrings.push_back(idStr);
205 if (idStr.length() > idWidth) idWidth = idStr.length();
206 // Data part
207 const Trk::TrackParameters* trackParameters = (*it)->trackParameters();
208 std::string dataStr = printData(*m);
209 if (trackParameters) {
210 std::multimap<const Trk::MeasurementBase*, const Trk::AlignmentEffectsOnTrack*>::iterator itMap =
211 measAndTheirAlignmentEffects.begin();
212 itMap = measAndTheirAlignmentEffects.find(m);
213 if (itMap != measAndTheirAlignmentEffects.end()) {
214 std::vector<const Trk::AlignmentEffectsOnTrack*> aeotos;
215 aeotos.push_back(itMap->second);
216 ++itMap;
217 if (itMap != measAndTheirAlignmentEffects.end() && itMap->first == m)
218 aeotos.push_back(itMap->second);
219 std::optional<Trk::ResidualPull> resPull{m_pullCalculator->residualPull(
220 m, trackParameters, Trk::ResidualPull::Unbiased, Trk::TrackState::unidentified, aeotos)};
221 if (resPull) dataStr += print(*resPull);
222 if (resPull) dataStr += " (AEOT)";
223 } else {
224 std::optional<Trk::ResidualPull> resPull{
225 m_pullCalculator->residualPull(m, trackParameters, Trk::ResidualPull::Unbiased)};
226 if (resPull) dataStr += print(*resPull);
227 }
228 }
229 if ((*it)->type(Trk::TrackStateOnSurface::Outlier)) {
230 dataStr += " (Outlier)";
231 } else if ((*it)->type(Trk::TrackStateOnSurface::Hole)) {
232 dataStr += " (Hole)";
233 }
234 dataStrings.push_back(dataStr);
235 }
236 aeot = (*it)->alignmentEffectsOnTrack();
237 if (aeot) {
238 std::string idStr = " AEOT ";
239 idStrings.push_back(idStr);
240 std::ostringstream souta;
241 souta << std::setprecision(3) << " deltaTranslation (mm) " << aeot->deltaTranslation() << " error "
242 << aeot->sigmaDeltaTranslation() << " deltaAngle (mrad) " << 1000 * aeot->deltaAngle() << " error "
243 << 1000 * aeot->sigmaDeltaAngle();
244 dataStrings.push_back(souta.str());
245 }
246 }
247
248 // second loop to print out aligned strings
249 unsigned int n = idStrings.size();
250 for (unsigned int i = 0; i < n; ++i) {
251 sout << std::left << std::setw(idWidth) << idStrings[i] << std::right << " " << dataStrings[i];
252 if (i != n - 1) sout << std::endl;
253 }
254
255 return sout.str();
256}
const std::vector< Identifier > & vectorOfAffectedTSOS() const
Returns a vector of the affected TSOS in the track.
bool effectsLastFromNowOn() const
Returns true if the effects of this AlignmentEffectsOnTrack apply to all remaining TrackStatesOnSurfa...
@ Unbiased
RP with track state that has measurement not included.
@ Outlier
This TSoS contains an outlier, that is, it contains a MeasurementBase/RIO_OnTrack which was not used ...
@ Hole
A hole on the track - this is defined in the following way.
std::vector< Identifier > identifiers(const InDetSimDataCollection &coll)
DataVector< const Trk::TrackStateOnSurface > TrackStates

◆ printPatRec()

std::string Muon::MuonEDMPrinterTool::printPatRec ( const Trk::Track & track)
static

produce a string indicating who produced the track

Definition at line 260 of file MuonEDMPrinterTool.cxx.

261{
262 if (track.info().patternRecoInfo(Trk::TrackInfo::STACO)) return "STACO";
263 if (track.info().patternRecoInfo(Trk::TrackInfo::StacoLowPt)) return "StacoLowPt";
264 if (track.info().patternRecoInfo(Trk::TrackInfo::Muonboy)) return "Muonboy";
265 if (track.info().patternRecoInfo(Trk::TrackInfo::MuTag)) return "MuTag";
266 if (track.info().patternRecoInfo(Trk::TrackInfo::MuidComb)
267 || track.info().patternRecoInfo(Trk::TrackInfo::MuidCombined))
268 return "MuidCombined";
269 if (track.info().patternRecoInfo(Trk::TrackInfo::MuidStandAlone)) return "MuidStandAlone";
270 if (track.info().patternRecoInfo(Trk::TrackInfo::Moore)) return "Moore";
271 if (track.info().patternRecoInfo(Trk::TrackInfo::MuGirl)) return "MuGirl";
272 if (track.info().patternRecoInfo(Trk::TrackInfo::MuGirlUnrefitted)) return "MuGirlUnrefitted";
273 if (track.info().patternRecoInfo(Trk::TrackInfo::MuidVertexAssociator)) return "MuidVertexAssociator";
274 if (track.info().patternRecoInfo(Trk::TrackInfo::MuGirlLowBeta)) return "MuGirlLowBeta";
275 return "Unknown";
276}
@ StacoLowPt
Tracks produced by StacoLowpt.
@ MuGirlUnrefitted
Tracks from MuGirl not refitted with iPat.
@ MuidComb
Back compatibility with older ESD versions.

◆ printStations()

std::string Muon::MuonEDMPrinterTool::printStations ( const Trk::Track & track) const

print stations on track to string

Definition at line 136 of file MuonEDMPrinterTool.cxx.

137{
138
139 const Trk::MuonTrackSummary* muonSummary = nullptr;
140
141 // check if the track already has a MuonTrackSummary, if not calculate it using the helper
142 const Trk::TrackSummary* summary = track.trackSummary();
143 if (summary) muonSummary = summary->muonTrackSummary();
144 if (!muonSummary) {
145 ATH_MSG_WARNING("No muon summary is present");
146 return "";
147 }
148
149 return print(*muonSummary);
150}
#define ATH_MSG_WARNING(x)

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_DetectorManagerKey

SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> Muon::MuonEDMPrinterTool::m_DetectorManagerKey
private
Initial value:
{
this,
"DetectorManagerKey",
"MuonDetectorManager",
"Key of input MuonDetectorManager condition data",
}

Definition at line 155 of file MuonEDMPrinterTool.h.

155 {
156 this,
157 "DetectorManagerKey",
158 "MuonDetectorManager",
159 "Key of input MuonDetectorManager condition data",
160 };

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_edmHelperSvc

ServiceHandle<IMuonEDMHelperSvc> Muon::MuonEDMPrinterTool::m_edmHelperSvc
private
Initial value:
{
this,
"edmHelper",
"Muon::MuonEDMHelperSvc/MuonEDMHelperSvc",
"Handle to the service providing the IMuonEDMHelperSvc interface",
}

Definition at line 142 of file MuonEDMPrinterTool.h.

142 {
143 this,
144 "edmHelper",
145 "Muon::MuonEDMHelperSvc/MuonEDMHelperSvc",
146 "Handle to the service providing the IMuonEDMHelperSvc interface",
147 };

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_idHelperSvc

ServiceHandle<Muon::IMuonIdHelperSvc> Muon::MuonEDMPrinterTool::m_idHelperSvc
private
Initial value:
{
this,
"MuonIdHelperSvc",
"Muon::MuonIdHelperSvc/MuonIdHelperSvc",
}

Definition at line 137 of file MuonEDMPrinterTool.h.

137 {
138 this,
139 "MuonIdHelperSvc",
140 "Muon::MuonIdHelperSvc/MuonIdHelperSvc",
141 };

◆ m_mdtKey

SG::ReadHandleKey<MdtPrepDataContainer> Muon::MuonEDMPrinterTool::m_mdtKey
private
Initial value:
{
this,
"MdtPrdCollection",
"MDT_DriftCircles",
"MDT PRD Container",
}

Definition at line 161 of file MuonEDMPrinterTool.h.

161 {
162 this,
163 "MdtPrdCollection",
164 "MDT_DriftCircles",
165 "MDT PRD Container",
166 };

◆ m_pullCalculator

ToolHandle<Trk::IResidualPullCalculator> Muon::MuonEDMPrinterTool::m_pullCalculator
private
Initial value:
{
this,
"ResidualPullCalculator",
"Trk::ResidualPullCalculator/ResidualPullCalculator",
}

Definition at line 149 of file MuonEDMPrinterTool.h.

149 {
150 this,
151 "ResidualPullCalculator",
152 "Trk::ResidualPullCalculator/ResidualPullCalculator",
153 };

◆ m_rpcKey

SG::ReadHandleKey<RpcPrepDataContainer> Muon::MuonEDMPrinterTool::m_rpcKey
private
Initial value:
{
this,
"RpcPrdCollection",
"RPC_Measurements",
"RPC PRD Container",
}

Definition at line 167 of file MuonEDMPrinterTool.h.

167 {
168 this,
169 "RpcPrdCollection",
170 "RPC_Measurements",
171 "RPC PRD Container",
172 };

◆ m_tgcKey

SG::ReadHandleKey<TgcPrepDataContainer> Muon::MuonEDMPrinterTool::m_tgcKey
private
Initial value:
{
this,
"TgcPrdCollection",
"TGC_Measurements",
"TGC PRD Container",
}

Definition at line 173 of file MuonEDMPrinterTool.h.

173 {
174 this,
175 "TgcPrdCollection",
176 "TGC_Measurements",
177 "TGC PRD Container",
178 };

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: