ATLAS Offline Software
Loading...
Searching...
No Matches
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
21namespace LVL1MUONIF {
22
37 class Lvl1MuCTPIInput final {
38
39 public:
42 ~Lvl1MuCTPIInput() = default;
43
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 };
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
171
172#endif // TRIGT1INTERFACES_LVL1MUCTPIINPUT_H
macros to associate a CLID to a type
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
Class representing (part of) the input data to the MuCTPI.
void setSectorLogicData(const Lvl1MuSectorLogicData &data, size_t systemAddress, size_t subSystemAddress, size_t sectorAddress, int bcid=0)
void clear(size_t systemAddress)
static size_t numberOfBarrelSector()
std::array< bool, NumberOfMuonSystem > m_isFilledOutOfTimeCandidates
bool isEmpty(size_t systemAddress, int bcid=0) const
Return "true" if data of specified system is empty.
void clearAll()
Clear Sector Logic data.
std::pair< int, Lvl1MuVect > Lvl1MuVectWithBC
const Lvl1MuSectorLogicData & getSectorLogicData(size_t systemAddress, size_t subSystemAddress, size_t sectorAddress, int bcid=0) const
std::vector< std::shared_ptr< Lvl1MuSectorLogicData > > Lvl1MuVect
size_t reserve(size_t systemAddress, int bcid=0)
To store object to file. (NOT TO BE USED ANYMORE...)
size_t getBcidIndex(size_t systemAddress, int bcid=0) const
bool hasOutOfTimeCandidates(size_t systemAddress) const
Return "true" if data of specified system is filled for bunches other than 'current' bunch.
Lvl1MuCTPIInput & operator=(const Lvl1MuCTPIInput &right)
static size_t numberOfForwardSector()
static size_t numberOfEndcapSector()
bool isEmptyAll(int bcid=0) const
Return "true" if data of all systems for this bcid is empty.
size_t getSystemIndex(size_t systemAddress, size_t subSystemAddress, size_t sectorAddress) const
friend std::ostream & operator<<(std::ostream &, const Lvl1MuCTPIInput &)
std::vector< Lvl1MuVectWithBC > m_data[NumberOfMuonSystem]
Base class for the data coming from one SL board.
Namespace for the LVL1 muon interface classes.
Definition merge.py:1