Project
Loading...
Searching...
No Matches
Response.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
18
19#include <cmath>
20
22
23#include "TMath.h"
24#include "TRandom.h"
25
26using namespace o2::mch;
27
28//_____________________________________________________________________
29Response::Response(Station station) : mStation(station)
30{
31 if (station == Station::Type1) {
32 mMathieson.setPitch(ResponseParam::Instance().pitchSt1);
33 mMathieson.setSqrtKx3AndDeriveKx2Kx4(ResponseParam::Instance().mathiesonSqrtKx3St1);
34 mMathieson.setSqrtKy3AndDeriveKy2Ky4(ResponseParam::Instance().mathiesonSqrtKy3St1);
38 } else {
39 mMathieson.setPitch(ResponseParam::Instance().pitchSt2345);
40 mMathieson.setSqrtKx3AndDeriveKx2Kx4(ResponseParam::Instance().mathiesonSqrtKx3St2345);
41 mMathieson.setSqrtKy3AndDeriveKy2Ky4(ResponseParam::Instance().mathiesonSqrtKy3St2345);
45 }
48 mChargeThreshold = ResponseParam::Instance().chargeThreshold;
49}
50//_____________________________________________________________________
51float Response::etocharge(float edepos) const
52{
53 int nel = int(edepos * 1.e9 / 27.4);
54 if (nel == 0) {
55 nel = 1;
56 }
57 float charge = 0.f;
58 for (int i = 1; i <= nel; i++) {
59 float arg = 0.f;
60 do {
61 arg = gRandom->Rndm();
62 } while (!arg);
63 charge -= mChargeSlope * TMath::Log(arg);
64 }
65 return charge;
66}
67
68//_____________________________________________________________________
69float Response::getAnod(float x) const
70{
71 return (mStation == Station::Type1)
72 ? std::round(x / mPitch) * mPitch
73 : (std::floor(x / mPitch) + 0.5f) * mPitch;
74}
75
76//_____________________________________________________________________
78{
79 return TMath::Exp(gRandom->Gaus(0.0, mChargeCorr / 2.0));
80}
81
82//_____________________________________________________________________
83uint32_t Response::nSamples(float charge) const
84{
85 // the main purpose is to the pass the background rejection and signal selection
86 // applied in data reconstruction (see MCH/DigitFiltering/src/DigitFilter.cxx).
87 // a realistic estimate of nSamples would require a complete simulation of the electronic signal
88 double signalParam[3] = {14., 13., 1.5};
89 return std::round(std::pow(charge / signalParam[1], 1. / signalParam[2]) + signalParam[0]);
90}
91//_____________________________________________________________________
92float Response::inclandbfield(float thetawire, float betagamma, float bx) const
93{
94 float yAngleEffect = 0;
95 // auxiliary variables for b-field and inclination angle effect
96 float eLossParticleElossMip = 0.0;
97 float sigmaEffect10degrees = 0.0;
98 float sigmaEffectThetadegrees = 0.0;
99
100 if (isAngleEffect()) {
101 if (!isMagnetEffect()) {
102 thetawire = abs(thetawire);
103 if ((betagamma > 3.2) && (thetawire * TMath::RadToDeg() <= 15.)) {
104 betagamma = log(betagamma); // check if ln or log10
105 eLossParticleElossMip = eLossRatio(betagamma);
106 sigmaEffect10degrees = angleEffect10(eLossParticleElossMip);
107 sigmaEffectThetadegrees = sigmaEffect10degrees / angleEffectNorma(thetawire * TMath::RadToDeg());
109 sigmaEffectThetadegrees /= 1.09833 + 0.017 * (thetawire * TMath::RadToDeg());
110 }
111 yAngleEffect = 0.0001 * gRandom->Gaus(0, sigmaEffectThetadegrees); // error due to the angle effect in cm
112 }
113 } else {
114 if ((betagamma > 3.2) && (abs(thetawire * TMath::RadToDeg()) <= 15.)) {
115 betagamma = log(betagamma);
116 eLossParticleElossMip = eLossRatio(betagamma);
117 sigmaEffect10degrees = angleEffect10(eLossParticleElossMip);
118 sigmaEffectThetadegrees = sigmaEffect10degrees / magAngleEffectNorma(thetawire * TMath::RadToDeg(), bx / 10.); // check b-field unit in aliroot and O2
120 sigmaEffectThetadegrees /= 1.09833 + 0.017 * (thetawire * TMath::RadToDeg());
121 }
122 yAngleEffect = 0.0001 * gRandom->Gaus(0, sigmaEffectThetadegrees);
123 }
124 }
125 }
126 return yAngleEffect;
127}
128//_____________________________________________________________________
129float Response::eLossRatio(float logbetagamma) const
130{
131 // Ratio of particle mean eloss with respect MIP's Khalil Boudjemline, sep 2003, PhD.Thesis and Particle Data Book
133 float eLossRatioParam[5] = {1.02138, -9.54149e-02, +7.83433e-02, -9.98208e-03, +3.83279e-04};
134 return eLossRatioParam[0] + eLossRatioParam[1] * logbetagamma + eLossRatioParam[2] * logbetagamma * logbetagamma + eLossRatioParam[3] * logbetagamma * logbetagamma * logbetagamma + eLossRatioParam[4] * logbetagamma * logbetagamma * logbetagamma * logbetagamma;
135}
136//_____________________________________________________________________
137float Response::angleEffect10(float elossratio) const
138{
141 float angleEffectParam[3] = {1.90691e+02, -6.62258e+01, 1.28247e+01};
142 return angleEffectParam[0] + angleEffectParam[1] * elossratio + angleEffectParam[2] * elossratio * elossratio;
143}
144//_____________________________________________________________________
145float Response::angleEffectNorma(float angle) const
146{
150 float angleEffectParam[4] = {4.148, -6.809e-01, 5.151e-02, -1.490e-03};
151 return angleEffectParam[0] + angleEffectParam[1] * angle + angleEffectParam[2] * angle * angle + angleEffectParam[3] * angle * angle * angle;
152}
153//_____________________________________________________________________
154float Response::magAngleEffectNorma(float angle, float bfield) const
155{
159 float angleEffectParam[7] = {8.6995, 25.4022, 13.8822, 2.4717, 1.1551, -0.0624, 0.0012};
160 float aux = std::abs(angle - angleEffectParam[0] * bfield);
161 return 121.24 / ((angleEffectParam[1] + angleEffectParam[2] * std::abs(bfield)) + angleEffectParam[3] * aux + angleEffectParam[4] * aux * aux + angleEffectParam[5] * aux * aux * aux + angleEffectParam[6] * aux * aux * aux * aux);
162}
int16_t charge
Definition RawEventData.h:5
int32_t i
Configurable parameters for MCH charge induction and signal generation.
void setSqrtKy3AndDeriveKy2Ky4(float sqrtKy3)
void setSqrtKx3AndDeriveKx2Kx4(float sqrtKx3)
void setPitch(float pitch)
set the inverse of the anode-cathode pitch
uint32_t nSamples(float charge) const
compute the number of samples corresponding to the charge in ADC units
Definition Response.cxx:83
float inclandbfield(float thetawire, float betagamma, float bx) const
compute deteriation of y-resolution due to track inclination and B-field
Definition Response.cxx:92
float getAnod(float x) const
return wire coordinate closest to x
Definition Response.cxx:69
bool isMagnetEffect() const
Definition Response.h:40
bool isAngleEffect() const
Definition Response.h:39
float chargeCorr() const
return a randomized charge correlation between cathodes
Definition Response.cxx:77
Response(Station station)
Definition Response.cxx:29
float etocharge(float edepos) const
Definition Response.cxx:51
GLint GLenum GLint x
Definition glcorearb.h:403
GLfloat angle
Definition glcorearb.h:4071
float chargeCorrelation
amplitude of charge correlation between cathodes (= RMS of ln(q1/q2))
float chargeSpreadSt2345
width of the charge distribution for station 2 to 5
float pitchSt1
anode-cathode pitch (cm) for station 1
float chargeSlopeSt1
charge slope used in E to charge conversion for station 1
float chargeSpreadSt1
width of the charge distribution for station 1
float chargeSlopeSt2345
charge slope used in E to charge conversion for station 2 to 5
float chargeThreshold
minimum fraction of charge added to a pad
float pitchSt2345
anode-cathode pitch (cm) for station 2 to 5
float chargeSigmaIntegration
number of sigmas used for charge distribution