ATLAS Offline Software
Loading...
Searching...
No Matches
MuonSort_1BC.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4// MuonSort_1BC.cxx
5// TopoCore
6// Created by Sue Cheatham based on MuonSelect created by Joerg Stelzer, V Sorin 2014. Selects LateMuons from BC+1
7// algorithm to make abbreviated latemuon lists
8//
14#include <algorithm>
15
16REGISTER_ALG_TCS(MuonSort_1BC)
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( "InnerCoinCut", 0 );
26 defineParameter( "FullStationCut", 0 );
27 defineParameter( "GoodMFieldCut", 0 );
28 defineParameter( "nDelayedMuons", 1 );
29
30}
31
32// destructor
34
37
38 m_numberOfMuons = parameter("nDelayedMuons").value();
39 m_minEta = parameter("MinEta").value();
40 m_maxEta = parameter("MaxEta").value();
41 m_InnerCoinCut = parameter("InnerCoinCut").value();
42 m_FullStationCut = parameter("FullStationCut").value();
43 m_GoodMFieldCut = parameter("GoodMFieldCut").value();
44
46}
47
48
51
52 TRG_MSG_DEBUG("MuonSort_1BC");
53
54 const LateMuonTOBArray & muons = dynamic_cast<const LateMuonTOBArray&>(input);
55
56 // fill output array with GenericTOB built from late muons
57 for(LateMuonTOBArray::const_iterator lm = muons.begin(); lm!= muons.end(); ++lm ) {
58
59 const GenericTOB gtob(**lm);
60
61 // eta cut
62 if (parType_t(std::abs((*lm)-> eta())) < m_minEta) continue;
63 if (parType_t(std::abs((*lm)-> eta())) > m_maxEta) continue;
64
65
66 // Apply flag selection only for TGC muons. The flag selection is applied only if the corresponding parameter from the menu is 1.
67 if ( parType_t((*lm)->isTGC()) )
68 {
69 if(m_InnerCoinCut == 1 && ( ! (static_cast<int>(parType_t((*lm)->innerCoin())) == static_cast<int>(m_InnerCoinCut) ) ) ) continue;
70 if(m_FullStationCut == 1 && ( ! (static_cast<int>(parType_t((*lm)->bw2or3())) == static_cast<int>(m_FullStationCut) ) ) ) continue;
71 if(m_GoodMFieldCut == 1 && ( ! (static_cast<int>(parType_t((*lm)->goodMF())) == static_cast<int>(m_GoodMFieldCut) ) ) ) continue;
72 }
73
74 output.push_back( gtob );
75 }
76
77 // sort
78 output.sort( [] (auto tob1, auto tob2) {return tob1->Et() > tob2->Et();} );
79
80 // keep only max number of muons
81 if( m_numberOfMuons > 0) {
82 while( output.size()> m_numberOfMuons ) {
83 output.pop_back();
84 }
85 }
86
88}
89
#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_InnerCoinCut
virtual ~MuonSort_1BC()
virtual TCS::StatusCode initialize()
parType_t m_FullStationCut
MuonSort_1BC(const std::string &name)
virtual TCS::StatusCode sort(const InputTOBArray &input, TOBArray &output)
parType_t m_numberOfMuons
parType_t m_GoodMFieldCut
SortingAlg(const std::string &name)
Definition SortingAlg.h:21
uint32_t parType_t
Definition Parameter.h:22
STL namespace.