Skip to content

Commit ccd86e0

Browse files
martenoledavidrohr
authored andcommitted
TRD TRAP simulation uses OpenMP
- output tracklets are sorted by HCId - parallelisation is done over collisions - TODO: check hit calculation in TRAP simulation
1 parent 797d80e commit ccd86e0

5 files changed

Lines changed: 119 additions & 112 deletions

File tree

DataFormats/Detectors/TRD/include/DataFormatsTRD/Constants.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ constexpr int NROWC0 = 12; // the number of pad rows for chambers of type C0 (
3939
constexpr int NROWC1 = 16; // the number of pad rows for chambers of type C1 (installed in stack 2)
4040

4141
constexpr int NMCMROB = 16; // the number of MCMs per ROB
42+
constexpr int NMCMHCMAX = 64; // the maximum number of MCMs for one half chamber (C1 type)
4243
constexpr int NMCMROBINROW = 4; // the number of MCMs per ROB in row direction
4344
constexpr int NMCMROBINCOL = 4; // the number of MCMs per ROB in column direction
4445
constexpr int NROBC0 = 6; // the number of ROBs per C0 chamber

Detectors/TRD/base/include/TRDBase/Digit.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ class Digit
6363
void setADC(const gsl::span<ADC_t>& adc) { std::copy(adc.begin(), adc.end(), mADC.begin()); }
6464
// Get methods
6565
int getDetector() const { return mDetector; }
66+
int getHCId() const { return mDetector * 2 + (mROB % 2); }
6667
int getRow() const { return FeeParam::getPadRowFromMCM(mROB, mMCM); }
6768
int getPad() const { return FeeParam::getPadColFromADC(mROB, mMCM, mChannel); }
6869
int getROB() const { return mROB; }

Detectors/TRD/simulation/src/TrapSimulator.cxx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ void TrapSimulator::reset()
107107
//clear the adc data
108108
std::fill(mADCR.begin(), mADCR.end(), 0);
109109
std::fill(mADCF.begin(), mADCF.end(), 0);
110+
std::fill(mADCDigitIndices.begin(), mADCDigitIndices.end(), -1);
110111

111112
for (auto filterreg : mInternalFilterRegisters) {
112113
filterreg.ClearReg();
@@ -2069,7 +2070,8 @@ void TrapSimulator::fitTracklet()
20692070
}
20702071
bool printoutadcs = false;
20712072
for (int i = 0; i < 21; i++) {
2072-
if (adchitbp & (1U << i)) {
2073+
// FIXME it can happen that there is a hit found in a channel where there is no digit provided as input. Is this expected?
2074+
if ((adchitbp & (1U << i)) && (mADCDigitIndices[i] >= 0)) {
20732075
mTrackletDigitCount.back() += 1;
20742076
mTrackletDigitIndices.push_back(mADCDigitIndices[i]);
20752077
}

Detectors/TRD/workflow/include/TRDWorkflow/TRDTrapSimulatorSpec.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "TRDSimulation/TrapSimulator.h"
2121
#include "TRDSimulation/TrapConfig.h"
2222
#include "DataFormatsTRD/Tracklet64.h"
23+
#include "DataFormatsTRD/Constants.h"
2324
#include <SimulationDataFormat/MCCompLabel.h>
2425
#include <SimulationDataFormat/ConstMCTruthContainer.h>
2526

@@ -41,23 +42,20 @@ class TRDDPLTrapSimulatorTask : public o2::framework::Task
4142

4243

4344
private:
44-
std::array<TrapSimulator, 128> mTrapSimulator; //the up to 128 trap simulators for a single chamber
4545
TrapConfig* mTrapConfig = nullptr;
4646
unsigned long mRunNumber = 297595; //run number to anchor simulation to.
47-
int mShowTrackletStats = 1; // show some statistics for each run
4847
bool mEnableOnlineGainCorrection{false};
4948
bool mUseMC{false}; // whether or not to use MC labels
5049
bool mEnableTrapConfigDump{false};
5150
std::string mTrapConfigName; // the name of the config to be used.
5251
std::string mOnlineGainTableName;
5352
std::unique_ptr<Calibrations> mCalib; // store the calibrations connection to CCDB. Used primarily for the gaintables in line above.
54-
std::chrono::duration<double> mTrapSimTime{0}; // timer for the actual processing in the TRAP chips
5553

5654
TrapConfig* getTrapConfig();
5755
void loadTrapConfig();
5856
void loadDefaultTrapConfig();
5957
void setOnlineGainTables();
60-
void processTRAPchips(int currDetector, int& nTrackletsInTrigRec, std::vector<Tracklet64>& trapTrackletsAccum, o2::dataformats::MCTruthContainer<o2::MCCompLabel>& lblTracklets, const o2::dataformats::ConstMCTruthContainer<o2::MCCompLabel>* lblDigits);
58+
void processTRAPchips(int& nTracklets, std::vector<Tracklet64>& trackletsAccum, std::array<TrapSimulator, constants::NMCMHCMAX>& trapSimulators, std::vector<short>& digitCounts, std::vector<int>& digitIndices);
6159
};
6260

6361
o2::framework::DataProcessorSpec getTRDTrapSimulatorSpec(bool useMC);

0 commit comments

Comments
 (0)