ATLAS Offline Software
FPGATrackSimEventSelectionSvc.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 FPGATrackSimCONFTOOLS_FPGATrackSimEVENTSELECTIONSVC_H
6 #define FPGATrackSimCONFTOOLS_FPGATrackSimEVENTSELECTIONSVC_H
7 
9 #include "GaudiKernel/ToolHandle.h"
10 
14 
15 class FPGATrackSimHit;
16 class FPGATrackSimTrack;
22 
23 
24 class FPGATrackSimEventSelectionSvc : public extends< AthService, IFPGATrackSimEventSelectionSvc >
25 {
26  public:
27 
28  FPGATrackSimEventSelectionSvc(const std::string& name, ISvcLocator* svc);
29  virtual ~FPGATrackSimEventSelectionSvc() = default;
30 
31  virtual StatusCode initialize() override;
32  virtual StatusCode finalize() override;
33 
34  virtual unsigned getRegionID() const override { return m_regionID; }
35  virtual SampleType getSampleType() const override { return m_st; }
36  virtual bool checkPU() const override { return m_withPU.value(); }
37  virtual const FPGATrackSimRegionSlices* getRegions() override;
38  virtual int getLRTpdgID() const override { return m_LRT_pdgID; }
39 
40  virtual FPGATrackSimTrackPars getMin() const override { return m_min; }
41  virtual FPGATrackSimTrackPars getMax() const override { return m_max; }
42 
43  virtual bool passCuts(const FPGATrackSimHit&) const override;
44  virtual bool passCuts(const FPGATrackSimTrack&) const override;
45  virtual bool passCuts(const FPGATrackSimOfflineTrack&) const override;
46  virtual bool passCuts(const FPGATrackSimTruthTrack&) const override;
47 
48  virtual bool passQOverPt(const FPGATrackSimTrack&) const override;
49  virtual bool passEta(const FPGATrackSimTrack&) const override;
50  virtual bool passPhi(const FPGATrackSimTrack&) const override;
51  virtual bool passD0(const FPGATrackSimTrack&) const override;
52  virtual bool passZ0(const FPGATrackSimTrack&) const override;
53  virtual bool passQOverPt(const FPGATrackSimOfflineTrack&) const override;
54  virtual bool passEta(const FPGATrackSimOfflineTrack&) const override;
55  virtual bool passPhi(const FPGATrackSimOfflineTrack&) const override;
56  virtual bool passD0(const FPGATrackSimOfflineTrack&) const override;
57  virtual bool passZ0(const FPGATrackSimOfflineTrack&) const override;
58 
59  virtual bool passMatching(FPGATrackSimTrack const &) const override;
60  virtual bool passMatching(FPGATrackSimTruthTrack const &) const override;
61 
62  virtual bool selectEvent(FPGATrackSimEventInputHeader*) override;
63  virtual bool selectEvent(FPGATrackSimLogicalEventInputHeader*) override;
64 
65  // Allow code to query whether or not an event was selected by the service.
66  // If running over RDO part of this decision is made inside the dataprep algorithm, so it needs a setter.
67  virtual bool getSelectedEvent() const override { return m_selectEvent; }
68  virtual void setSelectedEvent(bool s) override { m_selectEvent = s; }
69 
70  private:
71 
72  // Gaudi parameters:
73  Gaudi::Property<unsigned int> m_regionID { this, "regionID", 0, "current region under processing"}; // Current region of interest
74  Gaudi::Property<std::string> m_regions_path { this, "regions", "", "path of the slices file"}; // path to slices file
75  Gaudi::Property<std::string> m_sampleType { this, "sampleType", "singleMuons", "type of sample under processing (skipTruth, singleElectrons, singleMuons, singlePions, or LLPs)"}; // type of sample ("skipTruth", "singleElectrons", "singleMuons", "singlePions")
76  Gaudi::Property<bool> m_withPU { this, "withPU", false, "flag to say if there is pile-up or not"}; // flag to say if there is pile-up or not
77  Gaudi::Property<bool> m_LRT { this, "doLRT", false, "Change track selection to LRT quantities; hit selection unchanged"}; // flag to require cancelling of selections on d0 and z0 in the case of large-radius tracking
78  Gaudi::Property<float> m_minLRTpT { this, "minLRTpT", 5., "Minimum pT to use in LRT selection, in GeV"}; // minimum pT, in GeV, to use in LRT selection
79  Gaudi::Property<int> m_LRT_pdgID { this, "lrt_truthMatchPDGID", 0, "If we are running an LLP sample but want only some PDGID of output in the truth selection, set this"}; // If we are running an LLP sample but want only some PDGID of output in the truth selection, set this
80  Gaudi::Property<bool> m_allowHighBarcode { this, "allowHighBarcode", false, "Whether or not to allow barcodes over 200000 in truth matching"}; // whether or not to allow barcodes over 200000 in truth matching
81 
82 
83 
84  SampleType m_st = SampleType::skipTruth; // internal value for faster comparisons in selectEvent()
85  FPGATrackSimRegionSlices* m_regions = nullptr; // pointer to RegionSlices class
86 
87  FPGATrackSimTrackPars m_min; // min limits of current region
88  FPGATrackSimTrackPars m_max; // max limits of current region
89  FPGATrackSimTrackPars m_trackmin; // min limits of tracks to be accepted in region
90  FPGATrackSimTrackPars m_trackmax; // max limits of tracks to be accepted in region
91 
92 
93  void createRegions(); // helper function to create RegionSlices object
94  bool checkTruthTracks(const std::vector<FPGATrackSimTruthTrack>&) const; // helper function to check the truth tracks for selectEvent()
95  bool checkTruthTracksLRT(const std::vector<FPGATrackSimTruthTrack>&) const; // check the truth tracks for selectEvent() with LRT requirements
96 
97  // Cache result of selectEvent().
98  bool m_selectEvent = false;
99 
100 };
101 
102 #endif // FPGATrackSimCONFTOOLS_FPGATrackSimEVENTSELECTIONSVC_H
FPGATrackSimEventSelectionSvc::passZ0
virtual bool passZ0(const FPGATrackSimTrack &) const override
Definition: FPGATrackSimEventSelectionSvc.cxx:135
FPGATrackSimEventSelectionSvc::checkTruthTracksLRT
bool checkTruthTracksLRT(const std::vector< FPGATrackSimTruthTrack > &) const
Definition: FPGATrackSimEventSelectionSvc.cxx:323
FPGATrackSimLogicalEventInputHeader
Definition: FPGATrackSimLogicalEventInputHeader.h:21
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
FPGATrackSimEventSelectionSvc::checkTruthTracks
bool checkTruthTracks(const std::vector< FPGATrackSimTruthTrack > &) const
Definition: FPGATrackSimEventSelectionSvc.cxx:297
FPGATrackSimRegionSlices
Definition: FPGATrackSimRegionSlices.h:25
FPGATrackSimEventSelectionSvc::selectEvent
virtual bool selectEvent(FPGATrackSimEventInputHeader *) override
Definition: FPGATrackSimEventSelectionSvc.cxx:233
FPGATrackSimTrack
Definition: FPGATrackSimTrack.h:18
FPGATrackSimTrackPars
Definition: FPGATrackSimTrackPars.h:22
FPGATrackSimTruthTrack
Definition: FPGATrackSimTruthTrack.h:14
FPGATrackSimEventSelectionSvc::passMatching
virtual bool passMatching(FPGATrackSimTrack const &) const override
Definition: FPGATrackSimEventSelectionSvc.cxx:215
FPGATrackSimEventSelectionSvc::m_trackmin
FPGATrackSimTrackPars m_trackmin
Definition: FPGATrackSimEventSelectionSvc.h:89
FPGATrackSimEventSelectionSvc::m_regions
FPGATrackSimRegionSlices * m_regions
Definition: FPGATrackSimEventSelectionSvc.h:85
FPGATrackSimEventSelectionSvc::passQOverPt
virtual bool passQOverPt(const FPGATrackSimTrack &) const override
Definition: FPGATrackSimEventSelectionSvc.cxx:103
FPGATrackSimEventSelectionSvc::getSelectedEvent
virtual bool getSelectedEvent() const override
Definition: FPGATrackSimEventSelectionSvc.h:67
FPGATrackSimEventSelectionSvc::getSampleType
virtual SampleType getSampleType() const override
Definition: FPGATrackSimEventSelectionSvc.h:35
FPGATrackSimEventSelectionSvc::getMax
virtual FPGATrackSimTrackPars getMax() const override
Definition: FPGATrackSimEventSelectionSvc.h:41
FPGATrackSimEventSelectionSvc::passCuts
virtual bool passCuts(const FPGATrackSimHit &) const override
Definition: FPGATrackSimEventSelectionSvc.cxx:79
FPGATrackSimHit
Definition: FPGATrackSimHit.h:41
FPGATrackSimEventSelectionSvc::passD0
virtual bool passD0(const FPGATrackSimTrack &) const override
Definition: FPGATrackSimEventSelectionSvc.cxx:127
FPGATrackSimEventSelectionSvc::FPGATrackSimEventSelectionSvc
FPGATrackSimEventSelectionSvc(const std::string &name, ISvcLocator *svc)
Definition: FPGATrackSimEventSelectionSvc.cxx:22
FPGATrackSimEventSelectionSvc::getMin
virtual FPGATrackSimTrackPars getMin() const override
Definition: FPGATrackSimEventSelectionSvc.h:40
FPGATrackSimEventSelectionSvc::passPhi
virtual bool passPhi(const FPGATrackSimTrack &) const override
Definition: FPGATrackSimEventSelectionSvc.cxx:119
FPGATrackSimEventSelectionSvc::m_selectEvent
bool m_selectEvent
Definition: FPGATrackSimEventSelectionSvc.h:98
FPGATrackSimEventSelectionSvc::finalize
virtual StatusCode finalize() override
Definition: FPGATrackSimEventSelectionSvc.cxx:71
FPGATrackSimEventSelectionSvc
Definition: FPGATrackSimEventSelectionSvc.h:25
FPGATrackSimEventSelectionSvc::~FPGATrackSimEventSelectionSvc
virtual ~FPGATrackSimEventSelectionSvc()=default
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
FPGATrackSimEventSelectionSvc::m_sampleType
Gaudi::Property< std::string > m_sampleType
Definition: FPGATrackSimEventSelectionSvc.h:75
FPGATrackSimEventInputHeader
Definition: FPGATrackSimEventInputHeader.h:22
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition: AthROOTErrorHandlerSvc.cxx:10
FPGATrackSimOfflineTrack
Definition: FPGATrackSimOfflineTrack.h:12
FPGATrackSimEventSelectionSvc::m_max
FPGATrackSimTrackPars m_max
Definition: FPGATrackSimEventSelectionSvc.h:88
SampleType::skipTruth
@ skipTruth
FPGATrackSimEventSelectionSvc::initialize
virtual StatusCode initialize() override
Definition: FPGATrackSimEventSelectionSvc.cxx:26
FPGATrackSimEventSelectionSvc::m_trackmax
FPGATrackSimTrackPars m_trackmax
Definition: FPGATrackSimEventSelectionSvc.h:90
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
FPGATrackSimEventSelectionSvc::m_minLRTpT
Gaudi::Property< float > m_minLRTpT
Definition: FPGATrackSimEventSelectionSvc.h:78
FPGATrackSimEventSelectionSvc::m_regions_path
Gaudi::Property< std::string > m_regions_path
Definition: FPGATrackSimEventSelectionSvc.h:74
FPGATrackSimEventSelectionSvc::m_LRT
Gaudi::Property< bool > m_LRT
Definition: FPGATrackSimEventSelectionSvc.h:77
FPGATrackSimEventSelectionSvc::m_LRT_pdgID
Gaudi::Property< int > m_LRT_pdgID
Definition: FPGATrackSimEventSelectionSvc.h:79
FPGATrackSimEventSelectionSvc::passEta
virtual bool passEta(const FPGATrackSimTrack &) const override
Definition: FPGATrackSimEventSelectionSvc.cxx:111
IFPGATrackSimEventSelectionSvc.h
FPGATrackSimEventSelectionSvc::m_regionID
Gaudi::Property< unsigned int > m_regionID
Definition: FPGATrackSimEventSelectionSvc.h:73
FPGATrackSimEventSelectionSvc::setSelectedEvent
virtual void setSelectedEvent(bool s) override
Definition: FPGATrackSimEventSelectionSvc.h:68
FPGATrackSimEventSelectionSvc::m_st
SampleType m_st
Definition: FPGATrackSimEventSelectionSvc.h:84
FPGATrackSimEventSelectionSvc::m_allowHighBarcode
Gaudi::Property< bool > m_allowHighBarcode
Definition: FPGATrackSimEventSelectionSvc.h:80
AthService.h
FPGATrackSimEventSelectionSvc::getLRTpdgID
virtual int getLRTpdgID() const override
Definition: FPGATrackSimEventSelectionSvc.h:38
FPGATrackSimEventSelectionSvc::checkPU
virtual bool checkPU() const override
Definition: FPGATrackSimEventSelectionSvc.h:36
FPGATrackSimTypes.h
FPGATrackSimEventSelectionSvc::createRegions
void createRegions()
Definition: FPGATrackSimEventSelectionSvc.cxx:286
SampleType
SampleType
Definition: FPGATrackSimTypes.h:40
FPGATrackSimTrackPars.h
Structs that store the 5 track parameters.
FPGATrackSimEventSelectionSvc::m_withPU
Gaudi::Property< bool > m_withPU
Definition: FPGATrackSimEventSelectionSvc.h:76
FPGATrackSimEventSelectionSvc::getRegions
virtual const FPGATrackSimRegionSlices * getRegions() override
Definition: FPGATrackSimEventSelectionSvc.cxx:280
FPGATrackSimEventSelectionSvc::m_min
FPGATrackSimTrackPars m_min
Definition: FPGATrackSimEventSelectionSvc.h:87
FPGATrackSimEventSelectionSvc::getRegionID
virtual unsigned getRegionID() const override
Definition: FPGATrackSimEventSelectionSvc.h:34