|
ATLAS Offline Software
|
This class return all neighbours for given hash ID of the cell.
More...
#include <TileNeighbour.h>
|
int | initialize_prev_eta (unsigned int ind, const std::vector< short int > &all_cells) |
|
int | initialize_next_eta (unsigned int ind, const std::vector< short int > &all_cells) |
|
int | initialize_prev_samp (unsigned int ind, const std::vector< short int > &all_cells) |
|
int | initialize_next_samp (unsigned int ind, const std::vector< short int > &all_cells) |
|
int | initialize_prev_samp_wide (unsigned int ind, const std::vector< short int > &all_cells) |
|
int | initialize_next_samp_wide (unsigned int ind, const std::vector< short int > &all_cells) |
|
int | fill_phi_vec (std::set< std::pair< IdentifierHash, int > > &ids, unsigned int hash_max, unsigned int max_phi, MsgStream &log) |
|
|
static void | get_id (std::string &strName, Identifier &id, const Tile_Base_ID *tileID) |
|
static void | get_name (Identifier &id, std::string §ion, int &module, std::string &cell, const Tile_Base_ID *tileID, MsgStream &log, const char *end) |
|
static void | print_list (std::vector< IdentifierHash > &nb_list, const Tile_Base_ID *tileID, const IdContext *context, MsgStream &log, const char *pref, const char *suff) |
|
This class return all neighbours for given hash ID of the cell.
- Author
- Alexander Solodkov
Definition at line 41 of file TileNeighbour.h.
◆ TileNeighbour()
TileNeighbour::TileNeighbour |
( |
void |
| ) |
|
◆ ~TileNeighbour()
TileNeighbour::~TileNeighbour |
( |
void |
| ) |
|
|
virtualdefault |
◆ fill_phi_vec()
int TileNeighbour::fill_phi_vec |
( |
std::set< std::pair< IdentifierHash, int > > & |
ids, |
|
|
unsigned int |
hash_max, |
|
|
unsigned int |
max_phi, |
|
|
MsgStream & |
log |
|
) |
| |
|
private |
Definition at line 371 of file TileNeighbour.cxx.
375 if(
ids.size() != hash_max) {
376 log << MSG::ERROR <<
"fill_phi_vec "
377 <<
" Error: set size NOT EQUAL to hash max. size " <<
ids.size()
378 <<
" hash max " << hash_max
387 int dphi = hash_max / max_phi;
389 int ind_min=0, ind_max=-1,
phi, phi_prev=-1,
index=0;
391 std::set<std::pair<IdentifierHash,int> >::const_iterator
first =
ids.begin();
392 std::set<std::pair<IdentifierHash,int> >::const_iterator last =
ids.end();
395 phi = (*first).second;
396 if (
phi != phi_prev) {
409 IdentifierHash hash_id = (*first).first;
◆ get_id()
Definition at line 566 of file TileNeighbour.cxx.
568 const char *
name = strName.c_str();
574 std::string::size_type
pos = strName.find(
'-', 0 );
575 if ( std::string::npos !=
pos )
sd = -1;
else sd = 1;
577 sscanf(
name+2,
"%80d",&tw);
581 case 'a':
case 'A': sm = 0; tw -= 1;
582 if (tw<10)
se = 1;
else se = 2;
584 case 'b':
case 'B': sm = 1; tw -= 1;
585 if (tw<10)
se = 1;
else se = 2;
587 case 'c':
case 'C': sm = 1; tw -= 1;
590 case 'd':
case 'D': sm = 2; tw *= 2;
591 if (tw<10)
se = 1;
else se = 2;
594 case 'e':
case 'E': sm = 3;
596 case 1: tw = 10;
break;
597 case 2: tw = 11;
break;
598 case 3: tw = 13;
break;
599 case 4: tw = 15;
break;
603 case 's':
case 'S': sm = 0; tw -= 1;
604 if (tw<9)
se = 1;
else se = 2;
606 case 'v':
case 'V': sm = 2; tw *= 2;
607 if (tw<10)
se = 1;
else se = 2;
609 default:
se = 0; sm = -1; tw = -1;
break;
◆ get_name()
void TileNeighbour::get_name |
( |
Identifier & |
id, |
|
|
std::string & |
section, |
|
|
int & |
module, |
|
|
std::string & |
cell, |
|
|
const Tile_Base_ID * |
tileID, |
|
|
MsgStream & |
log, |
|
|
const char * |
end |
|
) |
| |
|
staticprivate |
Definition at line 615 of file TileNeighbour.cxx.
622 int tower = tileID->
tower (
id);
627 case 0: strSection =
"Online";
break;
628 case 1: strSection =
"Barrel";
break;
629 case 2: strSection =
"Ext.Barrel";
break;
630 case 3: strSection = (
sample < 3) ?
"ITC":
"Gap.Scin";
break;
631 default: strSection =
"Unknown";
635 char sd = (
side<0) ?
'-' :
'+';
639 case 0: sm=(supercell?
'S':
'A');
647 case 2: sm=(supercell?
'V':
'D');
661 else snprintf(
name,
sizeof(
name),
"%c%c%d", sm,
sd,tw);
666 << strSection <<
" " <<
module <<
" " << strCell <<
end;
◆ initialize()
int TileNeighbour::initialize |
( |
const Tile_Base_ID * |
tileID, |
|
|
const std::string & |
filename = "TileNeighbour.txt" |
|
) |
| |
Definition at line 61 of file TileNeighbour.cxx.
80 log << MSG::ERROR <<
"Could not open file " <<
file <<
endmsg;
87 unsigned int line=0, record=0;
92 std::vector<Cell> allCells;
94 while (
fin >> token ) {
96 if ( token[0] ==
'#' || token[0] ==
'!' || ( token[0] ==
'/' && token[1] ==
'/' ) ) {
101 unsigned int toklen = strlen(token) - 1 ;
106 newCell.name = token;
107 for (
unsigned int i=0;
i<4; ++
i) newCell.neighbours[
i].clear();
110 while (
fin >> token) {
111 toklen = strlen(token) - 1;
112 bool lastelem = ( token[toklen] ==
';' );
115 if (strcmp(token,
"none") != 0)
116 newCell.neighbours[
column].emplace_back(token);
126 allCells.push_back(newCell);
135 unsigned int curSize = allCells.size();
136 for (
unsigned int i=0;
i<curSize; ++
i) {
138 std::string::size_type
pos = allCells[
i].name.find(
'-', 0 );
139 if ( std::string::npos !=
pos ) {
143 tmpName = allCells[
i].name;
144 tmpName.replace(
pos,1,
"+");
145 newCell.name = tmpName;
147 for (
unsigned int j=0; j<4; ++j) {
148 unsigned int j1 = (j<2) ? 1-j : j;
149 unsigned int nb_size=allCells[
i].neighbours[j].size();
150 for (
unsigned int k=0;
k<nb_size; ++
k) {
151 tmpName = allCells[
i].neighbours[j][
k];
152 pos = tmpName.find(
'-', 0 );
153 if ( std::string::npos !=
pos ) {
154 tmpName.replace(
pos,1,
"+");
156 pos = tmpName.find(
'+', 0 );
157 if ( std::string::npos !=
pos ) {
158 tmpName.replace(
pos,1,
"-");
161 newCell.neighbours[
j1].push_back(tmpName);
164 allCells.push_back(newCell);
168 unsigned int nids = 0;
169 unsigned int max_phi = 0,
phi=0;
170 std::set<std::pair<IdentifierHash,int> >
ids;
175 auto first = rit.begin();
176 auto last = rit.end();
180 if (
phi > max_phi) max_phi =
phi;
187 if(!(
ids.insert(std::make_pair(hashid,
phi))).second){
188 log << MSG::ERROR <<
"init_hashes "
189 <<
" Error: duplicated id for cell id. nids= " << nids
204 curSize = allCells.size();
206 std::string nb_name[4] = {
"Prev_eta_",
"Next_eta_",
"Prev_smp_",
"Next_smp_"};
208 for (
unsigned int i=0;
i<curSize; ++
i) {
211 for (
unsigned int ii=0; ii<
m_length; ++ii) {
213 allCells[
i].index = ii;
218 for (
unsigned int j=0; j<4; ++j) {
219 unsigned int nb_size=allCells[
i].neighbours[j].size();
220 allCells[
i].neighbours_ind[j].resize(nb_size);
221 for (
unsigned int k=0;
k<nb_size; ++
k) {
222 for (
unsigned int ii=0; ii<curSize; ++ii) {
223 if ( allCells[ii].
name == allCells[
i].neighbours[j][
k]) {
224 allCells[
i].neighbours_ind[j][
k] = ii;
227 << tileID->
to_string(allCells[
i].
id,-2) <<
" "
228 << allCells[
i].hash_id <<
" "
229 << allCells[
i].index <<
" "
230 << nb_name[j] <<
k <<
" "
231 << allCells[
i].neighbours[j][
k] <<
" "
232 << allCells[
i].neighbours_ind[j][
k] <<
" "
249 std::vector<short int> neighbours[4];
250 for (
unsigned int i=0;
i<curSize; ++
i) {
251 unsigned int ind = allCells[
i].index;
253 for (
unsigned int j=0; j<4; ++j) {
254 unsigned int nb_size=allCells[
i].neighbours[j].size();
255 neighbours[j].resize(nb_size);
256 for (
unsigned int k=0;
k<nb_size; ++
k) {
257 neighbours[j][
k] = allCells[allCells[
i].neighbours_ind[j][
k]].index;
269 int sd = tileID->
side(allCells[
i].
id);
270 int tw = tileID->
tower(allCells[
i].
id);
271 int sm = tileID->
sample(allCells[
i].
id);
274 for (
unsigned int j=2; j<4; ++j) {
277 unsigned int nb_size=allCells[
i].neighbours[j].size();
278 for (
unsigned int k=0;
k<nb_size; ++
k) {
279 unsigned int new_i = allCells[
i].neighbours_ind[j][
k];
280 for (
unsigned int new_j=0; new_j<2; ++new_j) {
281 unsigned int new_nb_size=allCells[new_i].neighbours[new_j].size();
282 for (
unsigned int new_k=0; new_k<new_nb_size; ++new_k) {
283 unsigned int new_nb_i = allCells[new_i].neighbours_ind[new_j][new_k];
284 short new_nb_index = allCells[new_nb_i].index;
285 int n=neighbours[j].size()-1;
287 if (neighbours[j][
n] == new_nb_index)
291 int new_sd = tileID->
side(allCells[new_nb_i].
id);
292 int new_tw = tileID->
tower(allCells[new_nb_i].
id);
293 int new_sm = tileID->
sample(allCells[new_nb_i].
id);
294 int new_se = tileID->
section(allCells[new_nb_i].
id);
295 if ( ( new_sd !=
sd && new_tw == tw ) ||
297 ( new_se ==
se && abs(new_tw - tw) < 3 ) ||
299 ( new_sm == sm+1 && abs(new_tw - tw) < 3 ) ||
300 ( new_sm != sm+1 && abs(new_tw - tw) < 4 ) ))))) {
301 neighbours[j].push_back(new_nb_index);
316 std::vector<IdentifierHash> nb_list;
319 for (
unsigned int i=0;
i<hash_max; ++
i) {
322 tileID->
get_id (
i,
id, &context);
323 if ( tileID->
module(
id) != 0 )
continue;
325 IdentifierHash hash_id=
i;
326 nb_list.clear(); nb_list.push_back(hash_id);
330 print_list(nb_list, tileID, &context,
log,
"Prev phi ",
" ; ");
333 print_list(nb_list, tileID, &context,
log,
"Next phi ",
" ; ");
336 print_list(nb_list, tileID, &context,
log,
"Prev eta ",
" ; ");
339 print_list(nb_list, tileID, &context,
log,
"Next eta ",
" ; ");
342 print_list(nb_list, tileID, &context,
log,
"Prev smp ",
" ; ");
345 print_list(nb_list, tileID, &context,
log,
"Next smp ",
" ; ");
348 print_list(nb_list, tileID, &context,
log,
"Face 2D ",
" ; ");
351 print_list(nb_list, tileID, &context,
log,
"Corn 2D ",
" ; ");
360 print_list(nb_list, tileID, &context,
log,
"All 3DC ",
" ; ");
363 print_list(nb_list, tileID, &context,
log,
"Super 3D ",
" ; ");
◆ initialize_next_eta()
int TileNeighbour::initialize_next_eta |
( |
unsigned int |
ind, |
|
|
const std::vector< short int > & |
all_cells |
|
) |
| |
|
private |
◆ initialize_next_samp()
int TileNeighbour::initialize_next_samp |
( |
unsigned int |
ind, |
|
|
const std::vector< short int > & |
all_cells |
|
) |
| |
|
private |
◆ initialize_next_samp_wide()
int TileNeighbour::initialize_next_samp_wide |
( |
unsigned int |
ind, |
|
|
const std::vector< short int > & |
all_cells |
|
) |
| |
|
private |
◆ initialize_prev_eta()
int TileNeighbour::initialize_prev_eta |
( |
unsigned int |
ind, |
|
|
const std::vector< short int > & |
all_cells |
|
) |
| |
|
private |
◆ initialize_prev_samp()
int TileNeighbour::initialize_prev_samp |
( |
unsigned int |
ind, |
|
|
const std::vector< short int > & |
all_cells |
|
) |
| |
|
private |
◆ initialize_prev_samp_wide()
int TileNeighbour::initialize_prev_samp_wide |
( |
unsigned int |
ind, |
|
|
const std::vector< short int > & |
all_cells |
|
) |
| |
|
private |
◆ next_eta()
◆ next_phi()
◆ next_samp()
◆ next_samp_wide()
◆ prev_eta()
◆ prev_phi()
◆ prev_samp()
◆ prev_samp_wide()
◆ print_list()
Definition at line 669 of file TileNeighbour.cxx.
679 std::string strSection;
681 std::sort(nb_list.begin(), nb_list.end());
682 unsigned int size=nb_list.size();
688 for (
unsigned int j=0; j<
size; ++j) {
691 tileID->
get_id (nb_list[j],
id, context);
◆ m_cell_index
std::vector<short int> TileNeighbour::m_cell_index |
|
private |
◆ m_debug
unsigned int TileNeighbour::m_debug |
|
private |
◆ m_hashid_vec
◆ m_length
unsigned int TileNeighbour::m_length |
|
private |
◆ m_maxHash
unsigned int TileNeighbour::m_maxHash |
|
private |
◆ m_next_eta
std::vector<std::vector<short int> > TileNeighbour::m_next_eta |
|
private |
◆ m_next_samp
std::vector<std::vector<short int> > TileNeighbour::m_next_samp |
|
private |
◆ m_next_samp_wide
std::vector<std::vector<short int> > TileNeighbour::m_next_samp_wide |
|
private |
◆ m_phid_index
std::vector<short int> TileNeighbour::m_phid_index |
|
private |
◆ m_prev_eta
std::vector<std::vector<short int> > TileNeighbour::m_prev_eta |
|
private |
◆ m_prev_samp
std::vector<std::vector<short int> > TileNeighbour::m_prev_samp |
|
private |
◆ m_prev_samp_wide
std::vector<std::vector<short int> > TileNeighbour::m_prev_samp_wide |
|
private |
The documentation for this class was generated from the following files:
int initialize_next_samp(unsigned int ind, const std::vector< short int > &all_cells)
int initialize_prev_eta(unsigned int ind, const std::vector< short int > &all_cells)
size_type cell_hash_max(void) const
Scalar phi() const
phi method
static std::string find_file(const std::string &logical_file_name, const std::string &search_path, SearchType search_type=LocalSearch)
int initialize_prev_samp_wide(unsigned int ind, const std::vector< short int > &all_cells)
IdContext cell_context(void) const
id for cells
std::vector< IdentifierHash > m_hashid_vec
static void get_id(std::string &strName, Identifier &id, const Tile_Base_ID *tileID)
logLevel
If HLT PSK is set on command line read it from DB instead of COOL (ATR-25974)
int side(const Identifier &id) const
int sample(const Identifier &id) const
int initialize_next_eta(unsigned int ind, const std::vector< short int > &all_cells)
int fill_phi_vec(std::set< std::pair< IdentifierHash, int > > &ids, unsigned int hash_max, unsigned int max_phi, MsgStream &log)
IMessageSvc * m_msgSvc
pointer to the message service
int tower(const Identifier &id) const
std::vector< short int > m_cell_index
size_type m_SECTION_INDEX
virtual int get_id(const IdentifierHash &hash_id, Identifier &id, const IdContext *context=0) const
create compact id from hash id (return == 0 for OK)
int initialize_next_samp_wide(unsigned int ind, const std::vector< short int > &all_cells)
int module(const Identifier &id) const
std::vector< std::vector< short int > > m_prev_eta
IdentifierHash hash(Identifier id) const
Look up the hash code corresponding to an Identifier.
std::vector< std::vector< short int > > m_next_samp
std::vector< std::vector< short int > > m_prev_samp
A Range describes the possible ranges for the field values of an ExpandedIdentifier.
int get_neighbours(const IdentifierHash &id, const LArNeighbours::neighbourOption &option, std::vector< IdentifierHash > &neighbourList) const
access to hashes for neighbours return == 0 for neighbours found option = prevInPhi,...
std::vector< std::vector< short int > > m_next_samp_wide
const HashGroup & channels() const
Return the HashGroup for channels (cells).
MultiRange m_full_cell_range
std::vector< std::vector< short int > > m_prev_samp_wide
std::string show_to_string(Identifier id, const IdContext *context=0, char sep='.') const
or provide the printout in string form
std::string to_string(const Identifier &id, int level=0) const
void sort(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, const Compare &comp)
Specialization of sort for DataVector/List.
std::vector< std::vector< short int > > m_next_eta
bool is_supercell(const Identifier &id) const
static void get_name(Identifier &id, std::string §ion, int &module, std::string &cell, const Tile_Base_ID *tileID, MsgStream &log, const char *end)
std::vector< short int > m_phid_index
int section(const Identifier &id) const
size_type cardinality() const
Computes a possible cardinality from all ranges.
Identifier cell_id(const Identifier &any_id) const
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
static void print_list(std::vector< IdentifierHash > &nb_list, const Tile_Base_ID *tileID, const IdContext *context, MsgStream &log, const char *pref, const char *suff)
int initialize_prev_samp(unsigned int ind, const std::vector< short int > &all_cells)