ATLAS Offline Software
StripTdsOfflineTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef STRIPTDSOFFLINETOOL_H
6 #define STRIPTDSOFFLINETOOL_H
7 
9 #include "CLHEP/Random/RandFlat.h"
10 #include "CLHEP/Random/RandGauss.h"
11 #include "GaudiKernel/EventContext.h"
12 #include "GaudiKernel/IIncidentSvc.h"
13 #include "GaudiKernel/IIncidentListener.h"
14 #include "GaudiKernel/ITHistSvc.h"
15 #include "GaudiKernel/ThreadLocalContext.h"
16 #include "GaudiKernel/ServiceHandle.h"
24 
30 
31 #include "TTree.h"
33 #include <functional>
34 #include <algorithm>
35 #include <map>
36 #include <utility>
37 
38 namespace MuonGM {
39  class MuonDetectorManager;
40 }
41 
42 namespace NSWL1 {
43 
71  class StripHits;
72 
73  class StripTdsOfflineTool: virtual public IStripTdsTool,
74  public AthAlgTool,
75  public IIncidentListener {
76 
77  public:
78  StripTdsOfflineTool(const std::string& type,
79  const std::string& name,
80  const IInterface* parent);
81 
82  virtual ~StripTdsOfflineTool()=default;
83 
84  virtual StatusCode initialize() override;
85 
86  virtual void handle (const Incident& inc) override;
87 
88  virtual StatusCode gather_strip_data(std::vector<std::unique_ptr<StripData>>& strips,const std::vector<std::unique_ptr<PadTrigger>>& padTriggers) const override;
89 
90 
91  private:
92  // methods implementing the internal data processing
93  StatusCode fill_strip_cache(const std::vector<std::unique_ptr<PadTrigger>>& padTriggers, std::vector<std::unique_ptr<StripData>> &strip_cache) const;
94 
96  void clear_ntuple_variables();
97  void fill_strip_validation_id(std::vector<std::unique_ptr<StripData>> &strip_cache) const;
98  bool readStrip( StripData* ,const std::vector<std::unique_ptr<PadTrigger>>&) const;
99 
100  // needed Servives, Tools and Helpers
101  ServiceHandle<IIncidentSvc> m_incidentSvc{this, "IncidentSvc", "IncidentSvc"};
103  ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
104 
105  // hidden variables
106  Gaudi::Property<bool> m_doNtuple{this, "DoNtuple", false, "Input StripTds branches into the analysis ntuple"};
107 
108  // activate MC-only processes
109  Gaudi::Property<bool> m_isMC {this, "IsMC", true, "This is MC"};
110 
111 
112  /* None of the TTree filling is thread-safe and should really be refactored.
113  * But we check in initialize() that this is only used in single-threaded mode.
114  */
115  TTree* m_tree ATLAS_THREAD_SAFE{nullptr};
116  mutable int m_nStripHits ATLAS_THREAD_SAFE;
117  std::vector<float > *m_stripCharge ATLAS_THREAD_SAFE{nullptr};
118  std::vector<float > *m_stripCharge_6bit ATLAS_THREAD_SAFE{nullptr};
119  std::vector<float > *m_stripCharge_10bit ATLAS_THREAD_SAFE{nullptr};
120  std::vector<float > *m_strip_global_X ATLAS_THREAD_SAFE{nullptr};
121  std::vector<float > *m_strip_global_Y ATLAS_THREAD_SAFE{nullptr};
122  std::vector<float > *m_strip_global_Z ATLAS_THREAD_SAFE{nullptr};
123  std::vector<float > *m_strip_local_X ATLAS_THREAD_SAFE{nullptr};
124  std::vector<float > *m_strip_local_Y ATLAS_THREAD_SAFE{nullptr};
125  std::vector<float > *m_strip_layer ATLAS_THREAD_SAFE{nullptr};
126  std::vector<bool > *m_strip_isSmall ATLAS_THREAD_SAFE{nullptr};
127  std::vector<float > *m_strip_eta ATLAS_THREAD_SAFE{nullptr};
128  std::vector<float > *m_strip_phi ATLAS_THREAD_SAFE{nullptr};
129  std::vector<bool > *m_strip_readStrip ATLAS_THREAD_SAFE{nullptr};
130  std::vector<int > *m_strip_channel ATLAS_THREAD_SAFE{nullptr};
131  std::vector<int > *m_strip_BCID ATLAS_THREAD_SAFE{nullptr};
132  std::vector<int > *m_strip_wedge ATLAS_THREAD_SAFE{nullptr};
133  std::vector<float > *m_strip_time ATLAS_THREAD_SAFE{nullptr};
134 
135  SG::ReadHandleKey<sTgcDigitContainer> m_sTgcDigitContainer = {this,"sTGC_DigitContainerName","sTGC_DIGITS","the name of the sTGC digit container"};
136  SG::ReadHandleKey<MuonSimDataCollection> m_sTgcSdoContainer = {this,"sTGC_SdoContainerName","sTGC_SDO","the name of the sTGC SDO container"};
137 
138  }; // end of StripTdsOfflineTool class
139 
140 } // namespace NSWL1
141 
142 #endif
NSWL1::StripTdsOfflineTool::m_detManager
const MuonGM::MuonDetectorManager * m_detManager
MuonDetectorManager.
Definition: StripTdsOfflineTool.h:102
MuonGM
Ensure that the Athena extensions are properly loaded.
Definition: GeoMuonHits.h:27
NSWL1::StripTdsOfflineTool::fill_strip_validation_id
void fill_strip_validation_id(std::vector< std::unique_ptr< StripData >> &strip_cache) const
fill the ntuple branch for the StripTdsOffline
Definition: StripTdsOfflineTool.cxx:151
TriggerTypes.h
NSWL1::StripTdsOfflineTool::StripTdsOfflineTool
StripTdsOfflineTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: StripTdsOfflineTool.cxx:27
NSWL1::StripTdsOfflineTool::m_sTgcSdoContainer
SG::ReadHandleKey< MuonSimDataCollection > m_sTgcSdoContainer
Definition: StripTdsOfflineTool.h:136
NSWL1::StripTdsOfflineTool::handle
virtual void handle(const Incident &inc) override
Definition: StripTdsOfflineTool.cxx:73
sTgcReadoutElement.h
NSWL1::StripTdsOfflineTool::initialize
virtual StatusCode initialize() override
Definition: StripTdsOfflineTool.cxx:36
SG::ReadHandleKey< sTgcDigitContainer >
NSWL1::StripTdsOfflineTool::~StripTdsOfflineTool
virtual ~StripTdsOfflineTool()=default
NSWL1::StripData
abstract class to interface the data hit fragment output from the Strip TDS
Definition: StripData.h:30
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AthAlgTool.h
test_pyathena.parent
parent
Definition: test_pyathena.py:15
IStripTdsTool.h
NSWL1::StripTdsOfflineTool::ATLAS_THREAD_SAFE
int m_nStripHits ATLAS_THREAD_SAFE
number of STRIP hit delivered
Definition: StripTdsOfflineTool.h:116
StripOfflineData.h
NSWL1::StripTdsOfflineTool::fill_strip_cache
StatusCode fill_strip_cache(const std::vector< std::unique_ptr< PadTrigger >> &padTriggers, std::vector< std::unique_ptr< StripData >> &strip_cache) const
Definition: StripTdsOfflineTool.cxx:185
NSWL1::StripTdsOfflineTool::m_doNtuple
Gaudi::Property< bool > m_doNtuple
Definition: StripTdsOfflineTool.h:106
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
PadOfflineData.h
NSWL1::IStripTdsTool
interface for the StripTDS tools
Definition: IStripTdsTool.h:30
MuonDetectorManager.h
NSWL1::StripTdsOfflineTool
Definition: StripTdsOfflineTool.h:75
NSWL1::StripTdsOfflineTool::m_sTgcDigitContainer
SG::ReadHandleKey< sTgcDigitContainer > m_sTgcDigitContainer
Definition: StripTdsOfflineTool.h:135
MuonGM::MuonDetectorManager
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h:49
NSWL1::StripTdsOfflineTool::ATLAS_THREAD_SAFE
TTree *m_tree ATLAS_THREAD_SAFE
ntuple for analysis
Definition: StripTdsOfflineTool.h:115
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
NSWL1::StripTdsOfflineTool::clear_ntuple_variables
void clear_ntuple_variables()
clear the variables used in the analysis ntuple
Definition: StripTdsOfflineTool.cxx:126
NSWL1::StripTdsOfflineTool::readStrip
bool readStrip(StripData *, const std::vector< std::unique_ptr< PadTrigger >> &) const
Definition: StripTdsOfflineTool.cxx:304
sTgcDigit.h
NSWL1::StripTdsOfflineTool::m_incidentSvc
ServiceHandle< IIncidentSvc > m_incidentSvc
Athena/Gaudi incident Service.
Definition: StripTdsOfflineTool.h:101
sTgcDigitContainer.h
PadTrigger.h
AthAlgTool
Definition: AthAlgTool.h:26
MuonSimDataCollection.h
checker_macros.h
Define macros for attributes used to control the static checker.
NSWL1::StripTdsOfflineTool::gather_strip_data
virtual StatusCode gather_strip_data(std::vector< std::unique_ptr< StripData >> &strips, const std::vector< std::unique_ptr< PadTrigger >> &padTriggers) const override
Definition: StripTdsOfflineTool.cxx:168
NSWL1
A trigger trigger candidate for a stgc sector.
Definition: NSWL1Simulation.cxx:9
NSWL1::StripTdsOfflineTool::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: StripTdsOfflineTool.h:103
NSWL1::StripTdsOfflineTool::m_isMC
Gaudi::Property< bool > m_isMC
Definition: StripTdsOfflineTool.h:109
IMuonIdHelperSvc.h
NSWL1::StripTdsOfflineTool::book_branches
StatusCode book_branches()
book the branches to analyze the StripTds behavior
Definition: StripTdsOfflineTool.cxx:80
MuonSimData.h
ServiceHandle< IIncidentSvc >