ATLAS Offline Software
CaloNoiseSigmaDiffCondAlg.cxx
Go to the documentation of this file.
1 
2 /*
3  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
4 */
19 
20 CaloNoiseSigmaDiffCondAlg::CaloNoiseSigmaDiffCondAlg(const std::string& name, ISvcLocator* pSvcLocator) :
21 AthReentrantAlgorithm(name,pSvcLocator)
22 {
23 }
24 
28  return StatusCode::SUCCESS;
29 }
30 
31 StatusCode CaloNoiseSigmaDiffCondAlg::execute(const EventContext& context) const {
32 
33  // Write Conditions
35  if ( output.isValid() ) {
36  ATH_MSG_DEBUG("Already available handle");
37  return StatusCode::SUCCESS;
38  }
39 
40  const CaloIdManager* calo_id_manager(nullptr);
41  CHECK( detStore()->retrieve (calo_id_manager, "CaloIdManager") );
42  const CaloCell_ID * calo_cell_id = calo_id_manager->getCaloCell_ID();
43  int hash_max = calo_cell_id->calo_cell_hash_max();
44 
45  // prepare real output object (not handle)
46  auto out = std::make_unique<CaloNoiseSigmaDiff>(hash_max,0.0);
47 
48  // get Noise Table
49  SG::ReadCondHandle<CaloNoise> noiseCDO (m_noiseCDOKey, context);
50  const CaloNoise* nn = noiseCDO.cptr();
51  for(int i=0;i<hash_max;++i){
53  if (calo_cell_id->is_tile(h) ) continue;
54  float nn1=nn->getNoise(h,1); // medium gain
55  float nn0=nn->getNoise(h,0); // high gain
56  float sigma_diff = nn1*nn1-nn0*nn0;
57  if ( sigma_diff < 0.0 ) { out->at(i)=0; continue;}
58  out->at(i)=std::sqrt(sigma_diff);
59  }
60 
61  output.addDependency(noiseCDO);
62  ATH_CHECK(output.record( std::move(out) ) );
63  ATH_MSG_INFO( "recorded new " << output.key() << " with range " << output.getRange() );
64  return StatusCode::SUCCESS;
65 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
CaloNoiseSigmaDiffCondAlg::initialize
virtual StatusCode initialize() override
Gaudi initialize method.
Definition: CaloNoiseSigmaDiffCondAlg.cxx:25
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
CaloCell_Base_ID::is_tile
bool is_tile(const Identifier id) const
test if the id belongs to the Tiles
CaloNoise::getNoise
float getNoise(const IdentifierHash h, const int gain) const
Accessor by IdentifierHash and gain.
Definition: CaloNoise.h:34
ReadCondHandle.h
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
CaloNoiseSigmaDiffCondAlg::CaloNoiseSigmaDiffCondAlg
CaloNoiseSigmaDiffCondAlg(const std::string &name, ISvcLocator *pSvcLocator)
NAME : CaloNoiseSigmaDiffCondAlg.cxx PACKAGE : Calorimeter/CaloRec.
Definition: CaloNoiseSigmaDiffCondAlg.cxx:20
CaloIdManager
This class initializes the Calo (LAr and Tile) offline identifiers.
Definition: CaloIdManager.h:45
lumiFormat.i
int i
Definition: lumiFormat.py:92
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
extractSporadic.h
list h
Definition: extractSporadic.py:97
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
WriteCondHandle.h
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CaloNoiseSigmaDiffCondAlg.h
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
CaloCell_ID
Helper class for offline cell identifiers.
Definition: CaloCell_ID.h:34
CaloNoise
Definition: CaloNoise.h:16
merge.output
output
Definition: merge.py:17
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
CaloIdManager::getCaloCell_ID
const CaloCell_ID * getCaloCell_ID(void) const
Access to IdHelper.
Definition: CaloIdManager.cxx:63
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
CaloNoiseSigmaDiffCondAlg::m_noiseCDOKey
SG::ReadCondHandleKey< CaloNoise > m_noiseCDOKey
Property: CaloNoise (conditions input).
Definition: CaloNoiseSigmaDiffCondAlg.h:41
h
CaloIdManager.h
CaloNoiseSigmaDiffCondAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Execute the algorithm.
Definition: CaloNoiseSigmaDiffCondAlg.cxx:31
IdentifierHash
Definition: IdentifierHash.h:38
SG::WriteCondHandle
Definition: WriteCondHandle.h:26
CaloNoiseSigmaDiffCondAlg::m_noiseSigmaDiff
SG::WriteCondHandleKey< CaloNoiseSigmaDiff > m_noiseSigmaDiff
Definition: CaloNoiseSigmaDiffCondAlg.h:44
CaloCell_Base_ID::calo_cell_hash_max
size_type calo_cell_hash_max(void) const
cell 'global' hash table max size
SG::ReadCondHandle::cptr
const_pointer_type cptr()
Definition: ReadCondHandle.h:67