106 std::vector<PSimHit> theCTPPSHits;
110 std::vector<math::XYZTLorentzVector> protonCTPPS;
112 for (HepMC::GenEvent::vertex_const_iterator ivtx = Evt->vertices_begin(); ivtx != Evt->vertices_end(); ivtx++) {
113 if ((*ivtx)->id() != 0)
115 double prim_vtxZ = (*ivtx)->position().z() *
mm_to_m;
117 for (HepMC::GenVertex::particles_out_const_iterator
i = (*ivtx)->particles_out_const_begin();
118 i != (*ivtx)->particles_out_const_end();
120 int pid = (*i)->pdg_id();
124 HepMC::GenVertex*
pv = (*i)->production_vertex();
125 const HepMC::FourVector&
vertex =
pv->position();
126 const HepMC::FourVector
p((*i)->momentum());
129 LocalPoint initialPosition_tr1, initialPosition_tr2, initialPosition_tof;
131 double t0_tr1 = 0., t0_tr2 = 0., t0_tof = 0.;
137 double x_tr1 = 0., x_tr2 = 0., x_tof = 0., y_tr1 = 0., y_tr2 = 0., y_tof = 0., z_tr1 = 0.;
154 initialPosition_tr1 = xyzzy_tr1;
160 x_tr2 = x_tr1 + (
p.x() /
p.z()) * (z_tr2 - z_tr1) *
m_to_mm;
161 y_tr2 = y_tr1 + (
p.y() /
p.z()) * (z_tr2 - z_tr1) *
m_to_mm;
163 initialPosition_tr2 = xyzzy_tr2;
168 x_tof = x_tr1 + (
p.x() /
p.z()) * (z_tof - z_tr1) *
m_to_mm;
169 y_tof = y_tr1 + (
p.y() /
p.z()) * (z_tof - z_tr1) *
m_to_mm;
171 initialPosition_tof = xyzzy_tof;
181 if (Direction > 0.) {
182 PSimHit hit_tr1(xyzzy_tr1, xyzzy_tr1, 0., t0_tr1, 0., pid, 2014314496, 0, 0., 0., 2);
183 PSimHit hit_tr2(xyzzy_tr2, xyzzy_tr2, 0., t0_tr2, 0., pid, 2014838784, 0, 0., 0., 2);
184 PSimHit hit_tof(xyzzy_tof, xyzzy_tof, 0., t0_tof, 0., pid, 2046820352, 0, 0., 0., 2);
185 theCTPPSHits.push_back(hit_tr1);
186 theCTPPSHits.push_back(hit_tr2);
187 theCTPPSHits.push_back(hit_tof);
189 if (Direction < 0.) {
190 PSimHit hit_tr1(xyzzy_tr1, xyzzy_tr1, 0., t0_tr1, 0., pid, 2031091712, 0, 0., 0., 2);
191 PSimHit hit_tr2(xyzzy_tr2, xyzzy_tr2, 0., t0_tr2, 0., pid, 2031616000, 0, 0., 0., 2);
192 PSimHit hit_tof(xyzzy_tof, xyzzy_tof, 0., t0_tof, 0., pid, 2063597568, 0, 0., 0., 2);
193 theCTPPSHits.push_back(hit_tr1);
194 theCTPPSHits.push_back(hit_tr2);
195 theCTPPSHits.push_back(hit_tof);
202 for (std::vector<PSimHit>::const_iterator
i = theCTPPSHits.begin();
i != theCTPPSHits.end();
i++) {
203 pctpps->push_back(*
i);
static const double c_light_s
edm::Handle< edm::HepMCProduct > EvtHandle
static const double s_to_ns
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Abs< T >::type abs(const T &t)
const HepMC::GenEvent * GetEvent() const
static const double m_to_mm
static const double mm_to_m
edm::EDGetTokenT< edm::HepMCProduct > mcEventToken
std::vector< PSimHit > PSimHitContainer