Skip to content

Commit efde4e3

Browse files
[FV0] pile-up simulation (#4500)
* [FV0] pile-up simulation
1 parent ad7196f commit efde4e3

File tree

4 files changed

+237
-87
lines changed

4 files changed

+237
-87
lines changed

Detectors/FIT/FV0/simulation/include/FV0Simulation/Digitizer.h

Lines changed: 47 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class Digitizer
3535

3636
public:
3737
Digitizer()
38-
: mTimeStamp(0), mIntRecord(), mEventId(-1), mSrcId(-1), mMCLabels(), mPmtChargeVsTime(), mNBins(), mPmtResponseGlobal(), mPmtResponseTemp()
38+
: mTimeStamp(0), mIntRecord(), mEventId(-1), mSrcId(-1), mMCLabels(), mCache(), mPmtChargeVsTime(), mNBins(), mNTimeBinsPerBC(), mPmtResponseGlobal(), mPmtResponseTemp()
3939
{
4040
}
4141

@@ -53,25 +53,61 @@ class Digitizer
5353
void setSrcId(Int_t id) { mSrcId = id; }
5454
void setInteractionRecord(const InteractionTimeRecord& ir) { mIntRecord = ir; }
5555

56-
void process(const std::vector<o2::fv0::Hit>& hits);
57-
void analyseWaveformsAndStore(std::vector<fv0::BCData>& digitsBC,
58-
std::vector<fv0::ChannelData>& digitsCh,
59-
dataformats::MCTruthContainer<fv0::MCLabel>& labels);
56+
void process(const std::vector<o2::fv0::Hit>& hits, std::vector<o2::fv0::BCData>& digitsBC,
57+
std::vector<o2::fv0::ChannelData>& digitsCh, o2::dataformats::MCTruthContainer<o2::fv0::MCLabel>& labels);
58+
59+
void flush(std::vector<o2::fv0::BCData>& digitsBC,
60+
std::vector<o2::fv0::ChannelData>& digitsCh,
61+
o2::dataformats::MCTruthContainer<o2::fv0::MCLabel>& labels);
6062

6163
const InteractionRecord& getInteractionRecord() const { return mIntRecord; }
6264
InteractionRecord& getInteractionRecord(InteractionRecord& src) { return mIntRecord; }
6365
uint32_t getOrbit() const { return mIntRecord.orbit; }
6466
uint16_t getBC() const { return mIntRecord.bc; }
6567

68+
using ChannelBCDataF = std::vector<float>;
69+
70+
struct BCCache : public o2::InteractionRecord {
71+
std::vector<o2::fv0::MCLabel> labels;
72+
std::array<ChannelBCDataF, Constants::nFv0Channels> mPmtChargeVsTime = {};
73+
74+
void clear()
75+
{
76+
for (auto& channel : mPmtChargeVsTime) {
77+
std::fill(channel.begin(), channel.end(), 0.);
78+
}
79+
labels.clear();
80+
}
81+
82+
BCCache& operator=(const o2::InteractionRecord& ir)
83+
{
84+
o2::InteractionRecord::operator=(ir);
85+
return *this;
86+
}
87+
void print() const;
88+
};
89+
6690
private:
91+
static constexpr int BCCacheMin = 0, BCCacheMax = 7, NBC2Cache = 1 + BCCacheMax - BCCacheMin;
92+
void createPulse(float mipFraction, int parID, const double hitTime, std::array<o2::InteractionRecord, NBC2Cache> const& cachedIR,
93+
int nCachedIR, const int detID);
94+
6795
long mTimeStamp; // TF (run) timestamp
68-
InteractionRecord mIntRecord; // Interaction record (orbit, bc) -> InteractionTimeRecord
96+
InteractionTimeRecord mIntRecord; // Interaction record (orbit, bc) -> InteractionTimeRecord
6997
Int_t mEventId; // ID of the current event
7098
Int_t mSrcId; // signal, background or QED
71-
std::vector<fv0::MCLabel> mMCLabels;
99+
std::deque<fv0::MCLabel> mMCLabels;
100+
std::deque<BCCache> mCache;
101+
102+
BCCache& setBCCache(const o2::InteractionRecord& ir);
103+
BCCache* getBCCache(const o2::InteractionRecord& ir);
104+
105+
void storeBC(const BCCache& bc, std::vector<o2::fv0::BCData>& digitsBC, std::vector<o2::fv0::ChannelData>& digitsCh,
106+
o2::dataformats::MCTruthContainer<o2::fv0::MCLabel>& labels);
72107

73108
std::array<std::vector<Float_t>, Constants::nFv0Channels> mPmtChargeVsTime; // Charge time series aka analogue signal pulse from PM
74-
UInt_t mNBins; // Number of bins in pulse series
109+
UInt_t mNBins; //
110+
UInt_t mNTimeBinsPerBC;
75111
Float_t mBinSize; // Time width of the pulse bin - HPTDC resolution
76112

77113
/// vectors to store the PMT signal from cosmic muons
@@ -80,7 +116,9 @@ class Digitizer
80116

81117
/// Internal helper methods related to conversion of energy-deposition into el. signal
82118
Int_t SimulateLightYield(Int_t pmt, Int_t nPhot) const;
83-
Float_t SimulateTimeCfd(Int_t channel) const;
119+
Float_t SimulateTimeCfd(const ChannelBCDataF& pulse) const;
120+
Float_t IntegrateCharge(const ChannelBCDataF& pulse) const;
121+
// Float_t SimulateTimeCfd(Int_t channel, Int_t iCache) const;
84122

85123
/// Functions related to splitting ring-5 cell signal to two readout channels
86124
static float getDistFromCellCenter(UInt_t cellId, double hitx, double hity);

Detectors/FIT/FV0/simulation/include/FV0Simulation/FV0DigParam.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313

1414
#include "CommonUtils/ConfigurableParam.h"
1515
#include "CommonUtils/ConfigurableParamHelper.h"
16+
#include "CommonConstants/PhysicsConstants.h"
1617

1718
namespace o2
1819
{
1920
namespace fv0
2021
{
2122
// parameters of FV0 digitization / transport simulation
22-
2323
struct FV0DigParam : public o2::conf::ConfigurableParamHelper<FV0DigParam> {
2424
float intrinsicTimeRes = 0.91; // time resolution
2525
float photoCathodeEfficiency = 0.23; // quantum efficiency = nOfPhotoE_emitted_by_photocathode / nIncidentPhotons
@@ -28,23 +28,23 @@ struct FV0DigParam : public o2::conf::ConfigurableParamHelper<FV0DigParam> {
2828
float pmtTransitTime = 9.5; // PMT response time (corresponds to 1.9 ns rise time)
2929
float pmtTransparency = 0.25; // Transparency of the first dynode of the PMT
3030
float shapeConst = 1.18059e-14; // Crystal ball const parameter
31-
float shapeMean = 1.70518e+01; // Crystal ball mean parameter
31+
float shapeMean = 9.5; // Crystal ball mean parameter
3232
float shapeAlpha = -6.56586e-01; // Crystal ball alpha parameter
3333
float shapeN = 2.36408e+00; // Crystal ball N parameter
3434
float shapeSigma = 3.55445; // Crystal ball sigma parameter
35-
float timeShiftCfd = 3.3; // TODO: adjust after PM design for FV0 is fixed
35+
//float timeShiftCfd = 3.3; // From the cosmic measurements of FV0 [keep it for reference]
36+
float timeShiftCfd = 5.3; // TODO: adjust after FV0 with FEE measurements are done
3637
float singleMipThreshold = 3.0; // in [MeV] of deposited energy
38+
float singleHitTimeThreshold = 120.0; // in [ns] to skip very slow particles
3739
float waveformNbins = 10000; // number of bins for the analog pulse waveform
3840
float waveformBinWidth = 0.01302; // number of bins for the analog
39-
float timeCompensate = 23.25; // in ns
40-
float chargeIntBinMin = (timeCompensate - 6.0) / waveformBinWidth; //Charge integration offset (cfd mean time - 6 ns)
41-
float chargeIntBinMax = (timeCompensate + 14.0) / waveformBinWidth; //Charge integration offset (cfd mean time + 14 ns)
42-
bool isIntegrateFull = false;
43-
float cfdCheckWindow = 2.5; // in ns
44-
int avgPhElectron = 201;
45-
46-
//Optimization-related, derived constants
47-
float oneOverPmtTransitTime2 = 1.0 / (pmtTransitTime * pmtTransitTime);
41+
float avgCfdTimeForMip = 8.63; // in ns to shift the CFD time to zero TODO do ring wise
42+
int chargeIntBinMin = (avgCfdTimeForMip - 6.0) / waveformBinWidth; //Charge integration offset (cfd mean time - 6 ns)
43+
int chargeIntBinMax = (avgCfdTimeForMip + 14.0) / waveformBinWidth; //Charge integration offset (cfd mean time + 14 ns)
44+
bool isIntegrateFull = false; // Full charge integration widow in 25 ns
45+
float cfdCheckWindow = 2.5; // time window for the cfd in ns to trigger the charge integration
46+
int avgNumberPhElectronPerMip = 201; // avg number of photo-electrons per MIP
47+
float globalTimeOfFlight = 315.0 / o2::constants::physics::LightSpeedCm2NS; //TODO check the correct value for distance of FV0 to IP
4848

4949
O2ParamDef(FV0DigParam, "FV0DigParam");
5050
};

0 commit comments

Comments
 (0)