Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:52:53

0001 /* Unit test for CaloCluster
0002    Stefano Argiro', Dec 2010
0003 
0004  */
0005 
0006 #include <cppunit/extensions/HelperMacros.h>
0007 #include "DataFormats/CaloRecHit/interface/CaloCluster.h"
0008 #include "DataFormats/Math/interface/Point3D.h"
0009 #include "DataFormats/CaloRecHit/interface/CaloID.h"
0010 #include "DataFormats/DetId/interface/DetId.h"
0011 
0012 class testCaloCluster : public CppUnit::TestFixture {
0013   CPPUNIT_TEST_SUITE(testCaloCluster);
0014   CPPUNIT_TEST(FlagsTest);
0015   CPPUNIT_TEST_SUITE_END();
0016 
0017 public:
0018   void setUp() {}
0019   void tearDown() {}
0020 
0021   void FlagsTest();
0022 };
0023 
0024 ///registration of the test so that the runner can find it
0025 CPPUNIT_TEST_SUITE_REGISTRATION(testCaloCluster);
0026 
0027 void testCaloCluster::FlagsTest() {
0028   using namespace reco;
0029   using namespace math;
0030 
0031   CaloCluster c1(0., XYZPoint(), CaloID(), CaloCluster::island, CaloCluster::cleanOnly);
0032   CPPUNIT_ASSERT(c1.flags() == CaloCluster::cleanOnly);
0033   CPPUNIT_ASSERT(c1.isInClean() == true);
0034   CPPUNIT_ASSERT(c1.isInUnclean() == false);
0035 
0036   CaloCluster c2(0., XYZPoint(), CaloID(), CaloCluster::island, CaloCluster::uncleanOnly);
0037   CPPUNIT_ASSERT(c2.flags() == CaloCluster::uncleanOnly);
0038   CPPUNIT_ASSERT(c2.isInUnclean() == true);
0039   CPPUNIT_ASSERT(c2.isInClean() == false);
0040 
0041   CaloCluster c3(0., XYZPoint(), CaloID(), CaloCluster::island, CaloCluster::common);
0042   CPPUNIT_ASSERT(c3.flags() == CaloCluster::common);
0043   CPPUNIT_ASSERT(c3.isInUnclean() == true);
0044   CPPUNIT_ASSERT(c3.isInClean() == true);
0045 
0046   c3.setFlags(CaloCluster::common);
0047   CPPUNIT_ASSERT(c3.isInUnclean() == true);
0048   CPPUNIT_ASSERT(c3.isInClean() == true);
0049   CPPUNIT_ASSERT(c3.flags() == CaloCluster::common);
0050 
0051   c3.setFlags(CaloCluster::uncleanOnly);
0052   CPPUNIT_ASSERT(c3.isInUnclean() == true);
0053   CPPUNIT_ASSERT(c3.isInClean() == false);
0054   CPPUNIT_ASSERT(c3.flags() == CaloCluster::uncleanOnly);
0055 
0056   c3.setFlags(CaloCluster::cleanOnly);
0057   CPPUNIT_ASSERT(c3.isInUnclean() == false);
0058   CPPUNIT_ASSERT(c3.isInClean() == true);
0059   CPPUNIT_ASSERT(c3.flags() == CaloCluster::cleanOnly);
0060 }