ATLAS Offline Software
Loading...
Searching...
No Matches
TrigConf::PrescaleSet Class Reference

#include <PrescaleSet.h>

Inheritance diagram for TrigConf::PrescaleSet:
Collaboration diagram for TrigConf::PrescaleSet:

Public Member Functions

 PrescaleSet ()
virtual ~PrescaleSet () override=default
bool isNull () const
bool newPrescaleStyle () const
const std::string & type () const
unsigned int partition () const
const std::vector< int > & prescales () const __attribute__((deprecated))
const std::vector< int64_t > & prescales_ctp () const
const std::vector< float > & prescales_float () const
const std::vector< int32_t > & cuts () const
void setNewPrescaleStyle (bool newstyle=true)
void setType (const std::string &type)
void setPartition (unsigned int partition)
void resize (size_t size)
void setPrescales (const std::vector< int64_t > &) __attribute__((deprecated))
 DEPRECATED.
void setPrescales (const int64_t p[], unsigned int size) __attribute__((deprecated))
 DEPRECATED.
void setPrescales (const int p[], unsigned int size) __attribute__((deprecated))
 Sets the prescales from a vector of int32.
void setPrescale (unsigned int num, int64_t prescaleValue) __attribute__((deprecated))
 Set the prescale NUM from the int64 value prescaleValue.
void setPrescale (unsigned int num, int prescaleValue) __attribute__((deprecated))
 Cast int prescaleValue to int64 and call setPrescale(int, int64).
void setPrescale (unsigned int num, float prescaleValue)
void setCuts (const std::vector< int32_t > &cuts)
void setCut (unsigned int num, int32_t cut)
void reset ()
virtual void print (const std::string &indent="", unsigned int detail=1) const override
void writeXML (std::ostream &xmlfile, int indentLevel=0, int indentWidth=2) const
 Writes the Prescale item to the XML file.
unsigned int lvl1MasterTableId () const
void setLvl1MasterTableId (unsigned int id)
int superMasterTableId () const
unsigned int smk () const
unsigned int id () const
const std::string & name () const
const std::string & comment () const
unsigned int version () const
void setSuperMasterTableId (int id)
void setSMK (int id)
void setId (unsigned int id)
void setName (const std::string &name)
void setVersion (unsigned int version)
void setComment (const std::string &c)
void printNameIdV (const std::string &indent="") const
virtual std::string __str__ () const

Static Public Member Functions

static int32_t getCutFromPrescale (double prescale)
 calculate cut value for hardware configuration cut = 2*24/prescale - 1
static double getPrescaleFromCut (int32_t cut)
 prescale = 2*24/(cut+1.)

Static Public Attributes

static const int32_t maxPrescaleCut = 0xFFFFFF

Protected Member Functions

std::ostream & indent (std::ostream &o, int lvl, int size) const

Private Attributes

bool m_null
bool m_newPrescales
std::string m_Type
unsigned int m_Partition
std::vector< int > m_Prescales
std::vector< int64_t > m_Prescales_ctp
std::vector< float > m_Prescales_float
std::vector< int32_t > m_Cuts
unsigned int m_Lvl1MasterId
unsigned int m_smk
unsigned int m_id
std::string m_name
unsigned int m_version
std::string m_comment

Detailed Description

Definition at line 22 of file PrescaleSet.h.

Constructor & Destructor Documentation

◆ PrescaleSet()

TrigConf::PrescaleSet::PrescaleSet ( )

Definition at line 59 of file PrescaleSet.cxx.

59 :
61 m_null(true),
62 m_newPrescales(true),
63 m_Type("Physics"),
64 m_Partition(0),
68 m_Cuts()
69{}
std::vector< int32_t > m_Cuts
Definition PrescaleSet.h:79
unsigned int m_Partition
Definition PrescaleSet.h:75
std::vector< float > m_Prescales_float
Definition PrescaleSet.h:78
std::vector< int > m_Prescales
Definition PrescaleSet.h:76
std::vector< int64_t > m_Prescales_ctp
Definition PrescaleSet.h:77

◆ ~PrescaleSet()

virtual TrigConf::PrescaleSet::~PrescaleSet ( )
overridevirtualdefault

Member Function Documentation

◆ __str__()

string TrigConfData::__str__ ( ) const
virtualinherited

Reimplemented in TrigConf::HLTChain, TrigConf::HLTPrescaleSet, TrigConf::HLTSequence, and TrigConf::TriggerItem.

Definition at line 50 of file TrigConfData.cxx.

50 {
51 stringstream s;
52 s << *this;
53 return s.str();
54}

◆ comment()

const std::string & TrigConf::TrigConfData::comment ( ) const
inlineinherited

Definition at line 23 of file TrigConfData.h.

23{return m_comment;}

◆ cuts()

const std::vector< int32_t > & TrigConf::PrescaleSet::cuts ( ) const
inline

Definition at line 44 of file PrescaleSet.h.

44{ return m_Cuts; }

◆ getCutFromPrescale()

int32_t PrescaleSet::getCutFromPrescale ( double prescale)
static

calculate cut value for hardware configuration cut = 2*24/prescale - 1

prescale = 1 --> C = 2*24-1 prescale = 2 --> C = 2*23-1 prescale = 10 --> C = 1677720 prescale = 1024 --> C = 2*14-1 prescale = 50 --> C = 335543 prescale = 500 --> C = 33553 prescale = 5000 --> C = 3354 prescale = 50000 --> C = 334

Definition at line 33 of file PrescaleSet.cxx.

33 {
34 int32_t sign = prescale<0 ? -1 : 1;
35 double uprescale = fabs(prescale);
36 return sign * ( 0x1000000 - int32_t(0xFFFFFF/uprescale));
37}
int sign(int a)

◆ getPrescaleFromCut()

double PrescaleSet::getPrescaleFromCut ( int32_t cut)
static

prescale = 2*24/(cut+1.)

cut = 2*24-1 --> prescale = 1 cut = 2*23-1 --> prescale = 2 cut = 1677720 --> prescale = 10.000002980233305 cut = 2*14-1 --> prescale = 1024 cut = 335543 --> prescale = 50.0000447035 cut = 33553 --> prescale = 500.006407582 cut = 3354 --> prescale = 5000.66020864
cut = 334 --> prescale = 50081.238806

Definition at line 52 of file PrescaleSet.cxx.

52 {
53 double sign = cut<0 ? -1 : 1;
54 uint32_t ucut = abs(cut);
55 return (sign * 0xFFFFFF ) / ( 0x1000000 - ucut );
56}
cut
This script demonstrates how to call a C++ class from Python Also how to use PyROOT is shown.
setEventNumber uint32_t

◆ id()

unsigned int TrigConf::TrigConfData::id ( ) const
inlineinherited

Definition at line 21 of file TrigConfData.h.

21{return m_id;}

◆ indent()

std::ostream & TrigConfData::indent ( std::ostream & o,
int lvl,
int size ) const
protectedinherited

Definition at line 23 of file TrigConfData.cxx.

23 {
24 int width = lvl*size;
25 if(width==0) return o;
26 o << setw(lvl*size) << " ";
27 return o;
28}
const double width

◆ isNull()

bool TrigConf::PrescaleSet::isNull ( ) const
inline

Definition at line 37 of file PrescaleSet.h.

37{ return m_null; }

◆ lvl1MasterTableId()

unsigned int TrigConf::L1DataBaseclass::lvl1MasterTableId ( ) const
inlineinherited

Definition at line 30 of file L1DataBaseclass.h.

30{ return m_Lvl1MasterId; }

◆ name()

const std::string & TrigConf::TrigConfData::name ( ) const
inlineinherited

Definition at line 22 of file TrigConfData.h.

22{return m_name;}

◆ newPrescaleStyle()

bool TrigConf::PrescaleSet::newPrescaleStyle ( ) const
inline

Definition at line 38 of file PrescaleSet.h.

38{ return m_newPrescales; }

◆ partition()

unsigned int TrigConf::PrescaleSet::partition ( ) const
inline

Definition at line 40 of file PrescaleSet.h.

40{ return m_Partition; }

◆ prescales()

const std::vector< int > & TrigConf::PrescaleSet::prescales ( ) const
inline

Definition at line 41 of file PrescaleSet.h.

41{ return m_Prescales; }

◆ prescales_ctp()

const std::vector< int64_t > & TrigConf::PrescaleSet::prescales_ctp ( ) const
inline

Definition at line 42 of file PrescaleSet.h.

42{ return m_Prescales_ctp; }

◆ prescales_float()

const std::vector< float > & TrigConf::PrescaleSet::prescales_float ( ) const
inline

Definition at line 43 of file PrescaleSet.h.

43{ return m_Prescales_float; }

◆ print()

void TrigConf::PrescaleSet::print ( const std::string & indent = "",
unsigned int detail = 1 ) const
overridevirtual

Implements TrigConf::TrigConfData.

Definition at line 197 of file PrescaleSet.cxx.

197 {
198 if(detail>=1) {
199 cout << indent << "PrescaleSet ";
200 printNameIdV("");
201 if(detail>=3) {
202 int i(0);
203 for( auto ps: m_Prescales_float)
204 cout << indent << " ctpid=" << i++ << ": " << " prescale=" << ps << endl;
205 }
206 }
207}
std::ostream & indent(std::ostream &o, int lvl, int size) const
void printNameIdV(const std::string &indent="") const

◆ printNameIdV()

void TrigConfData::printNameIdV ( const std::string & indent = "") const
inherited

Definition at line 31 of file TrigConfData.cxx.

31 {
32 cout << indent << name();
33 if(id()>0 || version()>0)
34 cout << " (id=" << id() << "/v=" << version() << ")";
35 cout << endl;
36 if(comment()!="")
37 cout << indent << "Comment: " << comment() << endl;
38}
unsigned int id() const
const std::string & name() const
const std::string & comment() const
unsigned int version() const

◆ reset()

void TrigConf::PrescaleSet::reset ( )

Definition at line 71 of file PrescaleSet.cxx.

71 {
72 for(auto& x: m_Prescales) x=-1;
73 for(auto& x: m_Prescales_ctp) x=-1;
74 for(auto& x: m_Prescales_float) x=-1;
75 for(auto& x: m_Cuts) x=-maxPrescaleCut;
76 m_null = true;
77}
#define x
static const int32_t maxPrescaleCut
Definition PrescaleSet.h:27

◆ resize()

void TrigConf::PrescaleSet::resize ( size_t size)

Definition at line 80 of file PrescaleSet.cxx.

80 {
81 m_Prescales.resize(size,-1);
82 m_Prescales_ctp.resize(size,-1);
83 m_Prescales_float.resize(size,-1);
84 m_Cuts.resize(size,2<<10);
85 //m_Cuts.resize(size,-maxPrescaleCut);
86}

◆ setComment()

void TrigConf::TrigConfData::setComment ( const std::string & c)
inlineinherited

Definition at line 32 of file TrigConfData.h.

◆ setCut()

void TrigConf::PrescaleSet::setCut ( unsigned int num,
int32_t cut )

Definition at line 96 of file PrescaleSet.cxx.

96 {
97 m_Cuts[ctpid] = cut;
98
99 const float ps_f = getPrescaleFromCut(cut);
100 m_Prescales_float[ctpid] = ps_f;
101
102 const int sign = ps_f<0 ? -1 : 1;
103 int ps = sign * static_cast<int>(fabs(ps_f)+0.5);
104
105 m_Prescales[ctpid] = ps;
106
107 m_null = false;
108}
static double getPrescaleFromCut(int32_t cut)
prescale = 2*24/(cut+1.)

◆ setCuts()

void TrigConf::PrescaleSet::setCuts ( const std::vector< int32_t > & cuts)

Definition at line 89 of file PrescaleSet.cxx.

89 {
90 for(unsigned int ctpid = 0; ctpid < cuts.size(); ++ctpid )
91 setCut(ctpid, cuts[ctpid]);
92}
void setCut(unsigned int num, int32_t cut)
const std::vector< int32_t > & cuts() const
Definition PrescaleSet.h:44

◆ setId()

void TrigConf::TrigConfData::setId ( unsigned int id)
inlineinherited

Definition at line 29 of file TrigConfData.h.

29{ m_id=id; }

◆ setLvl1MasterTableId()

void TrigConf::L1DataBaseclass::setLvl1MasterTableId ( unsigned int id)
inlineinherited

Definition at line 31 of file L1DataBaseclass.h.

31{ m_Lvl1MasterId = id; }

◆ setName()

void TrigConf::TrigConfData::setName ( const std::string & name)
inlineinherited

Definition at line 30 of file TrigConfData.h.

30{ m_name = name;}

◆ setNewPrescaleStyle()

void TrigConf::PrescaleSet::setNewPrescaleStyle ( bool newstyle = true)
inline

Definition at line 47 of file PrescaleSet.h.

47{ m_newPrescales = newstyle; }

◆ setPartition()

void TrigConf::PrescaleSet::setPartition ( unsigned int partition)
inline

Definition at line 49 of file PrescaleSet.h.

unsigned int partition() const
Definition PrescaleSet.h:40

◆ setPrescale() [1/3]

void TrigConf::PrescaleSet::setPrescale ( unsigned int num,
float prescaleValue )

Definition at line 187 of file PrescaleSet.cxx.

187 {
188 int32_t cut = getCutFromPrescale(prescaleValue);
191 m_Prescales_float[num] = prescaleValue;
192 m_null = false;
193}
static int32_t getCutFromPrescale(double prescale)
calculate cut value for hardware configuration cut = 2*24/prescale - 1

◆ setPrescale() [2/3]

void TrigConf::PrescaleSet::setPrescale ( unsigned int num,
int prescaleValue )

Cast int prescaleValue to int64 and call setPrescale(int, int64).

Definition at line 178 of file PrescaleSet.cxx.

178 {
179 m_Prescales_ctp[num] = (int64_t) prescaleValue;
180 TrigConf::L1PSNumber l1ps = TrigConf::L1PSNumber((int64_t)prescaleValue);
181 m_Prescales[num] = l1ps.getInt32();
183 m_null = false;
184}
int getInt32() const
Definition L1PSNumber.h:78
float getFloatPrescale() const
Definition L1PSNumber.h:76

◆ setPrescale() [3/3]

void TrigConf::PrescaleSet::setPrescale ( unsigned int num,
int64_t prescaleValue )

Set the prescale NUM from the int64 value prescaleValue.

DEPRECATED

Definition at line 166 of file PrescaleSet.cxx.

166 {
167 TrigConf::L1PSNumber l1ps = TrigConf::L1PSNumber(prescaleValue);
168 m_Prescales[num] = l1ps.getInt32();
169 m_Prescales_ctp[num] = prescaleValue;
171 m_null = false;
172}

◆ setPrescales() [1/3]

void TrigConf::PrescaleSet::setPrescales ( const int p[],
unsigned int size )

Sets the prescales from a vector of int32.

DEPRECATED

Definition at line 149 of file PrescaleSet.cxx.

149 {
150 TrigConf::L1PSNumber l1ps;
151 for (unsigned int i = 0; i < size; i++) {
152 m_Prescales_ctp[i] = (int64_t) p[i];
153 l1ps = TrigConf::L1PSNumber((int64_t)p[i]);
154 m_Prescales[i] = l1ps.getInt32();
156 }
157 m_null = false;
158}

◆ setPrescales() [2/3]

void TrigConf::PrescaleSet::setPrescales ( const int64_t p[],
unsigned int size )

DEPRECATED.

Definition at line 132 of file PrescaleSet.cxx.

132 {
133 TrigConf::L1PSNumber l1ps;
134 for (unsigned int i = 0; i < size; ++i) {
135 m_Prescales_ctp[i] = p[i];
136 l1ps = TrigConf::L1PSNumber(p[i]);
137 m_Prescales[i] = l1ps.getInt32();
139 }
140 m_null = false;
141}

◆ setPrescales() [3/3]

void TrigConf::PrescaleSet::setPrescales ( const std::vector< int64_t > & prescales)

DEPRECATED.

Definition at line 115 of file PrescaleSet.cxx.

115 {
117 TrigConf::L1PSNumber l1ps;
118 unsigned int i(0);
119 for (auto ps: m_Prescales_ctp) {
120 l1ps = TrigConf::L1PSNumber(ps);
121 m_Prescales[i] = l1ps.getInt32();
123 i++;
124 }
125 m_null = false;
126}
const std::vector< int > & prescales() const __attribute__((deprecated))
Definition PrescaleSet.h:41

◆ setSMK()

void TrigConf::TrigConfData::setSMK ( int id)
inlineinherited

Definition at line 28 of file TrigConfData.h.

28{m_smk=id;}

◆ setSuperMasterTableId()

void TrigConf::TrigConfData::setSuperMasterTableId ( int id)
inlineinherited

Definition at line 27 of file TrigConfData.h.

27{m_smk=id;}

◆ setType()

void TrigConf::PrescaleSet::setType ( const std::string & type)
inline

Definition at line 48 of file PrescaleSet.h.

48{ m_Type = type; }
const std::string & type() const
Definition PrescaleSet.h:39

◆ setVersion()

void TrigConf::TrigConfData::setVersion ( unsigned int version)
inlineinherited

Definition at line 31 of file TrigConfData.h.

◆ smk()

unsigned int TrigConf::TrigConfData::smk ( ) const
inlineinherited

Definition at line 20 of file TrigConfData.h.

20{return m_smk;}

◆ superMasterTableId()

int TrigConf::TrigConfData::superMasterTableId ( ) const
inlineinherited

Definition at line 19 of file TrigConfData.h.

19{return (int)m_smk;}

◆ type()

const std::string & TrigConf::PrescaleSet::type ( ) const
inline

Definition at line 39 of file PrescaleSet.h.

39{ return m_Type; }

◆ version()

unsigned int TrigConf::TrigConfData::version ( ) const
inlineinherited

Definition at line 24 of file TrigConfData.h.

24{return m_version;}

◆ writeXML()

void TrigConf::PrescaleSet::writeXML ( std::ostream & xmlfile,
int indentLevel = 0,
int indentWidth = 2 ) const

Writes the Prescale item to the XML file.

Definition at line 213 of file PrescaleSet.cxx.

213 {
214 L1PSNumber psOut;
215 indent(xmlfile, indentLevel, indentWidth)
216 << "<PrescaleSet"
217 << " name=\"" << name() << "\""
218 << " type=\"" << type() << "\""
219 << " menuPartition=\"" << partition() << "\">"
220 << endl;
221
222 if(newPrescaleStyle()) {
223 int ctpid(0);
224 for (int32_t cut: m_Cuts) {
225 indent(xmlfile, indentLevel + 1, indentWidth)
226 << "<Prescale ctpid=\"" << ctpid++
227 << "\" cut=\"" << (cut<0?"-":"") << hex << setfill('0') << setw(6) << abs(cut) << setfill(' ') << dec
228 << "\" value=\"" << getPrescaleFromCut(cut)
229 << "\"/>" << endl;
230 }
231 } else {
232 int i(0);
233 for (auto& ps: m_Prescales_ctp) {
234 psOut = L1PSNumber(ps);
235 indent(xmlfile, indentLevel + 1, indentWidth)
236 << "<Prescale ctpid=\"" << i++ << "\" ps=\"" << psOut.write() << "\"/>" << endl;
237 }
238 }
239 indent(xmlfile, indentLevel, indentWidth)
240 << "</PrescaleSet>" << endl;
241}
std::string write()
Writes nicely the ps value.
bool newPrescaleStyle() const
Definition PrescaleSet.h:38
static std::vector< std::string > xmlfile
Definition iLumiCalc.h:29

Member Data Documentation

◆ m_comment

std::string TrigConf::TrigConfData::m_comment
privateinherited

Definition at line 48 of file TrigConfData.h.

◆ m_Cuts

std::vector<int32_t> TrigConf::PrescaleSet::m_Cuts
private

Definition at line 79 of file PrescaleSet.h.

◆ m_id

unsigned int TrigConf::TrigConfData::m_id
privateinherited

Definition at line 45 of file TrigConfData.h.

◆ m_Lvl1MasterId

unsigned int TrigConf::L1DataBaseclass::m_Lvl1MasterId
privateinherited

Definition at line 35 of file L1DataBaseclass.h.

◆ m_name

std::string TrigConf::TrigConfData::m_name
privateinherited

Definition at line 46 of file TrigConfData.h.

◆ m_newPrescales

bool TrigConf::PrescaleSet::m_newPrescales
private

Definition at line 72 of file PrescaleSet.h.

◆ m_null

bool TrigConf::PrescaleSet::m_null
private

Definition at line 70 of file PrescaleSet.h.

◆ m_Partition

unsigned int TrigConf::PrescaleSet::m_Partition
private

Definition at line 75 of file PrescaleSet.h.

◆ m_Prescales

std::vector<int> TrigConf::PrescaleSet::m_Prescales
private

Definition at line 76 of file PrescaleSet.h.

◆ m_Prescales_ctp

std::vector<int64_t> TrigConf::PrescaleSet::m_Prescales_ctp
private

Definition at line 77 of file PrescaleSet.h.

◆ m_Prescales_float

std::vector<float> TrigConf::PrescaleSet::m_Prescales_float
private

Definition at line 78 of file PrescaleSet.h.

◆ m_smk

unsigned int TrigConf::TrigConfData::m_smk
privateinherited

Definition at line 44 of file TrigConfData.h.

◆ m_Type

std::string TrigConf::PrescaleSet::m_Type
private

Definition at line 74 of file PrescaleSet.h.

◆ m_version

unsigned int TrigConf::TrigConfData::m_version
privateinherited

Definition at line 47 of file TrigConfData.h.

◆ maxPrescaleCut

const int32_t PrescaleSet::maxPrescaleCut = 0xFFFFFF
static

Definition at line 27 of file PrescaleSet.h.


The documentation for this class was generated from the following files: