From 87058ac8b050dea5d28b891a05cf57be1294d659 Mon Sep 17 00:00:00 2001 From: Gustavo Conesa Date: Mon, 28 Sep 2020 14:44:23 +0200 Subject: [PATCH] Macros to run Pythia6 and EPOS with user defined trigger on MC events and example used defined trigger macro --- MC/CustomGenerators/DPG/EPOS_UserTrigger.C | 31 ++++++++++++ MC/CustomGenerators/DPG/Pythia6_UserTrigger.C | 31 ++++++++++++ MC/CustomGenerators/DPG/UserTrigger.C | 49 +++++++++++++++++++ 3 files changed, 111 insertions(+) create mode 100644 MC/CustomGenerators/DPG/EPOS_UserTrigger.C create mode 100644 MC/CustomGenerators/DPG/Pythia6_UserTrigger.C create mode 100644 MC/CustomGenerators/DPG/UserTrigger.C diff --git a/MC/CustomGenerators/DPG/EPOS_UserTrigger.C b/MC/CustomGenerators/DPG/EPOS_UserTrigger.C new file mode 100644 index 00000000..b4558f4e --- /dev/null +++ b/MC/CustomGenerators/DPG/EPOS_UserTrigger.C @@ -0,0 +1,31 @@ +/// +/// \file EPOS_UserTrigger.C +/// \brief Configuration of EPOSLHC with external trigger user defined +/// +/// Generate EPOSLHC events, while the event is generated, check that +/// the user trigger conditions on the event are fulfilled. The user trigger +/// must be defined in macro UserTrigger.C +/// +/// \author Luca Micheletti +/// \author Gustavo Conesa Balbastre + +#if !defined(__CINT__) || defined(__MAKECINT__) + #include "UserTrigger.C" +#endif + +//------ +/// Main, configure EPOSLHC events via standard configuration in GeneratorConfig.C +/// adding an external event trigger defined in UserTrigger.C +//------ +AliGenerator * GeneratorCustom() +{ + AliGenerator * generator = GeneratorEPOSLHC(); + +#if defined(__CINT__) + gROOT->LoadMacro("UserTrigger.C+"); +#endif + + UserTrigger(generator); + + return generator; +} diff --git a/MC/CustomGenerators/DPG/Pythia6_UserTrigger.C b/MC/CustomGenerators/DPG/Pythia6_UserTrigger.C new file mode 100644 index 00000000..ef86e4fa --- /dev/null +++ b/MC/CustomGenerators/DPG/Pythia6_UserTrigger.C @@ -0,0 +1,31 @@ +/// +/// \file Pythia6_UserTrigger.C +/// \brief Configuration of Pythia6 with external trigger user defined +/// +/// Generate PYTHIA6 events, while the event is generated, check that +/// the user trigger conditions on the event are fulfilled. The user trigger +/// must be defined in macro UserTrigger.C +/// +/// \author Luca Micheletti +/// \author Gustavo Conesa Balbastre + +#if !defined(__CINT__) || defined(__MAKECINT__) + #include "UserTrigger.C" +#endif + +//------ +/// Main, configure PYTHIA6 events via standard configuration in GeneratorConfig.C +/// adding an external event trigger defined in UserTrigger.C +//------ +AliGenerator * GeneratorCustom() +{ + AliGenerator * generator = GeneratorPythia6(); + +#if defined(__CINT__) + gROOT->LoadMacro("UserTrigger.C+"); +#endif + + UserTrigger(generator); + + return generator; +} diff --git a/MC/CustomGenerators/DPG/UserTrigger.C b/MC/CustomGenerators/DPG/UserTrigger.C new file mode 100644 index 00000000..0a4af234 --- /dev/null +++ b/MC/CustomGenerators/DPG/UserTrigger.C @@ -0,0 +1,49 @@ +/// +/// \file UserTrigger.C +/// \brief Example of user defined trigger, to be called by main CustomGenerator macro +/// +/// Example of user trigger with simple multiplicity event selection. +/// In Root5 it must be compiled +/// +/// \author Luca Micheletti +/// \author Gustavo Conesa Balbastre + + +#include "AliStack.h" +#include "AliGenerator.h" + +//------ +/// User trigger logic to accept the event +/// Here simple multiplicity selection +//------ +Bool_t UserTriggerFunction(AliStack *stack) +{ + printf("____________________________\n"); + printf("USER TRIGGER IMPLEMENTATION \n"); + + Int_t nTracks = stack->GetNtrack(); + printf("n Tracks = %i \n",nTracks); + + if ( nTracks > 120 ) + { + printf("\t accepted!\n"); + return kTRUE; + } + else + { + printf("\t rejected!\n"); + return kFALSE; + } +} + +//------ +/// Main, pass the generator and set the user trigger +//------ +void UserTrigger(AliGenerator * generator) +{ + Bool_t (*funcUserTrigger)(AliStack*) = UserTriggerFunction; + +//printf("*-*-*-* USER FUNC %p\n",funcUserTrigger); + + generator->SetUserTrigger(funcUserTrigger); +}