LDMX Software
EcalTrigPrimDigiProducer.cxx
2
5#include "Recon/Event/HgcrocTrigDigi.h"
7
8namespace ecal {
10 framework::Process& process)
11 : Producer(name, process) {}
12
14 digiCollName_ = ps.getParameter<std::string>("digiCollName");
15 digiPassName_ = ps.getParameter<std::string>("digiPassName");
17 ps.getParameter<std::string>("condObjName", "EcalTrigPrimDigiConditions");
18}
19
21 const EcalTriggerGeometry& geom = getCondition<EcalTriggerGeometry>(
22 EcalTriggerGeometry::CONDITIONS_OBJECT_NAME);
23
24 const ldmx::HgcrocDigiCollection& ecalDigis =
26
27 // get the calibration object
28 const conditions::IntegerTableCondition& conditions =
29 getCondition<conditions::IntegerTableCondition>(condObjName_);
30
31 // construct the calculator...
32 ldmx::HgcrocTriggerCalculations calc(conditions);
33
34 // Loop over the digis
35 for (unsigned int ix = 0; ix < ecalDigis.getNumDigis(); ix++) {
36 const ldmx::HgcrocDigiCollection::HgcrocDigi pdigi = ecalDigis.getDigi(ix);
37 // std::cout << EcalID(pdigi.id()) << pdigi << std::endl;
38
39 ldmx::EcalTriggerID tid = geom.belongsTo(ldmx::EcalID(pdigi.id()));
40
41 if (!tid.null()) {
42 int tot = 0;
43 if (pdigi.soi().isTOTComplete()) tot = pdigi.soi().tot();
44 calc.addDigi(pdigi.id(), tid.raw(), pdigi.soi().adc_t(), tot);
45 }
46 }
47
48 // Now, we compress the digis
49 calc.compressDigis(9); // 9 is the number for Ecal...
50
51 const std::map<unsigned int, uint8_t>& results = calc.compressedEnergies();
52 ldmx::HgcrocTrigDigiCollection tdigis;
53
54 for (auto result : results) {
55 if (result.second > 0) {
56 tdigis.push_back(ldmx::HgcrocTrigDigi(result.first, result.second));
57 // std::cout << EcalTriggerID(result.first) << " " << tdigis.back() <<
58 // std::endl;
59 }
60 }
61
62 // std::cout << ecalDigis.size() << " " << tdigis.size() << std::endl;
63 event.add(getName(), tdigis);
64}
65} // namespace ecal
66DECLARE_PRODUCER_NS(ecal, EcalTrigPrimDigiProducer);
Class that performs emulation of the EcalTriggerPrimitives.
Class that defines the relationship between precision cells and trigger cells and provides geometry i...
#define DECLARE_PRODUCER_NS(NS, CLASS)
Macro which allows the framework to construct a producer given its name during configuration.
Class that represents a digitized hit in a calorimeter cell readout by an HGCROC.
Class that contains the Hgcroc Trigger algorithms, used for both Ecal and Hcal.
std::string digiCollName_
Digi Collection Name to use as input.
virtual void produce(framework::Event &event)
Produce EcalHits and put them into the event bus using the EcalDigis as input.
EcalTrigPrimDigiProducer(const std::string &name, framework::Process &process)
Constructor.
std::string condObjName_
Conditions object for the calibration information.
std::string digiPassName_
Digi Pass Name to use as input.
virtual void configure(framework::config::Parameters &)
Grabs configure parameters from the python config file.
defines the relationship between precision cells and trigger cells and provides geometry information ...
ldmx::EcalTriggerID belongsTo(ldmx::EcalID precisionCell) const
Returns which trigger cell this precision cell is associated with, or a null id if there is no such a...
std::string getName() const
Get the processor name.
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
T getParameter(const std::string &name) const
Retrieve the parameter of the given name.
Definition Parameters.h:89
bool null() const
Definition DetectorID.h:60
RawValue raw() const
Definition DetectorID.h:68
Extension of DetectorID providing access to ECal layers and cell numbers in a hex grid.
Definition EcalID.h:20
Extension of DetectorID providing access to ECal trigger cell information.
One DIGI signal coming from the HGC ROC.
unsigned int id() const
Get the ID for this DIGI.
HgcrocDigiCollection::Sample soi() const
Get the sample of interest from this DIGI.
int adc_t() const
Get the ADC measurement from this sample.
int tot() const
Get the TOT measurement from this sample.
bool isTOTComplete() const
Get the second flag from the sample checking if TOT is complete at this sample.
Represents a collection of the digi hits readout by an HGCROC.
const HgcrocDigi getDigi(unsigned int digiIndex) const
Get samples for the input digi index.
unsigned int getNumDigis() const
Get total number of digis.
Contains the trigger output for a single trigger hgcroc channel.
Contains the core logic for the Hgcroc trigger calculations.
void addDigi(unsigned int id, unsigned int tid, int adc, int tot)
Determine the linear charge for the given channel, using the calibration information,...
const std::map< unsigned int, uint8_t > & compressedEnergies() const
Access the map of trigger ids to compressed energies.
void compressDigis(int cells_per_trig)
Convert the linear charges to compressed charges, with a division depending on the number of cells su...