ATLAS Offline Software
Namespaces | Typedefs | Functions
SCT_ConditionsAlgorithms Namespace Reference

SCT_SimpleHisto.h C++ projects. More...

Namespaces

 CoveritySafe
 

Typedefs

typedef std::map< float, unsigned int > S_t
 

Functions

bool init (S_t &s, const float xlo, const float xhi, const unsigned int nbins)
 Initialize a map to be used as a histogram. More...
 
int fill (S_t &s, const float value)
 
std::string asXmlString (const S_t &s)
 
std::string xmlHeader (const std::string &version="1.0", const std::string &encoding="UTF-8")
 
std::string stylesheet (const std::string &path)
 

Detailed Description

SCT_SimpleHisto.h C++ projects.

Created by sroe on 13/11/2009.

Typedef Documentation

◆ S_t

typedef std::map<float, unsigned int> SCT_ConditionsAlgorithms::S_t

Definition at line 22 of file SCT_SimpleHisto.h.

Function Documentation

◆ asXmlString()

std::string SCT_ConditionsAlgorithms::asXmlString ( const S_t s)

Definition at line 53 of file SCT_SimpleHisto.h.

53  {
54  std::ostringstream os;
55  os<<"<histogram>\n";
56  for (S_t::const_iterator i{s.begin()}; i!=s.end(); ++i) {
57  os<<"<b x=\""<<i->first<<"\">"<<i->second<<"</b>\n";
58  }
59  os<<"</histogram>\n";
60  return os.str();
61  }//asXmlString

◆ fill()

int SCT_ConditionsAlgorithms::fill ( S_t s,
const float  value 
)

Definition at line 40 of file SCT_SimpleHisto.h.

40  {
41  S_t::const_iterator start{s.begin()};
42  S_t::const_iterator end{s.end()};
43  unsigned int nbins{static_cast<unsigned int>(s.size())};
44  if (value * nbins > ((--end)->first - start->first) * (nbins+1)) return 1;
45  S_t::iterator i=s.upper_bound(value);
46  if (i==start) return -1;
47  ++((--i)->second);
48  return 0;
49  }//fill function

◆ init()

bool SCT_ConditionsAlgorithms::init ( S_t s,
const float  xlo,
const float  xhi,
const unsigned int  nbins 
)

Initialize a map to be used as a histogram.

Definition at line 26 of file SCT_SimpleHisto.h.

26  {
27  if ((xhi <= xlo) or (nbins<2)) return false;
28  float increment{(xhi-xlo)/nbins};
29  float acc{xlo};
30  unsigned int init{0};
31  for (unsigned int i{0}; i!=nbins; ++i) {
32  s[acc]=init;
33  acc+=increment;
34  }
35  return (s.size()==nbins); //should be true now
36  }//initHisto function

◆ stylesheet()

std::string SCT_ConditionsAlgorithms::stylesheet ( const std::string &  path)

Definition at line 68 of file SCT_SimpleHisto.h.

68  {
69  return "<?xml-stylesheet type=\"text/xsl\" href=\""+path+"\"?>";
70  }

◆ xmlHeader()

std::string SCT_ConditionsAlgorithms::xmlHeader ( const std::string &  version = "1.0",
const std::string &  encoding = "UTF-8" 
)

Definition at line 64 of file SCT_SimpleHisto.h.

64  {
65  return "<?xml version=\""+version+"\" encoding=\""+encoding+"\" standalone=\"yes\"?>";
66  }
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
python.SystemOfUnits.second
int second
Definition: SystemOfUnits.py:120
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
athena.path
path
python interpreter configuration --------------------------------------—
Definition: athena.py:128
mergePhysValFiles.start
start
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:14
athena.value
value
Definition: athena.py:124
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
WritePulseShapeToCool.xhi
xhi
Definition: WritePulseShapeToCool.py:152
lumiFormat.i
int i
Definition: lumiFormat.py:85
generateReferenceFile.encoding
encoding
Definition: generateReferenceFile.py:15
AthenaPoolTestRead.acc
acc
Definition: AthenaPoolTestRead.py:16
WritePulseShapeToCool.xlo
xlo
Definition: WritePulseShapeToCool.py:133
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
SCT_CalibAlgs::nbins
@ nbins
Definition: SCT_CalibNumbers.h:10
get_generator_info.version
version
Definition: get_generator_info.py:33
DeMoScan.first
bool first
Definition: DeMoScan.py:536
SCT_ConditionsAlgorithms::init
bool init(S_t &s, const float xlo, const float xhi, const unsigned int nbins)
Initialize a map to be used as a histogram.
Definition: SCT_SimpleHisto.h:26