ATLAS Offline Software
CscThresholdClusterBuilder.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // CscThresholdClusterBuilder.cxx
7 
8 #include <sstream>
9 
10 #include "Gaudi/Property.h"
11 
12 using std::ostringstream;
13 using std::string;
14 using std::vector;
15 
16 //******************************************************************************
17 CscThresholdClusterBuilder::CscThresholdClusterBuilder(const std::string& aname, ISvcLocator* pSvcLocator) :
18  AthAlgorithm(aname, pSvcLocator) {}
19 
20 //******************************************************************************
21 
22 // Destructor.
23 
25 
26 //******************************************************************************
27 
29  ATH_MSG_DEBUG("Initializing " << name());
30 
31  // Retrieve the strip fitting tool.
32  ATH_CHECK(m_cluster_builder.retrieve());
33  ATH_MSG_DEBUG("Retrieved strip fitting tool " << m_cluster_builder);
34  // Initialise output cluster container
35  ATH_CHECK(m_pclusters.initialize());
36  ATH_CHECK(m_idHelperSvc.retrieve());
37  return StatusCode::SUCCESS;
38 }
39 
40 //******************************************************************************
41 
43  ATH_MSG_DEBUG("Processing event ");
44 
45  // Cleanup the cluster container - ready for filling
46  if (m_cluster_builder) {
47  std::vector<IdentifierHash> givenIDs;
48  std::vector<IdentifierHash> decodedIDs;
49 
50  // prepare output
52  Muon::CscPrepDataContainer* object = new Muon::CscPrepDataContainer(m_idHelperSvc->cscIdHelper().module_hash_max());
54  if (wh_pclusters.record(std::unique_ptr<Muon::CscPrepDataContainer>(object)).isFailure()) {
55  ATH_MSG_ERROR("Could not record container of CSC Cluster PrepData at " << m_pclusters.key());
56  return StatusCode::RECOVERABLE;
57  }
58 
59  if (m_cluster_builder->getClusters(givenIDs, decodedIDs, object).isFailure()) {
60  ATH_MSG_ERROR("CSC cluster building failed");
61  return StatusCode::FAILURE;
62  }
63  } else {
64  ATH_MSG_ERROR("No cluster builder tool initialised");
65  return StatusCode::FAILURE;
66  }
67 
68  return StatusCode::SUCCESS;
69 }
Muon::MuonPrepDataContainer
Template for Muon PRD containers (which are basically collections of MuonPrepDataCollections).
Definition: MuonPrepDataContainer.h:42
CscThresholdClusterBuilder.h
CscThresholdClusterBuilder::initialize
StatusCode initialize()
Definition: CscThresholdClusterBuilder.cxx:28
python.Dumpers.aname
string aname
Definition: Dumpers.py:5541
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
CscThresholdClusterBuilder::m_cluster_builder
ToolHandle< ICscClusterBuilder > m_cluster_builder
Definition: CscThresholdClusterBuilder.h:93
CscThresholdClusterBuilder::CscThresholdClusterBuilder
CscThresholdClusterBuilder(const std::string &name, ISvcLocator *pSvcLocator)
Definition: CscThresholdClusterBuilder.cxx:17
Muon::CscPrepDataContainer
MuonPrepDataContainerT< CscPrepData > CscPrepDataContainer
Definition: MuonPrepDataContainer.h:98
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AthAlgorithm
Definition: AthAlgorithm.h:47
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
CscThresholdClusterBuilder::execute
StatusCode execute()
Definition: CscThresholdClusterBuilder.cxx:42
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
CscThresholdClusterBuilder::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: CscThresholdClusterBuilder.h:99
CscThresholdClusterBuilder::~CscThresholdClusterBuilder
~CscThresholdClusterBuilder()
CscThresholdClusterBuilder::m_pclusters
SG::WriteHandleKey< Muon::CscPrepDataContainer > m_pclusters
Definition: CscThresholdClusterBuilder.h:105