Skip to content

Commit 3cf7236

Browse files
committed
feat(evtvis):Added CI test to check the event display for simulations
Minor change in the macros Added GLAD too and old CALIFA tests Added old MWPC tests Use of TString for R3BEventManager Added old tests for rpc, ssd, twim, alpide and music
1 parent 1f3483b commit 3cf7236

21 files changed

Lines changed: 263 additions & 47 deletions

alpide/test/CMakeLists.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
##############################################################################
22
# Copyright (C) 2022 GSI Helmholtzzentrum für Schwerionenforschung GmbH #
3-
# Copyright (C) 2022-2023 Members of R3B Collaboration #
3+
# Copyright (C) 2022-2025 Members of R3B Collaboration #
44
# #
55
# This software is distributed under the terms of the #
66
# GNU General Public Licence (GPL) version 3, #
@@ -11,6 +11,15 @@
1111
# or submit itself to any jurisdiction. #
1212
##############################################################################
1313

14+
if(GTEST_FOUND)
15+
add_executable(
16+
AlpideUnitTests
17+
testAlpideContainerPar.cxx)
18+
target_link_libraries(AlpideUnitTests PRIVATE GTest::gtest_main GTest::gmock_main
19+
R3BAlpide)
20+
gtest_discover_tests(AlpideUnitTests DISCOVERY_TIMEOUT 600)
21+
endif(GTEST_FOUND)
22+
1423
generate_root_test_script(${R3BROOT_SOURCE_DIR}/alpide/test/testAlpideSimulation.C)
1524
add_test(NAME AlpideSimulation COMMAND ${R3BROOT_BINARY_DIR}/alpide/test/testAlpideSimulation.sh)
1625
set_tests_properties(AlpideSimulation PROPERTIES TIMEOUT "2000")

califa/test/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@
1111
# or submit itself to any jurisdiction. #
1212
##############################################################################
1313

14+
if(GTEST_FOUND)
15+
add_executable(
16+
CalifaUnitTests
17+
testCalifaContainerPar.cxx)
18+
target_link_libraries(CalifaUnitTests PRIVATE GTest::gtest_main GTest::gmock_main
19+
R3BCalifa)
20+
gtest_discover_tests(CalifaUnitTests DISCOVERY_TIMEOUT 600)
21+
endif(GTEST_FOUND)
1422

1523
generate_root_test_script(${R3BROOT_SOURCE_DIR}/califa/test/testCalifaSimulation.C)
1624
add_test(NAME CalifaSimulation COMMAND ${R3BROOT_BINARY_DIR}/califa/test/testCalifaSimulation.sh)

evtvis/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ add_library_with_dictionary(
3131
LIBNAME
3232
R3BEvtVis
3333
LINKDEF
34-
R3BEventDisplayLinkDef.h
34+
EventDisplayLinkDef.h
3535
HEADERS
3636
${HEADERS}
3737
SRCS
@@ -56,3 +56,5 @@ add_library_with_dictionary(
5656
# Graf3d
5757
# Geom
5858
# GeomPainter)
59+
60+
add_subdirectory(test)

evtvis/R3BCalifaClusterEventDisplay.cxx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,6 @@ R3BCalifaClusterEventDisplay::R3BCalifaClusterEventDisplay(const char* name, Int
111111
, fProjManager2(NULL)
112112
{
113113
}
114-
// -----------------------------------------------------------------------
115-
116-
// ----- Destructor ----------------------------------------------------
117-
R3BCalifaClusterEventDisplay::~R3BCalifaClusterEventDisplay() {}
118-
// -------------------------------------------------------------------------
119114

120115
// ----- Public method Init --------------------------------------------
121116
InitStatus R3BCalifaClusterEventDisplay::Init()
@@ -261,9 +256,6 @@ void R3BCalifaClusterEventDisplay::Reset()
261256
delete fLego;
262257
}
263258

264-
// ---- Public method Finish --------------------------------------------------
265-
void R3BCalifaClusterEventDisplay::Finish() {}
266-
267259
// ----- Private method CreateHistograms -------------------------------------
268260
void R3BCalifaClusterEventDisplay::CreateHistograms()
269261
{

evtvis/R3BCalifaClusterEventDisplay.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class R3BCalifaClusterEventDisplay : public FairTask
4444
R3BCalifaClusterEventDisplay(const char* name, Int_t iVerbose = 1);
4545

4646
/** Destructor **/
47-
~R3BCalifaClusterEventDisplay();
47+
~R3BCalifaClusterEventDisplay() = default;
4848

4949
/** Virtual method Exec **/
5050
virtual void Exec(Option_t* opt);
@@ -55,9 +55,6 @@ class R3BCalifaClusterEventDisplay : public FairTask
5555
/** Virtual method Init **/
5656
virtual InitStatus Init();
5757

58-
/** Virtual method Finish **/
59-
virtual void Finish();
60-
6158
/** Accessors **/
6259

6360
protected:

evtvis/R3BCalifaEventDisplay.cxx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,6 @@ R3BCalifaEventDisplay::R3BCalifaEventDisplay(const char* name, Int_t iVerbose)
118118
, fProjManager2(NULL)
119119
{
120120
}
121-
// -----------------------------------------------------------------------
122-
123-
// ----- Destructor ----------------------------------------------------
124-
R3BCalifaEventDisplay::~R3BCalifaEventDisplay() {}
125-
// -------------------------------------------------------------------------
126121

127122
// ----- Public method Init --------------------------------------------
128123
InitStatus R3BCalifaEventDisplay::Init()
@@ -270,9 +265,6 @@ void R3BCalifaEventDisplay::Reset()
270265
delete fLego;
271266
}
272267

273-
// ---- Public method Finish --------------------------------------------------
274-
void R3BCalifaEventDisplay::Finish() {}
275-
276268
// ----- Private method CreateHistograms -------------------------------------
277269
void R3BCalifaEventDisplay::CreateHistograms()
278270
{

evtvis/R3BCalifaEventDisplay.h

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
// ----- Created 01/10/2012 by P.Cabanelas -----
1717
// -------------------------------------------------------------------------
1818

19-
#ifndef R3BCALIFAEVENTDISPLAY_H
20-
#define R3BCALIFAEVENTDISPLAY_H
19+
#pragma once
2120

2221
#include "FairTask.h"
2322

@@ -45,7 +44,7 @@ class R3BCalifaEventDisplay : public FairTask
4544
R3BCalifaEventDisplay(const char* name, Int_t iVerbose = 1);
4645

4746
/** Destructor **/
48-
~R3BCalifaEventDisplay();
47+
~R3BCalifaEventDisplay() = default;
4948

5049
/** Virtual method Exec **/
5150
virtual void Exec(Option_t* opt);
@@ -56,9 +55,6 @@ class R3BCalifaEventDisplay : public FairTask
5655
/** Virtual method Init **/
5756
virtual InitStatus Init();
5857

59-
/** Virtual method Finish **/
60-
virtual void Finish();
61-
6258
/** Public method SelectGeometryVersion
6359
**
6460
** Defines the geometry
@@ -120,5 +116,3 @@ class R3BCalifaEventDisplay : public FairTask
120116

121117
ClassDef(R3BCalifaEventDisplay, 2);
122118
};
123-
124-
#endif

evtvis/R3BEventManager.cxx

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,19 @@
1212
******************************************************************************/
1313

1414
#include "R3BEventManager.h"
15-
#include "FairLogger.h"
1615
#include "R3BIonName.h"
17-
#include "TDatabasePDG.h"
18-
#include "TEveGeoNode.h"
19-
#include "TEveManager.h"
20-
#include "TGeoManager.h"
2116

17+
#include <FairLogger.h>
18+
#include <TDatabasePDG.h>
19+
#include <TEveGeoNode.h>
20+
#include <TEveManager.h>
21+
#include <TGeoManager.h>
22+
#include <TString.h>
23+
24+
#include <fmt/core.h>
2225
#include <iostream>
26+
#include <string>
27+
2328
using namespace std;
2429

2530
R3BEventManager* R3BEventManager::fgRinstance = 0;
@@ -35,7 +40,6 @@ R3BEventManager::R3BEventManager()
3540

3641
void R3BEventManager::AddParticlesToPdgDataBase(Int_t pdgCode)
3742
{
38-
3943
TDatabasePDG* pdgDB = TDatabasePDG::Instance();
4044

4145
if (!pdgDB->GetParticle(pdgCode))
@@ -46,15 +50,14 @@ void R3BEventManager::AddParticlesToPdgDataBase(Int_t pdgCode)
4650
int mass = (temp - element * 1E4) / 10;
4751

4852
bool particleRecognised = true;
49-
char name[20];
53+
std::string name(64, '\0');
5054

51-
particleRecognised = ((R3BIonName*)fIonName)->GetIonName(element, name);
55+
particleRecognised = static_cast<R3BIonName*>(fIonName)->GetIonName(element, name.data());
5256

5357
if (particleRecognised)
5458
{
55-
char title[30];
56-
sprintf(title, "%s%i", name, mass);
57-
pdgDB->AddParticle(name, title, mass, kTRUE, 0, 0, "Ion", pdgCode);
59+
auto title = TString::Format("%s%d", name.c_str(), mass);
60+
pdgDB->AddParticle(name.c_str(), title.Data(), mass, kTRUE, 0, 0, "Ion", pdgCode);
5861
}
5962
}
6063
}

evtvis/test/CMakeLists.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
##############################################################################
2+
# Copyright (C) 2019 GSI Helmholtzzentrum für Schwerionenforschung GmbH #
3+
# Copyright (C) 2019-2025 Members of R3B Collaboration #
4+
# #
5+
# This software is distributed under the terms of the #
6+
# GNU General Public Licence (GPL) version 3, #
7+
# copied verbatim in the file "LICENSE". #
8+
# #
9+
# In applying this license GSI does not waive the privileges and immunities #
10+
# granted to it by virtue of its status as an Intergovernmental Organization #
11+
# or submit itself to any jurisdiction. #
12+
##############################################################################
13+
14+
generate_root_test_script(${R3BROOT_SOURCE_DIR}/evtvis/test/testEventSimulation.C)
15+
add_test(NAME EventVisSimulation COMMAND ${R3BROOT_BINARY_DIR}/evtvis/test/testEventSimulation.sh)
16+
set_tests_properties(EventVisSimulation PROPERTIES TIMEOUT "2000")
17+
set_tests_properties(EventVisSimulation PROPERTIES PASS_REGULAR_EXPRESSION
18+
"Macro finished successfully.")
19+
20+
generate_root_test_script(${R3BROOT_SOURCE_DIR}/evtvis/test/testEventDisplay.C)
21+
add_test(NAME EventDisplay COMMAND ${R3BROOT_BINARY_DIR}/evtvis/test/testEventDisplay.sh)
22+
set_tests_properties(EventDisplay PROPERTIES TIMEOUT "2000")
23+
set_tests_properties(EventDisplay PROPERTIES PASS_REGULAR_EXPRESSION
24+
"Macro finished successfully.")

0 commit comments

Comments
 (0)