ATLAS Offline Software
Loading...
Searching...
No Matches
TileTTL1Hash.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
5//*****************************************************************************
6// Filename : TileTTL1Hash.cxx
7// Author : jose.maneira@cern.ch
8// Created : Nov 2005
9//
10// DESCRIPTION:
11// Provides a hash (integer) conversion for the TileTTL1 identifiers.
12//
13// HISTORY:
14//
15// BUGS:
16//
17//*****************************************************************************
18
19// Calo include
21
22//TileCal include
24
25#include "assert.h"
26
27// This class converts a TTL1_ID into a integer, according to its
28// value of (ROS and drawer number).
29
30// default contructor
36
37void TileTTL1Hash::initialize( const CaloLVL1_ID * caloLVL1_ID)
38{
39 std::cout << "Initialization started" << std::endl;
40
41 m_size = 0;
42 for(int i = 0; i< m_table_size; ++i) { m_lookup[i]=-1; }
43
45 std::vector<Identifier>::const_iterator first = caloLVL1_ID->tower_begin();
46 std::vector<Identifier>::const_iterator last = caloLVL1_ID->tower_end();
47
48 int maxid = 0;
49 for ( ; first!=last; ++first) {
50 if(caloLVL1_ID->is_tile(*first)){
51 ID id = caloLVL1_ID->tower_hash(*first);
52 if (id > maxid) maxid = id;
53 assert(id>=0 && id < m_table_size);
54 m_int2id.push_back(id);
55 m_lookup[id] = (m_size++);
56 }
57 }
58 std::cout << " Number of valid tower IDs "<< m_size << std::endl;
59 std::cout << " Highest tower ID "<< maxid << std::endl;
60
61
62}
63
65{
66 assert(index>=0 && index < m_size);
67
68 return m_int2id[index];
69}
70
71int TileTTL1Hash::operator() (const ID& id) const
72{
73 assert(id>=0 && id < m_table_size);
74
75 return m_lookup[id];
76}
77
Helper class for offline TT identifiers.
Definition CaloLVL1_ID.h:66
IdentifierHash tower_hash(Identifier towerId) const
create hash id from tower id
id_iterator tower_begin() const
begin iterator over towers
bool is_tile(const Identifier id) const
Test wether given tower or layer is part of the Tile Calorimeter.
id_iterator tower_end() const
end iterator over towers
int operator()(const ID &id) const
Convert ID to int.
static const int m_table_size
lookup table
int m_lookup[m_table_size]
void initialize(const CaloLVL1_ID *caloLVL1_ID)
int m_size
total number of IDs
ID identifier(int i) const
reverse conversion
std::vector< ID > m_int2id
Definition index.py:1