ATLAS Offline Software
Loading...
Searching...
No Matches
JfexSimMonitorAlgorithm.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4#ifndef TRIGT1CALOMONITORING_JFEXSIMMONITORALGORITHM_H
5#define TRIGT1CALOMONITORING_JFEXSIMMONITORALGORITHM_H
6
10
17
20
22
24 public:
25 JfexSimMonitorAlgorithm( const std::string& name, ISvcLocator* pSvcLocator );
26 virtual ~JfexSimMonitorAlgorithm()=default;
27 virtual StatusCode initialize() override;
28 virtual StatusCode fillHistograms( const EventContext& ctx ) const override;
29
30 private:
31
32 // container keys for jfex input data
33 SG::ReadHandleKey<xAOD::jFexTowerContainer> m_jFexTowerKey{this, "jFexTowerContainer","L1_jFexDataTowers","SG key of the input jFex Tower container"};
34 SG::ReadHandleKey<CaloCellContainer> m_scellKey{this, "CaloCellContainerReadKey","SCell","Read handle key for the supercells"};
35
36 // container keys for Data tobs
37 SG::ReadHandleKey< xAOD::jFexSRJetRoIContainer > m_data_key_jJ {this,"jFexSRJetRoIContainer","L1_jFexSRJetRoI","SG key of the jFex SR Jet Roi container"};
38 SG::ReadHandleKey< xAOD::jFexLRJetRoIContainer > m_data_key_jLJ {this,"jFexLRJetRoIContainer","L1_jFexLRJetRoI","SG key of the jFex LR Jet Roi container"};
39 SG::ReadHandleKey< xAOD::jFexTauRoIContainer > m_data_key_jTau {this,"jFexTauRoIContainer" ,"L1_jFexTauRoI" ,"SG key of the jFex Tau Roi container" };
40 SG::ReadHandleKey< xAOD::jFexFwdElRoIContainer > m_data_key_jEM {this,"jFexFwdElRoIContainer","L1_jFexFwdElRoI","SG key of the jFex EM Roi container" };
41 SG::ReadHandleKey< xAOD::jFexMETRoIContainer > m_data_key_jXE {this,"jFexMETRoIContainer" ,"L1_jFexMETRoI" ,"SG key of the jFex MET Roi container" };
42 SG::ReadHandleKey< xAOD::jFexSumETRoIContainer > m_data_key_jTE {this,"jFexSumETRoIContainer","L1_jFexSumETRoI","SG key of the jFex SumEt Roi container" };
43
44 // container keys for Simulation tobs
45 SG::ReadHandleKey< xAOD::jFexSRJetRoIContainer > m_simu_key_jJ {this,"jFexSRJetRoISimContainer","L1_jFexSRJetRoISim","SG key of the Sim jFex SR Jet Roi container"};
46 SG::ReadHandleKey< xAOD::jFexLRJetRoIContainer > m_simu_key_jLJ {this,"jFexLRJetRoISimContainer","L1_jFexLRJetRoISim","SG key of the Sim jFex LR Jet Roi container"};
47 SG::ReadHandleKey< xAOD::jFexTauRoIContainer > m_simu_key_jTau {this,"jFexTauRoISimContainer" ,"L1_jFexTauRoISim" ,"SG key of the Sim jFex Tau Roi container" };
48 SG::ReadHandleKey< xAOD::jFexFwdElRoIContainer > m_simu_key_jEM {this,"jFexFwdElRoISimContainer","L1_jFexFwdElRoISim","SG key of the Sim jFex EM Roi container" };
49 SG::ReadHandleKey< xAOD::jFexMETRoIContainer > m_simu_key_jXE {this,"jFexMETRoISimContainer" ,"L1_jFexMETRoISim" ,"SG key of the Sim jFex MET Roi container" };
50 SG::ReadHandleKey< xAOD::jFexSumETRoIContainer > m_simu_key_jTE {this,"jFexSumETRoISimContainer","L1_jFexSumETRoISim","SG key of the Sim jFex SumEt Roi container" };
51
52 SG::ReadCondHandleKey<LArBadChannelCont> m_bcContKey{this, "LArMaskedChannelKey", "LArMaskedSC", "Key of the OTF-Masked SC" };
53
54 template <typename T> bool compareRoI(const std::string& label, const std::string& evenType,
55 const SG::ReadHandleKey<T>& tobs1Key,
56 const SG::ReadHandleKey<T>& tobs2Key,
57 const EventContext& ctx, bool simReadyFlag=false, size_t maxTobs=0) const;
58
59 // map hold the binlabels (in form of LBN:FirstEventNum) to use for each lb
60 mutable std::map<int,std::string> m_firstEvents ATLAS_THREAD_SAFE;
61 mutable std::mutex m_firstEventsMutex;
62
63
64 struct SortableTob {
65 SortableTob(unsigned int w, float e, float p) : word0(w),eta(e),phi(p) { }
66 unsigned int word0;
67 float eta,phi;
68 };
69 template <typename T> void fillVectors(const SG::ReadHandleKey<T>& key, const EventContext& ctx, std::vector<float>& etas, std::vector<float>& phis, std::vector<unsigned int>& word0s) const {
70 etas.clear();phis.clear();word0s.clear();
71 SG::ReadHandle<T> tobs{key, ctx};
72 if(tobs.isValid()) {
73 etas.reserve(tobs->size());
74 phis.reserve(tobs->size());
75 word0s.reserve(tobs->size());
76 std::vector<SortableTob> sortedTobs;
77 sortedTobs.reserve(tobs->size());
78 for(const auto tob : *tobs) {
79 sortedTobs.emplace_back(SortableTob{tob->tobWord(),tob->eta(),tob->phi()});
80 }
81 std::sort(sortedTobs.begin(),sortedTobs.end(),[](const SortableTob& lhs, const SortableTob& rhs) { return lhs.word0<rhs.word0; });
82 for(const auto& tob : sortedTobs) {
83 etas.push_back(tob.eta);
84 phis.push_back(tob.phi);
85 word0s.push_back(tob.word0);
86 }
87 }
88 }
89
90};
91
92// specializations for global tob types (no eta and phi values)
93template <> void JfexSimMonitorAlgorithm::fillVectors(const SG::ReadHandleKey<xAOD::jFexMETRoIContainer>& key, const EventContext& ctx, std::vector<float>& etas, std::vector<float>& phis, std::vector<unsigned int>& word0s) const;
94template <> void JfexSimMonitorAlgorithm::fillVectors(const SG::ReadHandleKey<xAOD::jFexSumETRoIContainer>& key, const EventContext& ctx, std::vector<float>& etas, std::vector<float>& phis, std::vector<unsigned int>& word0s) const;
95
96#endif
Header file to be included by clients of the Monitored infrastructure.
Property holding a SG store/key/clid from which a ReadHandle is made.
AthMonitorAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
SG::ReadHandleKey< xAOD::jFexLRJetRoIContainer > m_data_key_jLJ
SG::ReadHandleKey< xAOD::jFexMETRoIContainer > m_simu_key_jXE
SG::ReadHandleKey< xAOD::jFexFwdElRoIContainer > m_simu_key_jEM
SG::ReadHandleKey< xAOD::jFexTowerContainer > m_jFexTowerKey
SG::ReadHandleKey< xAOD::jFexTauRoIContainer > m_data_key_jTau
SG::ReadHandleKey< xAOD::jFexSRJetRoIContainer > m_data_key_jJ
SG::ReadHandleKey< xAOD::jFexLRJetRoIContainer > m_simu_key_jLJ
virtual StatusCode fillHistograms(const EventContext &ctx) const override
adds event to the monitoring histograms
virtual ~JfexSimMonitorAlgorithm()=default
SG::ReadHandleKey< xAOD::jFexSumETRoIContainer > m_data_key_jTE
SG::ReadCondHandleKey< LArBadChannelCont > m_bcContKey
std::map< int, std::string > m_firstEvents ATLAS_THREAD_SAFE
SG::ReadHandleKey< xAOD::jFexFwdElRoIContainer > m_data_key_jEM
void fillVectors(const SG::ReadHandleKey< T > &key, const EventContext &ctx, std::vector< float > &etas, std::vector< float > &phis, std::vector< unsigned int > &word0s) const
SG::ReadHandleKey< xAOD::jFexSumETRoIContainer > m_simu_key_jTE
SG::ReadHandleKey< CaloCellContainer > m_scellKey
SG::ReadHandleKey< xAOD::jFexMETRoIContainer > m_data_key_jXE
SG::ReadHandleKey< xAOD::jFexTauRoIContainer > m_simu_key_jTau
SG::ReadHandleKey< xAOD::jFexSRJetRoIContainer > m_simu_key_jJ
Property holding a SG store/key/clid from which a ReadHandle is made.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
std::string label(const std::string &format, int i)
Definition label.h:19
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
void initialize()
SortableTob(unsigned int w, float e, float p)