Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:28:30

0001 // ClusterShapeHitFilter test
0002 #include "RecoTracker/PixelLowPtUtilities/interface/ClusterShapeHitFilter.h"
0003 
0004 #include <iostream>
0005 #include <cassert>
0006 
0007 namespace test {
0008   namespace ClusterShapeHitFilterTest {
0009     int test() {
0010       const std::string use_PixelShapeFile("RecoTracker/PixelLowPtUtilities/data/pixelShapePhase0.par");
0011 
0012       ClusterShapeHitFilter filter("RecoTracker/PixelLowPtUtilities/data/pixelShapePhase0.par",
0013                                    "RecoTracker/PixelLowPtUtilities/data/pixelShapePhase0.par");
0014 
0015       const float out = 10e12;
0016       const float eps = 0.01;
0017       std::cout << "dump strip limits" << std::endl;
0018       for (int i = 0; i != StripKeys::N + 1; i++) {
0019         assert(!filter.stripLimits[i].isInside(out));
0020         assert(!filter.stripLimits[i].isInside(-out));
0021         std::cout << i << ": ";
0022         float const* p = filter.stripLimits[i].data[0];
0023         if (p[1] < 1.e9) {
0024           assert(filter.stripLimits[i].isInside(p[0] + eps));
0025           assert(filter.stripLimits[i].isInside(p[3] - eps));
0026         }
0027         for (int j = 0; j != 4; ++j)
0028           std::cout << p[j] << ", ";
0029         std::cout << std::endl;
0030       }
0031 
0032       const std::pair<float, float> out1(out, out), out2(-out, -out);
0033       std::cout << "\ndump pixel limits" << std::endl;
0034       for (int i = 0; i != PixelKeys::N + 1; i++) {
0035         assert(!filter.pixelLimits[i].isInside(out1));
0036         assert(!filter.pixelLimits[i].isInside(out2));
0037         std::cout << i << ": ";
0038         float const* p = filter.pixelLimits[i].data[0][0];
0039         if (p[1] < 1.e9) {
0040           assert(filter.pixelLimits[i].isInside(std::pair<float, float>(p[0] + eps, p[3] - eps)));
0041           assert(filter.pixelLimits[i].isInside(std::pair<float, float>(p[5] - eps, p[6] + eps)));
0042         }
0043         for (int j = 0; j != 8; ++j)
0044           std::cout << p[j] << ", ";
0045         std::cout << std::endl;
0046       }
0047 
0048       return 0;
0049     }
0050   }  // namespace ClusterShapeHitFilterTest
0051 }  // namespace test
0052 
0053 int main() { return test::ClusterShapeHitFilterTest::test(); }