Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 47 additions & 9 deletions Detectors/FIT/FV0/simulation/include/FV0Simulation/Digitizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Digitizer

public:
Digitizer()
: mTimeStamp(0), mIntRecord(), mEventId(-1), mSrcId(-1), mMCLabels(), mPmtChargeVsTime(), mNBins(), mPmtResponseGlobal(), mPmtResponseTemp()
: mTimeStamp(0), mIntRecord(), mEventId(-1), mSrcId(-1), mMCLabels(), mCache(), mPmtChargeVsTime(), mNBins(), mNTimeBinsPerBC(), mPmtResponseGlobal(), mPmtResponseTemp()
{
}

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

void process(const std::vector<o2::fv0::Hit>& hits);
void analyseWaveformsAndStore(std::vector<fv0::BCData>& digitsBC,
std::vector<fv0::ChannelData>& digitsCh,
dataformats::MCTruthContainer<fv0::MCLabel>& labels);
void process(const std::vector<o2::fv0::Hit>& hits, std::vector<o2::fv0::BCData>& digitsBC,
std::vector<o2::fv0::ChannelData>& digitsCh, o2::dataformats::MCTruthContainer<o2::fv0::MCLabel>& labels);

void flush(std::vector<o2::fv0::BCData>& digitsBC,
std::vector<o2::fv0::ChannelData>& digitsCh,
o2::dataformats::MCTruthContainer<o2::fv0::MCLabel>& labels);

const InteractionRecord& getInteractionRecord() const { return mIntRecord; }
InteractionRecord& getInteractionRecord(InteractionRecord& src) { return mIntRecord; }
uint32_t getOrbit() const { return mIntRecord.orbit; }
uint16_t getBC() const { return mIntRecord.bc; }

using ChannelBCDataF = std::vector<float>;

struct BCCache : public o2::InteractionRecord {
std::vector<o2::fv0::MCLabel> labels;
std::array<ChannelBCDataF, Constants::nFv0Channels> mPmtChargeVsTime = {};

void clear()
{
for (auto& channel : mPmtChargeVsTime) {
std::fill(channel.begin(), channel.end(), 0.);
}
labels.clear();
}

BCCache& operator=(const o2::InteractionRecord& ir)
{
o2::InteractionRecord::operator=(ir);
return *this;
}
void print() const;
};

private:
static constexpr int BCCacheMin = 0, BCCacheMax = 7, NBC2Cache = 1 + BCCacheMax - BCCacheMin;
void createPulse(float mipFraction, int parID, const double hitTime, std::array<o2::InteractionRecord, NBC2Cache> const& cachedIR,
int nCachedIR, const int detID);

long mTimeStamp; // TF (run) timestamp
InteractionRecord mIntRecord; // Interaction record (orbit, bc) -> InteractionTimeRecord
InteractionTimeRecord mIntRecord; // Interaction record (orbit, bc) -> InteractionTimeRecord
Int_t mEventId; // ID of the current event
Int_t mSrcId; // signal, background or QED
std::vector<fv0::MCLabel> mMCLabels;
std::deque<fv0::MCLabel> mMCLabels;
std::deque<BCCache> mCache;

BCCache& setBCCache(const o2::InteractionRecord& ir);
BCCache* getBCCache(const o2::InteractionRecord& ir);

void storeBC(const BCCache& bc, std::vector<o2::fv0::BCData>& digitsBC, std::vector<o2::fv0::ChannelData>& digitsCh,
o2::dataformats::MCTruthContainer<o2::fv0::MCLabel>& labels);

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

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

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

/// Functions related to splitting ring-5 cell signal to two readout channels
static float getDistFromCellCenter(UInt_t cellId, double hitx, double hity);
Expand Down
24 changes: 12 additions & 12 deletions Detectors/FIT/FV0/simulation/include/FV0Simulation/FV0DigParam.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@

#include "CommonUtils/ConfigurableParam.h"
#include "CommonUtils/ConfigurableParamHelper.h"
#include "CommonConstants/PhysicsConstants.h"

namespace o2
{
namespace fv0
{
// parameters of FV0 digitization / transport simulation

struct FV0DigParam : public o2::conf::ConfigurableParamHelper<FV0DigParam> {
float intrinsicTimeRes = 0.91; // time resolution
float photoCathodeEfficiency = 0.23; // quantum efficiency = nOfPhotoE_emitted_by_photocathode / nIncidentPhotons
Expand All @@ -28,23 +28,23 @@ struct FV0DigParam : public o2::conf::ConfigurableParamHelper<FV0DigParam> {
float pmtTransitTime = 9.5; // PMT response time (corresponds to 1.9 ns rise time)
float pmtTransparency = 0.25; // Transparency of the first dynode of the PMT
float shapeConst = 1.18059e-14; // Crystal ball const parameter
float shapeMean = 1.70518e+01; // Crystal ball mean parameter
float shapeMean = 9.5; // Crystal ball mean parameter
float shapeAlpha = -6.56586e-01; // Crystal ball alpha parameter
float shapeN = 2.36408e+00; // Crystal ball N parameter
float shapeSigma = 3.55445; // Crystal ball sigma parameter
float timeShiftCfd = 3.3; // TODO: adjust after PM design for FV0 is fixed
//float timeShiftCfd = 3.3; // From the cosmic measurements of FV0 [keep it for reference]
float timeShiftCfd = 5.3; // TODO: adjust after FV0 with FEE measurements are done
float singleMipThreshold = 3.0; // in [MeV] of deposited energy
float singleHitTimeThreshold = 120.0; // in [ns] to skip very slow particles
float waveformNbins = 10000; // number of bins for the analog pulse waveform
float waveformBinWidth = 0.01302; // number of bins for the analog
float timeCompensate = 23.25; // in ns
float chargeIntBinMin = (timeCompensate - 6.0) / waveformBinWidth; //Charge integration offset (cfd mean time - 6 ns)
float chargeIntBinMax = (timeCompensate + 14.0) / waveformBinWidth; //Charge integration offset (cfd mean time + 14 ns)
bool isIntegrateFull = false;
float cfdCheckWindow = 2.5; // in ns
int avgPhElectron = 201;

//Optimization-related, derived constants
float oneOverPmtTransitTime2 = 1.0 / (pmtTransitTime * pmtTransitTime);
float avgCfdTimeForMip = 8.63; // in ns to shift the CFD time to zero TODO do ring wise
int chargeIntBinMin = (avgCfdTimeForMip - 6.0) / waveformBinWidth; //Charge integration offset (cfd mean time - 6 ns)
int chargeIntBinMax = (avgCfdTimeForMip + 14.0) / waveformBinWidth; //Charge integration offset (cfd mean time + 14 ns)
bool isIntegrateFull = false; // Full charge integration widow in 25 ns
float cfdCheckWindow = 2.5; // time window for the cfd in ns to trigger the charge integration
int avgNumberPhElectronPerMip = 201; // avg number of photo-electrons per MIP
float globalTimeOfFlight = 315.0 / o2::constants::physics::LightSpeedCm2NS; //TODO check the correct value for distance of FV0 to IP

O2ParamDef(FV0DigParam, "FV0DigParam");
};
Expand Down
Loading