Project
Loading...
Searching...
No Matches
Pedestals.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
13#include <fairlogger/Logger.h>
14#include <TH1.h>
15#include <TH1F.h>
16
17using namespace o2::cpv;
18
19Pedestals::Pedestals(int /*dummy*/)
20{
21 //produce reasonable objest for test purposes
22 mPedestals.fill(200); //typical pedestal value
23 mPedSigmas.fill(1.5); //typical pedestal sigma
24}
25//______________________________________________________________________________
27{
28 if (!h) {
29 LOG(error) << "no input histogam";
30 return false;
31 }
32
33 if (h->GetNbinsX() != NCHANNELS) {
34 LOG(error) << "Wrong dimentions of input histogram:" << h->GetNbinsX() << " instead of " << NCHANNELS;
35 return false;
36 }
37
38 for (short i = 1; i <= NCHANNELS; i++) {
39 if (h->GetBinContent(i) > 511) {
40 LOG(error) << "setPedestals : pedestal value = " << h->GetBinContent(i)
41 << " in channel " << i
42 << " exceeds max possible value 511 (limited by CPV electronics)";
43 continue;
44 }
45 mPedestals[i - 1] = short(h->GetBinContent(i));
46 }
47 return true;
48}
49//_______________________________________________________________________________
51{
52 if (!h) {
53 LOG(error) << "no input histogam";
54 return false;
55 }
56
57 if (h->GetNbinsX() != NCHANNELS) {
58 LOG(error) << "Wrong dimentions of input histogram:" << h->GetNbinsX() << " instead of " << NCHANNELS;
59 return false;
60 }
61
62 for (short i = 1; i <= NCHANNELS; i++) {
63 if (h->GetBinContent(i) < 0) {
64 LOG(error) << "pedestal sigma = " << h->GetBinContent(i)
65 << " in channel " << i
66 << " cannot be less than 0";
67 continue;
68 }
69 mPedSigmas[i - 1] = float(h->GetBinContent(i));
70 }
71 return true;
72}
int32_t i
Class for time synchronization of RawReader instances.
bool setPedestals(TH1 *h)
Set pedestals from 1D histogram with cell absId in x axis.
Definition Pedestals.cxx:26
bool setPedSigmas(TH1F *h)
Definition Pedestals.cxx:50
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"