Skip to content

Commit 5ab1cf5

Browse files
authored
Merge 56e990d into sapling-pr-archive-ktf
2 parents c4fbaec + 56e990d commit 5ab1cf5

39 files changed

+3667
-240
lines changed

Detectors/EMCAL/simulation/include/EMCALSimulation/Digitizer.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ class Digitizer : public TObject
110110
bool mSmearEnergy = true; ///< do time and energy smearing
111111
bool mSimulateTimeResponse = true; ///< simulate time response
112112
const SimParam* mSimParam = nullptr; ///< SimParam object
113+
bool mIsBeforeFirstRO = false; ///< check if the signal comes before the ROF
114+
o2::InteractionRecord mIRFirstSampledTF; ///< IR of the 1st sampled IR, noise-only ROFs will be inserted till this IR only
115+
double mTimeBCns; ///< time difference between bc and start of ROF in ns
113116

114117
std::vector<Digit> mTempDigitVector; ///< temporary digit storage
115118
o2::emcal::DigitsWriteoutBuffer mDigits; ///< used to sort digits and labels by tower

Detectors/EMCAL/simulation/src/Digitizer.cxx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
#include "CommonDataFormat/InteractionRecord.h"
2727
#include "CommonUtils/TreeStreamRedirector.h"
2828
#include "SimConfig/DigiParams.h"
29+
#include "DetectorsRaw/HBFUtilsInitializer.h"
30+
#include "DetectorsRaw/HBFUtils.h"
2931

3032
ClassImp(o2::emcal::Digitizer);
3133

@@ -80,6 +82,8 @@ void Digitizer::init()
8082
} else {
8183
}
8284

85+
mIRFirstSampledTF = o2::raw::HBFUtils::Instance().getFirstSampledTFIR();
86+
8387
if (mEnableDebugStreaming) {
8488
mDebugStream = std::make_unique<o2::utils::TreeStreamRedirector>("emcaldigitsDebug.root", "RECREATE");
8589
}
@@ -164,6 +168,13 @@ void Digitizer::sampleSDigit(const Digit& sDigit)
164168
return;
165169
}
166170

171+
// check if this hit because it comes from an event before readout starts and it does not effect this RO
172+
LOG(debug) << "mIsBeforeFirstRO " << mIsBeforeFirstRO << " sDigit.getTimeStamp() " << sDigit.getTimeStamp() << " mSimParam->getSignalDelay() " << mSimParam->getSignalDelay() << " mPhase " << mPhase << " total: " << sDigit.getTimeStamp() + mSimParam->getSignalDelay() + mPhase * 25 << " EMC_TOF_MAX " << EMC_TOF_MAX << " mTimeBCns " << mTimeBCns;
173+
if (mIsBeforeFirstRO && sDigit.getTimeStamp() + mTimeBCns < 0) {
174+
LOG(debug) << "disregard this hit because it comes from an event before readout starts and it does not effect this RO";
175+
return;
176+
}
177+
167178
Double_t energies[15];
168179
if (mSimulateTimeResponse) {
169180
if (sDigit.getTimeStamp() + mSimParam->getSignalDelay() + mPhase * 25 > EMC_TOF_MAX) {
@@ -246,4 +257,16 @@ void Digitizer::setEventTime(o2::InteractionTimeRecord record, bool trigger)
246257
mPhase = 0;
247258
mEventTimeOffset++;
248259
}
260+
261+
// get time difference between current bc and start of RO in ns
262+
auto nbc = record.differenceInBC(mIRFirstSampledTF);
263+
mTimeBCns = record.getTimeOffsetWrtBC();
264+
mTimeBCns += nbc * o2::constants::lhc::LHCBunchSpacingNS;
265+
266+
if (nbc < 0) {
267+
// this event is before the first RO
268+
mIsBeforeFirstRO = true;
269+
} else {
270+
mIsBeforeFirstRO = false;
271+
}
249272
}

Detectors/GlobalTrackingWorkflow/study/include/GlobalTrackingStudy/TrackMCStudy.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ namespace o2::trackstudy
2121
{
2222

2323
/// create a processor spec
24-
o2::framework::DataProcessorSpec getTrackMCStudySpec(o2::dataformats::GlobalTrackID::mask_t srcTracks, o2::dataformats::GlobalTrackID::mask_t srcClus, const o2::tpc::CorrectionMapsLoaderGloOpts& sclOpts);
24+
o2::framework::DataProcessorSpec getTrackMCStudySpec(o2::dataformats::GlobalTrackID::mask_t srcTracks, o2::dataformats::GlobalTrackID::mask_t srcClus, const o2::tpc::CorrectionMapsLoaderGloOpts& sclOpts, bool checkSV);
2525

2626
} // namespace o2::trackstudy
2727

Detectors/GlobalTrackingWorkflow/study/include/GlobalTrackingStudy/TrackMCStudyConfig.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,9 @@ struct TrackMCStudyConfig : o2::conf::ConfigurableParamHelper<TrackMCStudyConfig
2727
float decayMotherMaxT = 1.0f; // max TOF in ns for mother particles to study
2828
bool requireITSorTPCTrackRefs = true;
2929
bool requireTopBottomRefs = false;
30-
int minTPCRefsToExtractClRes = 4;
31-
float rejectClustersResStat = 0.6;
32-
float maxTPCRefExtrap = 2; // max dX to extrapolate the track ref when extrapolating track true posions
33-
float maxTRefExtrapErr = 0.005;
30+
int minTPCRefsToExtractClRes = 2;
31+
float rejectClustersResStat = 0.;
32+
float maxTPCRefExtrap = 2; // max dX to extrapolate the track ref when extrapolating track true posions
3433
int decayPDG[5] = {310, 3122, 411, 421, -1}; // decays to study, must end by -1
3534
O2ParamDef(TrackMCStudyConfig, "trmcconf");
3635
};

Detectors/GlobalTrackingWorkflow/study/include/GlobalTrackingStudy/TrackMCStudyTypes.h

Lines changed: 64 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "CommonDataFormat/TimeStamp.h"
2121
#include "ReconstructionDataFormats/PrimaryVertex.h"
2222
#include <array>
23+
#include <vector>
2324

2425
namespace o2::trackstudy
2526
{
@@ -39,16 +40,18 @@ struct MCTrackInfo {
3940
int bcInTF = -1;
4041
int pdg = 0;
4142
int pdgParent = 0;
43+
int parentEntry = -1;
4244
int16_t nTPCCl = 0;
4345
int16_t nTPCClShared = 0;
46+
int8_t parentDecID = -1;
4447
uint8_t minTPCRow = -1;
4548
uint8_t maxTPCRow = 0;
4649
uint8_t maxTPCRowInner = 0; // highest row in the sector containing the lowest one
4750
uint8_t minTPCRowSect = -1;
4851
uint8_t maxTPCRowSect = -1;
4952
int8_t nITSCl = 0;
5053
int8_t pattITSCl = 0;
51-
ClassDefNV(MCTrackInfo, 2);
54+
ClassDefNV(MCTrackInfo, 3);
5255
};
5356

5457
struct RecTrack {
@@ -112,24 +115,20 @@ struct TrackFamily { // set of tracks related to the same MC label
112115
ClassDefNV(TrackFamily, 1);
113116
};
114117

115-
struct ClResTPC {
116-
uint8_t sect = 0;
117-
uint8_t row = 0;
118-
uint8_t ncont = 0;
119-
uint8_t flags = 0;
120-
float snp = 0;
121-
float tgl = 0;
122-
float qmax = 0;
123-
float qtot = 0;
124-
float occ = 0;
125-
std::array<float, 3> clPos{};
118+
struct ClResTPCCont {
119+
// contributor to TPC Cluster
120+
std::array<float, 3> xyz{};
126121
std::array<float, 3> below{};
127122
std::array<float, 3> above{};
123+
float snp = 0.;
124+
float tgl = 0.;
125+
float q2pt = 0.;
126+
bool corrAttach = false;
128127

129-
int getNExt() const { return below[0] > 1. + above[0] > 1.; }
128+
int getNExt() const { return (below[0] > 1.) + (above[0] > 1.); }
130129

131-
float getDY() const { return clPos[1] - getYRef(); }
132-
float getDZ() const { return clPos[2] - getZRef(); }
130+
float getDY() const { return xyz[1] - getYRef(); }
131+
float getDZ() const { return xyz[2] - getZRef(); }
133132

134133
float getYRef() const
135134
{
@@ -165,15 +164,62 @@ struct ClResTPC {
165164
{
166165
float adxA = 1e9, adxB = 1e9;
167166
if (above[0] > 1.) {
168-
adxA = clPos[0] - above[0];
167+
adxA = xyz[0] - above[0];
169168
}
170169
if (below[0] > 1.) {
171-
adxB = clPos[0] - below[0];
170+
adxB = xyz[1] - below[0];
172171
}
173172
return std::abs(adxA) < std::abs(adxB) ? adxA : adxB;
174173
}
175174

176-
ClassDefNV(ClResTPC, 1);
175+
float getDXMax() const
176+
{
177+
float adxA = 0, adxB = 0;
178+
if (above[0] > 1.) {
179+
adxA = xyz[0] - above[0];
180+
}
181+
if (below[0] > 1.) {
182+
adxB = xyz[0] - below[0];
183+
}
184+
return std::abs(adxA) > std::abs(adxB) ? adxA : adxB;
185+
}
186+
187+
float getEY() const { return getNExt() > 1 ? below[1] - above[1] : -999; }
188+
float getEZ() const { return getNExt() > 1 ? below[2] - above[2] : -999; }
189+
190+
ClassDefNV(ClResTPCCont, 1);
191+
};
192+
193+
struct ClResTPC {
194+
uint8_t sect = 0;
195+
uint8_t row = 0;
196+
uint8_t ncont = 0;
197+
uint8_t flags = 0;
198+
float qmax = 0;
199+
float qtot = 0;
200+
float occ = 0;
201+
202+
std::vector<ClResTPCCont> contTracks;
203+
int getNCont() const { return contTracks.size(); }
204+
205+
float getDY(int i) const { return i < getNCont() ? contTracks[i].getDY() : -999.; }
206+
float getDZ(int i) const { return i < getNCont() ? contTracks[i].getDZ() : -999.; }
207+
float getYRef(int i) const { return i < getNCont() ? contTracks[i].getYRef() : -999.; }
208+
float getZRef(int i) const { return i < getNCont() ? contTracks[i].getZRef() : -999.; }
209+
float getDXMin(int i) const { return i < getNCont() ? contTracks[i].getDXMin() : -999.; }
210+
float getDXMax(int i) const { return i < getNCont() ? contTracks[i].getDXMax() : -999.; }
211+
float getEY(int i) const { return i < getNCont() ? contTracks[i].getEY() : -999.; }
212+
float getEZ(int i) const { return i < getNCont() ? contTracks[i].getEZ() : -999.; }
213+
214+
void sortCont()
215+
{
216+
std::sort(contTracks.begin(), contTracks.end(), [](const ClResTPCCont& a, const ClResTPCCont& b) {
217+
float dya = a.getDY(), dyb = b.getDY(), dza = a.getDZ(), dzb = b.getDZ();
218+
return dya * dya + dza * dza < dyb * dyb + dzb * dzb;
219+
});
220+
}
221+
222+
ClassDefNV(ClResTPC, 2);
177223
};
178224

179225
struct RecPV {

Detectors/GlobalTrackingWorkflow/study/src/GlobalTrackingStudyLinkDef.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,7 @@
3434
#pragma link C++ class o2::trackstudy::MCVertex + ;
3535
#pragma link C++ class std::vector < o2::trackstudy::MCVertex> + ;
3636
#pragma link C++ class o2::trackstudy::ClResTPC + ;
37+
#pragma link C++ class o2::trackstudy::ClResTPCCont + ;
38+
#pragma link C++ class std::vector < o2::trackstudy::ClResTPCCont> + ;
3739

3840
#endif

0 commit comments

Comments
 (0)