File indexing completed on 2024-09-27 07:03:28
0001
0002
0003
0004 #include "Weights.h"
0005
0006 using std::vector;
0007
0008 ClassImp(Weights)
0009 ClassImp(WeightsUniform)
0010 ClassImp(WeightsSivers)
0011 ClassImp(WeightsCollins)
0012 ClassImp(WeightsProduct)
0013 ClassImp(WeightsSum)
0014
0015 Double_t WeightsSivers::GetWeight(const Kinematics& kin) const {
0016 return kin.polT * kin.tSpin
0017 * this->Asymmetry(kin.x, kin.z, kin.Q2, kin.pT)
0018 * TMath::Sin(kin.phiH - kin.phiS);
0019 }
0020
0021 Double_t WeightsCollins::GetWeight(const Kinematics& kin) const {
0022 return kin.polT * kin.tSpin * kin.depolP1
0023 * this->Asymmetry(kin.x, kin.z, kin.Q2, kin.pT)
0024 * TMath::Sin(kin.phiH + kin.phiS);
0025 }
0026
0027 WeightsProduct::WeightsProduct(std::initializer_list<Weights const*> init) {
0028 for (Weights const* weight : init) {
0029 weights.push_back(weight);
0030 }
0031 }
0032
0033 Double_t WeightsProduct::GetWeight(const Kinematics& kin) const {
0034 Double_t product = 1.;
0035 for (auto weight_ptr : weights) {
0036 product *= weight_ptr->GetWeight(kin);
0037 }
0038 return product;
0039 }
0040
0041 WeightsProduct& WeightsProduct::Multiply(Weights const* rhs) {
0042 WeightsProduct const* rhs_product = dynamic_cast<WeightsProduct const*>(rhs);
0043 if (rhs_product != nullptr) {
0044 weights.insert(
0045 weights.end(),
0046 rhs_product->weights.begin(),
0047 rhs_product->weights.end());
0048 } else {
0049 weights.push_back(rhs);
0050 }
0051 return *this;
0052 }
0053
0054 WeightsSum::WeightsSum(std::initializer_list<Weights const*> init) {
0055 for (Weights const* weight : init) {
0056 weights.push_back(weight);
0057 }
0058 }
0059
0060 Double_t WeightsSum::GetWeight(const Kinematics& kin) const {
0061 Double_t sum = 0.;
0062 for (auto weight_ptr : weights) {
0063 sum += weight_ptr->GetWeight(kin);
0064 }
0065 return sum;
0066 }
0067
0068 WeightsSum& WeightsSum::Add(Weights const* rhs) {
0069 WeightsSum const* rhs_sum = dynamic_cast<WeightsSum const*>(rhs);
0070 if (rhs_sum != nullptr) {
0071 weights.insert(
0072 weights.end(),
0073 rhs_sum->weights.begin(),
0074 rhs_sum->weights.end());
0075 } else {
0076 weights.push_back(rhs);
0077 }
0078 return *this;
0079 }
0080