Project
Loading...
Searching...
No Matches
Cluster.cxx
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
16#include <fairlogger/Logger.h>
17
18#include <TMath.h>
19#include <TString.h>
20
21#include <cstdlib>
22
23using namespace o2::itsmft;
24
26
27#ifdef _ClusterTopology_
28 //______________________________________________________________________________
29 void Cluster::resetPattern()
30{
31 // reset pixels pattern
32 memset(mPattern, 0, kMaxPatternBytes * sizeof(UChar_t));
33}
34
35//______________________________________________________________________________
36Bool_t Cluster::testPixel(UShort_t row, UShort_t col) const
37{
38 // test if pixel at relative row,col is fired
39 int nbits = row * getPatternColSpan() + col;
40 if (nbits >= kMaxPatternBits)
41 return kFALSE;
42 int bytn = nbits >> 3; // 1/8
43 int bitn = 7 - (nbits % 8);
44 return (mPattern[bytn] & (0x1 << bitn)) != 0;
45 //
46}
47
48#endif
49/*
50//______________________________________________________________________________
51Bool_t Cluster::hasCommonTrack(const Cluster* cl) const
52{
53 // check if clusters have common tracks
54 for (int i = 0; i < maxLabels; i++) {
55 Label lbi = getLabel(i);
56 if ( lbi.isEmpty() ) break;
57 if ( !lbi.isPosTrackID() ) continue;
58
59 for (int j = 0; j < maxLabels; j++) {
60 Label lbj = cl->getLabel(j);
61 if ( lbj.isEmpty() ) break;
62 if ( !lbj.isPosTrackID() ) continue;
63 if (lbi == lbj) return kTRUE;
64 }
65 }
66 return kFALSE;
67}
68*/
69//______________________________________________________________________________
70void Cluster::print() const
71{
72 // print itself
73 printf("Sensor %5d, nRow:%3d nCol:%3d n:%d |Err^2:%.3e %.3e %+.3e |", getSensorID(), getNx(), getNz(), getNPix(),
75 printf("XYZ: %+.4e %+.4e %+.4e\n", getX(), getY(), getZ());
76//
77#ifdef _ClusterTopology_
78 int nr = getPatternRowSpan();
79 int nc = getPatternColSpan();
80 printf("Pattern: %d rows from %d", nr, mPatternRowMin);
81 if (isPatternRowsTruncated())
82 printf("(truncated)");
83 printf(", %d cols from %d", nc, mPatternColMin);
84 if (isPatternColsTruncated())
85 printf("(truncated)");
86 printf("\n");
87 for (int ir = 0; ir < nr; ir++) {
88 for (int ic = 0; ic < nc; ic++)
89 printf("%c", testPixel(ir, ic) ? '+' : '-');
90 printf("\n");
91 }
92#endif
93}
94
95#ifdef _ClusterTopology_
96//______________________________________________________________________________
97void Cluster::getDiffPattern(std::vector<std::pair<short, short>>& diffv, short colRef, short rowRef) const
98{
99 // fill vector with incremental differences starting from colRed / rowRef
100 int nr = getPatternRowSpan();
101 int nc = getPatternColSpan();
102 diffv.clear();
103 for (short ir = 0; ir < nr; ir++) {
104 for (short ic0 = 0; ic0 < nc; ic0++) {
105 short ic = (ir & 0x1) ? nc - ic0 - 1 : ic0; // left-to-right for even rows, right-to-left for odd columns
106 if (testPixel(ir, ic)) {
107 short row = ir + mPatternRowMin, col = ic + mPatternColMin;
108 short drow = row - rowRef, dcol = col - colRef;
109 if (!dcol && !drow) {
110 continue;
111 }
112 diffv.emplace_back(dcol, drow);
113 colRef = col;
114 rowRef = row;
115 }
116 }
117 }
118 // flag end of the pattern
119 diffv.emplace_back(0, 0);
120}
121#endif
Definition of the ITSMFT cluster.
ClassImp(o2::itsmft::Cluster)
uint32_t col
Definition RawData.h:4
float getSigmaYZ() const
Definition BaseCluster.h:67
float getSigmaZ2() const
Definition BaseCluster.h:66
float getSigmaY2() const
Definition BaseCluster.h:65
std::int16_t getSensorID() const
Definition BaseCluster.h:81
void print(Option_t *opt="") const
Definition Cluster.cxx:197
Cluster class for the ITSMFT.
Definition Cluster.h:34
int getNz() const
Definition Cluster.h:88
int getNx() const
Definition Cluster.h:87
int getNPix() const
Definition Cluster.h:89
o2::InteractionRecord ir(0, 0)
std::vector< int > row