ATLAS Offline Software
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
TileNeighbour Class Reference

This class return all neighbours for given hash ID of the cell. More...

#include <TileNeighbour.h>

Collaboration diagram for TileNeighbour:

Public Member Functions

 TileNeighbour (void)
 
virtual ~TileNeighbour (void)
 
int initialize (const Tile_Base_ID *tileID, const std::string &filename="TileNeighbour.txt")
 
int prev_phi (const IdentifierHash &id, std::vector< IdentifierHash > &neighbourList) const
 
int next_phi (const IdentifierHash &id, std::vector< IdentifierHash > &neighbourList) const
 
int prev_eta (const IdentifierHash &id, std::vector< IdentifierHash > &neighbourList) const
 
int next_eta (const IdentifierHash &id, std::vector< IdentifierHash > &neighbourList) const
 
int prev_samp (const IdentifierHash &id, std::vector< IdentifierHash > &neighbourList) const
 
int next_samp (const IdentifierHash &id, std::vector< IdentifierHash > &neighbourList) const
 
int prev_samp_wide (const IdentifierHash &id, std::vector< IdentifierHash > &neighbourList) const
 
int next_samp_wide (const IdentifierHash &id, std::vector< IdentifierHash > &neighbourList) const
 

Private Member Functions

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 Private Member Functions

static void get_id (std::string &strName, Identifier &id, const Tile_Base_ID *tileID)
 
static void get_name (Identifier &id, std::string &section, 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)
 

Private Attributes

unsigned int m_debug
 
unsigned int m_length
 
unsigned int m_maxHash
 
std::vector< std::vector< short int > > m_prev_eta
 
std::vector< std::vector< short int > > m_next_eta
 
std::vector< std::vector< short int > > m_prev_samp
 
std::vector< std::vector< short int > > m_next_samp
 
std::vector< std::vector< short int > > m_prev_samp_wide
 
std::vector< std::vector< short int > > m_next_samp_wide
 
std::vector< short int > m_phid_index
 
std::vector< short int > m_cell_index
 
std::vector< IdentifierHashm_hashid_vec
 

Detailed Description

This class return all neighbours for given hash ID of the cell.

Author
Alexander Solodkov

Definition at line 41 of file TileNeighbour.h.

Constructor & Destructor Documentation

◆ TileNeighbour()

TileNeighbour::TileNeighbour ( void  )

Definition at line 51 of file TileNeighbour.cxx.

52  : m_debug(0)
53  , m_length(0)
54  , m_maxHash(0)
55 {
56 }

◆ ~TileNeighbour()

TileNeighbour::~TileNeighbour ( void  )
virtualdefault

Member Function Documentation

◆ 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.

373 {
374 
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
379  << endmsg;
380  return (1);
381  }
382 
383  m_phid_index.resize(hash_max);
384  m_cell_index.resize(hash_max);
385  m_hashid_vec.resize(hash_max);
386 
387  int dphi = hash_max / max_phi; // number of Ids in one phi-slice
388 
389  int ind_min=0, ind_max=-1, phi, phi_prev=-1, index=0;
390 
391  std::set<std::pair<IdentifierHash,int> >::const_iterator first = ids.begin();
392  std::set<std::pair<IdentifierHash,int> >::const_iterator last = ids.end();
393 
394  for (;first != last; ++first) {
395  phi = (*first).second;
396  if (phi != phi_prev) {
397  if (0 == phi) {
398  ++ind_max;
399  ind_min = ind_max;
400  }
401  index = ind_min + dphi * phi;
402  phi_prev = phi;
403  } else {
404  if (0 == phi) {
405  ++ind_max;
406  }
407  ++index;
408  }
409  IdentifierHash hash_id = (*first).first;
410  m_hashid_vec[index] = hash_id ;
411  m_phid_index[hash_id] = dphi*phi;
412  m_cell_index[hash_id] = index - dphi*phi;
413  }
414 
415  return (0);
416 }

◆ get_id()

void TileNeighbour::get_id ( std::string &  strName,
Identifier id,
const Tile_Base_ID tileID 
)
staticprivate

Definition at line 566 of file TileNeighbour.cxx.

567 {
568  const char * name = strName.c_str();
569  int se;
570  int sd;
571  int sm;
572  int tw;
573 
574  std::string::size_type pos = strName.find( '-', 0 );
575  if ( std::string::npos != pos ) sd = -1; else sd = 1;
576 
577  sscanf(name+2,"%80d",&tw);
578  if (tw<0) tw *= -1;
579 
580  switch ( name[0] ) {
581  case 'a': case 'A': sm = 0; tw -= 1;
582  if (tw<10) se = 1; else se = 2;
583  break;
584  case 'b': case 'B': sm = 1; tw -= 1;
585  if (tw<10) se = 1; else se = 2;
586  break;
587  case 'c': case 'C': sm = 1; tw -= 1;
588  se = 3;
589  break;
590  case 'd': case 'D': sm = 2; tw *= 2;
591  if (tw<10) se = 1; else se = 2;
592  if (tw==8) se = 3;
593  break;
594  case 'e': case 'E': sm = 3;
595  switch ( tw ) {
596  case 1: tw = 10; break;
597  case 2: tw = 11; break;
598  case 3: tw = 13; break;
599  case 4: tw = 15; break;
600  }
601  se = 3;
602  break;
603  case 's': case 'S': sm = 0; tw -= 1;
604  if (tw<9) se = 1; else se = 2;
605  break;
606  case 'v': case 'V': sm = 2; tw *= 2;
607  if (tw<10) se = 1; else se = 2;
608  break;
609  default: se = 0; sm = -1; tw = -1; break;
610  }
611 
612  id = tileID->cell_id(se,sd,0,tw,sm);
613 }

◆ 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.

618 {
619  int section = tileID->section (id);
620  int side = tileID->side (id);
621  module = tileID->module (id);
622  int tower = tileID->tower (id);
623  int sample = tileID->sample (id);
624  bool supercell = tileID->is_supercell(id);
625 
626  switch (section) {
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";
632  }
633 
634  int tw=0;
635  char sd = (side<0) ? '-' : '+';
636  char sm=0,s1=0;
637 
638  switch (sample) {
639  case 0: sm=(supercell?'S':'A');
640  tw=tower+1;
641  break;
642  case 1: sm='B';
643  tw=tower+1;
644  if (tw<9) s1='C';
645  if (tw==10) sm='C';
646  break;
647  case 2: sm=(supercell?'V':'D');
648  tw=tower/2;
649  if (tw==0) {
650  if (sd=='+') sd='*';
651  else sd='0';
652  }
653  break;
654  case 3: sm='E';
655  tw=(tower-7)/2;
656  break;
657  }
658 
659  char name[15];
660  if (s1>0) snprintf(name,sizeof(name),"%c%c%c%d",sm,s1,sd,tw);
661  else snprintf(name,sizeof(name),"%c%c%d", sm,sd,tw);
662  strCell = name;
663 
664  if (end)
665  log << tileID->to_string(id,-2) << " "
666  << strSection << " " << module << " " << strCell << end;
667 }

◆ initialize()

int TileNeighbour::initialize ( const Tile_Base_ID tileID,
const std::string &  filename = "TileNeighbour.txt" 
)

Definition at line 61 of file TileNeighbour.cxx.

62 {
63  MsgStream log(tileID->m_msgSvc, "TileNeighbour" );
64  MSG::Level logLevel = log.level();
65  if (logLevel==MSG::VERBOSE) m_debug = 1;
66  if (logLevel< MSG::VERBOSE) m_debug = 2;
67 
68  // Find the full path to filename:
69  std::string file = PathResolver::find_file (filename, "DATAPATH");
70  log << MSG::INFO << "Reading file " << file << endmsg;
71  std::ifstream fin;
72  if (!file.empty()) {
73  fin.open(file.c_str());
74  }
75  else {
76  log << MSG::ERROR << "Could not find input file " << filename << endmsg;
77  return 1;
78  }
79  if (fin.bad()) {
80  log << MSG::ERROR << "Could not open file " << file << endmsg;
81  return 1;
82  }
83 
84  //
85  // Parse the input file
86  //
87  unsigned int line=0, record=0; // file line number, record number
88  char token[MAX_TOKEN_SIZE]; // input token
89 
90  log << MSG::VERBOSE << "Parsing input file:" << endmsg;
91 
92  std::vector<Cell> allCells;
93 
94  while ( fin >> token ) {
95  line++; // count input lines
96  if ( token[0] == '#' || token[0] == '!' || ( token[0] == '/' && token[1] == '/' ) ) {
97  fin.ignore(MAX_TOKEN_SIZE, '\n');
98  continue; // skip comments
99  }
100 
101  unsigned int toklen = strlen(token) - 1 ;
102  token[toklen] = 0; // remove ":" at the end
103  log << MSG::VERBOSE << token << " ";
104 
105  Cell newCell;
106  newCell.name = token;
107  for (unsigned int i=0; i<4; ++i) newCell.neighbours[i].clear();
108 
109  unsigned int column=0;
110  while ( fin >> token) {
111  toklen = strlen(token) - 1;
112  bool lastelem = ( token[toklen] == ';' );
113  token[toklen] = 0; // remove "," or ";"
114  log << token << " ";
115  if (strcmp(token,"none") != 0)
116  newCell.neighbours[column].emplace_back(token);
117  if (lastelem) {
118  ++column;
119  if (4 == column) break;
120  }
121  }
122 
123  fin.ignore(MAX_TOKEN_SIZE, '\n'); // skip to eol
124 
125  log << endmsg;
126  allCells.push_back(newCell);
127  record++; // count input records
128 
129  } // end while fin
130 
131  fin.close();
132 
133  log << MSG::DEBUG << "Processed " << line << " lines, " << record << " records." << endmsg;
134 
135  unsigned int curSize = allCells.size();
136  for (unsigned int i=0; i<curSize; ++i) {
137 
138  std::string::size_type pos = allCells[i].name.find( '-', 0 );
139  if ( std::string::npos != pos ) { // it is not D0 cell
140 
141  Cell newCell;
142  std::string tmpName;
143  tmpName = allCells[i].name;
144  tmpName.replace(pos,1,"+");
145  newCell.name = tmpName;
146 
147  for (unsigned int j=0; j<4; ++j) {
148  unsigned int j1 = (j<2) ? 1-j : j; // swap prev and next eta
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,"+");
155  } else {
156  pos = tmpName.find( '+', 0 );
157  if ( std::string::npos != pos ) {
158  tmpName.replace(pos,1,"-");
159  }
160  }
161  newCell.neighbours[j1].push_back(tmpName);
162  }
163  }
164  allCells.push_back(newCell);
165  }
166  }
167 
168  unsigned int nids = 0;
169  unsigned int max_phi = 0, phi=0;
170  std::set<std::pair<IdentifierHash,int> > ids;
171  ids.clear();
172  for (unsigned int i = 0; i < tileID->m_full_cell_range.size(); ++i) {
173  const Range& range = tileID->m_full_cell_range[i];
175  auto first = rit.begin();
176  auto last = rit.end();
177  for (; first != last; ++first) {
178  const ExpandedIdentifier& exp_id = (*first);
179  phi = exp_id[tileID->m_MODULE_INDEX];
180  if (phi > max_phi) max_phi = phi;
181  Identifier id = tileID->cell_id ( exp_id[tileID->m_SECTION_INDEX],
182  exp_id[tileID->m_SIDE_INDEX],
183  exp_id[tileID->m_MODULE_INDEX],
184  exp_id[tileID->m_TOWER_INDEX],
185  exp_id[tileID->m_SAMPLE_INDEX]);
186  IdentifierHash hashid = tileID->channels().hash (id);
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
190  << " compact Id " << tileID->show_to_string(id)
191  << endmsg;
192  }
193  nids++;
194  }
195  }
196  ++max_phi;
198  m_length = m_maxHash / max_phi;
199  if ( fill_phi_vec(ids, m_maxHash, max_phi, log) ) {
200  m_maxHash = m_length = 0;
201  return (1);
202  }
203 
204  curSize = allCells.size();
205 
206  std::string nb_name[4] = {"Prev_eta_", "Next_eta_", "Prev_smp_", "Next_smp_"};
207 
208  for (unsigned int i=0; i<curSize; ++i) {
209  get_id(allCells[i].name,allCells[i].id,tileID);
210  allCells[i].hash_id = tileID->channels().hash (allCells[i].id);
211  for (unsigned int ii=0; ii<m_length; ++ii) {
212  if ( m_hashid_vec[ii] == allCells[i].hash_id) {
213  allCells[i].index = ii;
214  break;
215  }
216  }
217 
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;
225  if (m_debug) {
226  log << MSG::VERBOSE << allCells[i].name << " "
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] << " "
233  << endmsg;
234  }
235  break;
236  }
237  }
238  }
239  }
240  }
241 
242  m_prev_eta.resize(m_length);
243  m_next_eta.resize(m_length);
244  m_prev_samp.resize(m_length);
245  m_next_samp.resize(m_length);
246  m_prev_samp_wide.resize(m_length);
247  m_next_samp_wide.resize(m_length);
248 
249  std::vector<short int> neighbours[4];
250  for (unsigned int i=0; i<curSize; ++i) {
251  unsigned int ind = allCells[i].index;
252 
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;
258  }
259  }
260 
261  initialize_prev_eta (ind,neighbours[0]);
262  initialize_next_eta (ind,neighbours[1]);
263  initialize_prev_samp(ind,neighbours[2]);
264  initialize_next_samp(ind,neighbours[3]);
265 
266  // build wide prev/next sampling for 3D neighbours with corners
267 
268  // tower and side of current cell
269  int sd = tileID->side(allCells[i].id);
270  int tw = tileID->tower(allCells[i].id);
271  int sm = tileID->sample(allCells[i].id);
272  int se = tileID->section(allCells[i].id);
273 
274  for (unsigned int j=2; j<4; ++j) {
275  // find eta neighbours for all cells in prev/next sampling
276  // and keep only those which are not too far away
277  unsigned int nb_size=allCells[i].neighbours[j].size(); // how many cells in prev/next sampling
278  for (unsigned int k=0; k<nb_size; ++k) { // loop over them
279  unsigned int new_i = allCells[i].neighbours_ind[j][k]; // this is ind of cell in other sampling
280  for (unsigned int new_j=0; new_j<2; ++new_j) { // loop over prev/next eta for new cell
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) { // all new neighbours
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; // hash index of new neighbour
285  int n=neighbours[j].size()-1;
286  for ( ; n>-1; --n) { // check for duplicates
287  if (neighbours[j][n] == new_nb_index)
288  break;
289  }
290  if (n<0) { // new cell, check how far is it
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 ) || // only tower=0 from other side
296  ( new_sd == sd && ( // the same eta side
297  ( new_se == se && abs(new_tw - tw) < 3 ) || // withit one detector
298  ( new_se != se && ( // when we jump over crack
299  ( new_sm == sm+1 && abs(new_tw - tw) < 3 ) || // next sampling
300  ( new_sm != sm+1 && abs(new_tw - tw) < 4 ) ))))) { // previous sampling
301  neighbours[j].push_back(new_nb_index); // not too far away, take it
302  }
303  }
304  }
305  }
306  }
307  }
308 
309  initialize_prev_samp_wide(ind,neighbours[2]);
310  initialize_next_samp_wide(ind,neighbours[3]);
311  }
312 
313  if (m_debug) {
314 
315  IdContext context = tileID->cell_context();
316  std::vector<IdentifierHash> nb_list;
317 
318  unsigned int hash_max = tileID->cell_hash_max();
319  for (unsigned int i=0; i<hash_max; ++i) {
320 
321  Identifier id;
322  tileID->get_id (i, id, &context);
323  if ( tileID->module(id) != 0 ) continue;
324 
325  IdentifierHash hash_id=i;
326  nb_list.clear(); nb_list.push_back(hash_id);
327  print_list(nb_list, tileID, &context, log, "\nCell "," : ");
328 
329  tileID->get_neighbours(hash_id, prevInPhi, nb_list);
330  print_list(nb_list, tileID, &context, log, "Prev phi "," ; ");
331 
332  tileID->get_neighbours(hash_id, nextInPhi, nb_list);
333  print_list(nb_list, tileID, &context, log, "Next phi "," ; ");
334 
335  tileID->get_neighbours(hash_id, prevInEta, nb_list);
336  print_list(nb_list, tileID, &context, log, "Prev eta "," ; ");
337 
338  tileID->get_neighbours(hash_id, nextInEta, nb_list);
339  print_list(nb_list, tileID, &context, log, "Next eta "," ; ");
340 
341  tileID->get_neighbours(hash_id, prevInSamp, nb_list);
342  print_list(nb_list, tileID, &context, log, "Prev smp "," ; ");
343 
344  tileID->get_neighbours(hash_id, nextInSamp, nb_list);
345  print_list(nb_list, tileID, &context, log, "Next smp "," ; ");
346 
347  tileID->get_neighbours(hash_id, faces2D, nb_list);
348  print_list(nb_list, tileID, &context, log, "Face 2D "," ; ");
349 
350  tileID->get_neighbours(hash_id, corners2D, nb_list);
351  print_list(nb_list, tileID, &context, log, "Corn 2D "," ; ");
352 
353  tileID->get_neighbours(hash_id, all2D, nb_list);
354  print_list(nb_list, tileID, &context, log, "All 2D "," ; ");
355 
356  tileID->get_neighbours(hash_id, all3D, nb_list);
357  print_list(nb_list, tileID, &context, log, "All 3D "," ; ");
358 
359  tileID->get_neighbours(hash_id, all3DwithCorners, nb_list);
360  print_list(nb_list, tileID, &context, log, "All 3DC "," ; ");
361 
362  tileID->get_neighbours(hash_id, super3D, nb_list);
363  print_list(nb_list, tileID, &context, log, "Super 3D "," ; ");
364 
365  }
366  }
367 
368  return (0);
369 }

◆ initialize_next_eta()

int TileNeighbour::initialize_next_eta ( unsigned int  ind,
const std::vector< short int > &  all_cells 
)
private

Definition at line 424 of file TileNeighbour.cxx.

425 {
426  m_next_eta [ind] = all_cells;
427  return (0);
428 }

◆ initialize_next_samp()

int TileNeighbour::initialize_next_samp ( unsigned int  ind,
const std::vector< short int > &  all_cells 
)
private

Definition at line 436 of file TileNeighbour.cxx.

437 {
438  m_next_samp [ind] = all_cells;
439  return (0);
440 }

◆ initialize_next_samp_wide()

int TileNeighbour::initialize_next_samp_wide ( unsigned int  ind,
const std::vector< short int > &  all_cells 
)
private

Definition at line 449 of file TileNeighbour.cxx.

450 {
451  m_next_samp_wide [ind] = all_cells;
453  return (0);
454 }

◆ initialize_prev_eta()

int TileNeighbour::initialize_prev_eta ( unsigned int  ind,
const std::vector< short int > &  all_cells 
)
private

Definition at line 418 of file TileNeighbour.cxx.

419 {
420  m_prev_eta [ind] = all_cells;
421  return (0);
422 }

◆ initialize_prev_samp()

int TileNeighbour::initialize_prev_samp ( unsigned int  ind,
const std::vector< short int > &  all_cells 
)
private

Definition at line 430 of file TileNeighbour.cxx.

431 {
432  m_prev_samp [ind] = all_cells;
433  return (0);
434 }

◆ initialize_prev_samp_wide()

int TileNeighbour::initialize_prev_samp_wide ( unsigned int  ind,
const std::vector< short int > &  all_cells 
)
private

Definition at line 442 of file TileNeighbour.cxx.

443 {
444  m_prev_samp_wide [ind] = all_cells;
446  return (0);
447 }

◆ next_eta()

int TileNeighbour::next_eta ( const IdentifierHash id,
std::vector< IdentifierHash > &  neighbourList 
) const

Definition at line 496 of file TileNeighbour.cxx.

498 {
499  unsigned int phid = m_phid_index[id];
500  unsigned int cell = m_cell_index[id];
501 
502  unsigned int size = m_next_eta[cell].size();
503  for (unsigned int i=0; i<size; ++i) {
504  neighbourList.push_back(m_hashid_vec[phid+m_next_eta[cell][i]]);
505  }
506 
507  return size;
508 }

◆ next_phi()

int TileNeighbour::next_phi ( const IdentifierHash id,
std::vector< IdentifierHash > &  neighbourList 
) const

Definition at line 469 of file TileNeighbour.cxx.

471 {
472  unsigned int phid = m_phid_index[id];
473  unsigned int cell = m_cell_index[id];
474  phid += m_length;
475  if ( phid == m_maxHash ) phid = 0;
476 
477  neighbourList.push_back(m_hashid_vec[phid+cell]);
478 
479  return 1;
480 }

◆ next_samp()

int TileNeighbour::next_samp ( const IdentifierHash id,
std::vector< IdentifierHash > &  neighbourList 
) const

Definition at line 524 of file TileNeighbour.cxx.

526 {
527  unsigned int phid = m_phid_index[id];
528  unsigned int cell = m_cell_index[id];
529 
530  unsigned int size = m_next_samp[cell].size();
531  for (unsigned int i=0; i<size; ++i) {
532  neighbourList.push_back(m_hashid_vec[phid+m_next_samp[cell][i]]);
533  }
534 
535  return size;
536 }

◆ next_samp_wide()

int TileNeighbour::next_samp_wide ( const IdentifierHash id,
std::vector< IdentifierHash > &  neighbourList 
) const

Definition at line 552 of file TileNeighbour.cxx.

554 {
555  unsigned int phid = m_phid_index[id];
556  unsigned int cell = m_cell_index[id];
557 
558  unsigned int size = m_next_samp_wide[cell].size();
559  for (unsigned int i=0; i<size; ++i) {
560  neighbourList.push_back(m_hashid_vec[phid+m_next_samp_wide[cell][i]]);
561  }
562 
563  return size;
564 }

◆ prev_eta()

int TileNeighbour::prev_eta ( const IdentifierHash id,
std::vector< IdentifierHash > &  neighbourList 
) const

Definition at line 482 of file TileNeighbour.cxx.

484 {
485  unsigned int phid = m_phid_index[id];
486  unsigned int cell = m_cell_index[id];
487 
488  unsigned int size = m_prev_eta[cell].size();
489  for (unsigned int i=0; i<size; ++i) {
490  neighbourList.push_back(m_hashid_vec[phid+m_prev_eta[cell][i]]);
491  }
492 
493  return size;
494 }

◆ prev_phi()

int TileNeighbour::prev_phi ( const IdentifierHash id,
std::vector< IdentifierHash > &  neighbourList 
) const

Definition at line 456 of file TileNeighbour.cxx.

458 {
459  unsigned int phid = m_phid_index[id];
460  unsigned int cell = m_cell_index[id];
461  if ( phid == 0 ) phid = m_maxHash;
462  phid -= m_length;
463 
464  neighbourList.push_back(m_hashid_vec[phid+cell]);
465 
466  return 1;
467 }

◆ prev_samp()

int TileNeighbour::prev_samp ( const IdentifierHash id,
std::vector< IdentifierHash > &  neighbourList 
) const

Definition at line 510 of file TileNeighbour.cxx.

512 {
513  unsigned int phid = m_phid_index[id];
514  unsigned int cell = m_cell_index[id];
515 
516  unsigned int size = m_prev_samp[cell].size();
517  for (unsigned int i=0; i<size; ++i) {
518  neighbourList.push_back(m_hashid_vec[phid+m_prev_samp[cell][i]]);
519  }
520 
521  return size;
522 }

◆ prev_samp_wide()

int TileNeighbour::prev_samp_wide ( const IdentifierHash id,
std::vector< IdentifierHash > &  neighbourList 
) const

Definition at line 538 of file TileNeighbour.cxx.

540 {
541  unsigned int phid = m_phid_index[id];
542  unsigned int cell = m_cell_index[id];
543 
544  unsigned int size = m_prev_samp_wide[cell].size();
545  for (unsigned int i=0; i<size; ++i) {
546  neighbourList.push_back(m_hashid_vec[phid+m_prev_samp_wide[cell][i]]);
547  }
548 
549  return size;
550 }

◆ print_list()

void TileNeighbour::print_list ( std::vector< IdentifierHash > &  nb_list,
const Tile_Base_ID tileID,
const IdContext context,
MsgStream &  log,
const char *  pref,
const char *  suff 
)
staticprivate

Definition at line 669 of file TileNeighbour.cxx.

675 {
676  Identifier id;
677  int module;
678  std::string strCell;
679  std::string strSection;
680 
681  std::sort(nb_list.begin(), nb_list.end());
682  unsigned int size=nb_list.size();
683  log << MSG::VERBOSE << pref << "(" << size << ") ";
684 // size = strlen(pref) + 4 + ((size)<10 ? 1 : 2);
685 // char *space = new char[size+1];
686 // memset(space,32,size);
687 // space[size]=0;
688  for (unsigned int j=0; j<size; ++j) {
689  log << MSG::VERBOSE << endmsg;
690  log << MSG::VERBOSE << "\t";
691  tileID->get_id (nb_list[j], id, context);
692  get_name(id,strSection,module,strCell,tileID,log,suff);
693  }
694  log << endmsg;
695 // delete [] space;
696 }

Member Data Documentation

◆ m_cell_index

std::vector<short int> TileNeighbour::m_cell_index
private

Definition at line 75 of file TileNeighbour.h.

◆ m_debug

unsigned int TileNeighbour::m_debug
private

Definition at line 63 of file TileNeighbour.h.

◆ m_hashid_vec

std::vector<IdentifierHash> TileNeighbour::m_hashid_vec
private

Definition at line 76 of file TileNeighbour.h.

◆ m_length

unsigned int TileNeighbour::m_length
private

Definition at line 64 of file TileNeighbour.h.

◆ m_maxHash

unsigned int TileNeighbour::m_maxHash
private

Definition at line 65 of file TileNeighbour.h.

◆ m_next_eta

std::vector<std::vector<short int> > TileNeighbour::m_next_eta
private

Definition at line 68 of file TileNeighbour.h.

◆ m_next_samp

std::vector<std::vector<short int> > TileNeighbour::m_next_samp
private

Definition at line 70 of file TileNeighbour.h.

◆ m_next_samp_wide

std::vector<std::vector<short int> > TileNeighbour::m_next_samp_wide
private

Definition at line 72 of file TileNeighbour.h.

◆ m_phid_index

std::vector<short int> TileNeighbour::m_phid_index
private

Definition at line 74 of file TileNeighbour.h.

◆ m_prev_eta

std::vector<std::vector<short int> > TileNeighbour::m_prev_eta
private

Definition at line 67 of file TileNeighbour.h.

◆ m_prev_samp

std::vector<std::vector<short int> > TileNeighbour::m_prev_samp
private

Definition at line 69 of file TileNeighbour.h.

◆ m_prev_samp_wide

std::vector<std::vector<short int> > TileNeighbour::m_prev_samp_wide
private

Definition at line 71 of file TileNeighbour.h.


The documentation for this class was generated from the following files:
TileNeighbour::initialize_next_samp
int initialize_next_samp(unsigned int ind, const std::vector< short int > &all_cells)
Definition: TileNeighbour.cxx:436
TileNeighbour::m_maxHash
unsigned int m_maxHash
Definition: TileNeighbour.h:65
ConstRangeIterator
Definition: RangeIterator.h:46
TileNeighbour::initialize_prev_eta
int initialize_prev_eta(unsigned int ind, const std::vector< short int > &all_cells)
Definition: TileNeighbour.cxx:418
ReadCellNoiseFromCoolCompare.s1
s1
Definition: ReadCellNoiseFromCoolCompare.py:378
Tile_Base_ID::cell_hash_max
size_type cell_hash_max(void) const
Definition: Tile_Base_ID.cxx:1313
checkFileSG.line
line
Definition: checkFileSG.py:75
ReadCellNoiseFromCool.cell
cell
Definition: ReadCellNoiseFromCool.py:53
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
PathResolver::find_file
static std::string find_file(const std::string &logical_file_name, const std::string &search_path, SearchType search_type=LocalSearch)
Definition: PathResolver.cxx:251
TileNeighbour::initialize_prev_samp_wide
int initialize_prev_samp_wide(unsigned int ind, const std::vector< short int > &all_cells)
Definition: TileNeighbour.cxx:442
Tile_Base_ID::m_MODULE_INDEX
size_type m_MODULE_INDEX
Definition: Tile_Base_ID.h:344
LArNeighbours::corners2D
@ corners2D
Definition: LArNeighbours.h:17
Tile_Base_ID::cell_context
IdContext cell_context(void) const
id for cells
Definition: Tile_Base_ID.cxx:1059
index
Definition: index.py:1
TileNeighbour::m_hashid_vec
std::vector< IdentifierHash > m_hashid_vec
Definition: TileNeighbour.h:76
TileNeighbour::get_id
static void get_id(std::string &strName, Identifier &id, const Tile_Base_ID *tileID)
Definition: TileNeighbour.cxx:566
python.TrigPSCPythonDbSetup.logLevel
logLevel
If HLT PSK is set on command line read it from DB instead of COOL (ATR-25974)
Definition: TrigPSCPythonDbSetup.py:27
LArNeighbours::faces2D
@ faces2D
Definition: LArNeighbours.h:16
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
Tile_Base_ID::side
int side(const Identifier &id) const
Definition: Tile_Base_ID.cxx:153
Tile_Base_ID::sample
int sample(const Identifier &id) const
Definition: Tile_Base_ID.cxx:171
TileNeighbour::initialize_next_eta
int initialize_next_eta(unsigned int ind, const std::vector< short int > &all_cells)
Definition: TileNeighbour.cxx:424
TileNeighbour::fill_phi_vec
int fill_phi_vec(std::set< std::pair< IdentifierHash, int > > &ids, unsigned int hash_max, unsigned int max_phi, MsgStream &log)
Definition: TileNeighbour.cxx:371
ExpandedIdentifier
Definition: DetectorDescription/Identifier/Identifier/ExpandedIdentifier.h:102
DeMoUpdate.column
dictionary column
Definition: DeMoUpdate.py:1110
AtlasDetectorID::m_msgSvc
IMessageSvc * m_msgSvc
pointer to the message service
Definition: AtlasDetectorID.h:368
Tile_Base_ID::tower
int tower(const Identifier &id) const
Definition: Tile_Base_ID.cxx:165
TestSUSYToolsAlg.pref
pref
Definition: TestSUSYToolsAlg.py:80
keylayer_zslicemap.se
se
Definition: keylayer_zslicemap.py:194
LArNeighbours::prevInPhi
@ prevInPhi
Definition: LArNeighbours.h:12
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
TileNeighbour::m_cell_index
std::vector< short int > m_cell_index
Definition: TileNeighbour.h:75
TRT::Hit::side
@ side
Definition: HitInfo.h:83
python.selector.AtlRunQuerySelectorLhcOlc.sd
sd
Definition: AtlRunQuerySelectorLhcOlc.py:612
Tile_Base_ID::m_SECTION_INDEX
size_type m_SECTION_INDEX
Definition: Tile_Base_ID.h:342
LArNeighbours::nextInSamp
@ nextInSamp
Definition: LArNeighbours.h:20
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
python.PyAthena.module
module
Definition: PyAthena.py:131
LArNeighbours::nextInPhi
@ nextInPhi
Definition: LArNeighbours.h:13
Tile_Base_ID::get_id
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)
Definition: Tile_Base_ID.cxx:1077
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
TileNeighbour::initialize_next_samp_wide
int initialize_next_samp_wide(unsigned int ind, const std::vector< short int > &all_cells)
Definition: TileNeighbour.cxx:449
doubleTestComp.j1
j1
Definition: doubleTestComp.py:21
Tile_Base_ID::module
int module(const Identifier &id) const
Definition: Tile_Base_ID.cxx:159
FullCPAlgorithmsTest_eljob.sample
sample
Definition: FullCPAlgorithmsTest_eljob.py:113
lumiFormat.i
int i
Definition: lumiFormat.py:85
LArNeighbours::all3DwithCorners
@ all3DwithCorners
Definition: LArNeighbours.h:26
beamspotman.n
n
Definition: beamspotman.py:731
TileNeighbour::m_prev_eta
std::vector< std::vector< short int > > m_prev_eta
Definition: TileNeighbour.h:67
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
file
TFile * file
Definition: tile_monitor.h:29
CaloIDHelper::HashGroup::hash
IdentifierHash hash(Identifier id) const
Look up the hash code corresponding to an Identifier.
TileNeighbour::m_next_samp
std::vector< std::vector< short int > > m_next_samp
Definition: TileNeighbour.h:70
LArNeighbours::prevInSamp
@ prevInSamp
Definition: LArNeighbours.h:19
Tile_Base_ID::m_TOWER_INDEX
size_type m_TOWER_INDEX
Definition: Tile_Base_ID.h:345
LArNeighbours::super3D
@ super3D
Definition: LArNeighbours.h:29
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:227
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
python.subdetectors.mmg.ids
ids
Definition: mmg.py:8
TileNeighbour::m_prev_samp
std::vector< std::vector< short int > > m_prev_samp
Definition: TileNeighbour.h:69
Range
A Range describes the possible ranges for the field values of an ExpandedIdentifier.
Definition: DetectorDescription/Identifier/Identifier/Range.h:29
Tile_Base_ID::get_neighbours
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,...
Definition: Tile_Base_ID.cxx:1786
TileNeighbour::m_next_samp_wide
std::vector< std::vector< short int > > m_next_samp_wide
Definition: TileNeighbour.h:72
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
TileNeighbour::m_length
unsigned int m_length
Definition: TileNeighbour.h:64
CaloIDHelper::channels
const HashGroup & channels() const
Return the HashGroup for channels (cells).
Tile_Base_ID::m_full_cell_range
MultiRange m_full_cell_range
Definition: Tile_Base_ID.h:363
TileNeighbour::m_prev_samp_wide
std::vector< std::vector< short int > > m_prev_samp_wide
Definition: TileNeighbour.h:71
DeMoScan.index
string index
Definition: DeMoScan.py:364
Tile_Base_ID::m_SIDE_INDEX
size_type m_SIDE_INDEX
Definition: Tile_Base_ID.h:343
TileNeighbour::m_debug
unsigned int m_debug
Definition: TileNeighbour.h:63
AtlasDetectorID::show_to_string
std::string show_to_string(Identifier id, const IdContext *context=0, char sep='.') const
or provide the printout in string form
Definition: AtlasDetectorID.cxx:574
Tile_Base_ID::to_string
std::string to_string(const Identifier &id, int level=0) const
Definition: Tile_Base_ID.cxx:52
std::sort
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.
Definition: DVL_algorithms.h:623
LArNeighbours::nextInEta
@ nextInEta
Definition: LArNeighbours.h:15
TileNeighbour::m_next_eta
std::vector< std::vector< short int > > m_next_eta
Definition: TileNeighbour.h:68
MultiRange::size
size_type size() const
Definition: MultiRange.cxx:70
DeMoScan.first
bool first
Definition: DeMoScan.py:536
DEBUG
#define DEBUG
Definition: page_access.h:11
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
Tile_Base_ID::is_supercell
bool is_supercell(const Identifier &id) const
Definition: Tile_Base_ID.cxx:294
CaloCellTimeCorrFiller.filename
filename
Definition: CaloCellTimeCorrFiller.py:24
TileNeighbour::get_name
static void get_name(Identifier &id, std::string &section, int &module, std::string &cell, const Tile_Base_ID *tileID, MsgStream &log, const char *end)
Definition: TileNeighbour.cxx:615
TileNeighbour::m_phid_index
std::vector< short int > m_phid_index
Definition: TileNeighbour.h:74
compute_lumi.fin
fin
Definition: compute_lumi.py:19
LArNeighbours::all3D
@ all3D
Definition: LArNeighbours.h:24
LArNeighbours::prevInEta
@ prevInEta
Definition: LArNeighbours.h:14
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:14
Tile_Base_ID::section
int section(const Identifier &id) const
Definition: Tile_Base_ID.cxx:147
MultiRange::cardinality
size_type cardinality() const
Computes a possible cardinality from all ranges.
Definition: MultiRange.cxx:82
section
void section(const std::string &sec)
Definition: TestTriggerMenuAccess.cxx:22
Tile_Base_ID::cell_id
Identifier cell_id(const Identifier &any_id) const
Definition: Tile_Base_ID.cxx:581
MAX_TOKEN_SIZE
#define MAX_TOKEN_SIZE
Definition: TileNeighbour.cxx:33
IdContext
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
Definition: IdContext.h:26
Tile_Base_ID::m_SAMPLE_INDEX
size_type m_SAMPLE_INDEX
Definition: Tile_Base_ID.h:346
LArNeighbours::all2D
@ all2D
Definition: LArNeighbours.h:18
checkFileSG.ind
list ind
Definition: checkFileSG.py:118
fitman.k
k
Definition: fitman.py:528
TileNeighbour::print_list
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)
Definition: TileNeighbour.cxx:669
TileNeighbour::initialize_prev_samp
int initialize_prev_samp(unsigned int ind, const std::vector< short int > &all_cells)
Definition: TileNeighbour.cxx:430
Identifier
Definition: IdentifierFieldParser.cxx:14