Skip to content

Commit eade104

Browse files
committed
just formatting
1 parent 247beed commit eade104

File tree

7 files changed

+128
-131
lines changed

7 files changed

+128
-131
lines changed

SConstruct

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ from init_env import init_environment
22

33
# adding ccdb as temporary dependency
44
# will be removed once the hit process routines are plugins
5-
env = init_environment("qt5 geant4 clhep evio xercesc ccdb mlibrary cadmesh hipo c12bfields")
5+
env = init_environment("qt5 geant4 clhep xercesc ccdb mlibrary cadmesh hipo c12bfields")
66
env.Append(CXXFLAGS=['-std=c++17'])
77

88
# addressing shortcoming of geant4-config 10.7.4 not returning all libraries
@@ -160,7 +160,7 @@ env.Library(source = hitp_sources, target = "lib/ghitprocess")
160160
env.Append(CPPPATH = 'output')
161161
output_sources = Split("""
162162
output/outputFactory.cc
163-
output/evio_output.cc
163+
164164
output/hipo_output.cc
165165
output/hipoSchemas.cc
166166
output/txt_output.cc

materials/material_factory.cc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ map<string, G4Material *> materials::materialsFromMap(map <string, material> mma
390390

391391
optTable.back()->AddProperty("MIEHG", penergy, mie, nopts);
392392
}
393-
393+
394394

395395

396396
// in the API -1 is the default
@@ -421,13 +421,13 @@ map<string, G4Material *> materials::materialsFromMap(map <string, material> mma
421421

422422
// additional mie scattering constants
423423
if (it->second.miebackward != -1)
424-
optTable.back()->AddConstProperty("MIEHG_BACKWARD", it->second.miebackward);
425-
426-
if (it->second.mieforward != -1)
427-
optTable.back()->AddConstProperty("MIEHG_FORWARD", it->second.mieforward);
428-
429-
if (it->second.mieratio != -1)
430-
optTable.back()->AddConstProperty("MIEHG_FORWARD_RATIO", it->second.mieratio);
424+
optTable.back()->AddConstProperty("MIEHG_BACKWARD", it->second.miebackward);
425+
426+
if (it->second.mieforward != -1)
427+
optTable.back()->AddConstProperty("MIEHG_FORWARD", it->second.mieforward);
428+
429+
if (it->second.mieratio != -1)
430+
optTable.back()->AddConstProperty("MIEHG_FORWARD_RATIO", it->second.mieratio);
431431

432432
mats[it->first]->SetMaterialPropertiesTable(optTable.back());
433433
}

materials/mysql_materials.cc

Lines changed: 92 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
// mlibrary
1111
#include "gstring.h"
12+
1213
using namespace gstring;
1314

1415
// G4 headers
@@ -17,99 +18,95 @@ using namespace gstring;
1718
#include "G4OpBoundaryProcess.hh"
1819

1920

20-
map<string, G4Material*> mysql_materials::initMaterials(runConditions rc, goptions opts)
21-
{
22-
23-
string hd_msg = opts.optMap["LOG_MSG"].args + " MYSQL Materials Factory: >> ";
24-
double verbosity = opts.optMap["MATERIAL_VERBOSITY"].arg;
25-
26-
map<string, material> mymats; // material map
27-
28-
// first check if there's at least one detector with MYSQL factory
29-
if(!check_if_factory_is_needed(rc.detectorConditionsMap, "MYSQL"))
30-
return materialsFromMap(mymats);
31-
32-
// connection to the DB
33-
QSqlDatabase db = openGdb(opts);
34-
35-
// Looping over detectorConditionsMap for detector names
36-
// To each detector is associated a material and (optional) opt properties
37-
for(map<string, detectorCondition>::iterator it=rc.detectorConditionsMap.begin(); it != rc.detectorConditionsMap.end(); it++)
38-
{
39-
// building materials belonging to detectors that are tagged with MYSQL factory
40-
if(it->second.get_factory() != "MYSQL")
41-
continue;
42-
43-
if(verbosity)
44-
cout << hd_msg << " Initializing " << it->second.get_factory() << " for detector " << it->first << endl;
45-
46-
// only add "main" if it's the main variation
47-
string dname = it->first ;
48-
string tname = dname + "__materials";
49-
string variation = get_variation(it->second.get_variation());
50-
if(is_main_variation(it->second.get_variation()))
51-
tname += "_main";
52-
53-
string dbexecute = "select name, description, density, ncomponents, components, photonEnergy, indexOfRefraction, ";
54-
dbexecute += "absorptionLength, reflectivity, efficiency, fastcomponent, slowcomponent, ";
55-
dbexecute += "scintillationyield, resolutionscale, fasttimeconstant, slowtimeconstant, yieldratio, rayleigh, birkConstant, ";
56-
dbexecute += "mie, mieforward, miebackward, mieratio from " + tname;
57-
dbexecute += " where variation ='" + variation + "'";
58-
59-
// executing query - will exit if not successfull.
60-
QSqlQuery q;
61-
if(!q.exec(dbexecute.c_str())) {
62-
cout << hd_msg << " Failed to execute MYSQL query " << dbexecute << ". This is a fatal error. Exiting." << endl;
63-
qDebug() << q.lastError();
64-
exit(1);
65-
}
66-
// Warning if nothing is found
67-
if(q.size() == 0 && verbosity)
68-
{
69-
cout << " ** WARNING: material for system \"" << dname << "\" not found with variation \"" << variation << endl << endl;
70-
}
71-
72-
while (q.next())
73-
{
74-
material thisMat(trimSpacesFromString(qv_tostring( q.value(0)))); // name
75-
thisMat.desc = qv_tostring(q.value(1)); // description
76-
thisMat.density = q.value(2).toDouble(); // density
77-
thisMat.ncomponents = q.value(3).toInt(); // number of components
78-
thisMat.componentsFromString(qv_tostring(q.value(4))); // component + quantity list
79-
thisMat.opticalsFromString(qv_tostring( q.value(5)), "photonEnergy");
80-
thisMat.opticalsFromString(qv_tostring( q.value(6)), "indexOfRefraction");
81-
thisMat.opticalsFromString(qv_tostring( q.value(7)), "absorptionLength");
82-
thisMat.opticalsFromString(qv_tostring( q.value(8)), "reflectivity");
83-
thisMat.opticalsFromString(qv_tostring( q.value(9)), "efficiency");
84-
85-
// scintillation
86-
thisMat.opticalsFromString(qv_tostring( q.value(10)), "fastcomponent");
87-
thisMat.opticalsFromString(qv_tostring( q.value(11)), "slowcomponent");
88-
thisMat.scintillationyield = q.value(12).toDouble(); // scintillationyield
89-
thisMat.resolutionscale = q.value(13).toDouble(); // resolutionscale
90-
thisMat.fasttimeconstant = q.value(14).toDouble(); // fasttimeconstant
91-
thisMat.slowtimeconstant = q.value(15).toDouble(); // slowtimeconstant
92-
thisMat.yieldratio = q.value(16).toDouble(); // yieldratio
93-
thisMat.opticalsFromString(qv_tostring( q.value(17)), "rayleigh");
94-
95-
// Birk Constant
96-
thisMat.birkConstant = q.value(18).toDouble(); // yieldratio
97-
98-
// Mie scattering
99-
thisMat.opticalsFromString(qv_tostring( q.value(19)), "mie");
100-
thisMat.mieforward = q.value(20).toDouble(); // mie forward scattering
101-
thisMat.miebackward = q.value(21).toDouble(); // mie backward scattering
102-
thisMat.mieratio = q.value(22).toDouble(); // mie forward/backward scattering ratio
103-
104-
mymats[thisMat.name] = thisMat;
105-
106-
}
107-
}
108-
109-
cout << endl;
110-
111-
map<string, G4Material*> returnMap = materialsFromMap(mymats);
112-
if(verbosity>0) printMaterials(returnMap);
113-
114-
return returnMap;
21+
map<string, G4Material *> mysql_materials::initMaterials(runConditions rc, goptions opts) {
22+
23+
string hd_msg = opts.optMap["LOG_MSG"].args + " MYSQL Materials Factory: >> ";
24+
double verbosity = opts.optMap["MATERIAL_VERBOSITY"].arg;
25+
26+
map <string, material> mymats; // material map
27+
28+
// first check if there's at least one detector with MYSQL factory
29+
if (!check_if_factory_is_needed(rc.detectorConditionsMap, "MYSQL"))
30+
return materialsFromMap(mymats);
31+
32+
// connection to the DB
33+
QSqlDatabase db = openGdb(opts);
34+
35+
// Looping over detectorConditionsMap for detector names
36+
// To each detector is associated a material and (optional) opt properties
37+
for (map<string, detectorCondition>::iterator it = rc.detectorConditionsMap.begin(); it != rc.detectorConditionsMap.end(); it++) {
38+
// building materials belonging to detectors that are tagged with MYSQL factory
39+
if (it->second.get_factory() != "MYSQL")
40+
continue;
41+
42+
if (verbosity)
43+
cout << hd_msg << " Initializing " << it->second.get_factory() << " for detector " << it->first << endl;
44+
45+
// only add "main" if it's the main variation
46+
string dname = it->first;
47+
string tname = dname + "__materials";
48+
string variation = get_variation(it->second.get_variation());
49+
if (is_main_variation(it->second.get_variation()))
50+
tname += "_main";
51+
52+
string dbexecute = "select name, description, density, ncomponents, components, photonEnergy, indexOfRefraction, ";
53+
dbexecute += "absorptionLength, reflectivity, efficiency, fastcomponent, slowcomponent, ";
54+
dbexecute += "scintillationyield, resolutionscale, fasttimeconstant, slowtimeconstant, yieldratio, rayleigh, birkConstant, ";
55+
dbexecute += "mie, mieforward, miebackward, mieratio from " + tname;
56+
dbexecute += " where variation ='" + variation + "'";
57+
58+
// executing query - will exit if not successfull.
59+
QSqlQuery q;
60+
if (!q.exec(dbexecute.c_str())) {
61+
cout << hd_msg << " Failed to execute MYSQL query " << dbexecute << ". This is a fatal error. Exiting." << endl;
62+
qDebug() << q.lastError();
63+
exit(1);
64+
}
65+
// Warning if nothing is found
66+
if (q.size() == 0 && verbosity) {
67+
cout << " ** WARNING: material for system \"" << dname << "\" not found with variation \"" << variation << endl << endl;
68+
}
69+
70+
while (q.next()) {
71+
material thisMat(trimSpacesFromString(qv_tostring( q.value(0)))); // name
72+
thisMat.desc = qv_tostring(q.value(1)); // description
73+
thisMat.density = q.value(2).toDouble(); // density
74+
thisMat.ncomponents = q.value(3).toInt(); // number of components
75+
thisMat.componentsFromString(qv_tostring(q.value(4))); // component + quantity list
76+
thisMat.opticalsFromString(qv_tostring(q.value(5)), "photonEnergy");
77+
thisMat.opticalsFromString(qv_tostring(q.value(6)), "indexOfRefraction");
78+
thisMat.opticalsFromString(qv_tostring(q.value(7)), "absorptionLength");
79+
thisMat.opticalsFromString(qv_tostring(q.value(8)), "reflectivity");
80+
thisMat.opticalsFromString(qv_tostring(q.value(9)), "efficiency");
81+
82+
// scintillation
83+
thisMat.opticalsFromString(qv_tostring(q.value(10)), "fastcomponent");
84+
thisMat.opticalsFromString(qv_tostring(q.value(11)), "slowcomponent");
85+
thisMat.scintillationyield = q.value(12).toDouble(); // scintillationyield
86+
thisMat.resolutionscale = q.value(13).toDouble(); // resolutionscale
87+
thisMat.fasttimeconstant = q.value(14).toDouble(); // fasttimeconstant
88+
thisMat.slowtimeconstant = q.value(15).toDouble(); // slowtimeconstant
89+
thisMat.yieldratio = q.value(16).toDouble(); // yieldratio
90+
thisMat.opticalsFromString(qv_tostring(q.value(17)), "rayleigh");
91+
92+
// Birk Constant
93+
thisMat.birkConstant = q.value(18).toDouble(); // yieldratio
94+
95+
// Mie scattering
96+
thisMat.opticalsFromString(qv_tostring(q.value(19)), "mie");
97+
thisMat.mieforward = q.value(20).toDouble(); // mie forward scattering
98+
thisMat.miebackward = q.value(21).toDouble(); // mie backward scattering
99+
thisMat.mieratio = q.value(22).toDouble(); // mie forward/backward scattering ratio
100+
101+
mymats[thisMat.name] = thisMat;
102+
103+
}
104+
}
105+
106+
cout << endl;
107+
108+
map < string, G4Material * > returnMap = materialsFromMap(mymats);
109+
if (verbosity > 0) printMaterials(returnMap);
110+
111+
return returnMap;
115112
}

materials/sqlite_materials.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ map<string, G4Material *> sqlite_materials::initMaterials(runConditions rc, gopt
7171
}
7272

7373
while (q.next()) {
74-
material thisMat(trimSpacesFromString(qv_tostring( q.value(0)))); // name
74+
material thisMat(trimSpacesFromString(qv_tostring( q.value(0)))); // name
7575
thisMat.desc = qv_tostring(q.value(1)); // description
7676
thisMat.density = q.value(2).toDouble(); // density
7777
thisMat.ncomponents = q.value(3).toInt(); // number of components
@@ -95,7 +95,7 @@ map<string, G4Material *> sqlite_materials::initMaterials(runConditions rc, gopt
9595
// Birk Constant
9696
thisMat.birkConstant = q.value(18).toDouble();
9797

98-
// Mie scattering
98+
// Mie scattering
9999
thisMat.opticalsFromString(qv_tostring(q.value(19)), "mie");
100100
thisMat.mieforward = q.value(20).toDouble();
101101
thisMat.miebackward = q.value(21).toDouble();

materials/text_materials.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,12 @@ map<string, G4Material *> text_materials::initMaterials(runConditions rc, goptio
114114
// Birk Constant were added with gemc 2.6
115115
// 23 exact quantities
116116
if (gt.data.size() > 19) {
117-
thisMat.opticalsFromString(gt.data[19], "mie");
118-
thisMat.mieforward = get_number(gt.data[20]);
119-
thisMat.miebackward = get_number(gt.data[21]);
120-
thisMat.mieratio = get_number(gt.data[22]);
117+
thisMat.opticalsFromString(gt.data[19], "mie");
118+
thisMat.mieforward = get_number(gt.data[20]);
119+
thisMat.miebackward = get_number(gt.data[21]);
120+
thisMat.mieratio = get_number(gt.data[22]);
121121
}
122-
122+
123123
mymats[thisMat.name] = thisMat;
124124

125125
}

output/outputFactory.cc

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include "outputFactory.h"
33
#include "gemcOptions.h"
44
#include "string_utilities.h"
5-
#include "evio_output.h"
5+
66
#include "hipo_output.h"
77
#include "txt_output.h"
88
#include "txt_simple_output.h"
@@ -29,8 +29,8 @@ outputFactory *getOutputFactory(map<string, outputFactoryInMap> *outputFactoryMa
2929

3030
outputContainer::outputContainer(goptions Opts)
3131
{
32-
// EVIO Buffer size set to 30M words
33-
int evio_buffer = EVIO_BUFFER;
32+
33+
3434

3535
gemcOpt = Opts;
3636
string hd_msg = gemcOpt.optMap["LOG_MSG"].args + " Output File: >> ";
@@ -42,9 +42,9 @@ outputContainer::outputContainer(goptions Opts)
4242

4343
if(outType != "no") cout << hd_msg << " Opening output file \"" << trimSpacesFromString(outFile) << "\"." << endl;
4444
if(outType == "txt" || outType == "txt_simple") txtoutput = new ofstream(trimSpacesFromString(outFile).c_str());
45-
if(outType == "evio") {
46-
pchan = new evioFileChannel(trimSpacesFromString(outFile).c_str(), "w", evio_buffer);
47-
pchan->open();
45+
{
46+
47+
4848
}
4949

5050
if(outType == "hipo") {
@@ -63,9 +63,9 @@ outputContainer::~outputContainer()
6363

6464
if(outType != "no") cout << " Closing " << outFile << "." << endl;
6565
if(outType == "txt" || outType == "txt_simple") txtoutput->close();
66-
if(outType == "evio") {
67-
pchan->close();
68-
delete pchan;
66+
{
67+
68+
6969
}
7070
if(outType == "hipo") {
7171
cout << hd_msg << " Closing Hipo file \"" << trimSpacesFromString(outFile) << "\"." << endl;
@@ -81,7 +81,7 @@ map<string, outputFactoryInMap> registerOutputFactories()
8181

8282
outputMap["txt"] = &txt_output::createOutput;
8383
outputMap["txt_simple"] = &txt_simple_output::createOutput;
84-
outputMap["evio"] = &evio_output::createOutput;
84+
8585
outputMap["hipo"] = &hipo_output::createOutput;
8686

8787
return outputMap;

output/outputFactory.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717
// mlibrary
1818
#include "frequencySyncSignal.h"
1919

20-
// EVIO
21-
#pragma GCC diagnostic push
22-
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
23-
#pragma GCC diagnostic ignored "-Wdeprecated"
24-
#include "evioUtil.hxx"
25-
#include "evioFileChannel.hxx"
26-
#pragma GCC diagnostic pop
27-
using namespace evio;
20+
21+
22+
23+
24+
25+
26+
27+
2828

2929
// Hipo
3030
#include "hipo4/writer.h"
@@ -240,7 +240,7 @@ class outputContainer
240240
string outFile;
241241

242242
ofstream *txtoutput;
243-
evioFileChannel *pchan;
243+
244244

245245
// hipo schema and writer
246246
// The schemas have to be added to the writer before openning

0 commit comments

Comments
 (0)