Project
Loading...
Searching...
No Matches
ChipSimResponse.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 <vector>
14#include <algorithm>
15
16using namespace o2::its3;
17
19
20void ChipSimResponse::initData(int tableNumber, std::string dataPath, const bool quiet)
21{
22 AlpideSimResponse::initData(tableNumber, dataPath, quiet);
24}
25
27{
28 std::vector<float> zVec, qVec;
30
31 for (int iz = 0; iz < mNBinDpt; ++iz) {
32 size_t bin = iz + mNBinDpt * (0 + mNBinRow * 0);
33 const auto& mat = mData[bin];
34 float val = mat.getValue(npix / 2, npix / 2);
35 float gz = mDptMin + iz / mStepInvDpt;
36 zVec.push_back(gz);
37 qVec.push_back(val);
38 }
39
40 std::vector<std::pair<float, float>> zqPairs;
41 for (size_t i = 0; i < zVec.size(); ++i) {
42 zqPairs.emplace_back(zVec[i], qVec[i]);
43 }
44 std::sort(zqPairs.begin(), zqPairs.end());
45 zVec.clear();
46 qVec.clear();
47 for (auto& p : zqPairs) {
48 zVec.push_back(p.first);
49 qVec.push_back(p.second);
50 }
51
52 float intQ = 0.f, intZQ = 0.f;
53 for (size_t i = 0; i + 1 < zVec.size(); ++i) {
54 float z0 = zVec[i], z1 = zVec[i + 1];
55 float q0 = qVec[i], q1 = qVec[i + 1];
56 float dz = z1 - z0;
57 intQ += 0.5f * (q0 + q1) * dz;
58 intZQ += 0.5f * (z0 * q0 + z1 * q1) * dz;
59 }
60
61 mRespCentreDep = (intQ > 0.f) ? intZQ / intQ : 0.f;
62}
ClassImp(o2::its3::ChipSimResponse)
int32_t i
void initData(int tableNumber, std::string dataPath, const bool quiet=true)
static int constexpr getNPix()
number of pixels in the quadrant
int mNBinDpt
number of bins in Y(row direction)
std::vector< AlpideRespSimMat > mData
inverse step of the Dpt grid
float mDptMin
upper boundary of Row
float mStepInvDpt
inverse step of the Row grid
int mNBinRow
number of bins in X(col direction)
GLuint GLfloat * val
Definition glcorearb.h:1582