2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
5 #include "TileRawUtils/TileRoI_Map.h"
7 // Implementation of const_iterator
11 template <class CONTAINER >
12 TileTT_Selector<CONTAINER>::const_iterator::const_iterator
16 m_pair_it = v->begin() ;
17 if(m_pair_it != v->end()){
18 m_obj_it = (*m_pair_it).first ;
19 m_obj_it_end = (*m_pair_it).second ;
25 // constructor for end iterator
26 template <class CONTAINER >
27 TileTT_Selector<CONTAINER>::const_iterator::const_iterator
28 (const VEC_ITPAIR* v, const ITPAIR_IT& it)
36 template <class CONTAINER >
37 TileTT_Selector<CONTAINER>::const_iterator::const_iterator
46 template <class CONTAINER >
47 TileTT_Selector<CONTAINER>::const_iterator&
48 TileTT_Selector<CONTAINER>::const_iterator:: operator =
49 ( const TileTT_Selector<CONTAINER>::const_iterator & it )
52 m_vec_itpair = it.m_vec_itpair ;
53 m_pair_it = it.m_pair_it ;
54 m_obj_it = it.m_obj_it ;
55 m_obj_it_end = it.m_obj_it_end ;
62 template <class CONTAINER >
63 TileTT_Selector<CONTAINER>::const_iterator&
64 TileTT_Selector<CONTAINER>::const_iterator:: operator ++ ()
67 if(m_obj_it == m_obj_it_end) {
68 // end of this RoI, get next RoI
70 if(m_pair_it != m_vec_itpair->end() )
72 m_obj_it = (*m_pair_it).first;
73 m_obj_it_end = (*m_pair_it).second;
82 template <class CONTAINER >
83 TileTT_Selector<CONTAINER>::const_iterator
84 TileTT_Selector<CONTAINER>::const_iterator:: operator ++ (int )
86 const_iterator tmp = *this;
93 template <class CONTAINER >
95 TileTT_Selector<CONTAINER>::const_iterator:: operator !=
96 ( const TileTT_Selector<CONTAINER>::const_iterator & it ) const
98 // compare m_pair_it first because for end, m_pair_it is end.
99 if(it.m_pair_it == it.m_vec_itpair->end() )
100 { return m_pair_it != it.m_pair_it ;
103 m_pair_it != it.m_pair_it ||
104 m_obj_it != it.m_obj_it ||
105 m_obj_it_end != it.m_obj_it_end ||
106 m_vec_itpair != it.m_vec_itpair ;
111 template <class CONTAINER >
113 TileTT_Selector<CONTAINER>::const_iterator:: operator ==
114 ( const TileTT_Selector<CONTAINER>::const_iterator & it ) const
116 // compare m_map_it first because for end, m_map_it is end.
118 // if m_pair_it is end, only compare the pair iterator
119 if(m_pair_it == m_vec_itpair->end() )
120 return m_pair_it == it.m_pair_it ;
123 m_pair_it == it.m_pair_it &&
124 m_obj_it == it.m_obj_it &&
125 m_obj_it_end == it.m_obj_it_end &&
126 m_vec_itpair == it.m_vec_itpair ;
131 template <class CONTAINER >
132 const TileTT_Selector<CONTAINER>::OBJECT *
133 TileTT_Selector<CONTAINER>::const_iterator:: operator * ()
137 /*************** Implementation of TileTT_Selector<CONTAINER>
142 template <class CONTAINER >
143 TileTT_Selector<CONTAINER> ::TileTT_Selector ( const TileRoI_Map* m,
144 const CONTAINER* c ):
153 template <class CONTAINER >
154 void TileTT_Selector<CONTAINER> :: setMap(const TileRoI_Map* m) {
159 template <class CONTAINER >
160 void TileTT_Selector<CONTAINER>::setContainer(const CONTAINER* c) {
165 template <class CONTAINER >
166 void TileTT_Selector<CONTAINER> :: setRoIs( const VEC_TT_ID& ids)
170 if(m_vecItPair.size() > 0 ) {
171 m_vecItPair.erase(m_vecItPair.begin(), m_vecItPair.end());
174 TT_ID_IT it = ids.begin();
175 TT_ID_IT it_end = ids.end() ;
177 // cout <<" Number of TTs "<<ids.size()<<endl;
179 for(; it!=it_end; ++it){
181 const TT_ID& rId = (*it);
182 std::vector<COLL_ID> cIDs = m_roiMap->CollectionID(rId);
183 COLL_ID_IT cId_it = cIDs.begin();
184 COLL_ID_IT cId_it_end = cIDs.end();
185 // cout<< " Number of Collections for this RoI"<<cIDs.size()<<endl;
186 for(; cId_it!=cId_it_end;++cId_it){
187 const COLL_ID& cId = (*cId_it);
188 // cout<< " Collections id "<<cId.id()<<endl;
189 COLL_IT coll_it = m_container->find(cId);
190 if(coll_it!=m_container->end()){
192 const COLLECTION* coll = (*coll_it);
195 coll->getTT(rId,b,e);
197 m_vecItPair.push_back(ITPAIR(b,e) ) ;
200 // cout <<" Nothing in this Collections "<<endl;
209 template <class CONTAINER >
210 TileTT_Selector<CONTAINER>::const_iterator
211 TileTT_Selector<CONTAINER> ::begin() const
213 return const_iterator(&m_vecItPair);
216 template <class CONTAINER >
217 TileTT_Selector<CONTAINER>::const_iterator
218 TileTT_Selector<CONTAINER> ::end() const
220 return const_iterator(&m_vecItPair, m_vecItPair.end() );