Project
Loading...
Searching...
No Matches
AngularResidHistos.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
14
16#include <fairlogger/Logger.h>
17#include <cmath>
18
19using namespace o2::trd;
20using namespace o2::trd::constants;
21
23{
24 mHistogramEntries.fill(0);
25 mNEntriesPerBin.fill(0);
26 mNEntriesTotal = 0;
27}
28
29bool AngularResidHistos::addEntry(float deltaAlpha, float impactAngle, int chamberId)
30{
31 // add entry for given angular residual
32 // returns 0 in case of success (impact angle is in valid range)
33 int chamberOffset = chamberId * NBINSANGLEDIFF;
34 if (std::fabs(impactAngle) < MAXIMPACTANGLE) {
35 int iBin = (impactAngle + MAXIMPACTANGLE) * INVBINWIDTH;
36 mHistogramEntries[chamberOffset + iBin] += deltaAlpha;
37 ++mNEntriesPerBin[chamberOffset + iBin];
38 ++mNEntriesTotal;
39 } else {
40 LOG(debug) << "Under-/overflow entry detected for impact angle " << impactAngle;
41 return 1;
42 }
43 return 0;
44}
45
47{
48 for (int i = 0; i < MAXCHAMBER * NBINSANGLEDIFF; ++i) {
49 mHistogramEntries[i] += input.getHistogramEntry(i);
50 mNEntriesPerBin[i] += input.getBinCount(i);
51 mNEntriesTotal += input.getBinCount(i);
52 }
53}
54
56{
57 for (int i = 0; i < MAXCHAMBER * NBINSANGLEDIFF; ++i) {
58 mHistogramEntries[i] += prev->getHistogramEntry(i);
59 mNEntriesPerBin[i] += prev->getBinCount(i);
60 mNEntriesTotal += prev->getBinCount(i);
61 }
62}
63
65{
66 LOG(info) << "There are " << mNEntriesTotal << " entries in the container";
67 for (int i = 0; i < MAXCHAMBER * NBINSANGLEDIFF; ++i) {
68 if (mNEntriesPerBin[i] != 0) {
69 LOGF(info, "Global bin %i has %i entries. Average angular residual: %f", i, mNEntriesPerBin[i], mHistogramEntries[i] / mNEntriesPerBin[i]);
70 }
71 }
72}
Class to store the angular residuals of TRD tracklets wrt TPC tracks for each TRD chamber.
int32_t i
std::ostringstream debug
int getBinCount(int index) const
void merge(const AngularResidHistos *prev)
bool addEntry(float deltaAlpha, float impactAngle, int chamberId)
void fill(const AngularResidHistos &input)
float getHistogramEntry(int index) const
constexpr int MAXCHAMBER
the maximum number of installed chambers
Definition Constants.h:30
constexpr int NBINSANGLEDIFF
the number of bins for the track angle used for the vDrift and ExB calibration based on the tracking
Definition Constants.h:76
constexpr float MAXIMPACTANGLE
the maximum impact angle for tracks relative to the TRD detector plane to be considered for vDrift an...
Definition Constants.h:75
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"