Project
Loading...
Searching...
No Matches
Calibrations.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// //
15
16#include <TMath.h>
17#include <TH1F.h>
18#include <TH2F.h>
19#include <sstream>
20#include <string>
21
23#include "fairlogger/Logger.h"
25
26using namespace o2::trd;
27
28// first lets port the functions from CalROC :
29// This therefore includes CalPad (Local[VDrift,T0,GainFactor,PRFWidth,PadNoise)
30// TODO will come back to this in a while, more pressing issues for now.
31// This is here mostly as a stub to remember how to do it.
32//
33
34void Calibrations::getCCDBObjects(long timestamp)
35{
37 //ccdbmgr.clearCache();
38 //ccdbmgr.setURL("http://localhost:8080");
39 mTimeStamp = timestamp;
40 ccdbmgr.setTimestamp(timestamp); // set which time stamp of data we want this is called per timeframe, and removes the need to call it when querying a value.
41
42 mChamberCalibrations = ccdbmgr.get<o2::trd::ChamberCalibrations>("TRD/Calib/ChamberCalibrations");
44 LOG(fatal) << "No chamber calibrations returned from CCDB for TRD calibrations";
45 }
46 mLocalGainFactor = ccdbmgr.get<o2::trd::LocalGainFactor>("TRD/Calib/LocalGainFactor");
47 if (!mLocalGainFactor) {
48 LOG(fatal) << "No local gain factors returned from CCDB for TRD calibrations";
49 }
50
51 mPadNoise = ccdbmgr.get<o2::trd::PadNoise>("TRD/Calib/PadNoise");
52 if (!mPadNoise) {
53 LOG(fatal) << "No Padnoise calibrations returned from CCDB for TRD calibrations";
54 }
55 mChamberStatus = ccdbmgr.get<o2::trd::ChamberStatus>("TRD/Calib/ChamberStatus");
56 if (!mChamberStatus) {
57 LOG(fatal) << "No ChamberStatus calibrations returned from CCDB for TRD calibrations";
58 }
59 mPadStatus = ccdbmgr.get<o2::trd::PadStatus>("TRD/Calib/PadStatus");
60 if (!mPadStatus) {
61 LOG(fatal) << "No Pad Status calibrations returned from CCDB for TRD calibrations";
62 }
63}
64
65void Calibrations::setOnlineGainTables(std::string& tablename)
66{
68 LOG(fatal) << "Attempt to overwrite Gain tables, mCalOnlineGainTables already exists";
69 }
70
72 std::string fulltablename = "TRD/OnlineGainTables/" + tablename;
73 mCalOnlineGainTables = ccdbmgr.get<o2::trd::CalOnlineGainTables>(fulltablename);
74}
75
76float Calibrations::getVDrift(int det, int col, int row) const
77{
80 } else {
81 return -1;
82 }
83}
84
85float Calibrations::getT0(int det, int col, int row) const
86{
88 return mChamberCalibrations->getT0(det);
89 } else {
90 return -1;
91 }
92}
93float Calibrations::getExB(int det) const
94{
96 return mChamberCalibrations->getExB(det);
97 } else {
98 return -1;
99 }
100}
101float Calibrations::getGainFactor(int det, int col, int row) const
102{
105 } else {
106 return -1;
107 }
108}
109float Calibrations::getPadGainFactor(int det, int col, int row) const
110{
111 if (mLocalGainFactor) {
112 return TMath::Abs(mLocalGainFactor->getValue(det, col, row));
113 } else {
114 return -1;
115 }
116}
117
118float Calibrations::getOnlineGainAdcdac(int det, int row, int mcm) const
119{
122 } else {
123 return -1;
124 }
125}
126
127float Calibrations::getOnlineGainFGAN(int det, int rob, int mcm, int adc) const
128{
130 return mCalOnlineGainTables->getFGANrm(det, rob, mcm, adc);
131 } else {
132 return -1;
133 }
134}
135
136float Calibrations::getOnlineGainFGFN(int det, int rob, int mcm, int adc) const
137{
139 return mCalOnlineGainTables->getFGFNrm(det, rob, mcm, adc);
140 } else {
141 return -1;
142 }
143}
uint16_t mcm
uint16_t rob
uint32_t col
Definition RawData.h:4
static BasicCCDBManager & instance()
short getFGFNrm(int det, int rob, int mcm, int channel) const
short getAdcdacrm(int det, int rob, int mcm) const
short getFGANrm(int det, int rob, int mcm, int channel) const
float getOnlineGainFGAN(int det, int row, int mcm, int adc) const
void getCCDBObjects(long timestamp)
void setOnlineGainTables(std::string &tablename)
ChamberStatus * mChamberStatus
status flag for each chamber
PadStatus * mPadStatus
status flag for each readout pad
float getGainFactor(int roc, int col, int row) const
ChamberCalibrations * mChamberCalibrations
from AliRoot: vDrift, T0, ExB and Gain for each chamber
float getOnlineGainFGFN(int det, int row, int mcm, int adc) const
PadNoise * mPadNoise
noise value per readout pad
float getPadGainFactor(int roc, int col, int row) const
CalOnlineGainTables * mCalOnlineGainTables
online gain table (obtained from Kr calibration)
float getOnlineGainAdcdac(int det, int row, int mcm) const
float getVDrift(int roc, int col, int row) const
float getExB(int roc) const
float getT0(int roc, int col, int row) const
LocalGainFactor * mLocalGainFactor
gain factor per readout pad
float getGainFactor(int p, int c, int s) const
float getExB(int p, int c, int s) const
float getT0(int p, int c, int s) const
float getVDrift(int p, int c, int s) const
T getValue(int roc, int col, int row) const
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
std::vector< int > row
ArrayADC adc