Skip to content

Commit 795218b

Browse files
fuhlig1ChristianTackeGSI
authored andcommitted
Add or update license header and include statements
Don't include the headers when using the cling interpreter. For some not yet understood reason the macro compilation crashes when including the headers with cling,
1 parent 20d0431 commit 795218b

7 files changed

Lines changed: 183 additions & 39 deletions

File tree

Lines changed: 44 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,47 @@
1-
int compare_seed_value(TString filename, UInt_t initial_seed) {
1+
/********************************************************************************
2+
* Copyright (C) 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+
#if !defined(__CLING__) || defined(__ROOTCLING__)
9+
#include "FairBaseParSet.h"
210

3-
// Open parameter file and get the stored random seed from the
4-
// FairBaseParSet parameter container
5-
// Compare the random seed with the expected one set during the
6-
// transport run
11+
#include <RtypesCore.h>
12+
#include <TFile.h>
13+
#include <TString.h>
14+
#include <iostream>
15+
#include <memory>
16+
#endif
717

8-
std::unique_ptr<TFile> myFile( TFile::Open(filename) );
9-
std::unique_ptr<FairBaseParSet> par(myFile->Get<FairBaseParSet>("FairBaseParSet"));
10-
UInt_t seed = par->GetRndSeed();
18+
int compare_seed_value(TString filename, UInt_t initial_seed)
19+
{
1120

12-
if ( seed == initial_seed ) {
13-
return 0;
14-
}
15-
else {
16-
std::cout << "Expected seed value : " << initial_seed << std::endl;
17-
std::cout << "Seed value from file : " << seed << std::endl;
18-
return 1;
19-
}
20-
}
21+
// Open parameter file and get the stored random seed from the
22+
// FairBaseParSet parameter container
23+
// Compare the random seed with the expected one set during the
24+
// transport run
25+
26+
std::unique_ptr<TFile> myFile(TFile::Open(filename));
27+
if (!myFile || myFile->IsZombie()) {
28+
std::cerr << "Error opening file " << filename << std::endl;
29+
return 1;
30+
}
31+
32+
std::unique_ptr<FairBaseParSet> par(myFile->Get<FairBaseParSet>("FairBaseParSet"));
33+
if (!par) {
34+
std::cerr << "Did not find FairBaseParSet in input file" << std::endl;
35+
return 1;
36+
}
37+
38+
UInt_t seed = par->GetRndSeed();
39+
40+
if (seed == initial_seed) {
41+
return 0;
42+
} else {
43+
std::cout << "Expected seed value : " << initial_seed << std::endl;
44+
std::cout << "Seed value from file : " << seed << std::endl;
45+
return 1;
46+
}
47+
}

examples/simulation/Tutorial2/macros/create_digis.C

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,29 @@
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+
#if !defined(__CLING__) || defined(__ROOTCLING__)
10+
#include "FairFileSource.h"
11+
#include "FairParAsciiFileIo.h"
12+
#include "FairParRootFileIo.h"
13+
#include "FairRootFileSink.h"
14+
#include "FairRunAna.h"
15+
#include "FairRuntimeDb.h"
16+
#include "FairSystemInfo.h"
17+
#include "FairTutorialDet2CustomTask.h"
18+
#include "FairTutorialDet2DigiPar.h"
19+
#include "FairTutorialDet2Digitizer.h"
20+
921
#include <TStopwatch.h>
1022
#include <TString.h>
23+
#include <TSystem.h>
1124
#include <iostream>
1225
#include <memory>
26+
#endif
1327

1428
using std::cout;
1529
using std::endl;

examples/simulation/Tutorial2/macros/create_digis_mixed.C

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,29 @@
1+
/********************************************************************************
2+
* Copyright (C) 2014-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+
#if !defined(__CLING__) || defined(__ROOTCLING__)
10+
#include "FairMixedSource.h"
11+
#include "FairParAsciiFileIo.h"
12+
#include "FairParRootFileIo.h"
13+
#include "FairRootFileSink.h"
14+
#include "FairRunAna.h"
15+
#include "FairRuntimeDb.h"
16+
#include "FairSystemInfo.h"
17+
#include "FairTutorialDet2CustomTask.h"
18+
#include "FairTutorialDet2DigiPar.h"
19+
#include "FairTutorialDet2Digitizer.h"
20+
121
#include <TStopwatch.h>
222
#include <TString.h>
23+
#include <TSystem.h>
324
#include <iostream>
425
#include <memory>
26+
#endif
527

628
using std::cout;
729
using std::endl;

examples/simulation/Tutorial2/macros/read_digis.C

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,29 @@
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+
#if !defined(__CLING__) || defined(__ROOTCLING__)
10+
#include "FairBaseParSet.h"
11+
#include "FairFileSource.h"
12+
#include "FairParAsciiFileIo.h"
13+
#include "FairParRootFileIo.h"
14+
#include "FairRootFileSink.h"
15+
#include "FairRunAna.h"
16+
#include "FairRuntimeDb.h"
17+
#include "FairSystemInfo.h"
18+
#include "FairTutorialDet2CustomTask.h"
19+
#include "FairTutorialDet2DigiPar.h"
20+
#include "FairTutorialDet2Digitizer.h"
21+
922
#include <TStopwatch.h>
1023
#include <TString.h>
1124
#include <iostream>
1225
#include <memory>
26+
#endif
1327

1428
using std::cout;
1529
using std::endl;

examples/simulation/Tutorial2/macros/run_background.C

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,34 @@
1+
/********************************************************************************
2+
* Copyright (C) 2014-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+
#if !defined(__CLING__) || defined(__ROOTCLING__)
10+
#include "FairBoxGenerator.h"
11+
#include "FairCave.h"
12+
#include "FairDetector.h"
13+
#include "FairModule.h"
14+
#include "FairParRootFileIo.h"
15+
#include "FairPrimaryGenerator.h"
16+
#include "FairRootFileSink.h"
17+
#include "FairRunSim.h"
18+
#include "FairRuntimeDb.h"
19+
#include "FairSystemInfo.h"
20+
#include "FairTutorialDet2.h"
21+
22+
#include <RtypesCore.h>
123
#include <TStopwatch.h>
224
#include <TString.h>
325
#include <TSystem.h>
26+
#include <iostream>
427
#include <memory>
28+
#endif
29+
30+
using std::cout;
31+
using std::endl;
532

633
void run_background(Int_t nEvents = 130)
734
{
@@ -53,7 +80,7 @@ void run_background(Int_t nEvents = 130)
5380

5481
// ----- Create simulation run ----------------------------------------
5582
auto run = std::make_unique<FairRunSim>();
56-
run->SetName("TGeant4"); // Transport engine
83+
run->SetName("TGeant4"); // Transport engine
5784
run->SetSink(std::make_unique<FairRootFileSink>(outFile));
5885
FairRuntimeDb* rtdb = run->GetRuntimeDb();
5986
// ------------------------------------------------------------------------

examples/simulation/Tutorial2/macros/run_signal.C

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,33 @@
1+
/********************************************************************************
2+
* Copyright (C) 2014-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+
#if !defined(__CLING__) || defined(__ROOTCLING__)
10+
#include "FairBoxGenerator.h"
11+
#include "FairCave.h"
12+
#include "FairDetector.h"
13+
#include "FairModule.h"
14+
#include "FairParRootFileIo.h"
15+
#include "FairPrimaryGenerator.h"
16+
#include "FairRootFileSink.h"
17+
#include "FairRunSim.h"
18+
#include "FairRuntimeDb.h"
19+
#include "FairSystemInfo.h"
20+
#include "FairTutorialDet2.h"
21+
22+
#include <RtypesCore.h>
123
#include <TStopwatch.h>
224
#include <TString.h>
325
#include <TSystem.h>
426
#include <memory>
27+
#endif
28+
29+
using std::cout;
30+
using std::endl;
531

632
void run_signal(Int_t fileNr, Int_t nEvents = 10)
733
{
@@ -55,7 +81,7 @@ void run_signal(Int_t fileNr, Int_t nEvents = 10)
5581

5682
// ----- Create simulation run ----------------------------------------
5783
auto run = std::make_unique<FairRunSim>();
58-
run->SetName("TGeant4"); // Transport engine
84+
run->SetName("TGeant4"); // Transport engine
5985
run->SetSink(std::make_unique<FairRootFileSink>(outFile));
6086
FairRuntimeDb* rtdb = run->GetRuntimeDb();
6187
// ------------------------------------------------------------------------

examples/simulation/Tutorial2/macros/run_tutorial2.C

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,33 @@
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+
#if !defined(__CLING__) || defined(__ROOTCLING__)
10+
#include "FairBoxGenerator.h"
11+
#include "FairCave.h"
12+
#include "FairDetector.h"
13+
#include "FairModule.h"
14+
#include "FairParRootFileIo.h"
15+
#include "FairPrimaryGenerator.h"
16+
#include "FairRootFileSink.h"
17+
#include "FairRunSim.h"
18+
#include "FairRuntimeDb.h"
19+
#include "FairSystemInfo.h"
20+
#include "FairTutorialDet2.h"
21+
22+
#include <RtypesCore.h>
923
#include <TRandom.h>
1024
#include <TStopwatch.h>
1125
#include <TString.h>
1226
#include <TSystem.h>
1327
#include <memory>
28+
#endif
1429

15-
void run_tutorial2(Int_t nEvents = 10, TString mcEngine = "TGeant4",
16-
Bool_t isMT = true, UInt_t initial_seed=98989)
30+
void run_tutorial2(Int_t nEvents = 10, TString mcEngine = "TGeant4", Bool_t isMT = true, UInt_t initial_seed = 98989)
1731
{
1832
TString dir = getenv("VMCWORKDIR");
1933

@@ -66,8 +80,8 @@ void run_tutorial2(Int_t nEvents = 10, TString mcEngine = "TGeant4",
6680

6781
// ----- Create simulation run ----------------------------------------
6882
auto run = std::make_unique<FairRunSim>();
69-
run->SetName(mcEngine); // Transport engine
70-
run->SetIsMT(isMT); // Multi-threading mode (Geant4 only)
83+
run->SetName(mcEngine); // Transport engine
84+
run->SetIsMT(isMT); // Multi-threading mode (Geant4 only)
7185
run->SetSink(std::make_unique<FairRootFileSink>(outFile));
7286
FairRuntimeDb* rtdb = run->GetRuntimeDb();
7387
// ------------------------------------------------------------------------
@@ -118,30 +132,30 @@ void run_tutorial2(Int_t nEvents = 10, TString mcEngine = "TGeant4",
118132

119133
// ----- Finish -------------------------------------------------------
120134

121-
cout << endl << endl;
135+
std::cout << std::endl << std::endl;
122136

123137
// Extract the maximal used memory an add is as Dart measurement
124138
// This line is filtered by CTest and the value send to CDash
125139
FairSystemInfo sysInfo;
126140
Float_t maxMemory = sysInfo.GetMaxMemory();
127-
cout << "<DartMeasurement name=\"MaxMemory\" type=\"numeric/double\">";
128-
cout << maxMemory;
129-
cout << "</DartMeasurement>" << endl;
141+
std::cout << "<DartMeasurement name=\"MaxMemory\" type=\"numeric/double\">";
142+
std::cout << maxMemory;
143+
std::cout << "</DartMeasurement>" << std::endl;
130144

131145
timer.Stop();
132146
Double_t rtime = timer.RealTime();
133147
Double_t ctime = timer.CpuTime();
134148

135149
Float_t cpuUsage = ctime / rtime;
136-
cout << "<DartMeasurement name=\"CpuLoad\" type=\"numeric/double\">";
137-
cout << cpuUsage;
138-
cout << "</DartMeasurement>" << endl;
139-
140-
cout << endl << endl;
141-
cout << "Output file is " << outFile << endl;
142-
cout << "Parameter file is " << parFile << endl;
143-
cout << "Real time " << rtime << " s, CPU time " << ctime << "s" << endl << endl;
144-
cout << "Macro finished successfully." << endl;
150+
std::cout << "<DartMeasurement name=\"CpuLoad\" type=\"numeric/double\">";
151+
std::cout << cpuUsage;
152+
std::cout << "</DartMeasurement>" << std::endl;
153+
154+
std::cout << std::endl << std::endl;
155+
std::cout << "Output file is " << outFile << std::endl;
156+
std::cout << "Parameter file is " << parFile << std::endl;
157+
std::cout << "Real time " << rtime << " s, CPU time " << ctime << "s" << std::endl << std::endl;
158+
std::cout << "Macro finished successfully." << std::endl;
145159

146160
// ------------------------------------------------------------------------
147161
}

0 commit comments

Comments
 (0)