ATLAS Offline Software
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 
22 namespace MuonCalib {
23 
25 
27  const std::vector<ExtendedSegPtr>& segments,
28  const std::vector<ExtendedTrkPtr>& tracks) :
29  m_adcThreshold(70.) {
30  MuonFixedIdManipulator idManip;
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);
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
MuonCalib::MuonCalibExtendedRawHits::ExtendedTrkPtr
std::shared_ptr< MuonCalibExtendedTrack > ExtendedTrkPtr
Definition: MuonCalibExtendedRawHits.h:37
MuonCalibPattern.h
MuonCalib::MuonFixedIdManipulator::StationIndex
StationIndex
enum defining station layers
Definition: MuonFixedIdManipulator.h:17
MuonCalibSegment.h
MuonCalib::MuonFixedIdManipulator::chamberIdentifier
MuonFixedId chamberIdentifier(const MuonFixedId &id) const
returns chamber Identifier for the give id, same as stationIdentifier RPC: includes doubletR
Definition: MuonFixedIdManipulator.cxx:154
MuonCalib::MuonCalibRawHitCollection::MdtContainer
const MuonCalibRawMdtHitVec & MdtContainer() const
Retrieve references to the container themselves.
Definition: MuonCalibRawHitCollection.cxx:27
MuonCalib::MuonCalibExtendedRawHits::MdtRegionInfo::nhitsOnTrack
unsigned int nhitsOnTrack
Definition: MuonCalibExtendedRawHits.h:51
MuonCalibExtendedTrack.h
MuonFixedIdPrinter.h
MuonCalibRawCscHit.h
MuonCalib::MuonCalibExtendedRawHits::MdtCalibRawHitPtr
MuonCalibRawHitCollection::MdtCalibRawHitPtr MdtCalibRawHitPtr
Definition: MuonCalibExtendedRawHits.h:30
MuonCalib::MuonCalibExtendedRawHits::MdtRegionInfo
Definition: MuonCalibExtendedRawHits.h:48
MuonCalib::MuonCalibExtendedRawHits::MdtRegionInfo::nhitsAboveAdcThreshold
unsigned int nhitsAboveAdcThreshold
Definition: MuonCalibExtendedRawHits.h:49
MuonCalib::MuonFixedIdManipulator
Definition: MuonFixedIdManipulator.h:14
MuonCalib::MuonCalibExtendedRawHits::ExtendedChannelInfo
Definition: MuonCalibExtendedRawHits.h:38
MuonCalib::MuonCalibExtendedRawHits::m_adcThreshold
double m_adcThreshold
Definition: MuonCalibExtendedRawHits.h:105
MuonCalib::MuonCalibExtendedRawHits::ExtendedChannelInfo::associatedTracks
std::vector< ExtendedTrkPtr > associatedTracks
Definition: MuonCalibExtendedRawHits.h:41
MuonCalib::MuonCalibExtendedRawHits::MuonCalibExtendedRawHits
MuonCalibExtendedRawHits()
Default constructor .
Definition: MuonCalibExtendedRawHits.cxx:24
MuonCalibExtendedSegment.h
MuonCalib
CscCalcPed - algorithm that finds the Cathode Strip Chamber pedestals from an RDO.
Definition: CscCalcPed.cxx:22
MuonCalib::MuonCalibExtendedRawHits::ExtendedChannelInfo::associatedSegments
std::vector< ExtendedSegPtr > associatedSegments
Definition: MuonCalibExtendedRawHits.h:40
MuonCalib::MuonCalibExtendedRawHits::m_mdtChamberIdMap
MdtHitChamberIdMap m_mdtChamberIdMap
Definition: MuonCalibExtendedRawHits.h:107
MuonCalibExtendedRawHits.h
MuonCalibHit_E.h
MuonCalib::MuonCalibExtendedRawHits::MdtRegionInfo::nhitsOnSegment
unsigned int nhitsOnSegment
Definition: MuonCalibExtendedRawHits.h:50
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:220
MuonCalib::MuonFixedId
Definition: MuonFixedId.h:50
MuonCalib::MuonCalibRawHitCollection
Definition: MuonCalibRawHitCollection.h:42
MuonCalib::MuonCalibExtendedRawHits::ExtendedSegPtr
std::shared_ptr< MuonCalibExtendedSegment > ExtendedSegPtr
Definition: MuonCalibExtendedRawHits.h:36
MuonCalib::MuonCalibExtendedRawHits::ExtendedChannelInfo::hits
std::vector< MdtCalibRawHitPtr > hits
Definition: MuonCalibExtendedRawHits.h:39
MuonCalib::MuonCalibExtendedRawHits::MdtRegionInfo::hits
MdtHitInfoMap hits
Definition: MuonCalibExtendedRawHits.h:52
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
MuonCalibRawTgcHit.h
MuonCalib::MuonCalibExtendedRawHits::m_mdtChamberIndexMap
MdtHitStationIndexMap m_mdtChamberIndexMap
Definition: MuonCalibExtendedRawHits.h:108
MuonCalib::MuonCalibExtendedRawHits::dumpMdtHits
std::string dumpMdtHits() const
Definition: MuonCalibExtendedRawHits.cxx:92
MuonCalib::MuonCalibHit_E::type
int type() const
return the type of measurement
Definition: MuonCalibHit_E.cxx:18
MuonCalibRawRpcHit.h
MuonCalibRawHitCollection.h
MuonCalib::MuonFixedIdManipulator::stationLayerIndex
StationIndex stationLayerIndex(const MuonFixedId &id) const
returns station layer index for a give identifier
Definition: MuonFixedIdManipulator.cxx:87
MuonCalibRawMdtHit.h
MuonFixedIdManipulator.h
MuonCalib::MuonCalibHit_E
Definition: MuonCalibHit_E.h:21
MuonCalib::IdHitMap
std::map< MuonFixedId, CalibHitE_Ptr > IdHitMap
hit information per identifier
Definition: MuonCalibLayerMapping.h:27
MuonCalib::MuonFixedIdPrinter
Definition: MuonFixedIdPrinter.h:13