Project
Loading...
Searching...
No Matches
BaselineCalibEPN.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 <TROOT.h>
13#include <TFile.h>
14#include <TH1.h>
15#include <TString.h>
16#include <TStyle.h>
17#include <TDirectory.h>
20#include "Framework/Logger.h"
21
22using namespace o2::zdc;
23
25{
26 static bool firstCall = true;
27 if (firstCall) {
28 // Inspect reconstruction parameters
29 const auto& opt = CalibParamZDC::Instance();
30 if (mVerbosity >= DbgFull) {
31 opt.print();
32 }
33 if (opt.debugOutput == true) {
35 }
36 if (mVerbosity >= DbgMedium) {
37 mModuleConfig->print();
38 }
39 firstCall = false;
40 } else {
41 // Reset data structure
42 mData.clear();
43 }
44 mInitDone = true;
45 return 0;
46}
47
48//______________________________________________________________________________
49int BaselineCalibEPN::process(const gsl::span<const o2::zdc::OrbitData>& orbitdata)
50{
51 if (!mInitDone) {
52 init();
53 }
54 for (auto& myorbit : orbitdata) {
55 for (int ich = 0; ich < NChannels; ich++) {
56 // Check if orbit data is valid. N.B. the default scaler initializer has
57 // 0x8fff that is in overflow. Data loss in orbit has most significant bit
58 // set to 1
59 // TODO: relax this condition?
60 if (myorbit.scaler[ich] <= o2::constants::lhc::LHCMaxBunches) {
61 auto myped = float(myorbit.data[ich]) * mModuleConfig->baselineFactor;
62 if (myped >= ADCMin && myped <= ADCMax) {
63 mData.addEntry(ich, myorbit.data[ich]);
64 if (mSaveDebugHistos) {
65 mDataSum.addEntry(ich, myorbit.data[ich]);
66 }
67 }
68 }
69 }
70 }
71 return 0;
72}
73
74//______________________________________________________________________________
76{
77 if (mVerbosity > DbgZero) {
78 LOG(info) << "BaselineCalibEPN::endOfRun";
79 }
80 if (mSaveDebugHistos) {
81 if (mVerbosity >= DbgMedium) {
83 }
85 }
86 mInitDone = false;
87 return 0;
88}
89
90//______________________________________________________________________________
91int BaselineCalibEPN::saveDebugHistos(const std::string fn)
92{
93 // EPN debug histos are now cumulated over process life
94 LOG(info) << "Saving EPN debug histos on file " << fn;
95 return mDataSum.saveDebugHistos(fn, mModuleConfig->baselineFactor);
96}
ZDC calibration common parameters.
int process(const gsl::span< const o2::zdc::OrbitData > &orbitdata)
int saveDebugHistos(const std::string fn="ZDCBaselineCalibEPN.root")
constexpr int LHCMaxBunches
constexpr int NChannels
Definition Constants.h:65
constexpr int DbgFull
Definition Constants.h:210
constexpr int DbgZero
Definition Constants.h:207
constexpr int ADCMin
Definition Constants.h:76
constexpr int DbgMedium
Definition Constants.h:209
constexpr int ADCMax
Definition Constants.h:76
void addEntry(int isig, zdcBaseline_t val)
int saveDebugHistos(const std::string fn, float factor)
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"