ATLAS Offline Software
BeamBackgroundFiller.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 RECBACKGROUNDALGS_BEAMBACKGROUNDFILLER
6 #define RECBACKGROUNDALGS_BEAMBACKGROUNDFILLER
7 
8 #include <string>
9 #include <vector>
10 
11 #include "AthLinks/ElementLinkVector.h"
13 #include "GaudiKernel/ServiceHandle.h"
18 #include "TrkSegment/Segment.h"
21 #include "xAODJet/JetContainer.h"
22 #include "GaudiKernel/SystemOfUnits.h"
24 
38  public:
39  BeamBackgroundFiller(const std::string& name, ISvcLocator* pSvcLocator);
40  virtual ~BeamBackgroundFiller() = default;
41 
42  virtual StatusCode initialize() override;
43  virtual StatusCode execute(const EventContext& ctx) const override;
44 
45  private:
46  struct Cache {
47  int m_numSegment{0}; // number of segments with the direction parallel to
48  // the beam pipe
49  int m_numSegmentEarly{0}; // number of early segments
50  int m_numSegmentACNoTime{0}; // number of matched pairs of segments on
51  // side A and side C
52  int m_numSegmentAC{0}; // number of matched pairs of segments with
53  // corresponding time difference
54  int m_numMatched{0}; // number of clusters matched with the segments
55  int m_numNoTimeLoose{0}; // number of clusters identified by the "No-Time
56  // Method"
59  int m_numOneSidedLoose{0}; // number of clusters identified by the
60  // "One-Sided Method"
63  int m_numTwoSidedNoTime{0}; // number of clusters identified by the
64  // "Two-Sided No-Time Method"
65  int m_numTwoSided{0}; // number of clusters identified by the "Two-Sided
66  // Method"
67  int m_numClusterShape{0}; // number of clusters identified by the
68  // "Cluster-Shape Method"
69  int m_numJet{0}; // number of fake jets
70  int m_direction{0}; // direction of beam halo from the "Two-Sided Method"
71  // (positive for A->C, negative for C->A)
72  // link to the calorimeter cluster
74  // line to the muon segment
76  // matching matrix (stores results for each muon segment and calorimeter
77  // cluster)
78  std::vector<std::vector<int> > m_matchMatrix{};
79  // summary of the results for each muon segment
80  std::vector<int> m_resultSeg{};
81  // summary of the results for each cluster segment
82  std::vector<int> m_resultClus{};
83  // shape of the cluster
84  std::vector<float> m_drdzClus{};
85 
87  std::vector<int> m_resultJet{}; // summary of the results for each jet
88  };
89 
90  // Function matching calorimeter clusters with muon segments
91  void FillMatchMatrix(const EventContext& ctx, Cache& cache) const;
92  // Beam background identification methods
93  void SegmentMethod(Cache& cache) const;
94  void OneSidedMethod(Cache& cache) const;
95  void TwoSidedMethod(Cache& cache) const;
96  void ClusterShapeMethod(Cache& cache) const;
97 
98  // Function calculating time for mboy CSC segments
99  // (needed until release 17.1.0, does not work on AOD)
100  double GetSegmentTime(const Muon::MuonSegment& pMuonSegment) const;
101 
102  // Function to identify fake jets
103  void FindFakeJets(const EventContext& ctx, Cache& cache) const;
104  // Function to store the results in BeamBackgroundData
106  SG::WriteHandle<BeamBackgroundData>& beamBackgroundDataWriteHandle,
107  Cache& cache) const;
108 
111  this, "SegmentKeys", {"NCB_TrackMuonSegments", /*"TrackMuonSegments" */} ,
112  "Muon segment collections from the MS patterns"};
113 
117  this, "caloClusterContainerKey", "CaloCalTopoClusters",
118  "ReadHandleKey for CaloClusterContainer"};
119 
122  this, "jetContainerKey", "AntiKt4EMTopoJets",
123  "ReadHandleKey for JetContainer"};
124 
125  /* WriteHandleKey for BeamBackgroundData */
127  this, "BeamBackgroundKey", "BeamBackgroundData",
128  "WriteHandleKey for BeamBackgroundData"};
129 
130  ToolHandle<Muon::IMuonSegmentSelectionTool> m_segmentSelector{this, "SegmentSelector",""};
131 
132 
134  Gaudi::Property<double> m_thetaCutNCB{this, "cutThetaNCB", 5. * Gaudi::Units::deg};
135 
136  Gaudi::Property<double> m_cutDphiSegAC{this,"cutPhi", 4.* Gaudi::Units::deg};
137 
139  Gaudi::Property<double> m_clusEnergyCut{this,"clustEnergy", 10. *Gaudi::Units::GeV};
140  // CSC : 881 < R < 2081
141  // LAr barrel : 1500 < R < 1970
142  // TileCal : 2280 < R < 4250
143  Gaudi::Property<double> m_clusRadiusLow{this, "cutRadiusLow", 881. * Gaudi::Units::mm};
144  Gaudi::Property<double> m_clusRadiusHigh{this,"cutRadiusHigh", 4250. * Gaudi::Units::mm};
145 
146  Gaudi::Property<double> m_cutDphiClusSeg{this, "cutDphiClusSeg", 4.* Gaudi::Units::deg};
147  Gaudi::Property<double> m_cutDradClusSeg{this,"cutDrClusSet", 40. * Gaudi::Units::cm};
148 
149 
150 
151  Gaudi::Property<double> m_cutMuonTime{this, "cutMuonTime", 25.};
152  Gaudi::Property<double> m_cutClusTime{this,"cutClusTime", 2.5};
153  Gaudi::Property<double> m_cutTimeDiffAC{this,"cutTimeDiffAC", 25.};
154  Gaudi::Property<double> m_cutDrdz{this,"cutDrdz", 0.15};
156  this, "edmHelper", "Muon::MuonEDMHelperSvc/MuonEDMHelperSvc",
157  "Handle to the service providing the IMuonEDMHelperSvc interface"};
159  this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
160 };
161 
162 #endif
BeamBackgroundFiller::m_jetContainerReadHandleKey
SG::ReadHandleKey< xAOD::JetContainer > m_jetContainerReadHandleKey
ReadHandleKey for JetContainer.
Definition: BeamBackgroundFiller.h:121
BeamBackgroundFiller::Cache::m_indexSeg
ElementLinkVector< Trk::SegmentCollection > m_indexSeg
Definition: BeamBackgroundFiller.h:75
BeamBackgroundFiller::SegmentMethod
void SegmentMethod(Cache &cache) const
This function looks at the segments found by the FillMatchMatrix function.
Definition: BeamBackgroundFiller.cxx:261
BeamBackgroundFiller::Cache::m_resultClus
std::vector< int > m_resultClus
Definition: BeamBackgroundFiller.h:82
BeamBackgroundFiller::m_cutDphiSegAC
Gaudi::Property< double > m_cutDphiSegAC
Definition: BeamBackgroundFiller.h:136
BeamBackgroundFiller::m_clusRadiusHigh
Gaudi::Property< double > m_clusRadiusHigh
Definition: BeamBackgroundFiller.h:144
BeamBackgroundFiller::Cache
Definition: BeamBackgroundFiller.h:46
BeamBackgroundFiller::m_caloClusterContainerReadHandleKey
SG::ReadHandleKey< xAOD::CaloClusterContainer > m_caloClusterContainerReadHandleKey
ReadHandleKey for CaloClusterContainer.
Definition: BeamBackgroundFiller.h:116
BeamBackgroundFiller::FillBeamBackgroundData
void FillBeamBackgroundData(SG::WriteHandle< BeamBackgroundData > &beamBackgroundDataWriteHandle, Cache &cache) const
This function stores all the results in BeamBackgroundData.
Definition: BeamBackgroundFiller.cxx:713
BeamBackgroundFiller::BeamBackgroundFiller
BeamBackgroundFiller(const std::string &name, ISvcLocator *pSvcLocator)
Definition: BeamBackgroundFiller.cxx:30
BeamBackgroundFiller::m_cutDphiClusSeg
Gaudi::Property< double > m_cutDphiClusSeg
Definition: BeamBackgroundFiller.h:146
BeamBackgroundFiller::m_cutDradClusSeg
Gaudi::Property< double > m_cutDradClusSeg
Definition: BeamBackgroundFiller.h:147
BeamBackgroundFiller::Cache::m_numNoTimeTight
int m_numNoTimeTight
Definition: BeamBackgroundFiller.h:58
deg
#define deg
Definition: SbPolyhedron.cxx:17
BeamBackgroundFiller::Cache::m_numSegmentACNoTime
int m_numSegmentACNoTime
Definition: BeamBackgroundFiller.h:50
SG::HandleKeyArray
Definition: StoreGate/StoreGate/HandleKeyArray.h:38
BeamBackgroundFiller::Cache::m_numSegmentEarly
int m_numSegmentEarly
Definition: BeamBackgroundFiller.h:49
SG::ReadHandleKey< xAOD::CaloClusterContainer >
BeamBackgroundFiller::Cache::m_indexClus
ElementLinkVector< xAOD::CaloClusterContainer > m_indexClus
Definition: BeamBackgroundFiller.h:73
BeamBackgroundFiller::Cache::m_numTwoSided
int m_numTwoSided
Definition: BeamBackgroundFiller.h:65
BeamBackgroundFiller::Cache::m_numJet
int m_numJet
Definition: BeamBackgroundFiller.h:69
BeamBackgroundFiller
Implementation of the Beam Background Identification Method.
Definition: BeamBackgroundFiller.h:37
BeamBackgroundFiller::Cache::m_numNoTimeLoose
int m_numNoTimeLoose
Definition: BeamBackgroundFiller.h:55
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
BeamBackgroundFiller::m_cutDrdz
Gaudi::Property< double > m_cutDrdz
Definition: BeamBackgroundFiller.h:154
BeamBackgroundFiller::m_thetaCutNCB
Gaudi::Property< double > m_thetaCutNCB
Inclanation cut between the segment position and its direction.
Definition: BeamBackgroundFiller.h:134
BeamBackgroundFiller::Cache::m_numSegment
int m_numSegment
Definition: BeamBackgroundFiller.h:47
BeamBackgroundFiller::GetSegmentTime
double GetSegmentTime(const Muon::MuonSegment &pMuonSegment) const
Definition: BeamBackgroundFiller.cxx:216
cm
const double cm
Definition: Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/FCAL_ChannelMap.cxx:25
BeamBackgroundFiller::m_edmHelperSvc
ServiceHandle< Muon::IMuonEDMHelperSvc > m_edmHelperSvc
Definition: BeamBackgroundFiller.h:155
BeamBackgroundFiller::m_cutTimeDiffAC
Gaudi::Property< double > m_cutTimeDiffAC
Definition: BeamBackgroundFiller.h:153
BeamBackgroundFiller::Cache::m_indexJet
ElementLinkVector< xAOD::JetContainer > m_indexJet
Definition: BeamBackgroundFiller.h:86
BeamBackgroundFiller::Cache::m_resultJet
std::vector< int > m_resultJet
Definition: BeamBackgroundFiller.h:87
BeamBackgroundFiller::Cache::m_numNoTimeMedium
int m_numNoTimeMedium
Definition: BeamBackgroundFiller.h:57
SG::WriteHandleKey< BeamBackgroundData >
BeamBackgroundFiller::m_cutMuonTime
Gaudi::Property< double > m_cutMuonTime
Definition: BeamBackgroundFiller.h:151
BeamBackgroundFiller::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition: BeamBackgroundFiller.cxx:50
BeamBackgroundFiller::Cache::m_drdzClus
std::vector< float > m_drdzClus
Definition: BeamBackgroundFiller.h:84
BeamBackgroundFiller::m_clusRadiusLow
Gaudi::Property< double > m_clusRadiusLow
Definition: BeamBackgroundFiller.h:143
IMuonSegmentSelectionTool.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
BeamBackgroundFiller::Cache::m_numOneSidedMedium
int m_numOneSidedMedium
Definition: BeamBackgroundFiller.h:61
BeamBackgroundFiller::Cache::m_numOneSidedLoose
int m_numOneSidedLoose
Definition: BeamBackgroundFiller.h:59
BeamBackgroundFiller::FindFakeJets
void FindFakeJets(const EventContext &ctx, Cache &cache) const
This function checks whether the matched clusters are contained in any jets.
Definition: BeamBackgroundFiller.cxx:655
Segment.h
BeamBackgroundData.h
BeamBackgroundFiller::ClusterShapeMethod
void ClusterShapeMethod(Cache &cache) const
This function is the implementation of the "Cluster-Shape Method".
Definition: BeamBackgroundFiller.cxx:574
BeamBackgroundFiller::Cache::m_numOneSidedTight
int m_numOneSidedTight
Definition: BeamBackgroundFiller.h:62
BeamBackgroundFiller::m_cutClusTime
Gaudi::Property< double > m_cutClusTime
Definition: BeamBackgroundFiller.h:152
BeamBackgroundFiller::m_clusEnergyCut
Gaudi::Property< double > m_clusEnergyCut
Minimum cut on the cluster energy to be considered.
Definition: BeamBackgroundFiller.h:139
BeamBackgroundFiller::initialize
virtual StatusCode initialize() override
Definition: BeamBackgroundFiller.cxx:36
AthReentrantAlgorithm.h
BeamBackgroundFiller::Cache::m_numTwoSidedNoTime
int m_numTwoSidedNoTime
Definition: BeamBackgroundFiller.h:63
BeamBackgroundFiller::Cache::m_numMatched
int m_numMatched
Definition: BeamBackgroundFiller.h:54
ElementLinkVector
ElementLinkVector implementation for standalone ROOT.
Definition: AthLinks/ElementLinkVector.h:27
IMuonEDMHelperSvc.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
BeamBackgroundFiller::Cache::m_matchMatrix
std::vector< std::vector< int > > m_matchMatrix
Definition: BeamBackgroundFiller.h:78
BeamBackgroundFiller::~BeamBackgroundFiller
virtual ~BeamBackgroundFiller()=default
BeamBackgroundFiller::m_beamBackgroundDataWriteHandleKey
SG::WriteHandleKey< BeamBackgroundData > m_beamBackgroundDataWriteHandleKey
Definition: BeamBackgroundFiller.h:126
BeamBackgroundFiller::Cache::m_numSegmentAC
int m_numSegmentAC
Definition: BeamBackgroundFiller.h:52
BeamBackgroundFiller::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: BeamBackgroundFiller.h:158
python.SystemOfUnits.mm
int mm
Definition: SystemOfUnits.py:83
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
BeamBackgroundFiller::m_segmentSelector
ToolHandle< Muon::IMuonSegmentSelectionTool > m_segmentSelector
Definition: BeamBackgroundFiller.h:130
BeamBackgroundFiller::FillMatchMatrix
void FillMatchMatrix(const EventContext &ctx, Cache &cache) const
This function selects the muon segments with the direction parallel to the beam pipe and calorimeter ...
Definition: BeamBackgroundFiller.cxx:79
BeamBackgroundFiller::Cache::m_direction
int m_direction
Definition: BeamBackgroundFiller.h:70
JetContainer.h
BeamBackgroundFiller::Cache::m_resultSeg
std::vector< int > m_resultSeg
Definition: BeamBackgroundFiller.h:80
BeamBackgroundFiller::OneSidedMethod
void OneSidedMethod(Cache &cache) const
This function is the implementation of the "No-Time Method" and the "One-Sided Method".
Definition: BeamBackgroundFiller.cxx:361
BeamBackgroundFiller::Cache::m_numClusterShape
int m_numClusterShape
Definition: BeamBackgroundFiller.h:67
CaloClusterContainer.h
MuonSegment.h
Muon::MuonSegment
Definition: MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonSegment/MuonSegment/MuonSegment.h:45
BeamBackgroundFiller::m_segmentKeys
SG::ReadHandleKeyArray< Trk::SegmentCollection > m_segmentKeys
ReadHandleKey for Trk::SegmentCollection from CSC.
Definition: BeamBackgroundFiller.h:110
BeamBackgroundFiller::TwoSidedMethod
void TwoSidedMethod(Cache &cache) const
This function is the implementation of the "Two-Sided No-Time Method" and the "Two-Sided Method" that...
Definition: BeamBackgroundFiller.cxx:475
GeV
#define GeV
Definition: CaloTransverseBalanceVecMon.cxx:30
IMuonIdHelperSvc.h
SegmentCollection.h
ServiceHandle< Muon::IMuonEDMHelperSvc >