ATLAS Offline Software
PadTriggerLogicOfflineTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef NSWL1_PADTRIGGERLOGICOFFLINETOOL_H
6 #define NSWL1_PADTRIGGERLOGICOFFLINETOOL_H
7 
8 #include "CLHEP/Random/RandFlat.h"
9 #include "CLHEP/Random/RandGauss.h"
11 #include "GaudiKernel/ITHistSvc.h"
12 #include "GaudiKernel/IIncidentSvc.h"
13 #include "GaudiKernel/IIncidentListener.h"
14 #include "GaudiKernel/ServiceHandle.h"
34 
35 #include <boost/geometry.hpp>
36 #include <boost/geometry/geometries/point_xy.hpp>
37 #include <boost/geometry/geometries/polygon.hpp>
38 #include "TTree.h"
39 #include "Math/Vector3D.h"
40 #include <functional>
41 #include <algorithm>
42 #include <map>
43 #include <utility>
44 #include <cmath>
45 
46 namespace MuonGM {
47  class MuonDetectorManager;
48 }
49 
50 namespace NSWL1 {
51  /*
52  * @short Simulation of the pad trigger
53  *
54  * DG--todo This class implements the Pad TDS offline simulation. It loops over the input digits,
55  * DG--todo determines the BC tag and applies the additional processing of the VMM chip which is
56  * DG--todo not yet implemented in the digitization. The loop is executed over the full digit pool
57  * DG--todo once upon the first data request for an event and the PAD data are internally cached
58  * DG--todo and collected per trigger sectors. The run ID and event ID are cached; the processing
59  * DG--todo status is also cached to be propagated via a StatusCode at each data request.
60  * DG--todo
61  * DG--todo Supported processing:
62  * DG--todo Time delay simulation by subtracting the time_of_flight and the electronic random jitter;
63  * DG--todo VMM Dead Time simulation;
64  * DG--todo
65  * DG--todo It returns a vector of PadData to input the PadTrigger simulation.
66  * Oct 2015
67  *
68  * Major updates for release 22 processing: francesco.giuseppe.gravili@cern.ch
69  */
71  virtual public IPadTriggerLogicTool, public AthAlgTool, public IIncidentListener {
72  public:
73  PadTriggerLogicOfflineTool(const std::string& type,
74  const std::string& name,
75  const IInterface* parent);
76  virtual ~PadTriggerLogicOfflineTool()=default;
78  virtual void handle (const Incident& inc) override;
80 
81  virtual StatusCode compute_pad_triggers(const std::vector<std::shared_ptr<PadData>>& pads, std::vector<std::unique_ptr<PadTrigger>> &triggers) const override;
82 
83  int ROI2BandId(const float EtaTrigAtCenter, const int SectorType) const;//Recipe From Y.R (based on eta slicing of triggering bands see the implementation)
84 
85  static std::vector<std::unique_ptr<PadTrigger>> build4of4SingleWedgeTriggers(const std::vector<std::shared_ptr<PadData>> &pads);
86 
89 
90  private:
92  const std::vector<float> m_etaBandsLargeSector;
93  const std::vector<float> m_etaBandsSmallSector;
94 
95  std::map<IdentifierHash, std::pair<double,double> > m_phiTable;
96  std::pair<double,double> m_Zratio;
97 
98  ServiceHandle<IIncidentSvc> m_incidentSvc{this, "IncidentSvc", "IncidentSvc"};
100 
101  Gaudi::Property<float> m_PadEfficiency {this, "PadEfficiency", 1.0, "Pad trigger efficiency"};
102  Gaudi::Property<int> m_phiIdBits {this, "PhiIdBits", 6, "Number of bit to compute Phi-Id of pad triggers"};
103  Gaudi::Property<bool> m_useSimple4of4 {this, "UseSimple4of4", false, "Use simplified logic requiring 4 hits on 4 gas gaps"};
104  Gaudi::Property<bool> m_doNtuple {this, "DoNtuple", false, "Save the trigger outputs in an analysis ntuple"};
105 
106  std::unique_ptr<PadTriggerValidationTree> m_validation_tree;
108  void fillPhiTable();
110  };
111 } // namespace NSWL1
112 #endif
NSWL1::PadTriggerLogicOfflineTool::m_tdrLogic
L1TdrStgcTriggerLogic m_tdrLogic
Definition: PadTriggerLogicOfflineTool.h:109
NSWL1::PadTriggerLogicOfflineTool::~PadTriggerLogicOfflineTool
virtual ~PadTriggerLogicOfflineTool()=default
TrapezoidBounds.h
NSWL1::PadTriggerLogicOfflineTool::m_phiTable
std::map< IdentifierHash, std::pair< double, double > > m_phiTable
Definition: PadTriggerLogicOfflineTool.h:95
NSWL1::PadTriggerLogicOfflineTool::ATLAS_NOT_THREAD_SAFE
virtual StatusCode initialize ATLAS_NOT_THREAD_SAFE() override
MuonGM
Ensure that the Athena extensions are properly loaded.
Definition: GeoMuonHits.h:27
NSWL1::PadTriggerLogicOfflineTool::ROI2BandId
int ROI2BandId(const float EtaTrigAtCenter, const int SectorType) const
Definition: PadTriggerLogicOfflineTool.cxx:214
TriggerTypes.h
NSWL1::PadTriggerLogicOfflineTool
Definition: PadTriggerLogicOfflineTool.h:71
tdr_compat_enum.h
SectorTriggerCandidate.h
sTgcReadoutElement.h
PadData.h
initialize
void initialize()
Definition: run_EoverP.cxx:894
NSWL1::PadTriggerLogicOfflineTool::compute_pad_triggers
virtual StatusCode compute_pad_triggers(const std::vector< std::shared_ptr< PadData >> &pads, std::vector< std::unique_ptr< PadTrigger >> &triggers) const override
Log a message using the Athena controlled logging system.
Definition: PadTriggerLogicOfflineTool.cxx:138
NSWL1::PadTriggerLogicOfflineTool::m_Zratio
std::pair< double, double > m_Zratio
Definition: PadTriggerLogicOfflineTool.h:96
NSWL1::PadTriggerLogicOfflineTool::PadTriggerLogicOfflineTool
PadTriggerLogicOfflineTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: PadTriggerLogicOfflineTool.cxx:13
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
python.TrigTLAMonitorAlgorithm.triggers
triggers
Definition: TrigTLAMonitorAlgorithm.py:196
PadTriggerValidationTree.h
NSWL1::IPadTriggerLogicTool
interface for the PadTriggerLogic tools
Definition: IPadTriggerLogicTool.h:32
NSWL1::PadTriggerLogicOfflineTool::m_incidentSvc
ServiceHandle< IIncidentSvc > m_incidentSvc
Athena/Gaudi incident Service.
Definition: PadTriggerLogicOfflineTool.h:98
IPadTriggerLogicTool.h
NSWL1::PadTriggerLogicOfflineTool::m_doNtuple
Gaudi::Property< bool > m_doNtuple
Definition: PadTriggerLogicOfflineTool.h:104
NSWL1::PadOfflineData
class modeling the pad hit fragment for the NSW L1 offline simulation
Definition: PadOfflineData.h:36
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
NSWL1::PadTriggerLogicOfflineTool::m_detManager
const MuonGM::MuonDetectorManager * m_detManager
MuonDetectorManager.
Definition: PadTriggerLogicOfflineTool.h:99
AthAlgTool.h
sTGCTriggerBandsInEta.h
test_pyathena.parent
parent
Definition: test_pyathena.py:15
NSWL1::PadTriggerLogicOfflineTool::m_PadEfficiency
Gaudi::Property< float > m_PadEfficiency
Definition: PadTriggerLogicOfflineTool.h:101
NSWL1::PadTriggerLogicOfflineTool::convert
PadTrigger convert(const SectorTriggerCandidate &t) const
from TDR-style SectorTriggerCandidate to PadTrigger
Definition: PadTriggerLogicOfflineTool.cxx:239
NSWL1::PadTriggerLogicOfflineTool::build4of4SingleWedgeTriggers
static std::vector< std::unique_ptr< PadTrigger > > build4of4SingleWedgeTriggers(const std::vector< std::shared_ptr< PadData >> &pads)
Definition: PadTriggerLogicOfflineTool.cxx:100
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
PadOfflineData.h
NSWL1::PadTriggerLogicOfflineTool::m_validation_tree
std::unique_ptr< PadTriggerValidationTree > m_validation_tree
Definition: PadTriggerLogicOfflineTool.h:106
MuonDetectorManager.h
NSWL1::PadTriggerLogicOfflineTool::m_etaBandsLargeSector
const std::vector< float > m_etaBandsLargeSector
get the output tree from the athena histogram service
Definition: PadTriggerLogicOfflineTool.h:92
NSWL1::PadTriggerLogicOfflineTool::handle
virtual void handle(const Incident &inc) override
Definition: PadTriggerLogicOfflineTool.cxx:59
NSWL1::SectorTriggerCandidate
Definition: SectorTriggerCandidate.h:26
NSWL1::PadTriggerLogicOfflineTool::m_etaBandsSmallSector
const std::vector< float > m_etaBandsSmallSector
Definition: PadTriggerLogicOfflineTool.h:93
SectorType
SectorType
Definition: sTGCenumeration.h:39
NSWL1::PadTrigger
Holder of the pad trigger information.
Definition: PadTrigger.h:26
MuonGM::MuonDetectorManager
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h:50
PlaneSurface.h
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
NSWL1::PadTriggerLogicOfflineTool::fillGeometricInformation
void fillGeometricInformation(PadOfflineData &) const
Definition: PadTriggerLogicOfflineTool.cxx:66
NSWL1::PadTriggerLogicOfflineTool::m_phiIdBits
Gaudi::Property< int > m_phiIdBits
Definition: PadTriggerLogicOfflineTool.h:102
sTgcDigit.h
sTgcDigitContainer.h
PadTrigger.h
AthAlgTool
Definition: AthAlgTool.h:26
MuonSimDataCollection.h
NSWL1::PadTriggerLogicOfflineTool::fillPhiTable
void fillPhiTable()
Definition: PadTriggerLogicOfflineTool.cxx:445
NSWL1::PadTriggerLogicOfflineTool::m_useSimple4of4
Gaudi::Property< bool > m_useSimple4of4
Definition: PadTriggerLogicOfflineTool.h:103
NSWL1::L1TdrStgcTriggerLogic
Initial version of the stgc pad trigger logic.
Definition: L1TdrStgcTriggerLogic.h:47
SingleWedgePadTrigger.h
NSWL1
A trigger trigger candidate for a stgc sector.
Definition: NSWL1Simulation.cxx:9
MuonSimData.h
L1TdrStgcTriggerLogic.h
ServiceHandle< IIncidentSvc >