ATLAS Offline Software
Loading...
Searching...
No Matches
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
31namespace 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
static Double_t ss
unsigned int m_d
Definition L1PSNumber.h:37
static int64_t makeLong(unsigned int n, unsigned int m, unsigned int d)
Returns the POSITIVE int64_t of 3 ints.
std::string write()
Writes nicely the ps value.
static const uint32_t NMASK
Definition L1PSNumber.h:42
void setInt64(const int64_t tmpLong)
Sets the N,M,D values from a Int64_t prescale value.
unsigned int m_n
Definition L1PSNumber.h:35
int getSign() const
Definition L1PSNumber.h:75
unsigned int getD() const
Definition L1PSNumber.h:74
int getInt32() const
Definition L1PSNumber.h:78
static const int MSHIFT
Definition L1PSNumber.h:45
static const uint32_t MMASK
Definition L1PSNumber.h:43
static const int s_auxLength
Definition L1PSNumber.h:55
int64_t getInt64() const
Definition L1PSNumber.h:77
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.
static const unsigned int s_psAuxValues[79][2]
Help array containing the allowed MD combinations (for N=1).
Definition L1PSNumber.h:56
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.
unsigned int getN() const
Definition L1PSNumber.h:72
unsigned int m_m
Definition L1PSNumber.h:36
static const int DSHIFT
Definition L1PSNumber.h:46
static const uint32_t DMASK
Definition L1PSNumber.h:44
unsigned int getM() const
Definition L1PSNumber.h:73
static int64_t decodeFloat(const float psF)
Calculates the NMD combination nearest to psF.
float getFloatPrescale() const
Definition L1PSNumber.h:76
Forward iterator to traverse the main components of the trigger configuration.
Definition Config.h:22