Project
Loading...
Searching...
No Matches
ClusterFinderOriginal.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
16
17#ifndef O2_MCH_CLUSTERFINDERORIGINAL_H_
18#define O2_MCH_CLUSTERFINDERORIGINAL_H_
19
20#include <functional>
21#include <map>
22#include <memory>
23#include <utility>
24#include <vector>
25
26#include <gsl/span>
27
28#include <TH2D.h>
29
32#include "MCHBase/ErrorMap.h"
35
36namespace o2
37{
38namespace mch
39{
40
41class PadOriginal;
42class ClusterOriginal;
43class MathiesonOriginal;
44
46{
47 public:
50
55
56 void init(bool run2Config);
57 void deinit();
58 void reset();
59
60 void findClusters(gsl::span<const Digit> digits);
61
63 const std::vector<Cluster>& getClusters() const { return mClusters; }
65 const std::vector<Digit>& getUsedDigits() const { return mUsedDigits; }
66
68 ErrorMap& getErrorMap() { return mErrorMap; }
69
70 private:
71 static constexpr double SDistancePrecision = 1.e-3;
72 static constexpr int SNFitClustersMax = 3;
73 static constexpr int SNFitParamMax = 3 * SNFitClustersMax - 1;
74 static constexpr double SLowestCoupling = 1.e-2;
75
76 void resetPreCluster(gsl::span<const Digit>& digits);
77 void simplifyPreCluster(std::vector<int>& removedDigits);
78 void processPreCluster();
79
80 void buildPixArray();
81 void ProjectPadOverPixels(const PadOriginal& pad, TH2D& hCharges, TH2I& hEntries) const;
82
83 void findLocalMaxima(std::unique_ptr<TH2D>& histAnode, std::multimap<double, std::pair<int, int>, std::greater<>>& localMaxima);
84 void flagLocalMaxima(const TH2D& histAnode, int i0, int j0, std::vector<std::vector<int>>& isLocalMax) const;
85 void restrictPreCluster(const TH2D& histAnode, int i0, int j0);
86
87 void processSimple();
88 void process();
89 void addVirtualPad();
90 void computeCoefficients(std::vector<double>& coef, std::vector<double>& prob) const;
91 double mlem(const std::vector<double>& coef, const std::vector<double>& prob, int nIter);
92 void findCOG(const TH2D& histMLEM, double xy[2]) const;
93 void refinePixelArray(const double xyCOG[2], size_t nPixMax, double& xMin, double& xMax, double& yMin, double& yMax);
94 void cleanPixelArray(double threshold, std::vector<double>& prob);
95
96 int fit(const std::vector<const std::vector<int>*>& clustersOfPixels, const double fitRange[2][2], double fitParam[SNFitParamMax + 1]);
97 double fit(double currentParam[SNFitParamMax + 2], const double parmin[SNFitParamMax], const double parmax[SNFitParamMax],
98 int nParamUsed, int& nTrials) const;
99 double computeChi2(const double param[SNFitParamMax + 2], int nParamUsed) const;
100 void param2ChargeFraction(const double param[SNFitParamMax], int nParamUsed, double fraction[SNFitClustersMax]) const;
101 float chargeIntegration(double x, double y, const PadOriginal& pad) const;
102
103 void split(const TH2D& histMLEM, const std::vector<double>& coef);
104 void addPixel(const TH2D& histMLEM, int i0, int j0, std::vector<int>& pixels, std::vector<std::vector<bool>>& isUsed);
105 void addCluster(int iCluster, std::vector<int>& coupledClusters, std::vector<bool>& isClUsed,
106 const std::vector<std::vector<double>>& couplingClCl) const;
107 void extractLeastCoupledClusters(std::vector<int>& coupledClusters, std::vector<int>& clustersForFit,
108 const std::vector<std::vector<double>>& couplingClCl) const;
109 int selectPads(const std::vector<int>& coupledClusters, const std::vector<int>& clustersForFit,
110 const std::vector<std::vector<double>>& couplingClPad);
111 void merge(const std::vector<int>& clustersForFit, const std::vector<int>& coupledClusters, std::vector<std::vector<int>>& clustersOfPixels,
112 std::vector<std::vector<double>>& couplingClCl, std::vector<std::vector<double>>& couplingClPad) const;
113 void updatePads(const double fitParam[SNFitParamMax + 1], int nParamUsed);
114
115 void setClusterResolution(Cluster& cluster) const;
116
118 std::function<double(uint32_t)> mADCToCharge = [](uint32_t adc) { return static_cast<double>(adc); };
119
120 double mLowestPadCharge = 0.;
121 double mLowestPixelCharge = 0.;
122 double mLowestClusterCharge = 0.;
123
124 std::unique_ptr<MathiesonOriginal[]> mMathiesons;
125 MathiesonOriginal* mMathieson = nullptr;
126
127 std::unique_ptr<ClusterOriginal> mPreCluster;
128 std::vector<PadOriginal> mPixels;
129
130 const mapping::Segmentation* mSegmentation = nullptr;
131
132 std::vector<Cluster> mClusters{};
133 std::vector<Digit> mUsedDigits{};
134
135 ErrorMap mErrorMap{};
136
137 PreClusterFinder mPreClusterFinder{};
138};
139
140} // namespace mch
141} // namespace o2
142
143#endif // O2_MCH_CLUSTERFINDERORIGINAL_H_
Definition of the MCH cluster minimal structure.
float & yMax
const std::vector< Digit > & getUsedDigits() const
return the list of digits used in reconstructed clusters
ErrorMap & getErrorMap()
return the counting of encountered errors
ClusterFinderOriginal & operator=(const ClusterFinderOriginal &)=delete
void findClusters(gsl::span< const Digit > digits)
const std::vector< Cluster > & getClusters() const
return the list of reconstructed clusters
ClusterFinderOriginal & operator=(ClusterFinderOriginal &&)=delete
ClusterFinderOriginal(const ClusterFinderOriginal &)=delete
ClusterFinderOriginal(ClusterFinderOriginal &&)=delete
A container class to summarize errors encountered during processing.
Definition ErrorMap.h:38
pad for internal use
Definition PadOriginal.h:33
GLint GLenum GLint x
Definition glcorearb.h:403
GLint GLint GLsizei GLint GLenum GLenum const void * pixels
Definition glcorearb.h:275
GLenum GLfloat param
Definition glcorearb.h:271
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
cluster minimal structure
Definition Cluster.h:31
std::vector< Digit > digits
ArrayADC adc