Skip to content
Snippets Groups Projects
Select Git revision
  • module_frame
  • master default protected
  • drich-two-mirrors
  • 148-hcal-geometry-development
  • 144-irt-geometry
  • deathvalley-acts-dd4hep-plugin
  • canyonlands-acts-dd4hep-plugin
  • adjust-barrel-emcalo-geometry
  • 148-hcal-geometry-development-wdconinc-suggestion
  • WorkingGemTrd_MLmodel_andAnalysis
  • 144-test-small-sensor-overlap
  • 59-detailed-forward-gem-trd
  • vdesai-master-patch-09582
  • mriganka-branch02
  • zdemirog-master-patch-64142
  • weibin-master-patch-37475
  • vanekjan-master-patch-74522
  • lkosarzew-master-patch-25029
  • swapneshkhade-master-patch-16755
  • mlavinsky-master-patch-10431
  • niveditharam-master-patch-05822
  • deathvalley-v1.1
  • deathvalley-v1.0-1.5T
  • deathvalley-v1.0
  • canyonlands-v2.2
  • canyonlands-v2.1
  • canyonlands-v2.0
  • canyonlands-v1.2
  • canyonlands-v1.1
  • acadia-v2.1
  • canyonlands-v1.0
  • acadia-v2.0
  • acadia-v1.1
  • acadia-v1.0
  • acadia-v1.0-alpha
  • v0.2.0
  • v0.1.0
37 results

cb_DIRC.cpp

Blame
  • pythia6m.cc 1.96 KiB
    #include <Math/Vector4D.h>
    #include <TFile.h>
    #include <fstream>
    #include <memory>
    #include <pythia6m/core/configuration.hh>
    #include <pythia6m/core/exception.hh>
    #include <pythia6m/core/framework.hh>
    #include <pythia6m/core/logger.hh>
    #include <pythia6m/core/progress_meter.hh>
    #include <pythia6m/interface/event.hh>
    #include <pythia6m/interface/event_out.hh>
    #include <pythia6m/interface/pythia6m_generator.hh>
    
    using namespace pythia6m;
    
    int run_pythia(const configuration& conf, const std::string& output) {
    
      // get the run info
      const size_t run = conf.get<size_t>("run");
      const size_t events = conf.get<size_t>("events");
    
      // setup output files:
      //  * root file
      std::shared_ptr<TFile> ofile =
          std::make_shared<TFile>((output + ".root").c_str(), "recreate");
      ep_event_out ev_writer{ofile, "ep_event"};
      //  * lund file (optional)
      std::ofstream olund;
      if (conf.get<bool>("write_lund")) {
        olund.open(output + ".lund");
      }
    
      // setup pythia6m
      pythia6m_generator pygen{conf, "generator"};
    
      // generate our events
      progress_meter progress{events};
      for (int iev = 0; iev < events; ++iev) {
    
        // generate one event
        const auto ev = pygen.generate<ep_event>();
    
        // add additonal event selection here if needed
    
    
        // update progress meter
        progress.update();
    
        // push event to the output writer
        ev_writer.push(ev);
    
        // also write lund file if needed
        if (olund) {
          ev.print(olund, [](const particle& p) {
            return true; /*add selection criteria for output lines here */
          });
        }
    
        // debug output for the first 100 events
        if (global::logger.level() == log_level::DEBUG && iev < 100) {
          PYLIST(2);
        }
        // truncated event record
        else if (global::logger.level() == log_level::JUNK) {
          PYEDIT(1);
          PYLIST(2);
        }
        // full event record
        else if (global::logger.level() == log_level::JUNK2) {
          PYLIST(2);
        }
      }
    
      // that's all!
      return 0;
    }
    
    MAKE_PYTHIA6M_FRAMEWORK(run_pythia)