LDMX Software
dqm::NtuplizeHgcrocDigiCollection Class Reference

Public Member Functions

 NtuplizeHgcrocDigiCollection (std::string const &n, framework::Process &p)
 
void configure (framework::config::Parameters &ps) final override
 Callback for the EventProcessor to configure itself from the given set of parameters.
 
void onProcessStart () final override
 Callback for the EventProcessor to take any necessary action when the processing of events starts, such as creating histograms.
 
void analyze (const framework::Event &event) final override
 Process the event and make histograms or summaries.
 
- Public Member Functions inherited from framework::Analyzer
 Analyzer (const std::string &name, Process &process)
 Class constructor.
 
virtual void process (Event &event) final
 Processing an event for an Analyzer is calling analyze.
 
virtual void beforeNewRun (ldmx::RunHeader &run_header) final
 Don't allow Analyzers to add parameters to the run header.
 
- Public Member Functions inherited from framework::EventProcessor
 DECLARE_FACTORY (EventProcessor, EventProcessor *, const std::string &, Process &)
 declare that we have a factory for this class
 
 EventProcessor (const std::string &name, Process &process)
 Class constructor.
 
virtual ~EventProcessor ()=default
 Class destructor.
 
virtual void onNewRun (const ldmx::RunHeader &run_header)
 Callback for the EventProcessor to take any necessary action when the run being processed changes.
 
virtual void onFileOpen (EventFile &event_file)
 Callback for the EventProcessor to take any necessary action when a new event input ROOT file is opened.
 
virtual void onFileClose (EventFile &event_file)
 Callback for the EventProcessor to take any necessary action when a event input ROOT file is closed.
 
virtual void onProcessEnd ()
 Callback for the EventProcessor to take any necessary action when the processing of events finishes, such as calculating job-summary quantities.
 
template<class T >
const T & getCondition (const std::string &condition_name)
 Access a conditions object for the current event.
 
TDirectory * getHistoDirectory ()
 Access/create a directory in the histogram file for this event processor to create histograms and analysis tuples.
 
void setStorageHint (framework::StorageControl::Hint hint)
 Mark the current event as having the given storage control hint from this module_.
 
void setStorageHint (framework::StorageControl::Hint hint, const std::string &purposeString)
 Mark the current event as having the given storage control hint from this module and the given purpose string.
 
int getLogFrequency () const
 Get the current logging frequency from the process.
 
int getRunNumber () const
 Get the run number from the process.
 
std::string getName () const
 Get the processor name.
 
void createHistograms (const std::vector< framework::config::Parameters > &histos)
 Internal function which is used to create histograms passed from the python configuration @parma histos vector of Parameters that configure histograms to create.
 

Private Attributes

std::string input_name_
 
std::string input_pass_
 
std::string pedestal_table_
 
int ldmxsw_event_
 
int version_
 
int pf_event_
 
int pf_ticks_
 
int pf_spill_
 
int raw_id_
 
int adc_
 
int raw_adc_
 
int tot_
 
int toa_
 
int i_sample_
 
int fpga_
 
int link_
 
int channel_
 
int index_
 
int section_
 
int layer_
 
int strip_
 
int end_
 
bool tot_prog_
 
bool tot_comp_
 
bool aligned_
 
bool using_eid_
 
bool already_aligned_
 
bool good_link_
 
TTree * flat_tree_
 

Additional Inherited Members

- Protected Member Functions inherited from framework::EventProcessor
void abortEvent ()
 Abort the event immediately.
 
- Protected Attributes inherited from framework::EventProcessor
HistogramPool histograms_
 helper object for making and filling histograms
 
NtupleManagerntuple_ {NtupleManager::getInstance()}
 Manager for any ntuples.
 
logging::logger the_log_
 The logger for this EventProcessor.
 

Detailed Description

Definition at line 11 of file NtuplizeHgcrocDigiCollection.cxx.

Constructor & Destructor Documentation

◆ NtuplizeHgcrocDigiCollection()

dqm::NtuplizeHgcrocDigiCollection::NtuplizeHgcrocDigiCollection ( std::string const & n,
framework::Process & p )
inline

Definition at line 23 of file NtuplizeHgcrocDigiCollection.cxx.

24 : framework::Analyzer(n, p) {}
Base class for a module which does not produce a data product.

◆ ~NtuplizeHgcrocDigiCollection()

dqm::NtuplizeHgcrocDigiCollection::~NtuplizeHgcrocDigiCollection ( )
inline

Definition at line 25 of file NtuplizeHgcrocDigiCollection.cxx.

25{}

Member Function Documentation

◆ analyze()

void dqm::NtuplizeHgcrocDigiCollection::analyze ( const framework::Event & event)
finaloverridevirtual

Process the event and make histograms or summaries.

Parameters
eventThe Event to analyze

Implements framework::Analyzer.

Definition at line 72 of file NtuplizeHgcrocDigiCollection.cxx.

72 {
73 // get the reconstruction parameters
74 auto pedestal_table{
78
79 ldmxsw_event_ = event.getEventNumber();
80
81 bool is_simulation = not event.getEventHeader().isRealData();
82
83 if (not is_simulation) {
84 if (already_aligned_) {
85 aligned_ = event.getObject<bool>(input_name_ + "Aligned", input_pass_);
86 } else {
87 aligned_ = false;
88 version_ = event.getObject<int>(input_name_ + "Version", input_pass_);
89 pf_event_ = event.getObject<int>(input_name_ + "Number", input_pass_);
90 pf_ticks_ = event.getObject<int>(input_name_ + "Ticks", input_pass_);
91 pf_spill_ = event.getObject<int>(input_name_ + "Spill", input_pass_);
92 }
93 } else {
94 aligned_ = true;
95 version_ = 0;
96 pf_event_ = ldmxsw_event_;
97 pf_ticks_ = 0;
98 pf_spill_ = 0;
99 }
100
101 std::vector<bool> good_bxheader;
102 std::vector<bool> good_trailer;
103
104 if (not is_simulation) {
105 good_bxheader =
106 event.getCollection<bool>(input_name_ + "GoodLinkHeader", input_pass_);
107 good_trailer =
108 event.getCollection<bool>(input_name_ + "GoodLinkTrailer", input_pass_);
109 }
110
111 auto const& digis{
112 event.getObject<ldmx::HgcrocDigiCollection>(input_name_, input_pass_)};
113
114 for (std::size_t i_digi{0}; i_digi < digis.size(); i_digi++) {
115 auto d{digis.getDigi(i_digi)};
116 raw_id_ = static_cast<int>(d.id());
117 if (using_eid_) {
118 ldmx::HcalElectronicsID eid(d.id());
119 fpga_ = eid.fiber();
120 link_ = eid.elink();
121 if (!is_simulation) {
122 good_link_ = (good_bxheader.at(link_) and good_trailer.at(link_));
123 } else {
124 good_link_ = true;
125 }
126 channel_ = eid.channel();
127 index_ = eid.index();
128 } else {
129 ldmx::HcalDigiID detid(d.id());
130 ldmx::HcalElectronicsID eid = detmap.get(detid);
131 int link = eid.elink();
132 if (!is_simulation) {
133 good_link_ = (good_bxheader.at(link) and good_trailer.at(link));
134 } else {
135 good_link_ = true;
136 }
137 section_ = detid.section();
138 layer_ = detid.layer();
139 strip_ = detid.strip();
140 end_ = detid.end();
141 }
142
143 for (i_sample_ = 0; i_sample_ < digis.getNumSamplesPerDigi(); i_sample_++) {
144 tot_prog_ = d.at(i_sample_).isTOTinProgress();
145 tot_comp_ = d.at(i_sample_).isTOTComplete();
146 tot_ = d.at(i_sample_).tot();
147 toa_ = d.at(i_sample_).toa();
148 int adc_t = d.at(i_sample_).adcT();
149 raw_adc_ = adc_t;
150 adc_ = adc_t - pedestal_table.get(d.id(), 0);
151 flat_tree_->Fill();
152 }
153 }
154}
const T & getCondition(const std::string &condition_name)
Access a conditions object for the current event.
static constexpr const char * CONDITIONS_OBJECT_NAME
The name of the EID <-> DetID map for the ECal.
Extension of HcalAbstractID providing access to HCal digi information.
Definition HcalDigiID.h:13
Identifies a location in the Hcal readout chain.
int elink() const
Get the value of the elink from the ID.
Represents a collection of the digi hits readout by an HGCROC.

References ldmx::HcalElectronicsID::channel(), hcal::HcalDetectorMap::CONDITIONS_OBJECT_NAME, ldmx::HcalElectronicsID::elink(), ldmx::HcalDigiID::end(), ldmx::HcalElectronicsID::fiber(), framework::EventProcessor::getCondition(), ldmx::HcalElectronicsID::index(), ldmx::HcalDigiID::layer(), ldmx::HcalDigiID::section(), and ldmx::HcalDigiID::strip().

◆ configure()

void dqm::NtuplizeHgcrocDigiCollection::configure ( framework::config::Parameters & parameters)
inlinefinaloverridevirtual

Callback for the EventProcessor to configure itself from the given set of parameters.

The parameters a processor has access to are the member variables of the python class in the sequence that has className equal to the EventProcessor class name.

For an example, look at MyProcessor.

Parameters
parametersParameters for configuration.

Reimplemented from framework::EventProcessor.

Definition at line 27 of file NtuplizeHgcrocDigiCollection.cxx.

27 {
28 input_name_ = ps.get<std::string>("input_name");
29 input_pass_ = ps.get<std::string>("input_pass");
30 pedestal_table_ = ps.get<std::string>("pedestal_table");
31 using_eid_ = ps.get<bool>("using_eid");
32 already_aligned_ = ps.get<bool>("already_aligned");
33 }

◆ onProcessStart()

void dqm::NtuplizeHgcrocDigiCollection::onProcessStart ( )
inlinefinaloverridevirtual

Callback for the EventProcessor to take any necessary action when the processing of events starts, such as creating histograms.

Reimplemented from framework::EventProcessor.

Definition at line 35 of file NtuplizeHgcrocDigiCollection.cxx.

35 {
37 // cleaned up when histogram file is closed
38 flat_tree_ = new TTree("hgcroc", "Ntuplized HGC ROC Digi Collection");
39
40 flat_tree_->Branch("raw_id", &raw_id_);
41 flat_tree_->Branch("adc", &adc_);
42 flat_tree_->Branch("tot", &tot_);
43 flat_tree_->Branch("toa", &toa_);
44 flat_tree_->Branch("good_link", &good_link_);
45 flat_tree_->Branch("raw_adc", &raw_adc_);
46 flat_tree_->Branch("i_sample", &i_sample_);
47 flat_tree_->Branch("ldmxsw_event", &ldmxsw_event_);
48 if (not already_aligned_) {
49 flat_tree_->Branch("pf_event", &pf_event_);
50 flat_tree_->Branch("pf_spill", &pf_spill_);
51 flat_tree_->Branch("pf_ticks", &pf_ticks_);
52 }
53 flat_tree_->Branch("tot_prog", &tot_prog_);
54 flat_tree_->Branch("tot_comp", &tot_comp_);
55 flat_tree_->Branch("aligned", &aligned_);
56 if (using_eid_) {
57 flat_tree_->Branch("fpga", &fpga_);
58 flat_tree_->Branch("link", &link_);
59 flat_tree_->Branch("channel", &channel_);
60 flat_tree_->Branch("index", &index_);
61 } else {
62 flat_tree_->Branch("section", &section_);
63 flat_tree_->Branch("layer", &layer_);
64 flat_tree_->Branch("strip", &strip_);
65 flat_tree_->Branch("end", &end_);
66 }
67 }
TDirectory * getHistoDirectory()
Access/create a directory in the histogram file for this event processor to create histograms and ana...

References framework::EventProcessor::getHistoDirectory().

Member Data Documentation

◆ adc_

int dqm::NtuplizeHgcrocDigiCollection::adc_
private

Definition at line 14 of file NtuplizeHgcrocDigiCollection.cxx.

◆ aligned_

bool dqm::NtuplizeHgcrocDigiCollection::aligned_
private

Definition at line 17 of file NtuplizeHgcrocDigiCollection.cxx.

◆ already_aligned_

bool dqm::NtuplizeHgcrocDigiCollection::already_aligned_
private

Definition at line 18 of file NtuplizeHgcrocDigiCollection.cxx.

◆ channel_

int dqm::NtuplizeHgcrocDigiCollection::channel_
private

Definition at line 15 of file NtuplizeHgcrocDigiCollection.cxx.

◆ end_

int dqm::NtuplizeHgcrocDigiCollection::end_
private

Definition at line 16 of file NtuplizeHgcrocDigiCollection.cxx.

◆ flat_tree_

TTree* dqm::NtuplizeHgcrocDigiCollection::flat_tree_
private

Definition at line 20 of file NtuplizeHgcrocDigiCollection.cxx.

◆ fpga_

int dqm::NtuplizeHgcrocDigiCollection::fpga_
private

Definition at line 15 of file NtuplizeHgcrocDigiCollection.cxx.

◆ good_link_

bool dqm::NtuplizeHgcrocDigiCollection::good_link_
private

Definition at line 19 of file NtuplizeHgcrocDigiCollection.cxx.

◆ i_sample_

int dqm::NtuplizeHgcrocDigiCollection::i_sample_
private

Definition at line 14 of file NtuplizeHgcrocDigiCollection.cxx.

◆ index_

int dqm::NtuplizeHgcrocDigiCollection::index_
private

Definition at line 15 of file NtuplizeHgcrocDigiCollection.cxx.

◆ input_name_

std::string dqm::NtuplizeHgcrocDigiCollection::input_name_
private

Definition at line 12 of file NtuplizeHgcrocDigiCollection.cxx.

◆ input_pass_

std::string dqm::NtuplizeHgcrocDigiCollection::input_pass_
private

Definition at line 12 of file NtuplizeHgcrocDigiCollection.cxx.

◆ layer_

int dqm::NtuplizeHgcrocDigiCollection::layer_
private

Definition at line 16 of file NtuplizeHgcrocDigiCollection.cxx.

◆ ldmxsw_event_

int dqm::NtuplizeHgcrocDigiCollection::ldmxsw_event_
private

Definition at line 13 of file NtuplizeHgcrocDigiCollection.cxx.

◆ link_

int dqm::NtuplizeHgcrocDigiCollection::link_
private

Definition at line 15 of file NtuplizeHgcrocDigiCollection.cxx.

◆ pedestal_table_

std::string dqm::NtuplizeHgcrocDigiCollection::pedestal_table_
private

Definition at line 12 of file NtuplizeHgcrocDigiCollection.cxx.

◆ pf_event_

int dqm::NtuplizeHgcrocDigiCollection::pf_event_
private

Definition at line 13 of file NtuplizeHgcrocDigiCollection.cxx.

◆ pf_spill_

int dqm::NtuplizeHgcrocDigiCollection::pf_spill_
private

Definition at line 13 of file NtuplizeHgcrocDigiCollection.cxx.

◆ pf_ticks_

int dqm::NtuplizeHgcrocDigiCollection::pf_ticks_
private

Definition at line 13 of file NtuplizeHgcrocDigiCollection.cxx.

◆ raw_adc_

int dqm::NtuplizeHgcrocDigiCollection::raw_adc_
private

Definition at line 14 of file NtuplizeHgcrocDigiCollection.cxx.

◆ raw_id_

int dqm::NtuplizeHgcrocDigiCollection::raw_id_
private

Definition at line 14 of file NtuplizeHgcrocDigiCollection.cxx.

◆ section_

int dqm::NtuplizeHgcrocDigiCollection::section_
private

Definition at line 16 of file NtuplizeHgcrocDigiCollection.cxx.

◆ strip_

int dqm::NtuplizeHgcrocDigiCollection::strip_
private

Definition at line 16 of file NtuplizeHgcrocDigiCollection.cxx.

◆ toa_

int dqm::NtuplizeHgcrocDigiCollection::toa_
private

Definition at line 14 of file NtuplizeHgcrocDigiCollection.cxx.

◆ tot_

int dqm::NtuplizeHgcrocDigiCollection::tot_
private

Definition at line 14 of file NtuplizeHgcrocDigiCollection.cxx.

◆ tot_comp_

bool dqm::NtuplizeHgcrocDigiCollection::tot_comp_
private

Definition at line 17 of file NtuplizeHgcrocDigiCollection.cxx.

◆ tot_prog_

bool dqm::NtuplizeHgcrocDigiCollection::tot_prog_
private

Definition at line 17 of file NtuplizeHgcrocDigiCollection.cxx.

◆ using_eid_

bool dqm::NtuplizeHgcrocDigiCollection::using_eid_
private

Definition at line 18 of file NtuplizeHgcrocDigiCollection.cxx.

◆ version_

int dqm::NtuplizeHgcrocDigiCollection::version_
private

Definition at line 13 of file NtuplizeHgcrocDigiCollection.cxx.


The documentation for this class was generated from the following file: