ATLAS Offline Software
Loading...
Searching...
No Matches
MuonSelect.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4// MuonSelect.cxx
5// TopoCore
6// Created by Joerg Stelzer, V Sorin 2014.
7// algorithm to make abbreviated muon lists
8// updated in 20/09/2021 to use flags selection
9
14#include <algorithm>
15
16REGISTER_ALG_TCS(MuonSelect)
17
18// constructor
20 defineParameter( "InputWidth", 32 ); // for FW
21 defineParameter( "InputWidth1stStage", 16 ); // for FW
22 defineParameter( "OutputWidth", 6 );
23 defineParameter( "MinEta", 0 );
24 defineParameter( "MaxEta", 196 );
25 defineParameter( "MinEtTGC", 0 );
26 defineParameter( "MinEtRPC", 0 );
27 defineParameter( "InnerCoinCut", 0 );
28 defineParameter( "FullStationCut", 0 );
29 defineParameter( "GoodMFieldCut", 0 );
30 defineParameter( "MinET", 0 );
31}
32
33
34// destructor
36
37
40 m_numberOfMuons = parameter("OutputWidth").value();
41 m_minEta = parameter("MinEta").value();
42 m_maxEta = parameter("MaxEta").value();
43 m_MinEtTGC = parameter("MinEtTGC").value();
44 m_MinEtRPC = parameter("MinEtRPC").value();
45 m_InnerCoinCut = parameter("InnerCoinCut").value();
46 m_FullStationCut = parameter("FullStationCut").value();
47 m_GoodMFieldCut = parameter("GoodMFieldCut").value();
48 m_et = parameter("MinET").value();
49
51}
52
53
56
57 const MuonTOBArray & muons = dynamic_cast<const MuonTOBArray&>(input);
58
59 // fill output array with GenericTOB built from clusters
60 for(MuonTOBArray::const_iterator muon = muons.begin(); muon!= muons.end(); ++muon ) {
61
62 // Tmp, to be removed after new menu is implemented
63 if( parType_t((*muon)->Et()) <= m_et ) continue; // ET cut
64
65 // Apply the relevant cut to the right kind of muon
66 if( (parType_t((*muon)->Et()) <= m_MinEtTGC && parType_t((*muon)->isTGC())) ||
67 (parType_t((*muon)->Et()) <= m_MinEtRPC && (!parType_t((*muon)->isTGC()))) ) continue; // ET cut
68
69 // eta cut
70 if (parType_t(std::abs((*muon)-> eta())) < m_minEta) continue;
71 if (parType_t(std::abs((*muon)-> eta())) > m_maxEta) continue;
72
73 // Apply flag selection only for TGC muons. The flag selection is applied only if the corresponding parameter from the menu is 1.
74 if ( parType_t((*muon)->isTGC()) )
75 {
76 if(m_InnerCoinCut == 1 && ( ! ((int)parType_t((*muon)->innerCoin()) == (int)m_InnerCoinCut ) ) ) continue;
77 if(m_FullStationCut == 1 && ( ! ((int)parType_t((*muon)->bw2or3()) == (int)m_FullStationCut ) ) ) continue;
78 if(m_GoodMFieldCut == 1 && ( ! ((int)parType_t((*muon)->goodMF()) == (int)m_GoodMFieldCut ) ) ) continue;
79 }
80
81 const GenericTOB gtob(**muon);
82 output.push_back( gtob );
83 }
84
85 // keep only max number of muons
86 if( m_numberOfMuons > 0) {
87
88 if (output.size()> m_numberOfMuons) {setOverflow(true);}
89
90 while( output.size()> m_numberOfMuons ) {
91 output.pop_back();
92 }
93 }
95}
96
97
#define REGISTER_ALG_TCS(CLASS)
Definition AlgFactory.h:62
Scalar eta() const
pseudorapidity method
const Parameter & parameter(const std::string &parameterName) const
const std::string & name() const
void defineParameter(const std::string &name, TCS::parType_t value)
data_t::const_iterator const_iterator
parType_t m_MinEtRPC
Definition MuonSelect.h:38
parType_t m_MinEtTGC
Definition MuonSelect.h:37
parType_t m_et
Definition MuonSelect.h:44
parType_t m_FullStationCut
Definition MuonSelect.h:41
parType_t m_minEta
Definition MuonSelect.h:35
MuonSelect(const std::string &name)
parType_t m_numberOfMuons
Definition MuonSelect.h:34
parType_t m_maxEta
Definition MuonSelect.h:36
virtual TCS::StatusCode sort(const InputTOBArray &input, TOBArray &output) override final
parType_t m_InnerCoinCut
Definition MuonSelect.h:40
virtual ~MuonSelect()
virtual TCS::StatusCode initialize() override
parType_t m_GoodMFieldCut
Definition MuonSelect.h:42
SortingAlg & setOverflow(const bool v)
setter, to propagate bit from input event
Definition SortingAlg.h:37
SortingAlg(const std::string &name)
Definition SortingAlg.h:21
uint32_t parType_t
Definition Parameter.h:22
STL namespace.