Skip to content

Commit

Permalink
Fix compiler warnings to make CI pass
Browse files Browse the repository at this point in the history
  • Loading branch information
tmadlener committed Oct 4, 2024
1 parent a68a4cf commit 364e32a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 19 deletions.
5 changes: 2 additions & 3 deletions converter/src/DelphesEDM4HepConverter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ namespace k4SimDelphes {
}

// mother-daughter relations
const auto nElements = collection->size();
for (int iCand = 0; iCand < delphesCollection->GetEntries(); ++iCand) {
const auto* delphesCand = static_cast<GenParticle*>(delphesCollection->At(iCand));
auto cand = collection->at(iCand);
Expand Down Expand Up @@ -608,7 +607,7 @@ namespace k4SimDelphes {

// Mothers
// Only set parents if not accessing out of bounds
const auto safeSetParent = [&mcParticles, &particle](int index) {
const auto safeSetParent = [&mcParticles, &particle](size_t index) {
if (index < mcParticles.size()) {
particle.addToParents(mcParticles[index]);
}
Expand Down Expand Up @@ -637,7 +636,7 @@ namespace k4SimDelphes {
}

// Daughters
const auto safeSetDaughter = [&mcParticles, &particle](int index) {
const auto safeSetDaughter = [&mcParticles, &particle](size_t index) {
if (index < mcParticles.size()) {
particle.addToDaughters(mcParticles[index]);
}
Expand Down
11 changes: 4 additions & 7 deletions standalone/src/PythiaEvtGen_Interface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,7 @@ void PythiaEvtGen_Interface::add_inclusive(std::string decayfile, int seed) {
std::list<EvtDecayBase*> extraModels = genList.getListOfModels();
// Random engine:

EvtRandomEngine* eng = 0;
//eng = new EvtMTRandomEngine(seed); // look out, this works only with C++11, OLD C++ use: eng = new EvtSimpleRandomEngine()
eng = new EvtSimpleRandomEngine();
EvtRandomEngine* eng = new EvtMTRandomEngine(seed);
EvtRandom::setRandomEngine(eng);

if (debug)
Expand All @@ -105,7 +103,7 @@ bool PythiaEvtGen_Interface::check_Signal_Appereance() {
//signal_map= new int[NOfSignal][10];// here we assume we won't have more then 10 signal candidates
signal_map = std::vector<std::vector<int>>(NOfSignal); // resetting this vector//;(NOfSignal);
//signal_map= new int*[NOfSignal];
for (int i = 0; i < NOfSignal; ++i) {
for (auto i = 0u; i < NOfSignal; ++i) {
// signal_map[i] = new int[10]; // here we assume we won't have more then 10 signal candidates
signal_map[i] = std::vector<int>(10);
}
Expand All @@ -117,7 +115,6 @@ bool PythiaEvtGen_Interface::check_Signal_Appereance() {
pythia->event.list();
Pythia8::Event& event = pythia->event;

double wgt(1.);
//loop over particles to find candidates that mach what we need from the decay
for (int iPro = 0; iPro < event.size(); ++iPro) {
Pythia8::Particle* part = &event[iPro];
Expand All @@ -138,7 +135,7 @@ bool PythiaEvtGen_Interface::check_Signal_Appereance() {
}
}
// now checking if we have all B candidates
int sum = 0;
size_t sum = 0;
for (unsigned i = 0; i < NOfSignal_list.size(); i++) {
if (NOfSignal_list[i] > 0)
sum += 1;
Expand All @@ -159,7 +156,7 @@ void PythiaEvtGen_Interface::decay_signals() {
if (debug)
std::cout << "In decay_signals" << std::endl;
unsigned NOfSignal = motherIDs.size();
for (int i_sig = 0; i_sig < NOfSignal; i_sig++) // loop over signal B's
for (auto i_sig = 0u; i_sig < NOfSignal; i_sig++) // loop over signal B's
{
int randomsignal = (rand() % NOfSignal_list[i_sig]);
if (debug)
Expand Down
18 changes: 9 additions & 9 deletions tests/src/compare_delphes_converter_outputs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ bool compareMCRelations(const DelphesT* delphesCand, edm4hep::ReconstructedParti
*/
void compareCollectionsBasic(const TClonesArray* delphesColl, const podio::CollectionBase& edm4hepColl,
const std::string collName) {
if (delphesColl->GetEntries() != edm4hepColl.size()) {
if (delphesColl->GetEntries() != static_cast<int>(edm4hepColl.size())) {
std::cerr << "Sizes of collection \'" << collName << "\' disagree: " << delphesColl->GetEntries() << " vs "
<< edm4hepColl.size() << std::endl;
std::exit(1);
Expand Down Expand Up @@ -195,10 +195,10 @@ void compareCollectionElements(const TClonesArray* delphesColl, const edm4hep::M
std::exit(1);
}

const auto assertMsg = [](const std::string& collName, const int index, const int relIndex,
const auto assertMsg = [](const std::string& name, const int index, const int relIndex,
const std::string& relation) {
return relation + std::to_string(relIndex) + " of particle " + std::to_string(index) +
" differs between delphes and edm4hep output in collection \'" + collName + "\'";
" differs between delphes and edm4hep output in collection \'" + name + "\'";
};

// compare the parents
Expand Down Expand Up @@ -290,17 +290,17 @@ void compareJets(const TClonesArray* delphesColl, const edm4hep::ReconstructedPa
const auto edm4hepCand = edm4hepColl[i];
assertSameKinematics(delphesCand, edm4hepCand, stdErrorMessage, collName, i);

if (delphesCand->Constituents.GetEntries() != edm4hepCand.getParticles().size()) {
if (delphesCand->Constituents.GetEntries() != static_cast<int>(edm4hepCand.getParticles().size())) {
std::cerr << "Number of Jet constitutents in Jet " << i
<< " differs between delphes and edm4hep output: " << delphesCand->Constituents.GetEntries() << " vs "
<< edm4hepCand.getParticles().size() << std::endl;
std::exit(1);
}

const auto assertMsg = [](const std::string& collName, const int index, const int iConst) {
const auto assertMsg = [](const std::string& name, const int index, const int iConst) {
return std::string("Jet constituent ") + std::to_string(iConst) +
" has different kinematics in delphes and in edm4hep in Jet " + std::to_string(index) +
" in collection \'" + collName + "\'";
" in collection \'" + name + "\'";
};

for (int j = 0; j < delphesCand->Constituents.GetEntries(); ++j) {
Expand Down Expand Up @@ -339,7 +339,7 @@ void compareMET(const TClonesArray* delphesColl, const edm4hep::ReconstructedPar
assertSameKinematics(delphesMET, edm4hepMET, []() { return "MET differs between delphes and edm4hep output"; });
}

int main(int argc, char* argv[]) {
int main(int, char* argv[]) {
// do the necessary setup work for podio and delphes first
podio::ROOTReader reader{};
reader.openFile(argv[1]);
Expand Down Expand Up @@ -388,8 +388,8 @@ int main(int argc, char* argv[]) {
compareCollectionsBasic(photonCollDelphes, photonColl, "Photon");
compareCollectionElements<Photon>(photonCollDelphes, photonColl, "Photon");

auto& recoColl = frame.get<edm4hep::ReconstructedParticleCollection>("ReconstructedParticles");
const int nRecos = tracks->GetEntries() + ecalClusters->GetEntries() + hcalClusters->GetEntries();
auto& recoColl = frame.get<edm4hep::ReconstructedParticleCollection>("ReconstructedParticles");
const unsigned nRecos = tracks->GetEntries() + ecalClusters->GetEntries() + hcalClusters->GetEntries();

if (nRecos != recoColl.size()) {
std::cerr << "The global ReconstructedParticle collection and the original delphes collections differ in size: "
Expand Down

0 comments on commit 364e32a

Please sign in to comment.