ATLAS Offline Software
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 //
10 #include "L1TopoEvent/TOBArray.h"
13 #include "L1TopoEvent/GenericTOB.h"
14 #include <algorithm>
15 
16 REGISTER_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 
TCS::StatusCode::SUCCESS
@ SUCCESS
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/StatusCode.h:17
TCS::parType_t
uint32_t parType_t
Definition: Parameter.h:22
TCS::DataArrayImpl< LateMuonTOB >::const_iterator
data_t::const_iterator const_iterator
Definition: DataArrayImpl.h:18
TCS::LateMuonTOBArray
Definition: LateMuonTOBArray.h:19
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
TCS::DataArrayImpl::end
iterator end()
Definition: DataArrayImpl.h:43
TCS::MuonSort_1BC::initialize
virtual TCS::StatusCode initialize()
Definition: MuonSort_1BC.cxx:36
TCS::MuonSort_1BC::sort
virtual TCS::StatusCode sort(const InputTOBArray &input, TOBArray &output)
Definition: MuonSort_1BC.cxx:50
TCS::InputTOBArray
Definition: InputTOBArray.h:15
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
TCS::MuonSort_1BC
Definition: MuonSort_1BC.h:19
TOBArray.h
MuonSort_1BC.h
TCS::MuonSort_1BC::~MuonSort_1BC
virtual ~MuonSort_1BC()
Definition: MuonSort_1BC.cxx:33
TCS::TOBArray
Definition: TOBArray.h:24
LateMuonTOBArray.h
merge.output
output
Definition: merge.py:17
TCS::GenericTOB
Definition: GenericTOB.h:35
REGISTER_ALG_TCS
#define REGISTER_ALG_TCS(CLASS)
Definition: AlgFactory.h:62
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
TCS::SortingAlg
Definition: SortingAlg.h:18
GenericTOB.h
TCS::DataArrayImpl::begin
iterator begin()
Definition: DataArrayImpl.h:40
TCS
Definition: Global/GlobalSimulation/src/IO/Decision.h:18
TRG_MSG_DEBUG
#define TRG_MSG_DEBUG(x)
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStreamMacros.h:25
TCS::StatusCode
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/StatusCode.h:15
MuonTOBArray.h