Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-07-03 04:18:12

0001 #include "DataFormats/HGCalReco/interface/HGCalSoARecHitsExtraHostCollection.h"
0002 #include "FWCore/Framework/interface/Event.h"
0003 #include "FWCore/Framework/interface/Frameworkfwd.h"
0004 #include "FWCore/Framework/interface/global/EDAnalyzer.h"
0005 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0006 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0007 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0008 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0009 #include "FWCore/Utilities/interface/EDGetToken.h"
0010 #include "FWCore/Utilities/interface/Exception.h"
0011 #include "FWCore/Utilities/interface/InputTag.h"
0012 
0013 #include <fmt/format.h>
0014 
0015 class HGCalLayerClusterHeterogeneousDumper : public edm::global::EDAnalyzer<> {
0016 public:
0017   HGCalLayerClusterHeterogeneousDumper(edm::ParameterSet const& iConfig)
0018       : token_{consumes(iConfig.getParameter<edm::InputTag>("src"))} {}
0019 
0020   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0021     edm::ParameterSetDescription desc;
0022     desc.add<edm::InputTag>("src", edm::InputTag("hltHgcalSoARecHitsLayerClustersProducer"));
0023     descriptions.addWithDefaultLabel(desc);
0024   }
0025 
0026   void analyze(edm::StreamID iStream, edm::Event const& iEvent, edm::EventSetup const& iSetup) const override {
0027     auto const& data = iEvent.get(token_);
0028 
0029     auto const view = data.view();
0030     std::cout << fmt::format("view.numberOfClusters() = {}", view.numberOfClustersScalar()) << std::endl;
0031     for (int i = 0; i < data->metadata().size(); ++i) {
0032       std::cout << fmt::format("view[{}].clusterIndex() = {}", i, view.clusterIndex(i)) << std::endl;
0033     }
0034   }
0035 
0036 private:
0037   edm::EDGetTokenT<HGCalSoARecHitsExtraHostCollection> const token_;
0038 };
0039 
0040 #include "FWCore/Framework/interface/MakerMacros.h"
0041 DEFINE_FWK_MODULE(HGCalLayerClusterHeterogeneousDumper);