LDMX Software
NtuplizeTrigScintQIEDigis.cxx
1
3#include "TrigScint/Event/TrigScintQIEDigis.h"
4
5namespace dqm {
6
8 std::string input_name_, input_pass_;
9
10 int chan_id_, elec_id_, ldmxsw_event_;
11 uint32_t time_since_spill_;
12 std::vector<int> adc_, tdc_, cid_;
13
14 TTree* flat_tree_;
15
16 public:
17 NtuplizeTrigScintQIEDigis(std::string const& n, framework::Process& p)
18 : framework::Analyzer(n, p) {}
20
21 void configure(framework::config::Parameters& ps) final override {
22 input_name_ = ps.getParameter<std::string>("input_name");
23 input_pass_ = ps.getParameter<std::string>("input_pass");
24 }
25
26 void onProcessStart() final override;
27 void analyze(const framework::Event& event) final override;
28};
29
32 // cleaned up when histogram file is closed
33 flat_tree_ = new TTree("digis", "Ntuplized TS Digis");
34
35 flat_tree_->Branch("time_since_spill", &time_since_spill_);
36 flat_tree_->Branch("ldmxsw_event", &ldmxsw_event_);
37 flat_tree_->Branch("chan_id", &chan_id_);
38 flat_tree_->Branch("elec_id", &elec_id_);
39 flat_tree_->Branch("adc", &adc_);
40 flat_tree_->Branch("tdc", &tdc_);
41 flat_tree_->Branch("cid", &cid_);
42}
43
45 const auto& digis{event.getCollection<trigscint::TrigScintQIEDigis>(
46 input_name_, input_pass_)};
47 ldmxsw_event_ = event.getEventNumber();
48 for (const auto& digi : digis) {
49 time_since_spill_ = digi.getTimeSinceSpill();
50 chan_id_ = digi.getChanID();
51 elec_id_ = digi.getElecID();
52 adc_ = digi.getADC();
53 tdc_ = digi.getTDC();
54 cid_ = digi.getCID();
55 flat_tree_->Fill();
56 }
57}
58
59} // namespace dqm
60
61DECLARE_ANALYZER_NS(dqm, NtuplizeTrigScintQIEDigis);
Base classes for all user event processing components to extend.
#define DECLARE_ANALYZER_NS(NS, CLASS)
Macro which allows the framework to construct an analyzer given its name during configuration.
void analyze(const framework::Event &event) final override
Process the event and make histograms or summaries.
void onProcessStart() final override
Callback for the EventProcessor to take any necessary action when the processing of events starts,...
void configure(framework::config::Parameters &ps) final override
Callback for the EventProcessor to configure itself from the given set of parameters.
Base class for a module which does not produce a data product.
TDirectory * getHistoDirectory()
Access/create a directory in the histogram file for this event processor to create histograms and ana...
Implements an event buffer system for storing event data.
Definition Event.h:41
Class which represents the process under execution.
Definition Process.h:36
Class encapsulating parameters for configuring a processor.
Definition Parameters.h:27
class for storing QIE output
uint32_t getTimeSinceSpill() const
Store the event time since spill counter.
All classes in the ldmx-sw project use this namespace.
Definition PerfDict.cxx:45