ATLAS Offline Software
Loading...
Searching...
No Matches
MuonAbbreviated.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4// MuonAbbreviated.cxx
5// TopoCore
6// Created by Joerg Stelzer on 11/10/12.
7
12#include <algorithm>
13
14REGISTER_ALG_TCS(MuonAbbreviated)
15
16// constructor
18 defineParameter( "NumberOfMuons", 0 );
19 defineParameter( "MinEta", 0 );
20 defineParameter( "MaxEta", 49);
21}
22
23
24// destructor
26
29 m_numberOfMuons = parameter("NumberOfMuons").value();
30 m_minEta = parameter("MinEta").value();
31 m_maxEta = parameter("MaxEta").value();
32 TRG_MSG_INFO("NumberOfMuons : " << m_numberOfMuons);
33 TRG_MSG_INFO("MinEta : " << m_minEta);
34 TRG_MSG_INFO("MaxEta : " << m_maxEta);
36}
37
38
41
42 const MuonTOBArray & muons = dynamic_cast<const MuonTOBArray&>(input);
43
44 // fill output array with GenericTOB buildt from clusters
45 //for(MuonTOBArray::const_iterator cl = muons.begin(); cl!= muons.end(); ++cl ) {
46 for(const MuonTOB* muon : muons ) {
47 const GenericTOB gtob(*muon);
48
49 parType_t muonAbsEta = (parType_t) std::abs( muon->eta() );
50
51 // eta cut
52 bool passEta = (muonAbsEta >= m_minEta) && (muonAbsEta <= m_maxEta);
53
54 TRG_MSG_DEBUG("Muon with Et=" << muon->Et() << " and abs(eta)=" << muonAbsEta << " --> " << (passEta?"pass":"fail") );
55
56 if ( ! passEta ) continue;
57
58 output.push_back( gtob );
59 }
60
61 // keep only max number of clusters
62 if( m_numberOfMuons > 0) {
63 while( output.size()> m_numberOfMuons ) {
64 output.pop_back();
65 }
66 }
68}
69
#define REGISTER_ALG_TCS(CLASS)
Definition AlgFactory.h:62
const Parameter & parameter(const std::string &parameterName) const
const std::string & name() const
void defineParameter(const std::string &name, TCS::parType_t value)
virtual TCS::StatusCode initialize()
MuonAbbreviated(const std::string &name)
virtual TCS::StatusCode sort(const InputTOBArray &input, TOBArray &output)
SortingAlg(const std::string &name)
Definition SortingAlg.h:21
uint32_t parType_t
Definition Parameter.h:22
STL namespace.