Skip to content

Commit d5cd151

Browse files
martenoleshahor02
authored andcommitted
Create MC labels for tracklets and cleanup
1 parent f73ef1e commit d5cd151

5 files changed

Lines changed: 59 additions & 269 deletions

File tree

Detectors/TRD/simulation/include/TRDSimulation/TrapSimulator.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
#include "TRDBase/Digit.h"
2828
#include "TRDSimulation/Digitizer.h"
2929
#include "TRDSimulation/TrapConfig.h"
30-
#include "TRDBase/MCLabel.h"
31-
#include "SimulationDataFormat/MCTruthContainer.h"
3230
#include "DataFormatsTRD/Tracklet64.h"
3331
#include "DataFormatsTRD/RawData.h"
3432
#include "DataFormatsTRD/Constants.h"
@@ -57,6 +55,8 @@ class TrapSimulator
5755
// Initialize MCM by the position parameters
5856
void init(TrapConfig* trapconfig, int det, int rob, int mcm);
5957

58+
bool checkInitialized() const { return mInitialized; }
59+
6060
// clears filter registers and internal data
6161
void reset();
6262
// void setDebugStream(TTreeSRedirector* stream) { mDebugStream = stream; }
@@ -73,7 +73,7 @@ class TrapSimulator
7373
int getZeroSupressionMap(int iadc) const { return (mZSMap[iadc]); }
7474
bool isDataSet() { return mDataIsSet; };
7575
// set ADC data with array
76-
void setData(int iadc, const ArrayADC& adc, std::vector<o2::MCCompLabel>& labels);
76+
void setData(int iadc, const ArrayADC& adc, unsigned int digitIdx);
7777
// set ADC data with array
7878
//void setData(int iadc, const ArrayADC& adc, gsl::span<o2::MCCompLabel,-1>& labels);
7979
void setBaselines(); // set the baselines as done in setDataByPad which is bypassed due to using setData in line above.
@@ -139,7 +139,11 @@ class TrapSimulator
139139

140140
int getNHits() const { return mHits.size(); }
141141
bool getHit(int index, int& channel, int& timebin, int& qtot, int& ypos, float& y) const;
142-
//o2::trd::TrapSimulator::Hit& getHit(int index) const;
142+
143+
// getters for calculated tracklets + labels
144+
std::vector<Tracklet64>& getTrackletArray64() { return mTrackletArray64; }
145+
std::vector<unsigned short>& getTrackletDigitCount() { return mTrackletDigitCount; }
146+
std::vector<unsigned int>& getTrackletDigitIndices() { return mTrackletDigitIndices; }
143147

144148
// data display
145149
void print(int choice) const; // print stored data to stdout
@@ -186,11 +190,6 @@ class TrapSimulator
186190
static constexpr int mQ2Startbin = 3; // Start range of Q2, for now here. TODO pull from a revised TrapConfig?
187191
static constexpr int mQ2Endbin = 5; // End range of Q2, also pull from a revised trapconfig at some point.
188192

189-
std::vector<Tracklet64>& getTrackletArray64() { return mTrackletArray64; }
190-
void getTracklet64s(std::vector<Tracklet64>& TrackletStore); // place the trapsim 64 bit tracklets nto the incoming vector
191-
o2::dataformats::MCTruthContainer<o2::MCCompLabel>& getTrackletLabels() { return mTrackletLabels; }
192-
193-
bool checkInitialized() const; // Check whether the class is initialized
194193
static const int mgkFormatIndex; // index for format settings in stream
195194
//TODO should this change to 3 for the new format ????? I cant remember now, ask someone.
196195
static const int mgkAddDigits = 2; // additional digits used for internal representation of ADC data
@@ -339,10 +338,11 @@ class TrapSimulator
339338
//TODO adcr adcf labels zerosupressionmap can all go into their own class. Refactor when stable.
340339
std::vector<int> mADCR; // Array with MCM ADC values (Raw, 12 bit) 2d with dimension mNTimeBin
341340
std::vector<int> mADCF; // Array with MCM ADC values (Filtered, 12 bit) 2d with dimension mNTimeBin
342-
std::array<std::vector<o2::MCCompLabel>, constants::NADCMCM> mADCLabels{}; // MC Labels sent in from the digits coming in.
341+
std::array<unsigned int, constants::NADCMCM> mADCDigitIndices{}; // indices of the incoming digits, used to relate the tracklets to labels in TRDTrapSimulatorSpec
343342
std::vector<unsigned int> mMCMT; // tracklet word for one mcm/trap-chip
344343
std::vector<Tracklet64> mTrackletArray64; // Array of 64 bit tracklets
345-
o2::dataformats::MCTruthContainer<o2::MCCompLabel> mTrackletLabels;
344+
std::vector<unsigned short> mTrackletDigitCount; // Keep track of the number of digits contributing to the tracklet (for MC labels)
345+
std::vector<unsigned int> mTrackletDigitIndices; // For each tracklet the up to two indices of the digits which contributed
346346
std::vector<TrackletDetail> mTrackletDetails; // store additional tracklet information for eventual debug output.
347347
std::vector<int> mZSMap; // Zero suppression map (1 dimensional projection)
348348

0 commit comments

Comments
 (0)