CMS 3D CMS Logo

L1CaloSummaryTreeProducer.cc
Go to the documentation of this file.
1 // Producer for the CaloSummary cards emulator
2 // Author: Andrew Loeliger
3 // Presumably the L1TNtuple Format is going to last very long with the advent of L1NanoAOD,
4 // But as of now, this is the only way to get CICADA into official menu studying tools
5 
6 #include <memory>
7 
15 
18 #include "TTree.h"
19 
21 
24 
25 class L1CaloSummaryTreeProducer : public edm::one::EDAnalyzer<edm::one::SharedResources> {
26 public:
28  ~L1CaloSummaryTreeProducer() override;
29 
30 private:
31  void beginJob() override{};
32  void analyze(const edm::Event&, const edm::EventSetup&) override;
33  void endJob() override{};
34 
35 public:
37 
38 private:
42  TTree* tree_;
43 };
44 
46  : scoreToken_(consumes<float>(iConfig.getUntrackedParameter<edm::InputTag>("scoreToken"))),
47  regionToken_(consumes<L1CaloRegionCollection>(iConfig.getUntrackedParameter<edm::InputTag>("regionToken"))) {
48  usesResource(TFileService::kSharedResource);
49  tree_ = fs_->make<TTree>("L1CaloSummaryTree", "L1CaloSummaryTree");
50  tree_->Branch("CaloSummary", "L1Analysis::L1AnalysisCaloSummaryDataFormat", &caloSummaryData_, 32000, 3);
51 
53 }
54 
57 
59  iEvent.getByToken(regionToken_, regions);
60 
61  if (regions.isValid()) {
62  for (const auto& itr : *regions) {
63  caloSummaryData_->modelInput[itr.gctPhi()][itr.gctEta() - 4] =
64  itr.et(); //4 is subtracted off of the Eta to account for the 4+4 forward/backward HF regions that are not used in CICADA. These take offset the iEta by 4
65  }
66  } else {
67  edm::LogWarning("L1Ntuple") << "Could not find region regions. CICADA model input will not be filled";
68  }
69 
71  iEvent.getByToken(scoreToken_, score);
72  if (score.isValid())
74  else
75  edm::LogWarning("L1Ntuple") << "Could not find a proper CICADA score. CICADA score will not be filled.";
76 
77  tree_->Fill();
78 }
79 
81 
static const std::string kSharedResource
Definition: TFileService.h:76
L1CaloSummaryTreeProducer(const edm::ParameterSet &)
const edm::EDGetTokenT< float > scoreToken_
void analyze(const edm::Event &, const edm::EventSetup &) override
int iEvent
Definition: GenABIO.cc:224
L1Analysis::L1AnalysisCaloSummaryDataFormat * caloSummaryData_
const edm::EDGetTokenT< L1CaloRegionCollection > regionToken_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
HLT enums.
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
std::vector< L1CaloRegion > L1CaloRegionCollection
Log< level::Warning, false > LogWarning
edm::Service< TFileService > fs_