Public Member Functions | Private Attributes | List of all members
mcdatadaq::Sorter Class Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N21-05-06/MockDataDAQ/include/Sorter.h"

Public Member Functions

 Sorter ()
 
 ~Sorter ()
 
bool addNumber (const unsigned long long)
 Add number. The index assigned to the number is the order in which the number is added. More...
 
bool sort ()
 Sorting the indeces by numbers. More...
 
std::vector< uint32_t > getIndeces () const
 Get indeces. More...
 
bool getIndeces (std::vector< uint32_t > &) const
 
bool print () const
 Print the numbers and current order of indeces. More...
 

Private Attributes

number_index_pair_vector_t _numberIndexPair
 

Detailed Description

Definition at line 24 of file Sorter.h.

Constructor & Destructor Documentation

mcdatadaq::Sorter::Sorter ( )

Definition at line 23 of file Sorter.cpp.

23 { }
mcdatadaq::Sorter::~Sorter ( )

Definition at line 26 of file Sorter.cpp.

26 { }

Member Function Documentation

bool mcdatadaq::Sorter::addNumber ( const unsigned long long  number)

Add number. The index assigned to the number is the order in which the number is added.

Definition at line 29 of file Sorter.cpp.

References _numberIndexPair, and make_pair().

Referenced by mcdatadaq::DAQSimulator::getNanoSliceOrder().

29  {
30 
31  const uint32_t current_index = _numberIndexPair.size();
32 
33  _numberIndexPair.push_back(std::make_pair(number, current_index));
34 
35  return true;
36 }
std::pair< Spectrum *, CheatDecomp * > make_pair(SpectrumLoaderBase &loader_data, SpectrumLoaderBase &loader_mc, HistAxis *axis, Cut *cut, const SystShifts &shift, const Var &wei)
Definition: DataMCLoad.C:336
number_index_pair_vector_t _numberIndexPair
Definition: Sorter.h:45
std::vector< uint32_t > mcdatadaq::Sorter::getIndeces ( ) const

Get indeces.

Definition at line 59 of file Sorter.cpp.

Referenced by mcdatadaq::DAQSimulator::getNanoSliceOrder().

59  {
60  std::vector <uint32_t> index_vector;
61 
62  getIndeces(index_vector);
63 
64  return index_vector;
65 }
std::vector< uint32_t > getIndeces() const
Get indeces.
Definition: Sorter.cpp:59
bool mcdatadaq::Sorter::getIndeces ( std::vector< uint32_t > &  index_vector) const

Definition at line 50 of file Sorter.cpp.

References _numberIndexPair.

50  {
51 
52  for(number_index_pair_vector_t::const_iterator itr = _numberIndexPair.begin(); itr != _numberIndexPair.end(); ++itr)
53  index_vector.push_back((*itr).second); //Fill the true order
54 
55  return true;
56 }
number_index_pair_vector_t _numberIndexPair
Definition: Sorter.h:45
bool mcdatadaq::Sorter::print ( ) const

Print the numbers and current order of indeces.

Definition at line 68 of file Sorter.cpp.

References _numberIndexPair, om::cout, allTimeWatchdog::endl, allTimeWatchdog::index, and printf().

68  {
69 
70  printf("-----------------------------------------------------------------\n");
71  printf("Sorter print:\n");
72  printf("-----------------------------------------------------------------\n");
73 
74  for(number_index_pair_vector_t::const_iterator itr = _numberIndexPair.begin(); itr != _numberIndexPair.end(); ++itr){
75 
76  const unsigned long long first_number = (*itr).first;
77  const uint32_t index = (*itr).second;
78 
79  std::cout<<std::hex<<first_number<<"x";
80  std::cout<<std::dec<<" ("<<first_number<<")";
81  std::cout<<" index="<<index<<std::endl;
82 
83  }// end of loop
84 
85  printf("-----------------------------------------------------------------\n");
86  printf("End of Sorter print:\n");
87  printf("-----------------------------------------------------------------\n");
88 
89  return true;
90 
91 }
number_index_pair_vector_t _numberIndexPair
Definition: Sorter.h:45
printf("%d Experimental points found\n", nlines)
OStream cout
Definition: OStream.cxx:6
bool mcdatadaq::Sorter::sort ( )

Sorting the indeces by numbers.

Sorting by the numbers (whuch come first in the pair)

Definition at line 39 of file Sorter.cpp.

References _numberIndexPair.

Referenced by mcdatadaq::DAQSimulator::getNanoSliceOrder().

39  {
40 
41  /// Sorting by the numbers (whuch come first in the pair)
42  std::sort(_numberIndexPair.begin(), _numberIndexPair.end(),
43  boost::bind(&number_index_pair_t::first, _1) <
44  boost::bind(&number_index_pair_t::first, _2));
45 
46  return true;
47 }
number_index_pair_vector_t _numberIndexPair
Definition: Sorter.h:45

Member Data Documentation

number_index_pair_vector_t mcdatadaq::Sorter::_numberIndexPair
private

Definition at line 45 of file Sorter.h.

Referenced by addNumber(), getIndeces(), print(), and sort().


The documentation for this class was generated from the following files: