ATLAS Offline Software
LineFormatter.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3 */
4 // Class to create a string of elements, n perline
5 // where n is settable.
6 
7 #ifndef JETREC_LINEFORMATTER_H
8 #define JETREC_LINEFORMATTER_H
9 
10 #include <sstream>
11 #include <ios>
12 #include <vector>
13 
15 public:
16  LineFormatter(std::size_t perline):m_perline(perline){
17  }
18  template<typename T>
19  std::string operator()(const std::vector<T>& v){
20  std::size_t count{0};
21  std::size_t linecount{0};
22  std::ostringstream oss{"", std::ios::ate};
23  oss << linecount << '|' << " ";
24  for (const auto& e : v){
25  if (count == m_perline){
26  count = 0;
27  linecount += m_perline;
28  oss << '\n'<<linecount<< '|' << " ";
29  }
30  oss << e << " ";
31  ++count;
32  }
33  // if(count != 0){oss << '\n';}
34  return oss.str();
35  }
36 
37 private:
38  std::size_t m_perline;
39 };
40 
41 #endif
XMLtoHeader.count
count
Definition: XMLtoHeader.py:85
LineFormatter::operator()
std::string operator()(const std::vector< T > &v)
Definition: LineFormatter.h:19
LineFormatter
Definition: LineFormatter.h:14
python.PyAthena.v
v
Definition: PyAthena.py:157
LineFormatter::LineFormatter
LineFormatter(std::size_t perline)
Definition: LineFormatter.h:16
LineFormatter::m_perline
std::size_t m_perline
Definition: LineFormatter.h:38
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26