Skip to content

Commit

Permalink
Merge pull request #423 from gconesab/master
Browse files Browse the repository at this point in the history
Macros to run Pythia6 and EPOS with user defined trigger on MC events…
  • Loading branch information
gconesab authored Sep 28, 2020
2 parents 7ee392b + 87058ac commit 2d7bab2
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 0 deletions.
31 changes: 31 additions & 0 deletions MC/CustomGenerators/DPG/EPOS_UserTrigger.C
Original file line number Diff line number Diff line change
@@ -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 <luca.micheletti@cern.ch>
/// \author Gustavo Conesa Balbastre <gustavo.conesa.balbastre@cern.ch>

#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;
}
31 changes: 31 additions & 0 deletions MC/CustomGenerators/DPG/Pythia6_UserTrigger.C
Original file line number Diff line number Diff line change
@@ -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 <luca.micheletti@cern.ch>
/// \author Gustavo Conesa Balbastre <gustavo.conesa.balbastre@cern.ch>

#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;
}
49 changes: 49 additions & 0 deletions MC/CustomGenerators/DPG/UserTrigger.C
Original file line number Diff line number Diff line change
@@ -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 <luca.micheletti@cern.ch>
/// \author Gustavo Conesa Balbastre <Gustavo.Conesa.Balbastre@cern.ch>


#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);
}

0 comments on commit 2d7bab2

Please sign in to comment.