ATLAS Offline Software
DefectsEmulatorBase.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 #ifndef INDET_DEFECTSEMULATORBASE_H
5 #define INDET_DEFECTSEMULATORBASE_H
6 
7 #include "GaudiKernel/ServiceHandle.h"
9 #include "GaudiKernel/ITHistSvc.h"
10 
11 #include <string>
12 #include <vector>
13 #include <mutex>
14 #include <atomic>
15 
16 class TH2;
17 
18 namespace InDet {
19 
24 public:
25  DefectsEmulatorBase(const std::string &name,ISvcLocator *pSvcLocator);
26 
27  virtual StatusCode initialize() override;
28  virtual StatusCode finalize() override;
29 
30 protected:
32  {this,"HistSvc","THistSvc"};
33  Gaudi::Property<std::string> m_histogramGroupName
34  {this,"HistogramGroupName","", "Histogram group name or empty to disable histogramming"};
35 
36  // calls during execute must be protected by m_histMutex
37  TH2 *findHist(unsigned int n_rows, unsigned int n_cols) const;
38 
40  // access to the following must be protected by m_histMutex during execute
41  mutable std::vector<unsigned int> m_dimPerHist ATLAS_THREAD_SAFE;
42  mutable TH2 * m_moduleHist ATLAS_THREAD_SAFE = nullptr;
43 
44  mutable std::vector< TH2 *> m_hist ATLAS_THREAD_SAFE;
45 
46  // Simple counters for dropped and copied RDOs
47  mutable std::atomic<std::size_t> m_rejectedRDOs {};
48  mutable std::atomic<std::size_t> m_totalRDOs {};
49 
50  bool m_histogrammingEnabled = false;
51 
52 };
53 
54 }
55 
56 #endif
InDet::DefectsEmulatorBase::m_histSvc
ServiceHandle< ITHistSvc > m_histSvc
Definition: DefectsEmulatorBase.h:32
InDet::DefectsEmulatorBase::finalize
virtual StatusCode finalize() override
Definition: DefectsEmulatorBase.cxx:38
InDet::DefectsEmulatorBase
Common base class for the specializations of the DefectsEmulatorAlg template.
Definition: DefectsEmulatorBase.h:23
InDet::DefectsEmulatorBase::findHist
TH2 * findHist(unsigned int n_rows, unsigned int n_cols) const
Definition: DefectsEmulatorBase.cxx:43
InDet::DefectsEmulatorBase::m_totalRDOs
std::atomic< std::size_t > m_totalRDOs
Definition: DefectsEmulatorBase.h:48
BeamSpot::mutex
std::mutex mutex
Definition: InDetBeamSpotVertex.cxx:18
InDet
Primary Vertex Finder.
Definition: VP1ErrorUtils.h:36
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
InDet::DefectsEmulatorBase::ATLAS_THREAD_SAFE
std::vector< unsigned int > m_dimPerHist ATLAS_THREAD_SAFE
Definition: DefectsEmulatorBase.h:41
InDet::DefectsEmulatorBase::DefectsEmulatorBase
DefectsEmulatorBase(const std::string &name, ISvcLocator *pSvcLocator)
Definition: DefectsEmulatorBase.cxx:12
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
InDet::DefectsEmulatorBase::m_histogrammingEnabled
bool m_histogrammingEnabled
Definition: DefectsEmulatorBase.h:50
InDet::DefectsEmulatorBase::m_histMutex
std::mutex m_histMutex
Definition: DefectsEmulatorBase.h:39
InDet::DefectsEmulatorBase::ATLAS_THREAD_SAFE
std::vector< TH2 * > m_hist ATLAS_THREAD_SAFE
Definition: DefectsEmulatorBase.h:44
AthReentrantAlgorithm.h
InDet::DefectsEmulatorBase::initialize
virtual StatusCode initialize() override
Definition: DefectsEmulatorBase.cxx:16
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
InDet::DefectsEmulatorBase::m_histogramGroupName
Gaudi::Property< std::string > m_histogramGroupName
Definition: DefectsEmulatorBase.h:34
InDet::DefectsEmulatorBase::m_rejectedRDOs
std::atomic< std::size_t > m_rejectedRDOs
Definition: DefectsEmulatorBase.h:47
ServiceHandle< ITHistSvc >