From 1ba2ea8bf74881c5c75917de7d29142596c62e29 Mon Sep 17 00:00:00 2001 From: Matteo Tenti Date: Wed, 18 Oct 2023 02:13:21 -0500 Subject: [PATCH 1/5] LinkDef.h for classes defined in struct.h has been renamed in StructDictLinkDef.h. Removed all directives (including include) but '#pragma link C++ class event + ;'. Added SANDGeoManagerDictLinkDef.h for the generation of SANDGeoManager dictionary. These modifications are to avoid 'Warning: Unused class rule: event' warnings. --- CMakeLists.txt | 4 ++-- include/Linkdef.h | 23 ----------------------- include/SANDGeoManagerDictLinkDef.h | 4 ++++ include/StructDictLinkDef.h | 23 +++++++++++++++++++++++ 4 files changed, 29 insertions(+), 25 deletions(-) delete mode 100644 include/Linkdef.h create mode 100644 include/SANDGeoManagerDictLinkDef.h create mode 100644 include/StructDictLinkDef.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 96745e9..c969bbf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,12 +34,12 @@ target_include_directories(Struct PUBLIC "$" "$") target_link_libraries(Struct PUBLIC) -ROOT_GENERATE_DICTIONARY(StructDict struct.h MODULE Struct LINKDEF include/Linkdef.h) +ROOT_GENERATE_DICTIONARY(StructDict struct.h MODULE Struct LINKDEF include/StructDictLinkDef.h) # Create SANDGeoManager lib add_library(SANDGeoManager SHARED src/SANDGeoManager.cpp src/SANDSTTTubeInfo.cpp src/SANDECALCellInfo.cpp) target_link_libraries(SANDGeoManager PUBLIC EDepSim::edepsim_io) -ROOT_GENERATE_DICTIONARY(SANDGeoManagerDict SANDGeoManager.h SANDSTTTubeInfo.h SANDECALCellInfo.h MODULE SANDGeoManager LINKDEF include/Linkdef.h) +ROOT_GENERATE_DICTIONARY(SANDGeoManagerDict SANDGeoManager.h SANDSTTTubeInfo.h SANDECALCellInfo.h MODULE SANDGeoManager LINKDEF include/SANDGeoManagerDictLinkDef.h) # Creates a libUtils shared library add_library(Utils SHARED src/utils.cpp src/transf.cpp) diff --git a/include/Linkdef.h b/include/Linkdef.h deleted file mode 100644 index a1ce312..0000000 --- a/include/Linkdef.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifdef __CINT__ -#include "struct.h" - -#pragma link C++ class std::map < int, std::vector < double>> + ; -#pragma link C++ class std::map < int, std::vector < int>> + ; -#pragma link C++ class std::map < int, double> + ; -#pragma link C++ class std::vector < pe> + ; -#pragma link C++ class std::vector < dg_ps> + ; -#pragma link C++ class std::vector < dg_cell> + ; -#pragma link C++ class std::map < std::string, std::vector < hit>> + ; -#pragma link C++ class std::vector < dg_tube> + ; -#pragma link C++ class std::vector < track> + ; -#pragma link C++ class std::vector < cluster> + ; -#pragma link C++ class std::vector < particle> + ; -#pragma link C++ class pe + ; -#pragma link C++ class dg_ps + ; -#pragma link C++ class dg_tube + ; -#pragma link C++ class dg_cell + ; -#pragma link C++ class cluster + ; -#pragma link C++ class track + ; -#pragma link C++ class particle + ; -#pragma link C++ class event + ; -#endif \ No newline at end of file diff --git a/include/SANDGeoManagerDictLinkDef.h b/include/SANDGeoManagerDictLinkDef.h new file mode 100644 index 0000000..6870195 --- /dev/null +++ b/include/SANDGeoManagerDictLinkDef.h @@ -0,0 +1,4 @@ +#ifdef __CINT__ + +#pragma link C++ class SANDGeoManager + ; +#endif diff --git a/include/StructDictLinkDef.h b/include/StructDictLinkDef.h new file mode 100644 index 0000000..776d401 --- /dev/null +++ b/include/StructDictLinkDef.h @@ -0,0 +1,23 @@ +#ifdef __CINT__ +//#include "struct.h" + +//#pragma link C++ class std::map < int, std::vector < double>> + ; +//#pragma link C++ class std::map < int, std::vector < int>> + ; +//#pragma link C++ class std::map < int, double> + ; +//#pragma link C++ class std::vector < pe> + ; +//#pragma link C++ class std::vector < dg_ps> + ; +//#pragma link C++ class std::vector < dg_cell> + ; +//#pragma link C++ class std::map < std::string, std::vector < hit>> + ; +//#pragma link C++ class std::vector < dg_tube> + ; +//#pragma link C++ class std::vector < track> + ; +//#pragma link C++ class std::vector < cluster> + ; +//#pragma link C++ class std::vector < particle> + ; +//#pragma link C++ class pe + ; +//#pragma link C++ class dg_ps + ; +//#pragma link C++ class dg_tube + ; +//#pragma link C++ class dg_cell + ; +//#pragma link C++ class cluster + ; +//#pragma link C++ class track + ; +//#pragma link C++ class particle + ; +#pragma link C++ class event + ; +#endif From 3b2def61c9168f2c06d3d17ab3b78b38643cfaf6 Mon Sep 17 00:00:00 2001 From: Matteo Tenti Date: Wed, 18 Oct 2023 03:01:49 -0500 Subject: [PATCH 2/5] Removed '[...] may be used uninitialized in this function' warning temporay variables declaration moved in the scope they are used. --- src/utils.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/utils.cpp b/src/utils.cpp index 9288ae2..12ff790 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -618,15 +618,12 @@ void sand_reco::fluka::ecal::CellPosition(TGeoManager* geo, int det, int mod, int lay, int cel, double& x, double& y, double& z) { - x = 0; - y = 0; - z = 0; - - double dummyLoc[3]; - double dummyMas[3]; + double dummyMas[3] = {0., 0., 0.}; if (mod < 24) { + double dummyLoc[3]; + // Local coordinates calculation dummyLoc[0] = cellCoordBarrel[mod][lay][cel][0]; dummyLoc[1] = cellCoordBarrel[mod][lay][cel][1]; @@ -642,6 +639,8 @@ void sand_reco::fluka::ecal::CellPosition(TGeoManager* geo, int det, int mod, // left x < 0 : c->mod = 40 { + double dummyLoc[3]; + // Local coordinates calculation dummyLoc[0] = cellCoordEndcap[int(mod / 10)][lay][cel][0]; dummyLoc[1] = cellCoordEndcap[int(mod / 10)][lay][cel][1]; From 76c795aca502cfb7531b1cf3fa44da671d6236e1 Mon Sep 17 00:00:00 2001 From: Matteo Tenti Date: Wed, 18 Oct 2023 03:16:21 -0500 Subject: [PATCH 3/5] Removed 'this statement may fall through' warning Added [[fallthrough]] statement to cases in which fallthrough is on purpose. --- src/display.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/display.cpp b/src/display.cpp index d90de60..bba06ad 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -556,6 +556,7 @@ void show(int index, bool showtrj, bool showede, bool showdig, bool showrec) case 22: tr_zy->SetLineStyle(7); tr_zx->SetLineStyle(7); + [[fallthrough]]; // e+/e- case 11: case -11: @@ -922,6 +923,7 @@ void showPri(int index) // photons case 22: par->SetLineStyle(7); + [[fallthrough]]; // e+/e- case 11: case -11: @@ -983,6 +985,7 @@ void showPri(int index) // photons case 22: par->SetLineStyle(7); + [[fallthrough]]; // e+/e- case 11: case -11: @@ -1044,6 +1047,7 @@ void showPri(int index) // photons case 22: par->SetLineStyle(7); + [[fallthrough]]; // e+/e- case 11: case -11: @@ -1238,6 +1242,7 @@ void showPri(int index) // photons case 22: par->SetLineStyle(7); + [[fallthrough]]; // e+/e- case 11: case -11: @@ -1303,6 +1308,7 @@ void showPri(int index) // photons case 22: par->SetLineStyle(7); + [[fallthrough]]; // e+/e- case 11: case -11: @@ -1368,6 +1374,7 @@ void showPri(int index) // photons case 22: par->SetLineStyle(7); + [[fallthrough]]; // e+/e- case 11: case -11: From b36f82ccb9e4a47277835898fe344ee43ec1dd3b Mon Sep 17 00:00:00 2001 From: Matteo Tenti Date: Wed, 18 Oct 2023 03:44:15 -0500 Subject: [PATCH 4/5] =?UTF-8?q?Removed=20warning=20'variable=20=E2=80=98ge?= =?UTF-8?q?o=E2=80=99=20set=20but=20not=20used'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added dummy code to use the variable and avoid the warning --- src/SANDEventDisplay.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/SANDEventDisplay.cpp b/src/SANDEventDisplay.cpp index 7308272..7534a2c 100644 --- a/src/SANDEventDisplay.cpp +++ b/src/SANDEventDisplay.cpp @@ -1180,6 +1180,10 @@ void SANDEventDisplay::SetSimData(TString fileName) return; } + if (!geo) { + cout << " Geometry name: " << geo->GetName() << endl; + } + if (!fGeomInitialized) { // sand_reco::init(geo); fGeomInitialized = true; @@ -1212,6 +1216,10 @@ void SANDEventDisplay::SetDigitData(TString fileName) return; } + if (!geo) { + cout << " Geometry name: " << geo->GetName() << endl; + } + if (!fGeomInitialized) { // sand_reco::init(geo); fGeomInitialized = true; From bf257d4500958d04cf869323a29b26df0dca6846 Mon Sep 17 00:00:00 2001 From: Matteo Tenti Date: Wed, 18 Oct 2023 04:07:28 -0500 Subject: [PATCH 5/5] Renaming of LinkDef files --- CMakeLists.txt | 4 ++-- .../{SANDGeoManagerDictLinkDef.h => SANDGeoManagerLinkDef.h} | 0 include/{StructDictLinkDef.h => StructLinkDef.h} | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename include/{SANDGeoManagerDictLinkDef.h => SANDGeoManagerLinkDef.h} (100%) rename include/{StructDictLinkDef.h => StructLinkDef.h} (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index c969bbf..6936265 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,12 +34,12 @@ target_include_directories(Struct PUBLIC "$" "$") target_link_libraries(Struct PUBLIC) -ROOT_GENERATE_DICTIONARY(StructDict struct.h MODULE Struct LINKDEF include/StructDictLinkDef.h) +ROOT_GENERATE_DICTIONARY(StructDict struct.h MODULE Struct LINKDEF include/StructLinkDef.h) # Create SANDGeoManager lib add_library(SANDGeoManager SHARED src/SANDGeoManager.cpp src/SANDSTTTubeInfo.cpp src/SANDECALCellInfo.cpp) target_link_libraries(SANDGeoManager PUBLIC EDepSim::edepsim_io) -ROOT_GENERATE_DICTIONARY(SANDGeoManagerDict SANDGeoManager.h SANDSTTTubeInfo.h SANDECALCellInfo.h MODULE SANDGeoManager LINKDEF include/SANDGeoManagerDictLinkDef.h) +ROOT_GENERATE_DICTIONARY(SANDGeoManagerDict SANDGeoManager.h SANDSTTTubeInfo.h SANDECALCellInfo.h MODULE SANDGeoManager LINKDEF include/SANDGeoManagerLinkDef.h) # Creates a libUtils shared library add_library(Utils SHARED src/utils.cpp src/transf.cpp) diff --git a/include/SANDGeoManagerDictLinkDef.h b/include/SANDGeoManagerLinkDef.h similarity index 100% rename from include/SANDGeoManagerDictLinkDef.h rename to include/SANDGeoManagerLinkDef.h diff --git a/include/StructDictLinkDef.h b/include/StructLinkDef.h similarity index 100% rename from include/StructDictLinkDef.h rename to include/StructLinkDef.h