File indexing completed on 2024-08-24 09:50:57
0001
0002
0003
0004
0005 #include "FWCore/Framework/interface/Event.h"
0006 #include "FWCore/Framework/interface/MakerMacros.h"
0007 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0008
0009 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0010
0011 #include "FWCore/ServiceRegistry/interface/Service.h"
0012 #include "CommonTools/UtilAlgos/interface/TFileService.h"
0013
0014 #include "CondFormats/L1TObjects/interface/CaloParams.h"
0015 #include "CondFormats/DataRecord/interface/L1TCaloParamsRcd.h"
0016
0017 #include "DataFormats/L1TCalorimeter/interface/CaloTower.h"
0018 #include "DataFormats/L1TCalorimeter/interface/CaloCluster.h"
0019 #include "DataFormats/L1Trigger/interface/EGamma.h"
0020 #include "DataFormats/L1Trigger/interface/Tau.h"
0021 #include "DataFormats/L1Trigger/interface/Jet.h"
0022 #include "DataFormats/L1Trigger/interface/EtSum.h"
0023
0024
0025 #include "TTree.h"
0026
0027 #include <string>
0028
0029
0030
0031
0032
0033 namespace l1t {
0034
0035 class L1TZDCAnalyzer : public edm::one::EDAnalyzer<edm::one::SharedResources> {
0036 public:
0037 explicit L1TZDCAnalyzer(const edm::ParameterSet&);
0038 ~L1TZDCAnalyzer() override = default;
0039
0040 static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0041
0042 private:
0043 void beginJob() override;
0044 void analyze(const edm::Event&, const edm::EventSetup&) override;
0045 void endJob() override;
0046
0047
0048 edm::Service<TFileService> fs_;
0049
0050 TTree* etSumZdcTree_;
0051
0052
0053 static const int maxBPX_ = 5;
0054 float etSumZdcP_[maxBPX_];
0055 float etSumZdcM_[maxBPX_];
0056
0057
0058 edm::EDGetToken sumToken_;
0059
0060 bool doHistos_;
0061
0062 TFileDirectory evtDispDir_;
0063 };
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076 L1TZDCAnalyzer::L1TZDCAnalyzer(const edm::ParameterSet& iConfig)
0077 : doHistos_(iConfig.getUntrackedParameter<bool>("doHistos", true)) {
0078 usesResource(TFileService::kSharedResource);
0079
0080
0081
0082 edm::InputTag nullTag("None");
0083
0084 edm::InputTag sumTag = iConfig.getParameter<edm::InputTag>("etSumTag");
0085 sumToken_ = consumes<l1t::EtSumBxCollection>(sumTag);
0086
0087 edm::LogInfo("L1TZDCAnalyzer") << "Processing " << sumTag.label() << std::endl;
0088 }
0089
0090
0091
0092
0093
0094
0095 void L1TZDCAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
0096 using namespace edm;
0097
0098
0099 Handle<BXVector<l1t::EtSum> > sums;
0100 iEvent.getByToken(sumToken_, sums);
0101
0102 int startBX = sums->getFirstBX();
0103
0104 for (int ibx = startBX; ibx <= sums->getLastBX(); ++ibx) {
0105 for (auto itr = sums->begin(ibx); itr != sums->end(ibx); ++itr) {
0106 if (itr->getType() == l1t::EtSum::EtSumType::kZDCP)
0107 etSumZdcP_[ibx - startBX] = itr->hwPt();
0108 if (itr->getType() == l1t::EtSum::EtSumType::kZDCM)
0109 etSumZdcM_[ibx - startBX] = itr->hwPt();
0110 }
0111 }
0112
0113 etSumZdcTree_->Fill();
0114 }
0115
0116
0117 void L1TZDCAnalyzer::beginJob() {
0118 etSumZdcTree_ = fs_->make<TTree>("etSumZdcTree", "");
0119 etSumZdcTree_->Branch("etSumZdcP", etSumZdcP_, ("etSumZdcP[" + std::to_string(maxBPX_) + "]/F").c_str());
0120 etSumZdcTree_->Branch("etSumZdcM", etSumZdcM_, ("etSumZdcM[" + std::to_string(maxBPX_) + "]/F").c_str());
0121 }
0122
0123
0124 void L1TZDCAnalyzer::endJob() {}
0125
0126
0127 void L1TZDCAnalyzer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0128 edm::ParameterSetDescription desc;
0129
0130 desc.add<edm::InputTag>("etSumTag", edm::InputTag("l1tZDCEtSums", ""));
0131 descriptions.add("l1tZDCAnalyzer", desc);
0132 }
0133
0134 }
0135
0136 using namespace l1t;
0137
0138
0139 DEFINE_FWK_MODULE(L1TZDCAnalyzer);