Skip to content

Commit 750baee

Browse files
author
Christian Holm Christensen
authored
Merge branch 'AliceO2Group:dev' into cholmcc_aod_to_hepmc
2 parents 53586ca + 7774a9e commit 750baee

47 files changed

Lines changed: 611 additions & 390 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Common/MathUtils/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ o2_add_library(
1616
src/Chebyshev3D.cxx
1717
src/Chebyshev3DCalc.cxx
1818
src/SymMatrixSolver.cxx
19+
src/Tsallis.cxx
1920
PUBLIC_LINK_LIBRARIES
2021
ROOT::Hist
2122
FairLogger::FairLogger
@@ -37,7 +38,8 @@ o2_target_root_dictionary(
3738
include/MathUtils/RandomRing.h
3839
include/MathUtils/Primitive2D.h
3940
include/MathUtils/SMatrixGPU.h
40-
include/MathUtils/SymMatrixSolver.h)
41+
include/MathUtils/SymMatrixSolver.h
42+
include/MathUtils/Tsallis.h)
4143

4244
o2_add_test(
4345
CachingTF1
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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+
12+
#ifndef ALICEO2_TSALLIS_H
13+
#define ALICEO2_TSALLIS_H
14+
15+
namespace o2
16+
{
17+
18+
namespace math_utils
19+
{
20+
21+
struct Tsallis {
22+
/// Tsallis/Hagedorn function describing charged pt spectra (m s = 62.4 GeV to 13 TeV) as in https://iopscience.iop.org/article/10.1088/2399-6528/aab00f/pdf
23+
/// https://github.com/alisw/AliPhysics/blob/523f2dc8b45d913e9b7fda9b27e746819cbe5b09/PWGPP/AliAnalysisTaskFilteredTree.h#L145
24+
/// \param pt - transverse momentum
25+
/// \param mass - mass of particle
26+
/// \param sqrts - centre of mass energy
27+
/// \return - invariant yields of the charged particle *pt
28+
/// n(sqrts)= a + b/sqrt(s) - formula 6
29+
/// T(sqrts)= c + d/sqrt(s) - formula 7
30+
/// a = 6.81 ± 0.06 and b = 59.24 ± 3.53 GeV - for charged particles page 3
31+
/// c = 0.082 ± 0.002 GeV and d = 0.151 ± 0.048 (GeV) - for charged particles page 4
32+
static float tsallisCharged(float pt, float mass, float sqrts);
33+
34+
/// Random downsampling trigger function using Tsallis/Hagedorn spectra fit (sqrt(s) = 62.4 GeV to 13 TeV) as in https://iopscience.iop.org/article/10.1088/2399-6528/aab00f/pdf
35+
/// \return flat q/pt trigger
36+
/// \param pt pat of particle
37+
/// \param factorPt defines the sampling
38+
/// \param sqrts centre of mass energy
39+
/// \param weight weight which is internally calculated
40+
/// \param rnd random value between (0->1) used to check for sampling
41+
/// \param mass particles mass (use pion if not known)
42+
static bool downsampleTsallisCharged(float pt, float factorPt, float sqrts, float& weight, float rnd, float mass = 0.13957);
43+
};
44+
45+
} // namespace math_utils
46+
} // namespace o2
47+
48+
#endif

Common/MathUtils/src/MathUtilsLinkDef.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,6 @@
4141
#pragma link C++ class o2::math_utils::IntervalXYd_t + ;
4242
#pragma link C++ class o2::math_utils::Bracketf_t + ;
4343
#pragma link C++ class o2::math_utils::Bracketd_t + ;
44+
#pragma link C++ class o2::math_utils::Tsallis + ;
4445

4546
#endif

Common/MathUtils/src/Tsallis.cxx

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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+
12+
#include "MathUtils/Tsallis.h"
13+
#include <cmath>
14+
15+
namespace o2::math_utils
16+
{
17+
18+
float Tsallis::tsallisCharged(float pt, float mass, float sqrts)
19+
{
20+
const float a = 6.81;
21+
const float b = 59.24;
22+
const float c = 0.082;
23+
const float d = 0.151;
24+
const float mt = std::sqrt(mass * mass + pt * pt);
25+
const float n = a + b / sqrts;
26+
const float T = c + d / sqrts;
27+
const float p0 = n * T;
28+
return std::pow((1. + mt / p0), -n) * pt;
29+
}
30+
31+
bool Tsallis::downsampleTsallisCharged(float pt, float factorPt, float sqrts, float& weight, float rnd, float mass)
32+
{
33+
const float prob = tsallisCharged(pt, mass, sqrts);
34+
const float probNorm = tsallisCharged(1., mass, sqrts);
35+
weight = prob / probNorm;
36+
return (rnd * (weight * pt * pt)) < factorPt;
37+
}
38+
39+
} // namespace o2::math_utils

Common/Utils/include/CommonUtils/DebugStreamer.h

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ enum SamplingTypes {
5050
sampleID = 2, ///< sample every n IDs (per example track)
5151
sampleIDGlobal = 3, ///< in case different streamers have access to the same IDs use this gloabl ID
5252
sampleWeights = 4, ///< perform sampling on weights, defined where the streamer is called
53-
sampleTsalis = 5, ///< perform sampling on tsalis pdf
53+
sampleTsallis = 5, ///< perform sampling on tsallis pdf
5454
};
5555

5656
#if !defined(GPUCA_GPUCODE) && !defined(GPUCA_STANDALONE)
@@ -164,34 +164,12 @@ class DebugStreamer
164164
/// \return returns integer index for given streamer flag
165165
static int getIndex(const StreamFlags streamFlag);
166166

167-
/// Random downsampling trigger function using Tsalis/Hagedorn spectra fit (sqrt(s) = 62.4 GeV to 13 TeV) as in https://iopscience.iop.org/article/10.1088/2399-6528/aab00f/pdf
168-
/// \return flat q/pt trigger
169-
/// \param pt pat of particle
170-
/// \param factorPt defines the sampling
171-
/// \param sqrts centre of mass energy
172-
/// \param weight weight which is internally calculated
173-
/// \param rnd random value between (0->1) used to check for sampling
174-
/// \param mass particles mass (use pion if not known)
175-
static bool downsampleTsalisCharged(float pt, float factorPt, float sqrts, float& weight, float rnd, float mass = 0.13957);
176-
177167
/// get random value between min and max
178168
static float getRandom(float min = 0, float max = 1);
179169

180170
private:
181171
using StreamersPerFlag = tbb::concurrent_unordered_map<size_t, std::unique_ptr<o2::utils::TreeStreamRedirector>>;
182172
StreamersPerFlag mTreeStreamer; ///< streamer which is used for the debugging
183-
184-
/// Tsalis/Hagedorn function describing charged pt spectra (m s = 62.4 GeV to 13 TeV) as in https://iopscience.iop.org/article/10.1088/2399-6528/aab00f/pdf
185-
/// https://github.com/alisw/AliPhysics/blob/523f2dc8b45d913e9b7fda9b27e746819cbe5b09/PWGPP/AliAnalysisTaskFilteredTree.h#L145
186-
/// \param pt - transverse momentum
187-
/// \param mass - mass of particle
188-
/// \param sqrts - centre of mass energy
189-
/// \return - invariant yields of the charged particle *pt
190-
/// n(sqrts)= a + b/sqrt(s) - formula 6
191-
/// T(sqrts)= c + d/sqrt(s) - formula 7
192-
/// a = 6.81 ± 0.06 and b = 59.24 ± 3.53 GeV - for charged particles page 3
193-
/// c = 0.082 ± 0.002 GeV and d = 0.151 ± 0.048 (GeV) - for charged particles page 4
194-
static float tsalisCharged(float pt, float mass, float sqrts);
195173
#else
196174

197175
// empty implementation of the class for GPU or when the debug streamer is not build for CPU

Common/Utils/src/DebugStreamer.cxx

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -107,29 +107,6 @@ bool o2::utils::DebugStreamer::checkStream(const StreamFlags streamFlag, const s
107107
return true;
108108
}
109109

110-
float o2::utils::DebugStreamer::tsalisCharged(float pt, float mass, float sqrts)
111-
{
112-
const float a = 6.81;
113-
const float b = 59.24;
114-
const float c = 0.082;
115-
const float d = 0.151;
116-
const float mt = std::sqrt(mass * mass + pt * pt);
117-
const float n = a + b / sqrts;
118-
const float T = c + d / sqrts;
119-
const float p0 = n * T;
120-
const float result = std::pow((1. + mt / p0), -n) * pt;
121-
return result;
122-
}
123-
124-
bool o2::utils::DebugStreamer::downsampleTsalisCharged(float pt, float factorPt, float sqrts, float& weight, float rnd, float mass)
125-
{
126-
const float prob = tsalisCharged(pt, mass, sqrts);
127-
const float probNorm = tsalisCharged(1., mass, sqrts);
128-
weight = prob / probNorm;
129-
const bool isSampled = (rnd * (weight * pt * pt)) < factorPt;
130-
return isSampled;
131-
}
132-
133110
float o2::utils::DebugStreamer::getRandom(float min, float max)
134111
{
135112
// init random number generator for each thread

DataFormats/common/include/CommonDataFormat/InteractionRecord.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ struct InteractionRecord {
109109

110110
float differenceInBCMUS(const InteractionRecord& other) const
111111
{
112-
// return difference in bunch-crossings in ms
112+
// return difference in bunch-crossings in us
113113
return differenceInBC(other) * o2::constants::lhc::LHCBunchSpacingMUS;
114114
}
115115

Detectors/AOD/src/AODProducerWorkflowSpec.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ void AODProducerWorkflowDPL::addToTracksExtraTable(TracksExtraCursorType& tracks
319319
// extra
320320
tracksExtraCursor(truncateFloatFraction(extraInfoHolder.tpcInnerParam, mTrack1Pt),
321321
extraInfoHolder.flags,
322-
extraInfoHolder.itsClusterMap,
322+
extraInfoHolder.itsClusterSizes,
323323
extraInfoHolder.tpcNClsFindable,
324324
extraInfoHolder.tpcNClsFindableMinusFound,
325325
extraInfoHolder.tpcNClsFindableMinusCrossedRows,
@@ -2370,14 +2370,14 @@ AODProducerWorkflowDPL::TrackExtraInfo AODProducerWorkflowDPL::processBarrelTrac
23702370
int nClusters = itsTrack.getNClusters();
23712371
float chi2 = itsTrack.getChi2();
23722372
extraInfoHolder.itsChi2NCl = nClusters != 0 ? chi2 / (float)nClusters : 0;
2373-
extraInfoHolder.itsClusterMap = itsTrack.getPattern();
2373+
extraInfoHolder.itsClusterSizes = itsTrack.getClusterSizes();
23742374
if (src == GIndex::ITS) { // standalone ITS track should set its time from the ROF
23752375
const auto& rof = data.getITSTracksROFRecords()[mITSROFs[trackIndex.getIndex()]];
23762376
double t = rof.getBCData().differenceInBC(mStartIR) * o2::constants::lhc::LHCBunchSpacingNS + mITSROFrameHalfLengthNS;
23772377
setTrackTime(t, mITSROFrameHalfLengthNS, false);
23782378
}
23792379
} else if (contributorsGID[GIndex::Source::ITSAB].isIndexSet()) { // this is an ITS-TPC afterburner contributor
2380-
extraInfoHolder.itsClusterMap = data.getITSABRefs()[contributorsGID[GIndex::Source::ITSAB].getIndex()].pattern;
2380+
extraInfoHolder.itsClusterSizes = data.getITSABRefs()[contributorsGID[GIndex::Source::ITSAB].getIndex()].getClusterSizes();
23812381
}
23822382
if (contributorsGID[GIndex::Source::TPC].isIndexSet()) {
23832383
const auto& tpcOrig = data.getTPCTrack(contributorsGID[GIndex::TPC]);

Detectors/CTP/reconstruction/src/RawDataDecoder.cxx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -384,19 +384,28 @@ int RawDataDecoder::shiftInputs(std::map<o2::InteractionRecord, CTPDigit>& digit
384384
} else if (lut == 2) { // L0
385385
shiftNew(dig.first, TFOrbit, inpmask, L0shift, 0, digitsMapShifted);
386386
if (dig.second.CTPClassMask.count()) {
387-
LOG(error) << "Adding class mask without input ?";
387+
// LOG(error) << "Adding class mask without input ?";
388+
// This is not needed as it can happen; Full checj done below - see next LOG(error)
388389
CTPDigit digi = {dig.first, 0, dig.second.CTPClassMask};
389390
digitsMapShifted[dig.first] = digi;
390391
}
391392
} else if (lut == 4) { // L1
392393
shiftNew(dig.first, TFOrbit, inpmask, L1shift, 1, digitsMapShifted);
394+
if (dig.second.CTPClassMask.count()) {
395+
CTPDigit digi = {dig.first, 0, dig.second.CTPClassMask};
396+
digitsMapShifted[dig.first] = digi;
397+
}
393398
} else if (lut == 6) { // L0 and L1
394399
shiftNew(dig.first, TFOrbit, inpmask, L0shift, 0, digitsMapShifted);
395400
shiftNew(dig.first, TFOrbit, inpmask, L1shift, 1, digitsMapShifted);
401+
if (dig.second.CTPClassMask.count()) {
402+
CTPDigit digi = {dig.first, 0, dig.second.CTPClassMask};
403+
digitsMapShifted[dig.first] = digi;
404+
}
396405
} else if (lut == 3) { // LM and L0
397406
shiftNew(dig.first, TFOrbit, inpmask, L0shift, 0, digitsMapShifted);
398407
CTPDigit digi = {dig.first, inpmask & (~L0MASKInputs), dig.second.CTPClassMask};
399-
// LOG(info) << "LM-L0 present";
408+
// if LM level do not need to add class as LM is not shifted;
400409
digitsMapShifted[dig.first] = digi;
401410
} else if (lut == 5) { // LM and L1
402411
shiftNew(dig.first, TFOrbit, inpmask, L1shift, 1, digitsMapShifted);
@@ -432,7 +441,7 @@ int RawDataDecoder::shiftInputs(std::map<o2::InteractionRecord, CTPDigit>& digit
432441
digits.push_back(dig.second);
433442
}
434443
if (nTwoI) { // Trigger class wo Input
435-
LOG(error) << "LM:" << nLM << " L0:" << nL0 << " L1:" << nL1 << " TwI:" << nTwI << " Trigger cals wo inputTwoI:" << nTwoI;
444+
LOG(error) << "LM:" << nLM << " L0:" << nL0 << " L1:" << nL1 << " TwI:" << nTwI << " Trigger classes wo input:" << nTwoI;
436445
}
437446
return 0;
438447
}

Detectors/Calibration/include/DetectorsCalibration/TimeSlotCalibration.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,16 @@ bool TimeSlotCalibration<Container>::saveLastSlot()
489489
if (!updateSaveMetaData()) {
490490
return false;
491491
}
492+
493+
if (!mSaveDirectory.empty() && !std::filesystem::exists(mSaveDirectory)) {
494+
std::filesystem::create_directories(mSaveDirectory);
495+
if (!std::filesystem::exists(mSaveDirectory)) {
496+
LOGP(fatal, "could not create output directory {}", mSaveDirectory);
497+
} else {
498+
LOGP(info, "created calibration directory {}", mSaveDirectory);
499+
}
500+
}
501+
492502
auto pth = getSaveFilePath();
493503
auto pthTmp = pth + ".part";
494504
TFile flout(pthTmp.c_str(), "recreate");

0 commit comments

Comments
 (0)