Skip to content

Commit 21224f3

Browse files
committed
Addition of TEpEmGen generator, better compilation
1 parent 9e905c3 commit 21224f3

File tree

14 files changed

+2469
-4
lines changed

14 files changed

+2469
-4
lines changed

CMakeLists.txt

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
2+
23
project(AEGIS)
4+
35
add_subdirectory(MICROCERN)
4-
add_subdirectory(THijing)
5-
add_subdirectory(TDPMjet)
6+
7+
add_subdirectory(TEPEMGEN)
8+
9+
if (DEFINED ENV{HIJING_ROOT})
10+
add_subdirectory(THijing)
11+
endif (DEFINED ENV{HIJING_ROOT})
12+
13+
if (DEFINED ENV{DPMJET_ROOT})
14+
add_subdirectory(TDPMjet)
15+
endif (DEFINED ENV{DPMJET_ROOT})
616

717
#Install(DIRECTORY Geometry gconfig DESTINATION share/Detectors/)

MICROCERN/CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,24 @@ include_directories(. kerngen/.)
55

66
file(GLOB SOURCES "*.F" "*.c")
77

8+
if(${CMAKE_SYSTEM} MATCHES Darwin)
9+
add_definitions(-DCERNLIB_LXIA64 -DCERNLIB_BLDLIB -DCERNLIB_CZ -DCERNLIB_PPC)
10+
endif(${CMAKE_SYSTEM} MATCHES Darwin)
11+
if(${CMAKE_SYSTEM} MATCHES Linux)
12+
add_definitions(-DCERNLIB_LINUX -DCERNLIB_BLDLIB -DCERNLIB_CZ)
13+
endif(${CMAKE_SYSTEM} MATCHES Linux)
14+
815
# not on Darwin
916
if(NOT ${CMAKE_SYSTEM} MATCHES Darwin)
1017
file(GLOB REMOVE "lnblnk.c")
1118
list(REMOVE_ITEM SOURCES ${REMOVE})
1219
endif(NOT ${CMAKE_SYSTEM} MATCHES Darwin)
1320

14-
1521
add_library(MICROCERN SHARED ${SOURCES})
1622

1723
install(TARGETS MICROCERN
1824
LIBRARY DESTINATION lib)
1925

20-
2126
if(${CMAKE_SYSTEM} MATCHES Darwin)
2227
set_target_properties(MICROCERN PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
2328
endif(${CMAKE_SYSTEM} MATCHES Darwin)

TEPEMGEN/CMakeLists.txt

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
2+
project(TEPEMGEN C CXX Fortran)
3+
4+
# You need to tell CMake where to find the ROOT installation. This can be done in a number of ways:
5+
# - ROOT built with classic configure/make use the provided $ROOTSYS/etc/cmake/FindROOT.cmake
6+
# - ROOT built with CMake. Add in CMAKE_PREFIX_PATH the installation prefix for ROOT
7+
list(APPEND CMAKE_PREFIX_PATH $ENV{ROOTSYS})
8+
9+
#---Locate the ROOT package and defines a number of variables (e.g. ROOT_INCLUDE_DIRS)
10+
find_package(ROOT REQUIRED COMPONENTS EG)
11+
12+
#---Define useful ROOT functions and macros (e.g. ROOT_GENERATE_DICTIONARY)
13+
include(${ROOT_USE_FILE})
14+
15+
link_directories($ENV{PYTHIA6_ROOT}/lib)
16+
17+
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/.)
18+
ROOT_GENERATE_DICTIONARY(G__TEPEMGEN TGenQEDBg.h TGenEpEmv1.h TEpEmGen.h TEcommon.h LINKDEF TEPEMGENLinkDef.h)
19+
20+
#---Create a shared library with geneated dictionary
21+
add_library(TEPEMGEN SHARED TGenQEDBg.cxx TGenEpEmv1.cxx TEpEmGen.cxx epemgen.f diffcross.f dtrint.f G__TEPEMGEN.cxx)
22+
target_link_libraries(TEPEMGEN ${ROOT_LIBRARIES} pythia6 MICROCERN)
23+
24+
install(TARGETS TEPEMGEN
25+
LIBRARY DESTINATION lib)
26+
27+
if (${ROOT_VERSION} VERSION_GREATER "6.0")
28+
install(
29+
FILES
30+
${CMAKE_CURRENT_BINARY_DIR}/libTEPEMGEN_rdict.pcm
31+
${CMAKE_CURRENT_BINARY_DIR}/libTEPEMGEN.rootmap
32+
DESTINATION lib)
33+
endif (${ROOT_VERSION} VERSION_GREATER "6.0")
34+
35+
if(${CMAKE_SYSTEM} MATCHES Darwin)
36+
set_target_properties(TEPEMGEN PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
37+
endif(${CMAKE_SYSTEM} MATCHES Darwin)

TEPEMGEN/TEPEMGENLinkDef.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#ifdef __CINT__
2+
3+
#pragma link off all globals;
4+
#pragma link off all classes;
5+
#pragma link off all functions;
6+
7+
#pragma link C++ class TEpEmGen+;
8+
#pragma link C++ class TGenEpEmv1+;
9+
#pragma link C++ class TGenQEDBg+;
10+
#endif

TEPEMGEN/TEcommon.h

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#ifndef ROOT_TEcommon
2+
#define ROOT_TEcommon
3+
//------------------------------------------------------------------------
4+
// TEcommon is an interface COMMON blocks of the fortran event generator of
5+
// single e+e- pair production in ultraperipheral PbPb collisions
6+
// at 5.5 GeV/c
7+
//%
8+
9+
// 9 October 2002
10+
//------------------------------------------------------------------------
11+
12+
#ifndef __CFORTRAN_LOADED
13+
#include "cfortran.h"
14+
#endif
15+
16+
// c++ interface to the f77 program - event generator of
17+
// e+e- pair production in ultraperipheral ion collisions
18+
// Author: Yuri Kharlov, 20 September 2002
19+
20+
extern "C" {
21+
typedef struct {
22+
Double_t Xsect2;
23+
Double_t Dsect2;
24+
Double_t Xsecttot;
25+
Double_t Dsecttot;
26+
Int_t Nevnt;
27+
} EeventCommon;
28+
#define EEVENT COMMON_BLOCK(EEVENT,eevent)
29+
COMMON_BLOCK_DEF(EeventCommon,EEVENT);
30+
}
31+
32+
#endif

TEPEMGEN/TEpEmGen.cxx

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
/**************************************************************************
2+
* Copyright(c) 1998-2002, ALICE Experiment at CERN, All rights reserved. *
3+
* *
4+
* Author: The ALICE Off-line Project. *
5+
* Contributors are mentioned in the code where appropriate. *
6+
* *
7+
* Permission to use, copy, modify and distribute this software and its *
8+
* documentation strictly for non-commercial purposes is hereby granted *
9+
* without fee, provided that the above copyright notice appears in all *
10+
* copies and that both the copyright notice and this permission notice *
11+
* appear in the supporting documentation. The authors make no claims *
12+
* about the suitability of this software for any purpose. It is *
13+
* provided "as is" without express or implied warranty. *
14+
* *
15+
* *
16+
* Copyright(c) 1997, 1998, 2002, Adrian Alscher and Kai Hencken *
17+
* See $ALICE_ROOT/EpEmGen/diffcross.f for full Copyright notice *
18+
* *
19+
* *
20+
* Copyright(c) 2002 Kai Hencken, Yuri Kharlov, Serguei Sadovsky *
21+
* See $ALICE_ROOT/EpEmGen/epemgen.f for full Copyright notice *
22+
* *
23+
**************************************************************************/
24+
//------------------------------------------------------------------------
25+
// TEpEmGen is an interface class to fortran event generator of
26+
// single e+e- pair production in ultraperipheral PbPb collisions
27+
// at 5.5 GeV/c
28+
//%
29+
30+
// 9 October 2002
31+
//
32+
// Revised on September 2018 for ALICEo2: Roberto Preghenella ([email protected])
33+
//------------------------------------------------------------------------
34+
35+
#include "TRandom.h"
36+
37+
#include "TEpEmGen.h"
38+
#include "TClonesArray.h"
39+
#include "TParticle.h"
40+
#include "TEcommon.h"
41+
42+
#ifndef WIN32
43+
# define ee_init ee_init_
44+
# define ee_event ee_event_
45+
# define eernd eernd_
46+
#else
47+
# define ee_init EE_INIT
48+
# define ee_event EE_EVENT
49+
# define eernd EERND
50+
#endif
51+
52+
extern "C" {
53+
void ee_init (Double_t &ymin, Double_t &ymax, Double_t &xmin, Double_t &xmax);
54+
void ee_event (Double_t &ymin, Double_t &ymax, Double_t &xmin, Double_t &xmax,
55+
Double_t &yE, Double_t &yP, Double_t &xE, Double_t &xP,
56+
Double_t &phi, Double_t &w);
57+
Double_t eernd(Int_t*) {
58+
Double_t r;
59+
do r=gRandom->Rndm(); while(0 >= r || r >= 1);
60+
return r;
61+
}
62+
}
63+
64+
ClassImp(TEpEmGen)
65+
66+
//------------------------------------------------------------------------------
67+
TEpEmGen::TEpEmGen() : TGenerator("TEpEmGen","TEpEmGen")
68+
{
69+
// TEpEmGen constructor: creates a TClonesArray in which it will store all
70+
// particles. Note that there may be only one functional TEpEmGen object
71+
// at a time, so it's not use to create more than one instance of it.
72+
73+
}
74+
75+
//------------------------------------------------------------------------------
76+
TEpEmGen::~TEpEmGen()
77+
{
78+
// Destroys the object, deletes and disposes all TParticles currently on list.
79+
fParticles->Delete();
80+
delete fParticles;
81+
}
82+
83+
//______________________________________________________________________________
84+
void TEpEmGen::GenerateEvent(Double_t ymin, Double_t ymax, Double_t ptmin, Double_t ptmax,
85+
Double_t &yElectron, Double_t &yPositron,
86+
Double_t &xElectron, Double_t &xPositron,
87+
Double_t &phi12, Double_t &weight)
88+
{
89+
//produce one event
90+
ee_event(ymin,ymax,ptmin,ptmax,
91+
yElectron,yPositron,xElectron,xPositron,
92+
phi12,weight);
93+
}
94+
95+
//______________________________________________________________________________
96+
void TEpEmGen::Initialize(Double_t ymin, Double_t ymax, Double_t ptmin, Double_t ptmax)
97+
{
98+
// Initialize EpEmGen
99+
Double_t ptminMeV = ptmin*1000;
100+
Double_t ptmaxMeV = ptmax*1000;
101+
ee_init(ymin,ymax,ptminMeV,ptmaxMeV);
102+
}
103+
104+
//______________________________________________________________________________
105+
Int_t TEpEmGen::ImportParticles(TClonesArray *particles, Option_t *option)
106+
{
107+
if (particles == 0) return 0;
108+
TClonesArray &clonesParticles = *particles;
109+
clonesParticles.Clear();
110+
Int_t numpart = fParticles->GetEntries();
111+
for (Int_t i = 0; i<numpart; i++) {
112+
TParticle *particle = (TParticle *)fParticles->At(i);
113+
new(clonesParticles[i]) TParticle(*particle);
114+
}
115+
return numpart;
116+
}
117+
118+
119+
//______________________________________________________________________________
120+
Double_t TEpEmGen::GetXsection()
121+
{
122+
// Return cross section accumulated so far
123+
return EEVENT.Xsecttot;
124+
}
125+
126+
//______________________________________________________________________________
127+
Double_t TEpEmGen::GetDsection()
128+
{
129+
// Return cross section error accumulated so far
130+
return EEVENT.Dsecttot;
131+
}

TEPEMGEN/TEpEmGen.h

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#ifndef ROOT_TEpEmGen
2+
#define ROOT_TEpEmGen
3+
/* Copyright(c) 1998-2002, ALICE Experiment at CERN, All rights reserved. *
4+
* See cxx source for full Copyright notice */
5+
6+
/* $Id$ */
7+
//------------------------------------------------------------------------
8+
// TEpEmGen is an interface class to fortran event generator of
9+
// single e+e- pair production in ultraperipheral PbPb collisions
10+
// at 5.5 GeV/c
11+
//%
12+
13+
// 9 October 2002
14+
//------------------------------------------------------------------------
15+
16+
#include "TGenerator.h"
17+
18+
// c++ interface to the f77 program - event generator of
19+
// e+e- pair production in ultraperipheral ion collisions
20+
// Author: Yuri Kharlov, 20 September 2002
21+
//
22+
// Revised on September 2018 for ALICEo2: Roberto Preghenella ([email protected])
23+
24+
class TEpEmGen : public TGenerator {
25+
26+
public:
27+
TEpEmGen();
28+
virtual ~TEpEmGen();
29+
30+
void Initialize (Double_t ymin, Double_t ymax, Double_t ptmin, Double_t ptmax);
31+
virtual void GenerateEvent() {TGenerator::GenerateEvent();};
32+
Int_t ImportParticles(TClonesArray *particles, Option_t *option);
33+
34+
protected:
35+
void GenerateEvent (Double_t ymin, Double_t ymax, Double_t ptmin, Double_t ptmax,
36+
Double_t &yElectron, Double_t &yPositron,
37+
Double_t &xElectron, Double_t &xPositron,
38+
Double_t &phi12, Double_t &weight);
39+
Double_t GetXsection();
40+
Double_t GetDsection();
41+
42+
ClassDef(TEpEmGen,1); //Interface to EpEmGen Event Generator
43+
};
44+
45+
#endif

0 commit comments

Comments
 (0)