22#if (defined(WITH_OPENMP) || defined(_OPENMP)) && !defined(__CLING__)
28 TFile fOut(outFileName,
"RECREATE");
29 fOut.WriteObject(
this, outName);
38 if (integrationIntervals <= 0) {
39 integrationIntervals = getNIntegrationIntervals();
42 const auto SACDeltaMedium = getSACDeltaMediumCompressed();
43 const auto SACDeltaHigh = getSACDeltaHighCompressed();
44 for (
unsigned int integrationInterval = 0; integrationInterval < integrationIntervals; ++integrationInterval) {
45 std::vector<int32_t> vSACs(GEMSTACKS);
46 std::vector<float> vSACsZero(GEMSTACKS);
47 std::vector<float> vSACsDelta(GEMSTACKS);
48 std::vector<float> vSACsDeltaMedium(GEMSTACKS);
49 std::vector<float> vSACsDeltaHigh(GEMSTACKS);
50 std::vector<unsigned int> vStack(GEMSTACKS);
51 std::vector<int> vSACZeroCut(GEMSTACKS);
53 unsigned int index = 0;
55 vSACs[
index] = getSACValue(
stack, integrationInterval);
57 vSACsDelta[
index] = getSACDeltaVal(
stack, integrationInterval);
58 vSACsDeltaMedium[
index] = SACDeltaMedium.getValue(getSide(
stack), getSACDeltaIndex(
stack, integrationInterval));
59 vSACsDeltaHigh[
index] = SACDeltaHigh.getValue(getSide(
stack), getSACDeltaIndex(
stack, integrationInterval));
63 float sacOneA = getSACOneVal(
Side::A, integrationInterval);
64 float sacOneC = getSACOneVal(
Side::C, integrationInterval);
67 <<
"integrationInterval=" << integrationInterval
69 <<
"SAC0.=" << vSACsZero
70 <<
"SAC1A=" << sacOneA
71 <<
"SAC1C=" << sacOneC
72 <<
"SACDeltaNoComp.=" << vSACsDelta
73 <<
"SACDeltaMediumComp.=" << vSACsDeltaMedium
74 <<
"SACDeltaHighComp.=" << vSACsDeltaHigh
75 <<
"stack.=" << vStack
76 <<
"SACZeroOutlier.=" << vSACZeroCut
84 const unsigned int nSACsSide = GEMSTACKSPERSIDE;
86 mSACZero.resize(nSACsSide);
88#pragma omp parallel for num_threads(sNThreads)
92 mSACZero.setValueSACZero(sacZero,
side,
stack % GEMSTACKSPERSIDE);
98 const unsigned int integrationIntervals = getNIntegrationIntervals();
100 mSACOne.resize(integrationIntervals);
102#pragma omp parallel for num_threads(sNThreads)
103 for (
int iSide = 0; iSide < SIDES; ++iSide) {
105 const int firstStack = (iSide == 0) ? 0 : GEMSTACKSPERSIDE;
106 const int lastStack = (iSide == 0) ? GEMSTACKSPERSIDE : GEMSTACKS;
107 const auto normFac = GEMSTACKSPERSIDE - std::accumulate(mOutlierMap.begin() + firstStack, mOutlierMap.begin() + lastStack, 0);
109 for (
unsigned int interval = 0; interval < integrationIntervals; ++interval) {
112 for (
unsigned int stackLocal = 0; stackLocal < GEMSTACKSPERSIDE; ++stackLocal) {
113 const int stack = stackLocal + iSide * GEMSTACKSPERSIDE;
114 const float sacZero = mSACZero.getValueIDCZero(
side, stackLocal);
115 const float sacValue = mSACs[
stack][interval];
116 if (mOutlierMap[
stack] == 0) {
117 sacOne += (sacZero == 0) ? sacZero : sacValue / sacZero;
121 mSACOne.setValueIDCOne(sacOne / normFac,
side, interval);
128 const unsigned int integrationIntervals = getNIntegrationIntervals();
129 const unsigned int nSACs = integrationIntervals * GEMSTACKSPERSIDE;
130 mSACDelta.resize(nSACs);
132#pragma omp parallel for num_threads(sNThreads)
135 for (
unsigned int interval = 0; interval < integrationIntervals; ++interval) {
138 const auto sacVal = mSACs[
stack][interval];
140 const auto val = (mult != 0 && (mOutlierMap[
stack] == 0)) ? sacVal / mult - 1 : 0;
141 mSACDelta.setSACDelta(
side, getSACDeltaIndex(
stack, interval),
val);
148 LOGP(info,
"Using {} threads for factorization of SACs", sNThreads);
149 LOGP(info,
"Calculating SAC0");
151 LOGP(info,
"Creating pad status map");
153 LOGP(info,
"Calculating SAC1");
155 LOGP(info,
"Calculating SACDelta");
161 for (
auto&
val : mSACs) {
166void o2::tpc::SACFactorization::drawSACDeltaHelper(
const bool type,
const Sector sector,
const unsigned int integrationInterval,
const SACDeltaCompression compression,
const std::string
filename,
const float minZ,
const float maxZ)
const
168 std::function<
float(
const unsigned int,
const unsigned int)> SACFunc;
173 switch (compression) {
174 case SACDeltaCompression::NO:
176 SACFunc = [
this, integrationInterval](
const unsigned int sector,
const unsigned int stack) {
177 return this->getSACDeltaVal(getStack(
sector,
stack), integrationInterval);
180 type ?
SACDrawHelper::drawSide(drawFun,
sector.side(), zAxisTitle,
filename,
minZ,
maxZ) : SACDrawHelper::drawSector(drawFun,
sector, zAxisTitle,
filename,
minZ,
maxZ);
183 case SACDeltaCompression::MEDIUM: {
184 const auto SACDeltaMedium = this->getSACDeltaMediumCompressed();
185 SACFunc = [
this, &SACDeltaMedium, integrationInterval = integrationInterval](
const unsigned int sector,
const unsigned int stack) {
186 return SACDeltaMedium.getValue(Sector(
sector).side(), getSACDeltaIndex(getStack(
sector,
stack), integrationInterval));
189 type ?
SACDrawHelper::drawSide(drawFun,
sector.side(), zAxisTitle,
filename,
minZ,
maxZ) : SACDrawHelper::drawSector(drawFun,
sector, zAxisTitle,
filename,
minZ,
maxZ);
192 case SACDeltaCompression::HIGH: {
193 const auto SACDeltaHigh = this->getSACDeltaHighCompressed();
194 SACFunc = [
this, &SACDeltaHigh, integrationInterval](
const unsigned int sector,
const unsigned int stack) {
195 return SACDeltaHigh.getValue(Sector(
sector).side(), getSACDeltaIndex(getStack(
sector,
stack), integrationInterval));
198 type ?
SACDrawHelper::drawSide(drawFun,
sector.side(), zAxisTitle,
filename,
minZ,
maxZ) : SACDrawHelper::drawSector(drawFun,
sector, zAxisTitle,
filename,
minZ,
maxZ);
204void o2::tpc::SACFactorization::drawSACZeroHelper(
const bool type,
const Sector
sector,
const std::string
filename,
const float minZ,
const float maxZ)
const
206 std::function<
float(
const unsigned int,
const unsigned int)> SACFunc = [
this](
const unsigned int sector,
const unsigned int stack) {
207 return this->getSACZeroVal(getStack(
sector,
stack));
210 SACDrawHelper::SACDraw drawFun;
213 type ?
SACDrawHelper::drawSide(drawFun,
sector.side(), zAxisTitle,
filename,
minZ,
maxZ) : SACDrawHelper::drawSector(drawFun,
sector, zAxisTitle,
filename,
minZ,
maxZ);
216void o2::tpc::SACFactorization::drawSACZeroOutlierHelper(
const bool type,
const Sector
sector,
const std::string
filename,
const float minZ,
const float maxZ)
const
218 std::function<
float(
const unsigned int,
const unsigned int)> SACFunc = [
this](
const unsigned int sector,
const unsigned int stack) {
222 SACDrawHelper::SACDraw drawFun;
223 drawFun.mSACFunc = SACFunc;
225 type ?
SACDrawHelper::drawSide(drawFun,
sector.side(), zAxisTitle,
filename,
minZ,
maxZ) : SACDrawHelper::drawSector(drawFun,
sector, zAxisTitle,
filename,
minZ,
maxZ);
228void o2::tpc::SACFactorization::drawSACHelper(
const bool type,
const Sector
sector,
const unsigned int integrationInterval,
const std::string
filename,
const float minZ,
const float maxZ)
const
230 std::function<
float(
const unsigned int,
const unsigned int)> SACFunc = [
this, integrationInterval](
const unsigned int sector,
const unsigned int stack) {
231 return this->getSACValue(getStack(
sector,
stack), integrationInterval);
234 SACDrawHelper::SACDraw drawFun;
235 drawFun.mSACFunc = SACFunc;
238 type ?
SACDrawHelper::drawSide(drawFun,
sector.side(), zAxisTitle,
filename,
minZ,
maxZ) : SACDrawHelper::drawSector(drawFun,
sector, zAxisTitle,
filename,
minZ,
maxZ);
244#pragma omp parallel for num_threads(sNThreads)
245 for (
unsigned int stackInSector = 0; stackInSector < GEMSTACKSPERSECTOR; ++stackInSector) {
247 for (
int iSide = 0; iSide < SIDES; ++iSide) {
249 for (
int iter = 0; iter < 2; ++iter) {
250 const float median = (iter == 1) ?
average.getMedian() : 0;
251 const float stdDev = (iter == 1) ?
average.getStdDev() : 0;
253 const int stackLocal =
sector * GEMSTACKSPERSECTOR + stackInSector;
254 const float sacZero = mSACZero.getValueIDCZero(
side, stackLocal);
259 const int stack = stackLocal + iSide * GEMSTACKSPERSIDE;
260 if ((sacZero > median + stdDev * paramSAC.maxSAC0Median) || (sacZero < median - stdDev * paramSAC.minSAC0Median)) {
261 mOutlierMap[
stack] = 1;
263 mOutlierMap[
stack] = 0;
configStandalone Light OpenGL display display_light Apply smoothing to points Enable Z buffer Highlight links Highlight seeds Highlight sector tracks Highlight final tracks Show individual sector
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from average
configStandalone Reconstruction rec_tpc float
class for performing robust averaging and outlier filtering
helper class for drawing SACs per sector/side
TPC factorization of SACs.
Definition of the parameters for the SAC processing.
static const ParameterSAC & Instance()
static std::string getZAxisTitle(const SACType type)
static void drawSide(const SACDraw &SAC, const o2::tpc::Side side, const std::string zAxisTitle, const std::string filename, const float minZ=0, const float maxZ=-1)
void reset()
resetting aggregated SACs
void dumpToTree(int intervals=-1, const char *outFileName="SACTree.root") const
void calcSACDelta()
calculate \Delta I(r,\phi,t) = I(r,\phi,t) / ( I_0(r,\phi) * I_1(t) )
void createStatusMap()
create outlier map using the SAC0
void calcSACOne()
calculate I_1(t) = <I(r,\phi,t) / I_0(r,\phi)>_{r,\phi}
void calcSACZero()
calculate I_0(r,\phi) = <I(r,\phi,t)>_t
void dumpToFile(const char *outFileName="SACFactorized.root", const char *outName="SACFactorized") const
GLint GLint GLsizei GLint GLenum GLenum type
GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat maxZ
@ IDC
integrated and grouped IDCs
@ IDCZero
IDC0: I_0(r,\phi) = <I(r,\phi,t)>_t.
@ IDCDelta
IDCDelta: \Delta I(r,\phi,t) = I(r,\phi,t) / ( I_0(r,\phi) * I_1(t) )
Enum< T >::Iterator begin(Enum< T >)
std::function< float(const unsigned int, const unsigned int)> mSACFunc
function returning the value which will be drawn for sector, stack
float getValue(const Side side, const int interval) const