Skip to content
This repository was archived by the owner on May 6, 2024. It is now read-only.

Commit aec46d2

Browse files
EinarElentomeichlersmith
authored andcommitted
Final formatting
1 parent 4150170 commit aec46d2

13 files changed

Lines changed: 73 additions & 117 deletions

include/SimCore/DetectorConstruction.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class DetectorConstruction : public G4VUserDetectorConstruction {
7272
framework::config::Parameters parameters_;
7373

7474
/// interface to conditions to be passed to SDs
75-
simcore::ConditionsInterface& conditions_interface_;
75+
simcore::ConditionsInterface &conditions_interface_;
7676
}; // DetectorConstruction
7777
} // namespace simcore
7878

include/SimCore/Factory.h

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
#ifndef SIMCORE_FACTORY_H
22
#define SIMCORE_FACTORY_H
33

4-
#include <memory> // for the unique_ptr default
5-
#include <string> // for the keys in the library map
6-
#include <unordered_map> // for the library of prototypes
7-
#include <algorithm> // for for_each call in apply
8-
9-
#include <boost/core/demangle.hpp> // for demangling
4+
#include <algorithm> // for for_each call in apply
5+
#include <boost/core/demangle.hpp> // for demangling
6+
#include <memory> // for the unique_ptr default
7+
#include <string> // for the keys in the library map
8+
#include <unordered_map> // for the library of prototypes
109

1110
#include "Framework/Exception/Exception.h"
1211

@@ -21,7 +20,7 @@ namespace simcore {
2120
* @tparam Prototype the type of object that this factory creates.
2221
* This should be the base class that all types in this factory derive from.
2322
* @tparam PrototypePtr the type of pointer that the factory creates
24-
* @tparam PrototypeConstructorArgs parameter pack of arguments to pass
23+
* @tparam PrototypeConstructorArgs parameter pack of arguments to pass
2524
* to the object constructor.
2625
*
2726
* ## Terminology
@@ -42,10 +41,11 @@ namespace simcore {
4241
* to it in the form of a prototype-class pointer.
4342
*
4443
* ### Declaration
45-
* Using an
46-
* [unnamed namespace](https://en.cppreference.com/w/cpp/language/namespace#Unnamed_namespaces)
47-
* defines the variables inside it as having internal linkage and as implicitly
48-
* static. Having internal linkage allows us to have repeat variable names
44+
* Using an
45+
* [unnamed
46+
namespace](https://en.cppreference.com/w/cpp/language/namespace#Unnamed_namespaces)
47+
* defines the variables inside it as having internal linkage and as implicitly
48+
* static. Having internal linkage allows us to have repeat variable names
4949
* across different source files. Being static means that the variable is
5050
* guaranteed to be constructed during library load time.
5151
*
@@ -61,7 +61,8 @@ namespace simcore {
6161
* ```
6262
*
6363
* The details of how this is handled is documented in
64-
* [Storage Class Specifiers](https://en.cppreference.com/w/cpp/language/storage_duration).
64+
* [Storage Class
65+
Specifiers](https://en.cppreference.com/w/cpp/language/storage_duration).
6566
*
6667
* ## Usage
6768
*
@@ -82,7 +83,7 @@ namespace simcore {
8283
* #define LIBRARYENTRY_HPP
8384
* // we need the factory template
8485
* #include "Factory.h"
85-
*
86+
*
8687
* // this class is our prototype
8788
* class LibraryEntry {
8889
* public:
@@ -93,7 +94,7 @@ namespace simcore {
9394
* // the factory type that we will use here
9495
* using Factory = ::fire::factory::Factory<LibraryEntry>;
9596
* }; // LibraryEntry
96-
*
97+
*
9798
* // a macro to help with registering our library entries with our factory
9899
* #define DECLARE_LIBRARYENTRY(CLASS) \
99100
* namespace { \
@@ -116,10 +117,10 @@ namespace simcore {
116117
* }
117118
* };
118119
* }
119-
*
120+
*
120121
* DECLARE_LIBRARYENTRY(library::Book)
121122
* ```
122-
*
123+
*
123124
* ```cpp
124125
* // Podcast.cpp
125126
* #include "LibraryEntry.hpp"
@@ -133,10 +134,10 @@ namespace simcore {
133134
* };
134135
* }
135136
* }
136-
*
137+
*
137138
* DECLARE_LIBRARYENTRY(library::audio::Podcast)
138139
* ```
139-
*
140+
*
140141
* ```cpp
141142
* // Album.cpp
142143
* #include "LibraryEntry.hpp"
@@ -150,7 +151,7 @@ namespace simcore {
150151
* };
151152
* }
152153
* }
153-
*
154+
*
154155
* DECLARE_LIBRARYENTRY(library::audio::Album)
155156
* ```
156157
*
@@ -165,9 +166,9 @@ namespace simcore {
165166
* ```cpp
166167
* // main.cxx
167168
* #include "LibraryEntry.hpp"
168-
*
169+
*
169170
* int main(int argc, char* argv[]) {
170-
* std::string full_cpp_name{argv[1]};
171+
* std::string full_cpp_name{argv[1]};
171172
* try {
172173
* auto entry_ptr{LibraryEntry::Factory::get().make(full_cpp_name)};
173174
* std::cout << entry_ptr->name() << std::endl;
@@ -176,7 +177,7 @@ namespace simcore {
176177
* }
177178
* }
178179
* ```
179-
*
180+
*
180181
* Compiling these files together into the `fave-things` executable would
181182
* then lead to the following behavior.
182183
*
@@ -191,8 +192,7 @@ namespace simcore {
191192
* ERROR: An object named library::DoesNotExist has not been declared.
192193
* ```
193194
*/
194-
template <typename Prototype,
195-
typename PrototypePtr,
195+
template <typename Prototype, typename PrototypePtr,
196196
typename... PrototypeConstructorArgs>
197197
class Factory {
198198
public:
@@ -237,7 +237,7 @@ class Factory {
237237
* at library load time. It relates to variables so that it cannot be
238238
* optimized away.
239239
*/
240-
template<typename DerivedType>
240+
template <typename DerivedType>
241241
uint64_t declare() {
242242
std::string full_name{boost::core::demangle(typeid(DerivedType).name())};
243243
library_[full_name] = &maker<DerivedType>;
@@ -256,7 +256,8 @@ class Factory {
256256
* The arguments to the maker are determined at compiletime
257257
* using the template parameters of Factory.
258258
*
259-
* @param[in] full_name name of class to create, same name as passed to declare
259+
* @param[in] full_name name of class to create, same name as passed to
260+
* declare
260261
* @param[in] maker_args parameter pack of arguments to pass on to maker
261262
*
262263
* @returns a pointer to the parent class that the objects derive from.
@@ -265,8 +266,8 @@ class Factory {
265266
PrototypeConstructorArgs... maker_args) {
266267
auto lib_it{library_.find(full_name)};
267268
if (lib_it == library_.end()) {
268-
EXCEPTION_RAISE("SimFactory","An object named "+full_name+
269-
" has not been declared.");
269+
EXCEPTION_RAISE("SimFactory", "An object named " + full_name +
270+
" has not been declared.");
270271
}
271272
warehouse_.emplace_back(lib_it->second(maker_args...));
272273
return warehouse_.back();
@@ -278,7 +279,7 @@ class Factory {
278279
* UnaryFunction is simply passed dirctly to std::for_each so
279280
* look there for requirements upon it.
280281
*/
281-
template<class UnaryFunction>
282+
template <class UnaryFunction>
282283
void apply(UnaryFunction f) const {
283284
std::for_each(warehouse_.begin(), warehouse_.end(), f);
284285
}
@@ -293,9 +294,9 @@ class Factory {
293294
/**
294295
* make a new DerivedType returning a PrototypePtr
295296
*
296-
* Basically a copy of what
297-
* [`std::make_unique`](https://en.cppreference.com/w/cpp/memory/unique_ptr/make_unique)
298-
* or
297+
* Basically a copy of what
298+
* [`std::make_unique`](https://en.cppreference.com/w/cpp/memory/unique_ptr/make_unique)
299+
* or
299300
* [`std::make_shared`](https://en.cppreference.com/w/cpp/memory/shared_ptr/make_shared)
300301
* do but with the following changes:
301302
* 1. constructor arguments defined by the Factory and not here
@@ -311,7 +312,8 @@ class Factory {
311312
*/
312313
template <typename DerivedType>
313314
static PrototypePtr maker(PrototypeConstructorArgs... args) {
314-
return PrototypePtr(new DerivedType(std::forward<PrototypeConstructorArgs>(args)...));
315+
return PrototypePtr(
316+
new DerivedType(std::forward<PrototypeConstructorArgs>(args)...));
315317
}
316318

317319
/// private constructor to prevent creation
@@ -325,5 +327,4 @@ class Factory {
325327
}; // Factory
326328

327329
} // namespace simcore
328-
329330
#endif // SIMCORE_FACTORY_H

include/SimCore/G4User/TrackingAction.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class TrackingAction : public G4UserTrackingAction {
9090
* We start by calling any other tracking actions'
9191
* PostUserTrackingAction methods.
9292
*
93-
* If the track should be saved (it's save flag is set to true)
93+
* If the track should be saved (it's save flag is set to true)
9494
* and it is being stopped, then we save it in the track map.
9595
*
9696
* @note This is where we make the final decision on if a
@@ -135,6 +135,6 @@ class TrackingAction : public G4UserTrackingAction {
135135
TrackMap trackMap_;
136136
}; // TrackingAction
137137

138-
} // namespace simcore
138+
} // namespace simcore::g4user
139139

140140
#endif

include/SimCore/LHE/LHEReader.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,6 @@ class LHEReader {
4545
std::ifstream ifs_;
4646
};
4747

48-
} // namespace simcore
48+
} // namespace simcore::lhe
4949

5050
#endif

include/SimCore/UserTrackInformation.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
#define SIMCORE_USERTRACKINFORMATION_H
33

44
#include "G4ThreeVector.hh"
5-
#include "G4VUserTrackInformation.hh"
65
#include "G4Track.hh"
6+
#include "G4VUserTrackInformation.hh"
77

88
namespace simcore {
99

src/SimCore/BiasOperators/ElectroNuclear.cxx

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,39 +14,18 @@ ElectroNuclear::ElectroNuclear(std::string name,
1414

1515
G4VBiasingOperation* ElectroNuclear::ProposeOccurenceBiasingOperation(
1616
const G4Track* track, const G4BiasingProcessInterface* callingProcess) {
17-
/*std::cout << "[ ElectroNuclearXsecBiasingOperator ]: "
18-
<< "Track ID: " << track->GetTrackID() << ", "
19-
<< "Parent ID: " << track->GetParentID() << ", "
20-
<< "Created within " << track->GetLogicalVolumeAtVertex()->GetName()
21-
<< ", "
22-
<< "Currently in volume " << track->GetVolume()->GetName()
23-
<< std::endl;*/
24-
2517
if (track->GetKineticEnergy() < threshold_) {
2618
return nullptr;
2719
}
2820

29-
/*std::cout << "[ ElectroNuclearXsecBiasingOperator ]: "
30-
<< "Calling process: "
31-
<< callingProcess->GetWrappedProcess()->GetProcessName()
32-
<< std::endl;*/
33-
3421
std::string currentProcess =
3522
callingProcess->GetWrappedProcess()->GetProcessName();
3623
if (currentProcess.compare(this->getProcessToBias()) == 0) {
3724
G4double interactionLength =
3825
callingProcess->GetWrappedProcess()->GetCurrentInteractionLength();
39-
/*std::cout << "[ ElectroNuclearXsecBiasingOperator ]: "
40-
<< "EN Interaction length: "
41-
<< interactionLength << std::endl;*/
42-
4326
double enXsecUnbiased = 1. / interactionLength;
44-
/*std::cout << "[ ElectroNuclearXsecBiasingOperator ]: Unbiased EN xsec: "
45-
<< enXsecUnbiased << std::endl;*/
4627

4728
double enXsecBiased = enXsecUnbiased * factor_;
48-
/*std::cout << "[ ElectroNuclearXsecBiasingOperator ]: Biased EN xsec: "
49-
<< enXsecBiased << std::endl;*/
5029

5130
return BiasedXsec(enXsecBiased);
5231
}

src/SimCore/BiasOperators/PhotoNuclear.cxx

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ void PhotoNuclear::StartRun() {
2929

3030
G4VBiasingOperation* PhotoNuclear::ProposeOccurenceBiasingOperation(
3131
const G4Track* track, const G4BiasingProcessInterface* callingProcess) {
32-
/*std::cout << "[ PhotoNuclearXsecBiasingOperator ]: "
33-
<< "Kinetic energy: " << track->GetKineticEnergy()
34-
<< " MeV" << std::endl;*/
35-
3632
// if we want to only bias children of primary, leave if this track is NOT a
3733
// child of the primary
3834
if (only_children_of_primary_ and track->GetParentID() != 1) {
@@ -44,50 +40,30 @@ G4VBiasingOperation* PhotoNuclear::ProposeOccurenceBiasingOperation(
4440
return nullptr;
4541
}
4642

47-
/*std::cout << "[ PhotoNuclearXsecBiasingOperator ]: "
48-
<< "Calling process: "
49-
<< callingProcess->GetWrappedProcess()->GetProcessName()
50-
<< std::endl;*/
51-
5243
std::string currentProcess =
5344
callingProcess->GetWrappedProcess()->GetProcessName();
5445
if (currentProcess.compare(this->getProcessToBias()) == 0) {
5546
G4double interactionLength =
5647
callingProcess->GetWrappedProcess()->GetCurrentInteractionLength();
57-
/*std::cout << "[ PhotoNuclearXsecBiasingOperator ]: "
58-
<< "PN Interaction length: "
59-
<< interactionLength << std::endl;*/
6048

6149
pnXsecUnbiased_ = 1. / interactionLength;
62-
/*std::cout << "[ PhotoNuclearXsecBiasingOperator ]: Unbiased PN xsec: "
63-
<< pnXsecUnbiased_ << std::endl;*/
6450

6551
pnXsecBiased_ = pnXsecUnbiased_ * factor_;
66-
/*std::cout << "[ PhotoNuclearXsecBiasingOperator ]: Biased PN xsec: "
67-
<< pnXsecBiased_ << std::endl;*/
6852

6953
return BiasedXsec(pnXsecBiased_);
70-
71-
} else if ((currentProcess.compare(CONVERSION_PROCESS) == 0) and
72-
down_bias_conv_) {
54+
}
55+
if ((currentProcess.compare(CONVERSION_PROCESS) == 0) and down_bias_conv_) {
7356
G4double interactionLength =
7457
callingProcess->GetWrappedProcess()->GetCurrentInteractionLength();
75-
/*std::cout << "[ PhotoNuclearXsecBiasingOperator ]: "
76-
<< "EM Interaction length: "
77-
<< interactionLength << std::endl;*/
7858

7959
double emXsecUnbiased = 1. / interactionLength;
80-
/*std::cout << "[ PhotoNuclearXsecBiasingOperator ]: Unbiased EM xsec: "
81-
<< emXsecUnbiased << std::endl;*/
8260

8361
double emXsecBiased = std::max(
8462
emXsecUnbiased + pnXsecUnbiased_ - pnXsecBiased_, pnXsecUnbiased_);
8563
if (emXsecBiased == pnXsecUnbiased_) {
8664
G4cout << "[ PhotoNuclearXsecBiasingOperator ]: [ WARNING ]: "
8765
<< "Biasing factor is too large." << std::endl;
8866
}
89-
/*std::cout << "[ PhotoNuclearXsecBiasingOperator ]: Biased EM xsec: "
90-
<< emXsecBiased << std::endl;*/
9167

9268
emXsecOperation->SetBiasedCrossSection(emXsecBiased);
9369
emXsecOperation->Sample();

0 commit comments

Comments
 (0)