ATLAS Offline Software
Loading...
Searching...
No Matches
MuonHoughPatternTool Class Reference

#include <MuonHoughPatternTool.h>

Inheritance diagram for MuonHoughPatternTool:
Collaboration diagram for MuonHoughPatternTool:

Public Member Functions

 MuonHoughPatternTool (const std::string &type, const std::string &name, const IInterface *parent)
 Default constructor.
virtual ~MuonHoughPatternTool ()=default
 Destructor.
virtual void makePatterns (const MuonHoughHitContainer &hitcontainer, MuonHoughPatternContainerShip &houghpatterns) const override
 method that builds the patterns
virtual StatusCode initialize () override
 initiates private members
virtual StatusCode finalize () override
 deletes private members
virtual std::unique_ptr< MuonPrdPatternCollectiongetPhiMuonPatterns (MuonHoughPatternContainerShip &houghpatterns) const override
 returns phipattern container in EDM
virtual std::unique_ptr< MuonPrdPatternCollectiongetEtaMuonPatterns (MuonHoughPatternContainerShip &houghpatterns) const override
 returns etapattern container in EDM
virtual MuonHoughPatternContainerShip emptyHoughPattern () const override
 creates houghpatterns, called from FinderTool
 DeclareInterfaceID (IMuonHoughPatternTool, 1, 0)
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

void makePatterns (int id_number, double weightmdt, const MuonHoughHitContainer &event, MuonHoughPatternContainerShip &houghpatterns) const
 method that builds the patterns
std::unique_ptr< MuonPrdPatternCollectiongetCurvedMuonPatterns (MuonHoughPatternContainerShip &houghpatterns) const
 returns curvedpattern container in EDM
void useIPMuons ()
 reduces Detector sizes for Hough Histograms to find patterns from muons from the Interaction Point (default on)
bool analyseHisto (int id_number, int level, const std::unique_ptr< MuonHoughHitContainer > &event_to_analyse, std::unique_ptr< MuonHoughTransformSteering > &houghtransform, MuonHoughPatternContainerShip &houghpatterns) const
 analyses the hough histograms
int numberOfHits (const MuonHoughHitContainer &event) const
 returns number of hits left (unused)
bool hitInHoughPattern (const std::shared_ptr< MuonHoughHit > &hit, const MuonHoughPatternContainer &houghpattern) const
 checks if hit is already in one of the found houghpatterns (unused)
void weightRescaling (const MuonHoughHitContainer &event, int id_number, int level) const
 rescales hits per iteration to reduce number of patterns when already some have been found
void calculateWeights (const MuonHoughHitContainer &event, double weightmdt) const
 calculates new weights based on rejection factor (1-origweight) and number of hits in event, only done for MDTs
int overlapHoughPatterns (const MuonHoughPattern &houghpattern1, const MuonHoughPattern &houghpattern2) const
 returns number of hits that are in both hough patterns
std::unique_ptr< MuonHoughHitContainerwhichEventHough (int id, const MuonHoughHitContainer &event, double weightmdt) const
 selects the hitcontainer to be used for filling the histograms
std::unique_ptr< MuonHoughHitContainerwhichEventAssociation (int id, const MuonHoughHitContainer &event) const
 selects the hitcontainer to be used to associate to the maxima
std::unique_ptr< MuonHoughTransformSteeringwhichHoughTransform (int id) const
 returns the Houghtransform for the id
std::vector< int > maxLevelHoughPattern (const MuonHoughPatternContainerShip &houghpattern) const
 returns the maximum iteration, not in use
int maxLevelHoughPattern (const MuonHoughPatternContainerShip &houghpattern, int id_number) const
 returns the maximum iteration, not in use
std::unique_ptr< Muon::MuonPrdPatternhoughPatternToEtaPattern (const MuonHoughPattern &houghpattern) const
 converts hough pattern to EDM eta patterns
std::unique_ptr< Muon::MuonPrdPatternhoughPatternToPhiPattern (const MuonHoughPattern &houghpattern) const
 converts hough pattern to EDM phi patterns
std::unique_ptr< Muon::MuonPrdPatternhoughPatternsToOneEtaPattern (const MuonHoughPattern &houghpattern1, const MuonHoughPattern &houghpattern2) const
 converts and combines two hough patterns to one EDM phi pattern
std::unique_ptr< Muon::MuonPrdPatternhoughPatternsToOnePhiPattern (const MuonHoughPattern &houghpattern1, const MuonHoughPattern &houghpattern2) const
 converts and combines two hough patterns to one EDM phi pattern
std::unique_ptr< Muon::MuonPrdPatternhoughPatternToCleanPhiPattern (MuonHoughPattern &houghpattern) const
 converts hough pattern to EDM phi patterns and cleans it from outliers
unsigned int getThresholdHoughPattern (int id_number) const
 returns minimum number of hits a hough pattern can contain
double getThresholdHisto (int id_number) const
 returns minimum number for the maximum of a hough transform
void setWeightMdtCutValue (const MuonHoughHitContainer &event, double &weightmdt) const
 calculates the mdt weight cut value
bool hitThroughCut (const std::shared_ptr< MuonHoughHit > &hit, double weightmdt) const
 hit through weight cut?
void printPattern (Muon::MuonPrdPattern *muonpattern) const
 print out pattern hits
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Static Private Member Functions

static void resetAssociation (const MuonHoughHitContainer &event)
 reset association flag of hits in m_event
static bool hitsLeft (const MuonHoughHitContainer &event)
 returns if there are hits left
static std::unique_ptr< MuonHoughHitContainerhitsNotInPattern (const MuonHoughHitContainer &event, int id_number)
 returns a hitcontainer with hits not yet used in pattern
static void transformCoordsMaximum (std::pair< double, double > &coordsmaximum, double r0_true)
 corrects the maximum of the histogram with a factor (not in use anymore, used for old rz transform)

Private Attributes

std::unique_ptr< TFile > m_file
 pointer to the file name for the hough histograms
MuonHoughMathUtils m_muonhoughmathutils
 object for use of mathematical formulas for trackmodels
Gaudi::Property< bool > m_use_histos {this, "UseHistos", false}
 output histograms (false)
Gaudi::Property< bool > m_use_cosmics {this, "UseCosmics", false}
 use cosmic settings (false)
Gaudi::Property< bool > m_use_csc_in_pattern {this, "UseCscInPattern", true}
 use csc hits in association / pattern (true)
Gaudi::Property< bool > m_use_csc_in_hough {this, "UseCscInHough", true}
 use csc hits in histogram (false)
Gaudi::Property< bool > m_use_negative_weights {this, "UseNegativeWeights", false}
 use negative weights (false)
Gaudi::Property< bool > m_use_curvedhough {this, "UseCurvedHough", true}
 use curved hough transformation for eta patterns (true)
int m_number_of_ids {7}
 number of hough transforms currently supported (7)
Gaudi::Property< int > m_number_of_maxima {this, "NumberOfMaximaPerIterations", 5}
 number of iterations (5)
bool m_use_ip {false}
 use interaction point constraint (true)
Gaudi::Property< unsigned int > m_thresholdpattern_xyz {this, "SetThresholdPatternRPhi", 1}
 minimal size for a phi pattern (1)
Gaudi::Property< unsigned int > m_thresholdpattern_rz {this, "SetThresholdPatternREta", 3}
 minimal size for a eta pattern (3)
double m_detectorsize_xy {0.}
 acceptancy of patterns in xy (phi) in mm
double m_detectorsize_yz {0.}
 acceptancy of patterns in yz (not used) in mm
double m_detectorsize_rz {0.}
 acceptancy of patterns in rz (eta) in mm
Gaudi::Property< bool > m_weightcut {this, "ApplyWeightCut", true}
 weight_cut for hits in hough
Gaudi::Property< double > m_weight {this, "WeightCut", 0.25}
 value of weight cut
Gaudi::Property< bool > m_weightcutmdt
 weight_cut for mdt hits in hough
Gaudi::Property< double > m_thresholdhisto_xyz {this, "SetThresholdHistoRPhi", 0.9}
 threshold histogram in xyz
Gaudi::Property< double > m_thresholdhisto_rz {this, "SetThresholdHistoREta", 2.1}
 threshold histogram in rz
Gaudi::Property< int > m_number_of_sectors_xyz {this, "SetNumberOfSectorsRPhi", 12}
 number of sectors (different regions in which patterns can be found in the same iteration) in xyz
Gaudi::Property< int > m_number_of_sectors_rz {this, "SetNumberOfSectorsREta", 16}
 number of sectors (different regions in which patterns can be found in the same iteration) in rz
int m_number_of_sectors_rz_cosmics {12}
 number of sectors (different regions in which patterns can be found in the same iteration) in rzcosmics
Gaudi::Property< int > m_printlevel {this, "Printlevel", 0}
 output level (range 0-10) (default 0)
std::atomic_uint m_ncalls {0}
Gaudi::Property< int > m_maxNumberOfPhiHits {this, "MaximumNumberOfPhiHits", -1}
 maximum number of phi hits to do pattern recognition, if small zero no cut is applied
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Static Private Attributes

static constexpr bool m_use_rpc_measures_eta {true}
 use rpc phi strips in phi-patterns (true)
static constexpr double m_maximum_residu_mm {500.}
 distance hits are associated with pattern in mm
static constexpr double m_maximum_residu_mm_cosmics {2000.}
 distance hits are associated with pattern in mm for cosmics
static constexpr double m_maximum_residu_angle {3.}
 distance hits are associated with pattern in degrees
static constexpr int m_maximum_level {5}
 // number of maximum iterations over houghtransform
static constexpr double m_z_cor_constant {-10000.}
 use hough correction to correct the maximum found in rz-plane slightly as there is a bias in the houghtransform
static constexpr double m_z_cor_constant2 {6000.}
 constant 2 for z for hough correction
static constexpr double m_theta_cor_constant {-0.042}
 constant 1 for theta for hough correction
static constexpr double m_theta_cor_constant2 {4000.}
 constant 2 for theta for hough correction
static constexpr double m_detectorsize_xy_full {15000.}
 size of full detector in xy (phi) in mm, used as acceptancy for cosmics
static constexpr double m_detectorsize_yz_full {25000.}
 size of full detector in yz (not used) in mm, used as acceptancy for cosmics
static constexpr double m_detectorsize_rz_full {27750.}
 size of full detector in rz (eta) in mm, used as acceptancy for cosmics
static constexpr double m_detectorsize_xy_ip {600.}
 acceptancy of patterns for ip in xy (phi) in mm
static constexpr double m_detectorsize_yz_ip {1000.}
 acceptancy of patterns for ip in yz (not used) in mm
static constexpr double m_detectorsize_rz_ip {1500.}
 acceptancy of patterns for ip in rz (eta) in mm
static constexpr double m_detectorsize_angle_xyz {360.}
 max range of angle in xyz in degrees (360)
static constexpr double m_detectorsize_angle_rz {180.}
 max range of angle in rz in degrees (180)
static constexpr double m_stepsize_xy {75.}
 max range of 1/sqrt(curvature) for curved transform, corresponds to 0.02 ~ 2,5m ~ 1.6GeV
static constexpr double m_stepsize_yz {250.}
 bin width for yz
static constexpr double m_stepsize_rz {75.}
 bin width for rz
static constexpr double m_stepsize_xy_cosmics {150.}
 bin width for xy cosmics
static constexpr double m_stepsize_rz_cosmics {150.}
 bin width for rzcosmics
static constexpr double m_stepsize_per_angle_xyz {0.25}
 bin width for angle in xyz
static constexpr double m_stepsize_per_angle_rz {0.25}
 bin width for angle in rz
static constexpr double m_stepsize_per_angle_xy_cosmics {1.}
 bin width for angle in xy cosmics
static constexpr double m_stepsize_per_angle_rz_cosmics {2.}
 bin width for angle in rzcosmics
static constexpr int m_nbins_curved {160}
 bin width for 1/sqrt(curvature)

Detailed Description

Definition at line 18 of file MuonHoughPatternTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ MuonHoughPatternTool()

MuonHoughPatternTool::MuonHoughPatternTool ( const std::string & type,
const std::string & name,
const IInterface * parent )

Default constructor.

Definition at line 24 of file MuonHoughPatternTool.cxx.

24 :
25 AthAlgTool(type, name, parent) {
26 declareInterface<IMuonHoughPatternTool>(this);
27
31}
AthAlgTool()
Default constructor:
static constexpr double m_detectorsize_rz_full
size of full detector in rz (eta) in mm, used as acceptancy for cosmics
double m_detectorsize_rz
acceptancy of patterns in rz (eta) in mm
static constexpr double m_detectorsize_yz_full
size of full detector in yz (not used) in mm, used as acceptancy for cosmics
double m_detectorsize_xy
acceptancy of patterns in xy (phi) in mm
double m_detectorsize_yz
acceptancy of patterns in yz (not used) in mm
static constexpr double m_detectorsize_xy_full
size of full detector in xy (phi) in mm, used as acceptancy for cosmics

◆ ~MuonHoughPatternTool()

virtual MuonHoughPatternTool::~MuonHoughPatternTool ( )
virtualdefault

Destructor.

Member Function Documentation

◆ analyseHisto()

bool MuonHoughPatternTool::analyseHisto ( int id_number,
int level,
const std::unique_ptr< MuonHoughHitContainer > & event_to_analyse,
std::unique_ptr< MuonHoughTransformSteering > & houghtransform,
MuonHoughPatternContainerShip & houghpatterns ) const
private

analyses the hough histograms

Parameters
[in]id_numberThe enum number corresponding to the HoughTransform
[in]levelThe iteration number
[in]event_to_analyseThe hitcontainer which will be associated to the pattern
[in]houghtransformThe HoughTransform

The Analyse-fillHistos loop is at three times ended for each id: 1- if the maximum_number of hhistos[id] ==0 2- if the houghpattern.size() < threshold_for_next_houghpattern 3 - if level == maximum_level at all these 3 times an array[number_of_ids] of int levelmax will be houghpattern has to be deleted.. (all in level>0) 4- if level not gets to 1 // but then no houghpatterns made.. ? 5- if numberOfHits left ==0

Definition at line 224 of file MuonHoughPatternTool.cxx.

226 {
227 ATH_MSG_VERBOSE("analyseHisto MuonHoughPatternTool (start)");
228
236
237 bool test_for_next_level = false;
238
239 const unsigned int threshold_for_next_houghpattern = getThresholdHoughPattern(id_number);
240 double numberofmaxima = 0;
241 double maximum_residu = m_maximum_residu_mm;
242 if (m_use_cosmics) { maximum_residu = m_maximum_residu_mm_cosmics; }
243 MuonHoughPatternCollection houghpatterns = houghtransform->constructHoughPatterns(
244 *event_to_analyse, maximum_residu, m_maximum_residu_angle, m_number_of_maxima);
245
246 for (unsigned int maximum_number = 0; maximum_number < houghpatterns.size(); ++maximum_number) {
247
248 std::unique_ptr<MuonHoughPattern>& houghpattern = houghpatterns[maximum_number];
249 if (!houghpattern) { continue; }
250 numberofmaxima = houghpattern->getMaximumHistogram();
251 ATH_MSG_DEBUG("id_number: " << id_number << " maximum_number: " << maximum_number << " size patternseg: " << houghpattern->size());
252
253 if (houghpattern->empty()) { ATH_MSG_DEBUG("houghpattern==0"); }
254
255 // some print statements
256 if (houghpattern->size() < numberofmaxima) {
257 ATH_MSG_DEBUG("ERROR: houghpattern smaller than maximum, id: " << id_number << " houghpattern.size(): " << houghpattern->size()
258 << " numberofmaxima: " << numberofmaxima);
259 }
260
261 if (m_printlevel >= 4) { houghpattern->printHoughPattern(); }
262
263 // checks for next level / maximum
264
265 if (houghpattern->size() >= threshold_for_next_houghpattern) {
266 if (level + 1 >= m_maximum_level) {
267 ATH_MSG_DEBUG("possibly more levels");
268 } else {
269 test_for_next_level = hitsLeft(*event_to_analyse);
270 }
271 } else if (maximum_number == 0) {
272 ATH_MSG_DEBUG("houghpattern too small for next level : " << level << " id: " << id_number);
273 }
274
275 // print_of houghpatterns:
276 ATH_MSG_DEBUG("Size of HoughPatterns: " << houghpattern->size());
277 houghpatterns_all[id_number][level][maximum_number] = std::move(houghpattern);
278
279 } // maximum_number
280
281 ATH_MSG_DEBUG(" Test for next level: " << test_for_next_level);
282
283 return test_for_next_level;
284
285} // analyseHisto
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
std::vector< std::unique_ptr< MuonHoughPattern > > MuonHoughPatternCollection
This typedef represents a collection and container of MuonHoughPattern objects.
static constexpr int m_maximum_level
// number of maximum iterations over houghtransform
static constexpr double m_maximum_residu_mm
distance hits are associated with pattern in mm
unsigned int getThresholdHoughPattern(int id_number) const
returns minimum number of hits a hough pattern can contain
Gaudi::Property< int > m_number_of_maxima
number of iterations (5)
static constexpr double m_maximum_residu_angle
distance hits are associated with pattern in degrees
Gaudi::Property< int > m_printlevel
output level (range 0-10) (default 0)
Gaudi::Property< bool > m_use_cosmics
use cosmic settings (false)
static constexpr double m_maximum_residu_mm_cosmics
distance hits are associated with pattern in mm for cosmics
static bool hitsLeft(const MuonHoughHitContainer &event)
returns if there are hits left

◆ calculateWeights()

void MuonHoughPatternTool::calculateWeights ( const MuonHoughHitContainer & event,
double weightmdt ) const
private

calculates new weights based on rejection factor (1-origweight) and number of hits in event, only done for MDTs

Definition at line 383 of file MuonHoughPatternTool.cxx.

383 {
384 if (weightmdt < 0.5) return;
385 // else do nothing (e.g. cosmics case)
386 for (unsigned int i = 0; i < event.size(); ++i) {
387 std::shared_ptr<MuonHoughHit> hit = event.getHit(i);
388 MuonHough::DetectorTechnology technology = hit->getDetectorId();
389 if (technology == MuonHough::MDT) {
390 // recalculate weight, especially important for cavern background MDT events
391 double p_old = hit->getOrigWeight();
392 double p_calc = 0.25 * p_old * (1. - weightmdt);
393 double p_new = p_calc / (p_calc + weightmdt * (1 - p_old));
394 ATH_MSG_VERBOSE(" MDT probability old " << p_old << " Recalculated " << p_new);
395 hit->setWeight(p_new);
396 }
397 }
398}
DetectorTechnology
enum to identify the muondetectortechnology

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ DeclareInterfaceID()

IMuonHoughPatternTool::DeclareInterfaceID ( IMuonHoughPatternTool ,
1 ,
0  )
inherited
Todo
should be rethought and possibly using the Moore Interface

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ emptyHoughPattern()

MuonHoughPatternContainerShip MuonHoughPatternTool::emptyHoughPattern ( ) const
overridevirtual

creates houghpatterns, called from FinderTool

Implements IMuonHoughPatternTool.

Definition at line 202 of file MuonHoughPatternTool.cxx.

202 {
204 houghpattern.reserve(m_number_of_ids);
205 for (int i = 0; i < m_number_of_ids; ++i) {
206 MuonHoughPatternContainer which_segment_vector;
207 which_segment_vector.reserve(m_maximum_level);
208 houghpattern.emplace_back(std::move(which_segment_vector));
209
210 for (int lvl = 0; lvl < m_maximum_level; lvl++) {
211 MuonHoughPatternCollection level_vector;
212 level_vector.reserve(m_number_of_maxima);
213 houghpattern[i].emplace_back(std::move(level_vector));
214
215 for (int maximum_number = 0; maximum_number < m_number_of_maxima; maximum_number++) {
216 houghpattern[i][lvl].emplace_back(nullptr);
217
218 } // maximum_number
219 } // maximum_level
220 } // number_of_ids
221 return houghpattern;
222} // emptyHoughPattern
std::vector< MuonHoughPatternContainer > MuonHoughPatternContainerShip
std::vector< MuonHoughPatternCollection > MuonHoughPatternContainer
int m_number_of_ids
number of hough transforms currently supported (7)

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ finalize()

StatusCode MuonHoughPatternTool::finalize ( )
overridevirtual

deletes private members

Definition at line 191 of file MuonHoughPatternTool.cxx.

191 {
192 ATH_MSG_VERBOSE("finalize()");
193
194 if (m_use_histos) {
195 m_file->Write();
196 m_file.reset();
197 }
198
199 return StatusCode::SUCCESS;
200}
std::unique_ptr< TFile > m_file
pointer to the file name for the hough histograms
Gaudi::Property< bool > m_use_histos
output histograms (false)

◆ getCurvedMuonPatterns()

std::unique_ptr< MuonPrdPatternCollection > MuonHoughPatternTool::getCurvedMuonPatterns ( MuonHoughPatternContainerShip & houghpatterns) const
private

returns curvedpattern container in EDM

Definition at line 953 of file MuonHoughPatternTool.cxx.

953 {
954 std::unique_ptr<MuonPrdPatternCollection> curvedpatterncollection = std::make_unique<MuonPrdPatternCollection>();
955
956 int maximum_number_of_patterns = m_maximum_level * m_number_of_maxima;
957
958 curvedpatterncollection->reserve(maximum_number_of_patterns);
959
961 for (unsigned int i = 0; i < curvedpatterns.size(); ++i) {
962 for (unsigned int j = 0; j < curvedpatterns[i].size(); ++j) {
963 std::unique_ptr<MuonHoughPattern>& houghpattern = curvedpatterns[i][j];
964 if (!houghpattern) { continue; }
965
966 if (!curvedpatterns[i][j]->empty()) {
967 std::unique_ptr<Muon::MuonPrdPattern> muonpattern = houghPatternToEtaPattern(*curvedpatterns[i][j]);
968 curvedpatterncollection->push_back(std::move(muonpattern));
969 ATH_MSG_DEBUG(" Lift MuoncurvedPattern size " << curvedpatterns[i][j]->size());
970 }
971 }
972 }
973 return curvedpatterncollection;
974}
static const Attributes_t empty
std::unique_ptr< Muon::MuonPrdPattern > houghPatternToEtaPattern(const MuonHoughPattern &houghpattern) const
converts hough pattern to EDM eta patterns
@ hough_curved_at_a_cylinder

◆ getEtaMuonPatterns()

std::unique_ptr< MuonPrdPatternCollection > MuonHoughPatternTool::getEtaMuonPatterns ( MuonHoughPatternContainerShip & houghpatterns) const
overridevirtual

returns etapattern container in EDM

Implements IMuonHoughPatternTool.

Definition at line 806 of file MuonHoughPatternTool.cxx.

806 {
807 std::unique_ptr<MuonPrdPatternCollection> etapatterncollection = std::make_unique<MuonPrdPatternCollection>();
808
809 int maximum_number_of_patterns = m_maximum_level * m_number_of_maxima;
810
811 if (m_use_curvedhough) maximum_number_of_patterns = 2 * maximum_number_of_patterns;
812
813 etapatterncollection->reserve(maximum_number_of_patterns);
814
815 int id = MuonHough::hough_rz;
816 if (m_use_cosmics) {
818 ATH_MSG_DEBUG(" GetEtaMuonPatterns Use RZ curved hough patterns ");
819 } else if (m_use_curvedhough) {
821 ATH_MSG_DEBUG(" GetEtaMuonPatterns Use curved hough patterns ");
822 } else {
823 ATH_MSG_DEBUG(" GetEtaMuonPatterns Use RZ hough patterns ");
824 }
825
826 MuonHoughPatternContainer& etapatterns = houghpatterns[id];
827
828 // Bookkeeping for merged or double eta patterns
829
830 std::map<MuonHoughPattern*, int> mergedpatterns;
831 for (unsigned int i = 0; i < etapatterns.size(); ++i) {
832 for (unsigned int j = 0; j < etapatterns[i].size(); ++j) {
833 std::unique_ptr<MuonHoughPattern>& houghpattern = etapatterns[i][j];
834 if (!houghpattern) continue;
835 mergedpatterns[houghpattern.get()] = 0;
836 }
837 }
838
839 // Search for identical eta patterns and remove them
840 // and search for overlapping eta patterns and merge them (10-1-2008, does merging ever happen? JS, yes it does!)
841
842 for (unsigned int i = 0; i < etapatterns.size(); ++i) {
843 for (unsigned int j = 0; j < etapatterns[i].size(); ++j) {
844 std::unique_ptr<MuonHoughPattern>& houghpattern1 = etapatterns[i][j];
845 if (!houghpattern1) continue;
846 if (etapatterns[i][j]->size() < m_thresholdpattern_rz) continue;
847 ATH_MSG_DEBUG(" Eta patterns size before Merge " << etapatterns[i][j]->size());
848 for (unsigned int k = i; k < etapatterns.size(); k++) {
849 for (unsigned int l = 0; l < etapatterns[k].size(); l++) {
850 std::unique_ptr<MuonHoughPattern>& houghpattern2 = etapatterns[k][l];
851 if (!houghpattern2) continue;
852 if (etapatterns[k][l]->size() < m_thresholdpattern_rz) continue;
853 //cppcheck-suppress mismatchingContainers
854 if (houghpattern1.get() == houghpattern2.get()) continue;
855 if (mergedpatterns[houghpattern1.get()] == 1) continue;
856 if (mergedpatterns[houghpattern2.get()] == 1) continue;
857
858 // calculate if curvatures are compatible, not done for cosmics
859 double alpha = 0.;
860 if (!m_use_cosmics) {
861 double curv1 = houghpattern1->getECurvature();
862 double curv2 = houghpattern2->getECurvature();
863 if (std::abs(curv1) < 1001. || std::abs(curv2) < 1001.) {
864 ATH_MSG_DEBUG("Curvature too small, should not be possible: " << curv1 << " " << curv2);
865 continue;
866 }
867
868 double angle1 = std::acos((std::abs(curv1) - 1000.) / curv1); // angle change after 1000 (mm)
869 double angle2 = std::acos((std::abs(curv2) - 1000.) / curv2);
870 alpha = std::abs(std::sin(angle1 - angle2));
871
872 ATH_MSG_DEBUG(" patterns curv1 " << curv1 << " curv2 " << curv2 << " alpha " << alpha);
873 }
874
875 double phi1 = houghpattern1->getEPhi();
876 double phi2 = houghpattern2->getEPhi();
877 double dotprod = std::cos(phi1) * std::cos(phi2) + std::sin(phi1) * std::sin(phi2);
878 if (dotprod > 1.)
879 dotprod = 1.;
880 else if (dotprod < -1.)
881 dotprod = -1.;
882 double psi = std::acos(dotprod);
883 double the1 = houghpattern1->getETheta();
884 double the2 = houghpattern2->getETheta();
885 dotprod = std::cos(the1) * std::cos(the2) + std::sin(the1) * std::sin(the2);
886 if (dotprod > 1.)
887 dotprod = 1.;
888 else if (dotprod < -1.)
889 dotprod = -1.;
890 double chi = std::acos(dotprod);
891
892 ATH_MSG_DEBUG(" patterns phi1 " << phi1 << " phi2 " << phi2 << " psi " << psi);
893 ATH_MSG_DEBUG(" patterns the1 " << the1 << " the2 " << the2 << " chi " << chi);
894
895 if (chi < 0.5 && psi < 0.5 && alpha < 0.05) { // 0.05 (rad) corresponds with 3 degrees per m
896
897 int overlap = overlapHoughPatterns(*houghpattern1, *houghpattern2);
898 const int ns1 = houghpattern1->size();
899 const int ns2 = houghpattern2->size();
900
901 ATH_MSG_DEBUG(" Eta Overlap " << overlap << " size1 " << ns1 << " size2 " << ns2);
902
903 if (overlap == ns2 && overlap <= ns1) {
904 ATH_MSG_DEBUG(" DROP patterns overlapping hits ");
905 mergedpatterns[houghpattern2.get()] = 1;
906 continue;
907 }
908 if (overlap == ns1 && overlap < ns2) {
909 ATH_MSG_DEBUG(" DROP patterns overlapping hits ");
910 mergedpatterns[houghpattern1.get()] = 1;
911 continue;
912 }
913 std::unique_ptr<Muon::MuonPrdPattern> muonpattern;
914 // Look for 80% or more overlap
915 if ((overlap > 0.8 * ns1 || overlap > 0.8 * ns2) && ns1 >= ns2) {
916 muonpattern = houghPatternsToOneEtaPattern(*etapatterns[i][j], *etapatterns[k][l]);
917 }
918 if ((overlap > 0.8 * ns1 || overlap > 0.8 * ns2) && ns1 < ns2) {
919 muonpattern = houghPatternsToOneEtaPattern(*etapatterns[k][l], *etapatterns[i][j]);
920 }
921 if (muonpattern) {
922 etapatterncollection->push_back(std::move(muonpattern));
923 mergedpatterns[houghpattern1.get()] = 1;
924 mergedpatterns[houghpattern2.get()] = 1;
925 continue;
926 }
927 } // end angular cut
928 }
929 } // end k
930 }
931 } // end i
932
933 for (unsigned int i = 0; i < etapatterns.size(); ++i) {
934 for (unsigned int j = 0; j < etapatterns[i].size(); ++j) {
935 std::unique_ptr<MuonHoughPattern>& houghpattern = etapatterns[i][j];
936 if (!houghpattern) { continue; }
937 if (mergedpatterns[houghpattern.get()] == 1) continue;
938
939 if (!etapatterns[i][j]->empty()) {
940 std::unique_ptr<Muon::MuonPrdPattern> muonpattern = houghPatternToEtaPattern(*etapatterns[i][j]);
941 //use muonpattern *before* you move it
942 if (msgLvl(MSG::VERBOSE)) { printPattern(muonpattern.get()); }
943 etapatterncollection->push_back(std::move(muonpattern));
944 ATH_MSG_DEBUG(" Lift MuonEtaPattern size " << etapatterns[i][j]->size());
945
946 }
947 }
948 }
949
950 return etapatterncollection;
951}
bool msgLvl(const MSG::Level lvl) const
Gaudi::Property< bool > m_use_curvedhough
use curved hough transformation for eta patterns (true)
void printPattern(Muon::MuonPrdPattern *muonpattern) const
print out pattern hits
Gaudi::Property< unsigned int > m_thresholdpattern_rz
minimal size for a eta pattern (3)
int overlapHoughPatterns(const MuonHoughPattern &houghpattern1, const MuonHoughPattern &houghpattern2) const
returns number of hits that are in both hough patterns
std::unique_ptr< Muon::MuonPrdPattern > houghPatternsToOneEtaPattern(const MuonHoughPattern &houghpattern1, const MuonHoughPattern &houghpattern2) const
converts and combines two hough patterns to one EDM phi pattern
l
Printing final latex table to .tex output file.

◆ getPhiMuonPatterns()

std::unique_ptr< MuonPrdPatternCollection > MuonHoughPatternTool::getPhiMuonPatterns ( MuonHoughPatternContainerShip & houghpatterns) const
overridevirtual

returns phipattern container in EDM

Implements IMuonHoughPatternTool.

Definition at line 683 of file MuonHoughPatternTool.cxx.

683 {
684 std::unique_ptr<MuonPrdPatternCollection> phipatterncollection = std::make_unique<MuonPrdPatternCollection>();
685 phipatterncollection->reserve(m_maximum_level * m_number_of_maxima);
686
687 MuonHoughPatternContainer& phipatterns = houghpatterns[MuonHough::hough_xy];
688
689 // Bookkeeping for merged or double phi pattersn
690
691 std::map<MuonHoughPattern*, int> mergedpatterns;
692 for (unsigned int i = 0; i < phipatterns.size(); ++i) {
693 for (unsigned int j = 0; j < phipatterns[i].size(); ++j) {
694 std::unique_ptr<MuonHoughPattern>& houghpattern = phipatterns[i][j];
695 if (!houghpattern) continue;
696 mergedpatterns[houghpattern.get()] = 0;
697 }
698 }
699
700 // Search for identical phi patterns and remove them
701 // and search for overlapping phi patterns and merge them for IP constraint (10-1-2008, does merging ever happen? JS)
702
703 for (unsigned int i = 0; i < phipatterns.size(); ++i) {
704 for (unsigned int j = 0; j < phipatterns[i].size(); ++j) {
705 std::unique_ptr<MuonHoughPattern>& houghpattern1 = phipatterns[i][j];
706 if (!houghpattern1) continue;
707 if (phipatterns[i][j]->size() < m_thresholdpattern_xyz) continue;
708 ATH_MSG_DEBUG(" patterns size before Merge " << phipatterns[i][j]->size());
709 for (unsigned int k = i; k < phipatterns.size(); k++) {
710 for (unsigned int l = 0; l < phipatterns[k].size(); l++) {
711 std::unique_ptr<MuonHoughPattern>& houghpattern2 = phipatterns[k][l];
712 if (!houghpattern2) continue;
713 if (phipatterns[k][l]->size() < m_thresholdpattern_xyz) continue;
714 //cppcheck-suppress mismatchingContainers
715 if (houghpattern1.get() == houghpattern2.get()) continue;
716 if (mergedpatterns[houghpattern1.get()] == 1) continue;
717 if (mergedpatterns[houghpattern2.get()] == 1) continue;
718 const double phi1 = houghpattern1->getEPhi();
719 const double phi2 = houghpattern2->getEPhi();
720 CxxUtils::sincos scphi1(phi1);
721 CxxUtils::sincos scphi2(phi2);
722 double dotprod = scphi1.cs * scphi2.cs + scphi1.sn * scphi2.sn;
723 if (dotprod > 1.)
724 dotprod = 1.;
725 else if (dotprod < -1.)
726 dotprod = -1.;
727 double psi = std::acos(dotprod);
728 const double the1 = houghpattern1->getETheta();
729 const double the2 = houghpattern2->getETheta();
730 CxxUtils::sincos scthe1(the1);
731 CxxUtils::sincos scthe2(the2);
732 dotprod = scthe1.cs * scthe2.cs + scthe1.sn * scthe2.sn;
733 if (dotprod > 1.)
734 dotprod = 1.;
735 else if (dotprod < -1.)
736 dotprod = -1.;
737 double chi = std::acos(dotprod);
738 ATH_MSG_DEBUG(" patterns phi1 " << phi1 << " phi2 " << phi2 << " psi " << psi);
739 ATH_MSG_DEBUG(" patterns the1 " << the1 << " the2 " << the2 << " chi " << chi);
740 if (chi < 0.5 || psi < 0.5) {
741 int overlap = overlapHoughPatterns(*houghpattern1, *houghpattern2);
742 ATH_MSG_DEBUG(" Phi Overlap " << overlap << " size1 " << houghpattern1->size() << " size2 "
743 << houghpattern2->size());
744 int ns1 = houghpattern1->size();
745 int ns2 = houghpattern2->size();
746 if (overlap <= ns1 && overlap == ns2) {
747 ATH_MSG_DEBUG(" DROP patterns same hits ");
748 mergedpatterns[houghpattern2.get()] = 1;
749 continue;
750 }
751 if (overlap == ns1 && overlap < ns2) {
752 ATH_MSG_DEBUG(" DROP patterns same hits ");
753 mergedpatterns[houghpattern1.get()] = 1;
754 continue;
755 }
756 if (m_use_ip) {
757 // Merge and do cleaning (IP constraint)
758 std::unique_ptr<Muon::MuonPrdPattern> muonpattern;
759 if ((overlap > 0.8 * ns1 || overlap > 0.8 * ns2) && ns1 >= ns2) {
760 muonpattern = houghPatternsToOnePhiPattern(*phipatterns[i][j], *phipatterns[k][l]);
761 }
762 if ((overlap > 0.8 * ns1 || overlap > 0.8 * ns2) && ns1 < ns2) {
763 // Merge and do cleaning (IP constraint)
764 muonpattern = houghPatternsToOnePhiPattern(*phipatterns[k][l], *phipatterns[i][j]);
765 }
766 if (muonpattern) {
767 phipatterncollection->push_back(std::move(muonpattern));
768 mergedpatterns[houghpattern1.get()] = 1;
769 mergedpatterns[houghpattern2.get()] = 1;
770 continue;
771 }
772 } // use IP
773 } // angular cut
774 }
775 } // end k
776 }
777 } // end i
778
779 for (unsigned int i = 0; i < phipatterns.size(); ++i) {
780 for (unsigned int j = 0; j < phipatterns[i].size(); ++j) {
781 std::unique_ptr<MuonHoughPattern>& houghpattern = phipatterns[i][j];
782 if (!houghpattern) { continue; }
783 if (mergedpatterns[houghpattern.get()] == 1) continue;
784
785 if (!phipatterns[i][j]->empty()) {
786 std::unique_ptr<Muon::MuonPrdPattern> muonpattern;
787
788 if (!m_use_ip) {
789 muonpattern = houghPatternToPhiPattern(*phipatterns[i][j]);
790 } else {
791 muonpattern = houghPatternToCleanPhiPattern(*phipatterns[i][j]);
792 }
793
794 if (muonpattern) {
795 ATH_MSG_DEBUG(" Lift MuonPhiPattern size " << muonpattern->numberOfContainedPrds());
796 if (msgLvl(MSG::VERBOSE)) { printPattern(muonpattern.get()); }
797 phipatterncollection->push_back(std::move(muonpattern));
798 }
799 }
800 }
801 }
802
803 return phipatterncollection;
804}
std::unique_ptr< Muon::MuonPrdPattern > houghPatternToCleanPhiPattern(MuonHoughPattern &houghpattern) const
converts hough pattern to EDM phi patterns and cleans it from outliers
bool m_use_ip
use interaction point constraint (true)
std::unique_ptr< Muon::MuonPrdPattern > houghPatternsToOnePhiPattern(const MuonHoughPattern &houghpattern1, const MuonHoughPattern &houghpattern2) const
converts and combines two hough patterns to one EDM phi pattern
std::unique_ptr< Muon::MuonPrdPattern > houghPatternToPhiPattern(const MuonHoughPattern &houghpattern) const
converts hough pattern to EDM phi patterns
Gaudi::Property< unsigned int > m_thresholdpattern_xyz
minimal size for a phi pattern (1)

◆ getThresholdHisto()

double MuonHoughPatternTool::getThresholdHisto ( int id_number) const
private

returns minimum number for the maximum of a hough transform

Definition at line 1421 of file MuonHoughPatternTool.cxx.

1421 {
1422 double thresholdhisto = 0.;
1423 switch (id_number) {
1425 case MuonHough::hough_yz: thresholdhisto = m_thresholdhisto_xyz; break;
1430 case MuonHough::hough_curved_at_a_cylinder: thresholdhisto = m_thresholdhisto_rz; break;
1431 default: ATH_MSG_WARNING("no valid id (id_number)");
1432 } // switch
1433 return thresholdhisto;
1434}
#define ATH_MSG_WARNING(x)
Gaudi::Property< double > m_thresholdhisto_rz
threshold histogram in rz
Gaudi::Property< double > m_thresholdhisto_xyz
threshold histogram in xyz

◆ getThresholdHoughPattern()

unsigned int MuonHoughPatternTool::getThresholdHoughPattern ( int id_number) const
private

returns minimum number of hits a hough pattern can contain

Definition at line 1406 of file MuonHoughPatternTool.cxx.

1406 {
1407 unsigned int thresholdpattern = 0;
1408 switch (id_number) {
1410 case MuonHough::hough_yz: thresholdpattern = m_thresholdpattern_xyz; break;
1415 case MuonHough::hough_curved_at_a_cylinder: thresholdpattern = m_thresholdpattern_rz; break;
1416 default: ATH_MSG_WARNING("no valid id (id_number)");
1417 } // switch
1418 return thresholdpattern;
1419}

◆ hitInHoughPattern()

bool MuonHoughPatternTool::hitInHoughPattern ( const std::shared_ptr< MuonHoughHit > & hit,
const MuonHoughPatternContainer & houghpattern ) const
private

checks if hit is already in one of the found houghpatterns (unused)

Definition at line 308 of file MuonHoughPatternTool.cxx.

308 {
309 // checks if hit is already assigned to a houghpattern
310
311 for (unsigned int i = 0; i < houghpattern.size(); ++i) {
312 for (unsigned int j = 0; j < houghpattern[i].size(); ++j) {
313 if (houghpattern[i][j]) {
314 if (houghpattern[i][j]->hitInHoughPattern(hit)) {
315 ATH_MSG_VERBOSE("Hit in hough pattern found level " << i << " max " << j << "hitid: " << hit->getId());
316 return true;
317 }
318 }
319 }
320 }
321 return false;
322}
int getId() const
returns id
bool hitInHoughPattern(const std::shared_ptr< MuonHoughHit > &hit, const MuonHoughPatternContainer &houghpattern) const
checks if hit is already in one of the found houghpatterns (unused)

◆ hitsLeft()

bool MuonHoughPatternTool::hitsLeft ( const MuonHoughHitContainer & event)
staticprivate

returns if there are hits left

Definition at line 287 of file MuonHoughPatternTool.cxx.

287 {
288 int number_of_hits = event.size();
289 for (int hitid = 0; hitid < number_of_hits; ++hitid) {
290 if (!event.getHit(hitid)->getAssociated()) { return true; }
291 }
292 return false;
293}

◆ hitsNotInPattern()

std::unique_ptr< MuonHoughHitContainer > MuonHoughPatternTool::hitsNotInPattern ( const MuonHoughHitContainer & event,
int id_number )
staticprivate

returns a hitcontainer with hits not yet used in pattern

Definition at line 1398 of file MuonHoughPatternTool.cxx.

1398 {
1399 std::unique_ptr<MuonHoughHitContainer> hits_not_in_patterns = std::make_unique<MuonHoughHitContainer>();
1400
1401 for (unsigned int hitid = 0; hitid < event.size(); ++hitid) {
1402 if (!event.getHit(hitid)->getAssociated()) { hits_not_in_patterns->addHit(event.getHit(hitid)); }
1403 }
1404 return hits_not_in_patterns;
1405}

◆ hitThroughCut()

bool MuonHoughPatternTool::hitThroughCut ( const std::shared_ptr< MuonHoughHit > & hit,
double weightmdt ) const
private

hit through weight cut?

Definition at line 1445 of file MuonHoughPatternTool.cxx.

1445 {
1446 return (!m_weightcutmdt || hit->getDetectorId() != MuonHough::MDT || hit->getProbability() >= weightmdt) &&
1447 (!m_weightcut || hit->getProbability() >= m_weight);
1448}
MuonHough::DetectorTechnology getDetectorId() const
return DetectorTechnology
double getProbability() const
returns probability that hit is part of pattern (true muon)
Gaudi::Property< bool > m_weightcutmdt
weight_cut for mdt hits in hough
Gaudi::Property< bool > m_weightcut
weight_cut for hits in hough
Gaudi::Property< double > m_weight
value of weight cut

◆ houghPatternsToOneEtaPattern()

std::unique_ptr< Muon::MuonPrdPattern > MuonHoughPatternTool::houghPatternsToOneEtaPattern ( const MuonHoughPattern & houghpattern1,
const MuonHoughPattern & houghpattern2 ) const
private

converts and combines two hough patterns to one EDM phi pattern

Definition at line 1023 of file MuonHoughPatternTool.cxx.

1024 {
1025 ATH_MSG_DEBUG("houghPatternsToOneEtaPattern");
1026
1027 const int ns1 = houghpattern1.size();
1028 const int ns2 = houghpattern2.size();
1029
1030 const double the1 = houghpattern1.getETheta();
1031 const double the2 = houghpattern2.getETheta();
1032 const double theta = (ns1 * the1 + ns2 * the2) / (ns1 + ns2);
1033
1034 const double phi1 = houghpattern1.getEPhi();
1035 const double phi2 = houghpattern2.getEPhi();
1036 const double cos_phi = (ns1 * std::cos(phi1) + ns2 * std::cos(phi2)) / (ns1 + ns2);
1037 const double sin_phi = (ns1 * std::sin(phi1) + ns2 * std::sin(phi2)) / (ns1 + ns2);
1038 const double phi = std::atan2(sin_phi, cos_phi);
1039
1040 const double invcur1 = 1. / houghpattern1.getECurvature();
1041 const double invcur2 = 1. / houghpattern2.getECurvature();
1042
1043 const Amg::Vector3D position1 = houghpattern1.getEPos();
1044 const Amg::Vector3D position2 = houghpattern2.getEPos();
1045 const double z0 = (ns1 * position1[2] + ns2 * position2[2]) / (ns1 + ns2);
1046
1047 const double invcur = (ns1 * invcur1 + ns2 * invcur2) / (ns1 + ns2);
1048
1049 ATH_MSG_DEBUG("Start Making one eta pattern theta " << theta << " phi " << phi << " invcur " << invcur);
1050
1051 ATH_MSG_DEBUG("eta patterns theta1 " << the1 << " theta2 " << the2 << " phi1 " << phi1 << " phi2 " << phi2 << " invcur1 " << invcur1
1052 << " invcur2 " << invcur2 << " ns1 " << ns1 << " ns2 " << ns2);
1053
1054 ATH_MSG_DEBUG(" z values " << z0 << " z1 " << position1[2] << " z2 " << position2[2]);
1055
1056 // require at least two eta hits on muon pattern
1057
1058 if (ns1 + ns2 < 2) return nullptr;
1059
1060 double invcurvature = invcur;
1061 double charge = 1.;
1062 if (invcurvature < 0) charge = -1;
1063 double pscale = 1.;
1064 if (invcurvature != 0) pscale = 1. / std::abs(invcurvature);
1065
1066 double r0 = 0.001;
1067
1068 if (m_use_cosmics) { // calculate new r0
1069 r0 = (ns1 * houghpattern1.getERPhi() + ns2 * houghpattern2.getERPhi()) / (ns1 + ns2);
1070 ATH_MSG_DEBUG("New r0: " << r0);
1071 }
1072
1073 double x0 = charge * r0 * sin_phi;
1074 double y0 = -charge * r0 * cos_phi;
1075
1076 ATH_MSG_DEBUG(" Lift one Eta pattern charge " << charge << " curvature " << pscale);
1077
1078 const Amg::Vector3D pos = Amg::Vector3D(x0, y0, z0);
1079 const Amg::Vector3D dir =
1080 Amg::Vector3D(pscale * std::sin(theta) * cos_phi, pscale * std::sin(theta) * sin_phi, pscale * std::cos(theta));
1081
1082 std::unique_ptr<Muon::MuonPrdPattern> muonpattern = std::make_unique<Muon::MuonPrdPattern>(pos, dir);
1083 int neta = 0;
1084
1085 for (unsigned int i = 0; i < houghpattern1.size(); ++i) {
1086 double the = houghpattern1.getTheta(i);
1087 muonpattern->addPrd(houghpattern1.getPrd(i));
1088 ++neta;
1089 ATH_MSG_VERBOSE("PrepRawData Added theta " << the);
1090 }
1091
1092 for (unsigned int i = 0; i < houghpattern2.size(); ++i) {
1093 bool accept = true;
1094 double the = houghpattern2.getTheta(i);
1095 for (unsigned int j = 0; j < houghpattern1.size(); ++j) {
1096 if (houghpattern2.getPrd(i) == houghpattern1.getPrd(j)) accept = false;
1097 }
1098 if (accept) {
1099 muonpattern->addPrd(houghpattern2.getPrd(i));
1100 ++neta;
1101 ATH_MSG_VERBOSE("PrepRawData Added theta " << the);
1102 } else {
1103 ATH_MSG_VERBOSE(" PrepRawData already there " << the);
1104 }
1105 }
1106
1107 ATH_MSG_VERBOSE(" END make One Eta pattern hits " << neta);
1108
1109 return muonpattern;
1110}
Scalar phi() const
phi method
Scalar theta() const
theta method
double charge(const T &p)
Definition AtlasPID.h:997
unsigned int size() const
returns size of hitcontainer
const Trk::PrepRawData * getPrd(unsigned int hitno) const
returns preprawdata pointer of hit hitno
double getTheta(unsigned int hitno) const
returns theta of hit hitno
Amg::Vector3D getEPos() const
calulates 3d point closest to ip
double getEPhi() const
returns phi of pattern
double getERPhi() const
returns r0/d0 of pattern
double getECurvature() const
returns curvature of pattern
double getETheta() const
returns theta of pattern
Eigen::Matrix< double, 3, 1 > Vector3D
StatusCode accept(const xAOD::Muon *mu)
const double r0
electron radius{cm}

◆ houghPatternsToOnePhiPattern()

std::unique_ptr< Muon::MuonPrdPattern > MuonHoughPatternTool::houghPatternsToOnePhiPattern ( const MuonHoughPattern & houghpattern1,
const MuonHoughPattern & houghpattern2 ) const
private

converts and combines two hough patterns to one EDM phi pattern

IP constraint used, should not be used for cosmics!

Definition at line 1112 of file MuonHoughPatternTool.cxx.

1113 {
1115
1116 ATH_MSG_DEBUG("houghPatternsToOnePhiPattern");
1117
1118 double theta = (houghpattern1.getETheta() + houghpattern2.getETheta()) / 2.;
1119 double cos_phi{0.}, sin_phi{0.};
1120 int nphi = 0;
1121 for (unsigned int i = 0; i < houghpattern1.size(); ++i) {
1122 double phi = houghpattern1.getPhi(i);
1123 cos_phi += std::cos(phi);
1124 sin_phi += std::sin(phi);
1125 ++nphi;
1126 }
1127 for (unsigned int i = 0; i < houghpattern2.size(); ++i) {
1128 double phi = houghpattern2.getPhi(i);
1129 bool accept = true;
1130 for (unsigned int j = 0; j < houghpattern1.size(); ++j) {
1131 if (houghpattern2.getPrd(i) == houghpattern1.getPrd(j)) accept = false;
1132 }
1133 if (accept) {
1134 cos_phi += std::cos(phi);
1135 sin_phi += std::sin(phi);
1136 ++nphi;
1137 }
1138 }
1139
1140 ATH_MSG_VERBOSE("Start Merged Phi hits cleaning with " << nphi << " hits ");
1141 // require at least two phi hits on muon phi pattern
1142
1143 if (nphi < 2) return nullptr;
1144
1145 double cphit = cos_phi / nphi;
1146 double sphit = sin_phi / nphi;
1147
1148 cos_phi = 0.;
1149 sin_phi = 0.;
1150 nphi = 0;
1151
1152 for (unsigned int i = 0; i < houghpattern1.size(); ++i) {
1153 double phi = houghpattern1.getPhi(i);
1154 double dotprod = cphit * std::cos(phi) + sphit * std::sin(phi);
1155 if (dotprod > 0.95) {
1156 cos_phi += std::cos(phi);
1157 sin_phi += std::sin(phi);
1158 ++nphi;
1159 }
1160 }
1161
1162 for (unsigned int i = 0; i < houghpattern2.size(); ++i) {
1163 double phi = houghpattern2.getPhi(i);
1164 double dotprod = cphit * std::cos(phi) + sphit * std::sin(phi);
1165 if (dotprod > 0.95) {
1166 bool accept = true;
1167 for (unsigned int j = 0; j < houghpattern1.size(); ++j) {
1168 if (houghpattern2.getPrd(i) == houghpattern1.getPrd(j)) accept = false;
1169 }
1170 if (accept) {
1171 cos_phi += std::cos(phi);
1172 sin_phi += std::sin(phi);
1173 ++nphi;
1174 }
1175 }
1176 }
1177
1178 if (nphi < 2) return nullptr;
1179 cphit = cos_phi / nphi;
1180 sphit = sin_phi / nphi;
1181
1182 cos_phi = 0.;
1183 sin_phi = 0.;
1184 nphi = 0;
1185 for (unsigned int i = 0; i < houghpattern1.size(); ++i) {
1186 double phi = houghpattern1.getPhi(i);
1187 double dotprod = cphit * std::cos(phi) + sphit * std::sin(phi);
1188 if (dotprod > 0.99) {
1189 cos_phi += std::cos(phi);
1190 sin_phi += std::sin(phi);
1191 ++nphi;
1192 }
1193 }
1194 for (unsigned int i = 0; i < houghpattern2.size(); ++i) {
1195 double phi = houghpattern2.getPhi(i);
1196 double dotprod = cphit * std::cos(phi) + sphit * std::sin(phi);
1197 if (dotprod > 0.99) {
1198 bool accept = true;
1199 for (unsigned int j = 0; j < houghpattern1.size(); ++j) {
1200 if (houghpattern2.getPrd(i) == houghpattern1.getPrd(j)) accept = false;
1201 }
1202 if (accept) {
1203 cos_phi += std::cos(phi);
1204 sin_phi += std::sin(phi);
1205 ++nphi;
1206 }
1207 }
1208 }
1209 if (nphi < 2) return nullptr;
1210 cphit = cos_phi / nphi;
1211 sphit = sin_phi / nphi;
1212
1213 theta = 0;
1214 cos_phi = 0.;
1215 sin_phi = 0.;
1216 nphi = 0;
1217 for (unsigned int i = 0; i < houghpattern1.size(); ++i) {
1218 double phi = houghpattern1.getPhi(i);
1219 double thetah = houghpattern1.getTheta(i);
1220 double dotprod = cphit * std::cos(phi) + sphit * std::sin(phi);
1221 if (dotprod > 0.995) {
1222 cos_phi += std::cos(phi);
1223 sin_phi += std::sin(phi);
1224 theta += thetah;
1225 ++nphi;
1226 }
1227 }
1228 for (unsigned int i = 0; i < houghpattern2.size(); ++i) {
1229 double phi = houghpattern2.getPhi(i);
1230 double thetah = houghpattern2.getTheta(i);
1231 double dotprod = cphit * std::cos(phi) + sphit * std::sin(phi);
1232 if (dotprod > 0.995) {
1233 bool accept = true;
1234 for (unsigned int j = 0; j < houghpattern1.size(); ++j) {
1235 if (houghpattern2.getPrd(i) == houghpattern1.getPrd(j)) accept = false;
1236 }
1237 if (accept) {
1238 cos_phi += std::cos(phi);
1239 sin_phi += std::sin(phi);
1240 theta += thetah;
1241 ++nphi;
1242 }
1243 }
1244 }
1245 if (nphi < 2) return nullptr;
1246 cphit = cos_phi / nphi;
1247 sphit = sin_phi / nphi;
1248 theta = theta / nphi;
1249
1250 double r0 = 1.; // put 1 mm r0 value
1251 double x0 = r0 * sphit;
1252 double y0 = -r0 * cphit;
1253 double z0 = 0.;
1254
1255 const Amg::Vector3D pos{x0, y0, z0};
1256 const Amg::Vector3D dir{std::sin(theta) * cphit, std::sin(theta) * sphit, std::cos(theta)};
1257
1258 std::unique_ptr<Muon::MuonPrdPattern> muonpattern = std::make_unique<Muon::MuonPrdPattern>(pos, dir);
1259 nphi = 0;
1260
1261 for (unsigned int i = 0; i < houghpattern1.size(); ++i) {
1262 double phi = houghpattern1.getPhi(i);
1263 double dotprod = cphit * std::cos(phi) + sphit * std::sin(phi);
1264 if (dotprod > 0.995) {
1265 muonpattern->addPrd(houghpattern1.getPrd(i));
1266 ++nphi;
1267 ATH_MSG_VERBOSE("PrepRawData Merged Clean Phi Added " << phi);
1268 } else {
1269 ATH_MSG_VERBOSE("PrepRawData Merged Phi Dropped " << phi);
1270 }
1271 }
1272
1273 for (unsigned int i = 0; i < houghpattern2.size(); ++i) {
1274 double phi = houghpattern2.getPhi(i);
1275 double dotprod = cphit * std::cos(phi) + sphit * std::sin(phi);
1276 if (dotprod > 0.995) {
1277 bool accept = true;
1278 for (unsigned int j = 0; j < houghpattern1.size(); ++j) {
1279 if (houghpattern2.getPrd(i) == houghpattern1.getPrd(j)) accept = false;
1280 }
1281 if (accept) {
1282 muonpattern->addPrd(houghpattern2.getPrd(i));
1283 ++nphi;
1284 ATH_MSG_VERBOSE("PrepRawData Merged Clean Phi Added " << phi);
1285 } else {
1286 ATH_MSG_VERBOSE("PrepRawData Merged Phi Dropped " << phi);
1287 }
1288 } else {
1289 ATH_MSG_VERBOSE("PrepRawData Merged Phi Dropped " << phi);
1290 }
1291 }
1292
1293 ATH_MSG_VERBOSE("END Clean Merged Phi hits " << nphi);
1294
1295 return muonpattern;
1296}
double getPhi(unsigned int hitno) const
returns phi of hit hitno

◆ houghPatternToCleanPhiPattern()

std::unique_ptr< Muon::MuonPrdPattern > MuonHoughPatternTool::houghPatternToCleanPhiPattern ( MuonHoughPattern & houghpattern) const
private

converts hough pattern to EDM phi patterns and cleans it from outliers

IP constraint used, should not be used for cosmics!

Definition at line 1298 of file MuonHoughPatternTool.cxx.

1298 {
1300
1301 // TODO: rewrite with removing hits from patterns, instead of building up
1302
1303 ATH_MSG_DEBUG("houghPatternToCleanPhiPattern");
1304
1305 if (msgLevel(MSG::VERBOSE)) {
1306 for (unsigned int i = 0; i < houghpattern.size(); ++i) {
1307 const std::shared_ptr<MuonHoughHit> hit = houghpattern.getHit(i);
1308 ATH_MSG_VERBOSE(hit->getHitx() << " " << hit->getHity() << " " << hit->getHitz() << " " << hit->getPhi() << " "
1309 << hit->getMeasuresPhi() << " " << hit->getWhichDetector() << " " << hit->getWeight() << " "
1310 << hit->getAssociated());
1311 }
1312 }
1313
1314 double theta = houghpattern.getETheta();
1315 unsigned int size = houghpattern.size();
1316 double phi = houghpattern.getEPhi();
1317 double r0 = houghpattern.getERPhi();
1318
1319 ATH_MSG_DEBUG("Start Phi hits cleaning with " << size << " hits "
1320 << " theta " << theta);
1321 ATH_MSG_DEBUG("Start Phi: " << phi << " r0: " << r0);
1322 houghpattern.updateParametersRPhi();
1323 unsigned int newsize = houghpattern.size();
1324
1325 ATH_MSG_VERBOSE("size: " << newsize << " r0: " << r0 << " phi: " << phi);
1326
1327 CxxUtils::sincos scphi(phi);
1328
1329 const int number_of_iterations = 4;
1330 static constexpr std::array<double, number_of_iterations> cutvalues{1000., 500., 250., 125.};
1331
1332 const MuonHoughPattern* newpattern{&houghpattern};
1333 std::unique_ptr<MuonHoughPattern> pat_owner{};
1334 for (int it = 0; it < number_of_iterations; it++) {
1335 bool change = true;
1336 while (change) {
1337 ATH_MSG_VERBOSE("size: " << newsize << " r0: " << r0 << " phi: " << phi);
1338
1339 double max_dist = 0.;
1340 unsigned int max_i = UINT_MAX;
1341 for (unsigned int i = 0; i < newpattern->size(); ++i) {
1342 double dist = newpattern->getHitx(i) * scphi.sn - newpattern->getHity(i) * scphi.cs - r0;
1343 ATH_MSG_VERBOSE("Dist: " << dist);
1344 if (dist > max_dist) {
1345 max_dist = dist;
1346 max_i = i;
1347 }
1348 }
1349 if (max_dist < cutvalues[it]) {
1350 change = false;
1351 } else {
1352 std::unique_ptr<MuonHoughPattern> newpattern2 = std::make_unique<MuonHoughPattern>(MuonHough::hough_xy);
1353 for (unsigned int i = 0; i < newpattern->size(); ++i) {
1354 if (i != max_i) { newpattern2->addHit(newpattern->getHit(i)); }
1355 }
1356 newpattern2->updateParametersRPhi();
1357 phi = newpattern2->getEPhi();
1358 r0 = newpattern2->getERPhi();
1359 newsize = newpattern2->size();
1360 pat_owner = std::move(newpattern2);
1361 newpattern = pat_owner.get();
1362 scphi = CxxUtils::sincos(phi);
1363 }
1364 }
1365 }
1366
1367 ATH_MSG_DEBUG("Final size: " << newsize << " r0: " << r0 << " phi: " << phi);
1368
1369 double thetanew = 0.;
1370 for (unsigned int i = 0; i < newpattern->size(); ++i) {
1371 double thetah = newpattern->getTheta(i);
1372 thetanew += thetah;
1373 }
1374
1375 thetanew = thetanew / (newpattern->size() + 1e-7);
1376
1377 double r0_new = 1.; // put 1 mm r0 value
1378 double x0_new = r0_new * scphi.sn;
1379 double y0_new = -r0_new * scphi.cs;
1380 double z0_new = 0.;
1381
1382 CxxUtils::sincos sctheta(thetanew);
1383
1384 const Amg::Vector3D pos = Amg::Vector3D(x0_new, y0_new, z0_new);
1385 const Amg::Vector3D dir = Amg::Vector3D(sctheta.sn * scphi.cs, sctheta.sn * scphi.sn, sctheta.cs);
1386
1387 std::unique_ptr<Muon::MuonPrdPattern> muonpattern = std::make_unique<Muon::MuonPrdPattern>(pos, dir);
1388
1389 for (unsigned int i = 0; i < newpattern->size(); ++i) { muonpattern->addPrd(newpattern->getPrd(i)); }
1390
1391 ATH_MSG_DEBUG("END Clean Phi hits " << newsize << " theta " << thetanew);
1392
1393 ATH_MSG_VERBOSE("cleaned pattern: ");
1394 if (msgLvl(MSG::VERBOSE)) { printPattern(muonpattern.get()); }
1395 return muonpattern;
1396}
double getHitx(unsigned int hitno) const
returns x position of hit hitno
double getHity(unsigned int hitno) const
returns y position of hit hitno
std::shared_ptr< MuonHoughHit > getHit(int hitno) const
returns Hit at position hitno
void updateParametersRPhi(bool cosmics=false)
update parameters in rphi plane based on weighted fit

◆ houghPatternToEtaPattern()

std::unique_ptr< Muon::MuonPrdPattern > MuonHoughPatternTool::houghPatternToEtaPattern ( const MuonHoughPattern & houghpattern) const
private

converts hough pattern to EDM eta patterns

Definition at line 976 of file MuonHoughPatternTool.cxx.

976 {
977 ATH_MSG_VERBOSE("houghPatternToEtaPattern");
978
979 const Amg::Vector3D position = houghpattern.getEPos();
980 const Amg::Vector3D direction = houghpattern.getEDir();
981
982 double curvature = houghpattern.getECurvature();
983 double charge = curvature < 0 ? -1 : 1.;
984 double pscale = std::abs(curvature);
985
986 const double r0 = m_use_cosmics ? houghpattern.getERPhi() : 0.001;
987
988 double x0 = charge * r0 * std::sin(houghpattern.getEPhi());
989 double y0 = -charge * r0 * std::cos(houghpattern.getEPhi());
990
991 const Amg::Vector3D pos = Amg::Vector3D(x0, y0, position[2]);
992 const Amg::Vector3D dir = Amg::Vector3D(pscale * direction[0], pscale * direction[1], pscale * direction[2]);
993
994 ATH_MSG_DEBUG("position: " << x0 << " " << y0 << " " << position[2]);
995 ATH_MSG_DEBUG("direction: " << direction[0] << " " << direction[1] << " " << direction[2]);
996
997 ATH_MSG_DEBUG(" Lift Eta Hough Pattern with charge " << charge << " Curvature " << pscale);
998 std::unique_ptr<Muon::MuonPrdPattern> muonpattern = std::make_unique<Muon::MuonPrdPattern>(pos, dir);
999
1000 for (unsigned int i = 0; i < houghpattern.size(); ++i) { muonpattern->addPrd(houghpattern.getPrd(i)); }
1001
1002 return muonpattern;
1003}
Amg::Vector3D getEDir() const
calculates direction at point closest to ip

◆ houghPatternToPhiPattern()

std::unique_ptr< Muon::MuonPrdPattern > MuonHoughPatternTool::houghPatternToPhiPattern ( const MuonHoughPattern & houghpattern) const
private

converts hough pattern to EDM phi patterns

Definition at line 1004 of file MuonHoughPatternTool.cxx.

1004 {
1005 ATH_MSG_VERBOSE("houghPatternToPhiPattern");
1006
1007 const Amg::Vector3D pos = houghpattern.getEPos();
1008 const Amg::Vector3D dir = houghpattern.getEDir();
1009
1010 ATH_MSG_DEBUG("position: " << pos[0] << " " << pos[1] << " " << pos[2]);
1011 ATH_MSG_DEBUG("direction: " << dir[0] << " " << dir[1] << " " << dir[2]);
1012 std::unique_ptr<Muon::MuonPrdPattern> muonpattern = std::make_unique<Muon::MuonPrdPattern>(pos, dir);
1013
1014 for (unsigned int i = 0; i < houghpattern.size(); ++i) {
1015 muonpattern->addPrd(houghpattern.getPrd(i));
1016
1017 ATH_MSG_VERBOSE("PrepRawData Added " << houghpattern.getPrd(i));
1018 }
1019
1020 return muonpattern;
1021}

◆ initialize()

StatusCode MuonHoughPatternTool::initialize ( )
overridevirtual

initiates private members

Definition at line 152 of file MuonHoughPatternTool.cxx.

152 {
153 if (m_use_histos) // debug histos
154 {
155 m_file = std::make_unique<TFile>("HoughPattern.root", "RECREATE");
156 }
157
158 ATH_MSG_DEBUG("Use Cosmic Settings: " << m_use_cosmics);
159
160 if (!m_use_cosmics) {
161 // change histogram sizes:
162 useIPMuons();
163 }
164
165 else {
168 // only 1 maximum search (number of sectors ==1):
170 // no curved hough for cosmics (muons assumed from ip):
171 m_use_curvedhough = false;
172 }
173
174 ATH_MSG_VERBOSE("Thresholds for histo: xyz: " << m_thresholdhisto_xyz << " rz: " << m_thresholdhisto_rz);
175
176 ATH_MSG_VERBOSE("Thresholds for pattern: xyz: " << m_thresholdpattern_xyz << " rz: " << m_thresholdpattern_rz);
177
178 ATH_MSG_DEBUG("Number of iterations: " << m_maximum_level << " Maxima per iteration: " << m_number_of_maxima);
179
180 return StatusCode::SUCCESS;
181}
Gaudi::Property< int > m_number_of_sectors_rz
number of sectors (different regions in which patterns can be found in the same iteration) in rz
void useIPMuons()
reduces Detector sizes for Hough Histograms to find patterns from muons from the Interaction Point (d...
Gaudi::Property< int > m_number_of_sectors_xyz
number of sectors (different regions in which patterns can be found in the same iteration) in xyz

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ makePatterns() [1/2]

void MuonHoughPatternTool::makePatterns ( const MuonHoughHitContainer & hitcontainer,
MuonHoughPatternContainerShip & houghpatterns ) const
overridevirtual

method that builds the patterns

skip cosmic events that have more than 1000 phi hits

value of mdt weight cut, dependent on # hits in event

Implements IMuonHoughPatternTool.

Definition at line 40 of file MuonHoughPatternTool.cxx.

40 {
43 int phihits{0};
44 for (unsigned int hitid = 0; hitid < hitcontainer.size(); ++hitid) { phihits += hitcontainer.getMeasuresPhi(hitid); }
45 if (phihits > m_maxNumberOfPhiHits) {
46 ATH_MSG_DEBUG("Cosmic event has more than 1000 phi hits: " << phihits << " event is not reconstructed!");
47 return;
48 }
49 }
50
52 double weightmdt{0.};
53 if (m_weightcutmdt) { setWeightMdtCutValue(hitcontainer, weightmdt); }
54
55 ATH_MSG_DEBUG("Mdt Cut Value: " << weightmdt);
56
57 // reset weights, based on rejection factor and weightmdt
58 calculateWeights(hitcontainer, weightmdt);
59
60 if (msgLevel(MSG::VERBOSE)) {
61 ATH_MSG_VERBOSE("Event Info");
62 ATH_MSG_VERBOSE("Size: " << hitcontainer.size());
63
64 for (unsigned int i = 0; i < hitcontainer.size(); ++i) {
65 const std::shared_ptr<MuonHoughHit> hit = hitcontainer.getHit(i);
66 ATH_MSG_VERBOSE(hit->getHitx() << " " << hit->getHity() << " " << hit->getHitz() << " " << hit->getMeasuresPhi() << " "
67 << hit->getWhichDetector() << " " << hit->getProbability() << " " << hit->getWeight() << " "
68 << hit->getAssociated());
69 }
70 }
71 makePatterns(MuonHough::hough_xy, weightmdt, hitcontainer, houghpattern);
72
73 if (m_use_cosmics) {
74 makePatterns(MuonHough::hough_rzcosmics, weightmdt, hitcontainer, houghpattern);
75 } else if (m_use_curvedhough) {
76 makePatterns(MuonHough::hough_curved_at_a_cylinder, weightmdt, hitcontainer, houghpattern);
77 } else {
78 makePatterns(MuonHough::hough_rz, weightmdt, hitcontainer, houghpattern);
79 }
80
81 ATH_MSG_VERBOSE("End makePatterns ");
82}
bool getMeasuresPhi(unsigned int hitno) const
returns if hit hitno measures phi
Gaudi::Property< int > m_maxNumberOfPhiHits
maximum number of phi hits to do pattern recognition, if small zero no cut is applied
virtual void makePatterns(const MuonHoughHitContainer &hitcontainer, MuonHoughPatternContainerShip &houghpatterns) const override
method that builds the patterns
void setWeightMdtCutValue(const MuonHoughHitContainer &event, double &weightmdt) const
calculates the mdt weight cut value
void calculateWeights(const MuonHoughHitContainer &event, double weightmdt) const
calculates new weights based on rejection factor (1-origweight) and number of hits in event,...

◆ makePatterns() [2/2]

void MuonHoughPatternTool::makePatterns ( int id_number,
double weightmdt,
const MuonHoughHitContainer & event,
MuonHoughPatternContainerShip & houghpatterns ) const
private

method that builds the patterns

Definition at line 84 of file MuonHoughPatternTool.cxx.

85 {
86 ATH_MSG_DEBUG("makePatterns");
87
88 resetAssociation(event); // resets association, for hits that are already assigned to pattern in a previous hough
89
90 std::unique_ptr<MuonHoughHitContainer> event_for_hough{whichEventHough(id_number, event, weightmdt)};
91 std::unique_ptr<MuonHoughHitContainer> event_for_association{whichEventAssociation(id_number, event)};
92
93 if (msgLevel(MSG::VERBOSE)) {
94 ATH_MSG_VERBOSE("Size event fill: " << event_for_hough->size());
95 for (unsigned int i = 0; i < event_for_hough->size(); ++i) {
96 const std::shared_ptr<MuonHoughHit> hit = event_for_hough->getHit(i);
97 ATH_MSG_VERBOSE(hit->getHitx() << " " << hit->getHity() << " " << hit->getHitz() << " " << hit->getMeasuresPhi() << " "
98 << hit->getWhichDetector() << " " << hit->getProbability() << " " << hit->getWeight() << " "
99 << hit->getAssociated());
100 }
101
102 ATH_MSG_VERBOSE("Size event association: " << event_for_association->size());
103 for (unsigned int i = 0; i < event_for_association->size(); ++i) {
104 const std::shared_ptr<MuonHoughHit> hit = event_for_association->getHit(i);
105 ATH_MSG_VERBOSE(hit->getHitx() << " " << hit->getHity() << " " << hit->getHitz() << " " << hit->getMeasuresPhi() << " "
106 << hit->getWhichDetector() << " " << hit->getProbability() << " " << hit->getWeight() << " "
107 << hit->getAssociated());
108 }
109
110 ATH_MSG_DEBUG("size of event: " << event_for_association->size() << " id_number: " << id_number);
111 }
112 std::unique_ptr<MuonHoughTransformSteering> houghtransform{whichHoughTransform(id_number)}; // const?
113
114 ATH_MSG_DEBUG("HoughTransform chosen");
115
116 bool test_for_next_level = true;
117
118 for (int level = 0; level < m_maximum_level; level++) {
119 if (test_for_next_level) {
120 ATH_MSG_DEBUG("Iteration number: " << level);
121
122 houghtransform->resetHisto();
123 ATH_MSG_DEBUG("fillHistos size hits not in patterns " << event_for_hough->size());
124 houghtransform->fill(*event_for_hough);
125
126 if (m_use_histos && level == 0 && id_number == MuonHough::hough_curved_at_a_cylinder) {
127 const MuonHoughHisto2DContainer& histos = houghtransform->histos();
128 TDirectory* dir = gDirectory;
129 m_file->cd();
130 for (int i = 0; i < histos.size(); ++i) {
131 const std::string hname = "hough_call_" + std::to_string(m_ncalls) + "_hist_" + std::to_string(i);
132 histos.getHisto(i)->bookAndFillRootHistogram(hname)->Write();
133 }
134 gDirectory = dir;
135 ++m_ncalls;
136 }
137
138 // hitcontainer for association not updated
139 test_for_next_level = analyseHisto(id_number, level, event_for_association, houghtransform, houghpattern);
140
141 if (test_for_next_level) {
142 event_for_hough = whichEventHough(id_number, *event_for_hough, weightmdt);
143 ATH_MSG_DEBUG("New event size for transform: " << event_for_hough->size());
144 }
145 } else {
146 break;
147 }
148 }
149
150} // id_number
std::unique_ptr< MuonHoughHitContainer > whichEventHough(int id, const MuonHoughHitContainer &event, double weightmdt) const
selects the hitcontainer to be used for filling the histograms
std::unique_ptr< MuonHoughHitContainer > whichEventAssociation(int id, const MuonHoughHitContainer &event) const
selects the hitcontainer to be used to associate to the maxima
bool analyseHisto(int id_number, int level, const std::unique_ptr< MuonHoughHitContainer > &event_to_analyse, std::unique_ptr< MuonHoughTransformSteering > &houghtransform, MuonHoughPatternContainerShip &houghpatterns) const
analyses the hough histograms
std::unique_ptr< MuonHoughTransformSteering > whichHoughTransform(int id) const
returns the Houghtransform for the id
static void resetAssociation(const MuonHoughHitContainer &event)
reset association flag of hits in m_event

◆ maxLevelHoughPattern() [1/2]

std::vector< int > MuonHoughPatternTool::maxLevelHoughPattern ( const MuonHoughPatternContainerShip & houghpattern) const
private

returns the maximum iteration, not in use

Definition at line 629 of file MuonHoughPatternTool.cxx.

630{
631 std::vector<int> maxlevel_houghpattern(m_number_of_ids);
632
633 for (int id_number = 0; id_number < m_number_of_ids; id_number++) {
634 maxlevel_houghpattern[id_number] = maxLevelHoughPattern(houghpattern, id_number);
635 } // number_of_ids
636 return maxlevel_houghpattern;
637}
std::vector< int > maxLevelHoughPattern(const MuonHoughPatternContainerShip &houghpattern) const
returns the maximum iteration, not in use

◆ maxLevelHoughPattern() [2/2]

int MuonHoughPatternTool::maxLevelHoughPattern ( const MuonHoughPatternContainerShip & houghpattern,
int id_number ) const
private

returns the maximum iteration, not in use

Todo
should be in houghpattern?

Definition at line 639 of file MuonHoughPatternTool.cxx.

639 {
640 int maxlevel = houghpattern[id_number].size();
641 bool continu = true;
642 while (maxlevel >= 1 && continu == 1) {
643 unsigned int maximum_number = 0;
644
645 while (continu && maximum_number < houghpattern[id_number][maxlevel - 1].size()) // m_number_of_maxima)
646 {
647 ATH_MSG_DEBUG("maximum_number: " << maximum_number << " "
648 << "maxlevel_houghpattern: " << maxlevel << " id: " << id_number);
649 if (!houghpattern[id_number][maxlevel - 1][maximum_number]->empty()) { continu = false; }
650
651 ++maximum_number;
652
653 } // number_of_maxima
654
655 if (continu) { maxlevel--; }
656 } // while
657 return maxlevel;
658} // maxLevelHoughPattern

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ numberOfHits()

int MuonHoughPatternTool::numberOfHits ( const MuonHoughHitContainer & event) const
private

returns number of hits left (unused)

Definition at line 295 of file MuonHoughPatternTool.cxx.

295 {
296 int number_of_hits_left = 0;
297 int number_of_hits = event.size();
298
299 for (int hitid = 0; hitid < number_of_hits; ++hitid) { number_of_hits_left += !event.getHit(hitid)->getAssociated(); }
300
301 // logically impossible --- if (number_of_hits_left <0) {ATH_MSG_WARNING("number of hits smaller than 0");}
302
303 ATH_MSG_VERBOSE("numberOfHits left: " << number_of_hits_left);
304 ATH_MSG_VERBOSE("number_of_hits: " << number_of_hits);
305 return number_of_hits_left;
306}

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ overlapHoughPatterns()

int MuonHoughPatternTool::overlapHoughPatterns ( const MuonHoughPattern & houghpattern1,
const MuonHoughPattern & houghpattern2 ) const
private

returns number of hits that are in both hough patterns

Definition at line 400 of file MuonHoughPatternTool.cxx.

400 {
401 // both vectors houghpatterns->m_hitid[] are ordered, asked is the percentage of overlap between both vectors
402
403 int overlap = 0;
404 unsigned int j = 0;
405
406 for (unsigned int i = 0; i < houghpattern1.size(); ++i) {
407 while (j < houghpattern2.size()) {
408 if (houghpattern1.getHitId(i) == houghpattern2.getHitId(j)) {
409 ++overlap;
410 ++j; // this j cant be found again
411 break;
412 }
413 if (houghpattern1.getHitId(i) < houghpattern2.getHitId(j)) { break; }
414 ++j;
415 }
416 }
417 double percentage1 = (1.0 * overlap) / houghpattern1.size(); // size() gives double
418 double percentage2 = (1.0 * overlap) / houghpattern2.size();
419
420 ATH_MSG_DEBUG("Percentage Overlap: " << percentage1 << " " << percentage2);
421 return overlap;
422}
int getHitId(unsigned int hitno) const
returns hitid of hit hitno

◆ printPattern()

void MuonHoughPatternTool::printPattern ( Muon::MuonPrdPattern * muonpattern) const
private

print out pattern hits

Definition at line 1450 of file MuonHoughPatternTool.cxx.

1450 {
1451 if (!muonpattern) {
1452 ATH_MSG_VERBOSE("Printout of Pattern: nullptr");
1453 return;
1454 }
1455 ATH_MSG_VERBOSE("Printout of Pattern: ");
1456 for (unsigned int k = 0; k < muonpattern->numberOfContainedPrds(); k++) {
1457 const Trk::PrepRawData* prd = muonpattern->prd(k);
1458 const Muon::MdtPrepData* mdtprd = dynamic_cast<const Muon::MdtPrepData*>(prd);
1459 if (mdtprd) {
1460 const Trk::Surface& surface = mdtprd->detectorElement()->surface(mdtprd->identify());
1461 const Amg::Vector3D& gpos = surface.center();
1462 ATH_MSG_VERBOSE("mdt " << k << " x: " << gpos.x() << " y: " << gpos.y() << " z: " << gpos.z());
1463 } else if (!mdtprd) {
1464 const Muon::MuonCluster* muoncluster = dynamic_cast<const Muon::MuonCluster*>(prd);
1465 if (muoncluster) {
1466 const Amg::Vector3D& gpos = muoncluster->globalPosition();
1467 ATH_MSG_VERBOSE("cluster " << k << " x: " << gpos.x() << " y: " << gpos.y() << " z: " << gpos.z());
1468 }
1469 if (!muoncluster) { ATH_MSG_DEBUG("no muon prd? "); }
1470 }
1471 }
1472}
virtual const Trk::Surface & surface() const override final
Return surface associated with this detector element.
virtual const MuonGM::MdtReadoutElement * detectorElement() const override
Returns the detector element corresponding to this PRD.
virtual const Amg::Vector3D & globalPosition() const =0
Returns the global position of the measurement (calculated on the fly)
virtual unsigned int numberOfContainedPrds() const
Number or PrepRawData contained by this Pattern.
virtual const Trk::PrepRawData * prd(unsigned int index) const
returns the PrepRawData objects depending on the integer, return zero if index out of range
Identifier identify() const
return the identifier
const Amg::Vector3D & center() const
Returns the center position of the Surface.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ resetAssociation()

void MuonHoughPatternTool::resetAssociation ( const MuonHoughHitContainer & event)
staticprivate

reset association flag of hits in m_event

Definition at line 183 of file MuonHoughPatternTool.cxx.

183 {
184 for (unsigned int i = 0; i < event.size(); ++i) {
185 std::shared_ptr<MuonHoughHit> hit = event.getHit(i);
186 hit->setAssociated(false);
187 hit->setId(-1); // ugly, to be changed?
188 }
189}

◆ setWeightMdtCutValue()

void MuonHoughPatternTool::setWeightMdtCutValue ( const MuonHoughHitContainer & event,
double & weightmdt ) const
private

calculates the mdt weight cut value

Definition at line 1436 of file MuonHoughPatternTool.cxx.

1436 {
1437 if (m_use_cosmics) {
1438 weightmdt = 0.;
1439 return;
1440 }
1441 int mdthits = event.getMDThitno(); // slow function!
1442 weightmdt = mdthits > 0. ? 1. - 5. / std::sqrt(mdthits) : 0.;
1443}

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ transformCoordsMaximum()

void MuonHoughPatternTool::transformCoordsMaximum ( std::pair< double, double > & coordsmaximum,
double r0_true )
staticprivate

corrects the maximum of the histogram with a factor (not in use anymore, used for old rz transform)

Definition at line 660 of file MuonHoughPatternTool.cxx.

660 {
661 double z_true = coordsmaximum.first;
662 double theta_true = coordsmaximum.second;
663
664 // double theta_cor = - 0.042*(r0_true/4000.)*(r0_true/4000);
665 double theta_cor = m_theta_cor_constant * (r0_true / m_theta_cor_constant2) * (r0_true / m_theta_cor_constant2);
666
667 // double z_cor = - 10000 * (std::cos(theta_true) * r0_true/6000.) * (std::cos(theta_true)*r0_true/6000.);
668 double z_cor =
669 m_z_cor_constant * (std::cos(theta_true) * r0_true / m_z_cor_constant2) * (std::cos(theta_true) * r0_true / m_z_cor_constant2);
670
671 double z_rec = z_true + z_cor;
672 double theta_rec = theta_true + theta_cor;
673
674 if (std::cos(theta_true) < 0) {
675 z_rec = z_true - z_cor;
676 theta_rec = theta_true - theta_cor;
677 }
678
679 coordsmaximum.first = z_rec;
680 coordsmaximum.second = theta_rec;
681} // transformCoordsMaximum
static constexpr double m_theta_cor_constant
constant 1 for theta for hough correction
static constexpr double m_z_cor_constant
use hough correction to correct the maximum found in rz-plane slightly as there is a bias in the houg...
static constexpr double m_theta_cor_constant2
constant 2 for theta for hough correction
static constexpr double m_z_cor_constant2
constant 2 for z for hough correction

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

◆ useIPMuons()

void MuonHoughPatternTool::useIPMuons ( )
private

reduces Detector sizes for Hough Histograms to find patterns from muons from the Interaction Point (default on)

Definition at line 33 of file MuonHoughPatternTool.cxx.

33 {
37 m_use_ip = true;
38}
static constexpr double m_detectorsize_yz_ip
acceptancy of patterns for ip in yz (not used) in mm
static constexpr double m_detectorsize_rz_ip
acceptancy of patterns for ip in rz (eta) in mm
static constexpr double m_detectorsize_xy_ip
acceptancy of patterns for ip in xy (phi) in mm

◆ weightRescaling()

void MuonHoughPatternTool::weightRescaling ( const MuonHoughHitContainer & event,
int id_number,
int level ) const
private

rescales hits per iteration to reduce number of patterns when already some have been found

Definition at line 324 of file MuonHoughPatternTool.cxx.

324 {
325 double weight_trigger_hits = 1.;
326 double weight_mdt_hits = 1.;
327
328 switch (id_number) {
331 weight_trigger_hits = 1 - (level - 1) * (1. / (m_maximum_level + 0.0)); // 1 , 1, 0.8, 0.6 , 0.4
332 if (weight_trigger_hits > 1) weight_trigger_hits = 1.;
333 weight_mdt_hits = weight_trigger_hits;
334 break;
340 switch (level) {
341 case 0:
342 weight_trigger_hits = 1.;
343 weight_mdt_hits = 1.;
344 break;
345 case 1:
346 weight_trigger_hits = 1.;
347 weight_mdt_hits = 1.;
348 break;
349 case 2:
350 weight_trigger_hits = 1.;
351 weight_mdt_hits = 0.75;
352 break;
353 case 3:
354 weight_trigger_hits = 0.75;
355 weight_mdt_hits = 0.5;
356 break;
357 case 4:
358 weight_trigger_hits = 0.5;
359 weight_mdt_hits = 0.25;
360 break;
361 default:
362 ATH_MSG_DEBUG("no weight defined for this level");
363 weight_trigger_hits = 0.5;
364 weight_mdt_hits = 0.25;
365 }
366 break;
367 default: ATH_MSG_WARNING("no valid id (id_number)");
368 }
369
370 for (unsigned int i = 0; i < event.size(); ++i) {
371 std::shared_ptr<MuonHoughHit> hit = event.getHit(i);
372 MuonHough::DetectorTechnology technology = hit->getDetectorId();
373 switch (technology) {
374 case MuonHough::CSC:
375 case MuonHough::RPC:
376 case MuonHough::TGC: hit->setWeight(hit->getOrigWeight() * weight_trigger_hits); break;
377 case MuonHough::MDT: hit->setWeight(hit->getOrigWeight() * weight_mdt_hits); break;
378 default: ATH_MSG_WARNING("no valid detector technology");
379 }
380 }
381}

◆ whichEventAssociation()

std::unique_ptr< MuonHoughHitContainer > MuonHoughPatternTool::whichEventAssociation ( int id,
const MuonHoughHitContainer & event ) const
private

selects the hitcontainer to be used to associate to the maxima

Definition at line 424 of file MuonHoughPatternTool.cxx.

425 {
426 std::unique_ptr<MuonHoughHitContainer> event_to_analyse = std::make_unique<MuonHoughHitContainer>();
427
428 switch (id_number) {
430
431 for (unsigned int hitid = 0; hitid < event.size(); ++hitid) {
432 std::shared_ptr<MuonHoughHit> hit = event.getHit(hitid);
433 if (hit->getMeasuresPhi()) {
434 if (m_use_csc_in_pattern || (!m_use_csc_in_pattern && hit->getDetectorId() != MuonHough::CSC)) {
435 event_to_analyse->addHit(hit);
436 }
437 }
438 }
439 break;
441 for (unsigned int hitid = 0; hitid < event.size(); ++hitid) {
442 std::shared_ptr<MuonHoughHit> hit = event.getHit(hitid);
443 event_to_analyse->addHit(hit);
444 }
445 break;
449 for (unsigned int hitid = 0; hitid < event.size(); ++hitid) {
450 std::shared_ptr<MuonHoughHit> hit = event.getHit(hitid);
451 if (!hit->getMeasuresPhi()) {
452 if (m_use_csc_in_pattern || (!m_use_csc_in_pattern && hit->getDetectorId() != MuonHough::CSC)) {
453 event_to_analyse->addHit(hit);
454 }
455 }
456 }
457 break;
459 if (m_use_rpc_measures_eta == 1) {
460 for (unsigned int hitid = 0; hitid < event.size(); ++hitid) {
461 std::shared_ptr<MuonHoughHit> hit = event.getHit(hitid);
462 if (hit->getDetectorId() == MuonHough::RPC) {
463 if (!hit->getMeasuresPhi()) { event_to_analyse->addHit(hit); }
464 }
465 }
466 } else {
467 for (unsigned int hitid = 0; hitid < event.size(); ++hitid) {
468 std::shared_ptr<MuonHoughHit> hit = event.getHit(hitid);
469 if (hit->getDetectorId() == MuonHough::RPC) { event_to_analyse->addHit(hit); }
470 }
471 }
472 break;
474 for (unsigned int hitid = 0; hitid < event.size(); ++hitid) {
475 std::shared_ptr<MuonHoughHit> hit = event.getHit(hitid);
476 if (hit->getDetectorId() == MuonHough::MDT) { event_to_analyse->addHit(hit); }
477 }
478 break;
479 default: ATH_MSG_WARNING(" no valid id");
480 }
481
482 return event_to_analyse;
483}
Gaudi::Property< bool > m_use_csc_in_pattern
use csc hits in association / pattern (true)
static constexpr bool m_use_rpc_measures_eta
use rpc phi strips in phi-patterns (true)

◆ whichEventHough()

std::unique_ptr< MuonHoughHitContainer > MuonHoughPatternTool::whichEventHough ( int id,
const MuonHoughHitContainer & event,
double weightmdt ) const
private

selects the hitcontainer to be used for filling the histograms

Definition at line 485 of file MuonHoughPatternTool.cxx.

486 {
487 ATH_MSG_DEBUG("whichEventHough::size of event: " << event.size());
488 std::unique_ptr<MuonHoughHitContainer> hits_not_in_patterns{hitsNotInPattern(event, id_number)};
489 ATH_MSG_DEBUG("whichEventHough::hitsNotInPattern: " << hits_not_in_patterns->size());
490 std::unique_ptr<MuonHoughHitContainer> event_to_analyse = std::make_unique<MuonHoughHitContainer>();
491
492 switch (id_number) {
494
495 for (unsigned int hitid = 0; hitid < hits_not_in_patterns->size(); ++hitid) {
496 std::shared_ptr<MuonHoughHit> hit = hits_not_in_patterns->getHit(hitid);
497 if (hit->getMeasuresPhi() == 1) {
498 if (hitThroughCut(hit, weightmdt)) {
499 if (m_use_csc_in_hough || (!m_use_csc_in_hough && hit->getDetectorId() == MuonHough::CSC)) {
500 event_to_analyse->addHit(hit);
501 }
502 }
503 }
504 }
505 break;
507 for (unsigned int hitid = 0; hitid < hits_not_in_patterns->size(); ++hitid) {
508 std::shared_ptr<MuonHoughHit> hit = hits_not_in_patterns->getHit(hitid);
509 if (hitThroughCut(hit, weightmdt)) { event_to_analyse->addHit(hit); }
510 }
511 break;
515 for (unsigned int hitid = 0; hitid < hits_not_in_patterns->size(); ++hitid) {
516 std::shared_ptr<MuonHoughHit> hit = hits_not_in_patterns->getHit(hitid);
517 if (hitThroughCut(hit, weightmdt)) {
518 if (hit->getMeasuresPhi() == 0) {
519 if (m_use_csc_in_hough || (!m_use_csc_in_hough && hit->getDetectorId() == MuonHough::CSC)) {
520 event_to_analyse->addHit(hit);
521 }
522 }
523 }
524 }
525 break;
527 if (m_use_rpc_measures_eta == 1) {
528 for (unsigned int hitid = 0; hitid < hits_not_in_patterns->size(); ++hitid) {
529 if (hits_not_in_patterns->getDetectorId(hitid) == MuonHough::RPC) {
530 std::shared_ptr<MuonHoughHit> hit = hits_not_in_patterns->getHit(hitid);
531 if (hit->getMeasuresPhi() == 0) { event_to_analyse->addHit(hit); }
532 }
533 }
534 } else {
535 for (unsigned int hitid = 0; hitid < hits_not_in_patterns->size(); ++hitid) {
536 if (hits_not_in_patterns->getDetectorId(hitid) == MuonHough::RPC) {
537 std::shared_ptr<MuonHoughHit> hit = hits_not_in_patterns->getHit(hitid);
538 event_to_analyse->addHit(hit);
539 }
540 }
541 }
542 break;
544 for (unsigned int hitid = 0; hitid < hits_not_in_patterns->size(); ++hitid) {
545 if (hits_not_in_patterns->getDetectorId(hitid) == MuonHough::MDT) {
546 std::shared_ptr<MuonHoughHit> hit = hits_not_in_patterns->getHit(hitid);
547 if (hitThroughCut(hit, weightmdt)) { event_to_analyse->addHit(hit); }
548 }
549 }
550 break;
551 default: ATH_MSG_WARNING(" no valid id");
552 }
553
554 return event_to_analyse;
555}
bool hitThroughCut(const std::shared_ptr< MuonHoughHit > &hit, double weightmdt) const
hit through weight cut?
Gaudi::Property< bool > m_use_csc_in_hough
use csc hits in histogram (false)
static std::unique_ptr< MuonHoughHitContainer > hitsNotInPattern(const MuonHoughHitContainer &event, int id_number)
returns a hitcontainer with hits not yet used in pattern

◆ whichHoughTransform()

std::unique_ptr< MuonHoughTransformSteering > MuonHoughPatternTool::whichHoughTransform ( int id) const
private

returns the Houghtransform for the id

Definition at line 557 of file MuonHoughPatternTool.cxx.

557 {
558 std::unique_ptr<MuonHoughTransformer> houghtransformer;
559
560 int nbins = 0;
561 int nbins_angle = 0;
562 double detectorsize_angle_xy = m_detectorsize_angle_xyz;
563 double stepsize_per_angle_xy = m_stepsize_per_angle_xyz;
564 double detectorsize_curved = m_nbins_curved / 2.;
565 double stepsize_xy = m_stepsize_xy;
566 // additional histograms for overlaps:
567 int number_of_histos_rz = 2 * m_number_of_sectors_rz;
568
569 switch (id_number) {
571 if (m_use_cosmics) {
572 stepsize_xy = m_stepsize_xy_cosmics;
573 stepsize_per_angle_xy = m_stepsize_per_angle_xy_cosmics;
574 detectorsize_angle_xy = (m_detectorsize_angle_xyz / 2.); // patterns not split for cosmics
575 }
576 nbins = static_cast<int>(2 * m_detectorsize_xy / stepsize_xy);
577 nbins_angle = static_cast<int>(detectorsize_angle_xy / stepsize_per_angle_xy);
578 houghtransformer = std::make_unique<MuonHoughTransformer_xy>(nbins, nbins_angle, m_detectorsize_xy, detectorsize_angle_xy,
580 break;
581
583 nbins = static_cast<int>(2 * m_detectorsize_yz / m_stepsize_yz);
584 nbins_angle = static_cast<int>(m_detectorsize_angle_xyz / m_stepsize_per_angle_xyz);
585 houghtransformer = std::make_unique<MuonHoughTransformer_yz>(nbins, nbins_angle, m_detectorsize_yz, m_detectorsize_angle_xyz,
587 break;
588
592 nbins = static_cast<int>(2 * m_detectorsize_rz / m_stepsize_rz);
593 nbins_angle = static_cast<int>(m_detectorsize_angle_rz / m_stepsize_per_angle_rz);
594 houghtransformer = std::make_unique<MuonHoughTransformer_rz>(nbins, nbins_angle, m_detectorsize_rz, m_detectorsize_angle_rz,
596 break;
597
599 nbins = static_cast<int>(2 * m_detectorsize_rz / m_stepsize_rz_cosmics);
600 nbins_angle = static_cast<int>(m_detectorsize_angle_rz / m_stepsize_per_angle_rz_cosmics);
601 houghtransformer = std::make_unique<MuonHoughTransformer_rzcosmics>(
603 break;
604
607 nbins_angle = static_cast<int>(m_detectorsize_angle_rz / (2 * m_stepsize_per_angle_rz));
608 houghtransformer = std::make_unique<MuonHoughTransformer_CurvedAtACylinder>(
609 nbins, nbins_angle, detectorsize_curved, m_detectorsize_angle_rz, m_thresholdhisto_rz, number_of_histos_rz);
610 break;
611
612 default: ATH_MSG_WARNING("no valid id");
613 }
614
615 if (houghtransformer) {
616 houghtransformer->useNegativeWeights(m_use_negative_weights);
617 houghtransformer->setIP(!m_use_cosmics);
618 }
619
620 ATH_MSG_DEBUG("**** histo houghtransformer: ****");
621 ATH_MSG_DEBUG("Id number: " << id_number);
622 ATH_MSG_DEBUG("NBins: " << nbins << " angle: " << nbins_angle);
623 if (m_use_negative_weights) ATH_MSG_DEBUG(" Negative weights are used ");
624 ATH_MSG_DEBUG("IP setting: " << !m_use_cosmics);
625 ATH_MSG_DEBUG("*********************************");
626 return std::make_unique<MuonHoughTransformSteering>(std::move(houghtransformer));
627}
static constexpr double m_stepsize_rz_cosmics
bin width for rzcosmics
static constexpr double m_stepsize_yz
bin width for yz
static constexpr double m_stepsize_per_angle_xyz
bin width for angle in xyz
static constexpr double m_stepsize_per_angle_rz_cosmics
bin width for angle in rzcosmics
int m_number_of_sectors_rz_cosmics
number of sectors (different regions in which patterns can be found in the same iteration) in rzcosmi...
static constexpr double m_detectorsize_angle_rz
max range of angle in rz in degrees (180)
static constexpr double m_stepsize_per_angle_xy_cosmics
bin width for angle in xy cosmics
static constexpr double m_detectorsize_angle_xyz
max range of angle in xyz in degrees (360)
static constexpr int m_nbins_curved
bin width for 1/sqrt(curvature)
static constexpr double m_stepsize_per_angle_rz
bin width for angle in rz
static constexpr double m_stepsize_xy_cosmics
bin width for xy cosmics
static constexpr double m_stepsize_rz
bin width for rz
static constexpr double m_stepsize_xy
max range of 1/sqrt(curvature) for curved transform, corresponds to 0.02 ~ 2,5m ~ 1....
Gaudi::Property< bool > m_use_negative_weights
use negative weights (false)

Member Data Documentation

◆ m_detectorsize_angle_rz

double MuonHoughPatternTool::m_detectorsize_angle_rz {180.}
staticconstexprprivate

max range of angle in rz in degrees (180)

Definition at line 216 of file MuonHoughPatternTool.h.

216{180.};

◆ m_detectorsize_angle_xyz

double MuonHoughPatternTool::m_detectorsize_angle_xyz {360.}
staticconstexprprivate

max range of angle in xyz in degrees (360)

Definition at line 214 of file MuonHoughPatternTool.h.

214{360.};

◆ m_detectorsize_rz

double MuonHoughPatternTool::m_detectorsize_rz {0.}
private

acceptancy of patterns in rz (eta) in mm

Definition at line 198 of file MuonHoughPatternTool.h.

198{0.};

◆ m_detectorsize_rz_full

double MuonHoughPatternTool::m_detectorsize_rz_full {27750.}
staticconstexprprivate

size of full detector in rz (eta) in mm, used as acceptancy for cosmics

Definition at line 204 of file MuonHoughPatternTool.h.

204{27750.};

◆ m_detectorsize_rz_ip

double MuonHoughPatternTool::m_detectorsize_rz_ip {1500.}
staticconstexprprivate

acceptancy of patterns for ip in rz (eta) in mm

Definition at line 211 of file MuonHoughPatternTool.h.

211{1500.};

◆ m_detectorsize_xy

double MuonHoughPatternTool::m_detectorsize_xy {0.}
private

acceptancy of patterns in xy (phi) in mm

Definition at line 194 of file MuonHoughPatternTool.h.

194{0.};

◆ m_detectorsize_xy_full

double MuonHoughPatternTool::m_detectorsize_xy_full {15000.}
staticconstexprprivate

size of full detector in xy (phi) in mm, used as acceptancy for cosmics

Definition at line 200 of file MuonHoughPatternTool.h.

200{15000.};

◆ m_detectorsize_xy_ip

double MuonHoughPatternTool::m_detectorsize_xy_ip {600.}
staticconstexprprivate

acceptancy of patterns for ip in xy (phi) in mm

Definition at line 207 of file MuonHoughPatternTool.h.

207{600.};

◆ m_detectorsize_yz

double MuonHoughPatternTool::m_detectorsize_yz {0.}
private

acceptancy of patterns in yz (not used) in mm

Definition at line 196 of file MuonHoughPatternTool.h.

196{0.};

◆ m_detectorsize_yz_full

double MuonHoughPatternTool::m_detectorsize_yz_full {25000.}
staticconstexprprivate

size of full detector in yz (not used) in mm, used as acceptancy for cosmics

Definition at line 202 of file MuonHoughPatternTool.h.

202{25000.};

◆ m_detectorsize_yz_ip

double MuonHoughPatternTool::m_detectorsize_yz_ip {1000.}
staticconstexprprivate

acceptancy of patterns for ip in yz (not used) in mm

Definition at line 209 of file MuonHoughPatternTool.h.

209{1000.};

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_file

std::unique_ptr<TFile> MuonHoughPatternTool::m_file
private

pointer to the file name for the hough histograms

Definition at line 131 of file MuonHoughPatternTool.h.

◆ m_maximum_level

int MuonHoughPatternTool::m_maximum_level {5}
staticconstexprprivate

// number of maximum iterations over houghtransform

Definition at line 176 of file MuonHoughPatternTool.h.

176{5};

◆ m_maximum_residu_angle

double MuonHoughPatternTool::m_maximum_residu_angle {3.}
staticconstexprprivate

distance hits are associated with pattern in degrees

Definition at line 173 of file MuonHoughPatternTool.h.

173{3.};

◆ m_maximum_residu_mm

double MuonHoughPatternTool::m_maximum_residu_mm {500.}
staticconstexprprivate

distance hits are associated with pattern in mm

Definition at line 169 of file MuonHoughPatternTool.h.

169{500.};

◆ m_maximum_residu_mm_cosmics

double MuonHoughPatternTool::m_maximum_residu_mm_cosmics {2000.}
staticconstexprprivate

distance hits are associated with pattern in mm for cosmics

Definition at line 171 of file MuonHoughPatternTool.h.

171{2000.};

◆ m_maxNumberOfPhiHits

Gaudi::Property<int> MuonHoughPatternTool::m_maxNumberOfPhiHits {this, "MaximumNumberOfPhiHits", -1}
private

maximum number of phi hits to do pattern recognition, if small zero no cut is applied

Definition at line 274 of file MuonHoughPatternTool.h.

274{this, "MaximumNumberOfPhiHits", -1};

◆ m_muonhoughmathutils

MuonHoughMathUtils MuonHoughPatternTool::m_muonhoughmathutils
private

object for use of mathematical formulas for trackmodels

Definition at line 133 of file MuonHoughPatternTool.h.

◆ m_nbins_curved

int MuonHoughPatternTool::m_nbins_curved {160}
staticconstexprprivate

bin width for 1/sqrt(curvature)

new curved properties

Definition at line 244 of file MuonHoughPatternTool.h.

244{160};

◆ m_ncalls

std::atomic_uint MuonHoughPatternTool::m_ncalls {0}
mutableprivate

Definition at line 271 of file MuonHoughPatternTool.h.

271{0};

◆ m_number_of_ids

int MuonHoughPatternTool::m_number_of_ids {7}
private

number of hough transforms currently supported (7)

Definition at line 149 of file MuonHoughPatternTool.h.

149{7};

◆ m_number_of_maxima

Gaudi::Property<int> MuonHoughPatternTool::m_number_of_maxima {this, "NumberOfMaximaPerIterations", 5}
private

number of iterations (5)

Definition at line 152 of file MuonHoughPatternTool.h.

152{this, "NumberOfMaximaPerIterations", 5};

◆ m_number_of_sectors_rz

Gaudi::Property<int> MuonHoughPatternTool::m_number_of_sectors_rz {this, "SetNumberOfSectorsREta", 16}
private

number of sectors (different regions in which patterns can be found in the same iteration) in rz

Definition at line 264 of file MuonHoughPatternTool.h.

264{this, "SetNumberOfSectorsREta", 16};

◆ m_number_of_sectors_rz_cosmics

int MuonHoughPatternTool::m_number_of_sectors_rz_cosmics {12}
private

number of sectors (different regions in which patterns can be found in the same iteration) in rzcosmics

Definition at line 266 of file MuonHoughPatternTool.h.

266{12};

◆ m_number_of_sectors_xyz

Gaudi::Property<int> MuonHoughPatternTool::m_number_of_sectors_xyz {this, "SetNumberOfSectorsRPhi", 12}
private

number of sectors (different regions in which patterns can be found in the same iteration) in xyz

Definition at line 262 of file MuonHoughPatternTool.h.

262{this, "SetNumberOfSectorsRPhi", 12};

◆ m_printlevel

Gaudi::Property<int> MuonHoughPatternTool::m_printlevel {this, "Printlevel", 0}
private

output level (range 0-10) (default 0)

Definition at line 269 of file MuonHoughPatternTool.h.

269{this, "Printlevel", 0};

◆ m_stepsize_per_angle_rz

double MuonHoughPatternTool::m_stepsize_per_angle_rz {0.25}
staticconstexprprivate

bin width for angle in rz

Definition at line 235 of file MuonHoughPatternTool.h.

235{0.25};

◆ m_stepsize_per_angle_rz_cosmics

double MuonHoughPatternTool::m_stepsize_per_angle_rz_cosmics {2.}
staticconstexprprivate

bin width for angle in rzcosmics

Definition at line 239 of file MuonHoughPatternTool.h.

239{2.};

◆ m_stepsize_per_angle_xy_cosmics

double MuonHoughPatternTool::m_stepsize_per_angle_xy_cosmics {1.}
staticconstexprprivate

bin width for angle in xy cosmics

Definition at line 237 of file MuonHoughPatternTool.h.

237{1.};

◆ m_stepsize_per_angle_xyz

double MuonHoughPatternTool::m_stepsize_per_angle_xyz {0.25}
staticconstexprprivate

bin width for angle in xyz

Definition at line 233 of file MuonHoughPatternTool.h.

233{0.25};

◆ m_stepsize_rz

double MuonHoughPatternTool::m_stepsize_rz {75.}
staticconstexprprivate

bin width for rz

Definition at line 227 of file MuonHoughPatternTool.h.

227{75.};

◆ m_stepsize_rz_cosmics

double MuonHoughPatternTool::m_stepsize_rz_cosmics {150.}
staticconstexprprivate

bin width for rzcosmics

Definition at line 231 of file MuonHoughPatternTool.h.

231{150.};

◆ m_stepsize_xy

double MuonHoughPatternTool::m_stepsize_xy {75.}
staticconstexprprivate

max range of 1/sqrt(curvature) for curved transform, corresponds to 0.02 ~ 2,5m ~ 1.6GeV

bin width for xy

Definition at line 223 of file MuonHoughPatternTool.h.

223{75.};

◆ m_stepsize_xy_cosmics

double MuonHoughPatternTool::m_stepsize_xy_cosmics {150.}
staticconstexprprivate

bin width for xy cosmics

Definition at line 229 of file MuonHoughPatternTool.h.

229{150.};

◆ m_stepsize_yz

double MuonHoughPatternTool::m_stepsize_yz {250.}
staticconstexprprivate

bin width for yz

Definition at line 225 of file MuonHoughPatternTool.h.

225{250.};

◆ m_theta_cor_constant

double MuonHoughPatternTool::m_theta_cor_constant {-0.042}
staticconstexprprivate

constant 1 for theta for hough correction

Definition at line 187 of file MuonHoughPatternTool.h.

187{-0.042};

◆ m_theta_cor_constant2

double MuonHoughPatternTool::m_theta_cor_constant2 {4000.}
staticconstexprprivate

constant 2 for theta for hough correction

Definition at line 189 of file MuonHoughPatternTool.h.

189{4000.};

◆ m_thresholdhisto_rz

Gaudi::Property<double> MuonHoughPatternTool::m_thresholdhisto_rz {this, "SetThresholdHistoREta", 2.1}
private

threshold histogram in rz

Definition at line 259 of file MuonHoughPatternTool.h.

259{this, "SetThresholdHistoREta", 2.1};

◆ m_thresholdhisto_xyz

Gaudi::Property<double> MuonHoughPatternTool::m_thresholdhisto_xyz {this, "SetThresholdHistoRPhi", 0.9}
private

threshold histogram in xyz

Definition at line 257 of file MuonHoughPatternTool.h.

257{this, "SetThresholdHistoRPhi", 0.9};

◆ m_thresholdpattern_rz

Gaudi::Property<unsigned int> MuonHoughPatternTool::m_thresholdpattern_rz {this, "SetThresholdPatternREta", 3}
private

minimal size for a eta pattern (3)

Definition at line 164 of file MuonHoughPatternTool.h.

164{this, "SetThresholdPatternREta", 3};

◆ m_thresholdpattern_xyz

Gaudi::Property<unsigned int> MuonHoughPatternTool::m_thresholdpattern_xyz {this, "SetThresholdPatternRPhi", 1}
private

minimal size for a phi pattern (1)

Definition at line 162 of file MuonHoughPatternTool.h.

162{this, "SetThresholdPatternRPhi", 1};

◆ m_use_cosmics

Gaudi::Property<bool> MuonHoughPatternTool::m_use_cosmics {this, "UseCosmics", false}
private

use cosmic settings (false)

Definition at line 138 of file MuonHoughPatternTool.h.

138{this, "UseCosmics", false};

◆ m_use_csc_in_hough

Gaudi::Property<bool> MuonHoughPatternTool::m_use_csc_in_hough {this, "UseCscInHough", true}
private

use csc hits in histogram (false)

Definition at line 142 of file MuonHoughPatternTool.h.

142{this, "UseCscInHough", true};

◆ m_use_csc_in_pattern

Gaudi::Property<bool> MuonHoughPatternTool::m_use_csc_in_pattern {this, "UseCscInPattern", true}
private

use csc hits in association / pattern (true)

Definition at line 140 of file MuonHoughPatternTool.h.

140{this, "UseCscInPattern", true};

◆ m_use_curvedhough

Gaudi::Property<bool> MuonHoughPatternTool::m_use_curvedhough {this, "UseCurvedHough", true}
private

use curved hough transformation for eta patterns (true)

Definition at line 146 of file MuonHoughPatternTool.h.

146{this, "UseCurvedHough", true};

◆ m_use_histos

Gaudi::Property<bool> MuonHoughPatternTool::m_use_histos {this, "UseHistos", false}
private

output histograms (false)

Definition at line 136 of file MuonHoughPatternTool.h.

136{this, "UseHistos", false};

◆ m_use_ip

bool MuonHoughPatternTool::m_use_ip {false}
private

use interaction point constraint (true)

Definition at line 159 of file MuonHoughPatternTool.h.

159{false};

◆ m_use_negative_weights

Gaudi::Property<bool> MuonHoughPatternTool::m_use_negative_weights {this, "UseNegativeWeights", false}
private

use negative weights (false)

Definition at line 144 of file MuonHoughPatternTool.h.

144{this, "UseNegativeWeights", false};

◆ m_use_rpc_measures_eta

bool MuonHoughPatternTool::m_use_rpc_measures_eta {true}
staticconstexprprivate

use rpc phi strips in phi-patterns (true)

use rpc eta strips in eta-patterns (true)

Definition at line 157 of file MuonHoughPatternTool.h.

157{true};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.

◆ m_weight

Gaudi::Property<double> MuonHoughPatternTool::m_weight {this, "WeightCut", 0.25}
private

value of weight cut

Definition at line 250 of file MuonHoughPatternTool.h.

250{this, "WeightCut", 0.25}; // cut all hits under 0.25

◆ m_weightcut

Gaudi::Property<bool> MuonHoughPatternTool::m_weightcut {this, "ApplyWeightCut", true}
private

weight_cut for hits in hough

Definition at line 247 of file MuonHoughPatternTool.h.

247{this, "ApplyWeightCut", true};

◆ m_weightcutmdt

Gaudi::Property<bool> MuonHoughPatternTool::m_weightcutmdt
private
Initial value:
{this, "ApplyWeightCutMdt",
true}

weight_cut for mdt hits in hough

Definition at line 253 of file MuonHoughPatternTool.h.

253 {this, "ApplyWeightCutMdt",
254 true}; // cut all mdt hits under a certain weight (dependent on number of mdt hits in event

◆ m_z_cor_constant

double MuonHoughPatternTool::m_z_cor_constant {-10000.}
staticconstexprprivate

use hough correction to correct the maximum found in rz-plane slightly as there is a bias in the houghtransform

constant 1 for z for hough correction

Definition at line 183 of file MuonHoughPatternTool.h.

183{-10000.};

◆ m_z_cor_constant2

double MuonHoughPatternTool::m_z_cor_constant2 {6000.}
staticconstexprprivate

constant 2 for z for hough correction

Definition at line 185 of file MuonHoughPatternTool.h.

185{6000.};

The documentation for this class was generated from the following files: