Advanced Computing Platform for Theoretical Physics
Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Yu-Chen Ding
crmc
Commits
67a5715f
Commit
67a5715f
authored
Jul 08, 2021
by
ralfulrich
Browse files
un-hiding ROOT support
parent
06456c00
Changes
4
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
67a5715f
...
...
@@ -150,7 +150,6 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set
(
CMAKE_CXX_EXTENSIONS OFF
)
if
(
CRMC_ENABLE_ROOT
)
message
(
"ROOT output is not encouraged. Consider HepMC or Rivet."
)
FIND_PACKAGE
(
Root
)
if
(
Root_FOUND
)
INCLUDE_DIRECTORIES
(
"
${
ROOT_INCLUDE_DIR
}
"
)
...
...
@@ -485,7 +484,7 @@ CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/src/crmc.param.in
SET
(
CRMC_TABDIR
"
${
CMAKE_INSTALL_PREFIX
}
/share/crmc"
)
CONFIGURE_FILE
(
${
CMAKE_SOURCE_DIR
}
/src/crmc.param.in
${
CMAKE_BINARY_DIR
}
/crmc.param.install @ONLY IMMEDIATE
)
install
(
FILES
${
CMAKE_BINARY_DIR
}
/crmc.param.install
TYPE SYSCONF
install
(
FILES
${
CMAKE_BINARY_DIR
}
/crmc.param.install
DESTINATION etc
RENAME crmc.param
)
# install tabs
...
...
ExampleAnalyser/Makefile
View file @
67a5715f
...
...
@@ -35,24 +35,32 @@ OBJS=$(FILES:%.f=$(LIBDIR)%.o)
CXXOBJS
=
$
(
CXXFILES:%.cc
=
$(LIBDIR)
%.o
)
all
:
check dirs bin_dir bin/analys
e
all
:
check dirs bin_dir bin/analys
is
.PHONY
:
check
check
:
@
if
[
-z
"
$(HepMC3_ROOT)
"
]
;
then
echo
"Please set HepMC3_ROOT to the root directory of HepMC3"
;
exit
1
;
fi
@
if
[
-z
"
$(ROOTSYS)
"
]
;
then
echo
"Please set ROOTSYS to the root directory of root"
;
exit
1
;
fi
bin/analys
e
:
$(OBJS) $(CXXOBJS)
bin/analys
is
:
$(OBJS) $(CXXOBJS)
$(CXX)
$(CXXFLAGS)
$(OBJS)
$(CXXOBJS)
-o
$@
$(LIBS)
@
(
echo
""
)
@
(
echo
"==> compilation successful!"
)
@
(
echo
"==> type bin/analyse"
)
@
(
echo
"==> type bin/analysis"
)
@
(
echo
""
)
bin/analysisROOT
:
$(LIBDIR)/analysisROOT.o
$(CXX)
$(CXXFLAGS)
-o
$@
$^
$(LIBS)
@
(
echo
""
)
@
(
echo
"==> compilation successful!"
)
@
(
echo
"==> type bin/analysisROOT"
)
@
(
echo
""
)
$(OBJS)
:
$(LIBDIR)%.o : $(SOURCE_DIR)%.f
$(FC)
-o
$@
-c
$<
$(CXXOBJS)
:
$(LIBDIR)%.o : $(SOURCE_DIR)%.cc src/analysis.h
$(LIBDIR)%.o
:
$(SOURCE_DIR)%.cc
$(CXX)
$(CXXFLAGS)
$(CFLAGS)
-o
$@
-c
$<
dirs
:
...
...
ExampleAnalyser/src/analysisROOT.cc
0 → 100644
View file @
67a5715f
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <stdexcept>
#include <string>
#include <sstream>
#include <fstream>
#include <math.h>
#include <stdlib.h>
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/path.hpp>
#include <TLorentzVector.h>
#include <TFile.h>
#include <TChain.h>
#include <TH1D.h>
using
namespace
std
;
int
main
(
int
argc
,
char
**
argv
)
{
if
(
argc
==
1
)
{
cout
<<
"
\n
Please, provide input data file(s) in ROOT format
\n
"
<<
endl
;
return
0
;
}
//-------------------SET UP DATA
TFile
*
theOutFile
;
string
outFileName
(
"new_histogram_file_ROOT.root"
);
cout
<<
" ! Opening output file: "
<<
outFileName
<<
endl
;
theOutFile
=
new
TFile
(
outFileName
.
c_str
(),
"RECREATE"
);
TChain
data
(
"Particle"
);
for
(
int
ia
=
1
;
ia
<
argc
;
++
ia
)
{
data
.
AddFile
(
argv
[
ia
]);
}
int
nPart
;
data
.
SetBranchAddress
(
"nPart"
,
&
nPart
);
const
int
MAXP
=
100000
;
int
pdgid
[
MAXP
];
int
status
[
MAXP
];
double
px
[
MAXP
];
double
py
[
MAXP
];
double
pz
[
MAXP
];
double
E
[
MAXP
];
double
m
[
MAXP
];
data
.
SetBranchAddress
(
"pdgid"
,
pdgid
);
data
.
SetBranchAddress
(
"status"
,
status
);
data
.
SetBranchAddress
(
"px"
,
px
);
data
.
SetBranchAddress
(
"py"
,
py
);
data
.
SetBranchAddress
(
"pz"
,
pz
);
data
.
SetBranchAddress
(
"E"
,
E
);
data
.
SetBranchAddress
(
"m"
,
m
);
theOutFile
->
mkdir
(
"model1"
);
//------------------SET UP HISTOGRAMS
TH1D
*
exampleHist
=
new
TH1D
(
"dNdeta"
,
";#eta;dN/d#eta"
,
21
,
-
10
,
10
);
//-------------------EVENT LOOP
int
nEvts
=
data
.
GetEntries
();
for
(
int
iEvt
=
0
;
iEvt
<
nEvts
;
++
iEvt
)
{
data
.
GetEntry
(
iEvt
);
//-------------------PARTICLE LOOP
for
(
int
ipar
=
0
;
ipar
<
nPart
;
++
ipar
)
{
if
(
status
[
ipar
]
!=
1
)
continue
;
//get final state particles. status == 2 are decayed particles, status == 4 is beam particles
TLorentzVector
lv
(
px
[
ipar
],
py
[
ipar
],
pz
[
ipar
],
E
[
ipar
]);
//HepMC3::GenVertex* parent_vertex = p->production_vertex();
const
int
id
=
pdgid
[
ipar
];
const
double
eta
=
lv
.
Eta
();
//const double pt = p->momentum ().perp ();
//const double e = p->momentum ().e ();
//for more advance paramters see HepMC documentation or load #include <TParticle.h> and fill object (see analysis.h)
//-------------------EVENT SELECTION
//-------------------FILL HISTOGRAMS WITH PER PARTICLE VARIABLES
exampleHist
->
Fill
(
eta
);
}
//PARTICLE LOOP
//-------------------FILL HISTOGRAMS WITH PER EVENT VARIABLES
}
//EVENT LOOP
//---------------FINALISE HISTOGRAMS
exampleHist
->
Scale
(
1.
/
nEvts
,
"width"
);
//----------------Closing Files
std
::
cout
<<
" ! Writing output file: "
<<
outFileName
<<
std
::
endl
;
theOutFile
->
Write
();
delete
exampleHist
;
exampleHist
=
0
;
std
::
cout
<<
" ! Closing output file: "
<<
outFileName
<<
std
::
endl
;
theOutFile
->
Close
();
delete
theOutFile
;
theOutFile
=
0
;
return
0
;
}
src/CRMCoptions.cc
View file @
67a5715f
...
...
@@ -34,7 +34,11 @@ double mass(int id)
CRMCoptions
::
CRMCoptions
(
int
argc
,
char
**
argv
)
:
fError
(
false
)
#ifdef WITH_HEPMC3
,
fOutputMode
(
eHepMC3GZ
)
#else
,
fOutputMode
(
eLHE
)
#endif
,
fNCollision
(
500
)
,
fSeed
(
0
)
,
fProjectileId
(
1
)
...
...
@@ -124,10 +128,14 @@ void CRMCoptions::ParseOptions(int argc, char **argv)
"output_mode"
,
"hepmc, hepmcgz, hepmc3, hepmc3gz (default), root, lhe, lhegz, rivet"
,
false
,
"lhe"
,
#ifdef WITH_HEPMC3
"hepmc3gz"
,
#else
"lhegz"
,
#endif
"string"
);
cmd
.
add
(
output
);
TCLAP
::
ValueArg
<
int
>
seed
(
"s"
,
"seed"
,
"random seed between 0 and 1e9 (default: random)"
,
false
,
0
,
"int"
);
cmd
.
add
(
seed
);
...
...
@@ -202,31 +210,48 @@ void CRMCoptions::ParseOptions(int argc, char **argv)
}
const
string
om
=
output
.
getValue
();
if
(
om
==
"hepmc3gz"
)
if
(
om
==
"hepmc3gz"
)
{
#ifndef WITH_HEPMC3
cerr
<<
" Compile with HepMC3 first "
<<
endl
;
exit
(
1
);
#endif
fOutputMode
=
eHepMC3GZ
;
else
if
(
om
==
"hepmc3"
)
}
else
if
(
om
==
"hepmc3"
)
{
#ifndef WITH_HEPMC3
cerr
<<
" Compile with HepMC3 first "
<<
endl
;
exit
(
1
);
#endif
fOutputMode
=
eHepMC3
;
else
if
(
om
==
"hepmcgz"
)
}
else
if
(
om
==
"hepmcgz"
)
{
#ifndef WITH_HEPMC
cerr
<<
" Compile with HepMC2 first "
<<
endl
;
exit
(
1
);
#endif
fOutputMode
=
eHepMCGZ
;
else
if
(
om
==
"hepmc"
)
}
else
if
(
om
==
"hepmc"
)
{
#ifndef WITH_HEPMC
cerr
<<
" Compile with HepMC2 first "
<<
endl
;
exit
(
1
);
#endif
fOutputMode
=
eHepMC
;
else
if
(
om
==
"lhe"
)
}
else
if
(
om
==
"lhe"
)
{
fOutputMode
=
eLHE
;
else
if
(
om
==
"lhegz"
)
}
else
if
(
om
==
"lhegz"
)
{
fOutputMode
=
eLHEGZ
;
else
if
(
om
==
"rivet"
)
}
else
if
(
om
==
"rivet"
)
{
#ifndef WITH_RIVET
cerr
<<
" Compile with Rivet first "
<<
endl
;
exit
(
1
);
#endif
fOutputMode
=
eRivet
;
else
if
(
om
==
"root"
)
{
}
else
if
(
om
==
"root"
)
{
#ifdef WITH_ROOT
fOutputMode
=
eROOT
;
#else
cerr
<<
" Compile with ROOT first "
<<
endl
;
exit
(
1
);
#endif
}
else
{
}
else
{
cerr
<<
" Wrong output type: "
<<
om
<<
endl
;
cerr
<<
" Check --help for more information"
<<
endl
;
exit
(
1
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment