ATLAS Offline Software
LArHVLineID.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef LARIDENTIFIER_LARHVLINEID_H
6 #define LARIDENTIFIER_LARHVLINEID_H
7 
12 #include "Identifier/MultiRange.h"
13 #include "AthenaKernel/CLASS_DEF.h"
14 #include <vector>
15 #include <algorithm>
16 
17 
43 class LArHVLineID : public AtlasDetectorID {
44  public:
45 
47 
49  LArHVLineID();
50  virtual ~LArHVLineID();
51 
55  HWIdentifier HVLineId( int part, int canline, int cannode, int line ) const;
59  HWIdentifier HVLineId( IdentifierHash hvline_hash )const;
63  IdentifierHash hvlineHash( HWIdentifier hvline_id ) const;
67  std::vector<HWIdentifier>::const_iterator hvline_begin() const;
71  std::vector<HWIdentifier>::const_iterator hvline_end() const;
72 
76  size_type hvlineHashMax () const;
80  virtual int initialize_from_dictionary (const IdDictMgr& dict_mgr);
81 
82 
86  int partition( const HWIdentifier id) const;
90  int can_line ( const HWIdentifier id) const;
94  int can_node ( const HWIdentifier id) const;
98  int hv_line ( const HWIdentifier id) const;
99 
100 
101 
102 
106  /*
107  bool isEMB(const HWIdentifier id) const;
108  bool isEMBA(const HWIdentifier id) const;
109  bool isEMBC(const HWIdentifier id) const;
110  bool isEMBPS(const HWIdentifier id) const;
111  bool isEMEC(const HWIdentifier id) const;
112  bool isEMECA(const HWIdentifier id) const;
113  bool isEMECC(const HWIdentifier id) const;
114  bool isEMECPS(const HWIdentifier id) const;
115 
116  bool isHEC(const HWIdentifier id) const;
117  bool isHECA(const HWIdentifier id) const;
118  bool isHECC(const HWIdentifier id) const;
119  bool isFCAL(const HWIdentifier id) const;
120  bool isFCALA(const HWIdentifier id) const;
121  bool isFCALC(const HWIdentifier id) const;
122  bool isEMPUR(const HWIdentifier id) const;
123  bool isNOTUSED(const HWIdentifier id) const;
124  bool isNOTCONNECTED(const HWIdentifier id) const;
125  bool isHVCONNECTED(const HWIdentifier id) const;
126  */
127 
128 
129  /* Test Beam configurations */
130  /* Obsolete / Not to be implemented in the new framework */
131  /*
132  bool isH8EMB(const HWIdentifier id) const { return false; };
133  bool isH8EMBPS(const HWIdentifier id) const { return false; };
134  bool isH6EMEC(const HWIdentifier id) const { return false; };
135  bool isH6HEC(const HWIdentifier id) const { return false; };
136  bool isH6FCAL(const HWIdentifier id) const { return false; };
137  bool isHV_H8(const HWIdentifier id) const { return false; };
138  bool isHV_H6(const HWIdentifier id) const { return false; };
139  */
140 
141  /* context for feedthroughs, feb & channels */
142  IdContext hvlineContext() const;
143  /* Now Obsolete */
144  //IdContext canlineContext() const;
145 
146 
147 
148 
149  private:
150 
151 
152  enum {NOT_VALID_HASH = 256000};
153 
155 
156  /* Check methods */
157  void hvlineId_checks(int part, int canline, int cannode, int line )const;
158 
159  /* create expanded HWIdentifier from HWIdentifier (return == 0 for OK) */
160  int get_expanded_id (const HWIdentifier& id, ExpandedIdentifier& exp_id,
161  const IdContext* context) const;
162 
163  /* init() hashes */
164  int initLevelsFromDict();
165  int init_hashes();
166 
167  /* Member Data index */
175 
176 
182  std::vector<HWIdentifier> m_hvline_vec;
183 
191 
192 };
193 
194 static const int s_lar_atlas_value = 1 ;
195 static const int s_lar_testbeam_value = 2 ;
196 
197 
198 //using the macro below we can assign an identifier (and a version)
199 //This is required and checked at compile time when you try to record/retrieve
200 CLASS_DEF( LArHVLineID , 27863673 , 1 )
201 
202 
203 
204 
205 //=====================
206 // Inline Definitions
207 //=====================
208 
209 
210 /* Identifier Definition Inline */
211 inline HWIdentifier LArHVLineID::HVLineId (int part, int canline, int cannode, int line ) const
212 /*============================================================================== */
213 {
214  HWIdentifier result(0);
215  /*Pack fields independently */
216  m_atlas_impl.pack (lar_field_value(), result);
217  m_configuration_impl.pack(s_lar_atlas_value, result);
218  m_partition_impl.pack (part , result);
219  m_canline_impl.pack (canline , result);
220  m_cannode_impl.pack (cannode , result);
221  m_hvline_impl.pack (line , result);
222  return result;
223 }
224 
226 /*===================================================================*/
227 {
228  return(m_hvline_vec[hvlineHashId]);
229 }
230 
231 
233 /*=============================================================================== */
234 {
235  std::vector<HWIdentifier>::const_iterator it = std::lower_bound(m_hvline_vec.begin(),m_hvline_vec.end(),hvId);
236  if ( it != m_hvline_vec.end() ){
237  return (it - m_hvline_vec.begin());
238  }
239  return (0);
240 }
241 
243 /*====================================================================*/
244 {
245  return m_hvlineHashMax;
246 }
247 
248 
249 inline std::vector<HWIdentifier>::const_iterator LArHVLineID::hvline_begin() const
250 /*====================================================================*/
251 {
252  return(m_hvline_vec.begin());
253 }
254 
255 inline std::vector<HWIdentifier>::const_iterator LArHVLineID::hvline_end() const
256 /*==================================================================*/
257 {
258  return(m_hvline_vec.end());
259 }
260 
261 
262 inline int LArHVLineID::partition(const HWIdentifier id)const
263 /*===========================================================*/
264 {
265  return (m_partition_impl.unpack(id));
266 }
267 
268 inline int LArHVLineID::can_line(const HWIdentifier id)const
269 /*===========================================================*/
270 {
271  return (m_canline_impl.unpack(id));
272 }
273 
274 
275 inline int LArHVLineID::can_node(const HWIdentifier id)const
276 /*===========================================================*/
277 {
278  return (m_cannode_impl.unpack(id));
279 }
280 
281 inline int LArHVLineID::hv_line(const HWIdentifier id)const
282 /*===========================================================*/
283 {
284  return (m_hvline_impl.unpack(id));
285 }
286 
287 
288 
289 // ==========================
290 // HEC
291 // ==========================
292 //
293 
294 /*
295 
296 inline bool LArHVLineID::isHEC( const HWIdentifier id ) const
297 {
298 // Note: left unchanged with new MAY-2008 maping (14/05/2008)
299 int cannode = can_node(id);
300 return( (cannode >= 48 && cannode <= 79) ||
301 (cannode >= 148 && cannode <= 179)
302 );
303 }
304 inline bool LArHVLineID::isHECA( const HWIdentifier id ) const
305 {
306 // Note: left unchanged with new MAY-2008 maping (14/05/2008)
307 int cannode = can_node(id);
308 return(
309 cannode >= 48 && cannode <= 79
310 );
311 }
312 inline bool LArHVLineID::isHECC( const HWIdentifier id ) const
313 {
314 // Note: left unchanged with new MAY-2008 maping (14/05/2008)
315 int cannode = can_node(id);
316 return(
317 cannode >= 148 && cannode <= 179
318 );
319 }
320 
321 
322 // ==========================
323 // FCAL
324 // ==========================
325 //
326 inline bool LArHVLineID::isFCAL( const HWIdentifier id ) const
327 {
328 // Note: left unchanged with new MAY-2008 maping (14/05/2008)
329 int cannode = can_node(id);
330 return( (cannode >= 80 && cannode <= 93) ||
331 (cannode >= 180 && cannode <= 193)
332 );
333 }
334 inline bool LArHVLineID::isFCALA( const HWIdentifier id ) const
335 {
336 // Note: left unchanged with new MAY-2008 maping (14/05/2008)
337 int cannode = can_node(id);
338 return(
339 cannode >= 80 && cannode <= 93
340 );
341 }
342 inline bool LArHVLineID::isFCALC( const HWIdentifier id ) const
343 {
344 // Note: left unchanged with new MAY-2008 maping (14/05/2008)
345 int cannode = can_node(id);
346 return(
347 cannode >= 180 && cannode <= 193
348 );
349 }
350 
351 */
352 
353 // ==========================
354 // EMEC
355 // ==========================
356 //
357 /*
358  inline bool LArHVLineID::isEMEC( const HWIdentifier id ) const
359  {
360  // Note: change in Tartarelli's new maping (15-MAY-2008)
361  // 0-47 and 100-147 left unchanged
362  // added 320-322 HVcannodes to EMEC-A
363  // added 324-325 HVcannodes to EMEC-C
364  int cannode = can_node(id);
365  return( (cannode >= 0 && cannode <= 47) ||
366  (cannode >= 100 && cannode <= 147) ||
367  (cannode >= 320 && cannode <= 322) ||
368  (cannode >= 324 && cannode <= 325)
369  );
370  }
371 
372  inline bool LArHVLineID::isEMECA( const HWIdentifier id ) const
373  {
374  // Note: change in Tartarelli's new maping (15-MAY-2008)
375  // 0-47 unchanged
376  // added 320-322 HVcannodes to EMEC-A
377  int cannode = can_node(id);
378  return(
379  (cannode >= 0 && cannode <= 47) ||
380  (cannode >= 320 && cannode <= 322)
381  );
382  }
383  inline bool LArHVLineID::isEMECC( const HWIdentifier id ) const
384  {
385  // Note: change in Tartarelli's new maping (15-MAY-2008)
386  // HVcannodes 100-147 left unchanged
387  // added 324-325 HVcannodes to EMEC-C
388  int cannode = can_node(id);
389  return(
390  (cannode >= 100 && cannode <= 147) ||
391  (cannode >= 324 && cannode <= 325)
392  );
393  }
394 
395  // ==========================
396 // EMECPS
397 // ==========================
398 //
399 inline bool LArHVLineID::isEMECPS( const HWIdentifier id ) const
400 {
401 // Note: left unchanged with new MAY-2008 maping (14/05/2008)
402 int cannode = can_node(id);
403 return( (cannode >= 312 && cannode <= 315) ||
404 (cannode >= 316 && cannode <= 319)
405 );
406 }
407 */
408 
409 // ==========================
410 // EMB
411 // ==========================
412 //
413 
414 /*
415 inline bool LArHVLineID::isEMB( const HWIdentifier id ) const
416 {
417  // Affected by new Tartarelli's maping (15-MAY-2008)
418  // Added new HVcannodes
419  // 306-307 : EMBA
420  // 308-309 : EMBC
421  int cannode = can_node(id);
422  return(
423  (cannode >= 200 && cannode <= 231) ||
424  (cannode >= 232 && cannode <= 263) ||
425  cannode == 296 || cannode == 297 || cannode == 306 || cannode == 307 ||
426  cannode == 299 || cannode == 304 || cannode == 305 || cannode == 308 || cannode == 309
427  );
428 }
429 inline bool LArHVLineID::isEMBA( const HWIdentifier id ) const
430 {
431  // Affected by new Tartarelli's maping (15-MAY-2008)
432  // Added new HVcannodes
433  // 306-307 : EMBA
434  int cannode = can_node(id);
435  return(
436  (cannode >= 200 && cannode <= 231) ||
437  cannode == 296 || cannode == 297 ||
438  cannode == 306 || cannode == 307
439  );
440 }
441 
442 inline bool LArHVLineID::isEMBC( const HWIdentifier id ) const
443 {
444  // Affected by new Tartarelli's maping (15-MAY-2008)
445  // Added new HVcannodes
446  // 307-308 : EMBC
447  int cannode = can_node(id);
448  return(
449  (cannode >= 232 && cannode <= 263) ||
450  cannode == 299 || cannode == 304 || cannode == 305 ||
451  cannode == 308 || cannode == 309
452  );
453 }
454 
455 
456 */
457 
458 // ==========================
459 // EMBPS
460 // ==========================
461 //
462 /*
463 inline bool LArHVLineID::isEMBPS( const HWIdentifier id ) const
464 {
465  // Unaffected by new Tartarelli's maping (15-MAY-2008)
466  int cannode = can_node(id);
467  return( (cannode >= 264 && cannode <= 279) ||
468  (cannode >= 280 && cannode <= 295)
469  );
470 }
471 */
472 
473 // ==========================
474 // EMPUR
475 // ==========================
476 //
477 /*
478  inline bool LArHVLineID::isEMPUR( const HWIdentifier id ) const
479  {
480  // Changed EMBPUR and EMECPUR into the same block
481  int cannode = can_node(id);
482  return( cannode >= 300 && cannode <= 303 );
483  }
484 */
485  /*
486  inline bool LArHVLineID::isNOTCONNECTED( const HWIdentifier id ) const
487  {
488  // Added to offer other ids for new hv lines
489  // Note : put by hand after having extended the fields of HV line
490  // which allows for further change of the HV numbering
491  // (typically, new cannodes can be used)
492  int cannode = can_node(id);
493  int hvline = hv_line(id);
494  return(
495  // lines not used in the present maping (but present in the disctionary)
496  (cannode == 323 || cannode == 326 || cannode == 327) ||
497  (cannode == 310 || cannode == 311)
498  ||
499  // disconnected hv lines
500  ((cannode >= 320 && cannode <= 327 ) && (hvline >= 8 && hvline <= 15))
501  );
502  }
503  */
504 
505  /*
506  //=============================================================
507  inline bool LArHVLineID::isNOTUSED( const HWIdentifier id ) const
508  {
509  // Added to offer other ids for new hv lines
510  // Note : put by hand after having extended the fields of HV line
511  // which allows for further change of the HV numbering
512  // (typically, new cannodes can be used)
513  int cannode = can_node(id);
514  return(
515  (cannode >= 94 && cannode <= 99) ||
516  (cannode >= 194 && cannode <= 199)
517  );
518  }
519 
520  inline bool LArHVLineID::isHVCONNECTED( const HWIdentifier id ) const
521  {
522  // Added to offer other ids for new hv lines
523  return(
524  !isNOTCONNECTED( id ) && !isNOTUSED( id )
525  );
526  }
527  */
528 
529 
530 
531 #endif //LARHVLINEID_H
LArG4FSStartPointFilter.part
part
Definition: LArG4FSStartPointFilter.py:21
LArHVLineID::hvline_hash_binary_search
IdentifierHash hvline_hash_binary_search(HWIdentifier hvId) const
LArHVLineID::m_hvline_vec
std::vector< HWIdentifier > m_hvline_vec
Definition: LArHVLineID.h:182
LArHVLineID::can_node
int can_node(const HWIdentifier id) const
Return the CAN node from an HighVoltage line identifier.
Definition: LArHVLineID.h:275
LArHVLineID::hvline_end
std::vector< HWIdentifier >::const_iterator hvline_end() const
Return an iterator pointing to a collection of high voltage line identifier.
Definition: LArHVLineID.h:255
LArHVLineID::HVLineId
HWIdentifier HVLineId(int part, int canline, int cannode, int line) const
Create an HighVoltage line identifier from fields.
Definition: LArHVLineID.h:211
LArHVLineID::m_cannode_index
size_type m_cannode_index
Definition: LArHVLineID.h:173
get_generator_info.result
result
Definition: get_generator_info.py:21
LArHVLineID::m_hvline_index
size_type m_hvline_index
Definition: LArHVLineID.h:174
LArHVLineID::m_partition_index
size_type m_partition_index
Definition: LArHVLineID.h:171
skel.it
it
Definition: skel.GENtoEVGEN.py:407
LArHVLineID::m_configuration_impl
IdDictFieldImplementation m_configuration_impl
Definition: LArHVLineID.h:186
LArHVLineID::hvlineContext
IdContext hvlineContext() const
Definition: LArHVLineID.cxx:40
LArHVLineID::hv_line
int hv_line(const HWIdentifier id) const
Return the HV line number from an HighVoltage line identifier.
Definition: LArHVLineID.h:281
ExpandedIdentifier
Definition: DetectorDescription/Identifier/Identifier/ExpandedIdentifier.h:102
LArHVLineID::m_partition_impl
IdDictFieldImplementation m_partition_impl
Definition: LArHVLineID.h:187
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
HWIdentifier
Definition: HWIdentifier.h:13
LArHVLineID::init_hashes
int init_hashes()
Definition: LArHVLineID.cxx:355
dq_defect_bulk_create_defects.line
line
Definition: dq_defect_bulk_create_defects.py:27
LArHVLineID::~LArHVLineID
virtual ~LArHVLineID()
LArHVLineID::get_expanded_id
int get_expanded_id(const HWIdentifier &id, ExpandedIdentifier &exp_id, const IdContext *context) const
Definition: LArHVLineID.cxx:179
AtlasDetectorID::size_type
Identifier::size_type size_type
Definition: AtlasDetectorID.h:385
LArHVLineID::m_canline_index
size_type m_canline_index
Definition: LArHVLineID.h:172
AtlasDetectorID.h
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
IdDictMgr
Definition: IdDictMgr.h:14
LArHVLineID::hvline_begin
std::vector< HWIdentifier >::const_iterator hvline_begin() const
Return an iterator pointing to a collection of high voltage line identifier.
Definition: LArHVLineID.h:249
LArHVLineID::LArHVLineID
LArHVLineID()
only allowed constructor
Definition: LArHVLineID.cxx:22
LArHVLineID::initLevelsFromDict
int initLevelsFromDict()
Definition: LArHVLineID.cxx:201
LArHVLineID::hvlineId_checks
void hvlineId_checks(int part, int canline, int cannode, int line) const
LArHVLineID::m_atlas_impl
IdDictFieldImplementation m_atlas_impl
Field Implementation.
Definition: LArHVLineID.h:185
LArHVLineID::partition
int partition(const HWIdentifier id) const
Return the partition from an HighVoltage line identifier.
Definition: LArHVLineID.h:262
LArHVLineID::m_full_hvline_range
MultiRange m_full_hvline_range
Definition: LArHVLineID.h:179
LArHVLineID::can_line
int can_line(const HWIdentifier id) const
Return the CAN line from an HighVoltage line identifier.
Definition: LArHVLineID.h:268
LArHVLineID::m_configuration_index
size_type m_configuration_index
Definition: LArHVLineID.h:170
LArHVLineID::m_dict
const IdDictDictionary * m_dict
Definition: LArHVLineID.h:177
LArHVLineID::initialize_from_dictionary
virtual int initialize_from_dictionary(const IdDictMgr &dict_mgr)
Initialization from the identifier dictionary.
Definition: LArHVLineID.cxx:55
MultiRange
A MultiRange combines several Ranges.
Definition: MultiRange.h:17
HWIdentifier.h
IdentifierHash.h
MultiRange.h
IdDictDictionary
Definition: IdDictDictionary.h:30
IdDictFieldImplementation.h
LArHVLineID::m_cannode_impl
IdDictFieldImplementation m_cannode_impl
Definition: LArHVLineID.h:189
LArHVLineID::m_hvlineHashMax
size_type m_hvlineHashMax
Definition: LArHVLineID.h:181
CLASS_DEF
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
Definition: Control/AthenaKernel/AthenaKernel/CLASS_DEF.h:67
LArHVLineID::NOT_VALID_HASH
@ NOT_VALID_HASH
Definition: LArHVLineID.h:152
LArHVLineID::m_atlas_index
size_type m_atlas_index
Definition: LArHVLineID.h:169
Identifier::size_type
unsigned long long size_type
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:29
LArHVLineID::m_full_canline_range
MultiRange m_full_canline_range
Definition: LArHVLineID.h:180
IdDictFieldImplementation
IdDictFieldImplementation is used to capture the specification of a single field of an Identifier.
Definition: IdDictFieldImplementation.h:58
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
LArHVLineID::m_canline_impl
IdDictFieldImplementation m_canline_impl
Definition: LArHVLineID.h:188
LArHVLineID::m_hvline_impl
IdDictFieldImplementation m_hvline_impl
Definition: LArHVLineID.h:190
IdContext
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
Definition: IdContext.h:26
CLASS_DEF.h
macros to associate a CLID to a type
LArHVLineID::hvlineHashMax
size_type hvlineHashMax() const
Define hash tables max size.
Definition: LArHVLineID.h:242
LArHVLineID::size_type
Identifier::size_type size_type
Definition: LArHVLineID.h:46
AtlasDetectorID
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
Definition: AtlasDetectorID.h:52
LArHVLineID::m_full_atlas_highvoltage_range
MultiRange m_full_atlas_highvoltage_range
Definition: LArHVLineID.h:178
LArHVLineID::m_larhvRegion_index
size_type m_larhvRegion_index
Definition: LArHVLineID.h:168
LArHVLineID::hvlineHash
IdentifierHash hvlineHash(HWIdentifier hvline_id) const
Create an HighVoltage line hash identifiers from identifiers.
Definition: LArHVLineID.h:232
LArHVLineID
Helper for the Liquid Argon Calorimeter High-Voltage identifiers.
Definition: LArHVLineID.h:43