Project
Loading...
Searching...
No Matches
Clusterer.h
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
14#ifndef ALICEO2_PHOS_CLUSTERER_H
15#define ALICEO2_PHOS_CLUSTERER_H
24#include "PHOSBase/Geometry.h"
25
26namespace o2
27{
28namespace phos
29{
30
32{
33 public:
34 Clusterer() = default;
35 ~Clusterer() = default;
36
37 void initialize();
38 void process(gsl::span<const Digit> digits, gsl::span<const TriggerRecord> dtr,
40 std::vector<Cluster>& clusters, std::vector<CluElement>& cluel, std::vector<TriggerRecord>& rigRec,
42 void processCells(gsl::span<const Cell> digits, gsl::span<const TriggerRecord> dtr,
44 std::vector<Cluster>& clusters, std::vector<CluElement>& cluel, std::vector<TriggerRecord>& rigRec,
46
47 void makeClusters(std::vector<Cluster>& clusters, std::vector<o2::phos::CluElement>& cluel);
48
51 void setL1phase(int phase)
52 {
54 mSkipL1phase = false;
55 }
56
57 protected:
58 // Calibrate energy
59 inline float calibrate(float amp, short absId, bool isHighGain)
60 {
61 if (isHighGain) {
62 return amp * mCalibParams->getGain(absId);
63 } else {
64 return amp * mCalibParams->getGain(absId) * mCalibParams->getHGLGRatio(absId);
65 }
66 }
67 // Calibrate time
68 inline float calibrateT(float time, short absId, bool isHighGain, int bc)
69 {
70 // L1phase correction
71 float shift = 0;
72 if (!mSkipL1phase) {
73 char relid[3];
75 int ddl = (relid[0] - 1) * 4 + (relid[1] - 1) / 16 - 2;
76 int l1 = (mL1phase >> (ddl * 2)) & 3; // extract 2 bits corresponding to this ddl
77 l1 = bc % 4 - l1;
78 if (l1 < 0) {
79 l1 += 4;
80 }
81 shift = l1 * 25.e-9;
82 }
83 // Calibrate time
84 if (isHighGain) {
85 return time - mCalibParams->getHGTimeCalib(absId) - shift;
86 } else {
87 return time - mCalibParams->getLGTimeCalib(absId) - shift;
88 }
89 }
90 // Test Bad map
91 inline bool isBadChannel(short absId) { return (!mBadMap->isChannelGood(absId)); }
92
93 char getNumberOfLocalMax(Cluster& clu, std::vector<CluElement>& cluel);
94 void evalAll(Cluster& clu, std::vector<CluElement>& cluel) const;
95 void evalLabels(std::vector<Cluster>& clusters, std::vector<CluElement>& cluel,
98
99 double showerShape(double r2, double& deriv); // Parameterization of EM shower
100
101 void makeUnfolding(Cluster& clu, std::vector<Cluster>& clusters, std::vector<o2::phos::CluElement>& cluel); // unfold cluster with few local maxima
102 void unfoldOneCluster(Cluster& iniClu, char nMax, std::vector<Cluster>& clusters, std::vector<CluElement>& cluelements);
103
104 protected:
105 static constexpr short NLOCMAX = 30; // Maximal number of local maxima in cluster
106 bool mProcessMC = false;
107 int miCellLabel = 0;
108 bool mFullCluOutput = false;
109 bool mSkipL1phase = true;
110 int mL1phase = 0;
111 Geometry* mPHOSGeom = nullptr;
112 const CalibParams* mCalibParams = nullptr;
113 const BadChannelsMap* mBadMap = nullptr;
114
115 std::vector<CluElement> mCluEl;
116 std::vector<Digit> mTrigger;
119
120 std::vector<float> mProp;
121 std::array<float, NLOCMAX> mxMax;
122 std::array<float, NLOCMAX> mzMax;
123 std::array<float, NLOCMAX> meMax;
124 std::array<float, NLOCMAX> mxMaxPrev;
125 std::array<float, NLOCMAX> mzMaxPrev;
126 std::array<float, NLOCMAX> mdx;
127 std::array<float, NLOCMAX> mdz;
128 std::array<float, NLOCMAX> mdxprev;
129 std::array<float, NLOCMAX> mdzprev;
130 std::array<double, NLOCMAX> mA;
131 std::array<double, NLOCMAX> mxB;
132 std::array<double, NLOCMAX> mzB;
133 std::array<double, NLOCMAX> mfijx;
134 std::array<double, NLOCMAX> mfijz;
135 std::array<double, NLOCMAX> mfijr;
136 std::array<double, NLOCMAX> mfij;
137 std::vector<bool> mIsLocalMax;
138 std::array<int, NLOCMAX> mMaxAt;
139};
140} // namespace phos
141} // namespace o2
142
143#endif
uint64_t phase
Definition RawEventData.h:7
uint64_t bc
Definition RawEventData.h:5
int16_t time
Definition RawEventData.h:4
Definition of a container to keep Monte Carlo truth external to simulation objects.
uint32_t c
Definition RawData.h:2
A container to hold and manage MC truth information/labels.
CCDB container for bad (masked) channels in PHOS.
bool isChannelGood(short channelID) const
Get the status of a certain cell.
float getHGLGRatio(short cellID) const
Get High Gain to Low Gain ratio calibration coefficients.
Definition CalibParams.h:69
float getGain(short cellID) const
Get High Gain energy calibration coefficients.
Definition CalibParams.h:53
float getLGTimeCalib(short cellID) const
Get Low Gain time calibration coefficient.
float getHGTimeCalib(short cellID) const
Get High Gain time calibration coefficients.
Definition CalibParams.h:85
Contains PHOS cluster parameters.
Definition Cluster.h:39
bool mFullCluOutput
Write output full of reduced (no contributed digits) clusters.
Definition Clusterer.h:108
static constexpr short NLOCMAX
Definition Clusterer.h:105
void makeUnfolding(Cluster &clu, std::vector< Cluster > &clusters, std::vector< o2::phos::CluElement > &cluel)
bool isBadChannel(short absId)
Definition Clusterer.h:91
void processCells(gsl::span< const Cell > digits, gsl::span< const TriggerRecord > dtr, const o2::dataformats::MCTruthContainer< MCLabel > *dmc, std::vector< Cluster > &clusters, std::vector< CluElement > &cluel, std::vector< TriggerRecord > &rigRec, o2::dataformats::MCTruthContainer< MCLabel > &cluMC)
void setBadMap(const o2::phos::BadChannelsMap *m)
Definition Clusterer.h:49
int mLastElementInEvent
Range of digits from one event.
Definition Clusterer.h:118
const BadChannelsMap * mBadMap
! Calibration coefficients, Clusterizer not owner
Definition Clusterer.h:113
std::array< double, NLOCMAX > mfijz
transient variable for derivative calculation
Definition Clusterer.h:134
int mL1phase
Do not correct for L1 phase.
Definition Clusterer.h:110
std::array< int, NLOCMAX > mMaxAt
indexes of local maxima
Definition Clusterer.h:138
char getNumberOfLocalMax(Cluster &clu, std::vector< CluElement > &cluel)
std::array< float, NLOCMAX > meMax
currecnt amplitude in unfoding
Definition Clusterer.h:123
void evalLabels(std::vector< Cluster > &clusters, std::vector< CluElement > &cluel, const o2::dataformats::MCTruthContainer< MCLabel > *dmc, o2::dataformats::MCTruthContainer< MCLabel > &cluMC)
float calibrateT(float time, short absId, bool isHighGain, int bc)
Definition Clusterer.h:68
std::array< float, NLOCMAX > mdz
step on current minimization iteration
Definition Clusterer.h:127
void setCalibration(const o2::phos::CalibParams *c)
Definition Clusterer.h:50
int mFirstElememtInEvent
Range of digits from one event.
Definition Clusterer.h:117
std::array< float, NLOCMAX > mdzprev
step on previoud minimization iteration
Definition Clusterer.h:129
double showerShape(double r2, double &deriv)
std::array< double, NLOCMAX > mxB
transient variable for derivative calculation
Definition Clusterer.h:131
void makeClusters(std::vector< Cluster > &clusters, std::vector< o2::phos::CluElement > &cluel)
std::array< float, NLOCMAX > mdxprev
step on previoud minimization iteration
Definition Clusterer.h:128
std::array< double, NLOCMAX > mfij
transient variable for derivative calculation
Definition Clusterer.h:136
Geometry * mPHOSGeom
packed shifts for 14 ddls
Definition Clusterer.h:111
std::vector< Digit > mTrigger
internal vector of clusters
Definition Clusterer.h:116
void unfoldOneCluster(Cluster &iniClu, char nMax, std::vector< Cluster > &clusters, std::vector< CluElement > &cluelements)
std::array< float, NLOCMAX > mdx
step on current minimization iteration
Definition Clusterer.h:126
std::vector< CluElement > mCluEl
! Bad map, Clusterizer not owner
Definition Clusterer.h:115
float calibrate(float amp, short absId, bool isHighGain)
Definition Clusterer.h:59
std::array< double, NLOCMAX > mA
transient variable for derivative calculation
Definition Clusterer.h:130
void setL1phase(int phase)
Definition Clusterer.h:51
std::vector< float > mProp
proportion of clusters in the current digit
Definition Clusterer.h:120
std::array< float, NLOCMAX > mxMax
current maximum coordinate
Definition Clusterer.h:121
std::array< double, NLOCMAX > mzB
transient variable for derivative calculation
Definition Clusterer.h:132
const CalibParams * mCalibParams
! PHOS geometry
Definition Clusterer.h:112
void evalAll(Cluster &clu, std::vector< CluElement > &cluel) const
std::vector< bool > mIsLocalMax
transient array for local max finding
Definition Clusterer.h:137
std::array< double, NLOCMAX > mfijr
transient variable for derivative calculation
Definition Clusterer.h:135
std::array< float, NLOCMAX > mzMax
in the unfolding procedure
Definition Clusterer.h:122
std::array< double, NLOCMAX > mfijx
transient variable for derivative calculation
Definition Clusterer.h:133
std::array< float, NLOCMAX > mxMaxPrev
coordunates at previous step
Definition Clusterer.h:124
std::array< float, NLOCMAX > mzMaxPrev
coordunates at previous step
Definition Clusterer.h:125
static bool absToRelNumbering(short absId, char *relid)
Definition Geometry.cxx:65
const GLfloat * m
Definition glcorearb.h:4066
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
Cluster clu
std::vector< Cluster > clusters
std::vector< Digit > digits