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