Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "RecoTracker/TkSeedingLayers/interface/SeedingHitSet.h"
0002 #include "DataFormats/TrackerRecHit2D/interface/TrackerSingleRecHit.h"
0003 #include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHit.h"
0004 #include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2D.h"
0005 #include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit1D.h"
0006 #include "DataFormats/TrackerRecHit2D/interface/MTDTrackingRecHit.h"
0007 #include "DataFormats/TrackerRecHit2D/interface/Phase2TrackerRecHit1D.h"
0008 
0009 #include "catch.hpp"
0010 
0011 #include <iostream>
0012 
0013 TEST_CASE("SeedingHitSet testing constructors", "[SeedingHitSet]") {
0014   using Hit = SeedingHitSet::RecHit;
0015   using HitPointer = SeedingHitSet::ConstRecHitPointer;
0016 
0017   HitPointer hitOne = new SiPixelRecHit();
0018   HitPointer hitTwo = new MTDTrackingRecHit();
0019   HitPointer hitThree = new SiStripRecHit1D();
0020   HitPointer hitFour = new SiStripRecHit2D();
0021   HitPointer hitFive = new Phase2TrackerRecHit1D();
0022 
0023   HitPointer HIT_NULL = nullptr;
0024 
0025   SECTION("Check vector constructor") {
0026     std::vector<HitPointer> containerOne = {hitOne, hitTwo, hitThree, hitFour, hitFive};
0027     std::vector<HitPointer> containerTwo = {hitOne, hitTwo, hitThree, HIT_NULL, hitFive};
0028     std::vector<HitPointer> containerThree = {hitOne, HIT_NULL, hitThree, hitFour, hitFive};
0029 
0030     SeedingHitSet vecOne(containerOne);
0031     REQUIRE(vecOne.size() == containerOne.size());
0032     SeedingHitSet vecTwo(containerTwo);
0033     REQUIRE(vecTwo.size() == 3);
0034     SeedingHitSet vecThree(containerThree);
0035     REQUIRE(vecThree.size() == 0);
0036   }
0037 
0038   SECTION("Check braced constructor") {
0039     SeedingHitSet listOne({hitThree, hitFive, hitFour});
0040     REQUIRE(listOne.size() == 3);
0041     SeedingHitSet listTwo({HIT_NULL, hitTwo, hitFour});
0042     REQUIRE(listTwo.size() == 0);
0043     SeedingHitSet listThree({hitTwo, hitFour, hitOne, hitFive, HIT_NULL});
0044     REQUIRE(listThree.size() == 4);
0045   }
0046 
0047   SECTION("Check two hits constructor") {
0048     SeedingHitSet twoHitsOne(hitOne, hitTwo);
0049     REQUIRE(twoHitsOne.size() == 2);
0050     SeedingHitSet twoHitsTwo(HIT_NULL, hitTwo);
0051     REQUIRE(twoHitsTwo.size() == 0);
0052     SeedingHitSet twoHitsThree(hitOne, HIT_NULL);
0053     REQUIRE(twoHitsThree.size() == 0);
0054   }
0055 
0056   SECTION("Check three hits constructor") {
0057     SeedingHitSet threeHitsOne(hitOne, hitTwo, hitThree);
0058     REQUIRE(threeHitsOne.size() == 3);
0059     SeedingHitSet threeHitsTwo(hitOne, hitTwo, HIT_NULL);
0060     REQUIRE(threeHitsTwo.size() == 2);
0061     SeedingHitSet threeHitsThree(hitOne, HIT_NULL, hitThree);
0062     REQUIRE(threeHitsThree.size() == 0);
0063   }
0064   SECTION("Check four hits constructor") {
0065     SeedingHitSet fourHitsOne(hitOne, hitTwo, hitThree, hitFour);
0066     REQUIRE(fourHitsOne.size() == 4);
0067     SeedingHitSet fourHitsTwo(hitOne, hitTwo, HIT_NULL, hitFour);
0068     REQUIRE(fourHitsTwo.size() == 2);
0069     SeedingHitSet fourHitsThree(hitOne, hitTwo, hitThree, HIT_NULL);
0070     REQUIRE(fourHitsThree.size() == 3);
0071     SeedingHitSet fourHitsFour(hitOne, HIT_NULL, hitThree, hitFour);
0072     REQUIRE(fourHitsFour.size() == 0);
0073   }
0074 }