ATLAS Offline Software
Lvl1MuCTPIInput.h
Go to the documentation of this file.
1 // Dear emacs, this is -*- c++ -*-
2 #ifndef TRIGT1INTERFACES_LVL1MUCTPIINPUT_H
3 /*
4  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
5 */
6 #define TRIGT1INTERFACES_LVL1MUCTPIINPUT_H
7 
8 // System include(s):
9 #include <iosfwd>
10 #include <vector>
11 #include <utility>
12 #include <memory>
13 #include <array>
14 
15 // Local include(s):
20 
21 namespace LVL1MUONIF {
22 
37  class Lvl1MuCTPIInput final {
38 
39  public:
42  ~Lvl1MuCTPIInput() = default;
43 
44  Lvl1MuCTPIInput& operator=( const Lvl1MuCTPIInput& right );
45 
46  protected:
47  // data from each sector logic is identifed by
48  // System Address : Barrel=0, Endcap=1, Forward=2
49  // Sub-system Address : A_side(Z>0) =1, C_side(Z<0) =0
50  // Sector Address : Barrel=0-31, Endcap=0-47, Forward=0-23
51  enum MuonSystem { Barrel = 0, Endcap = 1, Forward = 2 };
52  enum MuonSubSystem { A_side = 1, C_side = 0};
53  enum { NumberOfMuonSystem = 3 };
54  enum { NumberOfMuonSubSystem = 2 };
55  enum { NumberOfBarrelSector = 32 };
56  enum { NumberOfEndcapSector = 48 };
57  enum { NumberOfForwardSector = 24 };
58 
59  public:
60  static size_t idBarrelSystem() { return Barrel; }
61  static size_t numberOfBarrelSector() { return NumberOfBarrelSector; }
62  static size_t idEndcapSystem() { return Endcap; }
63  static size_t numberOfEndcapSector() { return NumberOfEndcapSector; }
64  static size_t idForwardSystem() { return Forward; }
65  static size_t numberOfForwardSector() { return NumberOfForwardSector; }
66  static size_t idSideA() { return A_side; }
67  static size_t idSideC() { return C_side; }
68 
69  const Lvl1MuSectorLogicData& getSectorLogicData( size_t systemAddress,
70  size_t subSystemAddress,
71  size_t sectorAddress,
72  int bcid=0 ) const;
73 
75  size_t systemAddress,
76  size_t subSystemAddress,
77  size_t sectorAddress,
78  int bcid=0 );
79 
80  void setSectorLogicData( const unsigned int & sectorWord,
81  size_t systemAddress,
82  size_t subSystemAddress,
83  size_t sectorAddress,
84  int bcid=0 );
85 
91  void merge( const Lvl1MuCTPIInput& another );
92 
93  void clear( size_t systemAddress );
95  void clearAll();
96 
98  bool isEmpty( size_t systemAddress,
99  int bcid=0 ) const;
100 
102  bool isEmptyAll(int bcid=0) const;
103 
106  bool hasOutOfTimeCandidates(size_t systemAddress) const
107  {
108  if ( systemAddress < NumberOfMuonSystem) {
109  return m_isFilledOutOfTimeCandidates[systemAddress];
110  }
111  return false;
112  }
113 
114  // for testing purposes only
115  // void duplicateToOtherBC(int bcidOffset);
116 
117  friend std::ostream& operator<<( std::ostream&, const Lvl1MuCTPIInput& );
118 
120  //bool storeInWordFormat( std::ofstream& fOut, bool ascii = true );
121 
123  //bool retrieveInWordFormat( std::ifstream& fIn, bool ascii = true );
124 
125  private:
126  //bool storeInWordFormat( std::ofstream& fOut,
127  // bool ascii,
128  // size_t systemAddress,
129  // size_t subSystemAddress,
130  // size_t sectorAddress );
131 
132  size_t reserve( size_t systemAddress ,
133  int bcid=0 );
134 
135  size_t getSystemIndex(size_t systemAddress,
136  size_t subSystemAddress,
137  size_t sectorAddress ) const
138  {
139  if (systemAddress==0) {
140  return NumberOfBarrelSector*subSystemAddress+sectorAddress;
141  } else if (systemAddress==1) {
142  return NumberOfEndcapSector*subSystemAddress+sectorAddress;
143  } else {
144  return NumberOfForwardSector*subSystemAddress+sectorAddress;
145  }
146  }
147 
148  size_t getBcidIndex(size_t systemAddress,
149  int bcid=0) const
150  {
151  for( size_t ip=0; ip<m_data[systemAddress].size(); ip++){
152  int bc=((m_data[systemAddress]).at(ip)).first;
153  if (bc == bcid) return ip;
154  }
155  return -1;
156  };
157 
158  std::array<bool, NumberOfMuonSystem> m_isFilledOutOfTimeCandidates;
159 
160 
161  typedef std::vector<std::shared_ptr <Lvl1MuSectorLogicData> > Lvl1MuVect;
162  typedef std::pair<int, Lvl1MuVect> Lvl1MuVectWithBC;
163  std::vector<Lvl1MuVectWithBC> m_data[ NumberOfMuonSystem ];
164 
165  }; // class Lvl1MuCTPIInput
166 
167 } // namespace LVL1MUONIF
168 
169 #include "AthenaKernel/CLASS_DEF.h"
171 
172 #endif // TRIGT1INTERFACES_LVL1MUCTPIINPUT_H
LVL1MUONIF::Lvl1MuCTPIInput::merge
void merge(const Lvl1MuCTPIInput &another)
Merge SectorLogic data of another object into this data of a system (Barrel, Endcap or Forward) is no...
Definition: Lvl1MuCTPIInput.cxx:104
LVL1MUONIF::Lvl1MuCTPIInput::Lvl1MuVectWithBC
std::pair< int, Lvl1MuVect > Lvl1MuVectWithBC
Definition: Lvl1MuCTPIInput.h:162
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
LVL1MUONIF::Lvl1MuSectorLogicData
Base class for the data coming from one SL board.
Definition: Lvl1MuSectorLogicData.h:34
LVL1MUONIF::Lvl1MuCTPIInput::setSectorLogicData
void setSectorLogicData(const Lvl1MuSectorLogicData &data, size_t systemAddress, size_t subSystemAddress, size_t sectorAddress, int bcid=0)
Definition: Lvl1MuCTPIInput.cxx:58
LVL1MUONIF::Lvl1MuCTPIInput::Endcap
@ Endcap
Definition: Lvl1MuCTPIInput.h:51
LVL1MUONIF::Lvl1MuCTPIInput::C_side
@ C_side
Definition: Lvl1MuCTPIInput.h:52
LVL1MUONIF::Lvl1MuCTPIInput::Forward
@ Forward
Definition: Lvl1MuCTPIInput.h:51
LVL1MUONIF::Lvl1MuCTPIInput
Class representing (part of) the input data to the MuCTPI.
Definition: Lvl1MuCTPIInput.h:37
LVL1MUONIF::Lvl1MuCTPIInput::operator=
Lvl1MuCTPIInput & operator=(const Lvl1MuCTPIInput &right)
Definition: Lvl1MuCTPIInput.cxx:24
LVL1MUONIF
Namespace for the LVL1 muon interface classes.
Definition: Lvl1MuBarrelSectorLogicData.cxx:9
LVL1MUONIF::Lvl1MuCTPIInput::reserve
size_t reserve(size_t systemAddress, int bcid=0)
To store object to file. (NOT TO BE USED ANYMORE...)
Definition: Lvl1MuCTPIInput.cxx:121
LVL1MUONIF::Lvl1MuCTPIInput::getSectorLogicData
const Lvl1MuSectorLogicData & getSectorLogicData(size_t systemAddress, size_t subSystemAddress, size_t sectorAddress, int bcid=0) const
Definition: Lvl1MuCTPIInput.cxx:42
LVL1MUONIF::Lvl1MuCTPIInput::m_isFilledOutOfTimeCandidates
std::array< bool, NumberOfMuonSystem > m_isFilledOutOfTimeCandidates
Definition: Lvl1MuCTPIInput.h:156
Lvl1MuForwardSectorLogicData.h
LVL1MUONIF::Lvl1MuCTPIInput::numberOfBarrelSector
static size_t numberOfBarrelSector()
Definition: Lvl1MuCTPIInput.h:61
LVL1MUONIF::Lvl1MuCTPIInput::Lvl1MuVect
std::vector< std::shared_ptr< Lvl1MuSectorLogicData > > Lvl1MuVect
Definition: Lvl1MuCTPIInput.h:161
LVL1MUONIF::Lvl1MuCTPIInput::isEmptyAll
bool isEmptyAll(int bcid=0) const
Return "true" if data of all systems for this bcid is empty.
Definition: Lvl1MuCTPIInput.cxx:164
LVL1MUONIF::Lvl1MuCTPIInput::NumberOfForwardSector
@ NumberOfForwardSector
Definition: Lvl1MuCTPIInput.h:57
LVL1MUONIF::Lvl1MuCTPIInput::hasOutOfTimeCandidates
bool hasOutOfTimeCandidates(size_t systemAddress) const
Return "true" if data of specified system is filled for bunches other than 'current' bunch
Definition: Lvl1MuCTPIInput.h:106
LVL1MUONIF::Lvl1MuCTPIInput::getSystemIndex
size_t getSystemIndex(size_t systemAddress, size_t subSystemAddress, size_t sectorAddress) const
Definition: Lvl1MuCTPIInput.h:135
LVL1MUONIF::Lvl1MuCTPIInput::idForwardSystem
static size_t idForwardSystem()
Definition: Lvl1MuCTPIInput.h:64
Lvl1MuBarrelSectorLogicData.h
LVL1MUONIF::Lvl1MuCTPIInput::operator<<
friend std::ostream & operator<<(std::ostream &, const Lvl1MuCTPIInput &)
Definition: Lvl1MuCTPIInput.cxx:218
LVL1MUONIF::Lvl1MuCTPIInput::NumberOfEndcapSector
@ NumberOfEndcapSector
Definition: Lvl1MuCTPIInput.h:56
LVL1MUONIF::Lvl1MuCTPIInput::clearAll
void clearAll()
Clear Sector Logic data.
Definition: Lvl1MuCTPIInput.cxx:179
LVL1MUONIF::Lvl1MuCTPIInput::isEmpty
bool isEmpty(size_t systemAddress, int bcid=0) const
Return "true" if data of specified system is empty.
Definition: Lvl1MuCTPIInput.cxx:154
LVL1MUONIF::Lvl1MuCTPIInput::idBarrelSystem
static size_t idBarrelSystem()
Definition: Lvl1MuCTPIInput.h:60
find_tgc_unfilled_channelids.ip
ip
Definition: find_tgc_unfilled_channelids.py:3
Lvl1MuSectorLogicData.h
LVL1MUONIF::Lvl1MuCTPIInput::A_side
@ A_side
Definition: Lvl1MuCTPIInput.h:52
LVL1MUONIF::Lvl1MuCTPIInput::getBcidIndex
size_t getBcidIndex(size_t systemAddress, int bcid=0) const
Definition: Lvl1MuCTPIInput.h:148
LVL1MUONIF::Lvl1MuCTPIInput::m_data
std::vector< Lvl1MuVectWithBC > m_data[NumberOfMuonSystem]
Definition: Lvl1MuCTPIInput.h:163
LVL1MUONIF::Lvl1MuCTPIInput::MuonSubSystem
MuonSubSystem
Definition: Lvl1MuCTPIInput.h:52
LVL1MUONIF::Lvl1MuCTPIInput::MuonSystem
MuonSystem
Definition: Lvl1MuCTPIInput.h:51
LVL1MUONIF::Lvl1MuCTPIInput::idEndcapSystem
static size_t idEndcapSystem()
Definition: Lvl1MuCTPIInput.h:62
LVL1MUONIF::Lvl1MuCTPIInput::idSideC
static size_t idSideC()
Definition: Lvl1MuCTPIInput.h:67
LVL1MUONIF::Lvl1MuCTPIInput::~Lvl1MuCTPIInput
~Lvl1MuCTPIInput()=default
xAOD::bcid
setEventNumber setTimeStamp bcid
Definition: EventInfo_v1.cxx:133
Lvl1MuEndcapSectorLogicData.h
LVL1MUONIF::Lvl1MuCTPIInput::clear
void clear(size_t systemAddress)
Definition: Lvl1MuCTPIInput.cxx:173
LVL1MUONIF::Lvl1MuCTPIInput::numberOfForwardSector
static size_t numberOfForwardSector()
Definition: Lvl1MuCTPIInput.h:65
LVL1MUONIF::Lvl1MuCTPIInput::NumberOfMuonSubSystem
@ NumberOfMuonSubSystem
Definition: Lvl1MuCTPIInput.h:54
CLASS_DEF
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
Definition: Control/AthenaKernel/AthenaKernel/CLASS_DEF.h:64
LVL1MUONIF::Lvl1MuCTPIInput::Barrel
@ Barrel
Definition: Lvl1MuCTPIInput.h:51
DeMoScan.first
bool first
Definition: DeMoScan.py:536
LVL1MUONIF::Lvl1MuCTPIInput::NumberOfBarrelSector
@ NumberOfBarrelSector
Definition: Lvl1MuCTPIInput.h:55
LVL1MUONIF::Lvl1MuCTPIInput::numberOfEndcapSector
static size_t numberOfEndcapSector()
Definition: Lvl1MuCTPIInput.h:63
LVL1MUONIF::Lvl1MuCTPIInput::NumberOfMuonSystem
@ NumberOfMuonSystem
Definition: Lvl1MuCTPIInput.h:53
LVL1MUONIF::Lvl1MuCTPIInput::idSideA
static size_t idSideA()
Definition: Lvl1MuCTPIInput.h:66
LVL1MUONIF::Lvl1MuCTPIInput::Lvl1MuCTPIInput
Lvl1MuCTPIInput()
Definition: Lvl1MuCTPIInput.cxx:12
CLASS_DEF.h
macros to associate a CLID to a type