34 #include <CLHEP/Random/RandGauss.h>
59 #include "HepMC/GenEvent.h"
94 produces<edm::CTPPSFastRecHitContainer>(
"CTPPSFastRecHits");
124 if (!rng.isAvailable()) {
126 <<
"CTPPSRecHitProducer requires the RandomNumberGeneratorService\n"
127 "which is not present in the configuration file. You must add the service\n"
128 "in the configuration file or remove the modules that require it.";
139 if (engine->name() !=
"TRandom3") {
140 throw cms::Exception(
"Configuration") <<
"The TRandom3 engine type must be used with CTPPSRecHitProducer, Random "
141 "Number Generator Service not correctly configured!";
150 std::vector<CTPPSFastRecHit> theCTPPSFastRecHit;
156 unsigned int detlayerId =
simHit->detUnitId();
164 bool outside =
false;
168 if (detlayerId == 2014314496 || detlayerId == 2031091712) {
172 float z_trk1 =
simHit->entryPoint().z();
176 if (x_trk1 > 0 || fabs(x_trk1) < pos_trk1 || fabs(x_trk1) > (
fTrackerWidth + pos_trk1) ||
181 unsigned int cellId = 1;
188 theCTPPSFastRecHit.push_back(rechit);
191 if (detlayerId == 2014838784 || detlayerId == 2031616000) {
195 double z_trk2 =
simHit->entryPoint().z();
198 if (x_trk2 > 0 || fabs(x_trk2) < pos_trk2 || fabs(x_trk2) > (
fTrackerWidth + pos_trk2) ||
203 unsigned int cellId = 2;
210 theCTPPSFastRecHit.push_back(rechit);
215 if (detlayerId == 2046820352 || detlayerId == 2063597568) {
217 unsigned int cellId = 0;
218 float tof = CLHEP::RandGauss::shoot(engine,
t,
fTimeSigma);
219 double x_tof =
simHit->entryPoint().x();
220 double y_tof =
simHit->entryPoint().y();
224 std::vector<double> vToFCellWidth;
225 for (
int i = 0;
i < 8;
i++) {
232 double xc_tof = 0., yc_tof = 0.;
239 theCTPPSFastRecHit.push_back(rechit);
245 output_recHits->reserve(
simHits->size());
248 for (std::vector<CTPPSFastRecHit>::const_iterator
i = theCTPPSFastRecHit.begin();
i != theCTPPSFastRecHit.end();
250 output_recHits->push_back(*
i);