Project
Loading...
Searching...
No Matches
ClusterPEM.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
17
18#ifndef O2_MCH_CLUSTER_H_
19#define O2_MCH_CLUSTER_H_
20
21#include <gsl/gsl_blas.h>
22#include <gsl/gsl_linalg.h>
23
25
26namespace o2
27{
28namespace mch
29{
30typedef std::pair<int, double*> DataBlock_t;
31
32typedef struct {
36
38{
39 public:
41 // Main constructor from initial data
42 ClusterPEM(const double* x, const double* y, const double* dx, const double* dy,
43 const double* q, const short* cathodes, const short* saturated,
44 int chId, int nPads);
45 ClusterPEM(Pads* pads0, Pads* pads1);
46 // Extract a sub-cluster belonging to the group g
49 inline int getNbrOfPads(int c)
50 {
51 return ((pads[c] == nullptr) ? 0 : pads[c]->getNbrOfPads());
52 };
53 inline int getNbrOfObsPads(int c)
54 {
55 return ((pads[c] == nullptr) ? 0 : pads[c]->getNbrOfObsPads());
56 };
57 inline int getNbrOfPads()
58 {
59 return getNbrOfPads(0) + getNbrOfPads(1);
60 };
61 inline int getNbrOfObsPads()
62 {
63 return getNbrOfObsPads(0) + getNbrOfObsPads(1);
64 };
65 inline double getTotalCharge(int c)
66 {
67 return (pads[c] == nullptr ? 0 : pads[c]->getTotalCharge());
68 };
69
70 inline const double* getCharges(int c)
71 {
72 return (pads[c] == nullptr ? nullptr : pads[c]->getCharges());
73 }
74
75 double getMaxCharge();
76
77 inline const Pads* getPads(int c) { return pads[c]; };
78 inline const Groups_t* getCathGroup(int c) { return cathGroup[c]; };
79 inline Groups_t* getProjPadGroup() { return projPadToGrp; };
80 int getNbrOfPadsInGroup(int g);
82 {
83 return (projectedPads == nullptr ? -1 : projectedPads->getNbrOfPads());
84 };
85 std::pair<double, double> computeChargeBarycenter(int plane);
86 //
87 std::pair<int, int> getNxNy(int c);
88 // Unused - Old version
89 // double *getProjPadsAsXYdXY( Groups_t group, const Mask_t* maskGrp, int
90 // nbrProjPadsInTheGroup);
92 {
93 return mapCathPadIdxToPadIdx[c];
94 };
95 // Build the 2 cathodes superosition geometry
96 int buildProjectedGeometry(int includeAlonePads);
97 const Pads* getProjectedPads() { return projectedPads; };
98 // Project the charges of the 2 cathodes planes on the projected geometry
99 double* projectChargeOnProjGeometry(int includeAlonePads);
100 // Build Groups or geometrically independant Subclusters
101 int buildGroupOfPads();
102 // Add zero-charge pads to the cluster neighboring
103 void addBoundaryPads();
104 // Find local maximima with the PET algo
105 int findLocalMaxWithPEM(double* thetaL, int nbrOfPadsInTheGroupCath);
106 int findLocalMaxWithPEMFullRefinement(double* thetaL, int nbrOfPadsInTheGroupCath);
107 int findLocalMaxWithPEM2Lev(double* thetaL, int nbrOfPadsInTheGroupCath);
108 // Perform the fitting
109 DataBlock_t fit(double* thetaInit, int K);
110 // Not used in the Clustering/fitting
111 // Just to check hit results
112 int findLocalMaxWithBothCathodes(double* thetaOut, int kMax);
113
114 private:
115 // Cathodes planes
116 int chamberId = -1;
117 int singleCathPlaneID = -1; // index of the unique cathode plane (0 or 1)
118 int nbrOfCathodePlanes = 0; // Nbr of Cathodes Plane
119 Pads* pads[2] = {nullptr, nullptr}; // Two cathode-pads
120 int nbrSaturated = 0; // Number of saturated pads
121 // Used for InspectModel
122 PadIdx_t* mapCathPadIdxToPadIdx[2] = {
123 nullptr, nullptr}; // Map cathode-pad index to pad index
124
125 // Projection
126 Pads* projectedPads = nullptr; // Projected pads
127 // Invalid PadIdx_t* projNeighbors = nullptr; // Neighbors list of projected pads
128 Groups_t* projPadToGrp = nullptr; // Groups of projected pads
129 int nbrOfProjGroups = 0;
130 // Groups (i.e. cathode groups)
131 Groups_t* cathGroup[2] = {nullptr, nullptr};
132 int nbrOfCathGroups = 0;
133 // Geometry
134 PadIdx_t* IInterJ = nullptr; // Compressed intersection matrix
135 PadIdx_t* JInterI = nullptr; // Compressed intersection matrix
136 PadIdx_t* aloneIPads = nullptr; // Indexes of alone pads in cathode 0
137 PadIdx_t* aloneJPads = nullptr; // Indexes of alone pads in cathode 1
138 MapKToIJ_t* mapKToIJ =
139 nullptr; // Mapping projected pads (k) to the 2 intersection pads
140 PadIdx_t* mapIJToK =
141 nullptr; // Inverse mapping (i,j) pads -> k (projected pads)
142 PadIdx_t* aloneKPads = nullptr; // Alone (isolate) projected pads
143
144 // Compute the projected geometry
145 // Used by buildProjectedGeometry
146 void computeProjectedPads(const Pads& pad0InfSup, const Pads& pad1InfSup,
147 int maxNbrOfProjPads, PadIdx_t* aloneIPads,
148 PadIdx_t* aloneJPads, PadIdx_t* aloneKPads,
149 int includeAlonePads);
150 // Build groups from projected geometry (called proj-groups)
151 int getConnectedComponentsOfProjPadsWOSinglePads();
152 // Not Used - older version
153 // void assignSingleCathPadsToGroup( short *padGroup, int nPads, int nGrp, int
154 // nCath0, int nCath1, short *wellSplitGroup); Propagate the proj-groups to
155 // the pads (of the 2 cathodes)
156 int assignPadsToGroupFromProj(int nGrp);
157 // Propagate the proj-groups to the pads (of the 2 cathodes)
158 // Not used
159 int assignGroupToCathPads();
160 void updateProjectionGroups();
161 // Unused - Old version
162 int renumberGroupsFromMap(Groups_t* grpToGrp, int nGrp);
163 // Renumber the groups id (starting from 0 and without gaps)
164 int renumberGroups(Groups_t* grpToGrp, int nGrp);
165 // Remove low charged groups
166 void removeLowChargedGroups(int nGroups);
167 // Remove smallCharged seeds
168 int filterFitModelOnSmallChargedSeeds(Pads& pads, double* theta, int K,
169 Mask_t* maskFilteredTheta);
170 // Keep the seeds inside the cluster area
171 // Some fitting cases provide seeds outside of the cluster area
172 int filterFitModelOnClusterRegion(Pads& pads, double* theta, int K,
173 Mask_t* maskFilteredTheta);
174 // Remove hits which are far from the strating position (theta0)
175 int filterFitModelOnSpaceVariations(const double* theta0, int K0,
176 double* theta, int K,
177 Mask_t* maskFilteredTheta);
178 Pads* findLocalMaxWithRefinement(double* thetaL, int nbrOfPadsInTheGroupCath);
179 Pads* findLocalMaxWithoutRefinement(double* thetaL, int nbrOfPadsInTheGroupCath);
180 // ???
181 int getIndexByRow(const char* matrix, PadIdx_t N, PadIdx_t M, PadIdx_t* IIdx);
182 int getIndexByColumns(const char* matrix, PadIdx_t N, PadIdx_t M,
183 PadIdx_t* JIdx);
184 // Check the consistency of the different maps
185 int checkConsistencyMapKToIJ(const char* intersectionMatrix,
186 const MapKToIJ_t* mapKToIJ,
187 const PadIdx_t* mapIJToK,
188 const PadIdx_t* aloneIPads,
189 const PadIdx_t* aloneJPads, int N0, int N1,
190 int nbrOfProjPads);
191
192 // Not used in the Clustering/fitting
193 // Just to check hit results
194 int laplacian2D(const Pads& pads_, PadIdx_t* neigh, int chId,
195 PadIdx_t* sortedLocalMax, int kMax, double* smoothQ);
196};
197
198gsl_matrix* moore_penrose_pinv(gsl_matrix* A, double rcond);
199
200} // namespace mch
201} // namespace o2
202
203#endif // O2_MCH_CLUSTER_H_
configStandalone Reconstruction rec_tpc multiplier for the combined cluster track error during track following area in cm for the search of for z only used if decrease removal by when above this local occupancy rowx Shift of TPC revert cluster flag edge bit distance to edge exceeds this ZOffset for secondary multiple of radius max P of electron K BB bands crossing max P of electron p BB bands crossing max P of electron d BB bands crossing max P of electron t BB bands crossing min accepted dEdxMaxTPC of the track Additive extra cluster error for Y2 if edge flag set Additive extra cluster error for Y2 if single set Additive extra cluster error for Y2 if or single set Additive extra cluster error for Z2 if or single set Extra errors to add to track when crossing depending on addErrorsCECrossing Inner portion of y range in sector that is not used in searching for extrapolated track candidates factor2YS for track merging factor2K for track merging Margin in cm of Y position when rejecting edge clusters based on uncorrected track Y Max fraction of shared clusters for tracklet Except pad from cluster finding if total number of charges in a fragment is above this Except pad from cluster finding if number of consecutive charges in a fragment is above this Threshold where a timebin is considered saturated
uint32_t c
Definition RawData.h:2
Definition A.h:16
int getNbrOfPads(int c)
Definition ClusterPEM.h:49
std::pair< int, int > getNxNy(int c)
const double * getCharges(int c)
Definition ClusterPEM.h:70
int findLocalMaxWithBothCathodes(double *thetaOut, int kMax)
int findLocalMaxWithPEMFullRefinement(double *thetaL, int nbrOfPadsInTheGroupCath)
int getNbrOfProjectedPads()
Definition ClusterPEM.h:81
const Pads * getProjectedPads()
Definition ClusterPEM.h:97
int buildProjectedGeometry(int includeAlonePads)
double * projectChargeOnProjGeometry(int includeAlonePads)
const PadIdx_t * getMapCathPadToPad(int c)
Definition ClusterPEM.h:91
int getNbrOfPadsInGroup(int g)
int findLocalMaxWithPEM2Lev(double *thetaL, int nbrOfPadsInTheGroupCath)
const Groups_t * getCathGroup(int c)
Definition ClusterPEM.h:78
std::pair< double, double > computeChargeBarycenter(int plane)
Groups_t * getProjPadGroup()
Definition ClusterPEM.h:79
int findLocalMaxWithPEM(double *thetaL, int nbrOfPadsInTheGroupCath)
int getNbrOfObsPads(int c)
Definition ClusterPEM.h:53
double getTotalCharge(int c)
Definition ClusterPEM.h:65
const Pads * getPads(int c)
Definition ClusterPEM.h:77
static int getNbrOfPads(const Pads *pads)
Definition PadsPEM.h:63
const double * getCharges() const
Definition PadsPEM.h:99
int getNbrOfObsPads() const
Definition PadsPEM.h:90
double getTotalCharge() const
Definition PadsPEM.h:102
GLboolean GLboolean g
Definition glcorearb.h:1233
GLint GLenum GLint x
Definition glcorearb.h:403
GLint y
Definition glcorearb.h:270
std::pair< int, double * > DataBlock_t
Definition ClusterPEM.h:30
short Groups_t
short Mask_t
gsl_matrix * moore_penrose_pinv(gsl_matrix *A, double rcond)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...