ATLAS Offline Software
Loading...
Searching...
No Matches
MuonCalibExtendedRawHits.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7#include <sstream>
8
21
22namespace MuonCalib {
23
25
27 const std::vector<ExtendedSegPtr>& segments,
28 const std::vector<ExtendedTrkPtr>& tracks) :
29 m_adcThreshold(70.) {
31 // loop over MDT raw hits and
32 for (const MdtCalibRawHitPtr& rawHit : rawHits.MdtContainer()) {
33 const MuonFixedId id = rawHit->identify();
34 // create ChamberId + StationIndex
35 MuonFixedId chId = idManip.chamberIdentifier(id);
36 MuonFixedIdManipulator::StationIndex stationIndex = idManip.stationLayerIndex(id);
37
38 MdtRegionInfo& chInfo = m_mdtChamberIdMap[chId];
39 ExtendedChannelInfo& channelChInfo = chInfo.hits[id];
40 MdtRegionInfo& stInfo = m_mdtChamberIndexMap[stationIndex];
41 ExtendedChannelInfo& channelStInfo = stInfo.hits[id];
42
43 channelChInfo.hits.emplace_back(rawHit);
44 channelStInfo.hits.emplace_back(rawHit);
45
46 const bool above_thresh = {rawHit->adcCount() > m_adcThreshold};
47 chInfo.nhitsAboveAdcThreshold += above_thresh;
48 stInfo.nhitsAboveAdcThreshold += above_thresh;
49
50 // only increase the hit counters once
51 bool isFirst = true;
52 // loop over tracks and check whether hit is 'on-track'
53 for (const ExtendedTrkPtr& trk : tracks) {
54 // look for id in map
55 const IdHitMap& idHitMap = trk->idHitMap();
56 IdHitMap::const_iterator pos = idHitMap.find(id);
57 if (pos == idHitMap.end()) continue;
58
59 // if we get here the hit was found, now check that it is a hit on track
60 const MuonCalibHit_E& hit = *pos->second;
61 if (hit.type() < 4) {
62 if (isFirst) {
63 ++chInfo.nhitsOnTrack;
64 ++stInfo.nhitsOnTrack;
65 isFirst = false;
66 }
67 trk->rawHitAssociationMap().addMdtRawHit(rawHit);
68 channelChInfo.associatedTracks.emplace_back(trk);
69 channelStInfo.associatedTracks.emplace_back(trk);
70 }
71 }
72
73 // only increase the hit counters once
74 isFirst = true;
75 // loop over segments and check whether hit is 'on-segment'
76 for (const ExtendedSegPtr& seg : segments) {
77 // look for id in segment
78 if (!seg->idSet().count(id)) continue;
79
80 if (isFirst) {
81 ++chInfo.nhitsOnSegment;
82 ++stInfo.nhitsOnSegment;
83 isFirst = false;
84 }
85 seg->rawHitAssociationMap().addMdtRawHit(rawHit);
86 channelChInfo.associatedSegments.emplace_back(seg);
87 channelStInfo.associatedSegments.emplace_back(seg);
88 }
89 }
90 }
91
93 std::ostringstream sout;
94 MuonFixedIdPrinter printer{};
95
96 sout << " number of MDT chambers with hits: " << m_mdtChamberIdMap.size() << std::endl;
97 for (const auto& chIt : m_mdtChamberIdMap) {
98 if (chIt.second.nhitsAboveAdcThreshold < 3) continue;
99 const MuonFixedId& chId = chIt.first;
100 sout << " " << std::setw(20) << printer.chamberIdentifier(chId) << " nhits " << std::setw(3) << chIt.second.hits.size()
101 << " above ADC cut " << std::setw(3) << chIt.second.nhitsAboveAdcThreshold << " on segment " << std::setw(3)
102 << chIt.second.nhitsOnSegment << " on track " << std::setw(3) << chIt.second.nhitsOnTrack;
103
104 // look at next iterator to decide whether to add endl or not
105 sout << std::endl;
106 }
107 return sout.str();
108 }
109} // namespace MuonCalib
std::shared_ptr< MuonCalibExtendedSegment > ExtendedSegPtr
MuonCalibRawHitCollection::MdtCalibRawHitPtr MdtCalibRawHitPtr
std::shared_ptr< MuonCalibExtendedTrack > ExtendedTrkPtr
Simplified class designed to store information of a MDT hit.
int type() const
return the type of measurement
A MuonCalibRawHitcollections is a container class within the Calibration EDM holding the MuonCalibXxx...
const MuonCalibRawMdtHitVec & MdtContainer() const
Retrieve references to the container themselves.
std::string chamberIdentifier(const MuonFixedId &id) const
prints chamber Identifier for the give id.
Implements fixed identifiers not dependent upon Athena Identifier for internal use in the calibration...
Definition MuonFixedId.h:50
CscCalcPed - algorithm that finds the Cathode Strip Chamber pedestals from an RDO.
std::map< MuonFixedId, CalibHitE_Ptr > IdHitMap
hit information per identifier