Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HIJINGFlipAfterburner.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file HIJINGFlipAfterburner.cc
1 
3 
5 
7 #include <phool/getClass.h>
8 // phhepmc
11 
12 // hepmc
13 #pragma GCC diagnostic push
14 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
15 #include <HepMC/GenEvent.h>
16 #include <HepMC/GenParticle.h> // for GenParticle
17 #include <HepMC/GenVertex.h> // for GenVertex, GenVertex::part...
18 #include <HepMC/SimpleVector.h>
19 #pragma GCC diagnostic pop
20 
21 #include <cassert>
22 
23 //____________________________________________________________________________..
25  : SubsysReco(name)
26 {
27 }
28 
29 //____________________________________________________________________________..
31 {
32  if (!doFlip)
33  {
34  doFlip = true;
35  }
36  else
37  {
38  doFlip = false;
39  PHHepMCGenEventMap *genevtmap = findNode::getClass<PHHepMCGenEventMap>(topNode, "PHHepMCGenEventMap");
40  for (auto &iter : *genevtmap)
41  {
42  PHHepMCGenEvent *genevt = iter.second;
43  HepMC::GenEvent *evt = genevt->getEvent();
44  assert(evt);
45  flipZDirection(evt);
46  }
47  }
48 
50 }
51 
53 {
54  assert(event);
55 
56  for (auto v = event->vertices_begin(); v != event->vertices_end(); ++v)
57  {
58  HepMC::FourVector position = (*v)->position();
59 
60  position.setZ(-position.z());
61  position.setX(-position.x());
62 
63  (*v)->set_position(position);
64  }
65 
66  for (auto p = event->particles_begin(); p != event->particles_end(); ++p)
67  {
68  HepMC::FourVector momentum = (*p)->momentum();
69 
70  momentum.setPz(-momentum.pz());
71  momentum.setPx(-momentum.px());
72 
73  (*p)->set_momentum(momentum);
74  }
75 }