LDMX Software
ecal::test::EcalCheckEnergyReconstruction Class Reference

Checks. More...

Public Member Functions

 EcalCheckEnergyReconstruction (const std::string &name, framework::Process &p)
 
void configure (framework::config::Parameters &parameters) 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 ecal_simhits_passname_
 
std::string ecal_digis_passname_
 
std::string ecal_rechits_passname_
 
std::string ecal_trig_digis_passname_
 

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

Checks.

  • Amplitude of EcalRecHit matches SimCalorimeterHit EDep with the same ID
  • Estimated energy at TP level matches sim energy

Assumptions

  • Max one sim hit per event
  • Noise generation has been turned off

Definition at line 218 of file EcalDigiPipelineTest.cxx.

Constructor & Destructor Documentation

◆ EcalCheckEnergyReconstruction()

ecal::test::EcalCheckEnergyReconstruction::EcalCheckEnergyReconstruction ( const std::string & name,
framework::Process & p )
inline

Definition at line 226 of file EcalDigiPipelineTest.cxx.

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

◆ ~EcalCheckEnergyReconstruction()

ecal::test::EcalCheckEnergyReconstruction::~EcalCheckEnergyReconstruction ( )
inline

Definition at line 228 of file EcalDigiPipelineTest.cxx.

228{}

Member Function Documentation

◆ analyze()

void ecal::test::EcalCheckEnergyReconstruction::analyze ( const framework::Event & event)
inlinefinaloverridevirtual

Process the event and make histograms or summaries.

Parameters
eventThe Event to analyze

Implements framework::Analyzer.

Definition at line 256 of file EcalDigiPipelineTest.cxx.

256 {
257 const auto sim_hits = event.getCollection<ldmx::SimCalorimeterHit>(
258 "EcalSimHits", ecal_simhits_passname_);
259
260 REQUIRE(sim_hits.size() == 1);
261
262 float truth_energy = sim_hits.at(0).getEdep();
263 ntuple_.setVar<float>("SimEnergy", truth_energy);
264
265 const auto daq_digis{event.getObject<ldmx::HgcrocDigiCollection>(
266 "EcalDigis", ecal_digis_passname_)};
267
268 if (daq_digis.getNumDigis() == 1) {
269 auto daq_digi = daq_digis.getDigi(0);
270 ntuple_.setVar<int>("DaqDigi", daq_digi.soi().raw());
271 bool is_in_adc_mode = daq_digi.isADC();
272 ntuple_.setVar<int>("DaqDigiIsADC", is_in_adc_mode);
273 ntuple_.setVar<int>("DaqDigiADC", daq_digi.soi().adcT());
274 ntuple_.setVar<int>("DaqDigiTOT", daq_digi.tot());
275
276 const auto rec_hits = event.getCollection<ldmx::EcalHit>(
277 "EcalRecHits", ecal_rechits_passname_);
278 CHECK(rec_hits.size() == 1);
279
280 auto hit = rec_hits.at(0);
281 ldmx::EcalID id(hit.getID());
282 CHECK_FALSE(hit.isNoise());
283 CHECK(id.raw() == sim_hits.at(0).getID());
284
285 double daq_energy{hit.getAmplitude()};
286 CHECK_THAT(daq_energy, IsCloseEnough(truth_energy, MAX_ENERGY_ERROR_DAQ,
287 MAX_ENERGY_PERCENT_ERROR_DAQ));
288 ntuple_.setVar<float>("RecEnergy", hit.getAmplitude());
289
290 const auto trig_digis{event.getObject<ldmx::HgcrocTrigDigiCollection>(
291 "ecalTrigDigis", ecal_trig_digis_passname_)};
292 CHECK(trig_digis.size() == 1);
293
294 auto trig_digi = trig_digis.at(0);
295 float tp_energy =
296 8 * trig_digi.linearPrimitive() * 320. / 1024 * MEV_PER_FC;
297
298 CHECK_THAT(tp_energy, IsCloseEnough(truth_energy, MAX_ENERGY_ERROR_TP,
299 MAX_ENERGY_PERCENT_ERROR_TP));
300 ntuple_.setVar<float>("TrigPrimEnergy", tp_energy);
301 ntuple_.setVar<int>("TrigPrimDigiEncoded", trig_digi.getPrimitive());
302 ntuple_.setVar<int>("TrigPrimDigiLinear", trig_digi.linearPrimitive());
303 }
304
305 return;
306 }
NtupleManager & ntuple_
Manager for any ntuples.
void setVar(const std::string &vname, const T &value)
Set the value of the variable named 'vname'.
Stores reconstructed hit information from the ECAL.
Definition EcalHit.h:19
Extension of DetectorID providing access to ECal layers and cell numbers in a hex grid.
Definition EcalID.h:20
Represents a collection of the digi hits readout by an HGCROC.
Stores simulated calorimeter hit information.

References framework::EventProcessor::ntuple_, and framework::NtupleManager::setVar().

◆ configure()

void ecal::test::EcalCheckEnergyReconstruction::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 230 of file EcalDigiPipelineTest.cxx.

230 {
231 ecal_simhits_passname_ =
232 parameters.get<std::string>("ecal_simhits_passname", "");
233 ecal_digis_passname_ =
234 parameters.get<std::string>("ecal_digis_passname", "");
235 ecal_rechits_passname_ =
236 parameters.get<std::string>("ecal_rechits_passname", "");
237 ecal_trig_digis_passname_ =
238 parameters.get<std::string>("ecal_trig_digis_passname", "");
239 }
const T & get(const std::string &name) const
Retrieve the parameter of the given name.
Definition Parameters.h:78

◆ onProcessStart()

void ecal::test::EcalCheckEnergyReconstruction::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 241 of file EcalDigiPipelineTest.cxx.

241 {
243 ntuple_.create("EcalDigiTest");
244 ntuple_.addVar<float>("EcalDigiTest", "SimEnergy");
245 ntuple_.addVar<float>("EcalDigiTest", "RecEnergy");
246 ntuple_.addVar<float>("EcalDigiTest", "TrigPrimEnergy");
247
248 ntuple_.addVar<int>("EcalDigiTest", "DaqDigi");
249 ntuple_.addVar<int>("EcalDigiTest", "DaqDigiIsADC");
250 ntuple_.addVar<int>("EcalDigiTest", "DaqDigiADC");
251 ntuple_.addVar<int>("EcalDigiTest", "DaqDigiTOT");
252 ntuple_.addVar<int>("EcalDigiTest", "TrigPrimDigiEncoded");
253 ntuple_.addVar<int>("EcalDigiTest", "TrigPrimDigiLinear");
254 }
TDirectory * getHistoDirectory()
Access/create a directory in the histogram file for this event processor to create histograms and ana...
void addVar(const std::string &tname, const std::string &vname)
Add a variable of type VarType to the ROOT tree with name 'tname'.
void create(const std::string &tname)
Create a ROOT tree to hold the ntuple variables (ROOT leaves).

References framework::NtupleManager::addVar(), framework::NtupleManager::create(), framework::EventProcessor::getHistoDirectory(), and framework::EventProcessor::ntuple_.

Member Data Documentation

◆ ecal_digis_passname_

std::string ecal::test::EcalCheckEnergyReconstruction::ecal_digis_passname_
private

Definition at line 221 of file EcalDigiPipelineTest.cxx.

◆ ecal_rechits_passname_

std::string ecal::test::EcalCheckEnergyReconstruction::ecal_rechits_passname_
private

Definition at line 222 of file EcalDigiPipelineTest.cxx.

◆ ecal_simhits_passname_

std::string ecal::test::EcalCheckEnergyReconstruction::ecal_simhits_passname_
private

Definition at line 220 of file EcalDigiPipelineTest.cxx.

◆ ecal_trig_digis_passname_

std::string ecal::test::EcalCheckEnergyReconstruction::ecal_trig_digis_passname_
private

Definition at line 223 of file EcalDigiPipelineTest.cxx.


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