diff --git a/analysis/PWGDIL/dielectron/papaframework/PairAnalysisMC.cxx b/analysis/PWGDIL/dielectron/papaframework/PairAnalysisMC.cxx index 27e6f435a7711f69003cf5093eca11ea022739f0..016aa9652d1ee19bb0ed1152890223f6d2ddbfea 100644 --- a/analysis/PWGDIL/dielectron/papaframework/PairAnalysisMC.cxx +++ b/analysis/PWGDIL/dielectron/papaframework/PairAnalysisMC.cxx @@ -472,7 +472,8 @@ Bool_t PairAnalysisMC::CheckParticleSource(Int_t label, PairAnalysisSignalMC::ES // NOTE: TODO: check and clarify different sources, UPDATE! // - UInt_t processID = static_cast<CbmMCTrack*>(GetMCTrackFromMCEvent(label))->GetGeantProcessId(); + UInt_t processID = 9999999; + if (label > 0) processID = static_cast<CbmMCTrack*>(GetMCTrackFromMCEvent(label))->GetGeantProcessId(); // printf("process: id %d --> %s \n",processID,TMCProcessName[processID]); switch (source) { diff --git a/analysis/PWGDIL/dielectron/papaframework/PairAnalysisMC.h b/analysis/PWGDIL/dielectron/papaframework/PairAnalysisMC.h index d32a2b8f884e5d8cc7cdb5be860b14e66343bb9f..ee87babe3e74ef3e5b8846dc4c08f1358981706f 100644 --- a/analysis/PWGDIL/dielectron/papaframework/PairAnalysisMC.h +++ b/analysis/PWGDIL/dielectron/papaframework/PairAnalysisMC.h @@ -12,10 +12,12 @@ //##################################################### #ifndef ROOT_TObject -#include <TClonesArray.h> #include <TMCProcess.h> #include <TObject.h> #endif + +#include <TClonesArray.h> + class TParticle; class CbmMCTrack; class PairAnalysisTrack; diff --git a/analysis/PWGDIL/dielectron/papaframework/PairAnalysisPairKF.cxx b/analysis/PWGDIL/dielectron/papaframework/PairAnalysisPairKF.cxx index 01feddd1e51194538eee18e4f7be6066348c5b7a..63733318a828c6205f85fca5e08ca6a6a20887db 100644 --- a/analysis/PWGDIL/dielectron/papaframework/PairAnalysisPairKF.cxx +++ b/analysis/PWGDIL/dielectron/papaframework/PairAnalysisPairKF.cxx @@ -18,6 +18,7 @@ #include <TDatabasePDG.h> #include "KFParticle.h" +#include "PairAnalysisMC.h" #include "PairAnalysisTrack.h" ClassImp(PairAnalysisPairKF) @@ -118,7 +119,20 @@ void PairAnalysisPairKF::SetTracks(PairAnalysisTrack* const particle1, Int_t pid // fPair.SetMassConstraint( mass, wdth ); //TODO: take from mother pdg code provided to pairanalysis fCharge = (particle1->Charge() * particle2->Charge()); - fWeight = TMath::Sqrt(particle1->GetWeight() * particle2->GetWeight()); + fWeight = particle1->GetWeight() * particle2->GetWeight(); + + //Check if both particles come from the same mother -> then only use one weight + PairAnalysisMC* mc = PairAnalysisMC::Instance(); + if (mc->HasMC() && particle1->GetMCTrack() && particle2->GetMCTrack()) { + CbmMCTrack* particle1MC = particle1->GetMCTrack(); + CbmMCTrack* particle2MC = particle2->GetMCTrack(); + Int_t mother1Id = particle1MC->GetMotherId(); + Int_t mother2Id = particle2MC->GetMotherId(); + CbmMCTrack* mother1 = mc->GetMCTrackFromMCEvent(mother1Id); + CbmMCTrack* mother2 = mc->GetMCTrackFromMCEvent(mother2Id); + if (mother1 && mother2 && (mother1Id == mother2Id)) fWeight = particle1->GetWeight(); + } + // printf("fill pair weight: %.1f * %.1f = %.1f \n",particle1->GetWeight(),particle2->GetWeight(),fWeight); } diff --git a/analysis/PWGDIL/dielectron/papaframework/PairAnalysisPairLV.cxx b/analysis/PWGDIL/dielectron/papaframework/PairAnalysisPairLV.cxx index ec78ce749cf85d58a2d57fe4082a023a32b756da..5084ee44c0eb769f82a9636392ef11d5c1bd7b83 100644 --- a/analysis/PWGDIL/dielectron/papaframework/PairAnalysisPairLV.cxx +++ b/analysis/PWGDIL/dielectron/papaframework/PairAnalysisPairLV.cxx @@ -16,6 +16,7 @@ #include <TDatabasePDG.h> +#include "PairAnalysisMC.h" #include "PairAnalysisTrack.h" ClassImp(PairAnalysisPairLV) @@ -118,7 +119,21 @@ void PairAnalysisPairLV::SetTracks(PairAnalysisTrack* const particle1, Int_t pid fPair = (fD1 + fD2); fPairPos = (*particle1->GetPosition() + *particle2->GetPosition()); fCharge = (particle1->Charge() * particle2->Charge()); - fWeight = TMath::Sqrt(particle1->GetWeight() * particle2->GetWeight()); + fWeight = particle1->GetWeight() * particle2->GetWeight(); + + //Check if both particles come from the same mother -> then only use one weight + PairAnalysisMC* mc = PairAnalysisMC::Instance(); + if (mc->HasMC() && particle1->GetMCTrack() && particle2->GetMCTrack()) { + CbmMCTrack* particle1MC = particle1->GetMCTrack(); + CbmMCTrack* particle2MC = particle2->GetMCTrack(); + Int_t mother1Id = particle1MC->GetMotherId(); + Int_t mother2Id = particle2MC->GetMotherId(); + CbmMCTrack* mother1 = mc->GetMCTrackFromMCEvent(mother1Id); + CbmMCTrack* mother2 = mc->GetMCTrackFromMCEvent(mother2Id); + if (mother1 && mother2 && (mother1Id == mother2Id)) fWeight = particle1->GetWeight(); + } + + // printf("fill pair weight: %.1f * %.1f = %.1f \n",particle1->GetWeight(),particle2->GetWeight(),fWeight); } diff --git a/analysis/PWGDIL/dielectron/papaframework/PairAnalysisVarManager.cxx b/analysis/PWGDIL/dielectron/papaframework/PairAnalysisVarManager.cxx index abedf6886d19bc346bb59d4418252cdf1c823937..4025c98f5002380ea195d20b47202a9548552dc9 100644 --- a/analysis/PWGDIL/dielectron/papaframework/PairAnalysisVarManager.cxx +++ b/analysis/PWGDIL/dielectron/papaframework/PairAnalysisVarManager.cxx @@ -243,6 +243,7 @@ ClassImp(PairAnalysisVarManager) {"Centrality", "centrality_{V0M}", "(%)"}, {"Nevents", "N_{evt}", ""}, + {"EventStartTime", "t_{start}", "(ns)"}, {"RunNumber", "run", ""}, {"Ybeam", "#it{y}_{beam}", ""}, {"MixingBin", "mixing bin", ""}, diff --git a/analysis/PWGDIL/dielectron/papaframework/PairAnalysisVarManager.h b/analysis/PWGDIL/dielectron/papaframework/PairAnalysisVarManager.h index b51c654b3710a13be67ef04ef1aeb433d4e52535..521dc4075440e74a03860b07087522dfb2bee412 100644 --- a/analysis/PWGDIL/dielectron/papaframework/PairAnalysisVarManager.h +++ b/analysis/PWGDIL/dielectron/papaframework/PairAnalysisVarManager.h @@ -24,6 +24,7 @@ #include <CbmRichElectronIdAnn.h> #include <CbmRichHit.h> #include <CbmRichRing.h> +#include <CbmRichUtil.h> #include <CbmStsHit.h> #include <CbmStsTrack.h> #include <CbmTofHit.h> @@ -863,6 +864,92 @@ inline void PairAnalysisVarManager::FillVarPairAnalysisTrack(const PairAnalysisT values[kTofisMC] = track->TestBit(BIT(14 + ToIntegralType(ECbmModuleId::kTof))); values[kWeight] = track->GetWeight(); + //Apply correct weighting to tracks from inmed and qgp. For this we need the mass of the mother + PairAnalysisMC* mc = PairAnalysisMC::Instance(); + if (mc->HasMC() && track->GetMCTrack()) { + CbmMCTrack* mainMCtrack = track->GetMCTrack(); + Int_t mainMotherId = mainMCtrack->GetMotherId(); + CbmMCTrack* mother = mc->GetMCTrackFromMCEvent(mainMotherId); + if (mother) { + Int_t mainMotherPdg = mother->GetPdgCode(); + if (values[kThermalScaling] == 3) { + Double_t mass[170] = { + 0.0195, 0.0395, 0.0595, 0.0795, 0.0995, 0.1195, 0.1395, 0.1595, 0.1795, 0.1995, 0.2195, 0.2395, 0.2595, + 0.2795, 0.2995, 0.3195, 0.3395, 0.3595, 0.3795, 0.3995, 0.4195, 0.4395, 0.4595, 0.4795, 0.4995, 0.5195, + 0.5395, 0.5595, 0.5795, 0.5995, 0.6195, 0.6395, 0.6595, 0.6795, 0.6995, 0.7195, 0.7395, 0.7595, 0.7795, + 0.7995, 0.8195, 0.8395, 0.8595, 0.8795, 0.8995, 0.9195, 0.9395, 0.9595, 0.9795, 0.9995, 1.0195, 1.0395, + 1.0595, 1.0795, 1.0995, 1.1195, 1.1395, 1.1595, 1.1795, 1.1995, 1.2195, 1.2395, 1.2595, 1.2795, 1.2995, + 1.3195, 1.3395, 1.3595, 1.3795, 1.3995, 1.4195, 1.4395, 1.4595, 1.4795, 1.4995, 1.5195, 1.5395, 1.5595, + 1.5795, 1.5995, 1.6195, 1.6395, 1.6595, 1.6795, 1.6995, 1.7195, 1.7395, 1.7595, 1.7795, 1.7995, 1.8195, + 1.8395, 1.8595, 1.8795, 1.8995, 1.9195, 1.9395, 1.9595, 1.9795, 1.9995, 2.0195, 2.0395, 2.0595, 2.0795, + 2.0995, 2.1195, 2.1395, 2.1595, 2.1795, 2.1995, 2.2195, 2.2395, 2.2595, 2.2795, 2.2995, 2.3195, 2.3395, + 2.3595, 2.3795, 2.3995, 2.4195, 2.4395, 2.4595, 2.4795, 2.4995, 2.5195, 2.5395, 2.5595, 2.5795, 2.5995, + 2.6195, 2.6395, 2.6595, 2.6795, 2.6995, 2.7195, 2.7395, 2.7595, 2.7795, 2.7995, 2.8195, 2.8395, 2.8595, + 2.8795, 2.8995, 2.9195, 2.9395, 2.9595, 2.9795, 2.9995, 3.0195, 3.0395, 3.0595, 3.0795, 3.0995, 3.1195, + 3.1395, 3.1595, 3.1795, 3.1995, 3.2195, 3.2395, 3.2595, 3.2795, 3.2995, 3.3195, 3.3395, 3.3595, 3.3795, + 3.3995}; + + if (mainMotherPdg == 99009011) { + //inmed 12AGeV + Double_t scale[170] = { + 41.706, 18.918, 11.465, 8.4388, 5.9176, 4.9025, 3.8087, 3.0387, 2.5856, + 2.1142, 1.7603, 1.5327, 1.28, 1.1579, 1.0367, 0.89355, 0.81317, 0.71582, + 0.65863, 0.59678, 0.53702, 0.45378, 0.41238, 0.37502, 0.33593, 0.28791, 0.26352, + 0.23939, 0.21167, 0.19479, 0.19204, 0.17492, 0.15811, 0.15479, 0.14935, 0.13803, + 0.1354, 0.11993, 0.1046, 0.08226, 0.073183, 0.055433, 0.043467, 0.033975, 0.028025, + 0.021504, 0.016863, 0.014108, 0.01094, 0.0088095, 0.007324, 0.0057162, 0.0046817, 0.0037459, + 0.0030017, 0.0024459, 0.0020671, 0.0016089, 0.0013754, 0.0011223, 0.00096256, 0.00081647, 0.00072656, + 0.00060776, 0.00051243, 0.00045705, 0.00039636, 0.00036259, 0.00033248, 0.0002953, 0.00027328, 0.00023776, + 0.00022163, 0.00019852, 0.000186, 0.00016846, 0.00015469, 0.00014169, 0.00013343, 0.00011594, 0.00010722, + 0.00010205, 9.1907e-05, 8.3718e-05, 7.5457e-05, 6.7192e-05, 6.2202e-05, 5.7372e-05, 4.8314e-05, 4.5502e-05, + 4.1334e-05, 3.7429e-05, 3.2131e-05, 3.0103e-05, 2.6125e-05, 2.3601e-05, 2.1167e-05, 1.94e-05, 1.7025e-05, + 1.5496e-05, 1.3704e-05, 1.1866e-05, 1.1135e-05, 9.8842e-06, 8.9101e-06, 7.9225e-06, 7.0706e-06, 6.3536e-06, + 5.3786e-06, 4.7179e-06, 4.2128e-06, 4.0015e-06, 3.4118e-06, 3.1864e-06, 2.734e-06, 2.3844e-06, 2.173e-06, + 1.8774e-06, 1.6468e-06, 1.501e-06, 1.3597e-06, 1.2113e-06, 1.0384e-06, 9.4105e-07, 8.4223e-07, 7.434e-07, + 6.5049e-07, 5.8824e-07, 5.3603e-07, 4.6756e-07, 4.1173e-07, 3.5872e-07, 3.2764e-07, 2.9889e-07, 2.5989e-07, + 2.219e-07, 1.9468e-07, 1.816e-07, 1.5707e-07, 1.3565e-07, 1.2619e-07, 1.0919e-07, 1.0071e-07, 8.4632e-08, + 7.6459e-08, 6.829e-08, 6.2046e-08, 5.5335e-08, 4.5937e-08, 4.2426e-08, 3.567e-08, 3.4051e-08, 2.9627e-08, + 2.5249e-08, 2.2767e-08, 2.1054e-08, 1.7873e-08, 1.574e-08, 1.3713e-08, 1.23e-08, 1.1045e-08, 9.5536e-09, + 8.5859e-09, 7.7217e-09, 6.9958e-09, 6.0992e-09, 5.3453e-09, 4.7659e-09, 4.3313e-09, 3.6575e-09}; + TSpline3* weight = new TSpline3("inmedwghts", mass, scale, 170); + TLorentzVector mom; + mother->Get4Momentum(mom); + Double_t corrw = weight->Eval(mom.M()); //mother->GetMass() + values[kWeight] *= corrw; + delete weight; + } + if (mainMotherPdg == 99009111) { + Double_t scale[170] = { + 39.496, 17.961, 11.024, 8.2093, 5.8331, 4.8995, 3.8612, 3.1258, 2.7006, + 2.2465, 1.908, 1.699, 1.4435, 1.3253, 1.2059, 1.049, 0.96753, 0.86685, + 0.81407, 0.75959, 0.70663, 0.61951, 0.58586, 0.55534, 0.51902, 0.46377, 0.4415, + 0.41412, 0.37414, 0.34883, 0.34494, 0.31141, 0.2762, 0.26331, 0.24693, 0.22286, + 0.21697, 0.1972, 0.1841, 0.16097, 0.16352, 0.14345, 0.13096, 0.11911, 0.11399, + 0.10111, 0.0913, 0.08764, 0.077745, 0.071417, 0.067561, 0.05987, 0.055543, 0.050193, + 0.045244, 0.04128, 0.03898, 0.03365, 0.031622, 0.028217, 0.026215, 0.023919, 0.022648, + 0.019915, 0.017524, 0.016145, 0.014357, 0.013362, 0.012368, 0.011036, 0.010198, 0.0088275, + 0.0081762, 0.0072697, 0.00675, 0.0060424, 0.0054788, 0.0049588, 0.0046174, 0.0039685, 0.00363, + 0.0034204, 0.0030534, 0.0027606, 0.0024723, 0.0021893, 0.0020174, 0.0018545, 0.0015584, 0.0014661, + 0.0013315, 0.0012065, 0.0010375, 0.00097456, 0.00084865, 0.00076982, 0.00069371, 0.00063931, 0.00056442, + 0.00051712, 0.00046054, 0.00040174, 0.00037996, 0.00034009, 0.00030921, 0.00027738, 0.00024981, 0.00022659, + 0.00019366, 0.00017153, 0.00015469, 0.00014841, 0.00012783, 0.00012061, 0.00010456, 9.2145e-05, 8.4856e-05, + 7.4087e-05, 6.5675e-05, 6.0496e-05, 5.5386e-05, 4.9865e-05, 4.3202e-05, 3.9571e-05, 3.5821e-05, 3.201e-05, + 2.8322e-05, 2.5886e-05, 2.384e-05, 2.1016e-05, 1.8703e-05, 1.6467e-05, 1.5199e-05, 1.4011e-05, 1.2311e-05, + 1.0621e-05, 9.4155e-06, 8.874e-06, 7.7548e-06, 6.7662e-06, 6.3589e-06, 5.5585e-06, 5.1791e-06, 4.3965e-06, + 4.012e-06, 3.6195e-06, 3.3215e-06, 2.9918e-06, 2.5084e-06, 2.3397e-06, 1.9865e-06, 1.915e-06, 1.6826e-06, + 1.448e-06, 1.3183e-06, 1.231e-06, 1.0551e-06, 9.3811e-07, 8.2511e-07, 7.4714e-07, 6.7735e-07, 5.9142e-07, + 5.3654e-07, 4.8709e-07, 4.4543e-07, 3.9199e-07, 3.4674e-07, 3.1203e-07, 2.862e-07, 2.4391e-07}; + TSpline3* weight = new TSpline3("inmedwghts", mass, scale, 170); + TLorentzVector mom; + mother->Get4Momentum(mom); + Double_t corrw = weight->Eval(mom.M()); + values[kWeight] *= corrw; + delete weight; + } + } + } + } + // Reset ResetArrayData(kParticleMax, values); @@ -1114,8 +1201,8 @@ inline void PairAnalysisVarManager::FillVarMCParticle(const CbmMCTrack* p1, cons if (!mc->HasMC()) return; // Set - CbmMCTrack* mother = 0x0; - // CbmMCTrack* smother = 0x0; + CbmMCTrack* mother = nullptr; + // CbmMCTrack* smother = nullptr; Int_t mLabel1 = p1->GetMotherId(); Int_t mLabel2 = p2->GetMotherId(); if (mLabel1 == mLabel2) mother = mc->GetMCTrackFromMCEvent(mLabel1); @@ -1185,9 +1272,8 @@ inline void PairAnalysisVarManager::FillVarMCTrack(const CbmMCTrack* particle, D if (!mc->HasMC()) return; // Set - CbmMCTrack* mother = 0x0; Int_t mLabel1 = particle->GetMotherId(); - mother = mc->GetMCTrackFromMCEvent(mLabel1); + CbmMCTrack* mother = mc->GetMCTrackFromMCEvent(mLabel1); values[kPdgCode] = particle->GetPdgCode(); values[kPdgCodeMother] = (mother ? mother->GetPdgCode() : -99999.); @@ -1198,12 +1284,12 @@ inline void PairAnalysisVarManager::FillVarMCTrack(const CbmMCTrack* particle, D if (mother->GetPdgCode() == 111) values[kPdgCodeMother] = 3; if (mother->GetPdgCode() == 211 || mother->GetPdgCode() == -211) values[kPdgCodeMother] = 5; if (mother->GetPdgCode() == 2212) values[kPdgCodeMother] = 7; - if (mother->GetPdgCode() == 99009011 || mother->GetPdgCode() == 99009911) values[kPdgCodeMother] = 9; + if (mother->GetPdgCode() == 99009011 || mother->GetPdgCode() == 99009111) values[kPdgCodeMother] = 9; } values[kEMotherMC] = (mother ? mother->GetEnergy() : -99999.); - CbmMCTrack* granni = 0x0; + CbmMCTrack* granni = nullptr; if (mother) granni = mc->GetMCTrackMother(mother); values[kPdgCodeGrandMother] = (granni ? granni->GetPdgCode() : -99999.); //mc->GetMotherPDG(mother); values[kGeantId] = particle->GetGeantProcessId(); @@ -1306,22 +1392,37 @@ inline void PairAnalysisVarManager::FillVarPairAnalysisPair(const PairAnalysisPa /* values[kPdgCodeGrandMother]=-1; */ values[kWeight] = pair->GetWeight(); - if (pair->GetFirstDaughter()->GetMCTrack()) { + if (pair->GetFirstDaughter()->GetMCTrack() || pair->GetSecondDaughter()->GetMCTrack()) { PairAnalysisMC* mc = PairAnalysisMC::Instance(); if (!mc->HasMC()) return; // Set - CbmMCTrack* mother = 0x0; - Int_t mLabel1 = pair->GetFirstDaughter()->GetMCTrack()->GetMotherId(); - mother = mc->GetMCTrackFromMCEvent(mLabel1); - Int_t motherCode = (mother ? mother->GetPdgCode() : -99999.); + + Int_t motherCode = -99999.; + Int_t mLabel1 = -1; + Double_t mMass1 = 0.; + if (pair->GetFirstDaughter()->GetMCTrack()) { + mLabel1 = pair->GetFirstDaughter()->GetMCTrack()->GetMotherId(); + CbmMCTrack* mother = mc->GetMCTrackFromMCEvent(mLabel1); + motherCode = (mother ? mother->GetPdgCode() : -99999.); + if (mother) { + TLorentzVector mom; + mother->Get4Momentum(mom); + mMass1 = mom.M(); + } + } Int_t secondMother = -99999.; Int_t mLabel2 = -1; + Double_t mMass2 = 0.; if (pair->GetSecondDaughter()->GetMCTrack()) { - CbmMCTrack* sm = 0x0; mLabel2 = pair->GetSecondDaughter()->GetMCTrack()->GetMotherId(); - sm = mc->GetMCTrackFromMCEvent(mLabel2); + CbmMCTrack* sm = mc->GetMCTrackFromMCEvent(mLabel2); secondMother = (sm ? sm->GetPdgCode() : -99999.); + if (sm) { + TLorentzVector mom; + sm->Get4Momentum(mom); + mMass2 = mom.M(); + } } if (values[kThermalScaling] == 3) { @@ -1363,8 +1464,23 @@ inline void PairAnalysisVarManager::FillVarPairAnalysisPair(const PairAnalysisPa 2.5249e-08, 2.2767e-08, 2.1054e-08, 1.7873e-08, 1.574e-08, 1.3713e-08, 1.23e-08, 1.1045e-08, 9.5536e-09, 8.5859e-09, 7.7217e-09, 6.9958e-09, 6.0992e-09, 5.3453e-09, 4.7659e-09, 4.3313e-09, 3.6575e-09}; TSpline3* weight = new TSpline3("inmedwghts", mass, scale, 170); - Double_t corrw = weight->Eval(values[PairAnalysisVarManager::kM]); - values[kWeight] *= corrw; + Double_t corrw = 0.; + //Same mother: apply weight only once + if (mLabel1 == mLabel2) { + corrw = weight->Eval(mMass1); + values[kWeight] *= corrw; + } + else { // different mothers -> apply weight for each track that comes from thermal source + if (motherCode == 99009011) { + corrw = weight->Eval(mMass1); + values[kWeight] *= corrw; + } + if (secondMother == 99009011) { + corrw = weight->Eval(mMass2); + values[kWeight] *= corrw; + } + } + delete weight; } if (motherCode == 99009111 || secondMother == 99009111) { @@ -1389,8 +1505,24 @@ inline void PairAnalysisVarManager::FillVarPairAnalysisPair(const PairAnalysisPa 1.448e-06, 1.3183e-06, 1.231e-06, 1.0551e-06, 9.3811e-07, 8.2511e-07, 7.4714e-07, 6.7735e-07, 5.9142e-07, 5.3654e-07, 4.8709e-07, 4.4543e-07, 3.9199e-07, 3.4674e-07, 3.1203e-07, 2.862e-07, 2.4391e-07}; TSpline3* weight = new TSpline3("inmedwghts", mass, scale, 170); - Double_t corrw = weight->Eval(values[PairAnalysisVarManager::kM]); - values[kWeight] *= corrw; + + Double_t corrw = 0.; + //Same mother: apply weight only once + if (mLabel1 == mLabel2) { + corrw = weight->Eval(mMass1); + values[kWeight] *= corrw; + } + else { // different mothers -> apply weight for each track that comes from thermal source + if (motherCode == 99009111) { + corrw = weight->Eval(mMass1); + values[kWeight] *= corrw; + } + if (secondMother == 99009111) { + corrw = weight->Eval(mMass2); + values[kWeight] *= corrw; + } + } + delete weight; } } @@ -1426,11 +1558,24 @@ inline void PairAnalysisVarManager::FillVarPairAnalysisPair(const PairAnalysisPa 1.54601e-06, 1.34124e-06, 1.16263e-06, 1.00705e-06, 8.71694e-07, 7.54053e-07, 6.51895e-07, 5.63264e-07, 4.86443e-07, 4.19912e-07, 3.6233e-07, 3.12522e-07, 2.69465e-07, 2.32265e-07, 2.00144e-07, 1.72419e-07, 1.48498e-07, 1.27867e-07, 1.10079e-07, 9.47489e-08, 8.15401e-08, 7.01617e-08, 6.03625e-08, 5.19253e-08, - 4.46624e-08, 3.84113e-08, 3.3032e-08, 2.84035e-08, 2.44235e-08, - }; + 4.46624e-08, 3.84113e-08, 3.3032e-08, 2.84035e-08, 2.44235e-08}; TSpline3* weight = new TSpline3("inmedwghts", mass, scale, 125); - Double_t corrw = weight->Eval(values[PairAnalysisVarManager::kM]); - values[kWeight] *= corrw; + Double_t corrw = 0.; + //Same mother: apply weight only once + if (mLabel1 == mLabel2) { + corrw = weight->Eval(mMass1); + values[kWeight] *= corrw; + } + else { // different mothers -> apply weight for each track that comes from thermal source + if (motherCode == 99009011) { + corrw = weight->Eval(mMass1); + values[kWeight] *= corrw; + } + if (secondMother == 99009011) { + corrw = weight->Eval(mMass2); + values[kWeight] *= corrw; + } + } delete weight; } } //end thermal 7 @@ -1889,7 +2034,7 @@ inline void PairAnalysisVarManager::SetEvent(PairAnalysisEvent* const ev) // Reset if (fgKFVertex) delete fgKFVertex; - fgKFVertex = 0x0; + fgKFVertex = nullptr; if (fgVertexMC) fgVertexMC->Reset(); else fgVertexMC = new CbmVertex();