ATLAS Offline Software
Loading...
Searching...
No Matches
MuonHoughPatternFinderTool.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 MUONHOUGHPATTERNALGS_MUONHOUGHPATTERNFINDERTOOL_H
6#define MUONHOUGHPATTERNALGS_MUONHOUGHPATTERNFINDERTOOL_H
7
8#include <TFile.h>
9#include <TH1.h>
10
11#include <iostream>
12#include <string>
13#include <vector>
14
16#include "GaudiKernel/ServiceHandle.h"
17#include "GaudiKernel/ToolHandle.h"
27
29
30namespace Muon {
31
33 public:
34
37
38
40 MuonHoughPatternFinderTool(const std::string&, const std::string&, const IInterface*);
41
44
46 virtual StatusCode initialize() override;
48 virtual StatusCode finalize() override;
49
50 using MuonPatternHoughPair = std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muon::HoughDataPerSectorVec>>;
51
55 const std::vector<const MdtPrepDataCollection*>& mdtCols, const std::vector<const CscPrepDataCollection*>& cscCols,
56 const std::vector<const TgcPrepDataCollection*>& tgcCols, const std::vector<const RpcPrepDataCollection*>& rpcCols,
57 const MuonSegmentCombinationCollection* cscSegmentCombis, const EventContext& ctx) const override;
58
60 const MdtPrepDataContainer* mdtCont, const CscPrepDataContainer* cscCols, const TgcPrepDataContainer* tgcCont,
61 const RpcPrepDataContainer* rpcCont, const sTgcPrepDataContainer* stgcCont, const MMPrepDataContainer* mmCont,
62 const EventContext& ctx) const override;
63
64 private:
65 MuonPatternHoughPair find(const EventContext& ctx,
66 const std::vector<const MdtPrepDataCollection*>& mdtCols,
67 const std::vector<const CscPrepDataCollection*>& cscCols,
68 const std::vector<const TgcPrepDataCollection*>& tgcCols,
69 const std::vector<const RpcPrepDataCollection*>& rpcCols,
70 const std::vector<const sTgcPrepDataCollection*>& stgcCols,
71 const std::vector<const MMPrepDataCollection*>& mmCols,
72 const MuonSegmentCombinationCollection* cscSegmentCombis) const;
73
74 template <class T> std::vector<const MuonPrepDataCollection<T>*> stdVec(const MuonPrepDataContainerT<T>* cont) const;
75
77 std::unique_ptr<MuonHoughHitContainer> getAllHits(
78 const std::vector<const MdtPrepDataCollection*>& mdtCols, const std::vector<const TgcPrepDataCollection*>& tgcCols,
79 const std::vector<const RpcPrepDataCollection*>& rpcCols, const MuonSegmentCombinationCollection* cscSegmentCombis,
80 std::map<int, std::vector<std::pair<int, int>>>& rpcmdtstationmap,
81 std::map<int, std::vector<std::pair<int, int>>>& tgcmdtstationmap,
82 EtaPhiHitAssocMap& phietahitassociation) const;
83
85 std::unique_ptr<MuonPatternCombinationCollection> analyse( const EventContext& ctx,
86 const MuonHoughHitContainer& hitcontainer,
87 const EtaPhiHitAssocMap& phietahitassociation) const;
88
89 private:
92 void record(std::unique_ptr<MuonPrdPatternCollection>& patCol, const SG::WriteHandleKey<MuonPrdPatternCollection>& key,
93 const EventContext& ctx) const;
94
97 const RpcPrepDataCollection* rpc_coll, MuonHoughHitContainer& hitcontainer,
98 std::map<int, std::vector<std::pair<int, int>>>& rpcmdtstationmap,
99 EtaPhiHitAssocMap& phietahitassociation) const;
100
101
103 void addMdtCollection(const MdtPrepDataCollection* mdt_coll, MuonHoughHitContainer& hitcontainer,
104 std::map<int, std::vector<std::pair<int, int>>>& rpcmdtstationmap,
105 std::map<int, std::vector<std::pair<int, int>>>& tgcmdtstationmap) const;
108 const CscPrepDataCollection* csc_coll, MuonHoughHitContainer& hitcontainer,
109 EtaPhiHitAssocMap& phietahitassociation) const;
110
111
112
114 template <class CollContainer> void addCollection(const CollContainer& cont,
115 MuonHoughHitContainer& hitcontainer,
116 EtaPhiHitAssocMap& phietahitassociation) const;
117 template <class CollContainer> void addCollections(const std::vector<const CollContainer*>& colls,
118 MuonHoughHitContainer& hitcontainer,
119 EtaPhiHitAssocMap& phietahitassociation) const;
120
122 void addTgcCollection(
124 std::map<int, std::vector<std::pair<int, int>>>& tgcmdtstationmap,
125 EtaPhiHitAssocMap& phietahitassociation) const;
126
131 void fastSegmentFinder(TrkDriftCircleMath::DCVec& dcs, int& nl1, int& nl2, double& angleDif, std::vector<int>& sel) const;
132
135
138 void updateRpcMdtStationMap(const Identifier rpcid, int hit_begin, int hit_end,
139 std::map<int, std::vector<std::pair<int, int>>>& rpcmdtstationmap) const;
140
143 void updateTgcMdtStationMap(const Identifier tgcid, int hit_begin, int hit_end,
144 std::map<int, std::vector<std::pair<int, int>>>& tgcmdtstationmap) const;
145
147 int stationCode(const Identifier& id) const;
148
150 static int stationCode(int stationname, int phi, int eta);
151
152 static void addToStationMap(std::map<int, std::vector<std::pair<int, int>>>& stationmap,
153 std::map<int, std::vector<std::pair<int, int>>>::iterator& it, int& stationcode, const int& hit_begin,
154 const int& hit_end);
155
156 ToolHandle<IMuonHoughPatternTool> m_muonHoughPatternTool{this, "muonHoughPatternTool",""};
157 ToolHandle<Muon::IMuonCombinePatternTool> m_muonCombinePatternTool{this, "muonCombinePatternTool",
158 ""};
159 ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
160 PublicToolHandle<Muon::MuonEDMPrinterTool> m_printer{this, "printerTool", "Muon::MuonEDMPrinterTool/MuonEDMPrinterTool",
161 "ToolHandle for EDM printing of segments"};
162
164 Gaudi::Property<bool> m_hit_reweights{this, "HitReweights", true};
166 Gaudi::Property<bool> m_mdt_adc_cut{this, "MDT_ADC_cut", true};
168 Gaudi::Property<int> m_mdt_adc_min{this, "MDT_ADC_value", 50};
170 Gaudi::Property<bool> m_mdt_tdc_cut{this, "MDT_TDC_cut", true};
171
173 Gaudi::Property<bool> m_use_rpc{this, "RPC", true};
175 Gaudi::Property<bool> m_use_tgc{this, "TGC", true};
177 Gaudi::Property<bool> m_use_csc{this, "CSC", true};
179 Gaudi::Property<bool> m_use_mdt{this, "MDT", true};
180 /* use the micromega prepraw data */
181 Gaudi::Property<bool> m_use_mm{this, "MM", true};
182 /* use the stgc prepraw data */
183 Gaudi::Property<bool> m_use_stgc{this, "STGC", true};
186
188 Gaudi::Property<bool> m_showerskip{this, "ShowerSkipping", true};
190 Gaudi::Property<double> m_showerskipperc{this, "ShowerSkipPercentage", 0.3};
191
193 Gaudi::Property<bool> m_use_histos{this, "UseHistos", false};
194
196 Gaudi::Property<bool> m_summary{this, "DoSummary", false};
197
199 Gaudi::Property<bool> m_recordAllOutput{this, "RecordAll", false};
200
202 Gaudi::Property<std::string> m_cscAssoOutputLocation{this, "PatCscSegAssMapOutputLocation", "MuonPatCscSegAssMap"}; // Not used
203
205 // const MuonSegmentCombinationCollection* m_csc_segments;
206
207 struct Hists {
210 std::unique_ptr<TFile> m_file{};
213 std::unique_ptr<TH1> m_weighthistogram{};
215 std::unique_ptr<TH1> m_weighthistogrammdt{};
217 std::unique_ptr<TH1> m_weighthistogramrpc{};
219 std::unique_ptr<TH1> m_weighthistogramtgc{};
221 std::unique_ptr<TH1> m_weighthistogramcsc{};
223 std::unique_ptr<TH1> m_weighthistogramstgc{};
225 std::unique_ptr<TH1> m_weighthistogrammm{};
226
227 };
228 std::unique_ptr<Hists> m_h;
229 Hists& getHists() const;
230
232 SG::WriteHandleKey<MuonPrdPatternCollection> m_CosmicEtaPatternsKey{this, "CosmicEtaPatterns", "CosmicEtaPatterns"};
234
236 std::map<int, int> m_RpcToMdtOuterStDict{};
237 std::map<int, int> m_RpcToMdtInnerStDict{};
238 };
239
240} // namespace Muon
241
242#endif // MUONHOUGHPATTERNALGS_MUONHOUGHPATTERNALG_H
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
DataVector< Muon::MuonSegmentCombination > MuonSegmentCombinationCollection
This typedef represents a collection of MuonSegmentCombination objects.
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
std::set< const Trk::PrepRawData *, IdentifierPrdLess > PrepDataSet
std::map< const Trk::PrepRawData *, PrepDataSet > EtaPhiHitAssocMap
The IMuonSegmentMaker is a pure virtual interface for tools to find tracks starting from MuonSegmentC...
void fastSegmentFinder(TrkDriftCircleMath::DCVec &dcs, int &nl1, int &nl2, double &angleDif, std::vector< int > &sel) const
finds best segment for given driftcircle vector (nl1/2 = number of dc's in ml 1 and 2,...
IMuonCombinePatternTool::PrepDataSet PrepDataSet
void addTgcCollection(const Muon::TgcPrepDataCollection *, MuonHoughHitContainer &hitcontainer, std::map< int, std::vector< std::pair< int, int > > > &tgcmdtstationmap, EtaPhiHitAssocMap &phietahitassociation) const
convert and add tgc preprawdata collection (1 chamber)
std::map< int, int > m_RpcToMdtOuterStDict
Dictionary to translate from the RPC to the MDT station names.
Gaudi::Property< bool > m_use_rpc
use rpc preprawdata (true)
void updateTgcMdtStationMap(const Identifier tgcid, int hit_begin, int hit_end, std::map< int, std::vector< std::pair< int, int > > > &tgcmdtstationmap) const
update station map for tgc chamber, with id of chamber, and size of hits in tgc chamber
std::unique_ptr< MuonHoughHitContainer > getAllHits(const std::vector< const MdtPrepDataCollection * > &mdtCols, const std::vector< const TgcPrepDataCollection * > &tgcCols, const std::vector< const RpcPrepDataCollection * > &rpcCols, const MuonSegmentCombinationCollection *cscSegmentCombis, std::map< int, std::vector< std::pair< int, int > > > &rpcmdtstationmap, std::map< int, std::vector< std::pair< int, int > > > &tgcmdtstationmap, EtaPhiHitAssocMap &phietahitassociation) const
retrieves all hits and converts them into internal EDM
void addMdtCollection(const MdtPrepDataCollection *mdt_coll, MuonHoughHitContainer &hitcontainer, std::map< int, std::vector< std::pair< int, int > > > &rpcmdtstationmap, std::map< int, std::vector< std::pair< int, int > > > &tgcmdtstationmap) const
convert and add mdt preprawdata collection (1 chamber)
virtual StatusCode initialize() override
initialize
Gaudi::Property< std::string > m_cscAssoOutputLocation
storegate location for csc association map
Gaudi::Property< bool > m_use_mdt
use mdt preprawdata (true)
Gaudi::Property< bool > m_showerskip
reduce cpu for showers (true)
int stationCode(const Identifier &id) const
calculates an unique stationcode integer (own convention)
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
void addRpcCollection(const RpcPrepDataCollection *rpc_coll, MuonHoughHitContainer &hitcontainer, std::map< int, std::vector< std::pair< int, int > > > &rpcmdtstationmap, EtaPhiHitAssocMap &phietahitassociation) const
convert and add rpc preprawdata collection (1 chamber)
void updateRpcMdtStationMap(const Identifier rpcid, int hit_begin, int hit_end, std::map< int, std::vector< std::pair< int, int > > > &rpcmdtstationmap) const
update station map for rpc chamber, with id of chamber, and size of hits in rpc chamber
MuonPatternHoughPair find(const std::vector< const MdtPrepDataCollection * > &mdtCols, const std::vector< const CscPrepDataCollection * > &cscCols, const std::vector< const TgcPrepDataCollection * > &tgcCols, const std::vector< const RpcPrepDataCollection * > &rpcCols, const MuonSegmentCombinationCollection *cscSegmentCombis, const EventContext &ctx) const override
find patterns for a give set of MuonPrepData collections + optionally CSC segment combinations
Gaudi::Property< int > m_mdt_adc_min
value of adc cut (50)
Gaudi::Property< bool > m_mdt_adc_cut
use adc cut (true)
virtual ~MuonHoughPatternFinderTool()
destructor
void addCscCollection(const CscPrepDataCollection *csc_coll, MuonHoughHitContainer &hitcontainer, EtaPhiHitAssocMap &phietahitassociation) const
convert and add csc preprawdata collection (1 chamber)
Gaudi::Property< bool > m_use_tgc
use tgc preprawdata (true)
Gaudi::Property< bool > m_use_csc
use csc preprawdata (true)
std::pair< std::unique_ptr< MuonPatternCombinationCollection >, std::unique_ptr< Muon::HoughDataPerSectorVec > > MuonPatternHoughPair
Gaudi::Property< double > m_showerskipperc
percentage of occupancy to skip MDT chamber (0.3)
Gaudi::Property< bool > m_hit_reweights
reweight hits (true)
Gaudi::Property< bool > m_use_histos
flag to output a root file to study the weights of hits
ToolHandle< Muon::IMuonCombinePatternTool > m_muonCombinePatternTool
Pointer to concrete tool.
MuonHoughPatternFinderTool(const std::string &, const std::string &, const IInterface *)
constructor
std::vector< const MuonPrepDataCollection< T > * > stdVec(const MuonPrepDataContainerT< T > *cont) const
Gaudi::Property< bool > m_recordAllOutput
flag to write out intermediate patterns
IMuonCombinePatternTool::EtaPhiHitAssocMap EtaPhiHitAssocMap
Gaudi::Property< bool > m_mdt_tdc_cut
use tdc cut (false)
PublicToolHandle< Muon::MuonEDMPrinterTool > m_printer
static void addToStationMap(std::map< int, std::vector< std::pair< int, int > > > &stationmap, std::map< int, std::vector< std::pair< int, int > > >::iterator &it, int &stationcode, const int &hit_begin, const int &hit_end)
double m_weight_csc_on_segment
use weight for csc segments
void addCollection(const CollContainer &cont, MuonHoughHitContainer &hitcontainer, EtaPhiHitAssocMap &phietahitassociation) const
Inserts the Prds into the Hough container & fills the eta phi association map.
int calculateStationCode(const Identifier) const
calculateStationCode(const Identifier)
SG::WriteHandleKey< MuonPrdPatternCollection > m_COMBINED_PATTERNSKey
void record(std::unique_ptr< MuonPrdPatternCollection > &patCol, const SG::WriteHandleKey< MuonPrdPatternCollection > &key, const EventContext &ctx) const
record patterncollection to storegate or deletes collection when m_recordAllOutput is false
std::unique_ptr< MuonPatternCombinationCollection > analyse(const EventContext &ctx, const MuonHoughHitContainer &hitcontainer, const EtaPhiHitAssocMap &phietahitassociation) const
analyse hits
SG::WriteHandleKey< MuonPrdPatternCollection > m_CosmicEtaPatternsKey
virtual StatusCode finalize() override
finalize
SG::WriteHandleKey< MuonPrdPatternCollection > m_CosmicPhiPatternsKey
void addCollections(const std::vector< const CollContainer * > &colls, MuonHoughHitContainer &hitcontainer, EtaPhiHitAssocMap &phietahitassociation) const
ToolHandle< IMuonHoughPatternTool > m_muonHoughPatternTool
Pointer to concrete tool.
Gaudi::Property< bool > m_summary
flag to print out a summary of what comes in and what comes out
Property holding a SG store/key/clid from which a WriteHandle is made.
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
MuonPrepDataCollection< CscPrepData > CscPrepDataCollection
MuonPrepDataCollection< TgcPrepData > TgcPrepDataCollection
MuonPrepDataContainerT< RpcPrepData > RpcPrepDataContainer
MuonPrepDataContainer< MuonPrepDataCollection< PrdType > > MuonPrepDataContainerT
MuonPrepDataContainerT< TgcPrepData > TgcPrepDataContainer
MuonPrepDataContainerT< MdtPrepData > MdtPrepDataContainer
MuonPrepDataContainerT< sTgcPrepData > sTgcPrepDataContainer
MuonPrepDataContainerT< MMPrepData > MMPrepDataContainer
MuonPrepDataCollection< MdtPrepData > MdtPrepDataCollection
MuonPrepDataContainerT< CscPrepData > CscPrepDataContainer
MuonPrepDataCollection< RpcPrepData > RpcPrepDataCollection
std::vector< DriftCircle > DCVec
pointer to the CSC segment combination collection
std::unique_ptr< TH1 > m_weighthistogramtgc
tgc histogram
std::unique_ptr< TH1 > m_weighthistogramstgc
stgc histogram
std::unique_ptr< TH1 > m_weighthistogrammdt
mdt histogram
std::unique_ptr< TH1 > m_weighthistogramcsc
csc histogram
std::unique_ptr< TH1 > m_weighthistogrammm
mm histogram
std::unique_ptr< TH1 > m_weighthistogram
all hits histograms for studies on weighting (only in use, when m_use_histos is true)
std::unique_ptr< TH1 > m_weighthistogramrpc
rpc histogram
std::unique_ptr< TFile > m_file
histogram file for studies on weighting (only in use, when m_use_histos is true)