ATLAS Offline Software
Loading...
Searching...
No Matches
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
14#include <vector>
15#include <algorithm>
16
17
44 public:
45
46 typedef Identifier::size_type size_type;
47
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
194static const int s_lar_atlas_value = 1 ;
195static 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
200CLASS_DEF( LArHVLineID , 27863673 , 1 )
201
202
203
204
205//=====================
206// Inline Definitions
207//=====================
208
209
210/* Identifier Definition Inline */
211inline HWIdentifier LArHVLineID::HVLineId (int part, int canline, int cannode, int line ) const
212/*============================================================================== */
213{
215 /*Pack fields independently */
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
249inline std::vector<HWIdentifier>::const_iterator LArHVLineID::hvline_begin() const
250/*====================================================================*/
251{
252 return(m_hvline_vec.begin());
253}
254
255inline std::vector<HWIdentifier>::const_iterator LArHVLineID::hvline_end() const
256/*==================================================================*/
257{
258 return(m_hvline_vec.end());
259}
260
261
262inline int LArHVLineID::partition(const HWIdentifier id)const
263/*===========================================================*/
264{
265 return (m_partition_impl.unpack(id));
266}
267
268inline int LArHVLineID::can_line(const HWIdentifier id)const
269/*===========================================================*/
270{
271 return (m_canline_impl.unpack(id));
272}
273
274
275inline int LArHVLineID::can_node(const HWIdentifier id)const
276/*===========================================================*/
277{
278 return (m_cannode_impl.unpack(id));
279}
280
281inline 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
296inline bool LArHVLineID::isHEC( const HWIdentifier id ) const
297{
298// Note: left unchanged with new MAY-2008 maping (14/05/2008)
299int cannode = can_node(id);
300return( (cannode >= 48 && cannode <= 79) ||
301(cannode >= 148 && cannode <= 179)
302);
303}
304inline bool LArHVLineID::isHECA( const HWIdentifier id ) const
305{
306// Note: left unchanged with new MAY-2008 maping (14/05/2008)
307int cannode = can_node(id);
308return(
309cannode >= 48 && cannode <= 79
310);
311}
312inline bool LArHVLineID::isHECC( const HWIdentifier id ) const
313{
314// Note: left unchanged with new MAY-2008 maping (14/05/2008)
315int cannode = can_node(id);
316return(
317cannode >= 148 && cannode <= 179
318);
319}
320
321
322// ==========================
323// FCAL
324// ==========================
325//
326inline bool LArHVLineID::isFCAL( const HWIdentifier id ) const
327{
328// Note: left unchanged with new MAY-2008 maping (14/05/2008)
329int cannode = can_node(id);
330return( (cannode >= 80 && cannode <= 93) ||
331(cannode >= 180 && cannode <= 193)
332);
333}
334inline bool LArHVLineID::isFCALA( const HWIdentifier id ) const
335{
336// Note: left unchanged with new MAY-2008 maping (14/05/2008)
337int cannode = can_node(id);
338return(
339cannode >= 80 && cannode <= 93
340);
341}
342inline bool LArHVLineID::isFCALC( const HWIdentifier id ) const
343{
344// Note: left unchanged with new MAY-2008 maping (14/05/2008)
345int cannode = can_node(id);
346return(
347cannode >= 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//
399inline bool LArHVLineID::isEMECPS( const HWIdentifier id ) const
400{
401// Note: left unchanged with new MAY-2008 maping (14/05/2008)
402int cannode = can_node(id);
403return( (cannode >= 312 && cannode <= 315) ||
404(cannode >= 316 && cannode <= 319)
405);
406}
407*/
408
409// ==========================
410// EMB
411// ==========================
412//
413
414/*
415inline 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}
429inline 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
442inline 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/*
463inline 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
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
macros to associate a CLID to a type
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
static const int s_lar_atlas_value
static const int s_lar_testbeam_value
int lar_field_value() const
AtlasDetectorID(const std::string &name, const std::string &group)
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
Definition IdContext.h:26
IdDictFieldImplementation is used to capture the specification of a single field of an Identifier.
This is a "hash" representation of an Identifier.
Helper for the Liquid Argon Calorimeter High-Voltage identifiers.
Definition LArHVLineID.h:43
size_type m_canline_index
size_type m_atlas_index
virtual ~LArHVLineID()
size_type m_partition_index
IdDictFieldImplementation m_partition_impl
virtual int initialize_from_dictionary(const IdDictMgr &dict_mgr)
Initialization from the identifier dictionary.
IdDictFieldImplementation m_canline_impl
MultiRange m_full_atlas_highvoltage_range
const IdDictDictionary * m_dict
size_type m_configuration_index
int can_node(const HWIdentifier id) const
Return the CAN node from an HighVoltage line identifier.
LArHVLineID()
only allowed constructor
IdDictFieldImplementation m_atlas_impl
Field Implementation.
IdDictFieldImplementation m_hvline_impl
IdentifierHash hvline_hash_binary_search(HWIdentifier hvId) const
size_type m_hvlineHashMax
int can_line(const HWIdentifier id) const
Return the CAN line from an HighVoltage line identifier.
int get_expanded_id(const HWIdentifier &id, ExpandedIdentifier &exp_id, const IdContext *context) const
std::vector< HWIdentifier > m_hvline_vec
int initLevelsFromDict()
IdentifierHash hvlineHash(HWIdentifier hvline_id) const
Create an HighVoltage line hash identifiers from identifiers.
IdContext hvlineContext() const
std::vector< HWIdentifier >::const_iterator hvline_end() const
Return an iterator pointing to a collection of high voltage line identifier.
int partition(const HWIdentifier id) const
Return the partition from an HighVoltage line identifier.
IdDictFieldImplementation m_cannode_impl
size_type m_larhvRegion_index
size_type m_cannode_index
IdDictFieldImplementation m_configuration_impl
std::vector< HWIdentifier >::const_iterator hvline_begin() const
Return an iterator pointing to a collection of high voltage line identifier.
void hvlineId_checks(int part, int canline, int cannode, int line) const
MultiRange m_full_canline_range
int hv_line(const HWIdentifier id) const
Return the HV line number from an HighVoltage line identifier.
size_type hvlineHashMax() const
Define hash tables max size.
size_type m_hvline_index
Identifier::size_type size_type
Definition LArHVLineID.h:46
MultiRange m_full_hvline_range
HWIdentifier HVLineId(int part, int canline, int cannode, int line) const
Create an HighVoltage line identifier from fields.
A MultiRange combines several Ranges.
Definition MultiRange.h:17