Skip to content

Commit 8ebebf9

Browse files
parameter configuration saved in O2DPG, cleaner but a lot less flexible
1 parent 8bae689 commit 8ebebf9

9 files changed

Lines changed: 72 additions & 39 deletions

‎MC/config/PWGGAJE/external/generator/parametrisedJetModel/generator_pythia8_box_parametrisedModel_pythia6Fragmentation.C‎

Lines changed: 36 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ using namespace Pythia8;
3232
// "simLog": false,
3333
// "sglGenRAA": 0.45,
3434
// "sglGenTAA": 23.38,
35-
// "sglCutoffSteepNess": 15,
35+
// "sglCutoffSteepness": 15,
3636
// "sglCutoffAbscissa": 10,
3737
// "fallSpecterSlopeLog": 10.833274,
3838
// "fallSpecterAffinePowerConstantTerm": -5.476804,
@@ -50,36 +50,40 @@ using namespace Pythia8;
5050
class GeneratorParametrisedJetModel : public o2::eventgen::GeneratorPythia8 {
5151
public:
5252
/// constructor
53-
GeneratorParametrisedJetModel(std::string inputSimParametersPath, std::string inputSimParametersFileName, bool generateUE, bool generateSignal = true) : mInputSimParametersPath{inputSimParametersPath}, mInputSimParametersFileName{inputSimParametersFileName}, mGenerateUE{generateUE}, mGenerateSignal{generateSignal} {
53+
GeneratorParametrisedJetModel(std::string inputSimParametersFileName, bool generateUE, bool generateSignal = true) : mInputSimParametersFileName{inputSimParametersFileName}, mGenerateUE{generateUE}, mGenerateSignal{generateSignal} {
5454

5555
if (!generateUE && !generateSignal) {
5656
cout << "Both the UE and the signal generation should not be off at the same time" << endl;
5757
exit(1);
5858
}
5959

60-
std::string inputFilePathName = "alien://" + inputSimParametersPath + inputSimParametersFileName;
61-
if (!gGrid) {
62-
TGrid::Connect("alien://");
63-
if (!gGrid) {
64-
LOG(fatal) << "AliEn connection failed, check token.";
65-
exit(1);
66-
}
67-
}
68-
// fetch and copy the .json file to the sim work directory
69-
std::string outputPath = "./";
70-
TString aliencp = Form("alien_cp alien://%s%s file:%s%s", inputSimParametersPath.c_str(),
71-
inputSimParametersFileName.c_str(), outputPath.c_str(),
72-
inputSimParametersFileName.c_str()); // an internal operation in ROOT that discards the
73-
// JSON file directly (smaller than 300 bytes and if
74-
// a bit bigger it would discard the file because it
75-
// understands it's not a ROOT file), thus one
76-
// cannot use TFile::Cp()
77-
if (gSystem->Exec(aliencp.Data()) != 0) {
78-
cout << "Error: Sim parameters .json file " << inputFilePathName << " does not exist!" << endl;
79-
exit(1);
80-
}
60+
// old: retrieving from GRID; very flexible but to be avoided because poor reproduceability if file is changed etc for CI tests and analyses
61+
// std::string inputFilePathName = "alien://" + inputSimParametersPath + inputSimParametersFileName;
62+
// if (!gGrid) {
63+
// TGrid::Connect("alien://");
64+
// if (!gGrid) {
65+
// LOG(fatal) << "AliEn connection failed, check token.";
66+
// exit(1);
67+
// }
68+
// }
69+
// // fetch and copy the .json file to the sim work directory
70+
// std::string outputPath = "./";
71+
// TString aliencp = Form("alien_cp alien://%s%s file:%s%s", inputSimParametersPath.c_str(),
72+
// inputSimParametersFileName.c_str(), outputPath.c_str(),
73+
// inputSimParametersFileName.c_str()); // an internal operation in ROOT that discards the
74+
// // JSON file directly (smaller than 300 bytes and if
75+
// // a bit bigger it would discard the file because it
76+
// // understands it's not a ROOT file), thus one
77+
// // cannot use TFile::Cp()
78+
// if (gSystem->Exec(aliencp.Data()) != 0) {
79+
// cout << "Error: Sim parameters .json file " << inputFilePathName << " does not exist!" << endl;
80+
// exit(1);
81+
// }
82+
std::string O2DPG_ROOT(getenv("O2DPG_MC_CONFIG_ROOT"));
83+
std::string inputSimParametersPath = O2DPG_ROOT+"/MC/config/PWGGAJE/external/generator/parametrisedJetModel/paramConfigs/";
84+
std::string inputFilePathName = inputSimParametersPath + inputSimParametersFileName;
8185
// open the file
82-
std::FILE *fjson = std::fopen(inputSimParametersFileName.c_str(), "r");
86+
std::FILE *fjson = std::fopen(inputFilePathName.c_str(), "r");
8387
if (!fjson) {
8488
cout << "Could not open sim parameters file " << inputFilePathName << endl;
8589
exit(1);
@@ -118,7 +122,7 @@ public:
118122
// get parameters for sim
119123
mSglGenRAA = jsonDocument[mConfigurableSimParameterNames.at(0).c_str()].GetDouble();
120124
mSglGenTAA = jsonDocument[mConfigurableSimParameterNames.at(1).c_str()].GetDouble();
121-
mSglCutoffSteepNess = jsonDocument[mConfigurableSimParameterNames.at(2).c_str()].GetDouble();
125+
msglCutoffSteepness = jsonDocument[mConfigurableSimParameterNames.at(2).c_str()].GetDouble();
122126
mSglCutoffAbscissa = jsonDocument[mConfigurableSimParameterNames.at(3).c_str()].GetDouble();
123127
mFallSpecterSlopeLog = jsonDocument[mConfigurableSimParameterNames.at(4).c_str()].GetDouble();
124128
mFallSpecterAffinePowerConstantTerm = jsonDocument[mConfigurableSimParameterNames.at(5).c_str()].GetDouble();
@@ -138,7 +142,7 @@ public:
138142

139143
cout << "param retrieved: mSglGenRAA = " << mSglGenRAA << endl;
140144
cout << "param retrieved: mSglGenTAA = " << mSglGenTAA << endl;
141-
cout << "param retrieved: mSglCutoffSteepNess = " << mSglCutoffSteepNess << endl;
145+
cout << "param retrieved: msglCutoffSteepness = " << msglCutoffSteepness << endl;
142146
cout << "param retrieved: mSglCutoffAbscissa = " << mSglCutoffAbscissa << endl;
143147
cout << "param retrieved: mFallSpecterSlopeLog = " << mFallSpecterSlopeLog << endl;
144148
cout << "param retrieved: mFallSpecterAffinePowerConstantTerm = " << mFallSpecterAffinePowerConstantTerm << endl;
@@ -173,7 +177,7 @@ public:
173177
mJetYieldFit = new TF1("f2", "[0]*[1]*exp(-exp(-[2]*(x-[3]))) * exp([4])*pow(x, [5]+[6]*x)", 0, mPtInfinity); // RAA * TAA * sigmoid(cutoff at [2]) * fit to fulljetSpectrum in pp PYTHIA
174178
mJetYieldFit->SetParameter(0, mSglGenRAA); // rAA (single value for all pt)
175179
mJetYieldFit->SetParameter(1, mSglGenTAA); // <tAA>
176-
mJetYieldFit->SetParameter(2, mSglCutoffSteepNess); // steepness for the cutoff shape; higher is
180+
mJetYieldFit->SetParameter(2, msglCutoffSteepness); // steepness for the cutoff shape; higher is
177181
// steeper, but looks more and more like a
178182
// Heavyside step function as it gets to 50 or 100
179183
mJetYieldFit->SetParameter(3, mSglCutoffAbscissa); // cutoffpoint of hard population, in GeV/c
@@ -378,7 +382,7 @@ public:
378382

379383
private:
380384
bool mDebug = false; // setting to true will display particle lists
381-
std::string mInputSimParametersPath, mInputSimParametersFileName; // input path and file name of .json used to read simulation parameters
385+
std::string mInputSimParametersFileName; // input path and file name of .json used to read simulation parameters
382386

383387
////////////////////////////////////////////////
384388
///////// Common signal and background parameters ////////
@@ -405,7 +409,7 @@ private:
405409
const std::vector<std::string> mConfigurableSimParameterNames = {
406410
"sglGenRAA",
407411
"sglGenTAA",
408-
"sglCutoffSteepNess",
412+
"sglCutoffSteepness",
409413
"sglCutoffAbscissa",
410414
"fallSpecterSlopeLog",
411415
"fallSpecterAffinePowerConstantTerm",
@@ -437,7 +441,7 @@ private:
437441
// signal fit
438442
double mSglGenRAA;
439443
double mSglGenTAA;
440-
double mSglCutoffSteepNess; /// steepness for the cutoff shape; higher is steeper, but looks more and more like a Heavyside step function as it gets to 50 or 100
444+
double msglCutoffSteepness; /// steepness for the cutoff shape; higher is steeper, but looks more and more like a Heavyside step function as it gets to 50 or 100
441445
double mSglCutoffAbscissa; /// minimum pt (in GeV/c) for jet signal distribution; it's a smooth cutoff
442446
double mFallSpecterSlopeLog;
443447
double mFallSpecterAffinePowerConstantTerm;
@@ -452,8 +456,7 @@ private:
452456
};
453457

454458
///___________________________________________________________
455-
FairGenerator *generateParametrisedJetModel(std::string inputSimParametersPath,
456-
std::string inputSimParametersFileName,
459+
FairGenerator *generateParametrisedJetModel(std::string inputSimParametersFileName,
457460
bool generateUE, bool generateSignal = true) {
458-
return new GeneratorParametrisedJetModel(inputSimParametersPath, inputSimParametersFileName, generateUE, generateSignal);
461+
return new GeneratorParametrisedJetModel(inputSimParametersFileName, generateUE, generateSignal);
459462
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"simLog": false,
3+
"sglGenRAA": 0.45,
4+
"sglGenTAA": 23.38,
5+
"sglCutoffSteepness": 15,
6+
"sglCutoffAbscissa": 7,
7+
"fallSpecterSlopeLog": 6.619076,
8+
"fallSpecterAffinePowerConstantTerm": -3.918165,
9+
"fallSpecterAffinePowerSlope": -0.002032,
10+
"bkgAveragePt": 0.764567,
11+
"collMultPowerLawAmplitude": 20.66,
12+
"collMultPowerLawExponent": -1.26971,
13+
"collMultMin": 1681,
14+
"collMultMax": 2400
15+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"simLog": false,
3+
"sglGenRAA": 0.8,
4+
"sglGenTAA": 0.6933,
5+
"sglCutoffSteepness": 15,
6+
"sglCutoffAbscissa": 7,
7+
"fallSpecterSlopeLog": 6.619076,
8+
"fallSpecterAffinePowerConstantTerm": -3.918165,
9+
"fallSpecterAffinePowerSlope": -0.002032,
10+
"bkgAveragePt": 0.732677,
11+
"collMultPowerLawAmplitude": 16.43,
12+
"collMultPowerLawExponent": -0.683784,
13+
"collMultMin": 47,
14+
"collMultMax": 302
15+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
### bkg production using pythia8 box generator, to embed jet-jet production into
22
[GeneratorExternal]
33
fileName = ${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGGAJE/external/generator/parametrisedJetModel/generator_pythia8_box_parametrisedModel_pythia6Fragmentation.C
4-
funcName = generateParametrisedJetModel("/alice/cern.ch/user/a/alandou/Analysis/PWGJE/simSettings/combinatorialBkgClosure/", "parametrisedModel_PbPb_5p36TeV_cent0010.json", true, false)
4+
funcName = generateParametrisedJetModel("parametrisedModel_PbPb_5p36TeV_cent0010.json", true, false)
55

66
[GeneratorPythia8]
77
config=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGGAJE/pythia8/generator/pythia8box_parametrisedModel.cfg
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
### bkg production using pythia8 box generator, to embed jet-jet production into
22
[GeneratorExternal]
33
fileName = ${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGGAJE/external/generator/parametrisedJetModel/generator_pythia8_box_parametrisedModel_pythia6Fragmentation.C
4-
funcName = generateParametrisedJetModel("/alice/cern.ch/user/a/alandou/Analysis/PWGJE/simSettings/combinatorialBkgClosure/", "parametrisedModel_PbPb_5p36TeV_cent0010.json", false, true)
4+
funcName = generateParametrisedJetModel("parametrisedModel_PbPb_5p36TeV_cent0010.json", false, true)
55

66
[GeneratorPythia8]
77
config=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGGAJE/pythia8/generator/pythia8box_parametrisedModel.cfg
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
### bkg production using pythia8 box generator, to embed jet-jet production into
22
[GeneratorExternal]
33
fileName = ${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGGAJE/external/generator/parametrisedJetModel/generator_pythia8_box_parametrisedModel_pythia6Fragmentation.C
4-
funcName = generateParametrisedJetModel("/alice/cern.ch/user/a/alandou/Analysis/PWGJE/simSettings/combinatorialBkgClosure/", "parametrisedModel_PbPb_5p36TeV_cent0010.json", true, true)
4+
funcName = generateParametrisedJetModel("parametrisedModel_PbPb_5p36TeV_cent0010.json", true, true)
55

66
[GeneratorPythia8]
77
config=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGGAJE/pythia8/generator/pythia8box_parametrisedModel.cfg
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
### bkg production using pythia8 box generator, to embed jet-jet production into
22
[GeneratorExternal]
33
fileName = ${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGGAJE/external/generator/parametrisedJetModel/generator_pythia8_box_parametrisedModel_pythia6Fragmentation.C
4-
funcName = generateParametrisedJetModel("/alice/cern.ch/user/a/alandou/Analysis/PWGJE/simSettings/combinatorialBkgClosure/", "parametrisedModel_PbPb_5p36TeV_cent5080.json", true, false)
4+
funcName = generateParametrisedJetModel("parametrisedModel_PbPb_5p36TeV_cent5080.json", true, false)
55

66
[GeneratorPythia8]
77
config=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGGAJE/pythia8/generator/pythia8box_parametrisedModel.cfg
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
### bkg production using pythia8 box generator, to embed jet-jet production into
22
[GeneratorExternal]
33
fileName = ${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGGAJE/external/generator/parametrisedJetModel/generator_pythia8_box_parametrisedModel_pythia6Fragmentation.C
4-
funcName = generateParametrisedJetModel("/alice/cern.ch/user/a/alandou/Analysis/PWGJE/simSettings/combinatorialBkgClosure/", "parametrisedModel_PbPb_5p36TeV_cent5080.json", false, true)
4+
funcName = generateParametrisedJetModel("parametrisedModel_PbPb_5p36TeV_cent5080.json", false, true)
55

66
[GeneratorPythia8]
77
config=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGGAJE/pythia8/generator/pythia8box_parametrisedModel.cfg
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
### bkg production using pythia8 box generator, to embed jet-jet production into
22
[GeneratorExternal]
33
fileName = ${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGGAJE/external/generator/parametrisedJetModel/generator_pythia8_box_parametrisedModel_pythia6Fragmentation.C
4-
funcName = generateParametrisedJetModel("/alice/cern.ch/user/a/alandou/Analysis/PWGJE/simSettings/combinatorialBkgClosure/", "parametrisedModel_PbPb_5p36TeV_cent5080.json", true, true)
4+
funcName = generateParametrisedJetModel("parametrisedModel_PbPb_5p36TeV_cent5080.json", true, true)
55

66
[GeneratorPythia8]
77
config=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGGAJE/pythia8/generator/pythia8box_parametrisedModel.cfg

0 commit comments

Comments
 (0)