Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-11-11 03:56:56

0001 // system include files
0002 #include <iostream>
0003 #include <cstdio>
0004 #include <sys/time.h>
0005 
0006 // user include files
0007 #include "FWCore/Framework/interface/Frameworkfwd.h"
0008 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0009 #include "FWCore/Framework/interface/Event.h"
0010 #include "FWCore/Framework/interface/EventSetup.h"
0011 #include "FWCore/ServiceRegistry/interface/Service.h"
0012 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0013 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0014 #include "CondFormats/DataRecord/interface/SiStripLorentzAngleRcd.h"
0015 #include "CondFormats/SiStripObjects/interface/SiStripLorentzAngle.h"
0016 
0017 //
0018 //
0019 // class decleration
0020 //
0021 class SiStripLorentzAngleReader : public edm::one::EDAnalyzer<> {
0022 public:
0023   explicit SiStripLorentzAngleReader(const edm::ParameterSet&);
0024   ~SiStripLorentzAngleReader() override = default;
0025 
0026   void analyze(const edm::Event&, const edm::EventSetup&) override;
0027 
0028 private:
0029   uint32_t printdebug_;
0030   std::string label_;
0031   const edm::ESGetToken<SiStripLorentzAngle, SiStripLorentzAngleRcd> laToken_;
0032 };
0033 
0034 using namespace cms;
0035 
0036 SiStripLorentzAngleReader::SiStripLorentzAngleReader(const edm::ParameterSet& iConfig)
0037     : printdebug_(iConfig.getUntrackedParameter<uint32_t>("printDebug", 5)),
0038       label_(iConfig.getUntrackedParameter<std::string>("label", "")),
0039       laToken_(esConsumes(edm::ESInputTag{"", label_})) {}
0040 
0041 void SiStripLorentzAngleReader::analyze(const edm::Event& e, const edm::EventSetup& iSetup) {
0042   const auto& lorentzAngles = iSetup.getData(laToken_);
0043   edm::LogInfo("SiStripLorentzAngleReader")
0044       << "[SiStripLorentzAngleReader::analyze] End Reading SiStripLorentzAngle with label " << label_ << std::endl;
0045 
0046   std::map<unsigned int, float> detid_la = lorentzAngles.getLorentzAngles();
0047   std::map<unsigned int, float>::const_iterator it;
0048   size_t count = 0;
0049   for (it = detid_la.begin(); it != detid_la.end() && count < printdebug_; it++) {
0050     edm::LogInfo("SiStripLorentzAngleReader") << "detid " << it->first << " \t"
0051                                               << " Lorentz angle  " << it->second;
0052     count++;
0053   }
0054 }
0055 
0056 #include "FWCore/PluginManager/interface/ModuleDef.h"
0057 #include "FWCore/Framework/interface/MakerMacros.h"
0058 
0059 DEFINE_FWK_MODULE(SiStripLorentzAngleReader);