Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-03-01 00:02:34

0001 #include "DataFormats/Provenance/interface/ProcessHistoryID.h"
0002 #include "DataFormats/Provenance/interface/ProcessConfiguration.h"
0003 #include "DataFormats/Provenance/interface/ProcessHistory.h"
0004 
0005 #include "DataFormats/Provenance/interface/CompactEventAuxiliaryVector.h"
0006 
0007 #include "cppunit/extensions/HelperMacros.h"
0008 
0009 class TestCompactEventAuxiliaryVector : public CppUnit::TestFixture {
0010   CPPUNIT_TEST_SUITE(TestCompactEventAuxiliaryVector);
0011   CPPUNIT_TEST(fillAndCompare);
0012   CPPUNIT_TEST_SUITE_END();
0013 
0014 public:
0015   TestCompactEventAuxiliaryVector() {}
0016   ~TestCompactEventAuxiliaryVector() {}
0017   void setUp();
0018   void tearDown() {}
0019 
0020   void fillAndCompare();
0021 
0022 private:
0023   edm::ProcessHistoryID phid_;
0024 };
0025 
0026 CPPUNIT_TEST_SUITE_REGISTRATION(TestCompactEventAuxiliaryVector);
0027 
0028 void TestCompactEventAuxiliaryVector::setUp() {
0029   edm::ProcessConfiguration pc;
0030   auto processHistory = std::make_unique<edm::ProcessHistory>();
0031   edm::ProcessHistory& ph = *processHistory;
0032   processHistory->push_back(pc);
0033   phid_ = ph.id();
0034 }
0035 
0036 void TestCompactEventAuxiliaryVector::fillAndCompare() {
0037   std::vector<edm::EventAuxiliary> aux = {{{165121, 62, 23634374},
0038                                            "E403F8AD-A17F-E011-A42B-0022195E688C",
0039                                            edm::Timestamp((1305540804ULL << 32) + 10943758ULL),
0040                                            true,
0041                                            edm::EventAuxiliary::PhysicsTrigger,
0042                                            1995,
0043                                            0,
0044                                            16008401},
0045                                           {{165121, 62, 23643566},
0046                                            "A83A11AE-A17F-E011-A5F1-001EC9ADD952",
0047                                            edm::Timestamp((1305540804ULL << 32) + 20943758ULL),
0048                                            true,
0049                                            edm::EventAuxiliary::PhysicsTrigger,
0050                                            278,
0051                                            0,
0052                                            16014593},
0053                                           {{165121, 62, 23666070},
0054                                            "2E2618AE-A17F-E011-A82D-001EC9ADE1D1",
0055                                            edm::Timestamp((1305540805ULL << 32) + 10943758ULL),
0056                                            true,
0057                                            edm::EventAuxiliary::PhysicsTrigger,
0058                                            1981,
0059                                            0,
0060                                            16029687},
0061                                           {{165121, 62, 23666454},
0062                                            "F055F4AD-A17F-E011-9552-001517794E74",
0063                                            edm::Timestamp((1305540804ULL << 32) + 20943758ULL),
0064                                            true,
0065                                            edm::EventAuxiliary::PhysicsTrigger,
0066                                            611,
0067                                            0,
0068                                            16029970}};
0069 
0070   for (auto& a : aux) {
0071     a.setProcessHistoryID(phid_);
0072   }
0073 
0074   edm::CompactEventAuxiliaryVector caux;
0075   for (const auto& a : aux) {
0076     caux.push_back(a);
0077   }
0078 
0079   CPPUNIT_ASSERT(aux.size() == caux.size());
0080 
0081   auto j = caux.begin();
0082   for (auto i = aux.begin(); i != aux.end(); ++i, ++j) {
0083     CPPUNIT_ASSERT(edm::isSameEvent(*i, j->eventAuxiliary()));
0084   }
0085 
0086   auto i = aux.begin();
0087   j = caux.begin();
0088   i->id() = edm::EventID(165121, 62, 23634375);
0089   CPPUNIT_ASSERT(!edm::isSameEvent(*i, j->eventAuxiliary()));
0090 }