summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fileio/root.C22
1 files changed, 22 insertions, 0 deletions
diff --git a/fileio/root.C b/fileio/root.C
index 24ed09a..9a959f5 100644
--- a/fileio/root.C
+++ b/fileio/root.C
@@ -48,6 +48,28 @@ struct Event {
int nhit;
std::vector<Channel> channel;
+ // Populate arrays of length nentries with hit, time, and charge
+ // information, indexed by channel ID
+ void get_channels(unsigned int nentries, int *hit, float *time,
+ float *charge)
+ {
+ for (unsigned int i=0; i < nentries; i++) {
+ hit[i] = 0;
+ time[i] = -1e9f;
+ charge[i] = -1e9f;
+ }
+
+ for (unsigned int i=0; i < channel.size(); i++) {
+ unsigned int channel_id = channel[i].channel_id;
+
+ if (channel_id < nentries) {
+ hit[channel_id] = 1;
+ time[channel_id] = channel[i].t;
+ charge[channel_id] = channel[i].q;
+ }
+ }
+ }
+
};
void fill_photons(Event *ev, bool start,