Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 // system includes
0002 #include <algorithm>
0003 #include <cstdint>
0004 #include <iomanip>
0005 #include <iostream>
0006 #include <sstream>
0007 #include <string>
0008 #include <time.h>
0009 #include <vector>
0010 
0011 // user includes
0012 #include "DataFormats/SiStripCommon/interface/Constants.h"
0013 #include "DataFormats/SiStripCommon/interface/SiStripConstants.h"
0014 #include "DataFormats/SiStripCommon/interface/SiStripFecKey.h"
0015 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0016 #include "FWCore/Framework/interface/Event.h"
0017 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0018 
0019 /**
0020    @class examplesSiStripFecKey 
0021    @author R.Bainbridge
0022    @brief Simple class that tests SiStripFecKey.
0023 */
0024 
0025 class examplesSiStripFecKey : public edm::one::EDAnalyzer<> {
0026 public:
0027   examplesSiStripFecKey(const edm::ParameterSet&);
0028   ~examplesSiStripFecKey();
0029 
0030   void beginJob();
0031   void analyze(const edm::Event&, const edm::EventSetup&);
0032 
0033 private:
0034   void buildKeys(std::vector<uint32_t>&);
0035 };
0036 
0037 using namespace sistrip;
0038 
0039 // -----------------------------------------------------------------------------
0040 //
0041 examplesSiStripFecKey::examplesSiStripFecKey(const edm::ParameterSet& pset) {
0042   LogTrace(mlDqmCommon_) << "[examplesSiStripFecKey::" << __func__ << "]"
0043                          << " Constructing object...";
0044 }
0045 
0046 // -----------------------------------------------------------------------------
0047 //
0048 examplesSiStripFecKey::~examplesSiStripFecKey() {
0049   LogTrace(mlDqmCommon_) << "[examplesSiStripFecKey::" << __func__ << "]"
0050                          << " Destructing object...";
0051 }
0052 
0053 // -----------------------------------------------------------------------------
0054 //
0055 void examplesSiStripFecKey::beginJob() {
0056   SiStripFecKey invalid;
0057   SiStripFecKey inv(sistrip::invalid_,
0058                     sistrip::invalid_,
0059                     sistrip::invalid_,
0060                     sistrip::invalid_,
0061                     sistrip::invalid_,
0062                     sistrip::invalid_,
0063                     sistrip::invalid_);
0064   SiStripFecKey valid(1, 2, 1, 1, 16, 1, 32);
0065   SiStripFecKey all(0, 0, 0, 0, 0, 0, 0);
0066   SiStripFecKey same(valid);
0067   SiStripFecKey equal = valid;
0068   SiStripFecKey equals;
0069   equals = valid;
0070   SiStripFecKey to_gran(valid, sistrip::CCU_CHAN);
0071 
0072   std::stringstream ss;
0073 
0074   ss << "[SiStripFecKey::" << __func__ << "]"
0075      << " Tests for utility methods..." << std::endl;
0076 
0077   ss << ">>>> invalid.path: " << invalid << std::endl
0078      << ">>>> inv.path:     " << inv << std::endl
0079      << ">>>> valid.path:   " << valid << std::endl
0080      << ">>>> all.path:     " << all << std::endl
0081      << ">>>> same.path:    " << same << std::endl
0082      << ">>>> equal.path:   " << equal << std::endl
0083      << ">>>> equals.path:  " << equals << std::endl
0084      << ">>>> to_gran.path: " << to_gran << std::endl;
0085 
0086   ss << std::hex << ">>>> invalid.key:  " << invalid.key() << std::endl
0087      << ">>>> valid.key:    " << valid.key() << std::endl
0088      << ">>>> all.key:      " << all.key() << std::endl
0089      << std::dec;
0090 
0091   ss << ">>>> invalid.isInvalid: " << invalid.isInvalid() << std::endl
0092      << ">>>> invalid.isValid:   " << invalid.isValid() << std::endl
0093      << ">>>> valid.isInvalid:   " << valid.isInvalid() << std::endl
0094      << ">>>> valid.isValid:     " << valid.isValid() << std::endl
0095      << ">>>> all.isInvalid:     " << all.isInvalid() << std::endl
0096      << ">>>> all.isValid:       " << all.isValid() << std::endl;
0097 
0098   ss << ">>>> valid.isEqual(valid):        " << valid.isEqual(valid) << std::endl
0099      << ">>>> valid.isConsistent(valid):   " << valid.isConsistent(valid) << std::endl
0100      << ">>>> valid.isEqual(invalid):      " << valid.isEqual(invalid) << std::endl
0101      << ">>>> valid.isConsistent(invalid): " << valid.isConsistent(invalid) << std::endl
0102      << ">>>> valid.isEqual(all):          " << valid.isEqual(all) << std::endl
0103      << ">>>> valid.isConsistent(all):     " << valid.isConsistent(all) << std::endl
0104      << ">>>> valid.isEqual(same):         " << valid.isEqual(same) << std::endl
0105      << ">>>> valid.isEqual(equal):        " << valid.isEqual(equal) << std::endl
0106      << ">>>> valid.isEqual(equals):       " << valid.isEqual(equals) << std::endl;
0107 
0108   LogTrace(mlDqmCommon_) << ss.str();
0109 }
0110 
0111 // -----------------------------------------------------------------------------
0112 //
0113 void examplesSiStripFecKey::analyze(const edm::Event& event, const edm::EventSetup& setup) {
0114   LogTrace(mlDqmCommon_) << "[SiStripFecKey::" << __func__ << "]"
0115                          << " Analyzing run/event " << event.id().run() << "/" << event.id().event();
0116 }
0117 
0118 #include "FWCore/Framework/interface/MakerMacros.h"
0119 DEFINE_FWK_MODULE(examplesSiStripFecKey);