Skip to content

Commit ae1a700

Browse files
committed
Add weight for mixing
1 parent 6d861bd commit ae1a700

File tree

1 file changed

+43
-3
lines changed

1 file changed

+43
-3
lines changed

PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,39 @@
3939
#include <string>
4040
#include <vector>
4141

42+
// o2 includes.
43+
#include "CCDB/BasicCCDBManager.h"
44+
#include "CCDB/CcdbApi.h"
45+
4246
using namespace o2;
4347
using namespace o2::framework;
4448
using namespace o2::framework::expressions;
4549
using namespace o2::soa;
4650

4751
struct lambdaspincorrderived {
52+
53+
struct : ConfigurableGroup {
54+
Configurable<std::string> cfgURL{"cfgURL", "http://alice-ccdb.cern.ch", "Address of the CCDB to browse"};
55+
Configurable<int64_t> nolaterthan{"ccdb-no-later-than", std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count(), "Latest acceptable timestamp of creation for the object"};
56+
} cfgCcdbParam;
57+
58+
// Enable access to the CCDB for the offset and correction constants and save them in dedicated variables.
59+
Service<o2::ccdb::BasicCCDBManager> ccdb;
60+
o2::ccdb::CcdbApi ccdbApi;
61+
TH3D* hweight1;
62+
TH3D* hweight2;
63+
TH3D* hweight3;
64+
65+
Configurable<std::string> ConfWeightPathLL{"ConfWeightPathLL", "Users/s/skundu/My/Object/spincorr/cent010LL", "Weight path"};
66+
Configurable<std::string> ConfWeightPathALAL{"ConfWeightPathALAL", "Users/s/skundu/My/Object/spincorr/cent010LL", "Weight path"};
67+
Configurable<std::string> ConfWeightPathLAL{"ConfWeightPathLAL", "Users/s/skundu/My/Object/spincorr/cent010LL", "Weight path"};
68+
4869
// event sel/////////
4970
Configurable<float> centMin{"centMin", 0, "Minimum Centrality"};
5071
Configurable<float> centMax{"centMax", 80, "Maximum Centrality"};
5172

5273
// Lambda selection ////////////
74+
Configurable<bool> useweight{"useweight", 1, "Use weight"};
5375
Configurable<bool> usePDGM{"usePDGM", 1, "Use PDG mass"};
5476
Configurable<bool> checkDoubleStatus{"checkDoubleStatus", 0, "Check Double status"};
5577
Configurable<float> cosPA{"cosPA", 0.995, "Cosine Pointing Angle"};
@@ -101,6 +123,16 @@ struct lambdaspincorrderived {
101123
histos.add("hSparseLambdaLambdaMixed", "hSparseLambdaLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisCentrality, configThnAxisR}, true);
102124
histos.add("hSparseLambdaAntiLambdaMixed", "hSparseLambdaAntiLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisCentrality, configThnAxisR}, true);
103125
histos.add("hSparseAntiLambdaAntiLambdaMixed", "hSparseAntiLambdaAntiLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisCentrality, configThnAxisR}, true);
126+
127+
ccdb->setURL(cfgCcdbParam.cfgURL);
128+
ccdbApi.init("http://alice-ccdb.cern.ch");
129+
ccdb->setCaching(true);
130+
ccdb->setLocalObjectValidityChecking();
131+
ccdb->setCreatedNotAfter(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count());
132+
LOGF(info, "Getting alignment offsets from the CCDB...");
133+
hweight1 = ccdb->getForTimeStamp<TH3D>(ConfWeightPathLL.value, cfgCcdbParam.nolaterthan.value);
134+
hweight2 = ccdb->getForTimeStamp<TH3D>(ConfWeightPathALAL.value, cfgCcdbParam.nolaterthan.value);
135+
hweight3 = ccdb->getForTimeStamp<TH3D>(ConfWeightPathLAL.value, cfgCcdbParam.nolaterthan.value);
104136
}
105137

106138
template <typename T>
@@ -210,14 +242,22 @@ struct lambdaspincorrderived {
210242
histos.fill(HIST("hAntiLambdaSameForALAL"), particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F));
211243
}
212244
} else if (datatype == 1) {
245+
double weight1 = 1.0;
246+
double weight2 = 1.0;
247+
double weight3 = 1.0;
248+
if (useweight) {
249+
weight1 = hweight1->GetBinContent(hweight1->FindBin(particle1.Pt() + 0.001, particle1.Eta() + 0.001, particle1.Phi() + 0.001));
250+
weight2 = hweight2->GetBinContent(hweight2->FindBin(particle1.Pt() + 0.001, particle1.Eta() + 0.001, particle1.Phi() + 0.001));
251+
weight3 = hweight3->GetBinContent(hweight3->FindBin(particle1.Pt() + 0.001, particle1.Eta() + 0.001, particle1.Phi() + 0.001));
252+
}
213253
if (tag1 == 0 && tag2 == 0) {
214-
histos.fill(HIST("hSparseLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, centrality, deltaR);
254+
histos.fill(HIST("hSparseLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, centrality, deltaR, weight1);
215255
histos.fill(HIST("hLambdaMixForLL"), particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F));
216256
} else if ((tag1 == 0 && tag2 == 1) || (tag1 == 1 && tag2 == 0)) {
217-
histos.fill(HIST("hSparseLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, centrality, deltaR);
257+
histos.fill(HIST("hSparseLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, centrality, deltaR, weight2);
218258
histos.fill(HIST("hLambdaMixForLAL"), particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F));
219259
} else if (tag1 == 1 && tag2 == 1) {
220-
histos.fill(HIST("hSparseAntiLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, centrality, deltaR);
260+
histos.fill(HIST("hSparseAntiLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, centrality, deltaR, weight3);
221261
histos.fill(HIST("hAntiLambdaMixForALAL"), particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F));
222262
}
223263
}

0 commit comments

Comments
 (0)