Skip to content

Commit e3666cc

Browse files
author
Alice
committed
merge fixing issue HEP-FCC/heppy#39
2 parents 15e8bec + 3ce4b3e commit e3666cc

33 files changed

+183
-207
lines changed

examples/PythiaConnector.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,7 @@ papas::ListParticles PythiaConnector::makePapasParticlesFromGeneratedParticles(c
7878
if (ptc.core().status == 1) { // only stable ones
7979

8080
if (tlv.Pt() > 1e-5 && (abs(pdgid) != 12) && (abs(pdgid) != 14) && (abs(pdgid) != 16)) {
81-
82-
auto particle =
83-
papas::Particle(pdgid, (double)ptc.core().charge, tlv, ptc.core().status, startVertex, endVertex);
81+
papas::Particle particle(pdgid, (double)ptc.core().charge, tlv, ptc.core().status, startVertex, endVertex);
8482
particles.push_back(std::move(particle));
8583
// papas::PDebug::write("Selected Papas{}", particle);
8684
}
@@ -213,7 +211,7 @@ papas::Clusters PythiaConnector::ConvertClustersToPapas(const fcc::CaloClusterCo
213211
for (const auto& c : fccClusters) {
214212
const auto position = c.core().position;
215213
const auto energy = c.core().energy;
216-
auto cluster = papas::Cluster(energy, TVector3(position.x, position.y, position.z), size, clusters.size(), itemtype, subtype);
214+
papas::Cluster cluster(energy, TVector3(position.x, position.y, position.z), size, clusters.size(), itemtype, subtype);
217215
clusters.emplace(cluster.id(), std::move(cluster));
218216
}
219217
return clusters;

examples/example_dag_pair.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,18 @@ int main() {
4242
// BFSVisitor uses an iterative method to traverse
4343
// output the Datatype of all children
4444
std::cout << std::endl << "TRAVERSE CHILDREN (start Node 0) 1 level" << std::endl;
45-
for (auto n : bfs.traverseChildren(n0, 1)) {
45+
for (const auto& n : bfs.traverseChildren(n0, 1)) {
4646
std::cout << n->value().itype << ":" << n->value().ivalue << std::endl;
4747
}
4848

4949
std::cout << std::endl << "TRAVERSE UNDIRECTED (start Node 5) 2 levels " << std::endl;
50-
for (auto n : bfs.traverseUndirected(n5, 2)) {
50+
for (const auto& n : bfs.traverseUndirected(n5, 2)) {
5151
std::cout << n->value().itype << ":" << n->value().ivalue << std::endl;
5252
}
5353

5454
std::cout << std::endl << "TRAVERSE CHILDREN (start Node 0) all levels" << std::endl;
5555

56-
for (auto n : bfs.traverseChildren(n0)) {
56+
for (const auto& n : bfs.traverseChildren(n0)) {
5757
std::cout << n->value().itype << ":" << n->value().ivalue << std::endl;
5858
}
5959

examples/example_loop.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ int main(int argc, char* argv[]) {
3030
const char* fname = argv[1];
3131
// open the Pythia file fname
3232
try {
33-
auto pythiaConnector = PythiaConnector(fname);
33+
PythiaConnector pythiaConnector(fname);
3434
#if WITHSORT
3535
std::cout << "doing sorting";
3636
#else
3737
std::cout << "no sort";
3838
#endif
3939
// Create CMS detector and PapasManager
4040
papas::CMS CMSDetector;
41-
auto papasManager = papas::PapasManager(CMSDetector);
41+
papas::PapasManager papasManager(CMSDetector);
4242

4343
unsigned int eventNo = 0;
4444
unsigned int nEvents = 100;

examples/example_pdebug_python_comparer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ int main(int argc, char* argv[]) {
2424
return 1;
2525
}
2626
const char* fname = argv[1];
27-
auto pythiaConnector = PythiaConnector(fname);
27+
PythiaConnector pythiaConnector(fname);
2828

2929
if (argc == 3) {
3030
const char* lname = argv[2];
@@ -37,7 +37,7 @@ int main(int argc, char* argv[]) {
3737
CMS CMSDetector;
3838
papas::PapasManager papasManager{CMSDetector};
3939
unsigned int eventNo = 0;
40-
unsigned int nEvents = 5;
40+
unsigned int nEvents = 10;
4141

4242
auto start = std::chrono::steady_clock::now();
4343

examples/example_plot.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ int main(int argc, char* argv[]) {
2525
return 1;
2626
}
2727
const char* fname = argv[1];
28-
auto pythiaConnector = PythiaConnector(fname);
28+
PythiaConnector pythiaConnector(fname);
2929

3030
// Create CMS detector and PapasManager
3131
CMS CMSDetector;

examples/example_simple.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ int main(int argc, char* argv[]) {
3333
return 1;
3434
}
3535
const char* fname = argv[1];
36-
auto pythiaConnector = PythiaConnector(fname);
36+
PythiaConnector pythiaConnector(fname);
3737

3838
if (argc == 3) {
3939
const char* lname = argv[2];

papas/datatypes/Cluster.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class Cluster {
2828

2929
/** Constructor: makes new cluster with a new id based on a copy of an existing cluster. The new id must be provided.
3030
@param[in] cluster the cluster that is to be "copied"
31+
@param[in] index of the collection into which the cluster is to be stored
3132
@param[in] type eg IdCoder::kHcalCluster the identifier type
3233
@param[in] subtype subtype of cluster eg 'm' for merged, 's' for smeared. Defaults to 'u' for unset.
3334
@param[in] val the value that will be used when creating the Cluster identifier and which is used for sorting.

papas/datatypes/Event.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ class Event {
173173
* @param[in] collection the collection
174174
*/
175175
template <class T>
176-
Ids collectionIds(const T& collection) const;
176+
Ids collectionIds(const T& collection, bool sort = false) const;
177177
/**
178178
* @brief takes all the history collection and merged them into one single history
179179
*/
@@ -237,11 +237,13 @@ void Event::addCollectionInternal(
237237
}
238238

239239
template <class T>
240-
Ids Event::collectionIds(const T& collection) const {
240+
Ids Event::collectionIds(const T& collection, bool sort) const {
241241
Ids ids;
242242
for (const auto& item : collection) {
243243
ids.push_back(item.first);
244244
}
245+
if (sort)
246+
ids.sort(std::greater<Identifier>());
245247
return ids;
246248
}
247249
}

papas/datatypes/HistoryHelper.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace papas {
1717
1818
@code
1919
Usage example:
20-
auto hhelper = HistoryHelper(event);
20+
HistoryHelper hhelper(event);
2121
//find what is connected to (say) a reconstructed particle
2222
auto ids =hhelper.linkedIds(id);
2323
//filter the connected ids selecting only the ecals of subtype 'm'

papas/datatypes/src/Cluster.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Cluster::Cluster(Cluster&& c)
4949
if (c.subClusters().size() == 1 && c.id() == (*c.subClusters().begin())->id())
5050
m_subClusters.push_back(this); // non merged cluster point to itself
5151
else
52-
for (auto s : c.subClusters()) // merged clusters
52+
for (const auto& s : c.subClusters()) // merged clusters
5353
m_subClusters.push_back(s);
5454
}
5555

@@ -100,7 +100,7 @@ std::ostream& operator<<(std::ostream& os, const Cluster& cluster) {
100100
os << "Cluster: " << std::setw(6) << std::left << IdCoder::pretty(cluster.id()) << ":" << cluster.id() << ": "
101101
<< cluster.info();
102102
os << " sub(";
103-
for (auto c : cluster.subClusters()) {
103+
for (const auto& c : cluster.subClusters()) {
104104
os << IdCoder::pretty(c->id()) << ", ";
105105
}
106106
os << ")";

0 commit comments

Comments
 (0)