ATLAS Offline Software
Classes | Functions
FloatArrayStore.h File Reference
#include <vector>
#include <map>
#include <string>
#include <functional>
#include <iosfwd>
#include <cmath>
#include "Identifier/Identifier.h"
#include "AthenaKernel/CLASS_DEF.h"
Include dependency graph for FloatArrayStore.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  FloatArrayStore
 class FloatArrayStore Access and manipulate an indexed storage of float vectors More...
 

Functions

std::ostream & operator<< (std::ostream &os, const FloatArrayStore &store)
 
std::istream & operator>> (std::istream &is, FloatArrayStore &store)
 

Function Documentation

◆ operator<<()

std::ostream& operator<< ( std::ostream &  os,
const FloatArrayStore store 
)

Definition at line 39 of file FloatArrayStore.cxx.

39  {
40  os << store.tag() << std::endl ;
41  // it is a bit of a heck, but the FloatArrayStore doesn't allow for more.
42  // first make an inverse map
43  std::map<int, std::vector<Identifier> > indextoidentmap ;
44  for(auto it : store)
45  indextoidentmap[it.second].push_back(it.first) ;
46  // store the number of lines
47  os << indextoidentmap.size() << std::endl ;
48  // now store all elements, as follows
49  // each line is: #idents ident1 ident2 ...indentN vectorsize element1 element2 ... elementN
50  for( std::map<int, std::vector<Identifier> >::const_iterator it = indextoidentmap.begin() ;
51  it != indextoidentmap.end(); ++it) {
52  os << it->second.size() << " " ;
53  for(auto vit : it->second)
54  os << vit << " " ;
55  const std::vector<float>& data = store[it->second.front()] ;
56  os << data.size() << " " ;
57  for(float vit : data)
58  os << vit << " " ;
59  os << std::endl ;
60  }
61  return os ;
62 }

◆ operator>>()

std::istream& operator>> ( std::istream &  is,
FloatArrayStore store 
)

Definition at line 64 of file FloatArrayStore.cxx.

64  {
65  store.clear() ;
66  std::string tag ;
67  is >> tag ;
69  std::vector<int> identifiers(0) ;
70  std::vector<float> data(0) ;
71  constexpr int maxLines=2000000;//max 2 million lines
72  constexpr int maxSize=2000000; //max size 2 million
73  int nlines ;
74  is >> nlines ;
75  if ((nlines>=0) and (nlines<maxLines)) {
76  for(int iline = 0; iline <nlines; ++iline) {
77  int size ;
78  is >> size ;
79  if ((size>=0) and (size<maxSize)){
80  identifiers.resize(size) ;
81  for(int i=0; i<size; ++i) is >> (identifiers[i]) ;
82  }
83  else {
84  MsgStream log(Athena::getMessageSvc(), "FloatArrayStore");
85  log << MSG::ERROR << "size of identifier is incorrect" << endmsg;
86  return is;
87  }
88  is >> size ;
89  if ((size>=0) and (size<maxSize)){
90  data.resize(size) ;
91  for(int i=0; i<size; ++i) is >> (data[i]) ;
92  }
93  else {
94  MsgStream log(Athena::getMessageSvc(), "FloatArrayStore");
95  log << MSG::ERROR << "size of data is incorrect" << endmsg;
96  return is;
97  }
99  store.push_back( reference, data ) ;
100  std::vector<int>::const_iterator it = identifiers.begin() ;
101  for( ++it; it!= identifiers.end(); ++it) store.share(Identifier(*it),reference) ;
102  }
103  }
104  return is ;
105 }
store
StoreGateSvc * store
Definition: fbtTestBasics.cxx:71
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
skel.it
it
Definition: skel.GENtoEVGEN.py:396
reference
Definition: hcg.cxx:437
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
lumiFormat.i
int i
Definition: lumiFormat.py:85
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
InDetSimDataHelpers::identifiers
std::vector< Identifier > identifiers(const InDetSimDataCollection &coll)
Definition: InDetSimDataDict.h:15
dq_make_web_display.reference
reference
Definition: dq_make_web_display.py:44
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:24
FloatArrayStore
class FloatArrayStore Access and manipulate an indexed storage of float vectors
Definition: FloatArrayStore.h:34
Identifier
Definition: IdentifierFieldParser.cxx:14