Skip to content

Commit e297eae

Browse files
authored
Synthetic flow exercise: add Xi-enriched, flow-enabled generator (#1793)
* Synthe-flow: move config histos to ccdb * Update generator_pythia8_syntheFlowXi.C * Add test script
1 parent 0fe6797 commit e297eae

File tree

4 files changed

+393
-7
lines changed

4 files changed

+393
-7
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[GeneratorExternal]
2+
fileName=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator_pythia8_syntheFlowXi.C
3+
funcName=generator_syntheFlowXi()
4+
5+
[GeneratorPythia8]
6+
config=${O2DPG_MC_CONFIG_ROOT}/MC/config/common/pythia8/generator/pythia8_hi.cfg
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
int External()
2+
{
3+
std::string path{"o2sim_Kine.root"};
4+
5+
TFile file(path.c_str(), "READ");
6+
if (file.IsZombie())
7+
{
8+
std::cerr << "Cannot open ROOT file " << path << "\n";
9+
return 1;
10+
}
11+
12+
auto tree = (TTree *)file.Get("o2sim");
13+
if (!tree)
14+
{
15+
std::cerr << "Cannot find tree o2sim in file " << path << "\n";
16+
return 1;
17+
}
18+
std::vector<o2::MCTrack> *tracks{};
19+
tree->SetBranchAddress("MCTrack", &tracks);
20+
21+
auto nEvents = tree->GetEntries();
22+
if (nEvents < 1)
23+
{
24+
std::cerr << "No events actually generated: not OK!";
25+
return 1;
26+
}
27+
return 0;
28+
}

MC/config/PWGLF/pythia8/generator_pythia8_syntheFlow.C

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
#include "TRandom3.h"
88
#include "TParticlePDG.h"
99
#include "TDatabasePDG.h"
10+
#include "CCDB/BasicCCDBManager.h"
11+
#include "TH1F.h"
12+
#include "TH1D.h"
1013

1114
#include <map>
1215
#include <unordered_set>
@@ -19,15 +22,25 @@ public:
1922
lutGen = new o2::eventgen::FlowMapper();
2023

2124
// -------- CONFIGURE SYNTHETIC FLOW ------------
22-
// specify a v2 vs pT here
23-
TFile *filehep = new TFile("/Users/daviddc/Downloads/HEPData-ins1116150-v1-Table_1.root", "READ");
24-
TH1D *hv = (TH1D*) filehep->Get("Table 1/Hist1D_y6");
25-
26-
TFile *fileEcc = new TFile("/Users/daviddc/Downloads/eccentricityvsb.root", "READ");
27-
TH1D *hEccentricities = (TH1D*) fileEcc->Get("hEccentricities");
25+
// establish connection to ccdb
26+
o2::ccdb::CcdbApi ccdb_api;
27+
ccdb_api.init("https://alice-ccdb.cern.ch");
28+
29+
// config was placed at midpoint of run 544122, retrieve that
30+
std::map<string, string> metadataRCT, headers;
31+
headers = ccdb_api.retrieveHeaders("RCT/Info/RunInformation/544122", metadataRCT, -1);
32+
int64_t tsSOR = atol(headers["SOR"].c_str());
33+
int64_t tsEOR = atol(headers["EOR"].c_str());
34+
int64_t midRun = 0.5*tsSOR+0.5*tsEOR;
35+
36+
map<string, string> metadata; // can be empty
37+
auto list = ccdb_api.retrieveFromTFileAny<TList>("Users/d/ddobrigk/syntheflow", metadata, midRun);
38+
39+
TH1D *hv2vspT = (TH1D*) list->FindObject("hFlowVsPt_ins1116150_v1_Table_1");
40+
TH1D *heccvsb = (TH1D*) list->FindObject("hEccentricityVsB");
2841

2942
cout<<"Generating LUT for flow test"<<endl;
30-
lutGen->CreateLUT(hv, hEccentricities);
43+
lutGen->CreateLUT(hv2vspT, heccvsb);
3144
cout<<"Finished creating LUT!"<<endl;
3245
// -------- END CONFIGURE SYNTHETIC FLOW ------------
3346
}

0 commit comments

Comments
 (0)