Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:04:15

0001 #include "DataFormats/GeometrySurface/interface/RectangularPlaneBounds.h"
0002 #include "DataFormats/GeometrySurface/interface/LocalError.h"
0003 
0004 #include "FWCore/Utilities/interface/HRRealTime.h"
0005 #include <iostream>
0006 
0007 void st() {}
0008 void en() {}
0009 
0010 int main() {
0011   RectangularPlaneBounds bound(1., 1., 1.);
0012 
0013   Local3DPoint a(10., 10., 10.);
0014 
0015   Local3DPoint in(0., 0., 0.);
0016   Local3DPoint in2(0.5, 0., 0.);
0017 
0018   Local3DPoint outY(0., 3., 0.);
0019   Local3DPoint out2(0., 1.5, 0.);
0020 
0021   Local3DPoint outZ(0., 3., 3.);
0022 
0023   LocalError err(0.1, 0.0, 0.1);
0024   LocalError errB(1.0, 0.0, 1.0);
0025 
0026   bool ok;
0027 
0028   // usual first to load whatever
0029   {
0030     edm::HRTimeType s = edm::hrRealTime();
0031     ok = bound.inside(a);
0032     edm::HRTimeType e = edm::hrRealTime();
0033     std::cout << e - s << std::endl;
0034     if (ok)
0035       std::cout << "inside?" << std::endl;
0036   }
0037 
0038   {
0039     edm::HRTimeType s = edm::hrRealTime();
0040     st();
0041     ok = bound.inside(outZ);
0042     en();
0043     edm::HRTimeType e = edm::hrRealTime();
0044     std::cout << e - s << std::endl;
0045     if (ok)
0046       std::cout << "inside?" << std::endl;
0047   }
0048 
0049   {
0050     edm::HRTimeType s = edm::hrRealTime();
0051     st();
0052     ok = bound.inside(in);
0053     en();
0054     edm::HRTimeType e = edm::hrRealTime();
0055     std::cout << e - s << std::endl;
0056     if (!ok)
0057       std::cout << "not inside?" << std::endl;
0058   }
0059 
0060   {
0061     edm::HRTimeType s = edm::hrRealTime();
0062     st();
0063     ok = bound.inside(in, err);
0064     en();
0065     edm::HRTimeType e = edm::hrRealTime();
0066     std::cout << e - s << std::endl;
0067     if (!ok)
0068       std::cout << "not inside?" << std::endl;
0069   }
0070 
0071   {
0072     edm::HRTimeType s = edm::hrRealTime();
0073     st();
0074     auto io = bound.inout(in, err);
0075     en();
0076     edm::HRTimeType e = edm::hrRealTime();
0077     std::cout << e - s << std::endl;
0078     if (!io.first)
0079       std::cout << "in not inside?" << std::endl;
0080     if (io.second)
0081       std::cout << "in outside?" << std::endl;
0082   }
0083 
0084   {
0085     edm::HRTimeType s = edm::hrRealTime();
0086     st();
0087     auto io = bound.inout(in2, errB);
0088     en();
0089     edm::HRTimeType e = edm::hrRealTime();
0090     std::cout << e - s << std::endl;
0091     if (!io.first)
0092       std::cout << "in2 not inside?" << std::endl;
0093     if (!io.second)
0094       std::cout << "in2 not outside?" << std::endl;
0095   }
0096 
0097   {
0098     edm::HRTimeType s = edm::hrRealTime();
0099     st();
0100     ok = bound.inside(outY, err);
0101     en();
0102     edm::HRTimeType e = edm::hrRealTime();
0103     std::cout << e - s << std::endl;
0104     if (ok)
0105       std::cout << "inside?" << std::endl;
0106   }
0107 
0108   {
0109     edm::HRTimeType s = edm::hrRealTime();
0110     st();
0111     auto io = bound.inout(outY, err);
0112     en();
0113     edm::HRTimeType e = edm::hrRealTime();
0114     std::cout << e - s << std::endl;
0115     if (io.first)
0116       std::cout << "outY inside?" << std::endl;
0117     if (!io.second)
0118       std::cout << "outY not outside?" << std::endl;
0119   }
0120 
0121   {
0122     edm::HRTimeType s = edm::hrRealTime();
0123     st();
0124     auto io = bound.inout(out2, errB);
0125     en();
0126     edm::HRTimeType e = edm::hrRealTime();
0127     std::cout << e - s << std::endl;
0128     if (!io.first)
0129       std::cout << "out2 not inside?" << std::endl;
0130     if (!io.second)
0131       std::cout << "out2 not outside?" << std::endl;
0132   }
0133 
0134   {
0135     edm::HRTimeType s = edm::hrRealTime();
0136     st();
0137     ok = bound.inside(Local2DPoint(in.x(), in.y()), 1.f);
0138     en();
0139     edm::HRTimeType e = edm::hrRealTime();
0140     std::cout << e - s << std::endl;
0141     if (!ok)
0142       std::cout << "not inside?" << std::endl;
0143   }
0144 
0145   {
0146     edm::HRTimeType s = edm::hrRealTime();
0147     st();
0148     ok = bound.inside(Local2DPoint(outY.x(), outY.y()), 1.f);
0149     en();
0150     edm::HRTimeType e = edm::hrRealTime();
0151     std::cout << e - s << std::endl;
0152     if (ok)
0153       std::cout << "inside?" << std::endl;
0154   }
0155   {
0156     edm::HRTimeType s = edm::hrRealTime();
0157     st();
0158     ok = bound.inside(Local2DPoint(outY.x(), outY.y()), 10.f);
0159     en();
0160     edm::HRTimeType e = edm::hrRealTime();
0161     std::cout << e - s << std::endl;
0162     if (!ok)
0163       std::cout << "not inside?" << std::endl;
0164   }
0165 
0166   return 0;
0167 }