ATLAS Offline Software
LArElectrodeID.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_LARELECTRODEID_H
6 #define LARIDENTIFIER_LARELECTRODEID_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 
102  public:
103 
104 
106 
107 
111  LArElectrodeID(void);
116 
120  HWIdentifier ElectrodeId( int det, int side, int mod, int phi, int eta, int gap, int elec ) const;
124  HWIdentifier ElectrodeId( IdentifierHash electrode_hash )const;
128  IdentifierHash electrodeHash( HWIdentifier electrode_id ) const;
129 
133  std::vector<HWIdentifier>::const_iterator electrode_begin(void) const;
134  std::vector<HWIdentifier>::const_iterator electrode_end(void) const;
135 
139  size_type electrodeHashMax (void) const;
140 
144  virtual int initialize_from_dictionary (const IdDictMgr& dict_mgr);
145 
150  int detector ( const HWIdentifier id) const;
155  int zside ( const HWIdentifier id) const;
160  int module ( const HWIdentifier id) const;
165  int hv_phi (const HWIdentifier id) const;
170  int hv_eta (const HWIdentifier id) const;
175  int gap ( const HWIdentifier id) const;
180  int electrode( const HWIdentifier id) const;
181 
182 
186  bool isEMB(const HWIdentifier id) const;
190  bool isEMBPS(const HWIdentifier id) const;
194  bool isEMEC(const HWIdentifier id) const;
198  bool isEMECinWHEEL(const HWIdentifier id) const;
202  bool isEMECoutWHEEL(const HWIdentifier id) const;
206  bool isEMECPS(const HWIdentifier id) const;
210  bool isHEC(const HWIdentifier id) const;
214  bool isFCAL( const HWIdentifier id) const;
218  bool isFCAL1(const HWIdentifier id) const;
222  bool isFCAL2(const HWIdentifier id) const;
226  bool isFCAL3(const HWIdentifier id) const;
230  bool isEMBPUR(const HWIdentifier id) const;
234  bool isECPUR(const HWIdentifier id) const;
235 
239  IdContext electrodeContext(void) const;
240 
241 
242  private:
243 
244 
245  enum {NOT_VALID_HASH = 256000};
246 
248 
249  /* Check methods */
250  void electrodeId_checks(int det, int side, int mod, int phi, int eta, int hvgap, int elec )const;
251 
252  /* create expanded HWIdentifier from HWIdentifier (return == 0 for OK) */
253  int get_expanded_id (const HWIdentifier& id, ExpandedIdentifier& exp_id,
254  const IdContext* context) const;
255 
256  /* init() hashes */
257  int initLevelsFromDict(void) ;
258  int init_hashes(void);
259 
260  /* Member Data index */
272 
277  std::vector<HWIdentifier> m_electrode_vec;
278 
289 
290 };
291 static const int s_larconfig_value = 1 ;
292 
293 //using the macro below we can assign an identifier (and a version)
294 //This is required and checked at compile time when you try to record/retrieve
295 CLASS_DEF( LArElectrodeID , 80757351 , 1 )
296 
297 
298 
299 
300 //=====================
301 // Inline Definitions
302 //=====================
303 
304 
305 /* Identifier Definition Inline */
306 inline HWIdentifier LArElectrodeID::ElectrodeId (int det, int zside, int mod, int phi,
307  int eta, int gap, int elec ) const
308 /*============================================================================== */
309 {
310  HWIdentifier result(0);
311  /*Pack fields independently */
312  m_atlas_impl.pack (lar_field_value(), result);
313  m_configuration_impl.pack(s_larconfig_value, result);
314  m_detector_impl.pack (det , result);
315  m_zside_impl.pack (zside , result);
316  m_module_impl.pack (mod , result);
317  m_hvphi_impl.pack (phi , result);
318  m_hveta_impl.pack (eta , result);
319  m_hvgap_impl.pack (gap , result);
320  m_electrode_impl.pack (elec , result);
321  return result;
322 }
323 
325 /*===================================================================*/
326 {
327  return(m_electrode_vec[electrodeHashId]);
328 }
329 
330 
332 /*=============================================================================== */
333 {
334  std::vector<HWIdentifier>::const_iterator it = std::lower_bound(m_electrode_vec.begin(),m_electrode_vec.end(),hvId);
335  if ( it != m_electrode_vec.end() ){
336  return (it - m_electrode_vec.begin());
337  }
338  return (0);
339 }
340 
342 /*====================================================================*/
343 {
344  return m_electrodeHashMax;
345 }
346 
347 
348 inline std::vector<HWIdentifier>::const_iterator LArElectrodeID::electrode_begin(void) const
349 /*====================================================================*/
350 {
351  return(m_electrode_vec.begin());
352 }
353 
354 inline std::vector<HWIdentifier>::const_iterator LArElectrodeID::electrode_end(void) const
355 /*==================================================================*/
356 {
357  return(m_electrode_vec.end());
358 }
359 
360 
361 inline int LArElectrodeID::detector(const HWIdentifier id)const
362 /*===========================================================*/
363 {
364  return (m_detector_impl.unpack(id));
365 }
366 
367 inline int LArElectrodeID::zside(const HWIdentifier id)const
368 /*===========================================================*/
369 {
370  return (m_zside_impl.unpack(id));
371 }
372 
373 
374 inline int LArElectrodeID::module(const HWIdentifier id)const
375 /*===========================================================*/
376 {
377  return (m_module_impl.unpack(id));
378 }
379 
380 inline int LArElectrodeID::hv_phi(const HWIdentifier id)const
381 /*===========================================================*/
382 {
383  return (m_hvphi_impl.unpack(id));
384 }
385 
386 inline int LArElectrodeID::hv_eta(const HWIdentifier id)const
387 /*===========================================================*/
388 {
389  return (m_hveta_impl.unpack(id));
390 }
391 
392 inline int LArElectrodeID::gap(const HWIdentifier id)const
393 /*===========================================================*/
394 {
395  return (m_hvgap_impl.unpack(id));
396 }
397 
398 inline int LArElectrodeID::electrode(const HWIdentifier id)const
399 /*===========================================================*/
400 {
401  return (m_electrode_impl.unpack(id));
402 }
403 
404 
405 // ==========================
406 // HEC
407 // ==========================
408 //
409 inline bool LArElectrodeID::isHEC( const HWIdentifier id ) const
410 /*================================================================*/
411 {
412  int det = detector(id);
413  return(
414  det == 4
415  );
416 }
417 
418 
419 // ==========================
420 // FCAL
421 // ==========================
422 //
423 inline bool LArElectrodeID::isFCAL( const HWIdentifier id ) const
424 /*================================================================*/
425 {
426  int det = detector(id);
427  //int hveta= hv_eta(id);
428  return(
429  det == 5
430  );
431 }
432 // ==========================
433 // FCAL-S1
434 // ==========================
435 //
436 inline bool LArElectrodeID::isFCAL1( const HWIdentifier id ) const
437 /*================================================================*/
438 {
439  int det = detector(id);
440  int hveta = hv_eta(id);
441  return(
442  det == 5 && hveta == 1
443  );
444 }
445 
446 // ==========================
447 // FCAL-S2
448 // ==========================
449 //
450 inline bool LArElectrodeID::isFCAL2( const HWIdentifier id ) const
451 /*================================================================*/
452 {
453  int det = detector(id);
454  int hveta = hv_eta(id);
455  return(
456  det == 5 && hveta == 2
457  );
458 }
459 // ==========================
460 // FCAL-S3
461 // ==========================
462 //
463 inline bool LArElectrodeID::isFCAL3( const HWIdentifier id ) const
464 /*================================================================*/
465 {
466  int det = detector(id);
467  int hveta = hv_eta(id);
468  return(
469  det == 5 && hveta == 3
470  );
471 }
472 
473 // ==========================
474 // EMBPUR
475 // ==========================
476 //
477 inline bool LArElectrodeID::isEMBPUR( const HWIdentifier id ) const
478 /*================================================================*/
479 {
480  int det = detector(id);
481  return(
482  det == 6
483  );
484 }
485 
486 // ==========================
487 // ECPUR
488 // ==========================
489 //
490 inline bool LArElectrodeID::isECPUR( const HWIdentifier id ) const
491 /*================================================================*/
492 {
493  int det = detector(id);
494  return(
495  det == 7
496  );
497 }
498 
499 
500 // ==========================
501 // EMEC
502 // ==========================
503 //
504 inline bool LArElectrodeID::isEMEC( const HWIdentifier id ) const
505 /*================================================================*/
506 {
507  int det = detector(id);
508  return(
509  det == 2
510  );
511 }
512 inline bool LArElectrodeID::isEMECinWHEEL( const HWIdentifier id ) const
513 /*================================================================*/
514 {
515  int det = detector(id);
516  int eta = hv_eta(id);
517  return(
518  det == 2 && eta >= 7
519  );
520 }
521 inline bool LArElectrodeID::isEMECoutWHEEL( const HWIdentifier id ) const
522 /*================================================================*/
523 {
524  int det = detector(id);
525  int eta = hv_eta(id);
526  return(
527  det == 2 && eta < 7
528  );
529 }
530 
531 // ==========================
532 // EMECPS
533 // ==========================
534 //
535 inline bool LArElectrodeID::isEMECPS( const HWIdentifier id ) const
536 /*================================================================*/
537 {
538  int det = detector(id);
539  return(
540  det == 3
541  );
542 }
543 
544 // ==========================
545 // EMB
546 // ==========================
547 //
548 inline bool LArElectrodeID::isEMB( const HWIdentifier id ) const
549 /*================================================================*/
550 {
551  int det = detector(id);
552  return(
553  det == 0
554  );
555 }
556 
557 
558 // ==========================
559 // EMBPS
560 // ==========================
561 //
562 inline bool LArElectrodeID::isEMBPS( const HWIdentifier id ) const
563 /*================================================================*/
564 {
565  int det = detector(id);
566  return(
567  det == 1
568  );
569 }
570 
571 
572 
573 
574 
575 #endif //LARELECTRODEID_H
LArElectrodeID::isEMECPS
bool isEMECPS(const HWIdentifier id) const
Return yes if electrode is in EMEC PreSampler.
Definition: LArElectrodeID.h:535
LArElectrodeID::electrodeId_checks
void electrodeId_checks(int det, int side, int mod, int phi, int eta, int hvgap, int elec) const
get_generator_info.result
result
Definition: get_generator_info.py:21
LArElectrodeID::m_hveta_impl
IdDictFieldImplementation m_hveta_impl
Definition: LArElectrodeID.h:286
LArElectrodeID::init_hashes
int init_hashes(void)
Definition: LArElectrodeID.cxx:393
LArElectrodeID::initLevelsFromDict
int initLevelsFromDict(void)
Definition: LArElectrodeID.cxx:194
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
LArElectrodeID::m_hvphi_impl
IdDictFieldImplementation m_hvphi_impl
Definition: LArElectrodeID.h:285
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
LArElectrodeID
Helper for the Liquid Argon Calorimeter cell at the electrode level.
Definition: LArElectrodeID.h:101
LArElectrodeID::ElectrodeId
HWIdentifier ElectrodeId(int det, int side, int mod, int phi, int eta, int gap, int elec) const
Create an Electrode identifier from fields.
Definition: LArElectrodeID.h:306
LArElectrodeID::LArElectrodeID
LArElectrodeID(void)
Default constructor.
Definition: LArElectrodeID.cxx:18
LArOnlID_Exception.h
Range.h
skel.it
it
Definition: skel.GENtoEVGEN.py:423
LArElectrodeID::m_hveta_index
size_type m_hveta_index
Definition: LArElectrodeID.h:269
LArElectrodeID::m_atlas_impl
IdDictFieldImplementation m_atlas_impl
Field Implementation.
Definition: LArElectrodeID.h:280
ExpandedIdentifier
Definition: DetectorDescription/Identifier/Identifier/ExpandedIdentifier.h:108
LArElectrodeID::electrodeHash
IdentifierHash electrodeHash(HWIdentifier electrode_id) const
Create an electrode hash identifier from an electrode identifier.
Definition: LArElectrodeID.h:331
LArElectrodeID::isEMBPUR
bool isEMBPUR(const HWIdentifier id) const
Return yes if electrode is in EMB PUR.
Definition: LArElectrodeID.h:477
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:562
LArElectrodeID::isFCAL1
bool isFCAL1(const HWIdentifier id) const
Return yes if electrode is in FCAL wheel 1.
Definition: LArElectrodeID.h:436
LArElectrodeID::m_configuration_impl
IdDictFieldImplementation m_configuration_impl
Definition: LArElectrodeID.h:281
HWIdentifier
Definition: HWIdentifier.h:13
LArElectrodeID::electrode_hash_binary_search
IdentifierHash electrode_hash_binary_search(HWIdentifier elecId) const
CaloSwCorrections.gap
def gap(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:212
LArElectrodeID::m_electrodeHashMax
size_type m_electrodeHashMax
Definition: LArElectrodeID.h:276
LArElectrodeID::isFCAL2
bool isFCAL2(const HWIdentifier id) const
Return yes if electrode is in FCAL wheel 2.
Definition: LArElectrodeID.h:450
LArElectrodeID::isFCAL3
bool isFCAL3(const HWIdentifier id) const
Return yes if electrode is in FCAL wheel 3.
Definition: LArElectrodeID.h:463
LArElectrodeID::m_hvgap_impl
IdDictFieldImplementation m_hvgap_impl
Definition: LArElectrodeID.h:287
LArElectrodeID::isEMECinWHEEL
bool isEMECinWHEEL(const HWIdentifier id) const
Return yes if electrode is in EMEC inner wheel.
Definition: LArElectrodeID.h:512
TRT::Hit::detector
@ detector
Definition: HitInfo.h:78
LArElectrodeID::m_zside_index
size_type m_zside_index
Definition: LArElectrodeID.h:266
TRT::Hit::side
@ side
Definition: HitInfo.h:83
IdDictDefs.h
LArElectrodeID::m_full_electrode_range
MultiRange m_full_electrode_range
Definition: LArElectrodeID.h:275
LArElectrodeID::m_larElectrodeRegion_index
size_type m_larElectrodeRegion_index
Definition: LArElectrodeID.h:261
AtlasDetectorID::size_type
Identifier::size_type size_type
Definition: AtlasDetectorID.h:384
LArElectrodeID::electrode
int electrode(const HWIdentifier id) const
Return an integer corresponding to the electrode number of an hardware electrode identifier.
Definition: LArElectrodeID.h:398
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
LArElectrodeID::~LArElectrodeID
~LArElectrodeID(void)
Default destructor.
maskDeadModules.mod
mod
Definition: maskDeadModules.py:36
LArElectrodeID::size_type
Identifier::size_type size_type
Definition: LArElectrodeID.h:105
LArElectrodeID::zside
int zside(const HWIdentifier id) const
Return an integer corresponding to the side of an hardware electrode identifier.
Definition: LArElectrodeID.h:367
LArElectrodeID::isHEC
bool isHEC(const HWIdentifier id) const
Return yes if electrode is in HEC.
Definition: LArElectrodeID.h:409
LArElectrodeID::isEMECoutWHEEL
bool isEMECoutWHEEL(const HWIdentifier id) const
Return yes if electrode is in EMEC outer wheel.
Definition: LArElectrodeID.h:521
WritePulseShapeToCool.det
det
Definition: WritePulseShapeToCool.py:204
LArElectrodeID::module
int module(const HWIdentifier id) const
Return an integer corresponding to the module of an hardware electrode identifier.
Definition: LArElectrodeID.h:374
LArElectrodeID::m_larelectrode_index
size_type m_larelectrode_index
Definition: LArElectrodeID.h:262
LArElectrodeID::electrodeHashMax
size_type electrodeHashMax(void) const
Define hash tables max size.
Definition: LArElectrodeID.h:341
LArElectrodeID::detector
int detector(const HWIdentifier id) const
Return an integer corresponding to the detector of an hardware electrode identifier.
Definition: LArElectrodeID.h:361
LArElectrodeID::m_atlas_index
size_type m_atlas_index
Definition: LArElectrodeID.h:263
LArElectrodeID::m_hvphi_index
size_type m_hvphi_index
Definition: LArElectrodeID.h:268
LArElectrodeID::NOT_VALID_HASH
@ NOT_VALID_HASH
Definition: LArElectrodeID.h:245
LArElectrodeID::m_configuration_index
size_type m_configuration_index
Definition: LArElectrodeID.h:264
LArElectrodeID::gap
int gap(const HWIdentifier id) const
Return an integer corresponding to the cell gap of an hardware electrode identifier.
Definition: LArElectrodeID.h:392
MultiRange
A MultiRange combines several Ranges.
Definition: DetectorDescription/Identifier/Identifier/Range.h:351
HWIdentifier.h
LArElectrodeID::m_detector_impl
IdDictFieldImplementation m_detector_impl
Definition: LArElectrodeID.h:282
IdentifierHash.h
LArElectrodeID::initialize_from_dictionary
virtual int initialize_from_dictionary(const IdDictMgr &dict_mgr)
Initialization from the identifier dictionary.
Definition: LArElectrodeID.cxx:47
LArElectrodeID::m_dict
const IdDictDictionary * m_dict
Definition: LArElectrodeID.h:273
LArElectrodeID::m_detector_index
size_type m_detector_index
Definition: LArElectrodeID.h:265
LArElectrodeID::hv_eta
int hv_eta(const HWIdentifier id) const
Return an integer corresponding to the high volatge eta sector of an hardware electrode identifier.
Definition: LArElectrodeID.h:386
LArElectrodeID::get_expanded_id
int get_expanded_id(const HWIdentifier &id, ExpandedIdentifier &exp_id, const IdContext *context) const
Definition: LArElectrodeID.cxx:169
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
LArElectrodeID::m_electrode_vec
std::vector< HWIdentifier > m_electrode_vec
Definition: LArElectrodeID.h:277
LArElectrodeID::isFCAL
bool isFCAL(const HWIdentifier id) const
Return yes if electrode is in FCAL.
Definition: LArElectrodeID.h:423
LArElectrodeID::isEMEC
bool isEMEC(const HWIdentifier id) const
Return yes if electrode is in EMEC.
Definition: LArElectrodeID.h:504
LArElectrodeID::electrode_end
std::vector< HWIdentifier >::const_iterator electrode_end(void) const
Definition: LArElectrodeID.h:354
LArElectrodeID::m_electrode_impl
IdDictFieldImplementation m_electrode_impl
Definition: LArElectrodeID.h:288
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
LArElectrodeID::electrodeContext
IdContext electrodeContext(void) const
Define feedthrough Context.
Definition: LArElectrodeID.cxx:39
LArElectrodeID::electrode_begin
std::vector< HWIdentifier >::const_iterator electrode_begin(void) const
Return an iterator pointing to a collection of electrode identifiers.
Definition: LArElectrodeID.h:348
LArElectrodeID::hv_phi
int hv_phi(const HWIdentifier id) const
Return an integer corresponding to the high voltage phi sector of an hardware electrode identifier.
Definition: LArElectrodeID.h:380
LArElectrodeID::isEMBPS
bool isEMBPS(const HWIdentifier id) const
Return yes if electrode is in EMBPS.
Definition: LArElectrodeID.h:562
Identifier::size_type
IDENTIFIER_TYPE size_type
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:41
LArElectrodeID::m_electrode_index
size_type m_electrode_index
Definition: LArElectrodeID.h:271
IdDictFieldImplementation
IdDictFieldImplementation is used to capture the specification of a single field of an Identifier.
Definition: IdDictFieldImplementation.h:58
IdentifierHash
Definition: IdentifierHash.h:38
LArElectrodeID::isECPUR
bool isECPUR(const HWIdentifier id) const
Return yes if electrode is in EC PUR.
Definition: LArElectrodeID.h:490
LArElectrodeID::m_zside_impl
IdDictFieldImplementation m_zside_impl
Definition: LArElectrodeID.h:283
LArElectrodeID::m_module_impl
IdDictFieldImplementation m_module_impl
Definition: LArElectrodeID.h:284
IdContext
class IdContext
Definition: IdContext.h:34
LArElectrodeID::m_full_larelectrode_range
MultiRange m_full_larelectrode_range
Definition: LArElectrodeID.h:274
CLASS_DEF.h
macros to associate a CLID to a type
LArElectrodeID::m_module_index
size_type m_module_index
Definition: LArElectrodeID.h:267
AtlasDetectorID
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
Definition: AtlasDetectorID.h:57
LArElectrodeID::m_hvgap_index
size_type m_hvgap_index
Definition: LArElectrodeID.h:270
LArElectrodeID::isEMB
bool isEMB(const HWIdentifier id) const
Return boolean yes if electrode is in EMB.
Definition: LArElectrodeID.h:548