ATLAS Offline Software
MMTriggerTool.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 MMTRIGGERTOOL_H
6 #define MMTRIGGERTOOL_H
7 
8 //basic includes
11 #include "Gaudi/Property.h"
12 #include "GaudiKernel/IIncidentListener.h"
13 #include "GaudiKernel/ITHistSvc.h"
14 #include "GaudiKernel/IIncidentSvc.h"
16 
17 //local includes
21 #include "TTree.h"
22 
27 
28 namespace MuonGM {
29  class MuonDetectorManager;
30 }
31 
32 
33 // namespace for the NSW LVL1 related classes
34 namespace NSWL1 {
35 
36  class MMTriggerTool: virtual public IMMTriggerTool,
37  public AthAlgTool,
38  public IIncidentListener {
39 
40  public:
41 
42  MMTriggerTool(const std::string& type, const std::string& name, const IInterface* parent);
43 
44  virtual ~MMTriggerTool()=default;
45 
46  virtual StatusCode initialize();
47 
48  virtual void handle (const Incident& inc);
49 
50  StatusCode runTrigger(const EventContext& ctx, Muon::NSW_TrigRawDataContainer* rdo, const bool do_MMDiamonds) const;
51 
52  private:
53 
54  // needed Servives, Tools and Helpers
55  ServiceHandle< IIncidentSvc > m_incidentSvc{this, "IncidentSvc", "IncidentSvc"};
56 
57  // read data handle
58  SG::ReadHandleKey<McEventCollection> m_keyMcEventCollection{this,"McEventCollection","TruthEvent","Location of TruthEvent"};
59  SG::ReadHandleKey<TrackRecordCollection> m_keyMuonEntryLayer{this,"MuonEntryLayer","MuonEntryLayer","Location of MuonEntryLayer"};
60  SG::ReadHandleKey<MmDigitContainer> m_keyMmDigitContainer{this,"MmDigitContainer","MM_DIGITS","Location of MmDigitContainer"};
61  Gaudi::Property<bool> m_isMC {this, "IsMC", true, "This is MC"};
62  Gaudi::Property<bool> m_doTruth {this, "DoTruth", false, "Process truth information. Disabled by default"};
63 
64  // Parameters for Diamond Road algorithms
65  Gaudi::Property<bool> m_trapShape {this, "TrapezoidalShape", true, "Consider the quadruplet as a trapezoid"};
66  Gaudi::Property<int> m_diamRoadSize {this, "DiamondRoadSize", 8, "Number of strips to create a road"};
67  Gaudi::Property<bool> m_uv {this, "DiamondUV", true, "Include Stereo planes for tracking"};
68  Gaudi::Property<int> m_diamXthreshold {this, "DiamondEtaThreshold", 3, "Number of Eta planes for coincidences"};
69  Gaudi::Property<int> m_diamUVthreshold {this, "DiamondStereoThreshold", 3, "Number of Stereo planes for coincidences"};
70  Gaudi::Property<int> m_diamOverlapEtaUp {this, "DiamondEtaUpOverlap", 4, "Number of Eta strips for upper road overlap"};
71  Gaudi::Property<int> m_diamOverlapEtaDown {this, "DiamondEtaDownOverlap", 0, "Number of Eta strips for lower road overlap"};
72  Gaudi::Property<int> m_diamOverlapStereoUp {this, "DiamondStereoUpOverlap", 4, "Number of Stereo strips for upper road overlap"};
73  Gaudi::Property<int> m_diamOverlapStereoDown{this, "DiamondStereoDownOverlap", 0, "Number of Stereo strips for lower road overlap"};
74 
75  // Parameters for RDO encoding
76  Gaudi::Property<std::string> m_mmDigitContainer{this, "MM_DigitContainerName", "MM_DIGITS", "Name of the MM digit container"};
77  Gaudi::Property<bool> m_doNtuple {this, "DoNtuple", false, "Input the MMStrip branches into the analysis ntuple"};
78  Gaudi::Property<float> m_phiMin {this, "PhiMin", -16.*M_PI/180.0, "Minimum Phi"};
79  Gaudi::Property<float> m_phiMax {this, "PhiMax", 16.*M_PI/180.0, "Maximum Phi"};
80  Gaudi::Property<int> m_phiBits {this, "PhiBits", 6, "Number of Phi bits"};
81  Gaudi::Property<float> m_rMin {this, "RMin", 900.0, "Minimum R [mm]"};
82  Gaudi::Property<float> m_rMax {this, "RMax", 5000.0, "Maximum R [mm]"};
83  Gaudi::Property<int> m_rBits {this, "RBits", 8, "Number of R bits"};
84  Gaudi::Property<float> m_dThetaMin {this, "DThetaMin", -0.015, "Minimum dTheta [rad]"};
85  Gaudi::Property<float> m_dThetaMax {this, "DThetaMax", 0.015, "Maximum dTheta [rad]"};
86  Gaudi::Property<int> m_dThetaBits {this, "DThetaBits", 5, "Number of dTheta bits"};
87 
88  std::shared_ptr<MMT_Parameters> m_par_large;
89  std::shared_ptr<MMT_Parameters> m_par_small;
92 
93  //Histogram
95  void clear_ntuple_variables();
96  void fillNtuple(const histogramDigitVariables& histDigVars) const;
97 
98  /* None of the TTree filling is thread-safe and should really be refactored.
99  * But we check in initialize() that this is only used in single-threaded mode.
100  */
101  TTree* m_tree ATLAS_THREAD_SAFE{nullptr};
102  std::vector<unsigned int>* m_trigger_diamond_ntrig ATLAS_THREAD_SAFE{nullptr};
103  std::vector<int>* m_trigger_diamond_bc ATLAS_THREAD_SAFE{nullptr};
104  std::vector<char>* m_trigger_diamond_sector ATLAS_THREAD_SAFE{nullptr};
105  std::vector<int>* m_trigger_diamond_stationPhi ATLAS_THREAD_SAFE{nullptr};
106  std::vector<unsigned int>* m_trigger_diamond_totalCount ATLAS_THREAD_SAFE{nullptr};
107  std::vector<unsigned int>* m_trigger_diamond_realCount ATLAS_THREAD_SAFE{nullptr};
108  std::vector<int>* m_trigger_diamond_iX ATLAS_THREAD_SAFE{nullptr};
109  std::vector<int>* m_trigger_diamond_iU ATLAS_THREAD_SAFE{nullptr};
110  std::vector<int>* m_trigger_diamond_iV ATLAS_THREAD_SAFE{nullptr};
111  std::vector<unsigned int>* m_trigger_diamond_XbkgCount ATLAS_THREAD_SAFE{nullptr};
112  std::vector<unsigned int>* m_trigger_diamond_UVbkgCount ATLAS_THREAD_SAFE{nullptr};
113  std::vector<unsigned int>* m_trigger_diamond_XmuonCount ATLAS_THREAD_SAFE{nullptr};
114  std::vector<unsigned int>* m_trigger_diamond_UVmuonCount ATLAS_THREAD_SAFE{nullptr};
115  std::vector<int>* m_trigger_diamond_age ATLAS_THREAD_SAFE{nullptr};
116  std::vector<double>* m_trigger_diamond_mx ATLAS_THREAD_SAFE{nullptr};
117  std::vector<double>* m_trigger_diamond_my ATLAS_THREAD_SAFE{nullptr};
118  std::vector<double>* m_trigger_diamond_Uavg ATLAS_THREAD_SAFE{nullptr};
119  std::vector<double>* m_trigger_diamond_Vavg ATLAS_THREAD_SAFE{nullptr};
120  std::vector<double>* m_trigger_diamond_mxl ATLAS_THREAD_SAFE{nullptr};
121  std::vector<double>* m_trigger_diamond_theta ATLAS_THREAD_SAFE{nullptr};
122  std::vector<double>* m_trigger_diamond_eta ATLAS_THREAD_SAFE{nullptr};
123  std::vector<double>* m_trigger_diamond_dtheta ATLAS_THREAD_SAFE{nullptr};
124  std::vector<double>* m_trigger_diamond_phi ATLAS_THREAD_SAFE{nullptr};
125  std::vector<double>* m_trigger_diamond_phiShf ATLAS_THREAD_SAFE{nullptr};
126  std::vector<uint8_t>* m_trigger_diamond_TP_phi_id ATLAS_THREAD_SAFE{nullptr};
127  std::vector<uint8_t>* m_trigger_diamond_TP_R_id ATLAS_THREAD_SAFE{nullptr};
128  std::vector<uint8_t>* m_trigger_diamond_TP_dTheta_id ATLAS_THREAD_SAFE{nullptr};
129 
130  std::vector<double>* m_trigger_RZslopes ATLAS_THREAD_SAFE{nullptr};
131  std::vector<double>* m_trigger_trueEtaRange ATLAS_THREAD_SAFE{nullptr};
132  std::vector<double>* m_trigger_truePtRange ATLAS_THREAD_SAFE{nullptr};
133 
134  std::vector<int>* m_trigger_VMM ATLAS_THREAD_SAFE{nullptr};
135  std::vector<int>* m_trigger_plane ATLAS_THREAD_SAFE{nullptr};
136  std::vector<int>* m_trigger_station ATLAS_THREAD_SAFE{nullptr};
137  std::vector<int>* m_trigger_strip ATLAS_THREAD_SAFE{nullptr};
138  std::vector<double>* m_trigger_slope ATLAS_THREAD_SAFE{nullptr};
139  std::vector<double>* m_trigger_trueThe ATLAS_THREAD_SAFE{nullptr};
140  std::vector<double>* m_trigger_truePhi ATLAS_THREAD_SAFE{nullptr};
141  std::vector<double>* m_trigger_trueDth ATLAS_THREAD_SAFE{nullptr};
142  std::vector<double>* m_trigger_trueEtaEnt ATLAS_THREAD_SAFE{nullptr};
143  std::vector<double>* m_trigger_trueTheEnt ATLAS_THREAD_SAFE{nullptr};
144  std::vector<double>* m_trigger_truePhiEnt ATLAS_THREAD_SAFE{nullptr};
145  std::vector<double>* m_trigger_trueEtaPos ATLAS_THREAD_SAFE{nullptr};
146  std::vector<double>* m_trigger_trueThePos ATLAS_THREAD_SAFE{nullptr};
147  std::vector<double>* m_trigger_truePhiPos ATLAS_THREAD_SAFE{nullptr};
148 
149  std::vector<std::string> *m_NSWMM_dig_stationName ATLAS_THREAD_SAFE{nullptr};
150  std::vector<int> *m_NSWMM_dig_stationEta ATLAS_THREAD_SAFE{nullptr};
151  std::vector<int> *m_NSWMM_dig_stationPhi ATLAS_THREAD_SAFE{nullptr};
152  std::vector<int> *m_NSWMM_dig_multiplet ATLAS_THREAD_SAFE{nullptr};
153  std::vector<int> *m_NSWMM_dig_gas_gap ATLAS_THREAD_SAFE{nullptr};
154  std::vector<int> *m_NSWMM_dig_channel ATLAS_THREAD_SAFE{nullptr};
155 
156  std::vector< std::vector<float> > *m_NSWMM_dig_time ATLAS_THREAD_SAFE{nullptr};
157  std::vector< std::vector<float> > *m_NSWMM_dig_charge ATLAS_THREAD_SAFE{nullptr};
158  std::vector< std::vector<int> > *m_NSWMM_dig_stripPosition ATLAS_THREAD_SAFE{nullptr};
159  std::vector< std::vector<double> > *m_NSWMM_dig_stripLposX ATLAS_THREAD_SAFE{nullptr};
160  std::vector< std::vector<double> > *m_NSWMM_dig_stripLposY ATLAS_THREAD_SAFE{nullptr};
161  std::vector< std::vector<double> > *m_NSWMM_dig_stripGposX ATLAS_THREAD_SAFE{nullptr};
162  std::vector< std::vector<double> > *m_NSWMM_dig_stripGposY ATLAS_THREAD_SAFE{nullptr};
163  std::vector< std::vector<double> > *m_NSWMM_dig_stripGposZ ATLAS_THREAD_SAFE{nullptr};
164  }; // end of MMTriggerTool class
165 } // namespace NSWL1
166 #endif
NSWL1::MMTriggerTool::m_keyMmDigitContainer
SG::ReadHandleKey< MmDigitContainer > m_keyMmDigitContainer
Definition: MMTriggerTool.h:60
NSWL1::MMTriggerTool::m_diamXthreshold
Gaudi::Property< int > m_diamXthreshold
Definition: MMTriggerTool.h:68
MuonGM
Ensure that the Athena extensions are properly loaded.
Definition: GeoMuonHits.h:27
NSWL1::MMTriggerTool::~MMTriggerTool
virtual ~MMTriggerTool()=default
NSWL1::MMTriggerTool::m_diamOverlapStereoDown
Gaudi::Property< int > m_diamOverlapStereoDown
Definition: MMTriggerTool.h:73
NSWL1::IMMTriggerTool
Definition: IMMTriggerTool.h:19
NSWL1::MMTriggerTool::m_diamOverlapEtaUp
Gaudi::Property< int > m_diamOverlapEtaUp
Definition: MMTriggerTool.h:70
NSWL1::MMTriggerTool::m_dThetaMin
Gaudi::Property< float > m_dThetaMin
Definition: MMTriggerTool.h:84
MMLoadVariables.h
NSWL1::MMTriggerTool::m_phiMax
Gaudi::Property< float > m_phiMax
Definition: MMTriggerTool.h:79
NSWL1::MMTriggerTool::initialize
virtual StatusCode initialize()
Definition: MMTriggerTool.cxx:20
NSWL1::MMTriggerTool::m_diamOverlapEtaDown
Gaudi::Property< int > m_diamOverlapEtaDown
Definition: MMTriggerTool.h:71
NSWL1::MMTriggerTool::clear_ntuple_variables
void clear_ntuple_variables()
clear the variables used in the analysis ntuple
Definition: MMTriggerToolTree.cxx:161
M_PI
#define M_PI
Definition: ActiveFraction.h:11
NSWL1::MMTriggerTool::book_branches
StatusCode book_branches()
book the branches
Definition: MMTriggerToolTree.cxx:27
NSWL1::MMTriggerTool::m_rMax
Gaudi::Property< float > m_rMax
Definition: MMTriggerTool.h:82
SG::ReadHandleKey< McEventCollection >
MmDigit.h
NSWL1::MMTriggerTool::handle
virtual void handle(const Incident &inc)
Definition: MMTriggerToolTree.cxx:20
NSWL1::MMTriggerTool::m_uv
Gaudi::Property< bool > m_uv
Definition: MMTriggerTool.h:67
NSWL1::MMTriggerTool::m_mmDigitContainer
Gaudi::Property< std::string > m_mmDigitContainer
Definition: MMTriggerTool.h:76
NSWL1::MMTriggerTool::m_MmIdHelper
const MmIdHelper * m_MmIdHelper
MM offline Id helper.
Definition: MMTriggerTool.h:91
McEventCollection.h
NSWL1::MMTriggerTool
Definition: MMTriggerTool.h:38
MmDigitContainer.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
NSWL1::MMTriggerTool::m_detManager
const MuonGM::MuonDetectorManager * m_detManager
MuonDetectorManager.
Definition: MMTriggerTool.h:90
NSWL1::MMTriggerTool::ATLAS_THREAD_SAFE
TTree *m_tree ATLAS_THREAD_SAFE
ntuple for analysis
Definition: MMTriggerTool.h:101
AthAlgTool.h
MmIdHelper.h
test_pyathena.parent
parent
Definition: test_pyathena.py:15
NSWL1::MMTriggerTool::m_keyMuonEntryLayer
SG::ReadHandleKey< TrackRecordCollection > m_keyMuonEntryLayer
Definition: MMTriggerTool.h:59
NSWL1::MMTriggerTool::fillNtuple
void fillNtuple(const histogramDigitVariables &histDigVars) const
Definition: MMTriggerToolTree.cxx:233
NSWL1::MMTriggerTool::MMTriggerTool
MMTriggerTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: MMTriggerTool.cxx:11
NSWL1::MMTriggerTool::m_trapShape
Gaudi::Property< bool > m_trapShape
Definition: MMTriggerTool.h:65
NSWL1::MMTriggerTool::m_diamRoadSize
Gaudi::Property< int > m_diamRoadSize
Definition: MMTriggerTool.h:66
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
TrackRecordCollection.h
NSWL1::MMTriggerTool::m_dThetaMax
Gaudi::Property< float > m_dThetaMax
Definition: MMTriggerTool.h:85
IMMTriggerTool.h
NSWL1::MMTriggerTool::m_incidentSvc
ServiceHandle< IIncidentSvc > m_incidentSvc
Athena/Gaudi incident Service.
Definition: MMTriggerTool.h:55
NSWL1::MMTriggerTool::m_keyMcEventCollection
SG::ReadHandleKey< McEventCollection > m_keyMcEventCollection
Definition: MMTriggerTool.h:58
NSWL1::MMTriggerTool::m_par_small
std::shared_ptr< MMT_Parameters > m_par_small
Definition: MMTriggerTool.h:89
histogramDigitVariables
Definition: MMLoadVariables.h:30
MmIdHelper
Definition: MmIdHelper.h:54
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
NSWL1::MMTriggerTool::m_isMC
Gaudi::Property< bool > m_isMC
Definition: MMTriggerTool.h:61
NSWL1::MMTriggerTool::m_diamUVthreshold
Gaudi::Property< int > m_diamUVthreshold
Definition: MMTriggerTool.h:69
NSWL1::MMTriggerTool::m_diamOverlapStereoUp
Gaudi::Property< int > m_diamOverlapStereoUp
Definition: MMTriggerTool.h:72
AthAlgTool
Definition: AthAlgTool.h:26
NSWL1::MMTriggerTool::m_doTruth
Gaudi::Property< bool > m_doTruth
Definition: MMTriggerTool.h:62
Muon::NSW_TrigRawDataContainer
Definition: NSW_TrigRawDataContainer.h:14
checker_macros.h
Define macros for attributes used to control the static checker.
NSWL1::MMTriggerTool::m_rBits
Gaudi::Property< int > m_rBits
Definition: MMTriggerTool.h:83
NSWL1
A trigger trigger candidate for a stgc sector.
Definition: NSWL1Simulation.cxx:9
MMT_Diamond.h
NSWL1::MMTriggerTool::m_rMin
Gaudi::Property< float > m_rMin
Definition: MMTriggerTool.h:81
NSWL1::MMTriggerTool::runTrigger
StatusCode runTrigger(const EventContext &ctx, Muon::NSW_TrigRawDataContainer *rdo, const bool do_MMDiamonds) const
Definition: MMTriggerTool.cxx:69
NSWL1::MMTriggerTool::m_phiBits
Gaudi::Property< int > m_phiBits
Definition: MMTriggerTool.h:80
NSWL1::MMTriggerTool::m_phiMin
Gaudi::Property< float > m_phiMin
Definition: MMTriggerTool.h:78
NSWL1::MMTriggerTool::m_doNtuple
Gaudi::Property< bool > m_doNtuple
Definition: MMTriggerTool.h:77
NSWL1::MMTriggerTool::m_par_large
std::shared_ptr< MMT_Parameters > m_par_large
Definition: MMTriggerTool.h:88
NSWL1::MMTriggerTool::m_dThetaBits
Gaudi::Property< int > m_dThetaBits
Definition: MMTriggerTool.h:86
ServiceHandle< IIncidentSvc >