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 
25 
26 class L1CaloSummaryTreeProducer : public edm::one::EDAnalyzer<edm::one::SharedResources> {
27 public:
29  ~L1CaloSummaryTreeProducer() override;
30 
31 private:
32  void beginJob() override {}
33  void analyze(const edm::Event&, const edm::EventSetup&) override;
34  void endJob() override {}
35 
36 public:
38 
39 private:
43  TTree* tree_;
44 };
45 
47  : scoreToken_(consumes<l1t::CICADABxCollection>(iConfig.getUntrackedParameter<edm::InputTag>("scoreToken"))),
48  regionToken_(consumes<L1CaloRegionCollection>(iConfig.getUntrackedParameter<edm::InputTag>("regionToken"))) {
49  usesResource(TFileService::kSharedResource);
50  tree_ = fs_->make<TTree>("L1CaloSummaryTree", "L1CaloSummaryTree");
51  tree_->Branch("CaloSummary", "L1Analysis::L1AnalysisCaloSummaryDataFormat", &caloSummaryData_, 32000, 3);
52 
54 }
55 
58 
60  iEvent.getByToken(regionToken_, regions);
61 
62  if (regions.isValid()) {
63  for (const auto& itr : *regions) {
64  caloSummaryData_->modelInput[itr.gctPhi()][itr.gctEta() - 4] =
65  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
66  }
67  } else {
68  edm::LogWarning("L1Ntuple") << "Could not find region regions. CICADA model input will not be filled";
69  }
70 
72  iEvent.getByToken(scoreToken_, score);
73  if (score.isValid())
74  caloSummaryData_->CICADAScore = score->at(0, 0);
75  else
76  edm::LogWarning("L1Ntuple") << "Could not find a proper CICADA score. CICADA score will not be filled.";
77 
78  tree_->Fill();
79 }
80 
82 
static const std::string kSharedResource
Definition: TFileService.h:76
L1CaloSummaryTreeProducer(const edm::ParameterSet &)
const edm::EDGetTokenT< l1t::CICADABxCollection > scoreToken_
delete x;
Definition: CaloConfig.h:22
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
BXVector< float > CICADABxCollection
Definition: CICADA.h:7
std::vector< L1CaloRegion > L1CaloRegionCollection
Log< level::Warning, false > LogWarning
edm::Service< TFileService > fs_