|
| 1 | +// Copyright CERN and copyright holders of ALICE O2. This software is |
| 2 | +// distributed under the terms of the GNU General Public License v3 (GPL |
| 3 | +// Version 3), copied verbatim in the file "COPYING". |
| 4 | +// |
| 5 | +// See http://alice-o2.web.cern.ch/license for full licensing information. |
| 6 | +// |
| 7 | +// In applying this license CERN does not waive the privileges and immunities |
| 8 | +// granted to it by virtue of its status as an Intergovernmental Organization |
| 9 | +// or submit itself to any jurisdiction. |
| 10 | + |
| 11 | +#ifndef DETECTORS_HMPID_BASE_INCLUDE_HMPIDBASE_DIGIT_H_ |
| 12 | +#define DETECTORS_HMPID_BASE_INCLUDE_HMPIDBASE_DIGIT_H_ |
| 13 | + |
| 14 | +#include "CommonDataFormat/TimeStamp.h" |
| 15 | +#include "HMPIDBase/Hit.h" // for hit |
| 16 | +#include "HMPIDBase/Param.h" // for param |
| 17 | +#include "TMath.h" |
| 18 | + |
| 19 | +namespace o2 |
| 20 | +{ |
| 21 | +namespace hmpid |
| 22 | +{ |
| 23 | + |
| 24 | +/// \class Digit |
| 25 | +/// \brief HMPID digit implementation |
| 26 | +using DigitBase = o2::dataformats::TimeStamp<double>; |
| 27 | +class Digit : public DigitBase |
| 28 | +{ |
| 29 | + public: |
| 30 | + Digit() = default; |
| 31 | + Digit(float charge) : mQ(charge) {} |
| 32 | + float getCharge() const { return mQ; } |
| 33 | + int getPadID() const { return mPad; } |
| 34 | + |
| 35 | + Digit(HitType const& hit) |
| 36 | + { |
| 37 | + int pc, px, py; |
| 38 | + float localX; |
| 39 | + float localY; |
| 40 | + |
| 41 | + // chamber number is in detID |
| 42 | + const auto chamber = hit.GetDetectorID(); |
| 43 | + |
| 44 | + double tmp[3] = { hit.GetX(), hit.GetY(), hit.GetZ() }; |
| 45 | + Param::Instance()->Mars2Lors(chamber, tmp, localX, localY); |
| 46 | + |
| 47 | + Param::Lors2Pad(localX, localY, pc, px, py); |
| 48 | + |
| 49 | + // TODO: check if this digit is valid |
| 50 | + // mark as invalid otherwise |
| 51 | + |
| 52 | + // calculate pad id |
| 53 | + mPad = Param::Abs(chamber, pc, px, py); |
| 54 | + |
| 55 | + // calculate charge |
| 56 | + mQ = /*fQHit **/ InMathieson(localX, localY); |
| 57 | + |
| 58 | + // what about time stamp?? |
| 59 | + } |
| 60 | + |
| 61 | + private: |
| 62 | + float mQ = 0.; |
| 63 | + int mPad = 0.; // -1 indicates invalid digit |
| 64 | + |
| 65 | + float LorsX() const { return Param::LorsX(Param::A2P(mPad), Param::A2X(mPad)); } //center of the pad x, [cm] |
| 66 | + float LorsY() const { return Param::LorsY(Param::A2P(mPad), Param::A2Y(mPad)); } //center of the pad y, [cm] |
| 67 | + |
| 68 | + float IntPartMathiX(float x) const |
| 69 | + { |
| 70 | + // Integration of Mathieson. |
| 71 | + // This is the answer to electrostatic problem of charge distrubution in MWPC described elsewhere. (NIM A370(1988)602-603) |
| 72 | + // Arguments: x,y- position of the center of Mathieson distribution |
| 73 | + // Returns: a charge fraction [0-1] imposed into the pad |
| 74 | + auto shift1 = -LorsX() + 0.5 * Param::SizePadX(); |
| 75 | + auto shift2 = -LorsX() - 0.5 * Param::SizePadX(); |
| 76 | + |
| 77 | + auto ux1 = Param::SqrtK3x() * TMath::TanH(Param::K2x() * (x + shift1) / Param::PitchAnodeCathode()); |
| 78 | + auto ux2 = Param::SqrtK3x() * TMath::TanH(Param::K2x() * (x + shift2) / o2::hmpid::Param::PitchAnodeCathode()); |
| 79 | + |
| 80 | + return o2::hmpid::Param::K4x() * (TMath::ATan(ux2) - TMath::ATan(ux1)); |
| 81 | + } |
| 82 | + //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 83 | + |
| 84 | + Double_t IntPartMathiY(Double_t y) const |
| 85 | + { |
| 86 | + // Integration of Mathieson. |
| 87 | + // This is the answer to electrostatic problem of charge distrubution in MWPC described elsewhere. (NIM A370(1988)602-603) |
| 88 | + // Arguments: x,y- position of the center of Mathieson distribution |
| 89 | + // Returns: a charge fraction [0-1] imposed into the pad |
| 90 | + Double_t shift1 = -LorsY() + 0.5 * o2::hmpid::Param::SizePadY(); |
| 91 | + Double_t shift2 = -LorsY() - 0.5 * o2::hmpid::Param::SizePadY(); |
| 92 | + |
| 93 | + Double_t uy1 = Param::SqrtK3y() * TMath::TanH(Param::K2y() * (y + shift1) / Param::PitchAnodeCathode()); |
| 94 | + Double_t uy2 = Param::SqrtK3y() * TMath::TanH(Param::K2y() * (y + shift2) / Param::PitchAnodeCathode()); |
| 95 | + |
| 96 | + return Param::K4y() * (TMath::ATan(uy2) - TMath::ATan(uy1)); |
| 97 | + } |
| 98 | + |
| 99 | + float InMathieson(float localX, float localY) const |
| 100 | + { |
| 101 | + return 4. * IntPartMathiX(localX) * IntPartMathiY(localY); |
| 102 | + } |
| 103 | + |
| 104 | + ClassDefNV(Digit, 1); |
| 105 | +}; |
| 106 | + |
| 107 | +} // namespace hmpid |
| 108 | +} // namespace o2 |
| 109 | + |
| 110 | +#endif /* DETECTORS_HMPID_BASE_INCLUDE_HMPIDBASE_DIGIT_H_ */ |
0 commit comments