|
| 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 ALICEO2_ZDC_CONSTANTS_H |
| 12 | +#define ALICEO2_ZDC_CONSTANTS_H |
| 13 | + |
| 14 | +#include "CommonConstants/PhysicsConstants.h" |
| 15 | + |
| 16 | +namespace o2 |
| 17 | +{ |
| 18 | +namespace zdc |
| 19 | +{ |
| 20 | + |
| 21 | +enum DetectorID { DetIDOffs = 1, |
| 22 | + ZNA = 1, |
| 23 | + ZPA = 2, |
| 24 | + ZEM = 3, |
| 25 | + ZNC = 4, |
| 26 | + ZPC = 5 }; // IDs of subdetector |
| 27 | +enum ChannelTypeZNP { Common, |
| 28 | + Ch1, |
| 29 | + Ch2, |
| 30 | + Ch3, |
| 31 | + Ch4, |
| 32 | + Sum }; // channel IDs for ZN and ZP |
| 33 | +enum ChannelTypeZEM { ZEMCh1, |
| 34 | + ZEMCh2 }; // channel IDs for ZEMs |
| 35 | + |
| 36 | +constexpr int NTimeBinsPerBC = 12; //< number of samples per BC |
| 37 | +constexpr int NBCBefore = 1; //< number of BCs read before the triggered BC |
| 38 | +constexpr int NBCAfter = 2; //< number of BCs read after the triggered BC |
| 39 | +constexpr int NBCReadOut = 1 + NBCBefore + NBCAfter; // N BCs read out per trigger |
| 40 | + |
| 41 | +constexpr int NChannelsZN = 6; //< number of channels stored per ZN |
| 42 | +constexpr int NChannelsZP = 6; //< number of channels stored per ZP |
| 43 | +constexpr int NChannelsZEM = 2; //< number of channels stored per ZEM |
| 44 | + |
| 45 | +constexpr float ChannelTimeBinNS = 2.; //< bin length in NS |
| 46 | +constexpr float SampleLenghtNS = NTimeBinsPerBC * ChannelTimeBinNS; |
| 47 | + |
| 48 | +constexpr int NChannels = 2 * (NChannelsZN + NChannelsZP) + NChannelsZEM; |
| 49 | + |
| 50 | +//< get detector TOF correction in ns |
| 51 | +constexpr float getTOFCorrection(int det) |
| 52 | +{ |
| 53 | + constexpr float TOFCorr[5] = { |
| 54 | + 11253.3 / o2::constants::physics::LightSpeedCm2NS, |
| 55 | + 11251.8 / o2::constants::physics::LightSpeedCm2NS, |
| 56 | + 760. / o2::constants::physics::LightSpeedCm2NS, |
| 57 | + 11261.3 / o2::constants::physics::LightSpeedCm2NS, |
| 58 | + 11253.3 / o2::constants::physics::LightSpeedCm2NS |
| 59 | + }; |
| 60 | + return TOFCorr[det - DetIDOffs]; |
| 61 | +} |
| 62 | + |
| 63 | +//< map detector/tower to continuous channel ID |
| 64 | +constexpr int toChannel(int det, int tower) |
| 65 | +{ |
| 66 | + constexpr int DetChMap[5][6] = { { 0, 1, 2, 3, 4, 5 }, // ZNA |
| 67 | + { 6, 7, 8, 9, 10, 11 }, // ZPA |
| 68 | + { 12, 13, -1, -1, -1, -1 }, // ZEM |
| 69 | + { 14, 15, 16, 17, 18, 19 }, // ZNC |
| 70 | + { 20, 21, 22, 23, 24, 25 } }; // ZPC |
| 71 | + return DetChMap[det - 1][tower]; |
| 72 | +} |
| 73 | + |
| 74 | +//< map channelID to detector/tower |
| 75 | +constexpr int toDet(int channel, int& tower) |
| 76 | +{ |
| 77 | + if (channel < toChannel(ZNC, 0)) { |
| 78 | + tower = channel % NChannelsZN; |
| 79 | + return DetIDOffs + channel / NChannelsZP; |
| 80 | + } else { |
| 81 | + channel -= toChannel(ZNC, 0); |
| 82 | + tower = channel % NChannelsZN; |
| 83 | + return ZNC + channel / NChannelsZP; |
| 84 | + } |
| 85 | +} |
| 86 | + |
| 87 | +} // namespace zdc |
| 88 | +} // namespace o2 |
| 89 | + |
| 90 | +#endif |
0 commit comments