File indexing completed on 2024-04-06 12:24:56
0001 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0002
0003 #include "FWCore/Framework/interface/Event.h"
0004 #include "FWCore/Framework/interface/MakerMacros.h"
0005
0006 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0007
0008 #include "DataFormats/CaloTowers/interface/CaloTowerCollection.h"
0009
0010 struct TestEgammaTowerIsolation : public edm::one::EDAnalyzer<> {
0011 explicit TestEgammaTowerIsolation(const edm::ParameterSet&) {}
0012
0013
0014
0015 private:
0016 void analyze(const edm::Event&, const edm::EventSetup&) override;
0017
0018 std::string towerLabel = "towerMaker";
0019 };
0020
0021 DEFINE_FWK_MODULE(TestEgammaTowerIsolation);
0022
0023 #include <iostream>
0024 void TestEgammaTowerIsolation::analyze(const edm::Event& iEvent, const edm::EventSetup&) {
0025 edm::Handle<CaloTowerCollection> towerHandle;
0026 iEvent.getByLabel(towerLabel, towerHandle);
0027 const CaloTowerCollection& towers = *towerHandle.product();
0028
0029 std::cout << "\n new event\n " << towers.size() << std::endl;
0030
0031 uint32_t nt = towers.size();
0032 for (uint32_t j = 0; j != nt; ++j) {
0033 std::cout << j << ": " << towers[j].eta() << ", " << towers[j].phi() << ", " << towers[j].id() << ", "
0034 << towers[j].ietaAbs() << ", " << std::sin(towers[j].theta()) << ", " << 1. / std::cosh(towers[j].eta())
0035 << ", " << towers[j].hadEnergy() << ", " << towers[j].hadEnergyHeInnerLayer() << ", "
0036 << towers[j].hadEnergyHeOuterLayer() << ", " << std::endl;
0037 }
0038 }