ATLAS Offline Software
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
TrigConf::DiffStruct Class Reference

#include <DiffStruct.h>

Collaboration diagram for TrigConf::DiffStruct:

Classes

struct  AttDiff
 

Public Types

typedef std::unordered_map< std::string, std::string > OnlyMap_t
 

Public Member Functions

 DiffStruct (const std::string &tagname, const std::string &name="")
 
 ~DiffStruct ()
 
void check (const std::string &attname, const std::string &lval, const std::string &rval)
 
void check (const std::string &attname, int lval, int rval)
 
void check (const std::string &attname, unsigned int lval, unsigned int rval)
 
void check (const std::string &attname, float lval, float rval)
 
void check (const std::string &attname, bool lval, bool rval)
 
void addSub (DiffStruct *sub)
 
void addRightOnlySub (const std::string &tagname, const std::string &name)
 
void addLeftOnlySub (const std::string &tagname, const std::string &name)
 
bool empty () const
 
void writeXML (std::ofstream &xmlfile, const std::string &prefix="") const
 

Public Attributes

std::string tagname
 
std::string name
 
std::vector< AttDiffattdiffs
 
std::vector< DiffStruct * > subs
 
OnlyMap_t rightonly
 
OnlyMap_t leftonly
 

Detailed Description

Definition at line 14 of file DiffStruct.h.

Member Typedef Documentation

◆ OnlyMap_t

typedef std::unordered_map<std::string, std::string> TrigConf::DiffStruct::OnlyMap_t

Definition at line 43 of file DiffStruct.h.

Constructor & Destructor Documentation

◆ DiffStruct()

TrigConf::DiffStruct::DiffStruct ( const std::string &  tagname,
const std::string &  name = "" 
)

Definition at line 14 of file DiffStruct.cxx.

14  :
16  name(name)
17 {}

◆ ~DiffStruct()

TrigConf::DiffStruct::~DiffStruct ( )

Definition at line 19 of file DiffStruct.cxx.

19  {
20  for(DiffStruct* d : subs)
21  delete d;
22 }

Member Function Documentation

◆ addLeftOnlySub()

void TrigConf::DiffStruct::addLeftOnlySub ( const std::string &  tagname,
const std::string &  name 
)

Definition at line 65 of file DiffStruct.cxx.

65  {
66  leftonly.insert( std::pair<string,string>(tagname, name) );
67 }

◆ addRightOnlySub()

void TrigConf::DiffStruct::addRightOnlySub ( const std::string &  tagname,
const std::string &  name 
)

Definition at line 60 of file DiffStruct.cxx.

60  {
61  rightonly.insert( std::pair<string,string>(tagname, name) );
62 }

◆ addSub()

void TrigConf::DiffStruct::addSub ( DiffStruct sub)

Definition at line 55 of file DiffStruct.cxx.

55  {
56  if(sub) subs.push_back(sub);
57 }

◆ check() [1/5]

void TrigConf::DiffStruct::check ( const std::string &  attname,
bool  lval,
bool  rval 
)

Definition at line 49 of file DiffStruct.cxx.

49  {
50  if(lval!=rval)
51  attdiffs.push_back(AttDiff(attname, boost::lexical_cast<string,bool>(lval), boost::lexical_cast<string,bool>(rval) ));
52 }

◆ check() [2/5]

void TrigConf::DiffStruct::check ( const std::string &  attname,
const std::string &  lval,
const std::string &  rval 
)

Definition at line 26 of file DiffStruct.cxx.

26  {
27  if(lval!=rval) attdiffs.push_back(AttDiff(attname, lval, rval));
28 }

◆ check() [3/5]

void TrigConf::DiffStruct::check ( const std::string &  attname,
float  lval,
float  rval 
)

Definition at line 43 of file DiffStruct.cxx.

43  {
44  if(lval!=rval)
45  attdiffs.push_back(AttDiff(attname, boost::lexical_cast<string,float>(lval), boost::lexical_cast<string,float>(rval) ));
46 }

◆ check() [4/5]

void TrigConf::DiffStruct::check ( const std::string &  attname,
int  lval,
int  rval 
)

Definition at line 31 of file DiffStruct.cxx.

31  {
32  if(lval!=rval)
33  attdiffs.push_back(AttDiff(attname, boost::lexical_cast<string,int>(lval), boost::lexical_cast<string,int>(rval) ));
34 }

◆ check() [5/5]

void TrigConf::DiffStruct::check ( const std::string &  attname,
unsigned int  lval,
unsigned int  rval 
)

Definition at line 37 of file DiffStruct.cxx.

37  {
38  if(lval!=rval)
39  attdiffs.push_back(AttDiff(attname, boost::lexical_cast<string,unsigned int>(lval), boost::lexical_cast<string,unsigned int>(rval) ));
40 }

◆ empty()

bool TrigConf::DiffStruct::empty ( ) const

Definition at line 70 of file DiffStruct.cxx.

70  {
71  return attdiffs.size()==0 && subs.size()==0;
72 }

◆ writeXML()

void TrigConf::DiffStruct::writeXML ( std::ofstream &  xmlfile,
const std::string &  prefix = "" 
) const

Definition at line 76 of file DiffStruct.cxx.

76  {
77  if(empty()) return;
78  xmlfile << prefix << "<" << tagname;
79  if(name!="")
80  xmlfile << " name=\"" << name << "\"";
81  for(const AttDiff& d : attdiffs)
82  xmlfile << " " << d.attname << "_l=\"" << d.lval << "\" " << d.attname << "_r=\"" << d.rval << "\"";
83  if(subs.size()==0 && rightonly.size()==0 && leftonly.size()==0) {
84  xmlfile << "/>" << endl;
85  } else {
86  xmlfile << ">" << endl;
87  for(DiffStruct *d : subs)
88  d->writeXML(xmlfile, prefix+" ");
89  if(leftonly.size()>0) {
90  xmlfile << prefix << " <LEFT_ONLY>" << endl;
91  for(OnlyMap_t::value_type tag_name : leftonly)
92  xmlfile << prefix << " <" << tag_name.first << " name=\"" << tag_name.second << "\"/>" << endl;
93  xmlfile << prefix << " </LEFT_ONLY>" << endl;
94  }
95  if(rightonly.size()>0) {
96  xmlfile << prefix << " <RIGHT_ONLY>" << endl;
97  for(OnlyMap_t::value_type tag_name : rightonly)
98  xmlfile << prefix << " <" << tag_name.first << " name=\"" << tag_name.second << "\"/>" << endl;
99  xmlfile << prefix << " </RIGHT_ONLY>" << endl;
100  }
101  xmlfile << prefix << "</" << tagname << ">" << endl;
102  }
103 }

Member Data Documentation

◆ attdiffs

std::vector<AttDiff> TrigConf::DiffStruct::attdiffs

Definition at line 41 of file DiffStruct.h.

◆ leftonly

OnlyMap_t TrigConf::DiffStruct::leftonly

Definition at line 45 of file DiffStruct.h.

◆ name

std::string TrigConf::DiffStruct::name

Definition at line 40 of file DiffStruct.h.

◆ rightonly

OnlyMap_t TrigConf::DiffStruct::rightonly

Definition at line 44 of file DiffStruct.h.

◆ subs

std::vector<DiffStruct*> TrigConf::DiffStruct::subs

Definition at line 42 of file DiffStruct.h.

◆ tagname

std::string TrigConf::DiffStruct::tagname

Definition at line 39 of file DiffStruct.h.


The documentation for this class was generated from the following files:
TrigConf::DiffStruct::rightonly
OnlyMap_t rightonly
Definition: DiffStruct.h:44
TrigConf::DiffStruct::DiffStruct
DiffStruct(const std::string &tagname, const std::string &name="")
Definition: DiffStruct.cxx:14
hist_file_dump.d
d
Definition: hist_file_dump.py:137
python.XMLReader.xmlfile
xmlfile
Definition: XMLReader.py:72
TrigConf::DiffStruct::tagname
std::string tagname
Definition: DiffStruct.h:39
TrigConf::DiffStruct::leftonly
OnlyMap_t leftonly
Definition: DiffStruct.h:45
checkCorrelInHIST.prefix
dictionary prefix
Definition: checkCorrelInHIST.py:391
TrigConf::DiffStruct::name
std::string name
Definition: DiffStruct.h:40
TrigConf::DiffStruct::empty
bool empty() const
Definition: DiffStruct.cxx:70
tagname
Definition: tagname.h:29
TrigConf::DiffStruct::subs
std::vector< DiffStruct * > subs
Definition: DiffStruct.h:42
TrigConf::DiffStruct::attdiffs
std::vector< AttDiff > attdiffs
Definition: DiffStruct.h:41