dguff / G4SOLAr

MIT License
1 stars 0 forks source link

19 output format #46

Closed dguff closed 1 year ago

dguff commented 1 year ago

Test new, compressed output format

dguff commented 1 year ago

Hi @JMMcElwee @bramati @antonio-branca,

I have opened this pull request with some major modifications to the output format. In particular, I changed the way hits are stored in a readout element, which is usually represented by an implementation of the class SLArEventHitsCollection<class Hit>. In the old version of the code we maintained the maximum level of granularity on the MC information by storing each individual hit with its own attributes in a std::vector<Hit*>. This of course produces a huge output file for high energy events such as the ones generated from a GENIE file.

In this new version of the code, hits are not stored individually and are collected in a std::map<UShort_t, UShort_t> instead. Each implementation of the SLArEventHitsCollection<class Hit> class now comes with an attribute fClockUnit which defines the discretization level of the time information and every hit is summed to the collection using its arrival time (in fClockUnit units) as a key. In this way we greatly reduce the output file size, but we also loose the information stored in the Hit attributes. To retain some of this information, I have implemented a backtracker system that allow the user to keep track of some of the MC truth information by creating a "mirror" map of the events one, keeping the time as key and storing a vector of backtracker records as a value. A backtracker record is basically just a std::map<Int_t key, UShort_t counts> which counts how many times the key attribute is found in the time span of the record. For example, activating the trkID backtracker one will count how may of the hits detected at a time t are produced by the track with ID 1234 and how many by track ID 2345

key:        value:
[1234]      8725237
[2345]      7353812