Skip to content

Commit 57ad736

Browse files
committed
minor changes related to #6
1 parent 0c6d19c commit 57ad736

4 files changed

+54
-58
lines changed

CMakeLists.txt

+25-25
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
set( LibraryVersion "1.2" )
1+
set(LibraryVersion "1.2")
22
add_definitions(-DLIBRARY_VERSION="${LibraryVersion}")
33

44
if (${REST_DECAY0} MATCHES "ON")
@@ -14,28 +14,28 @@ if (${REST_DECAY0} MATCHES "ON")
1414
#
1515

1616
execute_process(
17-
COMMAND bxdecay0-config --version
18-
OUTPUT_VARIABLE BxDecay0_VERSION
19-
OUTPUT_STRIP_TRAILING_WHITESPACE)
20-
21-
execute_process(
22-
COMMAND bxdecay0-config --incdir
23-
OUTPUT_VARIABLE BxDecay0_INCLUDE_DIRS
24-
OUTPUT_STRIP_TRAILING_WHITESPACE)
25-
26-
execute_process(
27-
COMMAND bxdecay0-config --libdir
28-
OUTPUT_VARIABLE BxDecay0_LIBRARY_DIRS
29-
OUTPUT_STRIP_TRAILING_WHITESPACE)
30-
31-
32-
if(NOT DEFINED BxDecay0_VERSION)
33-
message(FATAL_ERROR "bxdecay0 not found! Put its binary dir to PATH!")
34-
endif()
35-
36-
message (STATUS "Found BxDecay0. Version ='${BxDecay0_VERSION}'")
37-
message (STATUS "Found BxDecay0. Include path ='${BxDecay0_INCLUDE_DIRS}'")
38-
message (STATUS "Found BxDecay0. Library path ='${BxDecay0_LIBRARY_DIRS}'")
17+
COMMAND bxdecay0-config --version
18+
OUTPUT_VARIABLE BxDecay0_VERSION
19+
OUTPUT_STRIP_TRAILING_WHITESPACE)
20+
21+
execute_process(
22+
COMMAND bxdecay0-config --incdir
23+
OUTPUT_VARIABLE BxDecay0_INCLUDE_DIRS
24+
OUTPUT_STRIP_TRAILING_WHITESPACE)
25+
26+
execute_process(
27+
COMMAND bxdecay0-config --libdir
28+
OUTPUT_VARIABLE BxDecay0_LIBRARY_DIRS
29+
OUTPUT_STRIP_TRAILING_WHITESPACE)
30+
31+
32+
if (NOT DEFINED BxDecay0_VERSION)
33+
message(FATAL_ERROR "bxdecay0 not found! Put its binary dir to PATH!")
34+
endif ()
35+
36+
message(STATUS "Found BxDecay0. Version ='${BxDecay0_VERSION}'")
37+
message(STATUS "Found BxDecay0. Include path ='${BxDecay0_INCLUDE_DIRS}'")
38+
message(STATUS "Found BxDecay0. Library path ='${BxDecay0_LIBRARY_DIRS}'")
3939

4040
set(external_include_dirs ${external_include_dirs} ${BxDecay0_INCLUDE_DIRS})
4141
set(external_libs "${external_libs} -L${BxDecay0_LIBRARY_DIRS} -lBxDecay0")
@@ -44,11 +44,11 @@ if (${REST_DECAY0} MATCHES "ON")
4444
set(feature_added ${feature_added} PARENT_SCOPE)
4545
else ()
4646
set(REST_DECAY0 OFF)
47-
set(excludes ${excludes} TRestGeant4ParticleCollectionDecay0 )
47+
set(excludes ${excludes} TRestGeant4ParticleCollectionDecay0)
4848
endif (${REST_DECAY0} MATCHES "ON")
4949

5050
if (NOT ${REST_EVE} MATCHES "ON")
51-
set(excludes ${excludes} TRestGeant4EventViewer )
51+
set(excludes ${excludes} TRestGeant4EventViewer)
5252
endif ()
5353

5454
COMPILELIB("")

inc/TRestGeant4Particle.h

+12-12
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
#ifndef RestCore_TRestGeant4Particle
1717
#define RestCore_TRestGeant4Particle
1818

19-
#include <iostream>
20-
19+
#include <TObject.h>
2120
#include <TString.h>
2221
#include <TVector3.h>
23-
#include "TObject.h"
22+
23+
#include <iostream>
2424

2525
class TRestGeant4Particle : public TObject {
2626
protected:
@@ -39,17 +39,17 @@ class TRestGeant4Particle : public TObject {
3939
Int_t GetParticleCharge() { return fCharge; }
4040
TVector3 GetOrigin() { return fOrigin; }
4141

42-
void SetParticle(TRestGeant4Particle ptcle) {
43-
fExcitationLevel = ptcle.GetExcitationLevel();
44-
fParticleName = ptcle.GetParticleName();
45-
fEnergy = ptcle.GetEnergy();
46-
fDirection = ptcle.GetMomentumDirection();
47-
fOrigin = ptcle.fOrigin;
42+
void SetParticle(TRestGeant4Particle particle) {
43+
fExcitationLevel = particle.GetExcitationLevel();
44+
fParticleName = particle.GetParticleName();
45+
fEnergy = particle.GetEnergy();
46+
fDirection = particle.GetMomentumDirection();
47+
fOrigin = particle.fOrigin;
4848
}
4949

50-
void SetParticleName(TString ptcle) { fParticleName = ptcle; }
51-
void SetExcitationLevel(Double_t eenergy) {
52-
fExcitationLevel = eenergy;
50+
void SetParticleName(TString particle) { fParticleName = particle; }
51+
void SetExcitationLevel(Double_t eEnergy) {
52+
fExcitationLevel = eEnergy;
5353
if (fExcitationLevel < 0) fExcitationLevel = 0;
5454
}
5555

inc/TRestGeant4ParticleCollection.h

+6-7
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,19 @@
1616
#ifndef RestCore_TRestGeant4ParticleCollection
1717
#define RestCore_TRestGeant4ParticleCollection
1818

19-
#include <iostream>
20-
21-
#include "TObject.h"
22-
19+
#include <TObject.h>
2320
#include <TRestGeant4Particle.h>
2421

22+
#include <iostream>
23+
2524
class TRestGeant4ParticleCollection : public TObject {
2625
protected:
2726
std::vector<TRestGeant4Particle> fParticles;
2827

2928
public:
3029
static TRestGeant4ParticleCollection* instantiate(std::string model = "");
3130

32-
virtual void SetParticleModel(std::string modelstring) {
31+
virtual void SetParticleModel(std::string modelString) {
3332
std::cout << "REST ERROR: SetParticleModel() called in base class "
3433
"TRestGeant4ParticleCollection"
3534
<< std::endl;
@@ -41,9 +40,9 @@ class TRestGeant4ParticleCollection : public TObject {
4140
virtual TRestGeant4Particle GetParticle(int i) { return fParticles[i]; }
4241

4342
virtual void RemoveParticles() { fParticles.clear(); }
44-
virtual void AddParticle(TRestGeant4Particle ptcle) { fParticles.push_back(ptcle); }
43+
virtual void AddParticle(TRestGeant4Particle particle) { fParticles.push_back(particle); }
4544

46-
// Construtor
45+
// Constructor
4746
TRestGeant4ParticleCollection();
4847
// Destructor
4948
virtual ~TRestGeant4ParticleCollection();

src/TRestGeant4Metadata.cxx

+11-14
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,6 @@ void TRestGeant4Metadata::ReadGenerator() {
952952
// TODO : If not defined (and required to be) it just returns (0,0,0) we
953953
// should make a WARNING. Inside StringToVector probably
954954
fGenPosition = Get3DVectorParameterWithUnits("position", generatorDefinition);
955-
956955
fGenRotation = StringTo3DVector(GetParameter("rotation", generatorDefinition));
957956

958957
string dimension2[2]{"length", "lenY"};
@@ -987,7 +986,6 @@ void TRestGeant4Metadata::ReadGenerator() {
987986
fGeneratorFile = use;
988987
info << "Reading custom sources from ROOT file : " << fGeneratorFile << endl;
989988
ReadGeneratorTreeFile(fGeneratorFile);
990-
// exit(1);
991989
} else {
992990
info << "Load custom sources from " << use << endl;
993991
TRestGeant4ParticleCollection* particleCollection =
@@ -1188,15 +1186,16 @@ void TRestGeant4Metadata::ReadGeneratorTreeFile(TString fName) {
11881186
debug << "TRestGeant4Metadata::ReadGeneratorTreeFile" << endl;
11891187

11901188
TFile* file;
1189+
TTree* GeneratorTree;
1190+
TString treeName = "GeneratorTree";
1191+
11911192
file = TFile::Open(fName, "READ");
11921193
if (!file) {
11931194
ferr << "Error opening file: " << fName << endl;
11941195
exit(1);
11951196
}
1196-
1197-
TTree* GeneratorTree;
1198-
TString treeName = "GeneratorTree";
11991197
file->GetObject(treeName, GeneratorTree);
1198+
12001199
if (!GeneratorTree) {
12011200
ferr << "Error reading TTree named " << treeName << " from " << fName << endl;
12021201
file->ls();
@@ -1214,10 +1213,10 @@ void TRestGeant4Metadata::ReadGeneratorTreeFile(TString fName) {
12141213

12151214
debug << "Setting up TTree" << endl;
12161215

1217-
vector<double>*x, *y, *z;
1218-
vector<double>*px, *py, *pz;
1219-
vector<double>*KE, *timeGlobal, *weight;
1220-
vector<TString>* particleName;
1216+
vector<double>*x = 0, *y = 0, *z = 0;
1217+
vector<double>*px = 0, *py = 0, *pz = 0;
1218+
vector<double>*KE = 0, *timeGlobal = 0, *weight = 0;
1219+
vector<TString>* particleName = 0;
12211220

12221221
GeneratorTree->SetBranchAddress("x", &x);
12231222
GeneratorTree->SetBranchAddress("y", &y);
@@ -1232,9 +1231,6 @@ void TRestGeant4Metadata::ReadGeneratorTreeFile(TString fName) {
12321231

12331232
debug << "Finished setting up TTree" << endl;
12341233

1235-
GeneratorTree->Show(0);
1236-
GeneratorTree->GetEntry(0);
1237-
12381234
TRestGeant4Particle particle;
12391235
for (int k = 0; k < numberOfGeneratorEvents; k++) {
12401236
debug << "- Getting entry " << k << endl;
@@ -1244,6 +1240,7 @@ void TRestGeant4Metadata::ReadGeneratorTreeFile(TString fName) {
12441240
particleCollection->RemoveParticles();
12451241

12461242
int nParticles = x->size();
1243+
debug << "Number of particles: " << nParticles << endl;
12471244

12481245
for (int i = 0; i < nParticles; i++) {
12491246
TString thisParticleName = (*particleName)[i];
@@ -1303,7 +1300,7 @@ void TRestGeant4Metadata::ReadEventDataFile(TString fName) {
13031300
///////////////////////////////////////////////
13041301
/// \brief Reads particle information using the file format from newer Decay0 versions.
13051302
///
1306-
/// This is an auxiliar method used in TRestGeant4Metadata::ReadEventDataFile that will read the Decay0 files
1303+
/// This is an auxiliary method used in TRestGeant4Metadata::ReadEventDataFile that will read the Decay0 files
13071304
/// produced with the newer Decay0 versions.
13081305
///
13091306
Int_t TRestGeant4Metadata::ReadNewDecay0File(TString fileName) {
@@ -1406,7 +1403,7 @@ Int_t TRestGeant4Metadata::ReadNewDecay0File(TString fileName) {
14061403
///////////////////////////////////////////////
14071404
/// \brief Reads particle information using the file format from older Decay0 versions.
14081405
///
1409-
/// This is an auxiliar method used in TRestGeant4Metadata::ReadEventDataFile that will read the Decay0 files
1406+
/// This is an auxiliary method used in TRestGeant4Metadata::ReadEventDataFile that will read the Decay0 files
14101407
/// produced with the newer Decay0 versions.
14111408
///
14121409
Int_t TRestGeant4Metadata::ReadOldDecay0File(TString fileName) {

0 commit comments

Comments
 (0)