Skip to content

Commit 1d184c4

Browse files
ChristianTackeGSIdennisklein
authored andcommitted
chore(examples): More includes in macros
Even so macros do not need `#include`s, they're a nice way of documenting what's needed. And they help IDEs to find the right symbols/etc. The FairRoot includes themselves still have issues with this, so we only include ROOT and other includes for now.
1 parent 0429691 commit 1d184c4

10 files changed

Lines changed: 70 additions & 15 deletions

File tree

examples/advanced/Tutorial3/macro/run_sim_sep.C

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
/********************************************************************************
2+
* Copyright (C) 2012-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
3+
* *
4+
* This software is distributed under the terms of the *
5+
* GNU Lesser General Public Licence (LGPL) version 3, *
6+
* copied verbatim in the file "LICENSE" *
7+
********************************************************************************/
8+
9+
#include <TRandom.h>
10+
#include <TStopwatch.h>
11+
#include <TString.h>
12+
#include <TSystem.h>
13+
114
void run_sim_sep(Int_t fileId, Int_t nEvents = 1000, TString mcEngine = "TGeant3")
215
{
316
gRandom->SetSeed(1111 * fileId);

examples/advanced/propagator/macros/runMM.C

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
/********************************************************************************
2-
* Copyright (C) 2019 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
2+
* Copyright (C) 2019-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
33
* *
44
* This software is distributed under the terms of the *
55
* GNU Lesser General Public Licence (LGPL) version 3, *
66
* copied verbatim in the file "LICENSE" *
77
********************************************************************************/
8+
9+
#include <TRandom.h>
10+
#include <TStopwatch.h>
11+
#include <TString.h>
12+
#include <TSystem.h>
13+
814
int runMM(Int_t nEvents = 1000, TString mcEngine = "TGeant4", Bool_t isMT = false)
915
{
1016
UInt_t randomSeed = 123456;

examples/simulation/Tutorial1/macros/run_tutorial1_fastsim.C

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
/********************************************************************************
2-
* Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
2+
* Copyright (C) 2014-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
33
* *
44
* This software is distributed under the terms of the *
55
* GNU Lesser General Public Licence (LGPL) version 3, *
66
* copied verbatim in the file "LICENSE" *
77
********************************************************************************/
8+
9+
#include <TStopwatch.h>
10+
#include <TString.h>
11+
#include <TSystem.h>
12+
813
void run_tutorial1_fastsim(Int_t nEvents = 10, TString mcEngine = "TGeant3", Bool_t isMT = false)
914
{
10-
1115
TString dir = getenv("VMCWORKDIR");
1216
TString tutdir = dir + "/simulation/Tutorial1";
1317

examples/simulation/Tutorial1/macros/run_tutorial1_pythia8.C

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
/********************************************************************************
2-
* Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
2+
* Copyright (C) 2014-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
33
* *
44
* This software is distributed under the terms of the *
55
* GNU Lesser General Public Licence (LGPL) version 3, *
66
* copied verbatim in the file "LICENSE" *
77
********************************************************************************/
88

9+
#include <TStopwatch.h>
910
#include <TString.h>
1011
#include <TSystem.h>
1112
#include <memory>

examples/simulation/Tutorial1/macros/run_tutorial1_urqmd.C

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/********************************************************************************
2-
* Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
2+
* Copyright (C) 2014-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
33
* *
44
* This software is distributed under the terms of the *
55
* GNU Lesser General Public Licence (LGPL) version 3, *
@@ -9,8 +9,12 @@
99
#include <TStopwatch.h>
1010
#include <TString.h>
1111
#include <TSystem.h>
12+
#include <iostream>
1213
#include <memory>
1314

15+
using std::cout;
16+
using std::endl;
17+
1418
void run_tutorial1_urqmd(Int_t nEvents = 2, TString mcEngine = "TGeant3")
1519
{
1620
TString dir = getenv("VMCWORKDIR");

examples/simulation/Tutorial4/macros/run_tutorial4.C

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/********************************************************************************
2-
* Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
2+
* Copyright (C) 2014-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
33
* *
44
* This software is distributed under the terms of the *
55
* GNU Lesser General Public Licence (LGPL) version 3, *
@@ -9,8 +9,12 @@
99
#include <TObjString.h>
1010
#include <TStopwatch.h>
1111
#include <TSystem.h>
12+
#include <iostream>
1213
#include <memory>
1314

15+
using std::cout;
16+
using std::endl;
17+
1418
void run_tutorial4(Int_t nEvents = 10, TString mcEngine = "TGeant3", Bool_t doAlign = true, Bool_t isMT = false)
1519
{
1620
TString dir = getenv("VMCWORKDIR");

examples/simulation/Tutorial4/macros/run_tutorial4_createGeometryFile.C

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
/********************************************************************************
2-
* Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
2+
* Copyright (C) 2014-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
33
* *
44
* This software is distributed under the terms of the *
55
* GNU Lesser General Public Licence (LGPL) version 3, *
66
* copied verbatim in the file "LICENSE" *
77
********************************************************************************/
8+
9+
#include <TStopwatch.h>
10+
#include <TString.h>
11+
#include <TSystem.h>
12+
#include <iostream>
13+
14+
using std::cout;
15+
using std::endl;
16+
817
void run_tutorial4_createGeometryFile(Int_t nEvents = 1, TString mcEngine = "TGeant3", Bool_t isMT = false)
918
{
10-
1119
TString dir = getenv("VMCWORKDIR");
1220

1321
TString tut_configdir = dir + "/simulation/Tutorial4/gconfig";

examples/simulation/Tutorial4/macros/run_tutorial4_createMatrices.C

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
/********************************************************************************
2-
* Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
2+
* Copyright (C) 2014-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
33
* *
44
* This software is distributed under the terms of the *
55
* GNU Lesser General Public Licence (LGPL) version 3, *
66
* copied verbatim in the file "LICENSE" *
77
********************************************************************************/
8+
9+
#include <TObjString.h>
10+
#include <TStopwatch.h>
11+
#include <TString.h>
12+
#include <TSystem.h>
13+
#include <fairlogger/Logger.h>
14+
#include <fstream>
15+
816
void run_tutorial4_createMatrices(Int_t nEvents = 10, TString mcEngine = "TGeant3", Bool_t isMT = false)
917
{
10-
1118
TString dir = getenv("VMCWORKDIR");
1219

1320
TString tut_configdir = dir + "/simulation/Tutorial4/gconfig";
@@ -119,7 +126,7 @@ void run_tutorial4_createMatrices(Int_t nEvents = 10, TString mcEngine = "TGeant
119126

120127
auto matrices = tutdet->getMisalignmentMatrices();
121128

122-
ofstream myfile;
129+
std::ofstream myfile;
123130
myfile.open("misalignmentMatrices.txt");
124131

125132
double* rot;
@@ -140,6 +147,4 @@ void run_tutorial4_createMatrices(Int_t nEvents = 10, TString mcEngine = "TGeant
140147
LOG(info) << "AlignHandler: all matrices added!";
141148

142149
LOG(info) << "SUCCESS! All matrices created and saved!";
143-
144-
return;
145150
}

examples/simulation/rutherford/macros/run_rad.C

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/********************************************************************************
2-
* Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
2+
* Copyright (C) 2014-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
33
* *
44
* This software is distributed under the terms of the *
55
* GNU Lesser General Public Licence (LGPL) version 3, *
@@ -9,8 +9,12 @@
99
#include <TStopwatch.h>
1010
#include <TString.h>
1111
#include <TSystem.h>
12+
#include <iostream>
1213
#include <memory>
1314

15+
using std::cout;
16+
using std::endl;
17+
1418
void run_rad(Int_t nEvents = 100, TString mcEngine = "TGeant4")
1519
{
1620
TString dir = gSystem->Getenv("VMCWORKDIR");

examples/simulation/rutherford/macros/run_rutherford.C

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
/********************************************************************************
2-
* Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
2+
* Copyright (C) 2014-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
33
* *
44
* This software is distributed under the terms of the *
55
* GNU Lesser General Public Licence (LGPL) version 3, *
66
* copied verbatim in the file "LICENSE" *
77
********************************************************************************/
88

9+
#include <TH2D.h>
910
#include <TRandom.h>
11+
#include <TStopwatch.h>
1012
#include <TString.h>
1113
#include <TSystem.h>
14+
#include <iostream>
1215
#include <memory>
1316

17+
using std::cout;
18+
using std::endl;
19+
1420
void run_rutherford(Int_t nEvents = 10, TString mcEngine = "TGeant4", Bool_t isMT = true)
1521
{
1622
TString dir = gSystem->Getenv("VMCWORKDIR");

0 commit comments

Comments
 (0)