Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-04-27 23:38:18

0001 // system includes
0002 #include <iomanip>
0003 #include <iostream>
0004 #include <sstream>
0005 #include <string>
0006 #include <time.h>
0007 
0008 // user includes
0009 #include "DataFormats/SiStripCommon/interface/SiStripConstants.h"
0010 #include "DataFormats/SiStripCommon/interface/SiStripNullKey.h"
0011 #include "FWCore/Framework/interface/Event.h"
0012 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0013 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0014 
0015 /**
0016    @class testSiStripNullKey 
0017    @author R.Bainbridge
0018    @brief Simple class that tests SiStripNullKey.
0019 */
0020 class testSiStripNullKey : public edm::one::EDAnalyzer<> {
0021 public:
0022   testSiStripNullKey(const edm::ParameterSet&);
0023   ~testSiStripNullKey();
0024 
0025   void beginJob();
0026   void analyze(const edm::Event&, const edm::EventSetup&);
0027 };
0028 
0029 using namespace sistrip;
0030 
0031 // -----------------------------------------------------------------------------
0032 //
0033 testSiStripNullKey::testSiStripNullKey(const edm::ParameterSet& pset) {
0034   LogTrace(mlDqmCommon_) << "[testSiStripNullKey::" << __func__ << "]"
0035                          << " Constructing object...";
0036 }
0037 
0038 // -----------------------------------------------------------------------------
0039 //
0040 testSiStripNullKey::~testSiStripNullKey() {
0041   LogTrace(mlDqmCommon_) << "[testSiStripNullKey::" << __func__ << "]"
0042                          << " Destructing object...";
0043 }
0044 
0045 // -----------------------------------------------------------------------------
0046 //
0047 void testSiStripNullKey::beginJob() {
0048   // Tests for utility methods
0049 
0050   SiStripNullKey invalid;
0051   SiStripNullKey same(invalid);
0052   SiStripNullKey equal = invalid;
0053   SiStripNullKey equals;
0054   equals = invalid;
0055   SiStripKey* base = static_cast<SiStripKey*>(&invalid);
0056 
0057   std::stringstream ss;
0058 
0059   ss << "[SiStripNullKey::" << __func__ << "]"
0060      << " Tests for utility methods..." << std::endl;
0061 
0062   ss << ">>>> invalid: " << invalid << std::endl
0063      << ">>>> same:    " << same << std::endl
0064      << ">>>> equal:   " << equal << std::endl
0065      << ">>>> equals:  " << equals << std::endl
0066      << ">>>> base:    " << *base << std::endl;
0067 
0068   ss << ">>>> invalid.isInvalid: " << invalid.isInvalid() << std::endl
0069      << ">>>> invalid.isValid:   " << invalid.isValid() << std::endl;
0070 
0071   ss << ">>>> invalid.isEqual(invalid):      " << invalid.isEqual(invalid) << std::endl
0072      << ">>>> invalid.isConsistent(invalid): " << invalid.isConsistent(invalid) << std::endl
0073      << ">>>> invalid.isEqual(same):         " << invalid.isEqual(same) << std::endl
0074      << ">>>> invalid.isEqual(equal):        " << invalid.isEqual(equal) << std::endl
0075      << ">>>> invalid.isEqual(equals):       " << invalid.isEqual(equals) << std::endl;
0076   if (base) {
0077     ss << ">>>> base->isEqual(invalid):        " << base->isEqual(invalid) << std::endl
0078        << ">>>> base->isConsistent(invalid):   " << base->isConsistent(invalid) << std::endl;
0079   }
0080 
0081   LogTrace(mlDqmCommon_) << ss.str();
0082 }
0083 
0084 // -----------------------------------------------------------------------------
0085 //
0086 void testSiStripNullKey::analyze(const edm::Event& event, const edm::EventSetup& setup) {
0087   LogTrace(mlDqmCommon_) << "[SiStripNullKey::" << __func__ << "]"
0088                          << " Analyzing run/event " << event.id().run() << "/" << event.id().event();
0089 }
0090 
0091 #include "FWCore/Framework/interface/MakerMacros.h"
0092 DEFINE_FWK_MODULE(testSiStripNullKey);