ATLAS Offline Software
Loading...
Searching...
No Matches
CscClusterUtilTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
6
16
21
22//**********************************************************************
23
24CscClusterUtilTool::CscClusterUtilTool(const std::string& type, const std::string& aname, const IInterface* parent) :
25 AthAlgTool(type, aname, parent), m_phelper(nullptr), m_cscStripLocation("CSC_Measurements") {
26 declareInterface<ICscClusterUtilTool>(this);
27 declareProperty("CscStripPrepDataLocation", m_cscStripLocation);
28}
29
30//**********************************************************************
31
33 ATH_MSG_DEBUG("Initializing " << name());
34 ATH_MSG_DEBUG(" Strip fitter is " << m_stripFitter.typeAndName());
35 ATH_CHECK(m_cscStripLocation.initialize());
36 ATH_MSG_DEBUG(" CscStripPrepDataLocation is " << m_cscStripLocation.key());
37
38 // Retrieve the strip fitting tool.
39 ATH_CHECK(m_stripFitter.retrieve());
40 ATH_MSG_DEBUG("Retrieved strip fitting tool " << m_stripFitter);
41
42 // Retrieve the precision cluster fitting tool.
44 ATH_MSG_DEBUG("Retrieved CSC precision cluster fitting tool");
45
46 const MuonGM::MuonDetectorManager* muDetMgr = nullptr;
47 ATH_CHECK_RECOVERABLE(detStore()->retrieve(muDetMgr));
48 ATH_MSG_DEBUG("Retrieved geometry.");
49 m_phelper = muDetMgr->cscIdHelper();
50
51 return StatusCode::SUCCESS;
52}
53
54//**********************************************************************
56 if (!rot) {
57 ATH_MSG_WARNING(" Trk::RIO_OnTrack* rot is empty !");
58 return;
59 }
60 const Muon::CscClusterOnTrack* pclu = dynamic_cast<const Muon::CscClusterOnTrack*>(rot);
61 if (!pclu) {
62 ATH_MSG_WARNING(" Muon::CscClusterOnTrack* pclu is empty !");
63 return;
64 }
65 getStripFits(pclu, sfits);
66}
67
69 if (!pclu) {
70 ATH_MSG_WARNING(" Muon::CscClusterOnTrack* pclu is empty !");
71 return;
72 }
73 const Muon::CscPrepData* pprd = pclu->prepRawData();
74 if (!pprd) {
75 ATH_MSG_WARNING(" Muon::CscPrepData* pprd is empty !");
76 return;
77 }
78
79 getStripFits(pprd, sfits);
80}
81
83 if (!MClus) {
84 ATH_MSG_WARNING(" Muon::CscPrepData* pprd is empty !");
85 return;
86 }
87
88 sfits.clear();
89
90 std::vector<const CscStripPrepData*> strPrepDatas = getStrips(MClus);
91 for (unsigned int i = 0; i < strPrepDatas.size(); ++i) {
93 sfit = m_stripFitter->fit(*strPrepDatas[i]);
94 ATH_MSG_VERBOSE(" in loop charge " << sfit.charge);
95 // if (sfit.charge == 0.) // It's the case of narrow strips...in QratStripFitter
96 // sfit.charge = 40.; // 0 charge is set to minimal non zero to do fit e.g. dead channel case
97 sfits.push_back(sfit);
98 }
99 }
100
103 if (!MClus) {
104 ATH_MSG_WARNING(" Muon::CscPrepData* pprd is empty !");
105 return results;
106 }
107
109 sfits.clear();
110
111 getStripFits(MClus, sfits);
112 results = m_precClusterFitter->fit(sfits, tantheta);
113
114 return results;
115}
116
117
118std::vector<const CscStripPrepData*> CscClusterUtilTool::getStrips(const CscPrepData* MClus) const {
119 std::vector<const CscStripPrepData*> strips;
120 if (!MClus) {
121 ATH_MSG_WARNING(" Muon::CscPrepData* pprd is empty !");
122 return strips;
123 }
124
125 const std::vector<Identifier> &prd_digit_ids = MClus->rdoList();
126
128
129 if (!pdigcont.isValid()) {
130 ATH_MSG_WARNING("Strip container " << m_cscStripLocation.key() << " not found in StoreGate!");
131 return strips;
132 }
133 ATH_MSG_DEBUG("Retrieved " << m_cscStripLocation.key() << " successfully. ");
134
135 IdentifierHash elhash = MClus->collectionHash();
136 const auto *it = pdigcont->indexFindPtr(elhash);
137
138 ATH_MSG_VERBOSE("Hash " << elhash << " converted to iterator of container successfully");
139
140 if (it != nullptr) {
141 ATH_MSG_VERBOSE(" it == pdigcont.end() passed");
142 for (unsigned int istrip = 0; istrip < prd_digit_ids.size(); ++istrip) {
143 const CscStripPrepDataCollection& col = *it;
144 // Loop over digits and fill these arrays.
145 for (CscStripPrepDataCollection::const_iterator idig = col.begin(); idig != col.end(); ++idig) {
146 const CscStripPrepData& dig = **idig;
147 Identifier stid = dig.identify();
148 if (stid != prd_digit_ids[istrip]) continue;
149 const CscStripPrepData* pstrip = &dig;
150 ATH_MSG_VERBOSE("strip " << pstrip->timeOfFirstSample());
151
152 strips.push_back(pstrip);
153 break;
154 }
155 }
156 }
157 return strips;
158}
#define ATH_CHECK_RECOVERABLE
Evaluate an expression and check for errors.
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
const ServiceHandle< StoreGateSvc > & detStore() const
void getStripFits(const Trk::RIO_OnTrack *rot, ICscClusterFitter::StripFitList &sfits) const
CscClusterUtilTool(const std::string &, const std::string &, const IInterface *)
ICscClusterFitter::Results getRefitCluster(const Muon::CscPrepData *MClus, double tantheta) const
SG::ReadHandleKey< Muon::CscStripPrepDataContainer > m_cscStripLocation
ToolHandle< ICscStripFitter > m_stripFitter
const CscIdHelper * m_phelper
std::vector< const Muon::CscStripPrepData * > getStrips(const Muon::CscPrepData *MClus) const
ToolHandle< ICscClusterFitter > m_precClusterFitter
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
const_iterator end() const noexcept
const_iterator begin() const noexcept
ICscStripFitter::Result StripFit
std::vector< Result > Results
std::vector< StripFit > StripFitList
This is a "hash" representation of an Identifier.
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
Class to represent the calibrated clusters created from CSC strips.
virtual const CscPrepData * prepRawData() const override final
Returns the CscPrepData - is a CscPrepData in this scope.
Class representing clusters from the CSC.
Definition CscPrepData.h:39
Class representing the raw data of one CSC strip (for clusters look at Muon::CscPrepData).
double timeOfFirstSample() const
return the time of the first sample
virtual IdentifierHash collectionHash() const
Returns the IdentifierHash corresponding to the PRD collection in the PRD container.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
Identifier identify() const
return the identifier
const std::vector< Identifier > & rdoList() const
return the List of rdo identifiers (pointers)
Class to handle RIO On Tracks ROT) for InDet and Muons, it inherits from the common MeasurementBase.
Definition RIO_OnTrack.h:70
MuonPrepDataCollection< CscStripPrepData > CscStripPrepDataCollection
MuonPrepDataContainerT< CscStripPrepData > CscStripPrepDataContainer