ATLAS Offline Software
Loading...
Searching...
No Matches
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*/
13
14
19
20CaloNoiseSigmaDiffCondAlg::CaloNoiseSigmaDiffCondAlg(const std::string& name, ISvcLocator* pSvcLocator) :
21AthReentrantAlgorithm(name,pSvcLocator)
22{
23}
24
26 ATH_CHECK( m_noiseCDOKey.initialize() );
27 ATH_CHECK( m_noiseSigmaDiff.initialize() );
28 return StatusCode::SUCCESS;
29}
30
31StatusCode 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
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}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
#define CHECK(...)
Evaluate an expression and check for errors.
const ServiceHandle< StoreGateSvc > & detStore() const
Header file for AthHistogramAlgorithm.
An algorithm that can be simultaneously executed in multiple threads.
size_type calo_cell_hash_max() const
cell 'global' hash table max size
bool is_tile(const Identifier id) const
test if the id belongs to the Tiles
Helper class for offline cell identifiers.
Definition CaloCell_ID.h:34
This class initializes the Calo (LAr and Tile) offline identifiers.
const CaloCell_ID * getCaloCell_ID(void) const
Access to IdHelper.
SG::ReadCondHandleKey< CaloNoise > m_noiseCDOKey
Property: CaloNoise (conditions input).
SG::WriteCondHandleKey< CaloNoiseSigmaDiff > m_noiseSigmaDiff
CaloNoiseSigmaDiffCondAlg(const std::string &name, ISvcLocator *pSvcLocator)
NAME : CaloNoiseSigmaDiffCondAlg.cxx PACKAGE : Calorimeter/CaloRec.
virtual StatusCode initialize() override
Gaudi initialize method.
virtual StatusCode execute(const EventContext &ctx) const override
Execute the algorithm.
float getNoise(const IdentifierHash h, const int gain) const
Accessor by IdentifierHash and gain.
Definition CaloNoise.h:34
This is a "hash" representation of an Identifier.
const_pointer_type cptr()