Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions MC/config/PWGLF/ini/GeneratorLF_SyntheFlowXi.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[GeneratorExternal]
fileName=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator_pythia8_syntheFlowXi.C
funcName=generator_syntheFlowXi()

[GeneratorPythia8]
config=${O2DPG_MC_CONFIG_ROOT}/MC/config/common/pythia8/generator/pythia8_hi.cfg
28 changes: 28 additions & 0 deletions MC/config/PWGLF/ini/tests/GeneratorLF_SyntheFlowXi.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
int External()
{
std::string path{"o2sim_Kine.root"};

TFile file(path.c_str(), "READ");
if (file.IsZombie())
{
std::cerr << "Cannot open ROOT file " << path << "\n";
return 1;
}

auto tree = (TTree *)file.Get("o2sim");
if (!tree)
{
std::cerr << "Cannot find tree o2sim in file " << path << "\n";
return 1;
}
std::vector<o2::MCTrack> *tracks{};
tree->SetBranchAddress("MCTrack", &tracks);

auto nEvents = tree->GetEntries();
if (nEvents < 1)
{
std::cerr << "No events actually generated: not OK!";
return 1;
}
return 0;
}
27 changes: 20 additions & 7 deletions MC/config/PWGLF/pythia8/generator_pythia8_syntheFlow.C
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
#include "TRandom3.h"
#include "TParticlePDG.h"
#include "TDatabasePDG.h"
#include "CCDB/BasicCCDBManager.h"
#include "TH1F.h"
#include "TH1D.h"

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

// -------- CONFIGURE SYNTHETIC FLOW ------------
// specify a v2 vs pT here
TFile *filehep = new TFile("/Users/daviddc/Downloads/HEPData-ins1116150-v1-Table_1.root", "READ");
TH1D *hv = (TH1D*) filehep->Get("Table 1/Hist1D_y6");

TFile *fileEcc = new TFile("/Users/daviddc/Downloads/eccentricityvsb.root", "READ");
TH1D *hEccentricities = (TH1D*) fileEcc->Get("hEccentricities");
// establish connection to ccdb
o2::ccdb::CcdbApi ccdb_api;
ccdb_api.init("https://alice-ccdb.cern.ch");

// config was placed at midpoint of run 544122, retrieve that
std::map<string, string> metadataRCT, headers;
headers = ccdb_api.retrieveHeaders("RCT/Info/RunInformation/544122", metadataRCT, -1);
int64_t tsSOR = atol(headers["SOR"].c_str());
int64_t tsEOR = atol(headers["EOR"].c_str());
int64_t midRun = 0.5*tsSOR+0.5*tsEOR;

map<string, string> metadata; // can be empty
auto list = ccdb_api.retrieveFromTFileAny<TList>("Users/d/ddobrigk/syntheflow", metadata, midRun);

TH1D *hv2vspT = (TH1D*) list->FindObject("hFlowVsPt_ins1116150_v1_Table_1");
TH1D *heccvsb = (TH1D*) list->FindObject("hEccentricityVsB");

cout<<"Generating LUT for flow test"<<endl;
lutGen->CreateLUT(hv, hEccentricities);
lutGen->CreateLUT(hv2vspT, heccvsb);
cout<<"Finished creating LUT!"<<endl;
// -------- END CONFIGURE SYNTHETIC FLOW ------------
}
Expand Down
Loading