ATLAS Offline Software
Loading...
Searching...
No Matches
Random.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3*/
4
7#include <iostream>
8#include <math.h>
9
10using namespace std;
11
13 m_rate1( 0 ), m_rate2( 0 ),
14 m_names{ "Random0", "Random1",
15 "Random2", "Random3" },
16 m_cuts{ 0xffffff, 0xffffff, 0xffffff,
17 0xffffff }
18{}
19
20float
21TrigConf::Random::getRateFromCut(unsigned int idx) const {
22 int32_t cut = m_cuts[idx];
23 float ucut = abs(cut);
24 return ( 0x1000000 / ( ucut + 1 ) );
25}
26
27void
28TrigConf::Random::print(const std::string& indent, unsigned int detail) const {
29 if(detail>=1) {
30 cout << indent << "Random "; printNameIdV();
31 if(detail>=2) {
32 if( m_cuts[0]!=0xffffffff ||
33 m_cuts[1]!=0xffffffff ||
34 m_cuts[2]!=0xffffffff ||
35 m_cuts[3]!=0xffffffff )
36 {
37 for(int i=0; i<4; i++) {
38 cout << indent << " " << m_names[i] << ": cut=" << m_cuts[i] << " (prescale=" << PrescaleSet::getPrescaleFromCut(m_cuts[i]) << ")" << endl;
39 }
40 } else {
41 cout << indent << " Rate 1: " << m_rate1 << endl;
42 cout << indent << " Rate 2: " << m_rate2 << endl;
43 }
44 }
45 }
46}
47
48void
49TrigConf::Random::writeXML(std::ostream & xmlfile, int indentLevel, int indentWidth) const {
50 if( m_cuts[0]!=0xffffffff ||
51 m_cuts[1]!=0xffffffff ||
52 m_cuts[2]!=0xffffffff ||
53 m_cuts[3]!=0xffffffff )
54 {
55 indent(xmlfile,indentLevel, indentWidth)
56 << "<Random "
57 << "name0=\""<< m_names[0] << "\" cut0=\"" << m_cuts[0] << "\" "
58 << "name1=\""<< m_names[1] << "\" cut1=\"" << m_cuts[1] << "\" "
59 << "name2=\""<< m_names[2] << "\" cut2=\"" << m_cuts[2] << "\" "
60 << "name3=\""<< m_names[3] << "\" cut3=\"" << m_cuts[3] << "\"/>" << endl;
61 } else {
62 indent(xmlfile,indentLevel, indentWidth)
63 << "<Random name=\"" << name() << "\" rate1=\"" << m_rate1
64 << "\" rate2=\"" << m_rate2
65 << "\" seed1=\"1\" seed2=\"1\"/>" << endl;
66 }
67}
static double getPrescaleFromCut(int32_t cut)
prescale = 2*24/(cut+1.)
float getRateFromCut(unsigned int idx) const
Definition Random.cxx:21
virtual void print(const std::string &indent="", unsigned int detail=1) const override
Definition Random.cxx:28
virtual void writeXML(std::ostream &xmlfile, int indentLevel=0, int indentWidth=2) const
Definition Random.cxx:49
std::ostream & indent(std::ostream &o, int lvl, int size) const
void printNameIdV(const std::string &indent="") const
static std::vector< std::string > xmlfile
Definition iLumiCalc.h:29
STL namespace.