Project
Loading...
Searching...
No Matches
ClusterFinderGEM.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_CLUSTERFINDERGEM_H_
18#define O2_MCH_CLUSTERFINDERGEM_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
35
36// GG Added include
37#include "ClusterDump.h"
38#include "clusterProcessing.h"
39
40namespace o2
41{
42namespace mch
43{
44class PadOriginal;
45class ClusterOriginal;
46
47// GG class MathiesonOriginal;
48
50{
51 public:
54
59
60 //
61 // GG method called by the process workflow ( ClusterFinderGEMSpec )
62 //
63
64 void init(int mode, bool run2Config);
65 void deinit();
66 void reset();
67 void fillGEMInputData(gsl::span<const Digit>& digits, uint16_t bunchCrossing, uint32_t orbit, uint32_t iPreCluster);
68 void releasePreCluster();
69 //
70 void findClusters(gsl::span<const Digit> digits, uint16_t bunchCrossing, uint32_t orbit, uint32_t iPreCluster);
71 //
73
74 const std::vector<Cluster>& getClusters() const { return mClusters; }
76 const std::vector<Digit>& getUsedDigits() const { return mUsedDigits; }
77 void dumpPreCluster(ClusterDump* dumpFile, gsl::span<const Digit> digits, uint16_t bunchCrossing, uint32_t orbit, uint32_t iPreCluster);
78 void dumpClusterResults(ClusterDump* dumpFile, const std::vector<Cluster>& clusters, size_t startIdx, uint16_t bunchCrossing, uint32_t orbit, uint32_t iPreCluster);
79
80 private:
81 // GG Original commented
82 // Invalid static constexpr double SDistancePrecision = 1.e-3; ///< precision used to check overlaps and so on (cm)
83 // static constexpr double SLowestPadCharge = 4.f * 0.22875f; ///< minimum charge of a pad
84 // static constexpr double SLowestPixelCharge = SLowestPadCharge / 12.; ///< minimum charge of a pixel
85 // static constexpr double SLowestClusterCharge = 2. * SLowestPadCharge; ///< minimum charge of a cluster
86
87 static constexpr int SNFitClustersMax = 3;
88 static constexpr int SNFitParamMax = 3 * SNFitClustersMax - 1;
89 static constexpr double SLowestCoupling = 1.e-2;
90
91 // Invalid ???
92 // static constexpr char statFileName[] = "statistics.csv";
93 // std::fstream statStream;
94
95 // GG Unused
96 // void resetPreCluster(gsl::span<const Digit>& digits);
97 // void simplifyPreCluster(std::vector<int>& removedDigits);
98 // void processPreCluster();
99
100 // void buildPixArray();
101 // void ProjectPadOverPixels(const PadOriginal& pad, TH2D& hCharges, TH2I& hEntries) const;
102
103 // void findLocalMaxima(std::unique_ptr<TH2D>& histAnode, std::multimap<double, std::pair<int, int>, std::greater<>>& localMaxima);
104 // void flagLocalMaxima(const TH2D& histAnode, int i0, int j0, std::vector<std::vector<int>>& isLocalMax) const;
105 // void restrictPreCluster(const TH2D& histAnode, int i0, int j0);
106
107 // void processSimple();
108 // void process();
109 // void addVirtualPad();
110 // void computeCoefficients(std::vector<double>& coef, std::vector<double>& prob) const;
111 // double mlem(const std::vector<double>& coef, const std::vector<double>& prob, int nIter);
112 // void findCOG(const TH2D& histMLEM, double xy[2]) const;
113 // void refinePixelArray(const double xyCOG[2], size_t nPixMax, double& xMin, double& xMax, double& yMin, double& yMax);
114 // void shiftPixelsToKeep(double charge);
115 // void cleanPixelArray(double threshold, std::vector<double>& prob);
116
117 // int fit(const std::vector<const std::vector<int>*>& clustersOfPixels, const double fitRange[2][2], double fitParam[SNFitParamMax + 1]);
118 // double fit(double currentParam[SNFitParamMax + 2], const double parmin[SNFitParamMax], const double parmax[SNFitParamMax],
119 // int nParamUsed, int& nTrials) const;
120 // double computeChi2(const double param[SNFitParamMax + 2], int nParamUsed) const;
121 // void param2ChargeFraction(const double param[SNFitParamMax], int nParamUsed, double fraction[SNFitClustersMax]) const;
122 //
123 // float chargeIntegration(double x, double y, const PadOriginal& pad) const;
124 //
125 // void split(const TH2D& histMLEM, const std::vector<double>& coef);
126 // void addPixel(const TH2D& histMLEM, int i0, int j0, std::vector<int>& pixels, std::vector<std::vector<bool>>& isUsed);
127 // void addCluster(int iCluster, std::vector<int>& coupledClusters, std::vector<bool>& isClUsed,
128 // const std::vector<std::vector<double>>& couplingClCl) const;
129 // void extractLeastCoupledClusters(std::vector<int>& coupledClusters, std::vector<int>& clustersForFit,
130 // const std::vector<std::vector<double>>& couplingClCl) const;
131 // int selectPads(const std::vector<int>& coupledClusters, const std::vector<int>& clustersForFit,
132 // const std::vector<std::vector<double>>& couplingClPad);
133 // void merge(const std::vector<int>& clustersForFit, const std::vector<int>& coupledClusters, std::vector<std::vector<int>>& clustersOfPixels,
134 // std::vector<std::vector<double>>& couplingClCl, std::vector<std::vector<double>>& couplingClPad) const;
135 // void updatePads(const double fitParam[SNFitParamMax + 1], int nParamUsed);
136 void setClusterResolution(Cluster& cluster) const;
137 std::unique_ptr<MathiesonOriginal[]> mMathiesons;
138 // GG MathiesonOriginal* mMathieson = nullptr; ///< pointer to the Mathieson function currently used
139 //
140 // GG Introduced for run3
141 // function to reinterpret digit ADC as charge
142 std::function<double(uint32_t)> mADCToCharge = [](uint32_t adc) { return static_cast<double>(adc); };
143 //
144 std::unique_ptr<ClusterOriginal> mPreCluster;
145 // GG std::vector<PadOriginal> mPixels; ///< list of pixels for the current precluster
146
147 const mapping::Segmentation* mSegmentation = nullptr;
148 std::vector<Cluster> mClusters{};
149 std::vector<Digit> mUsedDigits{};
150
151 PreClusterFinder mPreClusterFinder{};
152
153 //
154 // GG Added to process GEM and use Dump Files
155 void initPreCluster(gsl::span<const Digit>& digits, uint16_t bunchCrossing, uint32_t orbit, uint32_t iPreCluster);
156
157 int mode;
158 int nPads;
159 double* xyDxy;
160 Mask_t* cathode;
161 Mask_t* saturated;
162 double* padCharge;
163 int DEId;
164 // PreCluster Identification
165 uint32_t currentBC;
166 uint32_t currentOrbit;
167 uint32_t currentPreClusterID;
168
169 // Dump Files
170 // Invalid
171 // ClusterDump* pOriginalClusterDump;
172 // ClusterDump* pGEMClusterDump;
173};
174
175} // namespace mch
176} // namespace o2
177
178#endif // O2_MCH_CLUSTERFINDERGEM_H_
Definition of a class to reconstruct clusters with the original MLEM algorithm.
Definition of a class to reconstruct clusters with the MLEM algorithm.
uint64_t orbit
Definition RawEventData.h:6
void fillGEMInputData(gsl::span< const Digit > &digits, uint16_t bunchCrossing, uint32_t orbit, uint32_t iPreCluster)
ClusterFinderGEM(ClusterFinderGEM &&)=delete
ClusterFinderGEM & operator=(ClusterFinderGEM &&)=delete
ClusterFinderGEM & operator=(const ClusterFinderGEM &)=delete
void findClusters(gsl::span< const Digit > digits, uint16_t bunchCrossing, uint32_t orbit, uint32_t iPreCluster)
void dumpPreCluster(ClusterDump *dumpFile, gsl::span< const Digit > digits, uint16_t bunchCrossing, uint32_t orbit, uint32_t iPreCluster)
const std::vector< Cluster > & getClusters() const
return the list of reconstructed clusters
void init(int mode, bool run2Config)
void dumpClusterResults(ClusterDump *dumpFile, const std::vector< Cluster > &clusters, size_t startIdx, uint16_t bunchCrossing, uint32_t orbit, uint32_t iPreCluster)
ClusterFinderGEM(const ClusterFinderGEM &)=delete
const std::vector< Digit > & getUsedDigits() const
return the list of digits used in reconstructed clusters
GLenum mode
Definition glcorearb.h:266
short Mask_t
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< Cluster > clusters
std::vector< Digit > digits
ArrayADC adc