Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasmolander committed Dec 12, 2024
1 parent 9da1a8c commit 77ddd3d
Show file tree
Hide file tree
Showing 13 changed files with 551 additions and 30 deletions.
4 changes: 4 additions & 0 deletions Detectors/FIT/FDD/simulation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@
o2_add_library(FDDSimulation
SOURCES src/Detector.cxx
src/Digitizer.cxx
<<<<<<< Updated upstream
PUBLIC_LINK_LIBRARIES O2::CommonUtils
O2::SimulationDataFormat
=======
PUBLIC_LINK_LIBRARIES O2::SimulationDataFormat
>>>>>>> Stashed changes
O2::FDDBase
O2::DataFormatsFDD
O2::DetectorsRaw
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <array>
#include <deque>
#include <bitset>
#include "FDDSimulation/FDDDigParam.h"

namespace o2
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,15 @@
namespace o2::fdd
{
struct FDDDigParam : o2::conf::ConfigurableParamHelper<FDDDigParam> {
<<<<<<< Updated upstream
float hitTimeOffsetA = 0; ///< Hit time offset on the A side [ns]
float hitTimeOffsetC = 0; ///< Hit time offset on the C side [ns]

float pmGain = 1e6; ///< PM gain
=======
float hitTimeOffsetA = 0; ///< Hit time offset on the A side [ns]
float hitTimeOffsetC = 0; ///< Hit time offset on the C side [ns]
>>>>>>> Stashed changes

O2ParamDef(FDDDigParam, "FDDDigParam");
};
Expand Down
13 changes: 13 additions & 0 deletions Detectors/FIT/FDD/simulation/src/Digitizer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@

#include "FDDSimulation/Digitizer.h"

<<<<<<< Updated upstream
#include "CommonDataFormat/InteractionRecord.h"
#include "FDDSimulation/FDDDigParam.h"
=======
#include "FDDSimulation/FDDDigParam.h"
#include "CommonDataFormat/InteractionRecord.h"
>>>>>>> Stashed changes
#include "SimulationDataFormat/MCTruthContainer.h"

#include "TMath.h"
Expand Down Expand Up @@ -74,10 +79,18 @@ void Digitizer::process(const std::vector<o2::fdd::Hit>& hits,
double delayScintillator = mRndScintDelay.getNextValue();
double timeHit = delayScintillator + hit.GetTime();

<<<<<<< Updated upstream
// Subtract time-of-flight from hit time
const float timeOfFlight = hit.GetPos().R() / o2::constants::physics::LightSpeedCm2NS;
const float timeOffset = iChannel < 8 ? FDDDigParam::Instance().hitTimeOffsetC : FDDDigParam::Instance().hitTimeOffsetA;

=======
// Time-of-flight subtracted from hit time
// timeHit -= getTOFCorrection(int(iChannel / 4));
const float timeOfFlight = hit.GetPos().R() / o2::constants::physics::LightSpeedCm2NS;
const float timeOffset = 0; // TODO: why instance not working?
// const float timeOffset = hit.GetDetectorID() > 7 ? FDDDigParam::Instance().hitTimeOffsetA : FDDDigParam::Instance().hitTimeOffsetC; // TODO double check ch IDs
>>>>>>> Stashed changes
timeHit += -timeOfFlight + timeOffset;
timeHit += mIntRecord.getTimeNS();
o2::InteractionRecord irHit(timeHit); // BC in which the hit appears (might be different from interaction BC for slow particles)
Expand Down
5 changes: 5 additions & 0 deletions Detectors/FIT/FT0/base/include/FT0Base/FT0DigParam.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ struct FT0DigParam : o2::conf::ConfigurableParamHelper<FT0DigParam> {
float mAmp_trsh = 100; // [ph.e]
float mAmpRecordLow = -4; // integrate charge from
float mAmpRecordUp = 15; // to [ns]
<<<<<<< Updated upstream
=======
// float mC_side_cable_cmps = 2.86; // ns
// float mA_side_cable_cmps = 11.110; // ns
>>>>>>> Stashed changes
float hitTimeOffsetA = 0; ///< hit time offset on the A side [ns]
float hitTimeOffsetC = 0; ///< hit time offset on the C side [ns]
int mtrg_central_trh = 600.; // channels
Expand Down
8 changes: 8 additions & 0 deletions Detectors/FIT/FT0/simulation/src/Digitizer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,20 @@ void Digitizer::process(const std::vector<o2::ft0::HitType>* hits,
const auto& params = FT0DigParam::Instance();

Bool_t is_A_side = (hit_ch < 4 * mGeometry.NCellsA);
<<<<<<< Updated upstream

// Subtract time-of-flight from hit time
const Float_t timeOfFlight = hit.GetPos().R() / o2::constants::physics::LightSpeedCm2NS;
const Float_t timeOffset = is_A_side ? params.hitTimeOffsetA : params.hitTimeOffsetC;
Double_t hit_time = hit.GetTime() - timeOfFlight + timeOffset;

=======
// Time-of-flight subtracted from hit time
const Float_t timeOfFlight = hit.GetPos().R() / o2::constants::physics::LightSpeedCm2NS;
const Float_t timeOffset = is_A_side ? params.hitTimeOffsetA : params.hitTimeOffsetC;
// Float_t time_compensate = is_A_side ? params.mA_side_cable_cmps : params.mC_side_cable_cmps;
Double_t hit_time = hit.GetTime() - timeOfFlight + timeOffset;
>>>>>>> Stashed changes
if (hit_time > 150) {
continue; // not collect very slow particles
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,11 @@ class Digitizer
/// \param hitTime Time of the hit
/// \param hitR Length to IP from the position of the hit
/// \param cachedIR Cached interaction records
<<<<<<< Updated upstream
/// \param nCachedIR Number of cached interaction records
=======
/// \param nCachedIR Mumber of cached interaction records
>>>>>>> Stashed changes
/// \param detID Detector cell ID
void createPulse(float mipFraction, int parID, const double hitTime, const float hitR,
std::array<o2::InteractionRecord, NBC2Cache> const& cachedIR, int nCachedIR, const int detID);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ struct FV0DigParam : o2::conf::ConfigurableParamHelper<FV0DigParam> {
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
<<<<<<< Updated upstream
=======
// float globalTimeOfFlight = 315.0 / o2::constants::physics::LightSpeedCm2NS; // TODO [check the correct value for distance of FV0 to IP]
float hitTimeOffset = 0.0; ///< Hit time offset [ns]
>>>>>>> Stashed changes
float mCfdDeadTime = 15.6; // [ns]
float mCFD_trsh = 3.; // [mV]
float getCFDTrshInAdc() const { return mCFD_trsh * getChannelsPerMilivolt(); } // [ADC channels]
Expand Down
4 changes: 4 additions & 0 deletions Detectors/FIT/FV0/simulation/src/Digitizer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,11 @@ void Digitizer::createPulse(float mipFraction, int parID, const double hitTime,
}
}

<<<<<<< Updated upstream
// Subtract time-of-flight from hit time
=======
// Time-of-flight subtracted from hit time
>>>>>>> Stashed changes
const float timeOfFlight = hitR / o2::constants::physics::LightSpeedCm2NS;
Int_t const NBinShift = std::lround((hitTime - timeOfFlight + FV0DigParam::Instance().hitTimeOffset) / FV0DigParam::Instance().waveformBinWidth);

Expand Down
Loading

0 comments on commit 77ddd3d

Please sign in to comment.