CMS 3D CMS Logo

L1HOTreeProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: L1Trigger/L1Ntuples
4 // Class: L1HOTreeProducer
5 //
6 
7 // system include files
8 #include <memory>
9 
10 // framework
17 
18 // data formats
21 
22 // ROOT output stuff
25 #include "TTree.h"
26 
28 
29 //
30 // class declaration
31 //
32 
34 public:
35  explicit L1HOTreeProducer(const edm::ParameterSet&);
36  ~L1HOTreeProducer() override;
37 
38 private:
39  void beginJob(void) override;
40  void analyze(const edm::Event&, const edm::EventSetup&) override;
41  void endJob() override;
42 
43 public:
46 
47 private:
48  // output file
50 
51  // tree
52  TTree* tree_;
53 
54  // EDM input tags
56 };
57 
60  consumes<edm::SortedCollection<HODataFrame>>(iConfig.getUntrackedParameter<edm::InputTag>("hoDataFrameToken"));
61 
62  l1HOData = l1HO.getData();
63 
64  // set up output
65  tree_ = fs_->make<TTree>("L1HOTree", "L1HOTree");
66  tree_->Branch("L1HO", "L1Analysis::L1AnalysisL1HODataFormat", &l1HOData, 32000, 3);
67 }
68 
70 
71 //
72 // member functions
73 //
74 
75 // ------------ method called to for each event ------------
77  l1HO.Reset();
78 
80 
81  iEvent.getByToken(hoDataFrameToken_, hoDataFrame);
82 
83  if (hoDataFrame.isValid()) {
84  l1HO.SetHO(*hoDataFrame);
85  } else {
86  edm::LogWarning("MissingProduct") << "HODataFrame not found. Branch will not be filled" << std::endl;
87  }
88 
89  tree_->Fill();
90 }
91 
92 // ------------ method called once each job just before starting event loop ------------
94 
95 // ------------ method called once each job just after ending the event loop ------------
97 
98 //define this as a plug-in
MessageLogger.h
edm::EDGetTokenT
Definition: EDGetToken.h:33
L1Analysis::L1AnalysisL1HODataFormat
Definition: L1AnalysisL1HODataFormat.h:7
HODataFrame.h
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
EDAnalyzer.h
L1HOTreeProducer::~L1HOTreeProducer
~L1HOTreeProducer() override
Definition: L1HOTreeProducer.cc:69
edm::Handle
Definition: AssociativeIterator.h:50
L1HOTreeProducer::hoDataFrameToken_
edm::EDGetTokenT< edm::SortedCollection< HODataFrame > > hoDataFrameToken_
Definition: L1HOTreeProducer.cc:55
L1AnalysisL1HO.h
edm::EDAnalyzer
Definition: EDAnalyzer.h:29
L1HOTreeProducer::l1HOData
L1Analysis::L1AnalysisL1HODataFormat * l1HOData
Definition: L1HOTreeProducer.cc:45
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Service.h
L1Analysis::L1AnalysisL1HO
Definition: L1AnalysisL1HO.h:9
L1Analysis::L1AnalysisL1HO::SetHO
void SetHO(const edm::SortedCollection< HODataFrame > &hoDataFrame)
Definition: L1AnalysisL1HO.cc:6
L1HOTreeProducer::l1HO
L1Analysis::L1AnalysisL1HO l1HO
Definition: L1HOTreeProducer.cc:44
edm::LogWarning
Definition: MessageLogger.h:141
TFileService.h
L1HOTreeProducer
Definition: L1HOTreeProducer.cc:33
L1Analysis::L1AnalysisL1HO::getData
L1AnalysisL1HODataFormat * getData()
Definition: L1AnalysisL1HO.h:15
edm::ParameterSet
Definition: ParameterSet.h:36
L1HOTreeProducer::tree_
TTree * tree_
Definition: L1HOTreeProducer.cc:52
Event.h
edm::Service< TFileService >
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:57
L1HOTreeProducer::fs_
edm::Service< TFileService > fs_
Definition: L1HOTreeProducer.cc:49
Frameworkfwd.h
L1HOTreeProducer::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: L1HOTreeProducer.cc:76
SortedCollection.h
L1Analysis::L1AnalysisL1HO::Reset
void Reset()
Definition: L1AnalysisL1HO.h:13
L1HOTreeProducer::beginJob
void beginJob(void) override
Definition: L1HOTreeProducer.cc:93
ParameterSet.h
L1HOTreeProducer::endJob
void endJob() override
Definition: L1HOTreeProducer.cc:96
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
TFileService::make
T * make(const Args &... args) const
make new ROOT object
Definition: TFileService.h:64
L1HOTreeProducer::L1HOTreeProducer
L1HOTreeProducer(const edm::ParameterSet &)
Definition: L1HOTreeProducer.cc:58