LDMX Software
SiElectrodeDataCollection.cxx
1#include "Tracking/Digitization/SiElectrodeDataCollection.h"
2
3namespace tracking {
4namespace digitization {
5
6SiElectrodeDataCollection::SiElectrodeDataCollection(
7 const SiElectrodeDataCollection& electrode_data) {
8 collection_ = electrode_data.getCollection();
9 electrode_pass_name_ = electrode_data.getPassName();
10}
11
12SiElectrodeDataCollection::SiElectrodeDataCollection(
13 const std::map<int, int>& electrode_charge, ldmx::SimTrackerHit hit,
14 const std::string& passName) {
15 electrode_pass_name_ = passName;
16 for (auto pair : electrode_charge) {
17 collection_[pair.first] = SiElectrodeData(pair.second, hit);
18 }
19}
20
21std::map<int, int> SiElectrodeDataCollection::getChargeMap() const {
22 std::map<int, int> charge_map;
23
24 for (auto pair : collection_) {
25 charge_map[pair.first] = pair.second.getCharge();
26 }
27
28 return charge_map;
29}
30
31const std::string& SiElectrodeDataCollection::getPassName() const {
32 return electrode_pass_name_;
33}
34
35void SiElectrodeDataCollection::add(
36 const std::map<int, SiElectrodeData>& electrode_data_collection) {
37 for (auto pair : electrode_data_collection) {
38 // Check if the internal collection_ has a key
39 if (collection_.count(pair.first))
40 collection_[pair.first].add(pair.second);
41
42 else
43 collection_[pair.first] = pair.second;
44 }
45}
46
47void SiElectrodeDataCollection::add(int cellid,
48 SiElectrodeData electrode_data) {
49 if (electrode_data.isValid())
50 if (collection_.count(cellid))
51 collection_[cellid].add(electrode_data);
52 else
53 collection_[cellid] = electrode_data;
54}
55
56} // namespace digitization
57} // namespace tracking
Represents a simulated tracker hit in the simulation.
The measurement calibrator can be a function or a class/struct able to retrieve the sim hits containe...