22 AlpideSimResponse::initData(tableNumber, dataPath, quiet);
29 std::vector<float> zVec, effVec;
33 for (
int iz = 0; iz <
mNBinDpt; ++iz) {
37 const auto& mat =
mData[rev];
38 for (
int ix = 0; ix < npix; ++ix) {
39 for (
int iy = 0; iy < npix; ++iy) {
40 sum += mat.getValue(ix, iy);
44 effVec.push_back(
sum);
48 float z0, z1, q0, q1, dq;
50 std::vector<Bin>
bins;
51 bins.reserve(zVec.size() - 1);
54 for (
size_t i = 0;
i + 1 < zVec.size(); ++
i) {
55 float z0 = zVec[
i], z1 = zVec[
i + 1];
56 float q0 = effVec[
i], q1 = effVec[
i + 1];
57 float dq = 0.5f * (q0 + q1) * (z1 - z0);
58 bins.push_back({z0, z1, q0, q1, dq});
67 float halfQ = 0.5f * totQ;
69 for (
auto&
b :
bins) {
70 if (cumQ +
b.dq < halfQ) {
74 float dz =
b.z1 -
b.z0;
75 float slope = (
b.q1 -
b.q0) / dz;
76 float disc =
b.q0 *
b.q0 - 2.f *
slope * (cumQ - halfQ);
79 if (disc >= 0.f && std::abs(
slope) > 1e-6f) {
80 x = (-
b.q0 + std::sqrt(disc)) /
slope;
82 x = (halfQ - cumQ) /
b.q0;
84 x = std::clamp(
x, 0.f, dz);
85 mRespCentreDep =
b.z0 +
x;
ClassImp(o2::its3::ChipSimResponse)
void initData(int tableNumber, std::string dataPath, const bool quiet=true)
void computeCentreFromData()
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
float mDptMax
lower boundary of Dpt
float sum(float s, o2::dcs::DataPointValue v)
GLboolean GLboolean GLboolean b
GLdouble GLdouble GLdouble z