Skip to content

Commit

Permalink
fixed attenuation
Browse files Browse the repository at this point in the history
  • Loading branch information
P-Ulrich committed Jan 13, 2025
1 parent b1f9971 commit b333f51
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion neuland/calibration/cal_to_hit/R3BNeulandCalToHitPar.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace
auto calculate_threshold(const R3B::Neuland::HitModulePar& modulePar, R3B::Side side)
{
const auto value = modulePar.PMTThreshold.get(side).value *
std::exp(R3B::Neuland::TotalBarLength / modulePar.lightAttenuationLength.value);//Paula: i think it should be length * attenuation, based on defenitions inside of neulandPaddle
std::exp(R3B::Neuland::TotalBarLength / modulePar.lightAttenuationLength.value);
const auto err = 0.;
return R3B::ValueError<double>{ value, err };
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace
new_par.effectiveSpeed.value = par.GetEffectiveSpeed();
new_par.lightAttenuationLength.value = par.GetLightAttenuationLength();
new_par.lightAttenuationFactor.value =
std::exp(R3B::Neuland::TotalBarLength * new_par.lightAttenuationLength.value / 2);
std::exp(R3B::Neuland::TotalBarLength / new_par.lightAttenuationLength.value / 2);

// Getters accept 1 as the left side and 2 as the right side

Expand Down
12 changes: 5 additions & 7 deletions neuland/digitizing/R3BDigitizingPaddleNeuland.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,17 @@ namespace R3B::Digitizing::Neuland
NeulandPaddle::NeulandPaddle(uint16_t paddleID)
: Digitizing::Paddle(paddleID, SignalCouplingNeuland)
{
LOG(debug) << "NeulandPaddle: Using constructor 1" << std::endl;
}

NeulandPaddle::NeulandPaddle(uint16_t paddleID, R3B::Neuland::Cal2HitPar* cal_to_hit_par)
: Digitizing::Paddle(paddleID, SignalCouplingNeuland)
{
LOG(debug) << "NeulandPaddle: Using constructor 2" << std::endl;
const auto& module_par = cal_to_hit_par->GetModulePars().at(paddleID);
effective_speed_ = module_par.effectiveSpeed.value;
gAttenuation_ = module_par.lightAttenuationLength.value;
attenuation_ = 1./ module_par.lightAttenuationLength.value;
time_offset_ = module_par.tDiff.value;
time_sync_ = module_par.tSync.value;
ReverseAttenFac_ = std::exp(NeulandPaddle::gHalfLength * gAttenuation_);
ReverseAttenFac_ = std::exp(NeulandPaddle::gHalfLength * attenuation_);
}

auto NeulandPaddle::MatchSignals(const Channel::Signal& firstSignal,
Expand All @@ -53,13 +51,13 @@ namespace R3B::Digitizing::Neuland
if (firstT > secondT)
{
res = std::abs((firstE / secondE) *
FastExp<4>(static_cast<Float_t>(gAttenuation_ * effective_speed_ * (firstT - secondT))) -
FastExp<4>(static_cast<Float_t>(attenuation_ * effective_speed_ * (firstT - secondT))) -
1);
}
else
{
res =
std::abs((secondE / firstE) * FastExp<4>(static_cast<Float_t>(gAttenuation_ * effective_speed_ *
std::abs((secondE / firstE) * FastExp<4>(static_cast<Float_t>(attenuation_ * effective_speed_ *
static_cast<Float_t>(secondT - firstT))) -
1);
}
Expand Down Expand Up @@ -108,7 +106,7 @@ namespace R3B::Digitizing::Neuland
const double dist,
enum ChannelSide channel_side) const -> Channel::Hit
{
auto light = double{ mcLight * std::exp(-NeulandPaddle::gAttenuation_ * (NeulandPaddle::gHalfLength_ - dist)) };
auto light = double{ mcLight * std::exp(-NeulandPaddle::attenuation_ * (NeulandPaddle::gHalfLength_ - dist)) };
int site_sign = (channel_side == ChannelSide::right) ? 1 : -1;

auto time = double{ mcTime + (NeulandPaddle::gHalfLength_ - dist) / effective_speed_ +
Expand Down
2 changes: 1 addition & 1 deletion neuland/digitizing/R3BDigitizingPaddleNeuland.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ namespace R3B::Digitizing::Neuland
// Paula: non static member variables, are not used in TacQuila
double gHalfLength_ = 135.; // [cm]
double gCMedium_ = 14.; // speed of light in material in [cm/ns]
double gAttenuation_ = 0.008; // light attenuation of plastic scintillator [1/cm]
double attenuation_ = 0.008; // light attenuation of plastic scintillator [1/cm]
double gLambda_ = 1. / 2.1;
double ReverseAttenFac_ = std::exp(NeulandPaddle::gHalfLength * NeulandPaddle::gAttenuation);
double effective_speed_ = R3B::Neuland::DEFAULT_EFFECTIVE_C;
Expand Down

0 comments on commit b333f51

Please sign in to comment.