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 47 of file TileNeighbour.cxx.

48  : m_debug(0)
49  , m_length(0)
50  , m_maxHash(0)
51 {
52 }

◆ ~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 367 of file TileNeighbour.cxx.

369 {
370 
371  if(ids.size() != hash_max) {
372  log << MSG::ERROR << "fill_phi_vec "
373  << " Error: set size NOT EQUAL to hash max. size " << ids.size()
374  << " hash max " << hash_max
375  << endmsg;
376  return (1);
377  }
378 
379  m_phid_index.resize(hash_max);
380  m_cell_index.resize(hash_max);
381  m_hashid_vec.resize(hash_max);
382 
383  int dphi = hash_max / max_phi; // number of Ids in one phi-slice
384 
385  int ind_min=0, ind_max=-1, phi, phi_prev=-1, index=0;
386 
387  std::set<std::pair<IdentifierHash,int> >::const_iterator first = ids.begin();
388  std::set<std::pair<IdentifierHash,int> >::const_iterator last = ids.end();
389 
390  for (;first != last; ++first) {
391  phi = (*first).second;
392  if (phi != phi_prev) {
393  if (0 == phi) {
394  ++ind_max;
395  ind_min = ind_max;
396  }
397  index = ind_min + dphi * phi;
398  phi_prev = phi;
399  } else {
400  if (0 == phi) {
401  ++ind_max;
402  }
403  ++index;
404  }
405  IdentifierHash hash_id = (*first).first;
406  m_hashid_vec[index] = hash_id ;
407  m_phid_index[hash_id] = dphi*phi;
408  m_cell_index[hash_id] = index - dphi*phi;
409  }
410 
411  return (0);
412 }

◆ get_id()

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

Definition at line 562 of file TileNeighbour.cxx.

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

◆ 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 611 of file TileNeighbour.cxx.

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

◆ initialize()

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

Definition at line 57 of file TileNeighbour.cxx.

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

◆ initialize_next_eta()

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

Definition at line 420 of file TileNeighbour.cxx.

421 {
422  m_next_eta [ind] = all_cells;
423  return (0);
424 }

◆ initialize_next_samp()

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

Definition at line 432 of file TileNeighbour.cxx.

433 {
434  m_next_samp [ind] = all_cells;
435  return (0);
436 }

◆ initialize_next_samp_wide()

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

Definition at line 445 of file TileNeighbour.cxx.

446 {
447  m_next_samp_wide [ind] = all_cells;
449  return (0);
450 }

◆ initialize_prev_eta()

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

Definition at line 414 of file TileNeighbour.cxx.

415 {
416  m_prev_eta [ind] = all_cells;
417  return (0);
418 }

◆ initialize_prev_samp()

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

Definition at line 426 of file TileNeighbour.cxx.

427 {
428  m_prev_samp [ind] = all_cells;
429  return (0);
430 }

◆ initialize_prev_samp_wide()

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

Definition at line 438 of file TileNeighbour.cxx.

439 {
440  m_prev_samp_wide [ind] = all_cells;
442  return (0);
443 }

◆ next_eta()

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

Definition at line 492 of file TileNeighbour.cxx.

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

◆ next_phi()

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

Definition at line 465 of file TileNeighbour.cxx.

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

◆ next_samp()

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

Definition at line 520 of file TileNeighbour.cxx.

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

◆ next_samp_wide()

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

Definition at line 548 of file TileNeighbour.cxx.

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

◆ prev_eta()

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

Definition at line 478 of file TileNeighbour.cxx.

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

◆ prev_phi()

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

Definition at line 452 of file TileNeighbour.cxx.

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

◆ prev_samp()

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

Definition at line 506 of file TileNeighbour.cxx.

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

◆ prev_samp_wide()

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

Definition at line 534 of file TileNeighbour.cxx.

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

◆ 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 665 of file TileNeighbour.cxx.

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

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:432
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:414
ReadCellNoiseFromCoolCompare.s1
s1
Definition: ReadCellNoiseFromCoolCompare.py:378
ReadCellNoiseFromCool.cell
cell
Definition: ReadCellNoiseFromCool.py:53
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
Tile_Base_ID::cell_hash_max
size_type cell_hash_max() const
Definition: Tile_Base_ID.cxx:1313
TileNeighbour::initialize_prev_samp_wide
int initialize_prev_samp_wide(unsigned int ind, const std::vector< short int > &all_cells)
Definition: TileNeighbour.cxx:438
Tile_Base_ID::m_MODULE_INDEX
size_type m_MODULE_INDEX
Definition: Tile_Base_ID.h:343
LArNeighbours::corners2D
@ corners2D
Definition: LArNeighbours.h:17
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:562
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:420
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:367
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:369
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
dq_defect_bulk_create_defects.line
line
Definition: dq_defect_bulk_create_defects.py:27
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:92
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:611
Tile_Base_ID::m_SECTION_INDEX
size_type m_SECTION_INDEX
Definition: Tile_Base_ID.h:341
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:445
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:116
lumiFormat.i
int i
Definition: lumiFormat.py:85
LArNeighbours::all3DwithCorners
@ all3DwithCorners
Definition: LArNeighbours.h:26
beamspotman.n
n
Definition: beamspotman.py:727
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
CopyBlobFromCool.suff
suff
Definition: CopyBlobFromCool.py:121
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:194
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:344
LArNeighbours::super3D
@ super3D
Definition: LArNeighbours.h:29
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:239
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
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:16
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:362
Tile_Base_ID::cell_context
IdContext cell_context() const
id for cells
Definition: Tile_Base_ID.cxx:1059
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:362
Tile_Base_ID::m_SIDE_INDEX
size_type m_SIDE_INDEX
Definition: Tile_Base_ID.h:342
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:360
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
PathResolver::find_file
static std::string find_file(const std::string &logical_file_name, const std::string &search_path)
Definition: PathResolver.cxx:183
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:534
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:23
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:611
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:13
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:29
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:345
LArNeighbours::all2D
@ all2D
Definition: LArNeighbours.h:18
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:665
TileNeighbour::initialize_prev_samp
int initialize_prev_samp(unsigned int ind, const std::vector< short int > &all_cells)
Definition: TileNeighbour.cxx:426
Identifier
Definition: IdentifierFieldParser.cxx:14