20 #include <HepMC/GenEvent.h> 
   21 #include <HepMC/GenParticle.h>    
   22 #include <HepMC/GenVertex.h>      
   23 #include <HepMC/SimpleVector.h>   
   24 #include <HepMC/Units.h>          
   29 #include <boost/iostreams/filter/bzip2.hpp> 
   30 #include <boost/iostreams/filter/gzip.hpp> 
   31 #include <boost/iostreams/filtering_streambuf.hpp> 
   43 static boost::iostreams::filtering_streambuf<boost::iostreams::input> 
zinbuffer;
 
   44 static const double toMM = 1.e-12;
 
   51   , topNodeName(topnodename)
 
   56   , unzipstream(nullptr)
 
   86     cout << 
"Call fileopen only after you registered your Input Manager " << 
Name() << 
" with the Fun4AllServer" << endl;
 
   91     cout << 
"Closing currently open file " 
   93          << 
" and opening " << filenam << endl;
 
  101     cout << 
Name() << 
": opening file " << fname << endl;
 
  105   TPRegexp bzip_ext(
".bz2$");
 
  106   TPRegexp gzip_ext(
".gz$");
 
  107   if (tstr.Contains(bzip_ext))
 
  111     zinbuffer.push(boost::iostreams::bzip2_decompressor());
 
  116   else if (tstr.Contains(gzip_ext))
 
  120     zinbuffer.push(boost::iostreams::gzip_decompressor());
 
  131   static bool run_number_forced = rc->
FlagExist(
"RUNNUMBER");
 
  132   if (run_number_forced)
 
  155         cout << 
Name() << 
": No Input file open" << endl;
 
  163         cout << 
Name() << 
": No Input file from filelist opened" << endl;
 
  170   evt = 
new HepMC::GenEvent(HepMC::Units::GEV, HepMC::Units::MM);
 
  178   if (code == 1 || 
evt == 
nullptr)
 
  180     if (
Verbosity() > 1) cout << 
"Finished file!" << endl;
 
  210     cout << 
Name() << 
": fileclose: No Input file open" << endl;
 
  250       if (theLine.compare(0, 1, 
"#") == 0) 
continue;
 
  251       vector<double> theInfo;
 
  253       for (istringstream numbers_iss(theLine); numbers_iss >> number;)
 
  255         theInfo.push_back(number);
 
  258       if (theInfo.size() == 2 && theInfo[0] == 0 && theInfo[1] == 0)
 
  264       else if (theInfo.size() == 2 && theInfo[0] == 0 && theInfo[1] > 0)
 
  283     cout << 
"Oscar EOF" << endl;
 
  286   evt = 
new HepMC::GenEvent(HepMC::Units::GEV, HepMC::Units::MM);
 
  291   vector<vector<double> > theEventVec;
 
  326       if (theLine.compare(0, 1, 
"#") == 0) 
continue;
 
  327       vector<double> theInfo;  
 
  329       for (istringstream numbers_iss(theLine); numbers_iss >> number;)
 
  331         theInfo.push_back(number);
 
  334       if (theInfo.size() == 2 && theInfo[0] == 0 && theInfo[1] == 0)
 
  338       else if (theInfo.size() == 2 && theInfo[0] == 0 && theInfo[1] > 0)
 
  344         theEventVec.push_back(theInfo);
 
  363   std::vector<HepMC::GenParticle *> hepevt_particles(theEventVec.size());
 
  364   for (
unsigned int i = 0; i < theEventVec.size(); i++)
 
  367     int pid = (int) theEventVec[i][1];
 
  368     double px = theEventVec[i][3];
 
  369     double py = theEventVec[i][4];
 
  370     double pz = theEventVec[i][5];
 
  371     double E = theEventVec[i][6];
 
  372     double m = theEventVec[i][7];
 
  375     hepevt_particles[i] = 
new HepMC::GenParticle(HepMC::FourVector(px, py, pz, E), pid, status);
 
  376     hepevt_particles[i]->setGeneratedMass(m);
 
  377     hepevt_particles[i]->suggest_barcode(i + 1);
 
  380   for (
unsigned int i = 0; i < theEventVec.size(); i++)
 
  382     HepMC::GenParticle *
p = hepevt_particles[i];
 
  383     HepMC::GenVertex *prod_vtx = p->production_vertex();
 
  384     if (prod_vtx) prod_vtx->add_particle_out(p);
 
  387     HepMC::FourVector prod_pos(theEventVec[i][8] * 
toMM, theEventVec[i][9] * toMM, theEventVec[i][10] * toMM, theEventVec[i][11]);
 
  391       for (HepMC::GenEvent::vertex_iterator 
v = 
evt->vertices_begin(); 
v != 
evt->vertices_end(); ++
v)
 
  393         HepMC::GenVertex *theV = *
v;
 
  394         if (theV->position().x() != prod_pos.x()) 
continue;
 
  395         if (theV->position().y() != prod_pos.y()) 
continue;
 
  396         if (theV->position().z() != prod_pos.z()) 
continue;
 
  398         theV->add_particle_out(p);
 
  403         prod_vtx = 
new HepMC::GenVertex(prod_pos);
 
  404         prod_vtx->add_particle_out(p);
 
  405         evt->add_vertex(prod_vtx);
 
  410     if (!found && prod_vtx && prod_vtx->position() == HepMC::FourVector()) prod_vtx->set_position(prod_pos);
 
  415   if (
Verbosity() > 3) cout << 
"Adding Event to phhepmcgenevt" << endl;
 
  422     ievt->second->addEvent(
evt);