LDMX Software
Public Member Functions | List of all members
ecal::test::EcalCheckEnergyReconstruction Class Reference

Checks. More...

Public Member Functions

 EcalCheckEnergyReconstruction (const std::string &name, framework::Process &p)
 
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.
 
- Public Member Functions inherited from framework::EventProcessor
 EventProcessor (const std::string &name, Process &process)
 Class constructor.
 
virtual ~EventProcessor ()
 Class destructor.
 
virtual void configure (framework::config::Parameters &parameters)
 Callback for the EventProcessor to configure itself from the given set of parameters.
 
virtual void onNewRun (const ldmx::RunHeader &runHeader)
 Callback for the EventProcessor to take any necessary action when the run being processed changes.
 
virtual void onFileOpen (EventFile &eventFile)
 Callback for the EventProcessor to take any necessary action when a new event input ROOT file is opened.
 
virtual void onFileClose (EventFile &eventFile)
 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.
 

Additional Inherited Members

- Static Public Member Functions inherited from framework::EventProcessor
static void declare (const std::string &classname, int classtype, EventProcessorMaker *)
 Internal function which is part of the PluginFactory machinery.
 
- Static Public Attributes inherited from framework::Analyzer
static const int CLASSTYPE {2}
 Constant used to track EventProcessor types by the PluginFactory.
 
- Protected Member Functions inherited from framework::EventProcessor
void abortEvent ()
 Abort the event immediately.
 
- Protected Attributes inherited from framework::EventProcessor
HistogramHelper histograms_
 Interface class for making and filling histograms.
 
NtupleManagerntuple_ {NtupleManager::getInstance()}
 Manager for any ntuples.
 
logging::logger theLog_
 The logger for this EventProcessor.
 

Detailed Description

Checks.

Assumptions

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 220 of file EcalDigiPipelineTest.cxx.

221 : 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 222 of file EcalDigiPipelineTest.cxx.

222{}

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 239 of file EcalDigiPipelineTest.cxx.

239 {
240 const auto simHits =
241 event.getCollection<ldmx::SimCalorimeterHit>("EcalSimHits");
242
243 REQUIRE(simHits.size() == 1);
244
245 float truth_energy = simHits.at(0).getEdep();
246 ntuple_.setVar<float>("SimEnergy", truth_energy);
247
248 const auto daqDigis{
249 event.getObject<ldmx::HgcrocDigiCollection>("EcalDigis")};
250
251 CHECK(daqDigis.getNumDigis() == 1);
252 auto daqDigi = daqDigis.getDigi(0);
253 ntuple_.setVar<int>("DaqDigi", daqDigi.soi().raw());
254 bool is_in_adc_mode = daqDigi.isADC();
255 ntuple_.setVar<int>("DaqDigiIsADC", is_in_adc_mode);
256 ntuple_.setVar<int>("DaqDigiADC", daqDigi.soi().adc_t());
257 ntuple_.setVar<int>("DaqDigiTOT", daqDigi.tot());
258
259 const auto recHits = event.getCollection<ldmx::EcalHit>("EcalRecHits");
260 CHECK(recHits.size() == 1);
261
262 auto hit = recHits.at(0);
263 ldmx::EcalID id(hit.getID());
264 CHECK_FALSE(hit.isNoise());
265 CHECK(id.raw() == simHits.at(0).getID());
266
267 double daq_energy{hit.getAmplitude()};
268 CHECK_THAT(daq_energy, isCloseEnough(truth_energy, MAX_ENERGY_ERROR_DAQ,
269 MAX_ENERGY_PERCENT_ERROR_DAQ));
270 ntuple_.setVar<float>("RecEnergy", hit.getAmplitude());
271
272 const auto trigDigis{
273 event.getObject<ldmx::HgcrocTrigDigiCollection>("ecalTrigDigis")};
274 CHECK(trigDigis.size() == 1);
275
276 auto trigDigi = trigDigis.at(0);
277 float tp_energy = 8 * trigDigi.linearPrimitive() * 320. / 1024 * MeV_per_fC;
278
279 CHECK_THAT(tp_energy, isCloseEnough(truth_energy, MAX_ENERGY_ERROR_TP,
280 MAX_ENERGY_PERCENT_ERROR_TP));
281 ntuple_.setVar<float>("TrigPrimEnergy", tp_energy);
282 ntuple_.setVar<int>("TrigPrimDigiEncoded", trigDigi.getPrimitive());
283 ntuple_.setVar<int>("TrigPrimDigiLinear", trigDigi.linearPrimitive());
284
285 return;
286 }
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().

◆ 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 224 of file EcalDigiPipelineTest.cxx.

224 {
226 ntuple_.create("EcalDigiTest");
227 ntuple_.addVar<float>("EcalDigiTest", "SimEnergy");
228 ntuple_.addVar<float>("EcalDigiTest", "RecEnergy");
229 ntuple_.addVar<float>("EcalDigiTest", "TrigPrimEnergy");
230
231 ntuple_.addVar<int>("EcalDigiTest", "DaqDigi");
232 ntuple_.addVar<int>("EcalDigiTest", "DaqDigiIsADC");
233 ntuple_.addVar<int>("EcalDigiTest", "DaqDigiADC");
234 ntuple_.addVar<int>("EcalDigiTest", "DaqDigiTOT");
235 ntuple_.addVar<int>("EcalDigiTest", "TrigPrimDigiEncoded");
236 ntuple_.addVar<int>("EcalDigiTest", "TrigPrimDigiLinear");
237 }
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_.


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