Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:25:45

0001 #include "FWCore/Framework/interface/Frameworkfwd.h"
0002 #include "FWCore/Framework/interface/stream/EDAnalyzer.h"
0003 
0004 #include "FWCore/Framework/interface/Event.h"
0005 #include "FWCore/Framework/interface/MakerMacros.h"
0006 
0007 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0008 
0009 #include "DataFormats/EcalRecHit/interface/EcalUncalibratedRecHit.h"
0010 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
0011 
0012 #include <iostream>
0013 
0014 class EcalUncalibRecHitDump : public edm::stream::EDAnalyzer<> {
0015 public:
0016   explicit EcalUncalibRecHitDump(const edm::ParameterSet&);
0017 
0018 private:
0019   void analyze(const edm::Event&, const edm::EventSetup&) override;
0020 
0021 private:
0022   edm::EDGetTokenT<EcalUncalibratedRecHitCollection> EBUncalicRecHitCollectionT_;
0023   edm::EDGetTokenT<EcalUncalibratedRecHitCollection> EEUncalicRecHitCollectionT_;
0024 };
0025 
0026 EcalUncalibRecHitDump::EcalUncalibRecHitDump(const edm::ParameterSet& iConfig) {
0027   EBUncalicRecHitCollectionT_ =
0028       consumes<EcalUncalibratedRecHitCollection>(iConfig.getParameter<edm::InputTag>("EBUncalibRecHitCollection"));
0029   EEUncalicRecHitCollectionT_ =
0030       consumes<EcalUncalibratedRecHitCollection>(iConfig.getParameter<edm::InputTag>("EEUncalibRecHitCollection"));
0031 }
0032 
0033 void EcalUncalibRecHitDump::analyze(const edm::Event& ev, const edm::EventSetup&) {
0034   edm::Handle<EcalUncalibratedRecHitCollection> EBURecHits_;
0035   edm::Handle<EcalUncalibratedRecHitCollection> EEURecHits_;
0036 
0037   ev.getByToken(EBUncalicRecHitCollectionT_, EBURecHits_);
0038   ev.getByToken(EEUncalicRecHitCollectionT_, EEURecHits_);
0039 
0040   for (auto const& h : (*EBURecHits_))
0041     std::cout << "EB id: " << h.id() << " amplitude: " << h.amplitude() << " pedestal: " << h.pedestal()
0042               << " jitter: " << h.jitter() << " chi2: " << h.chi2() << " amplitudeError: " << h.amplitudeError()
0043               << " jitterErrorBits: " << int(h.jitterErrorBits()) << std::endl;
0044 
0045   for (auto const& h : (*EEURecHits_))
0046     std::cout << "EE id: " << h.id() << " amplitude: " << h.amplitude() << " pedestal: " << h.pedestal()
0047               << " jitter: " << h.jitter() << " chi2: " << h.chi2() << " amplitudeError: " << h.amplitudeError()
0048               << " jitterErrorBits: " << int(h.jitterErrorBits()) << std::endl;
0049 }
0050 
0051 DEFINE_FWK_MODULE(EcalUncalibRecHitDump);