ATLAS Offline Software
Functions
testMETHash.cxx File Reference
#include <cassert>
#include <ctime>
#include <utility>
#include "xAODMissingET/MissingETAuxContainer.h"
#include "xAODMissingET/MissingETAssociationMap.h"
#include "xAODMissingET/MissingETContainer.h"
Include dependency graph for testMETHash.cxx:

Go to the source code of this file.

Functions

int testStringComparisonVersion (xAOD::MissingETContainer &cont)
 
int testHashComparisonVersion (xAOD::MissingETContainer &cont)
 
double calcMean (std::vector< double > &times)
 
int main ()
 

Function Documentation

◆ calcMean()

double calcMean ( std::vector< double > &  times)

Definition at line 55 of file testMETHash.cxx.

55  {
56  //std::cout << __PRETTY_FUNCTION__ << std::endl;
57  double sum = 0;
58  for (auto i : times ){
59  //std::cout << sum << std::endl;
60  sum += i;
61  }
62 
63  return sum/static_cast<double>(times.size());
64 }

◆ main()

int main ( )

Definition at line 66 of file testMETHash.cxx.

66  {std::cout << __PRETTY_FUNCTION__ << std::endl;
67 
68  std::pair<xAOD::MissingETContainer, xAOD::MissingETAuxContainer> cont;
69  cont.first.setStore(& cont.second);
70 
71  std::vector<double> stringComparisonTimes;
72  std::vector<double> hashComparisonTimes;
73 
74  for(size_t i = 0; i < 1000; ++i){
75  for(size_t j = 0; j < 7; ++j){
76  xAOD::MissingET * met = new xAOD::MissingET(metStringsMap.at(j));
77  cont.first.push_back(met);
78  }
79 
80  clock_t begin = clock();
81  testStringComparisonVersion(cont.first);
82  clock_t end = clock();
83 
84  cont.first.clear();
85 
86  clock_t begin2 = clock();
87  testHashComparisonVersion(cont.first);
88  clock_t end2 = clock();
89 
90  cont.first.clear();
91 
92  double stringTime = double(end - begin );
93  double hashTime = double(end2 - begin2);
94  // std::cout << "stringTime : " << stringTime << std::endl;
95  // std::cout << "hashTime : " << hashTime << std::endl;
96  stringComparisonTimes.push_back(stringTime);
97  hashComparisonTimes .push_back(hashTime);
98  }
99 
100  std::cout << "Avg time to run testStringComparisonVersion : " << calcMean(stringComparisonTimes)/CLOCKS_PER_SEC << std::endl;
101  std::cout << "Avg time to run testHashComparisonVersion : " << calcMean(hashComparisonTimes )/CLOCKS_PER_SEC << std::endl;
102 
103  return 0;
104  }

◆ testHashComparisonVersion()

int testHashComparisonVersion ( xAOD::MissingETContainer cont)

Definition at line 44 of file testMETHash.cxx.

44  {
45  //std::cout << __PRETTY_FUNCTION__ << std::endl;
46  for(size_t j = 0; j < 10000; ++j){
47  for(size_t i = 0; i < cont.size(); ++i ){
48  // xAOD::MissingET * met = *(cont.findByHash(metStringsMap.at(i)));
49  // assert(met);
50  }
51  }
52  return 0;
53 }

◆ testStringComparisonVersion()

int testStringComparisonVersion ( xAOD::MissingETContainer cont)

Definition at line 33 of file testMETHash.cxx.

33  {
34  //std::cout << __PRETTY_FUNCTION__ << std::endl;
35  for(size_t j = 0; j < 10000; ++j){
36  for(size_t i = 0; i < cont.size(); ++i ){
37  xAOD::MissingET * met = *(cont.find(metStringsMap.at(i)));
38  assert(met);
39  }
40  }
41  return 0;
42 }
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
xAOD::MissingET
MissingET_v1 MissingET
Version control by type defintion.
Definition: Event/xAOD/xAODMissingET/xAODMissingET/MissingET.h:15
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
xAOD::MissingETContainer_v1::find
const_iterator find(const std::string &name) const
Find non-modifiable MET object by name.
Definition: MissingETContainer_v1.cxx:52
met
Definition: IMETSignificance.h:24
convertTimingResiduals.sum
sum
Definition: convertTimingResiduals.py:55
lumiFormat.i
int i
Definition: lumiFormat.py:85
xAOD::MissingET_v1
Principal data object for Missing ET.
Definition: MissingET_v1.h:25
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
calcMean
double calcMean(std::vector< double > &times)
Definition: testMETHash.cxx:55
testStringComparisonVersion
int testStringComparisonVersion(xAOD::MissingETContainer &cont)
Definition: testMETHash.cxx:33
testHashComparisonVersion
int testHashComparisonVersion(xAOD::MissingETContainer &cont)
Definition: testMETHash.cxx:44
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
plot_times.times
def times(fn)
Definition: plot_times.py:11