Skip to content

Commit

Permalink
[ALIROOT-8678] Set weight outside the macro
Browse files Browse the repository at this point in the history
  • Loading branch information
gconesab committed Dec 15, 2021
1 parent e2b4c60 commit 1fd6d79
Showing 1 changed file with 24 additions and 11 deletions.
35 changes: 24 additions & 11 deletions MC/CustomGenerators/PWGGA/Pythia8Weighted_GammaTriggerAndJet.C
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@
/// * PHSRun2 : PHOS |eta| < 0.13, 250 < phi < 320
/// * PHSDMC : DCal+PHOS |eta| < 0.7, 250 < phi < 327
/// * EMCPHSDMC: EMCal+DCal+PHOS |eta| < 0.7, 250 < phi < 327 & 80 < phi < 187
///
///
/// * Weight to be applied to the pT hard exponential distribution.
///
/// Options are passed via the macro options, first the "acceptance string" and then the "weight string"
/// in this way: "acceptance_weight", for example "kFullDetector_5.13"
///
/// This macro can only be used for AliRoot containing the setting of the weight,
/// from v5-09-54m, v5-09-55b, v5-09-56f. On master from April 2021

Expand All @@ -29,23 +34,28 @@
///
AliGenerator *
GeneratorCustom
(TString opt = "kFullDetector")
(TString opt = "kFullDetector_5.13")
{
// Parse the option into detector string and weight
TObjArray *oa = opt.Tokenize("_");
TString det = ( (TObjString*) oa->At(0) )->GetString();
Float_t weight = atof((( (TObjString*) oa->At(1) )->GetString()).Data());

// acceptance
Int_t acceptance = kCalorimeterAcceptance_FullDetector;
if (opt.EqualTo("FullDetector"))
if (det.EqualTo("FullDetector"))
acceptance = kCalorimeterAcceptance_FullDetector;
if (opt.EqualTo("EMCRun1"))
if (det.EqualTo("EMCRun1"))
acceptance = kCalorimeterAcceptance_EMCRun1;
if (opt.EqualTo("PHSRun1"))
if (det.EqualTo("PHSRun1"))
acceptance = kCalorimeterAcceptance_PHSRun1;
if (opt.EqualTo("EMCRun2"))
if (det.EqualTo("EMCRun2"))
acceptance = kCalorimeterAcceptance_EMCRun2;
if (opt.EqualTo("PHSRun2"))
if (det.EqualTo("PHSRun2"))
acceptance = kCalorimeterAcceptance_PHSRun2;
if (opt.EqualTo("PHSDMC"))
if (det.EqualTo("PHSDMC"))
acceptance = kCalorimeterAcceptance_PHSDMC;
if (opt.EqualTo("EMCPHSDMC"))
if (det.EqualTo("EMCPHSDMC"))
acceptance = kCalorimeterAcceptance_EMCPHSDMC;

AliGenerator * gener = 0;
Expand All @@ -68,7 +78,10 @@ GeneratorCustom
}

// Set the desired weight
((AliGenPythiaPlus*) gener)->SetWeightPower(4.);

((AliGenPythiaPlus*) gener)->SetWeightPower(weight);

printf("Pythia8Weighted_GammaTriggerAndJet.C - Set weight %f for acceptance <%s> and process <%s>\n",
weight, det.Data(),processConfig.Data());

return gener;
}

0 comments on commit 1fd6d79

Please sign in to comment.