Skip to content

Commit 19518e5

Browse files
peressounkoDmitri Peresunko
andauthored
First implementation of PHOS trigger (#5821)
Implementation of calibration devices Co-authored-by: Dmitri Peresunko <Dmitri.Peresunko@cern.ch>
1 parent 36d4255 commit 19518e5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+3240
-659
lines changed

DataFormats/Detectors/PHOS/include/DataFormatsPHOS/Cell.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ constexpr float kTime0 = 150.e-9; //-Minimal time to be digitized
3434
enum ChannelType_t {
3535
HIGH_GAIN, ///< High gain channel
3636
LOW_GAIN, ///< Low gain channel
37-
TRU ///< TRU channel
37+
TRU2x2, ///< TRU channel, 2x2 trigger
38+
TRU4x4 ///< TRU channel, 4x4 trigger
3839
};
3940

4041
class Cell

DataFormats/Detectors/PHOS/include/DataFormatsPHOS/Cluster.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,14 @@ class Cluster
6464

6565
float getTime() const { return mTime; }
6666

67+
char firedTrigger() const { return mFiredTrigger; }
68+
void setFiredTrigger(char t) { mFiredTrigger = t; }
69+
6770
protected:
6871
char mMulDigit = 0; ///< Digit nultiplicity
6972
char mModule = 0; ///< Module number
7073
char mNExMax = -1; ///< number of (Ex-)maxima before unfolding
74+
char mFiredTrigger = 0; ///< matched with PHOS trigger: 0 no match, bit 1 with 2x2, bit 2 with 4x4
7175
float mLocalPosX = 0.; ///< Center of gravity position in local module coordunates (phi direction)
7276
float mLocalPosZ = 0.; ///< Center of gravity position in local module coordunates (z direction)
7377
float mFullEnergy = 0.; ///< full energy of a shower
@@ -78,7 +82,7 @@ class Cluster
7882
float mTime = 0.; ///< Time of the digit with maximal energy deposition
7983
float mDistToBadChannel = 999; ///< Distance to nearest bad crystal
8084

81-
ClassDefNV(Cluster, 2);
85+
ClassDefNV(Cluster, 3);
8286
};
8387
} // namespace phos
8488
} // namespace o2

DataFormats/Detectors/PHOS/include/DataFormatsPHOS/Digit.h

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ class Digit : public DigitBase
3838
/// particle in case of MC \return constructed Digit
3939
Digit(short cell, float amplitude, float time, int label);
4040

41+
/// \brief Contructor for TRU Digits
42+
/// \param cell truId of a tile, amplitude energy deposited in a tile, time, triggerType 2x2 or 4x4, dummy label
43+
Digit(short cell, float amplitude, float time, bool isTrigger2x2, int label);
44+
4145
/// \brief Digit constructor from Hit
4246
/// \param PHOS Hit
4347
/// \return constructed Digit
@@ -94,10 +98,16 @@ class Digit : public DigitBase
9498

9599
void addEnergyTime(float energy, float time);
96100

101+
// true if tru and not readount digit
102+
bool isTRU() const { return mAbsId >= NREADOUTCHANNELS; }
103+
97104
/// \brief Absolute sell id
98105
short getAbsId() const { return mAbsId; }
99106
void setAbsId(short cellId) { mAbsId = cellId; }
100107

108+
short getTRUId() const { return mAbsId - NREADOUTCHANNELS; }
109+
void setTRUId(short cellId) { mAbsId = cellId + NREADOUTCHANNELS; }
110+
101111
/// \brief Energy deposited in a cell
102112
float getAmplitude() const { return mAmplitude; }
103113
void setAmplitude(float amplitude) { mAmplitude = amplitude; }
@@ -110,6 +120,8 @@ class Digit : public DigitBase
110120
bool isHighGain() const { return mIsHighGain; }
111121
void setHighGain(Bool_t isHG) { mIsHighGain = isHG; }
112122

123+
bool is2x2Tile() { return isTRU() && isHighGain(); }
124+
113125
/// \brief index of entry in MCLabels array
114126
/// \return ndex of entry in MCLabels array
115127
int getLabel() const { return mLabel; }
@@ -127,7 +139,7 @@ class Digit : public DigitBase
127139
void PrintStream(std::ostream& stream) const;
128140

129141
private:
130-
// friend class boost::serialization::access;
142+
static constexpr short NREADOUTCHANNELS = 14337; ///< Number of channels starting from 1
131143

132144
bool mIsHighGain = true; ///< High Gain or Low Gain channel (for calibration)
133145
short mAbsId = 0; ///< cell index (absolute cell ID)

DataFormats/Detectors/PHOS/src/Cell.cxx

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ using namespace o2::phos;
2222

2323
Cell::Cell(short absId, float energy, float time, ChannelType_t ctype)
2424
{
25-
if (ctype == ChannelType_t::TRU) {
25+
if (ctype == ChannelType_t::TRU2x2 || ctype == ChannelType_t::TRU4x4) {
2626
setTRUId(absId);
2727
} else {
2828
setAbsId(absId);
@@ -127,9 +127,11 @@ void Cell::setType(ChannelType_t ctype)
127127
{
128128
switch (ctype) {
129129
case ChannelType_t::HIGH_GAIN:
130+
case ChannelType_t::TRU2x2:
130131
setHighGain();
131132
break;
132133
case ChannelType_t::LOW_GAIN:
134+
case ChannelType_t::TRU4x4:
133135
setLowGain();
134136
break;
135137
default:;
@@ -138,12 +140,19 @@ void Cell::setType(ChannelType_t ctype)
138140

139141
ChannelType_t Cell::getType() const
140142
{
141-
if (getHighGain()) {
142-
return ChannelType_t::HIGH_GAIN;
143-
} else if (getTRU()) {
144-
return ChannelType_t::TRU;
143+
if (getTRU()) {
144+
if (getHighGain()) {
145+
return ChannelType_t::TRU2x2;
146+
} else {
147+
return ChannelType_t::TRU4x4;
148+
}
149+
} else {
150+
if (getHighGain()) {
151+
return ChannelType_t::HIGH_GAIN;
152+
} else {
153+
return ChannelType_t::LOW_GAIN;
154+
}
145155
}
146-
return ChannelType_t::LOW_GAIN;
147156
}
148157

149158
void Cell::setLowGain()

DataFormats/Detectors/PHOS/src/Digit.cxx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ Digit::Digit(short absId, float amplitude, float time, int label)
2121
: DigitBase(time), mAmplitude(amplitude), mTime(time), mAbsId(absId), mLabel(label)
2222
{
2323
}
24+
Digit::Digit(short truId, float amplitude, float time, bool isTrigger2x2, int /*dummy*/)
25+
: DigitBase(time), mAmplitude(amplitude), mTime(time), mAbsId(truId + NREADOUTCHANNELS), mLabel(-1)
26+
{
27+
setHighGain(isTrigger2x2);
28+
}
2429
Digit::Digit(const Hit& hit, int label) : mAbsId(hit.GetDetectorID()), mAmplitude(hit.GetEnergyLoss()), mTime(hit.GetTime()), mLabel(label)
2530
{
2631
}

Detectors/CTF/test/test_ctf_io_phos.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ BOOST_AUTO_TEST_CASE(CTFTest)
3737
auto start = cells.size();
3838
int n = 1 + gRandom->Poisson(100);
3939
for (int i = n; i--;) {
40-
ChannelType_t tp = gRandom->Rndm() > 0.5 ? TRU : (gRandom->Rndm() > 0.5 ? HIGH_GAIN : LOW_GAIN);
41-
uint16_t id = tp == TRU ? 3000 : gRandom->Integer(kNmaxCell);
40+
ChannelType_t tp = gRandom->Rndm() > 0.5 ? (gRandom->Rndm() > 0.5 ? TRU2x2 : TRU4x4) : (gRandom->Rndm() > 0.5 ? HIGH_GAIN : LOW_GAIN);
41+
uint16_t id = (tp == TRU2x2 || tp == TRU4x4) ? 3000 : gRandom->Integer(kNmaxCell);
4242
float timeCell = gRandom->Rndm() * 3.00e-07 - 0.3e-9;
4343
float en = gRandom->Rndm() * 160.;
4444
cells.emplace_back(id, en, timeCell, tp);

Detectors/PHOS/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!-- doxy
2+
\page refDetectorsPHOS PHOS
3+
/doxy -->
4+
5+
# PHOS
6+
7+
This is a top page for the PHOS detector documentation.
8+
9+
<!-- doxy
10+
\subpage refDetectorsPHOSGeometry
11+
*\subpage refDetectorsPHOSsimulation
12+
*\subpage refDetectorsPHOSreconstruction
13+
\subpage refDetectorsPHOScalibration
14+
/doxy -->

Detectors/PHOS/base/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<!-- doxy
2+
\page refDetectorsPHOSGeometry PHOS Geometry
3+
/doxy -->
4+
5+
# PHOS geometry
6+
7+
Module numbering: start from module 0 (non-existing), 1 (half-module), 2 (bottom),... 4(highest)
8+
9+
All channels have unique absId: start from 1 till 4*64*56. Numbering in each module starts at bottom left and first go in z direction:
10+
56 112 3584
11+
... ... ...
12+
1 57 ...3529
13+
14+
One can use also relative numbering relid[3]:
15+
(module number[0...3], iphi[1...64], iz[1...56])
16+
17+
Then TRU channels go 112 per branch, 2 branches per ddl
18+
tru channels have absId after readout channels:
19+
absId = getTotalNCells() + TRUabsId ;
20+
relId for TRU
21+
relid: [DDL id=0..13] [x in 2x2 system: 0..7] [z in 2x2 system 0..27]
22+
23+
Mapping is realized with class Mapping and mapping files are stored as MODxRCUy.data
24+
25+
<!-- doxy
26+
/doxy -->

Detectors/PHOS/base/include/PHOSBase/Geometry.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,12 @@ class Geometry
106106
static void absIdToRelPosInModule(short absId, float& x, float& z);
107107
static bool relToAbsNumbering(const char* RelId, short& AbsId);
108108

109+
//Converters for TRU digits
110+
static bool truAbsToRelNumbering(short truId, char* relid);
111+
static short truRelToAbsNumbering(const char* relId);
112+
static bool truRelId2RelId(const char* truRelId, char* relId);
113+
static short relPosToTruId(char mod, float x, float z, short& ddl);
114+
109115
//local position to absId
110116
static void relPosToAbsId(char module, float x, float z, short& absId);
111117

Detectors/PHOS/base/include/PHOSBase/Mapping.h

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,13 @@ class Mapping
3838
kWrongAbsId,
3939
kWrongCaloFlag,
4040
kNotInitialized };
41-
static constexpr short NCHANNELS = 14337; ///< Number of channels starting from 1
42-
static constexpr short NHWPERDDL = 2048; ///< Number of HW addressed per DDL
43-
static constexpr short NMaxHWAddress = 3929; ///< Maximal HW address (size of array)
44-
static constexpr short NDDL = 14; ///< Total number of DDLs
41+
static constexpr short NCHANNELS = 14337; ///< Number of channels starting from 1
42+
static constexpr short NHWPERDDL = 2048; ///< Number of HW addressed per DDL
43+
static constexpr short NMaxHWAddress = 3929; ///< Maximal HW address (size of array)
44+
static constexpr short NDDL = 14; ///< Total number of DDLs
45+
static constexpr short NTRUBranchReadoutChannels = 112; ///< Number of TRU readout channels per branch
46+
static constexpr short NTRUReadoutChannels = 3136; ///< Total number of TRU readout channels
47+
static constexpr short TRUFinalProductionChannel = 123; // The last channel of production bits, contains markesr to choose between 2x2 and 4x4 algorithm
4548

4649
enum CaloFlag { kHighGain,
4750
kLowGain,
@@ -65,6 +68,9 @@ class Mapping
6568

6669
ErrorStatus setMapping();
6770

71+
//Select TRU readout channels or TRU flag channels
72+
static bool isTRUReadoutchannel(short hwAddress) { return (hwAddress < 112) || (hwAddress > 2048 && hwAddress < 2048 + 112); }
73+
6874
protected:
6975
/// \brief Construct vector for conversion only if necessary
7076
ErrorStatus constructAbsToHWMatrix();

0 commit comments

Comments
 (0)