Project
Loading...
Searching...
No Matches
FastORTimeSeries.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
12#include <algorithm>
13#include <iostream>
16
17using namespace o2::emcal;
18
19void FastORTimeSeries::fillReversed(const gsl::span<const uint16_t> samples, uint8_t starttime)
20{
21 if (starttime >= 14) {
22 throw FastOrStartTimeInvalidException(starttime);
23 }
24 if (starttime + 1 < samples.size()) {
25 throw FastOrStartTimeInvalidException(static_cast<int>(starttime) - static_cast<int>(samples.size()) + 1);
26 }
27 for (std::size_t isample = 0; isample < samples.size(); isample++) {
28 mTimeSamples[starttime - isample] = samples[isample];
29 }
30}
31
32uint16_t FastORTimeSeries::calculateL1TimeSum(uint8_t l0time) const
33{
34 uint16_t timesum = 0;
35 int firstbin = l0time - 4; // Include sample before the L0 time
36 for (int isample = firstbin; isample < firstbin + 4; isample++) {
37 timesum += mTimeSamples[isample];
38 }
39 return timesum;
40}
41
42void FastORTimeSeries::setSize(int maxsamples)
43{
44 mTimeSamples.resize(maxsamples);
45}
46
48{
49 std::fill(mTimeSamples.begin(), mTimeSamples.end(), 0);
50}
uint16_t calculateL1TimeSum(uint8_t l0time) const
Calculate L0 timesum (4-integral of the ADC series) with respect to a given L0 time.
void clear()
Clear ADC samples in the time series.
Handling of error if starttime is to large (>=14). This is most likely caused by a corrupted channel ...