Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:16:17

0001 #include "FermimotionAfterburner.h"
0002 
0003 #include "FermiMotion.h"
0004 
0005 #include <phhepmc/PHHepMCGenEvent.h>
0006 #include <phhepmc/PHHepMCGenEventMap.h>
0007 
0008 #include <fun4all/Fun4AllReturnCodes.h>
0009 #include <fun4all/SubsysReco.h>  // for SubsysReco
0010 
0011 #include <phool/PHRandomSeed.h>
0012 #include <phool/getClass.h>
0013 #include <phool/phool.h>
0014 
0015 #include <gsl/gsl_rng.h>
0016 
0017 #include <iostream>
0018 #include <set>  // for set, _Rb_tree_const_ite...
0019 #include <string>
0020 #include <utility>
0021 
0022 namespace HepMC
0023 {
0024   class GenEvent;
0025 }
0026 
0027 //____________________________________________________________________________..
0028 FermimotionAfterburner::FermimotionAfterburner(const std::string &name, const double pTspec)
0029   : SubsysReco(name)
0030   , RandomGenerator(gsl_rng_alloc(gsl_rng_mt19937))
0031   , m_pTspec(pTspec)
0032 
0033 {
0034 }
0035 
0036 //____________________________________________________________________________..
0037 FermimotionAfterburner::~FermimotionAfterburner()
0038 {
0039   gsl_rng_free(RandomGenerator);
0040 }
0041 
0042 //____________________________________________________________________________..
0043 int FermimotionAfterburner::Init(PHCompositeNode * /*topNode*/)
0044 {
0045   unsigned int seed = PHRandomSeed();
0046   gsl_rng_set(RandomGenerator, seed);
0047 
0048   return Fun4AllReturnCodes::EVENT_OK;
0049 }
0050 
0051 //____________________________________________________________________________..
0052 int FermimotionAfterburner::process_event(PHCompositeNode *topNode)
0053 {
0054   AddpF(topNode);
0055 
0056   return Fun4AllReturnCodes::EVENT_OK;
0057 }
0058 
0059 //____________________________________________________________________________..
0060 
0061 void FermimotionAfterburner::AddpF(PHCompositeNode *topNode)
0062 {
0063   PHHepMCGenEventMap *genevtmap = findNode::getClass<PHHepMCGenEventMap>(topNode, "PHHepMCGenEventMap");
0064   for (auto &iter : *genevtmap)
0065   {
0066     PHHepMCGenEvent *genevt = iter.second;
0067     HepMC::GenEvent *evt = genevt->getEvent();
0068     if (!evt)
0069     {
0070       std::cout << PHWHERE << " no evt pointer under HEPMC Node found" << std::endl;
0071     }
0072     FermiMotion(evt, RandomGenerator, m_pTspec);
0073   }
0074 }