ATLAS Offline Software
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 
10 using 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 
20 float
22  int32_t cut = m_cuts[idx];
23  float ucut = abs(cut);
24  return ( 0x1000000 / ( ucut + 1 ) );
25 }
26 
27 void
28 TrigConf::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 
48 void
49 TrigConf::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 }
PrescaleSet.h
TrigConf::Random::getRateFromCut
float getRateFromCut(unsigned int idx) const
Definition: Random.cxx:21
detail
Definition: extract_histogram_tag.cxx:14
Random.h
TrigConf::PrescaleSet::getPrescaleFromCut
static double getPrescaleFromCut(int32_t cut)
prescale = 2*24/(cut+1.)
Definition: PrescaleSet.cxx:52
geometry_dat_to_json.indent
indent
Definition: geometry_dat_to_json.py:36
lumiFormat.i
int i
Definition: lumiFormat.py:85
BindingsTest.cut
cut
This script demonstrates how to call a C++ class from Python Also how to use PyROOT is shown.
Definition: BindingsTest.py:13
TrigConf::Random::print
virtual void print(const std::string &indent="", unsigned int detail=1) const override
Definition: Random.cxx:28
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
TrigConf::Random::Random
Random()
Definition: Random.cxx:12
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
TrigConf::L1DataBaseclass
Definition: L1DataBaseclass.h:22
TrigConf::Random::writeXML
virtual void writeXML(std::ostream &xmlfile, int indentLevel=0, int indentWidth=2) const
Definition: Random.cxx:49