ATLAS Offline Software
Loading...
Searching...
No Matches
CscPeakThresholdClusterBuilderTool Class Reference

#include <CscPeakThresholdClusterBuilderTool.h>

Inheritance diagram for CscPeakThresholdClusterBuilderTool:
Collaboration diagram for CscPeakThresholdClusterBuilderTool:

Public Member Functions

 CscPeakThresholdClusterBuilderTool (const std::string &type, const std::string &aname, const IInterface *)
 ~CscPeakThresholdClusterBuilderTool ()
StatusCode initialize ()
 AlgTool InterfaceID.
StatusCode getClusters (std::vector< IdentifierHash > &idVect, std::vector< IdentifierHash > &selectedIdVect, Muon::CscPrepDataContainer *object)
StatusCode finalize ()
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 ()

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

int make_clusters (bool measphi, const std::vector< const Muon::CscStripPrepData * > &strips, Muon::CscPrepDataCollection *&collection)
StatusCode getClusters (IdentifierHash idVect, std::vector< IdentifierHash > &selectedIdVect, Muon::CscPrepDataContainer *pclusters)
StatusCode getClusters (std::vector< IdentifierHash > &selectedIdVect, Muon::CscPrepDataContainer *pclusters)
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

double m_qpeak_threshold_eta
double m_qpeak_threshold_phi
double m_q3sum_threshold_eta
double m_q3sum_threshold_phi
SG::ReadHandleKey< Muon::CscStripPrepDataContainerm_digit_key
SG::WriteHandle< Muon::CscPrepDataContainerm_cluster_handle
ToolHandle< ICscStripFitterm_pstrip_fitter
ToolHandle< ICscClusterFitterm_pfitter_def
ToolHandle< ICscClusterFitterm_pfitter_prec
ToolHandle< ICscClusterFitterm_pfitter_split
ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc
SG::ReadCondHandleKey< MuonGM::MuonDetectorManagerm_DetectorManagerKey
 retrieve MuonDetectorManager from the conditions store
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

Definition at line 73 of file CscPeakThresholdClusterBuilderTool.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

◆ CscPeakThresholdClusterBuilderTool()

CscPeakThresholdClusterBuilderTool::CscPeakThresholdClusterBuilderTool ( const std::string & type,
const std::string & aname,
const IInterface * parent )

Definition at line 66 of file CscPeakThresholdClusterBuilderTool.cxx.

67 :
68 AthAlgTool(type, aname, parent), m_digit_key("CSC_Measurements") {
69 declareInterface<ICscClusterBuilder>(this);
70
71 declareProperty("qpeak_threshold_eta", m_qpeak_threshold_eta = 21000.0);
72 declareProperty("qpeak_threshold_phi", m_qpeak_threshold_phi = 33000.0);
73 declareProperty("q3sum_threshold_eta", m_q3sum_threshold_eta = 38000.0);
74 declareProperty("q3sum_threshold_phi", m_q3sum_threshold_phi = 33000.0);
75 declareProperty("digit_key", m_digit_key);
76}
AthAlgTool()
Default constructor:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
SG::ReadHandleKey< Muon::CscStripPrepDataContainer > m_digit_key

◆ ~CscPeakThresholdClusterBuilderTool()

CscPeakThresholdClusterBuilderTool::~CscPeakThresholdClusterBuilderTool ( )
default

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 }

◆ 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

◆ finalize()

StatusCode CscPeakThresholdClusterBuilderTool::finalize ( )

Definition at line 324 of file CscPeakThresholdClusterBuilderTool.cxx.

324 {
325 ATH_MSG_VERBOSE("Finalizing " << name());
326 return StatusCode::SUCCESS;
327}
#define ATH_MSG_VERBOSE(x)

◆ getClusters() [1/3]

StatusCode CscPeakThresholdClusterBuilderTool::getClusters ( IdentifierHash idVect,
std::vector< IdentifierHash > & selectedIdVect,
Muon::CscPrepDataContainer * pclusters )
private

Definition at line 148 of file CscPeakThresholdClusterBuilderTool.cxx.

149 {
150 // identifiers of collections already decoded and stored in the container will be skipped
151 if (pclusters->indexFindPtr(givenHashId) != nullptr) {
152 decodedIds.push_back(givenHashId);
153 ATH_MSG_DEBUG("A collection already exists in the container for offline id hash. " << (int)givenHashId);
154 return StatusCode::SUCCESS;
155 }
156
157 // Retrieve the CSC digits for this event.
158 SG::ReadHandle<CscStripPrepDataContainer> pdigcon(m_digit_key);
159 if (pdigcon.isValid()) {
160 ATH_MSG_DEBUG("Retrieved strip container " << m_digit_key.key() << " with " << pdigcon->size() << " entries.");
161 } else {
162 ATH_MSG_WARNING("Failure to retrieve strip container " << m_digit_key.key());
163 return StatusCode::SUCCESS;
164 }
165
166 //**********************************************
167 // retrieve specific collection for the givenID
168 const CscStripPrepDataCollection* col = pdigcon->indexFindPtr(givenHashId);
169 if (nullptr == col) {
170 unsigned int coll_hash = givenHashId;
171 ATH_MSG_WARNING("Specific CSC Strip PrepData collection retrieving failed for collection hash = " << coll_hash);
172 return StatusCode::SUCCESS;
173 }
174
175 ATH_MSG_DEBUG("Retrieved " << col->size() << " CSC Strip PrepDatas.");
176
177 Identifier colid = col->identify();
178 int istation = m_idHelperSvc->cscIdHelper().stationName(colid) - 49;
179 int zsec = m_idHelperSvc->cscIdHelper().stationEta(colid);
180 int phisec = m_idHelperSvc->cscIdHelper().stationPhi(colid);
181
182 ATH_MSG_DEBUG(" Strip collection " << chamber(istation, zsec, phisec) << " has " << col->size() << " strips");
183
184 // Create arrays to hold digits and cathode plane parameters.
185 vector<const CscStripPrepData*> strips[8];
186 int maxstrip[8] = {0, 0, 0, 0, 0, 0, 0, 0};
187
188 // retrieve MuonDetectorManager from the conditions store
189 SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey};
190 const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr();
191 if (MuonDetMgr == nullptr) {
192 ATH_MSG_ERROR("Null pointer to the MuonDetectorManager conditions object");
193 return StatusCode::FAILURE;
194 }
195
196 IdentifierHash hash;
197 // Loop over digits and fill these arrays.
198 for (CscStripPrepDataCollection::const_iterator idig = col->begin(); idig != col->end(); ++idig) {
199 const CscStripPrepData& dig = **idig;
200 Identifier did = dig.identify();
201 hash = dig.collectionHash();
202 const CscReadoutElement* pro = MuonDetMgr->getCscReadoutElement(did);
203 int wlay = m_idHelperSvc->cscIdHelper().wireLayer(did);
204 int measphi = m_idHelperSvc->cscIdHelper().measuresPhi(did);
205 int idx = 2 * (wlay - 1) + measphi;
206 // First entry for a cathode plane, initialize.
207 if (maxstrip[idx] == 0) {
208 maxstrip[idx] = pro->maxNumberOfStrips(measphi);
209 for (int istrip = 0; istrip < maxstrip[idx]; ++istrip) strips[idx].push_back(nullptr);
210 }
211 int istrip = m_idHelperSvc->cscIdHelper().strip(did) - 1;
212 if (istrip < 0 || istrip >= maxstrip[idx]) {
213 ATH_MSG_WARNING("Invalid strip number");
214 continue;
215 }
216 strips[idx][istrip] = &dig;
217 }
218
219 // Cluster.
220 CscPrepDataCollection* newCollection = nullptr;
221 for (int measphi = 0; measphi < 2; ++measphi) {
222 for (int wlay = 1; wlay < 5; ++wlay) {
223 int idx = 2 * (wlay - 1) + measphi;
224 if (maxstrip[idx]) {
225 make_clusters(measphi, strips[idx], newCollection);
226 ATH_MSG_DEBUG(" " << wlay << "th layer ");
227 }
228 }
229 }
230 if (newCollection) {
231 if (pclusters->addCollection(newCollection, hash).isFailure()) {
232 ATH_MSG_ERROR("Couldn't add CscPrepdataCollection to container!");
233 return StatusCode::FAILURE;
234 }
235 decodedIds.push_back(hash); // Record that this collection contains data
236 }
237
238 return StatusCode::SUCCESS;
239}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
int make_clusters(bool measphi, const std::vector< const Muon::CscStripPrepData * > &strips, Muon::CscPrepDataCollection *&collection)
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager > m_DetectorManagerKey
retrieve MuonDetectorManager from the conditions store
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
const_iterator end() const noexcept
const_iterator begin() const noexcept
size_type size() const noexcept
virtual const T * indexFindPtr(IdentifierHash hashId) const override final
return pointer on the found entry or null if out of range using hashed index - fast version,...
virtual StatusCode addCollection(const T *coll, IdentifierHash hashId) override final
insert collection into container with id hash if IDC should not take ownership of collection,...
int maxNumberOfStrips(int measuresPhi) const
const CscReadoutElement * getCscReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
virtual const IdentifierHash collectionHash() const final
returns the IdentifierHash corresponding to the channel.
virtual Identifier identify() const override final
const_pointer_type cptr()
Identifier identify() const
return the identifier
MuonPrepDataCollection< CscPrepData > CscPrepDataCollection
MuonPrepDataCollection< CscStripPrepData > CscStripPrepDataCollection

◆ getClusters() [2/3]

StatusCode CscPeakThresholdClusterBuilderTool::getClusters ( std::vector< IdentifierHash > & idVect,
std::vector< IdentifierHash > & selectedIdVect,
Muon::CscPrepDataContainer * object )
virtual

Implements ICscClusterBuilder.

Definition at line 124 of file CscPeakThresholdClusterBuilderTool.cxx.

125 {
126 // clear output vector of selected data collections containing data
127 decodedIds.clear();
128
129 if (!givenIDs.empty()) {
130 for (unsigned int i = 0; i < givenIDs.size(); ++i) {
131 if (getClusters(givenIDs[i], decodedIds, object).isFailure()) {
132 ATH_MSG_ERROR("Unable to decode CSC RDO " << i << "th into CSC PrepRawData");
133 return StatusCode::RECOVERABLE;
134 }
135 }
136 } else {
137 // Clusterization is done for every area
138 if (getClusters(decodedIds, object).isFailure()) {
139 ATH_MSG_ERROR("Unable to decode CSC RDO into CSC PrepRawData");
140 return StatusCode::RECOVERABLE;
141 }
142 }
143 return StatusCode::SUCCESS;
144}
StatusCode getClusters(std::vector< IdentifierHash > &idVect, std::vector< IdentifierHash > &selectedIdVect, Muon::CscPrepDataContainer *object)

◆ getClusters() [3/3]

StatusCode CscPeakThresholdClusterBuilderTool::getClusters ( std::vector< IdentifierHash > & selectedIdVect,
Muon::CscPrepDataContainer * pclusters )
private

Definition at line 243 of file CscPeakThresholdClusterBuilderTool.cxx.

243 {
244 // Retrieve the CSC digits for this event.
245
246 SG::ReadHandle<CscStripPrepDataContainer> pdigcon(m_digit_key);
247 if (pdigcon.isValid()) {
248 ATH_MSG_DEBUG("Retrieved strip container " << m_digit_key.key() << " with " << pdigcon->size() << " entries.");
249 } else {
250 ATH_MSG_WARNING("Failure to retrieve strip container " << m_digit_key.key());
251 return StatusCode::SUCCESS;
252 }
253
254 // Loop over digit collections.
255 // This a loop over chambers (each with 4 wire planes).
256 const CscStripPrepDataContainer& con = *pdigcon;
257 for (CscStripPrepDataContainer::const_iterator icol = con.begin(); icol != con.end(); ++icol) {
258 const CscStripPrepDataCollection& col = **icol;
259 Identifier colid = col.identify();
260 int istation = m_idHelperSvc->cscIdHelper().stationName(colid) - 49;
261 int zsec = m_idHelperSvc->cscIdHelper().stationEta(colid);
262 int phisec = m_idHelperSvc->cscIdHelper().stationPhi(colid);
263 ATH_MSG_DEBUG(" Strip collection " << chamber(istation, zsec, phisec) << " has " << col.size() << " strips");
264
265 // Create arrays to hold digits and cathode plane parameters.
266 vector<const CscStripPrepData*> strips[8];
267 int maxstrip[8] = {0, 0, 0, 0, 0, 0, 0, 0};
268
269 // retrieve MuonDetectorManager from the conditions store
270 SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey};
271 const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr();
272 if (MuonDetMgr == nullptr) {
273 ATH_MSG_ERROR("Null pointer to the MuonDetectorManager conditions object");
274 return StatusCode::FAILURE;
275 }
276
277 IdentifierHash hash;
278 // Loop over digits and fill these arrays.
279 for (CscStripPrepDataCollection::const_iterator idig = col.begin(); idig != col.end(); ++idig) {
280 const CscStripPrepData& dig = **idig;
281 Identifier did = dig.identify();
282 hash = dig.collectionHash();
283 const CscReadoutElement* pro = MuonDetMgr->getCscReadoutElement(did);
284 int wlay = m_idHelperSvc->cscIdHelper().wireLayer(did);
285 int measphi = m_idHelperSvc->cscIdHelper().measuresPhi(did);
286 int idx = 2 * (wlay - 1) + measphi;
287 // First entry for a cathode plane, initialize.
288 if (maxstrip[idx] == 0) {
289 maxstrip[idx] = pro->maxNumberOfStrips(measphi);
290 for (int istrip = 0; istrip < maxstrip[idx]; ++istrip) strips[idx].push_back(nullptr);
291 }
292 int istrip = m_idHelperSvc->cscIdHelper().strip(did) - 1;
293 if (istrip < 0 || istrip >= maxstrip[idx]) {
294 ATH_MSG_WARNING("Invalid strip number");
295 continue;
296 }
297 strips[idx][istrip] = &dig;
298 }
299
300 // Cluster.
301 CscPrepDataCollection* newCollection = nullptr;
302 for (int measphi = 0; measphi < 2; ++measphi) {
303 for (int wlay = 1; wlay < 5; ++wlay) {
304 int idx = 2 * (wlay - 1) + measphi;
305 if (maxstrip[idx]) {
306 make_clusters(measphi, strips[idx], newCollection);
307 ATH_MSG_DEBUG(" " << wlay << "th layer ");
308 }
309 }
310 }
311 if (newCollection) {
312 if (pclusters->addCollection(newCollection, hash).isFailure()) {
313 ATH_MSG_ERROR("Couldn't add CscPrepdataCollection to container!");
314 return StatusCode::FAILURE;
315 }
316 decodedIds.push_back(hash); // Record that this collection contains data
317 }
318 } // end loop over chambers
319
320 return StatusCode::SUCCESS;
321}
const_iterator end() const
return const_iterator for end of container
const_iterator begin() const
return const_iterator for first entry
MuonPrepDataContainerT< CscStripPrepData > CscStripPrepDataContainer

◆ initialize()

StatusCode CscPeakThresholdClusterBuilderTool::initialize ( )

AlgTool InterfaceID.

Definition at line 86 of file CscPeakThresholdClusterBuilderTool.cxx.

86 {
87 ATH_MSG_DEBUG("Initializing " << name());
88 ATH_CHECK(m_digit_key.initialize());
89 // Display algorithm properties.
90 ATH_MSG_DEBUG("Properties for " << name() << ":");
91 ATH_MSG_DEBUG(" Cluster qpeak threshold is eta/phi " << m_qpeak_threshold_eta << "/" << m_qpeak_threshold_phi);
92 ATH_MSG_DEBUG(" Cluster q3sum threshold is eta/phi " << m_q3sum_threshold_eta << "/" << m_q3sum_threshold_phi);
93 ATH_MSG_DEBUG(" Strip fitter is " << m_pstrip_fitter.typeAndName());
94 ATH_MSG_DEBUG(" Default cluster fitter is " << m_pfitter_def.typeAndName());
95 ATH_MSG_DEBUG(" Precision cluster fitter is " << m_pfitter_prec.typeAndName());
96 ATH_MSG_DEBUG(" Split cluster fitter is " << m_pfitter_split.typeAndName());
97 ATH_MSG_DEBUG(" Input digit key is " << m_digit_key.key());
98
99 // Retrieve the strip fitting tool.
100 ATH_CHECK(m_pstrip_fitter.retrieve());
101 ATH_MSG_DEBUG("Retrieved strip fitting tool " << m_pstrip_fitter);
102
103 // Retrieve the default cluster fitting tool.
104 ATH_CHECK(m_pfitter_def.retrieve());
105 ATH_MSG_DEBUG("Retrieved CSC default cluster fitting tool");
106
107 // Retrieve the precision cluster fitting tool.
108 ATH_CHECK(m_pfitter_prec.retrieve());
109 ATH_MSG_DEBUG("Retrieved CSC precision cluster fitting tool");
110
111 // Retrieve the split cluster fitting tool.
112 ATH_CHECK(m_pfitter_split.retrieve());
113 ATH_MSG_DEBUG("Retrieved CSC split cluster fitting tool");
114
115 // retrieve MuonDetectorManager from the conditions store
116 ATH_CHECK(m_DetectorManagerKey.initialize());
117 ATH_CHECK(m_idHelperSvc.retrieve());
118
119 return StatusCode::SUCCESS;
120}
#define ATH_CHECK
Evaluate an expression and check for errors.

◆ 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 & ICscClusterBuilder::interfaceID ( )
inlinestaticinherited

Must declare this, with name of interface

Definition at line 30 of file ICscClusterBuilder.h.

30 {
32 static const InterfaceID IID_ICscClusterBuilder("ICscClusterBuilder", 1, 0);
33 return IID_ICscClusterBuilder;
34 }

◆ make_clusters()

int CscPeakThresholdClusterBuilderTool::make_clusters ( bool measphi,
const std::vector< const Muon::CscStripPrepData * > & strips,
Muon::CscPrepDataCollection *& collection )
private

Definition at line 338 of file CscPeakThresholdClusterBuilderTool.cxx.

339 {
340 // CscPrepDataCollection* newCollection = 0;
341
342 // Loop over channels.
343 unsigned int maxstrip = strips.size();
344
345 ATH_MSG_DEBUG(" Clustering for " << setaphi(measphi) << " plane with " << maxstrip << " strips");
346
347 // Loop over strips and fetch the charge and time for each.
348 // Also set flag indicating if this strip is active, i.e. should be included
349 // in a cluster.
351 std::vector<bool> astrip;
352 IdentifierHash cscHashId;
353
354 for (unsigned int istrip = 0; istrip < strips.size(); ++istrip) {
355 const CscStripPrepData* pstrip = strips[istrip];
357 res.charge = 0.0;
358 res.time = -666.;
359 bool active = false;
360
361 if (pstrip) {
362 if (!newCollection) {
363 Identifier elementId = m_idHelperSvc->cscIdHelper().elementID(pstrip->identify());
364 cscHashId = pstrip->collectionHash();
365 newCollection = new CscPrepDataCollection(cscHashId);
366 newCollection->setIdentifier(elementId);
367 }
368 if (!m_pstrip_fitter) {
369 ATH_MSG_WARNING("Unable to locate strip fitter");
370 return 1;
371 }
372 res = m_pstrip_fitter->fit(*pstrip);
373 active = res.charge > 0.0; // Allow all the positive charged strips...
374 // Log message.
375 ATH_MSG_DEBUG(" Strip " << setw(3) << istrip + 1 << ": charge= " << setw(7) << int(res.charge) << " time=" << setw(3)
376 << int(res.time + 0.5));
377 // if ( active ) *m_log << " *";
378 // else *m_log << " .";
379 // if ( res.status ) *m_log << " x";
380 // else *m_log << " o";
381 // *m_log );
382 }
383
384 // if (res.charge == 0.0) res.charge =40.;
385 stripfits.push_back(res);
386 astrip.push_back(active);
387 }
388
389 // Loop over strips and create clusters.
390 bool incluster = false;
391 int first_strip = 0; // First strip in the cluster.
392 double qpeak = 0;
394 std::vector<const CscStripPrepData*> clusterStrips;
395 std::vector<Identifier> prd_digit_ids;
396 for (unsigned int istrip = 0; istrip < strips.size(); ++istrip) {
397 const CscStripPrepData* pstrip = strips[istrip];
398 ICscClusterFitter::StripFit sfit = stripfits[istrip];
399 double q = sfit.charge;
400
401 // If the current strip is not active, skip it.
402 if (!astrip[istrip]) continue;
403 assert(pstrip != 0);
404
405 // First strip in cluster: initialize a new cluster.
406 if (!incluster) {
407 incluster = true;
408 qpeak = q;
409 first_strip = istrip;
410 sfits.clear();
411 clusterStrips.clear();
412 prd_digit_ids.clear();
413 incluster = true;
414 }
415
416 // Add strip to the current cluster.
417 sfits.push_back(sfit);
418 clusterStrips.push_back(pstrip);
419 prd_digit_ids.push_back(pstrip->identify());
420 if (q > qpeak) qpeak = q;
421
422 // If this is not the last strip in the plane, and the next
423 // strip is active, add the next strip to the cluster.
424 if (istrip != maxstrip - 1 && astrip[istrip + 1]) continue;
425
427 // Create a cluster
428 ATH_MSG_VERBOSE(" Creating cluster");
429
430 // QPeak Threshold Requirement.................
431
432 if (qpeak < (measphi ? m_qpeak_threshold_phi : m_qpeak_threshold_eta)) { // discard cluster and find new one....
433 incluster = false;
434 continue;
435 }
436
437 int fitresult = 99;
438 std::vector<ICscClusterFitter::Result> results;
439 // Precision fit.
440 if (!measphi && m_pfitter_prec) {
441 ATH_MSG_VERBOSE(" Performing precision fit with " << m_pfitter_prec);
442
443 results = m_pfitter_prec->fit(sfits);
444 fitresult = results[0].fitStatus;
445
446 ATH_MSG_VERBOSE(" Precision fit result return=" << fitresult);
447 }
448
449 if (fitresult == 6) { // in case of multipeak cluster
450 ATH_MSG_VERBOSE(" Performing split fit with " << m_pfitter_split);
451
452 results = m_pfitter_split->fit(sfits);
453 fitresult = results[0].fitStatus;
454
455 for (unsigned int i = 0; i < results.size(); ++i) ATH_MSG_VERBOSE(" Split fit result return=" << results[i].fitStatus);
456 }
457 // if splitcluster is succeeded, fitresult should be either 20 or 21
458 // if not, it's 19.
459
460 // Default fit.
461 if (measphi || (fitresult > 0 && fitresult < 20)) { // including measphi case
462 ATH_MSG_VERBOSE(" Performing default fit with " << m_pfitter_def);
463 ICscClusterFitter::Result res;
464 if (!measphi) res = results[0];
465 CscClusterStatus oldclustatus = res.clusterStatus;
466 results = m_pfitter_def->fit(sfits);
467 res = results[0];
468 fitresult = results[0].fitStatus;
469 if (fitresult) {
470 ATH_MSG_VERBOSE(" Default fit failed: return=" << fitresult);
471 return 1;
472 } else {
473 ATH_MSG_VERBOSE(" Default fit succeeded");
474 }
475 // Keep the status from the first fit if it is defined.
476 if (oldclustatus != Muon::CscStatusUndefined) {
477 res.clusterStatus = oldclustatus;
478 // we want to keep oldcluster status
479 results[0] = res;
480 }
481 }
482
483 // retrieve MuonDetectorManager from the conditions store
484 SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey};
485 const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr();
486 if (MuonDetMgr == nullptr) {
487 ATH_MSG_ERROR("Null pointer to the MuonDetectorManager conditions object");
488 return 0;
489 }
490
491 // Check results.
492 unsigned int nresults = results.size();
493 for (unsigned int ire = 0; ire < nresults; ++ire) {
494 if (results[ire].qpeak < (measphi ? m_qpeak_threshold_phi : m_qpeak_threshold_eta)) continue;
495 double q3sum = results[ire].qleft + results[ire].qpeak + results[ire].qright;
496 if (q3sum < (measphi ? m_q3sum_threshold_phi : m_q3sum_threshold_eta)) continue;
497
498 CscClusterStatus clustatus = results[ire].clusterStatus;
499 Muon::CscTimeStatus timeStatus = results[ire].timeStatus;
500 double pos = results[ire].position;
501 double err = results[ire].dposition;
502 unsigned int id_strip = results[ire].strip;
503 double cluster_charge = results[ire].charge;
504 double cluster_time = results[ire].time;
505 if (clustatus == Muon::CscStatusUndefined) ATH_MSG_DEBUG(" Csc Cluster Status is not defined.");
506
507 if (id_strip >= sfits.size()) {
508 ATH_MSG_WARNING(" Fit size check failed: ");
509 return 1;
510 }
511 // Fetch the strip used to identify this cluster.
512 const CscStripPrepData* pstrip_id = nullptr;
513 if (id_strip < clusterStrips.size()) pstrip_id = clusterStrips[id_strip];
514 if (!pstrip_id) {
515 ATH_MSG_WARNING(" Fit ID check failed: ");
516 return 1;
517 }
518
519 // Create ATLAS CSC cluster.
520 Identifier cluster_id = pstrip_id->identify();
521 IdentifierHash cluster_hash = pstrip_id->collectionHash();
522 int zsec = m_idHelperSvc->cscIdHelper().stationEta(cluster_id);
523 int wlay = m_idHelperSvc->cscIdHelper().wireLayer(cluster_id);
524 // This local position is in the muon (not tracking) coordinate system.
525 // const CscReadoutElement* pro = pstrip_id->detectorElement();
526 const CscReadoutElement* pro = MuonDetMgr->getCscReadoutElement(cluster_id);
527 Amg::Vector3D local_pos = pro->nominalLocalClusterPos(zsec, wlay, measphi, pos);
528 auto cov = Amg::MatrixX(1, 1);
529 (cov)(0, 0) = err * err;
530 Amg::Vector2D plpos(measphi ? local_pos.y() : local_pos.z(), measphi ? local_pos.z() : local_pos.y());
531
532 if (msgLvl(MSG::DEBUG)) {
533 ATH_MSG_DEBUG(" Cluster parameters: " << nresults);
534 ATH_MSG_DEBUG(" ID strip: " << first_strip + id_strip << "(" << first_strip << ":" << id_strip << ")");
535 ATH_MSG_DEBUG(" local position: " << plpos.x() << " " << plpos.y());
536 ATH_MSG_DEBUG(" error: " << Amg::toString(cov));
537 ATH_MSG_DEBUG(" charge: " << cluster_charge);
538 ATH_MSG_DEBUG(" time: " << cluster_time);
539 ATH_MSG_DEBUG(" status: " << Muon::toString(clustatus));
540 }
541 std::vector<Identifier> prd_digit_ids_submit;
542 unsigned int fstrip = results[ire].fstrip;
543 unsigned int lstrip = results[ire].lstrip;
544 prd_digit_ids_submit.reserve(lstrip + 1);
545 for (unsigned int ids_index = fstrip; ids_index < lstrip + 1; ++ids_index) {
546 if (ids_index >= prd_digit_ids.size())
547 ATH_MSG_WARNING(" bad index " << ids_index << " maximum " << prd_digit_ids.size());
548 else
549 prd_digit_ids_submit.push_back(prd_digit_ids[ids_index]);
550 }
551
552 CscPrepData* pclus = new CscPrepData(cluster_id,
553 cluster_hash,
554 plpos,
555 prd_digit_ids_submit,
556 cov,
557 pro,
558 int(cluster_charge + 0.5),
559 cluster_time,
560 clustatus,
561 timeStatus);
562 pclus->setHashAndIndex(newCollection->identifyHash(),
563 newCollection->size());
564
565 newCollection->push_back(pclus);
566 }
567 // Reset incluster.
568 incluster = false;
569 } // end loop over strips
570 return 0;
571}
std::pair< std::vector< unsigned int >, bool > res
bool msgLvl(const MSG::Level lvl) const
ICscStripFitter::Result StripFit
std::vector< StripFit > StripFitList
Amg::Vector3D nominalLocalClusterPos(int eta, int wireLayer, int measPhi, double x0) const
ignores internal alignment parameters, hence gives generally incorrect answer (local here is the stat...
void setHashAndIndex(unsigned short collHash, unsigned short objIndex)
TEMP for testing: might make some classes friends later ...
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Eigen::Matrix< double, 2, 1 > Vector2D
Eigen::Matrix< double, 3, 1 > Vector3D
std::string toString(CscStripStatus cstat)
Return a string description of a CSC cluster status flag.
CscClusterStatus
Enum to represent the cluster status - see the specific enum values for more details.
@ CscStatusUndefined
Undefined, should not happen, most likely indicates a problem.
CscTimeStatus
Enum to represent the cluster time measurement status - see the specific enum values for more details...
@ active
Definition Layer.h:47
fitresult
Definition fitman.py:590

◆ 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.

◆ 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_cluster_handle

SG::WriteHandle<Muon::CscPrepDataContainer> CscPeakThresholdClusterBuilderTool::m_cluster_handle
private

Definition at line 111 of file CscPeakThresholdClusterBuilderTool.h.

◆ m_DetectorManagerKey

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

retrieve MuonDetectorManager from the conditions store

Definition at line 144 of file CscPeakThresholdClusterBuilderTool.h.

144 {
145 this,
146 "DetectorManagerKey",
147 "MuonDetectorManager",
148 "Key of input MuonDetectorManager condition data",
149 };

◆ 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_digit_key

SG::ReadHandleKey<Muon::CscStripPrepDataContainer> CscPeakThresholdClusterBuilderTool::m_digit_key
private

Definition at line 110 of file CscPeakThresholdClusterBuilderTool.h.

◆ 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> CscPeakThresholdClusterBuilderTool::m_idHelperSvc
private
Initial value:
{
this,
"MuonIdHelperSvc",
"Muon::MuonIdHelperSvc/MuonIdHelperSvc",
}

Definition at line 137 of file CscPeakThresholdClusterBuilderTool.h.

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

◆ m_pfitter_def

ToolHandle<ICscClusterFitter> CscPeakThresholdClusterBuilderTool::m_pfitter_def
private
Initial value:
{
this,
"default_fitter",
"SimpleCscClusterFitter/SimpleCscClusterFitter",
}

Definition at line 121 of file CscPeakThresholdClusterBuilderTool.h.

121 {
122 this,
123 "default_fitter",
124 "SimpleCscClusterFitter/SimpleCscClusterFitter",
125 };

◆ m_pfitter_prec

ToolHandle<ICscClusterFitter> CscPeakThresholdClusterBuilderTool::m_pfitter_prec
private
Initial value:
{
this,
"precision_fitter",
"QratCscClusterFitter/QratCscClusterFitter",
}

Definition at line 126 of file CscPeakThresholdClusterBuilderTool.h.

126 {
127 this,
128 "precision_fitter",
129 "QratCscClusterFitter/QratCscClusterFitter",
130 };

◆ m_pfitter_split

ToolHandle<ICscClusterFitter> CscPeakThresholdClusterBuilderTool::m_pfitter_split
private
Initial value:
{
this,
"split_fitter",
"CscSplitClusterFitter/CscSplitClusterFitter",
}

Definition at line 131 of file CscPeakThresholdClusterBuilderTool.h.

131 {
132 this,
133 "split_fitter",
134 "CscSplitClusterFitter/CscSplitClusterFitter",
135 };

◆ m_pstrip_fitter

ToolHandle<ICscStripFitter> CscPeakThresholdClusterBuilderTool::m_pstrip_fitter
private
Initial value:
{
this,
"strip_fitter",
"CalibCscStripFitter/CalibCscStripFitter",
}

Definition at line 114 of file CscPeakThresholdClusterBuilderTool.h.

114 {
115 this,
116 "strip_fitter",
117 "CalibCscStripFitter/CalibCscStripFitter",
118 };

◆ m_q3sum_threshold_eta

double CscPeakThresholdClusterBuilderTool::m_q3sum_threshold_eta
private

Definition at line 108 of file CscPeakThresholdClusterBuilderTool.h.

◆ m_q3sum_threshold_phi

double CscPeakThresholdClusterBuilderTool::m_q3sum_threshold_phi
private

Definition at line 109 of file CscPeakThresholdClusterBuilderTool.h.

◆ m_qpeak_threshold_eta

double CscPeakThresholdClusterBuilderTool::m_qpeak_threshold_eta
private

Definition at line 106 of file CscPeakThresholdClusterBuilderTool.h.

◆ m_qpeak_threshold_phi

double CscPeakThresholdClusterBuilderTool::m_qpeak_threshold_phi
private

Definition at line 107 of file CscPeakThresholdClusterBuilderTool.h.

◆ 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: