ATLAS Offline Software
Loading...
Searching...
No Matches
TBDMContainerSplitter.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
9
11 ISvcLocator* pSvcLocator) :
12 AthAlgorithm(name, pSvcLocator),
13 m_DMHitsKey("LArCalibrationHitDeadMaterial"),
14 m_DMHitsCaloKey("LArCalibrationHitDeadMaterial_Calo"),
15 m_DMHitsLeakKey("LArCalibrationHitDeadMaterial_Leakage"),
17{
18 declareProperty("InputDMContainer",m_DMHitsKey);
19 declareProperty("OutputDM_Calo",m_DMHitsCaloKey);
20 declareProperty("OutputDM_Leak",m_DMHitsLeakKey);
21}
22
25
27{
28 ATH_MSG_INFO ( "in initialize()" );
29
32 ATH_MSG_FATAL(" Could not get the CaloDmDescrManager !! ");
33 return StatusCode::FAILURE ;
34 }
35
36 ATH_MSG_INFO ( "end of initialize()" );
37 return StatusCode::SUCCESS;
38}
39
40
42{
43 return StatusCode::SUCCESS;
44}
45
47{
48 ATH_MSG_DEBUG ( "Executing TBDMContainerSplitter " );
49
50 // Retrieve Original DM container
51 const CaloCalibrationHitContainer* inDMCont;
52 StatusCode sc = evtStore()->retrieve(inDMCont, m_DMHitsKey);
53 if ( sc.isFailure() ) {
55 ( "Cannot retrieve CaloCalibrationHitContainer "<<m_DMHitsKey<<" from StoreGate" );
56 setFilterPassed(false);
57 return StatusCode::SUCCESS;
58 }
59 // Create two new DMCont
62
63 // Loop over original, and fill two new ones
64 for (const CaloCalibrationHit* hit : *inDMCont) {
65 Identifier myId = hit->cellID();
66 CaloDmDescrElement* myCDDE(0);
67 myCDDE = m_caloDmDescrManager->get_element(myId);
68 CaloCalibrationHit *chit = new CaloCalibrationHit(myId, hit->energyEM(), hit->energyNonEM(), hit->energyInvisible(), hit->energyEscaped());
69 if ( myCDDE ) {
70 if(myCDDE->eta()>2.5 && myCDDE->phi() > M_PI/2 && myCDDE->phi() < M_PI){ // Calo hit
71 outDMContCalo->push_back(chit);
72 } else{ //Leak hit
73 outDMContLeak->push_back(chit);
74 }
75 } else { // No CDDE, assume leak hit
76 outDMContLeak->push_back(chit);
77 }
78 }
79
80 // Store new containers
81 sc = evtStore()->record(outDMContCalo, m_DMHitsCaloKey);
82 if ( sc.isFailure() ) {
83 ATH_MSG_ERROR ( "Could not store: "<<m_DMHitsCaloKey<<" to StoreGate" );
84 setFilterPassed(false);
85 return StatusCode::SUCCESS;
86 }
87 sc = evtStore()->record(outDMContLeak, m_DMHitsLeakKey);
88 if ( sc.isFailure() ) {
89 ATH_MSG_ERROR ( "Could not store: "<<m_DMHitsLeakKey<<" to StoreGate" );
90 setFilterPassed(false);
91 return StatusCode::SUCCESS;
92 }
93
94
95 setFilterPassed(true);
96 return StatusCode::SUCCESS;
97
98}
99
#define M_PI
#define ATH_MSG_ERROR(x)
#define ATH_MSG_FATAL(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
CaloCalibrationHitContainer
static Double_t sc
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Class to store calorimeter calibration hit.
static const CaloDmDescrManager * instance()
virtual StatusCode finalize() override
virtual StatusCode execute() override
TBDMContainerSplitter(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode initialize() override
const CaloDmDescrManager * m_caloDmDescrManager