Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:31:37

0001 #include "TrackingTools/GsfTools/interface/GaussianSumUtilities1D.h"
0002 #include "TrackingTools/GsfTools/interface/SingleGaussianState1D.h"
0003 #include "TrackingTools/GsfTools/interface/MultiGaussianState1D.h"
0004 
0005 #include "FWCore/Utilities/interface/HRRealTime.h"
0006 #include <iostream>
0007 #include <vector>
0008 
0009 namespace {
0010   struct LocalTimer {
0011     ~LocalTimer() { std::cout << "elapsed time " << t << std::endl; }
0012     edm::HRTimeType t;
0013   };
0014 
0015   LocalTimer timer;
0016 
0017 }  // namespace
0018 
0019 void st() { timer.t = edm::hrRealTime(); }
0020 
0021 void en() { timer.t = edm::hrRealTime() - timer.t; }
0022 
0023 int main(int argc, char* argv[]) {
0024   MultiGaussianState1D::SingleState1dContainer v(6);
0025   v[0] = SingleGaussianState1D(0., 1., 1.);
0026   v[1] = SingleGaussianState1D(0., 2., 0.5);
0027   v[2] = SingleGaussianState1D(0.2, 2., 0.5);
0028   v[3] = SingleGaussianState1D(-0.2, 2., 0.5);
0029   v[4] = SingleGaussianState1D(0., 4., 1.0);
0030   v[5] = SingleGaussianState1D(0.1, 4., 0.3);
0031 
0032   MultiGaussianState1D mgs(v);
0033 
0034   // call once to inizialite compiler stuff
0035   {
0036     GaussianSumUtilities1D gsu1(mgs);
0037     std::cout << gsu1.mode().mean() << std::endl;
0038   }
0039 
0040   GaussianSumUtilities1D gsu(mgs);
0041   st();
0042   const SingleGaussianState1D& sg1 = gsu.mode();
0043   en();
0044 
0045   std::cout << sg1.mean() << " " << sg1.standardDeviation() << " " << sg1.weight() << std::endl;
0046 
0047   return 0;
0048 }