ATLAS Offline Software
StripClusterTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef STRIPCLUSTERTOOL_H
6 #define STRIPCLUSTERTOOL_H
7 
9 #include "GaudiKernel/ITHistSvc.h"
10 #include "GaudiKernel/IIncidentSvc.h"
11 #include "GaudiKernel/IIncidentListener.h"
12 #include "GaudiKernel/ServiceHandle.h"
13 
21 
28 
29 #include "TTree.h"
30 #include <functional>
31 #include <algorithm>
32 #include <map>
33 #include <utility>
34 
35 namespace MuonGM {
36  class MuonDetectorManager;
37 }
38 
39 
40 // namespace for the NSW LVL1 related classes
41 namespace NSWL1 {
42 
55  class StripClusterTool: virtual public IStripClusterTool,
56  public AthAlgTool,
57  public IIncidentListener {
58 
59  public:
60  StripClusterTool(const std::string& type,
61  const std::string& name,
62  const IInterface* parent);
63  virtual ~StripClusterTool()=default;
64  virtual StatusCode initialize() override;
65  virtual void handle (const Incident& inc) override;
66  virtual StatusCode cluster_strip_data(const EventContext& ctx, std::vector<std::unique_ptr<StripData>>& strips,std::vector<std::unique_ptr<StripClusterData>>& clusters) const override;
67 
68  private:
69  // methods implementing the internal data processing
72  void clear_ntuple_variables();
73  StatusCode fill_strip_validation_id(const EventContext& ctx,
74  std::vector<std::unique_ptr<StripClusterData>>& clusters,
75  std::vector< std::shared_ptr<std::vector<std::unique_ptr<StripData> >> > &cluster_cache) const;
76 
77  // needed Servives, Tools and Helpers
78  ServiceHandle< IIncidentSvc > m_incidentSvc{this, "IncidentSvc", "IncidentSvc"};
80  ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
81 
82  Gaudi::Property<bool> m_isMC {this, "IsMC", true, "This is MC"};
83  Gaudi::Property<bool> m_doNtuple {this, "DoNtuple", false, "Input the sTGC strip cluster branches into the analysis ntuple"};
84  SG::ReadHandleKey<MuonSimDataCollection> m_sTgcSdoContainerKey{this,"sTGC_SdoContainerName", "sTGC_SDO", "the name of the sTGC SDO container"};
85 
86  /* None of the TTree filling is thread-safe and should really be refactored.
87  * But we check in initialize() that this is only used in single-threaded mode.
88  */
89  TTree* m_tree{nullptr};
90  mutable int m_cl_n ATLAS_THREAD_SAFE{0};
91  std::vector<int> *m_cl_charge ATLAS_THREAD_SAFE{nullptr};
92  std::vector<int> *m_cl_size ATLAS_THREAD_SAFE{nullptr};
93  std::vector<float> *m_cl_x ATLAS_THREAD_SAFE{nullptr};
94  std::vector<float> *m_cl_y ATLAS_THREAD_SAFE{nullptr};
95  std::vector<float> *m_cl_z ATLAS_THREAD_SAFE{nullptr};
96  std::vector<float> *m_cl_lx ATLAS_THREAD_SAFE{nullptr};
97  std::vector<float> *m_cl_ly ATLAS_THREAD_SAFE{nullptr};
98  std::vector<float> *m_cl_lz ATLAS_THREAD_SAFE{nullptr};
99  std::vector<float> *m_cl_ltgx ATLAS_THREAD_SAFE{nullptr};
100  std::vector<float> *m_cl_ltgy ATLAS_THREAD_SAFE{nullptr};
101  std::vector<float> *m_cl_ltgz ATLAS_THREAD_SAFE{nullptr};
102 
103  std::vector<float> *m_cl_truth_x ATLAS_THREAD_SAFE{nullptr};
104  std::vector<float> *m_cl_truth_y ATLAS_THREAD_SAFE{nullptr};
105  std::vector<float> *m_cl_truth_z ATLAS_THREAD_SAFE{nullptr};
106 
107  std::vector<float> *m_cl_truth_lx ATLAS_THREAD_SAFE{nullptr};
108  std::vector<float> *m_cl_truth_ly ATLAS_THREAD_SAFE{nullptr};
109  std::vector<float> *m_cl_truth_lz ATLAS_THREAD_SAFE{nullptr};
110 
111  std::vector<float> *m_cl_truth_E ATLAS_THREAD_SAFE{nullptr};
112  std::vector<int> *m_cl_truth_n ATLAS_THREAD_SAFE{nullptr};
113 
114  std::vector<int> *m_cl_side ATLAS_THREAD_SAFE{nullptr};
115  std::vector<int> *m_cl_isSmall ATLAS_THREAD_SAFE{nullptr};
116  std::vector<int> *m_cl_wedge ATLAS_THREAD_SAFE{nullptr};
117  std::vector<int> *m_cl_sector ATLAS_THREAD_SAFE{nullptr};
118  std::vector<int> *m_cl_module ATLAS_THREAD_SAFE{nullptr};
119  std::vector<int> *m_cl_layer ATLAS_THREAD_SAFE{nullptr};
120  std::vector<int> *m_cl_bandId ATLAS_THREAD_SAFE{nullptr};
121 
122  std::vector<int> *m_cl_phiId ATLAS_THREAD_SAFE{nullptr};
123  }; // end of StripClusterTool class
124 } // namespace NSWL1
125 #endif
NSWL1::StripClusterTool::initialize
virtual StatusCode initialize() override
Definition: StripClusterTool.cxx:19
MuonGM
Ensure that the Athena extensions are properly loaded.
Definition: GeoMuonHits.h:27
TriggerTypes.h
NSWL1::StripClusterTool::handle
virtual void handle(const Incident &inc) override
Definition: StripClusterTool.cxx:57
IStripClusterTool.h
StripTdsOfflineTool.h
sTgcReadoutElement.h
NSWL1::StripClusterTool::m_sTgcSdoContainerKey
SG::ReadHandleKey< MuonSimDataCollection > m_sTgcSdoContainerKey
Definition: StripClusterTool.h:84
NSWL1::StripClusterTool::init_branches
StatusCode init_branches()
init the branches
Definition: StripClusterTool.cxx:63
SG::ReadHandleKey< MuonSimDataCollection >
NSWL1::StripClusterTool::fill_strip_validation_id
StatusCode fill_strip_validation_id(const EventContext &ctx, std::vector< std::unique_ptr< StripClusterData >> &clusters, std::vector< std::shared_ptr< std::vector< std::unique_ptr< StripData > >> > &cluster_cache) const
Definition: StripClusterTool.cxx:195
NSWL1::StripClusterTool::book_branches
StatusCode book_branches()
book the branches to analyze the StripTds
Definition: StripClusterTool.cxx:96
NSWL1::StripClusterTool::m_incidentSvc
ServiceHandle< IIncidentSvc > m_incidentSvc
Athena/Gaudi incident Service.
Definition: StripClusterTool.h:78
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AthAlgTool.h
NSWL1::StripClusterTool
interface for the StripTDS tools
Definition: StripClusterTool.h:57
test_pyathena.parent
parent
Definition: test_pyathena.py:15
NSWL1::StripClusterTool::m_doNtuple
Gaudi::Property< bool > m_doNtuple
Definition: StripClusterTool.h:83
StripOfflineData.h
NSWL1::StripClusterTool::ATLAS_THREAD_SAFE
int m_cl_n ATLAS_THREAD_SAFE
number of STRIP hit delivered
Definition: StripClusterTool.h:90
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
NSWL1::StripClusterTool::cluster_strip_data
virtual StatusCode cluster_strip_data(const EventContext &ctx, std::vector< std::unique_ptr< StripData >> &strips, std::vector< std::unique_ptr< StripClusterData >> &clusters) const override
Definition: StripClusterTool.cxx:373
NSWL1::StripClusterTool::m_tree
TTree * m_tree
ntuple for analysis
Definition: StripClusterTool.h:89
MuonDetectorManager.h
NSWL1::StripClusterTool::StripClusterTool
StripClusterTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: StripClusterTool.cxx:11
NSWL1::StripClusterTool::~StripClusterTool
virtual ~StripClusterTool()=default
MuonGM::MuonDetectorManager
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h:50
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
RunTileMonitoring.clusters
clusters
Definition: RunTileMonitoring.py:133
sTgcDigit.h
sTgcDigitContainer.h
PadTrigger.h
AthAlgTool
Definition: AthAlgTool.h:26
NSWL1::StripClusterTool::clear_ntuple_variables
void clear_ntuple_variables()
clear the variables used in the analysis
Definition: StripClusterTool.cxx:161
MuonSimDataCollection.h
NSWL1
A trigger trigger candidate for a stgc sector.
Definition: NSWL1Simulation.cxx:9
IMuonIdHelperSvc.h
NSWL1::StripClusterTool::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: StripClusterTool.h:80
NSWL1::StripClusterTool::m_detManager
const MuonGM::MuonDetectorManager * m_detManager
MuonDetectorManager.
Definition: StripClusterTool.h:79
StripClusterOfflineData.h
MuonSimData.h
ServiceHandle< IIncidentSvc >
NSWL1::IStripClusterTool
interface for the Strip Cluster Tools
Definition: IStripClusterTool.h:34
NSWL1::StripClusterTool::m_isMC
Gaudi::Property< bool > m_isMC
Definition: StripClusterTool.h:82