diff --git a/GeneratorInterface/BeamHaloGenerator/src/PYR.cc b/GeneratorInterface/BeamHaloGenerator/src/PYR.cc index c78808fad301d..39228cd70fac4 100644 --- a/GeneratorInterface/BeamHaloGenerator/src/PYR.cc +++ b/GeneratorInterface/BeamHaloGenerator/src/PYR.cc @@ -3,9 +3,5 @@ CLHEP::HepRandomEngine* _BeamHalo_randomEngine; extern "C" { - float bhgpyr_(int* idummy) - { - return (float)_BeamHalo_randomEngine->flat(); - } +float bhgpyr_(int* idummy) { return (float)_BeamHalo_randomEngine->flat(); } } - diff --git a/GeneratorInterface/ExhumeInterface/src/Integral.cpp b/GeneratorInterface/ExhumeInterface/src/Integral.cpp index 77adbbd4250ee..3baa88c0db9e3 100644 --- a/GeneratorInterface/ExhumeInterface/src/Integral.cpp +++ b/GeneratorInterface/ExhumeInterface/src/Integral.cpp @@ -2,20 +2,20 @@ #include -double dsimps_(double* F,double* A,double* B,int* N){ - +double dsimps_(double* F, double* A, double* B, int* N) { double a = *A; double b = *B; int n = *N; - double deltaX = (b-a)/n; - double I=F[0] + F[n]; - - for(int i=1;i<=n/2;i++){ - int j=2*i; - int k =2*i-1; - if(j //HACK We need to change the internals of GenVertex when reading -// back via ROOT. We use the private access of GenEvent to +// back via ROOT. We use the private access of GenEvent to // accomplish it. namespace HepMC { class GenEvent { public: - static void clear_particles_in(HepMC::GenVertex* iVertex) { - iVertex->m_particles_in.clear(); - } + static void clear_particles_in(HepMC::GenVertex* iVertex) { iVertex->m_particles_in.clear(); } static void add_to_particles_in(HepMC::GenVertex* iVertex, HepMC::GenParticle* iPart) { iVertex->m_particles_in.push_back(iPart); } }; -} - +} // namespace HepMC -namespace hepmc_rootio { +namespace hepmc_rootio { void add_to_particles_in(HepMC::GenVertex* iVertex, HepMC::GenParticle* iPart) { HepMC::GenEvent::add_to_particles_in(iVertex, iPart); } - void clear_particles_in(HepMC::GenVertex* iVertex) { - HepMC::GenEvent::clear_particles_in(iVertex); - } -} + void clear_particles_in(HepMC::GenVertex* iVertex) { HepMC::GenEvent::clear_particles_in(iVertex); } +} // namespace hepmc_rootio diff --git a/SimDataFormats/GeneratorProducts/test/rootio_t.cc b/SimDataFormats/GeneratorProducts/test/rootio_t.cc index 3b866142c70de..cc4ab904b1657 100644 --- a/SimDataFormats/GeneratorProducts/test/rootio_t.cc +++ b/SimDataFormats/GeneratorProducts/test/rootio_t.cc @@ -10,29 +10,28 @@ int main() { constexpr int eventNumber = 10; { TFile oFile("rootio_t.root", "RECREATE"); - TTree events("Events","Events"); + TTree events("Events", "Events"); HepMC::GenEvent event; - auto vtx = new HepMC::GenVertex( HepMC::FourVector(0.,0.,0.)); + auto vtx = new HepMC::GenVertex(HepMC::FourVector(0., 0., 0.)); constexpr double kMass = 1.; constexpr double kMom = 1.; - const double kEnergy = sqrt( kMass*kMass+kMom*kMom); + const double kEnergy = sqrt(kMass * kMass + kMom * kMom); constexpr int id = 11; - auto p1 = new HepMC::GenParticle(HepMC::FourVector{kMom,0.,0.,kEnergy}, id, 1); + auto p1 = new HepMC::GenParticle(HepMC::FourVector{kMom, 0., 0., kEnergy}, id, 1); p1->suggest_barcode(1); vtx->add_particle_out(p1); - - auto p2 = new HepMC::GenParticle(HepMC::FourVector{-kMom,0.,0.,kEnergy}, -id, 1); + auto p2 = new HepMC::GenParticle(HepMC::FourVector{-kMom, 0., 0., kEnergy}, -id, 1); p2->suggest_barcode(2); vtx->add_particle_out(p2); - auto decayVtx = new HepMC::GenVertex(HepMC::FourVector(1.,0.,0.)); + auto decayVtx = new HepMC::GenVertex(HepMC::FourVector(1., 0., 0.)); decayVtx->add_particle_in(p1); event.add_vertex(vtx); @@ -43,10 +42,10 @@ int main() { HepMC::GenEvent* pEv = &event; - events.Branch("GenEvent",&pEv); + events.Branch("GenEvent", &pEv); events.Fill(); - + oFile.Write(); oFile.Close(); } @@ -55,35 +54,34 @@ int main() { { TFile iFile("rootio_t.root"); - TTree* events = dynamic_cast( iFile.Get("Events") ); + TTree* events = dynamic_cast(iFile.Get("Events")); HepMC::GenEvent event; HepMC::GenEvent* pEv = &event; - events->SetBranchAddress("GenEvent",&pEv); + events->SetBranchAddress("GenEvent", &pEv); events->GetEntry(0); assert(event.event_number() == eventNumber); assert(event.particles_size() == 2); assert(event.vertices_size() == 2); - + int barcode = 1; - for(auto it = event.particles_begin(); it != event.particles_end(); ++it) { - if((*it)->production_vertex()) { + for (auto it = event.particles_begin(); it != event.particles_end(); ++it) { + if ((*it)->production_vertex()) { auto vtx = (*it)->production_vertex(); - assert( std::find(vtx->particles_out_const_begin(), vtx->particles_out_const_end(), *it) != vtx->particles_out_const_end()); + assert(std::find(vtx->particles_out_const_begin(), vtx->particles_out_const_end(), *it) != + vtx->particles_out_const_end()); } - if((*it)->end_vertex()) { + if ((*it)->end_vertex()) { auto vtx = (*it)->end_vertex(); - assert( std::find(vtx->particles_in_const_begin(), vtx->particles_in_const_end(), *it) != vtx->particles_in_const_end()); + assert(std::find(vtx->particles_in_const_begin(), vtx->particles_in_const_end(), *it) != + vtx->particles_in_const_end()); } - assert( (*it)->barcode() == barcode); - assert( *it == event.barcode_to_particle( (*it)->barcode() ) ); + assert((*it)->barcode() == barcode); + assert(*it == event.barcode_to_particle((*it)->barcode())); ++barcode; } - - } - }