Skip to content

Commit 10ff1e0

Browse files
authored
Merge f649801 into sapling-pr-archive-ktf
2 parents ab118f1 + f649801 commit 10ff1e0

File tree

42 files changed

+1723
-419
lines changed

Some content is hidden

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

42 files changed

+1723
-419
lines changed

Common/SimConfig/src/SimConfig.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,8 +487,8 @@ void SimConfig::adjustFromCollContext(std::string const& collcontextfile, std::s
487487
// we take what is specified in the context
488488
mConfigData.mNEvents = collisionmap.size();
489489
} else {
490-
LOG(warning) << "The number of events on the command line " << mConfigData.mNEvents << " and in the collision context differ. Taking the min of the 2";
491-
mConfigData.mNEvents = std::min((size_t)mConfigData.mNEvents, collisionmap.size());
490+
LOG(warning) << "The number of events on the command line " << mConfigData.mNEvents << " and in the collision context differ. We take the one from collision context " << collisionmap.size();
491+
mConfigData.mNEvents = collisionmap.size();
492492
}
493493
LOG(info) << "Setting number of events to simulate to " << mConfigData.mNEvents;
494494
}

DataFormats/Detectors/CTP/include/DataFormatsCTP/Scalers.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ class CTPRunScalers
128128
std::pair<double, double> getRate(uint32_t orbit, int classindex, int type) const;
129129

130130
/// same with absolute timestamp (not orbit) as argument
131-
std::pair<double, double> getRateGivenT(double timestamp, int classindex, int type) const;
131+
std::pair<double, double> getRateGivenT(double timestamp, int classindex, int type, bool qc = 0) const;
132132

133133
/// retrieves integral for class
134134
std::array<uint64_t, 7> getIntegralForClass(int i) const

DataFormats/Detectors/CTP/src/CTPRateFetcher.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,14 @@ double CTPRateFetcher::fetchCTPratesClassesNoPuCorr(uint64_t timeStamp, const st
8484
LOG(warn) << "Trigger class " << className << " not found in CTPConfiguration";
8585
return -2.;
8686
}
87-
auto rate{mScalers.getRateGivenT(timeStamp * 1.e-3, classIndex, inputType)};
87+
auto rate{mScalers.getRateGivenT(timeStamp * 1.e-3, classIndex, inputType, 1)};
8888
return rate.second;
8989
}
9090
double CTPRateFetcher::fetchCTPratesInputs(uint64_t timeStamp, int input)
9191
{
9292
std::vector<ctp::CTPScalerRecordO2>& recs = mScalers.getScalerRecordO2();
9393
if (recs[0].scalersInps.size() == 48) {
94-
return pileUpCorrection(mScalers.getRateGivenT(timeStamp * 1.e-3, input, 7).second);
94+
return pileUpCorrection(mScalers.getRateGivenT(timeStamp * 1.e-3, input, 7, 1).second);
9595
} else {
9696
LOG(error) << "Inputs not available";
9797
return -1.;
@@ -101,7 +101,7 @@ double CTPRateFetcher::fetchCTPratesInputsNoPuCorr(uint64_t timeStamp, int input
101101
{
102102
std::vector<ctp::CTPScalerRecordO2>& recs = mScalers.getScalerRecordO2();
103103
if (recs[0].scalersInps.size() == 48) {
104-
return mScalers.getRateGivenT(timeStamp * 1.e-3, input, 7).second;
104+
return mScalers.getRateGivenT(timeStamp * 1.e-3, input, 7, 1).second;
105105
} else {
106106
LOG(error) << "Inputs not available";
107107
return -1.;

DataFormats/Detectors/CTP/src/Scalers.cxx

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,7 @@ std::pair<double, double> CTPRunScalers::getRate(uint32_t orbit, int classindex,
723723
// rate in Hz at a certain orbit number within the run
724724
// type - 7 : inputs
725725
// type - 1..6 : lmb,lma,l0b,l0a,l1b,l1a
726-
std::pair<double, double> CTPRunScalers::getRateGivenT(double timestamp, int classindex, int type) const
726+
std::pair<double, double> CTPRunScalers::getRateGivenT(double timestamp, int classindex, int type, bool qc) const
727727
{
728728
if (mScalerRecordO2.size() <= 1) {
729729
LOG(error) << "not enough data";
@@ -775,12 +775,24 @@ std::pair<double, double> CTPRunScalers::getRateGivenT(double timestamp, int cla
775775
return -1; // wrong type
776776
}
777777
};
778-
if (nextindex == 0 || nextindex == mScalerRecordO2.size()) {
778+
if (nextindex == 0) {
779779
// orbit is out of bounds
780-
LOG(info) << "query timestamp " << (long)timestamp << " out of bounds; Just returning the global rate";
781-
return std::make_pair(/*global mean rate*/ calcRate(0, mScalerRecordO2.size() - 1), /* current rate */ -1);
780+
if (qc == 0) {
781+
LOG(info) << "query timestamp " << (long)timestamp << " before first record; Just returning the global rate";
782+
return std::make_pair(/*global mean rate*/ calcRate(0, mScalerRecordO2.size() - 1), /* current rate */ -1);
783+
} else {
784+
LOG(info) << "query timestamp " << (long)timestamp << " before first record; Returning the first rate";
785+
return std::make_pair(/*global mean rate*/ calcRate(0, mScalerRecordO2.size() - 1), /* first rate */ calcRate(0, 1));
786+
}
787+
} else if (nextindex == mScalerRecordO2.size()) {
788+
if (qc == 0) {
789+
LOG(info) << "query timestamp " << (long)timestamp << " after last record; Just returning the global rate";
790+
return std::make_pair(/*global mean rate*/ calcRate(0, mScalerRecordO2.size() - 1), /* current rate */ -1);
791+
} else {
792+
LOG(info) << "query timestamp " << (long)timestamp << " after last record; Returning the last rate";
793+
return std::make_pair(/*global mean rate*/ calcRate(0, mScalerRecordO2.size() - 1), /* last rate */ calcRate(mScalerRecordO2.size() - 2, mScalerRecordO2.size() - 1));
794+
}
782795
} else {
783-
784796
return std::make_pair(/*global mean rate*/ calcRate(0, mScalerRecordO2.size() - 1), /* current rate */ calcRate(nextindex - 1, nextindex));
785797
}
786798
return std::make_pair(-1., -1.);

DataFormats/Detectors/FIT/common/include/DataFormatsFIT/DCSDPValues.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,23 @@
1414

1515
#include <Rtypes.h>
1616
#include "Framework/Logger.h"
17+
#include "Framework/O2LongInt.h"
1718

1819
namespace o2
1920
{
2021
namespace fit
2122
{
2223
struct DCSDPValues {
23-
std::vector<std::pair<uint64_t, int64_t>> values;
24+
std::vector<std::pair<O2LongUInt, O2LongInt>> values;
2425

2526
DCSDPValues()
2627
{
27-
values = std::vector<std::pair<uint64_t, int64_t>>();
28+
values = std::vector<std::pair<O2LongUInt, O2LongInt>>();
2829
}
2930

3031
void add(uint64_t timestamp, int64_t value)
3132
{
32-
values.push_back(std::pair<uint64_t, int64_t>(timestamp, value));
33+
values.push_back(std::pair<O2LongUInt, O2LongInt>(timestamp, value));
3334
}
3435

3536
bool empty()
@@ -63,4 +64,4 @@ struct DCSDPValues {
6364
} // namespace fit
6465
} // namespace o2
6566

66-
#endif
67+
#endif

Detectors/GRP/calibration/include/GRPCalibration/GRPDCSDPsProcessor.h

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <unordered_map>
1717
#include <deque>
1818
#include "Framework/Logger.h"
19+
#include "Framework/O2LongInt.h"
1920
#include "DetectorsDCS/DataPointCompositeObject.h"
2021
#include "DetectorsDCS/DataPointIdentifier.h"
2122
#include "DetectorsDCS/DataPointValue.h"
@@ -37,11 +38,11 @@ using DPID = o2::dcs::DataPointIdentifier;
3738
using DPVAL = o2::dcs::DataPointValue;
3839
using DPCOM = o2::dcs::DataPointCompositeObject;
3940

40-
inline unsigned long llu2lu(std::uint64_t v) { return (unsigned long)v; }
41+
inline O2LongUInt llu2lu(std::uint64_t v) { return (O2LongUInt)v; }
4142

4243
struct GRPEnvVariables {
4344

44-
std::unordered_map<std::string, std::vector<std::pair<uint64_t, double>>> mEnvVars;
45+
std::unordered_map<std::string, std::vector<std::pair<O2LongUInt, double>>> mEnvVars;
4546
size_t totalEntries() const
4647
{
4748
size_t s = 0;
@@ -60,7 +61,7 @@ struct GRPEnvVariables {
6061
}
6162
}
6263

63-
ClassDefNV(GRPEnvVariables, 1);
64+
ClassDefNV(GRPEnvVariables, 2);
6465
};
6566

6667
struct MagFieldHelper {
@@ -122,7 +123,7 @@ struct MagFieldHelper {
122123

123124
struct GRPCollimators {
124125

125-
std::unordered_map<std::string, std::vector<std::pair<uint64_t, double>>> mCollimators;
126+
std::unordered_map<std::string, std::vector<std::pair<O2LongUInt, double>>> mCollimators;
126127
size_t totalEntries() const
127128
{
128129
size_t s = 0;
@@ -141,7 +142,7 @@ struct GRPCollimators {
141142
}
142143
}
143144

144-
ClassDefNV(GRPCollimators, 1);
145+
ClassDefNV(GRPCollimators, 2);
145146
};
146147

147148
struct GRPLHCInfo {
@@ -191,19 +192,19 @@ struct GRPLHCInfo {
191192
static constexpr std::string_view lhcStringAliases[NLHCStringAliases] = {"ALI_Lumi_Source_Name", "BEAM_MODE", "MACHINE_MODE"};
192193
static constexpr int nAliasesLHC = (int)NCollimatorAliases + (int)NBeamAliases + (int)NBkgAliases + (int)NBPTXAliases + (int)NBPTXPhaseAliases + (int)NBPTXPhaseRMSAliases + (int)NBPTXPhaseShiftAliases + (int)NLumiAliases + (int)NLHCStringAliases;
193194

194-
std::array<std::vector<std::pair<uint64_t, double>>, 2> mIntensityBeam;
195-
std::array<std::vector<std::pair<uint64_t, double>>, 3> mBackground;
196-
std::vector<std::pair<uint64_t, double>> mInstLumi;
197-
std::vector<std::pair<uint64_t, double>> mBPTXdeltaT;
198-
std::vector<std::pair<uint64_t, double>> mBPTXdeltaTRMS;
199-
std::array<std::vector<std::pair<uint64_t, double>>, 2> mBPTXPhase;
200-
std::array<std::vector<std::pair<uint64_t, double>>, 2> mBPTXPhaseRMS;
201-
std::array<std::vector<std::pair<uint64_t, double>>, 2> mBPTXPhaseShift;
202-
std::pair<uint64_t, std::string> mLumiSource; // only one value per object: when there is a change, a new object is stored
203-
std::pair<uint64_t, std::string> mMachineMode; // only one value per object: when there is a change, a new object is stored
204-
std::pair<uint64_t, std::string> mBeamMode; // only one value per object: when there is a change, a new object is stored
205-
206-
void resetAndKeepLastVector(std::vector<std::pair<uint64_t, double>>& vect)
195+
std::array<std::vector<std::pair<O2LongUInt, double>>, 2> mIntensityBeam;
196+
std::array<std::vector<std::pair<O2LongUInt, double>>, 3> mBackground;
197+
std::vector<std::pair<O2LongUInt, double>> mInstLumi;
198+
std::vector<std::pair<O2LongUInt, double>> mBPTXdeltaT;
199+
std::vector<std::pair<O2LongUInt, double>> mBPTXdeltaTRMS;
200+
std::array<std::vector<std::pair<O2LongUInt, double>>, 2> mBPTXPhase;
201+
std::array<std::vector<std::pair<O2LongUInt, double>>, 2> mBPTXPhaseRMS;
202+
std::array<std::vector<std::pair<O2LongUInt, double>>, 2> mBPTXPhaseShift;
203+
std::pair<O2LongUInt, std::string> mLumiSource; // only one value per object: when there is a change, a new object is stored
204+
std::pair<O2LongUInt, std::string> mMachineMode; // only one value per object: when there is a change, a new object is stored
205+
std::pair<O2LongUInt, std::string> mBeamMode; // only one value per object: when there is a change, a new object is stored
206+
207+
void resetAndKeepLastVector(std::vector<std::pair<O2LongUInt, double>>& vect)
207208
{
208209
// always check that the size is > 0 (--> begin != end) for all vectors
209210
if (vect.begin() != vect.end()) {
@@ -291,16 +292,16 @@ class GRPDCSDPsProcessor
291292
void init(const std::vector<DPID>& pids);
292293
int process(const gsl::span<const DPCOM> dps);
293294
int processDP(const DPCOM& dpcom);
294-
uint64_t processFlags(uint64_t flag, const char* pid) { return 0; } // for now it is not really implemented
295+
O2LongUInt processFlags(O2LongUInt flag, const char* pid) { return 0; } // for now it is not really implemented
295296
bool processCollimators(const DPCOM& dpcom);
296297
bool processEnvVar(const DPCOM& dpcom);
297-
bool processPairD(const DPCOM& dpcom, const std::string& alias, std::unordered_map<std::string, std::vector<std::pair<uint64_t, double>>>& mapToUpdate);
298-
bool processPairS(const DPCOM& dpcom, const std::string& alias, std::pair<uint64_t, std::string>& p, bool& flag);
299-
bool compareToLatest(std::pair<uint64_t, double>& p, double val);
298+
bool processPairD(const DPCOM& dpcom, const std::string& alias, std::unordered_map<std::string, std::vector<std::pair<O2LongUInt, double>>>& mapToUpdate);
299+
bool processPairS(const DPCOM& dpcom, const std::string& alias, std::pair<O2LongUInt, std::string>& p, bool& flag);
300+
bool compareToLatest(std::pair<O2LongUInt, double>& p, double val);
300301
bool processLHCIFDPs(const DPCOM& dpcom);
301302

302303
void resetAndKeepLastLHCIFDPs() { mLHCInfo.resetAndKeepLast(); }
303-
void resetAndKeepLast(std::unordered_map<std::string, std::vector<std::pair<uint64_t, double>>>& mapToReset)
304+
void resetAndKeepLast(std::unordered_map<std::string, std::vector<std::pair<O2LongUInt, double>>>& mapToReset)
304305
{
305306
// keep only the latest measurement
306307
for (auto& el : mapToReset) {
@@ -366,8 +367,8 @@ class GRPDCSDPsProcessor
366367
void useVerboseMode() { mVerbose = true; }
367368
void clearVectors() { mClearVectors = true; }
368369

369-
void printVectorInfo(const std::vector<std::pair<uint64_t, double>>& vect, bool afterUpdate);
370-
void updateVector(const DPID& dpid, std::vector<std::pair<uint64_t, double>>& vect, std::string alias, uint64_t timestamp, double val);
370+
void printVectorInfo(const std::vector<std::pair<O2LongUInt, double>>& vect, bool afterUpdate);
371+
void updateVector(const DPID& dpid, std::vector<std::pair<O2LongUInt, double>>& vect, std::string alias, O2LongUInt timestamp, double val);
371372

372373
private:
373374
std::unordered_map<DPID, bool> mPids; // contains all PIDs for the processor, the bool

Detectors/GRP/calibration/src/GRPDCSDPsProcessor.cxx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ bool GRPDCSDPsProcessor::processEnvVar(const DPCOM& dpcom)
185185
}
186186

187187
//______________________________________________________________________
188-
bool GRPDCSDPsProcessor::processPairD(const DPCOM& dpcom, const std::string& alias, std::unordered_map<std::string, std::vector<std::pair<uint64_t, double>>>& mapToUpdate)
188+
bool GRPDCSDPsProcessor::processPairD(const DPCOM& dpcom, const std::string& alias, std::unordered_map<std::string, std::vector<std::pair<O2LongUInt, double>>>& mapToUpdate)
189189
{
190190

191191
// function to process Data Points that is stored in a pair
@@ -207,7 +207,7 @@ bool GRPDCSDPsProcessor::processPairD(const DPCOM& dpcom, const std::string& ali
207207
}
208208

209209
//______________________________________________________________________
210-
bool GRPDCSDPsProcessor::processPairS(const DPCOM& dpcom, const std::string& alias, std::pair<uint64_t, std::string>& p, bool& flag)
210+
bool GRPDCSDPsProcessor::processPairS(const DPCOM& dpcom, const std::string& alias, std::pair<O2LongUInt, std::string>& p, bool& flag)
211211
{
212212

213213
// function to process string Data Points that is stored in a pair
@@ -237,7 +237,7 @@ bool GRPDCSDPsProcessor::processPairS(const DPCOM& dpcom, const std::string& ali
237237

238238
//______________________________________________________________________
239239

240-
bool GRPDCSDPsProcessor::compareToLatest(std::pair<uint64_t, double>& p, double val)
240+
bool GRPDCSDPsProcessor::compareToLatest(std::pair<O2LongUInt, double>& p, double val)
241241
{
242242

243243
// check if the content of the pair should be updated
@@ -408,7 +408,7 @@ void GRPDCSDPsProcessor::updateCollimatorsCCDB()
408408

409409
//______________________________________________________________________
410410

411-
void GRPDCSDPsProcessor::printVectorInfo(const std::vector<std::pair<uint64_t, double>>& vect, bool afterUpdate)
411+
void GRPDCSDPsProcessor::printVectorInfo(const std::vector<std::pair<O2LongUInt, double>>& vect, bool afterUpdate)
412412
{
413413

414414
std::string stage = afterUpdate ? "after update" : "before update";
@@ -422,7 +422,7 @@ void GRPDCSDPsProcessor::printVectorInfo(const std::vector<std::pair<uint64_t, d
422422

423423
//______________________________________________________________________
424424

425-
void GRPDCSDPsProcessor::updateVector(const DPID& dpid, std::vector<std::pair<uint64_t, double>>& vect, std::string alias, uint64_t timestamp, double val)
425+
void GRPDCSDPsProcessor::updateVector(const DPID& dpid, std::vector<std::pair<O2LongUInt, double>>& vect, std::string alias, O2LongUInt timestamp, double val)
426426
{
427427
printVectorInfo(vect, 0);
428428
bool updateFlag = false;

Detectors/ITSMFT/ITS/tracking/GPU/ITStrackingGPU/TimeFrameGPU.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,10 @@ class TimeFrameGPU : public TimeFrame
7676
void createCellsBuffers(const int);
7777
void createCellsDevice();
7878
void createCellsLUTDevice();
79-
void createNeighboursDevice();
79+
void createNeighboursIndexTablesDevice();
8080
void createNeighboursDevice(const unsigned int& layer, std::vector<std::pair<int, int>>& neighbours);
8181
void createNeighboursLUTDevice(const int, const unsigned int);
82+
void createNeighboursDeviceArray();
8283
void createTrackITSExtDevice(std::vector<CellSeed>&);
8384
void downloadTrackITSExtDevice(std::vector<CellSeed>&);
8485
void downloadCellsNeighboursDevice(std::vector<std::vector<std::pair<int, int>>>&, const int);
@@ -113,7 +114,10 @@ class TimeFrameGPU : public TimeFrame
113114
Road<nLayers - 2>* getDeviceRoads() { return mRoadsDevice; }
114115
TrackITSExt* getDeviceTrackITSExt() { return mTrackITSExtDevice; }
115116
int* getDeviceNeighboursLUT(const int layer) { return mNeighboursLUTDevice[layer]; }
116-
gpuPair<int, int>* getDeviceNeighbours(const int layer) { return mNeighboursDevice[layer]; }
117+
gsl::span<int*> getDeviceNeighboursLUTs() { return mNeighboursLUTDevice; }
118+
gpuPair<int, int>* getDeviceNeighbourPairs(const int layer) { return mNeighbourPairsDevice[layer]; }
119+
int* getDeviceNeighbours(const int layer) { return mNeighboursDevice[layer]; }
120+
int** getDeviceNeighboursArray() { return mNeighboursDeviceArray; }
117121
TrackingFrameInfo* getDeviceTrackingFrameInfo(const int);
118122
const TrackingFrameInfo** getDeviceArrayTrackingFrameInfo() const { return mTrackingFrameInfoDeviceArray; }
119123
const Cluster** getDeviceArrayClusters() const { return mClustersDeviceArray; }
@@ -195,7 +199,9 @@ class TimeFrameGPU : public TimeFrame
195199

196200
Road<nLayers - 2>* mRoadsDevice;
197201
TrackITSExt* mTrackITSExtDevice;
198-
std::array<gpuPair<int, int>*, nLayers - 2> mNeighboursDevice;
202+
std::array<gpuPair<int, int>*, nLayers - 2> mNeighbourPairsDevice;
203+
std::array<int*, nLayers - 2> mNeighboursDevice;
204+
int** mNeighboursDeviceArray;
199205
std::array<TrackingFrameInfo*, nLayers> mTrackingFrameInfoDevice;
200206
const TrackingFrameInfo** mTrackingFrameInfoDeviceArray;
201207

Detectors/ITSMFT/ITS/tracking/GPU/ITStrackingGPU/TrackingKernels.h

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,31 @@ void computeCellNeighboursHandler(CellSeed** cellsLayersDevice,
176176
const int nBlocks,
177177
const int nThreads);
178178

179-
void filterCellNeighboursHandler(std::vector<int>&,
180-
gpuPair<int, int>*,
181-
unsigned int);
179+
int filterCellNeighboursHandler(std::vector<int>&,
180+
gpuPair<int, int>*,
181+
int*,
182+
unsigned int);
183+
184+
template <int nLayers = 7>
185+
void processNeighboursHandler(const int startLayer,
186+
const int startLevel,
187+
CellSeed** allCellSeeds,
188+
CellSeed* currentCellSeeds,
189+
const unsigned int nCurrentCells,
190+
const unsigned char** usedClusters,
191+
int* neighbours,
192+
gsl::span<int*> neighboursDeviceLUTs,
193+
const TrackingFrameInfo** foundTrackingFrameInfo,
194+
const float bz,
195+
const float MaxChi2ClusterAttachment,
196+
const o2::base::Propagator* propagator,
197+
const o2::base::PropagatorF::MatCorrType matCorrType,
198+
const std::vector<int>& lastCellIdHost, // temporary host vector
199+
const std::vector<CellSeed>& lastCellSeedHost, // temporary host vector
200+
std::vector<int>& updatedCellIdHost, // temporary host vector
201+
std::vector<CellSeed>& updatedCellSeedHost, // temporary host vector
202+
const int nBlocks,
203+
const int nThreads);
182204

183205
void trackSeedHandler(CellSeed* trackSeeds,
184206
const TrackingFrameInfo** foundTrackingFrameInfo,

0 commit comments

Comments
 (0)