Skip to content

Commit ad6983f

Browse files
authored
Merge branch 'dev' into feature_sensitive_volumes
2 parents 011da54 + 8e817e6 commit ad6983f

40 files changed

+460
-318
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6868
* Deprecate some singleton-like APIs:
6969
* `FairRunAnaProof::Instance()` - keep a pointer to the
7070
object after `new` in your code.
71+
* `FairRadGridManager::Instance()` - Consider using the
72+
`GetRadGridMan()` method on `FairMCApplcation`.
7173
* `FairRadMapManager::Instance`, `FairRadLenManager::Instance`
74+
* Deprecated some other APIs
75+
`FairGeoVector::round` was nonfunctional and never did anything.
7276
* Many items were already deprecated in prior versions.
7377
Marked them with proper C++14 deprecation warnings.
7478
Scheduled them for removal in v20.

CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ SET(FAIRROOT_MAJOR_VERSION 19)
2121
SET(FAIRROOT_MINOR_VERSION 0)
2222
SET(FAIRROOT_PATCH_VERSION 0)
2323

24-
set(PROJECT_MIN_CXX_STANDARD 14)
24+
set(PROJECT_MIN_CXX_STANDARD 17)
2525

2626
# Set name of our project to "FAIRROOT".
2727
# Has to be done after check of cmake version
@@ -146,6 +146,12 @@ include(ROOTMacros)
146146
#Check the compiler and set the compile and link flags
147147
Check_Compiler()
148148

149+
if(CMAKE_CXX_CLANG_TIDY)
150+
# Force clang-tidy to the same C++ Standard
151+
list(APPEND CMAKE_CXX_CLANG_TIDY
152+
"--extra-arg=-std=c++${CMAKE_CXX_STANDARD}")
153+
endif()
154+
149155
fairroot_check_root_cxxstd_compatibility()
150156

151157
if(ROOT_vmc_FOUND)
@@ -213,7 +219,6 @@ EndIf (Boost_FOUND)
213219

214220
set(FAIRROOT_LIBRARY_PROPERTIES ${FAIRROOT_LIBRARY_PROPERTIES}
215221
VERSION "${PROJECT_VERSION}"
216-
SOVERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}"
217222
)
218223
set(PROJECT_LIBRARY_PROPERTIES ${FAIRROOT_LIBRARY_PROPERTIES})
219224

Jenkinsfile

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ def jobMatrix(String prefix, String type, List specs) {
2424
nodes[label] = {
2525
node(selector) {
2626
githubNotify(context: "${prefix}/${label}", description: 'Building ...', status: 'PENDING')
27+
def logpattern = 'build/Testing/Temporary/*.log'
2728
try {
2829
deleteDir()
2930
checkout scm
@@ -62,7 +63,6 @@ def jobMatrix(String prefix, String type, List specs) {
6263
sh "./slurm-submit.sh \"FairRoot \${JOB_BASE_NAME} ${label}\" ${jobscript}"
6364
}
6465
if (check == "warnings") {
65-
def logpattern = 'build/Testing/Temporary/*.log'
6666
discoverGitReferenceBuild()
6767
recordIssues(tools: [clangTidy(pattern: logpattern)],
6868
filters: [excludeFile('build/.*/G__.*[.]cxx')],
@@ -75,6 +75,9 @@ def jobMatrix(String prefix, String type, List specs) {
7575
deleteDir()
7676
githubNotify(context: "${prefix}/${label}", description: 'Success', status: 'SUCCESS')
7777
} catch (e) {
78+
if (check == "warnings") {
79+
archiveArtifacts(artifacts: logpattern, allowEmptyArchive: true, fingerprint: true)
80+
}
7881
deleteDir()
7982
githubNotify(context: "${prefix}/${label}", description: 'Error', status: 'ERROR')
8083
throw e
@@ -92,31 +95,30 @@ pipeline{
9295
steps{
9396
script {
9497
def builds = jobMatrix('alfa-ci', 'build', [
95-
[os: 'centos', ver: '7', arch: 'x86_64', compiler: 'gcc-7', fairsoft: 'nov20_patches'],
96-
[os: 'centos', ver: '7', arch: 'x86_64', compiler: 'gcc-7', fairsoft: 'nov20_patches_mt'],
9798
[os: 'centos', ver: '7', arch: 'x86_64', compiler: 'gcc-7', fairsoft: 'apr21_patches'],
9899
[os: 'centos', ver: '7', arch: 'x86_64', compiler: 'gcc-7', fairsoft: 'apr21_patches_mt'],
99-
[os: 'debian', ver: '10', arch: 'x86_64', compiler: 'gcc-8', fairsoft: 'nov20_patches'],
100-
[os: 'debian', ver: '10', arch: 'x86_64', compiler: 'gcc-8', fairsoft: 'nov20_patches_mt'],
101100
[os: 'debian', ver: '10', arch: 'x86_64', compiler: 'gcc-8', fairsoft: 'apr21_patches'],
102101
[os: 'debian', ver: '10', arch: 'x86_64', compiler: 'gcc-8', fairsoft: 'apr21_patches_mt'],
102+
[os: 'debian', ver: '11', arch: 'x86_64', compiler: 'gcc-8', fairsoft: 'apr21_patches'],
103+
[os: 'debian', ver: '11', arch: 'x86_64', compiler: 'gcc-8', fairsoft: 'apr21_patches_mt'],
104+
[os: 'debian', ver: '11', arch: 'x86_64', compiler: 'gcc-8', fairsoft: 'apr22_patches'],
105+
[os: 'debian', ver: '11', arch: 'x86_64', compiler: 'gcc-8', fairsoft: 'apr22_patches_mt'],
103106
[os: 'ubuntu', ver: '20.04', arch: 'x86_64', compiler: 'gcc-9', fairsoft: 'apr21_patches'],
104107
[os: 'ubuntu', ver: '20.04', arch: 'x86_64', compiler: 'gcc-9', fairsoft: 'apr21_patches_mt'],
105108
[os: 'ubuntu', ver: 'rolling', arch: 'x86_64', compiler: 'current', fairsoft: 'dev',
106109
check: 'warnings',
107110
extra: '-DUSE_CLANG_TIDY=ON -DBUILD_MBS=OFF'],
108111
[os: 'fedora', ver: '33', arch: 'x86_64', compiler: 'gcc-10', fairsoft: 'apr21_patches'],
109112
[os: 'fedora', ver: '33', arch: 'x86_64', compiler: 'gcc-10', fairsoft: 'apr21_patches_mt'],
110-
// [os: 'macos', ver: '10.15', arch: 'x86_64', compiler: 'apple-clang-11', fairsoft: '20.11'],
111-
// [os: 'macos', ver: '11', arch: 'x86_64', compiler: 'apple-clang-12', fairsoft: '20.11'],
112-
[os: 'macos', ver: '12', arch: 'x86_64', compiler: 'apple-clang-13', fairsoft: '21.4'],
113-
[os: 'macos', ver: '11', arch: 'x86_64', compiler: 'apple-clang-13', fairsoft: '21.4'],
113+
[os: 'macos', ver: '12', arch: 'arm64', compiler: 'apple-clang-13', fairsoft: '22.4'],
114+
[os: 'macos', ver: '12', arch: 'x86_64', compiler: 'apple-clang-13', fairsoft: '22.4'],
115+
[os: 'macos', ver: '11', arch: 'x86_64', compiler: 'apple-clang-13', fairsoft: '22.4'],
114116
])
115117

116118
def checks = [:]
117119
if (env.CHANGE_ID != null) { // only run checks for PRs
118120
checks = jobMatrix('alfa-ci', 'check', [
119-
[os: 'debian', ver: '10', arch: 'x86_64', check: 'format', fairsoft: 'nov20_patches'],
121+
[os: 'debian', ver: '10', arch: 'x86_64', check: 'format', fairsoft: 'apr21_patches'],
120122
])
121123
}
122124

base/MQ/policies/Serialization/RootSerializer.h

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ struct RootSerializer
4141
template<typename T>
4242
void Serialize(fair::mq::Message& msg, T* input)
4343
{
44-
TMessage* tm = new TMessage(kMESS_OBJECT);
44+
auto tm = new TMessage(kMESS_OBJECT);
4545
tm->WriteObject(input);
4646
msg.Rebuild(
4747
tm->Buffer(), tm->BufferSize(), [](void*, void* tmsg) { delete static_cast<TMessage*>(tmsg); }, tm);
@@ -50,26 +50,33 @@ struct RootSerializer
5050
template<typename T>
5151
void Serialize(fair::mq::Message& msg, const std::unique_ptr<T>& input)
5252
{
53-
TMessage* tm = new TMessage(kMESS_OBJECT);
53+
auto tm = new TMessage(kMESS_OBJECT);
5454
tm->WriteObject(input.get());
5555
msg.Rebuild(
5656
tm->Buffer(), tm->BufferSize(), [](void*, void* tmsg) { delete static_cast<TMessage*>(tmsg); }, tm);
5757
}
5858

5959
template<typename T>
60-
void Deserialize(fair::mq::Message& msg, T*& output)
60+
void Deserialize(const fair::mq::Message& msg, T*& output)
6161
{
6262
delete output;
6363
FairTMessage tm(msg.GetData(), msg.GetSize());
6464
output = static_cast<T*>(tm.ReadObjectAny(tm.GetClass()));
6565
}
6666

6767
template<typename T>
68-
void Deserialize(fair::mq::Message& msg, std::unique_ptr<T>& output)
68+
void Deserialize(const fair::mq::Message& msg, std::unique_ptr<T>& output)
6969
{
7070
FairTMessage tm(msg.GetData(), msg.GetSize());
7171
output.reset(static_cast<T*>(tm.ReadObjectAny(tm.GetClass())));
7272
}
73+
74+
template<typename T>
75+
[[nodiscard]] std::unique_ptr<T> DeserializeTo(const fair::mq::Message& msg)
76+
{
77+
FairTMessage tm(msg.GetData(), msg.GetSize());
78+
return std::unique_ptr<T>{static_cast<T*>(tm.ReadObjectAny(tm.GetClass()))};
79+
}
7380
};
7481

7582
#endif /* ROOTSERIALIZER_H */

base/sim/FairMCApplication.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,11 @@ class FairMCApplication : public TVirtualMCApplication
227227
*/
228228
FairVolume* GetFairVolume();
229229

230+
/**
231+
* Return non-owning pointer to FairRadGridManager
232+
*/
233+
auto GetRadGridMan() { return fRadGridMan.get(); }
234+
230235
private:
231236
// methods
232237
Int_t GetIonPdg(Int_t z, Int_t a) const;

base/sink/FairRootFileSink.cxx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,11 @@ void FairRootFileSink::RegisterImpl(const char* /* name */, const char* folderNa
248248

249249
void FairRootFileSink::RegisterAny(const char* brname, const std::type_info& oi, const std::type_info& pi, void* obj)
250250
{
251+
if (fPersistentBranchesDone) {
252+
LOG(warning) << "FairRootFileSink::RegisterAny called for branch \"" << brname
253+
<< "\" after FairRootFileSink::CreatePersistentBranchesAny has already completed. "
254+
"The branch will not be registered.";
255+
}
251256
fPersistentBranchesMap[brname] = std::unique_ptr<TypeAddressPair const>(new TypeAddressPair(oi, pi, obj));
252257
}
253258

@@ -303,6 +308,7 @@ bool FairRootFileSink::CreatePersistentBranchesAny()
303308
LOG(info) << "Creating branch for " << iter.first.c_str() << " with address " << obj;
304309
fOutTree->Branch(iter.first.c_str(), tname.c_str(), obj);
305310
}
311+
fPersistentBranchesDone = true;
306312
return true;
307313
}
308314

base/sink/FairRootFileSink.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ class FairRootFileSink : public FairSink
9393
/**File Header*/
9494
FairFileHeader* fFileHeader; //!
9595

96+
bool fPersistentBranchesDone{false}; //!
97+
9698
ClassDef(FairRootFileSink, 1);
9799
};
98100

base/steer/FairRadGridManager.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ class FairRadGridManager
3232
/**
3333
* Default constructor.
3434
* Creates the singleton object of FairRadGridManager class.
35-
* The pointer to this object can be reached via FairRadGridManager::Instance().
3635
*/
3736
FairRadGridManager();
3837
/**
@@ -112,8 +111,9 @@ class FairRadGridManager
112111
* This function is used to access the methods of the class.
113112
* @return Pointer to the singleton FairRadGridManager object, created
114113
* with FairRadGridManager::FairRadGridManager().
114+
* \deprecated Deprecated in v19, will be removed in v20.
115115
*/
116-
static FairRadGridManager* Instance();
116+
[[deprecated("Maybe use FairMCApplcation::GetRadGridMan()")]] static FairRadGridManager* Instance();
117117
};
118118

119119
#endif

base/steer/FairRootManager.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,6 @@ class FairRootManager : public TObject
166166
/** create a new branch based on an arbitrary type T (for which a dictionary must exist) **/
167167
template<typename T>
168168
void RegisterAny(const char* name, T*& obj, Bool_t toFile);
169-
/// for branches which are not managed by folders, we need a special function
170-
/// to trigger persistent branch creation
171-
/// return true if successful; false if problem
172-
bool CreatePersistentBranchesAny();
173169

174170
void RegisterInputObject(const char* name, TObject* obj);
175171

@@ -355,8 +351,6 @@ class FairRootManager : public TObject
355351
/// used for branches registered with RegisterAny; use of ptr here
356352
/// since type_info cannot be copied
357353
std::map<std::string, std::unique_ptr<TypeAddressPair const>> fAnyBranchMap; //!
358-
/// keeps track of branches which are supposed to be persistified
359-
std::vector<std::string> fPersistentBranchesAny;
360354

361355
/**Branch id for this run */
362356
Int_t fBranchSeqId;

base/steer/FairRunSim.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,11 @@ class FairRunSim : public FairRun
189189

190190
void StopMCRun() { fApp->StopMCRun(); }
191191

192+
/**
193+
* Get non-owning pointer to FairMCApplication
194+
*/
195+
auto GetMCApplication() { return fApp; }
196+
192197
private:
193198
FairRunSim(const FairRunSim& M);
194199
FairRunSim& operator=(const FairRunSim&) { return *this; }

0 commit comments

Comments
 (0)