ATLAS Offline Software
Loading...
Searching...
No Matches
TileNeighbour.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5/***************************************************************************
6 Access to Tile Calorimeter raw data
7 -----------------------------------------
8 ***************************************************************************/
9
13#include "Identifier/Identifier.h"
15
17#include "GaudiKernel/MsgStream.h"
18
19#include <algorithm>
20#include <iostream>
21#include <fstream>
22#include <iomanip>
23
24#include <cstring>
25
26using namespace LArNeighbours;
27
28
29#define MAX_TOKEN_SIZE 256
30
31
32namespace {
33struct Cell
34{
35 Identifier id;
36 IdentifierHash hash_id;
37 short int index = 0;
38
39 std::string name;
40 std::vector<std::string> neighbours[4];
41 std::vector<int> neighbours_ind[4];
42
43};
44} // anonymous namespace
45
46
48 : m_debug(0)
49 , m_length(0)
50 , m_maxHash(0)
51{
52}
53
55= default;
56
57int TileNeighbour::initialize(const Tile_Base_ID* tileID, const std::string& filename)
58{
59 MsgStream log(Athena::getMessageSvc(), "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];
170 ConstRangeIterator rit(range);
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);
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}
366
367int TileNeighbour::fill_phi_vec (std::set<std::pair<IdentifierHash,int> > & ids,
368 unsigned int hash_max, unsigned int max_phi, MsgStream & log)
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}
413
414int TileNeighbour::initialize_prev_eta(unsigned int ind,const std::vector<short int> & all_cells)
415{
416 m_prev_eta [ind] = all_cells;
417 return (0);
418}
419
420int TileNeighbour::initialize_next_eta(unsigned int ind,const std::vector<short int> & all_cells)
421{
422 m_next_eta [ind] = all_cells;
423 return (0);
424}
425
426int TileNeighbour::initialize_prev_samp(unsigned int ind,const std::vector<short int> & all_cells)
427{
428 m_prev_samp [ind] = all_cells;
429 return (0);
430}
431
432int TileNeighbour::initialize_next_samp(unsigned int ind,const std::vector<short int> & all_cells)
433{
434 m_next_samp [ind] = all_cells;
435 return (0);
436}
437
438int TileNeighbour::initialize_prev_samp_wide(unsigned int ind,const std::vector<short int> & all_cells)
439{
440 m_prev_samp_wide [ind] = all_cells;
441 std::sort(m_prev_samp_wide[ind].begin(),m_prev_samp_wide[ind].end());
442 return (0);
443}
444
445int TileNeighbour::initialize_next_samp_wide(unsigned int ind,const std::vector<short int> & all_cells)
446{
447 m_next_samp_wide [ind] = all_cells;
448 std::sort(m_next_samp_wide[ind].begin(),m_next_samp_wide[ind].end());
449 return (0);
450}
451
453 std::vector<IdentifierHash> & neighbourList) const
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}
464
466 std::vector<IdentifierHash> & neighbourList) const
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}
477
479 std::vector<IdentifierHash> & neighbourList) const
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}
491
493 std::vector<IdentifierHash> & neighbourList) const
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}
505
507 std::vector<IdentifierHash> & neighbourList) const
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}
519
521 std::vector<IdentifierHash> & neighbourList) const
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}
533
535 std::vector<IdentifierHash> & neighbourList) const
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}
547
549 std::vector<IdentifierHash> & neighbourList) const
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}
561
562void TileNeighbour::get_id(std::string & strName, Identifier & id, const Tile_Base_ID* tileID)
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}
610
611void TileNeighbour::get_name(Identifier & id, std::string & strSection,
612 int & module, std::string & strCell,
613 const Tile_Base_ID* tileID, MsgStream & log, const char * end)
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}
664
665void TileNeighbour::print_list(std::vector<IdentifierHash> & nb_list,
666 const Tile_Base_ID* tileID,
667 const IdContext* context,
668 MsgStream & log,
669 const char * pref,
670 const char * suff)
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}
Scalar phi() const
phi method
#define endmsg
static Double_t * pref
void section(const std::string &sec)
#define MAX_TOKEN_SIZE
std::string show_to_string(Identifier id, const IdContext *context=0, char sep='.') const
or provide the printout in string form
IdentifierHash hash(Identifier id) const
Look up the hash code corresponding to an Identifier.
const HashGroup & channels() const
Return the HashGroup for channels (cells).
ConstRangeIterator end() const
ConstRangeIterator begin() const
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
Definition IdContext.h:26
This is a "hash" representation of an Identifier.
size_type cardinality() const
Computes a possible cardinality from all ranges.
size_type size() const
static std::string find_file(const std::string &logical_file_name, const std::string &search_path)
A Range describes the possible ranges for the field values of an ExpandedIdentifier.
unsigned int m_debug
int initialize_next_eta(unsigned int ind, const std::vector< short int > &all_cells)
std::vector< short int > m_phid_index
std::vector< std::vector< short int > > m_next_samp_wide
unsigned int m_length
std::vector< std::vector< short int > > m_prev_samp
unsigned int m_maxHash
int initialize(const Tile_Base_ID *tileID, const std::string &filename="TileNeighbour.txt")
std::vector< short int > m_cell_index
static void get_name(Identifier &id, std::string &section, int &module, std::string &cell, const Tile_Base_ID *tileID, MsgStream &log, const char *end)
int next_samp_wide(const IdentifierHash &id, std::vector< IdentifierHash > &neighbourList) const
int next_eta(const IdentifierHash &id, std::vector< IdentifierHash > &neighbourList) const
int prev_phi(const IdentifierHash &id, std::vector< IdentifierHash > &neighbourList) const
int fill_phi_vec(std::set< std::pair< IdentifierHash, int > > &ids, unsigned int hash_max, unsigned int max_phi, MsgStream &log)
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)
virtual ~TileNeighbour(void)
int prev_samp(const IdentifierHash &id, std::vector< IdentifierHash > &neighbourList) const
std::vector< std::vector< short int > > m_prev_samp_wide
std::vector< std::vector< short int > > m_next_samp
int next_samp(const IdentifierHash &id, std::vector< IdentifierHash > &neighbourList) const
int initialize_prev_eta(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 prev_eta(const IdentifierHash &id, std::vector< IdentifierHash > &neighbourList) const
int next_phi(const IdentifierHash &id, std::vector< IdentifierHash > &neighbourList) const
int initialize_next_samp_wide(unsigned int ind, const std::vector< short int > &all_cells)
static void get_id(std::string &strName, Identifier &id, const Tile_Base_ID *tileID)
int prev_samp_wide(const IdentifierHash &id, std::vector< IdentifierHash > &neighbourList) const
std::vector< IdentifierHash > m_hashid_vec
int initialize_prev_samp_wide(unsigned int ind, const std::vector< short int > &all_cells)
int initialize_prev_samp(unsigned int ind, const std::vector< short int > &all_cells)
std::vector< std::vector< short int > > m_next_eta
std::vector< std::vector< short int > > m_prev_eta
This class factors out code common between TileID and Tile_SuperCell_ID.
int sample(const Identifier &id) const
int tower(const Identifier &id) const
size_type m_MODULE_INDEX
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,...
size_type cell_hash_max() const
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)
IdContext cell_context() const
id for cells
bool is_supercell(const Identifier &id) const
std::string to_string(const Identifier &id, int level=0) const
Identifier cell_id(const Identifier &any_id) const
size_type m_SECTION_INDEX
size_type m_SAMPLE_INDEX
int side(const Identifier &id) const
size_type m_TOWER_INDEX
int section(const Identifier &id) const
size_type m_SIDE_INDEX
MultiRange m_full_cell_range
singleton-like access to IMessageSvc via open function and helper
IMessageSvc * getMessageSvc(bool quiet=false)
Definition index.py:1
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
TFile * file