ATLAS Offline Software
L1PSNumber.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 //
7 //NAME: L1PSNumber.h
8 //PACKAGE: TrigConfL1Data
9 //
10 //AUTHOR: Tiago Perez (DESY) Tiago.Perez@desy.de
11 //CREATED: 19. Feb. 2010, 11:18 AM
12 //
13 //PURPOSE: Auxiliar class to handle factional prescales. This class holds the
14 // 3 numbers needed to describe a fractional prescale as S. Haas and D. Berge
15 // defined them.
16 // Typically the constructor:
17 // L1PSNumber(int64_t) from DB
18 // L1PSNumber(float) or L1PSNumber(n,m,d) form XML
19 // will be calledd and after that we can "get" the appropriate numbers
20 // for the different arrays.
21 // CERN
23 
24 #ifndef TrigConf_L1PSNumber
25 #define TrigConf_L1PSNumber
26 
27 #include <iosfwd>
28 #include <string>
29 #include <stdint.h>
30 
31 namespace TrigConf {
32 
33  class L1PSNumber {
34  private:
35  unsigned int m_n;
36  unsigned int m_m;
37  unsigned int m_d;
38  int m_s;
39  float m_psFloat;
40  int64_t m_psLong;
41  // CONSTANT MASKs
42  static const uint32_t NMASK = 0x00FFFFFF;
43  static const uint32_t MMASK = 0xF0000000;
44  static const uint32_t DMASK = 0x0F000000;
45  static const int MSHIFT = 28;
46  static const int DSHIFT = 24;
47  // private methods.
48  bool validate(const int nn, const unsigned int mm,
49  const unsigned int dd, const int ss);
50  void setInt64(const int64_t tmpLong);
51 
52  static int64_t makeLong(unsigned int n, unsigned int m, unsigned int d);
53 
54  // private constant for decoding floats
55  static const int s_auxLength = 79;
56  static const unsigned int s_psAuxValues[79][2];
57 
58  public:
59  L1PSNumber();
60  L1PSNumber(const float ps);
61  L1PSNumber(const int64_t ps);
62  L1PSNumber(const int ps);
63  L1PSNumber(const int nn, const unsigned int mm,
64  unsigned const int dd, const int ss);
65 
66  static int64_t decodeFloat(const float psF);
67  static int64_t encodeNMD(const int nn, const unsigned int mm,
68  const unsigned int dd);
69  std::string write();
70 
71  // Getters
72  unsigned int getN() const { return m_n; };
73  unsigned int getM() const { return m_m; };
74  unsigned int getD() const { return m_d; };
75  int getSign() const { return m_s; };
76  float getFloatPrescale() const { return m_psFloat; };
77  int64_t getInt64() const { return m_psLong; };
78  int getInt32() const { return m_n*m_s; };
79 
80  };
81 }
82 
83 #endif /* TRIGCONFPRESCALESETL1PSNUMBER */
84 
TrigConf::L1PSNumber::s_auxLength
static const int s_auxLength
Definition: L1PSNumber.h:55
TrigConf::L1PSNumber::getFloatPrescale
float getFloatPrescale() const
Definition: L1PSNumber.h:76
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
TrigConf::L1PSNumber::getN
unsigned int getN() const
Definition: L1PSNumber.h:72
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
hist_file_dump.d
d
Definition: hist_file_dump.py:137
TrigConf::L1PSNumber::MMASK
static const uint32_t MMASK
Definition: L1PSNumber.h:43
TrigConf::L1PSNumber::s_psAuxValues
static const unsigned int s_psAuxValues[79][2]
Help array containing the allowed MD combinations (for N=1).
Definition: L1PSNumber.h:56
TrigConf::L1PSNumber::m_s
int m_s
Definition: L1PSNumber.h:38
TrigConf::L1PSNumber::setInt64
void setInt64(const int64_t tmpLong)
Sets the N,M,D values from a Int64_t prescale value.
Definition: L1PSNumber.cxx:124
TrigConf::L1PSNumber::m_psLong
int64_t m_psLong
Definition: L1PSNumber.h:40
TrigConf
Forward iterator to traverse the main components of the trigger configuration.
Definition: Config.h:22
TrigConf::L1PSNumber::getM
unsigned int getM() const
Definition: L1PSNumber.h:73
TrigConf::L1PSNumber::m_m
unsigned int m_m
Definition: L1PSNumber.h:36
TrigConf::L1PSNumber::m_psFloat
float m_psFloat
Definition: L1PSNumber.h:39
beamspotman.n
n
Definition: beamspotman.py:731
TrigConf::L1PSNumber::DMASK
static const uint32_t DMASK
Definition: L1PSNumber.h:44
TrigConf::L1PSNumber
Definition: L1PSNumber.h:33
TrigConf::L1PSNumber::m_n
unsigned int m_n
Definition: L1PSNumber.h:35
TrigConf::L1PSNumber::L1PSNumber
L1PSNumber()
Definition: L1PSNumber.cxx:31
TrigConf::L1PSNumber::write
std::string write()
Writes nicely the ps value.
Definition: L1PSNumber.cxx:153
TrigConf::L1PSNumber::encodeNMD
static int64_t encodeNMD(const int nn, const unsigned int mm, const unsigned int dd)
Returns INT64_T prescale number with the correct sign as it is stored in DB.
Definition: L1PSNumber.cxx:207
library_scraper.dd
list dd
Definition: library_scraper.py:46
python.SystemOfUnits.mm
int mm
Definition: SystemOfUnits.py:83
TrigConf::L1PSNumber::MSHIFT
static const int MSHIFT
Definition: L1PSNumber.h:45
TrigConf::L1PSNumber::m_d
unsigned int m_d
Definition: L1PSNumber.h:37
TrigConf::L1PSNumber::decodeFloat
static int64_t decodeFloat(const float psF)
Calculates the NMD combination nearest to psF.
Definition: L1PSNumber.cxx:167
TrigConf::L1PSNumber::getSign
int getSign() const
Definition: L1PSNumber.h:75
TrigConf::L1PSNumber::NMASK
static const uint32_t NMASK
Definition: L1PSNumber.h:42
TrigConf::L1PSNumber::getD
unsigned int getD() const
Definition: L1PSNumber.h:74
TrigConf::L1PSNumber::validate
bool validate(const int nn, const unsigned int mm, const unsigned int dd, const int ss)
Checks whether the m_n,m_m,m_d combination is valid, i.e.
Definition: L1PSNumber.cxx:93
TrigConf::L1PSNumber::makeLong
static int64_t makeLong(unsigned int n, unsigned int m, unsigned int d)
Returns the POSITIVE int64_t of 3 ints.
Definition: L1PSNumber.cxx:228
TrigConf::L1PSNumber::getInt32
int getInt32() const
Definition: L1PSNumber.h:78
TrigConf::L1PSNumber::getInt64
int64_t getInt64() const
Definition: L1PSNumber.h:77
TrigConf::L1PSNumber::DSHIFT
static const int DSHIFT
Definition: L1PSNumber.h:46