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 vToFCellWidth.reserve(8);
226 for (
int i = 0;
i < 8;
i++) {
233 double xc_tof = 0., yc_tof = 0.;
240 theCTPPSFastRecHit.push_back(rechit);
246 output_recHits->reserve(
simHits->size());
249 for (std::vector<CTPPSFastRecHit>::const_iterator
i = theCTPPSFastRecHit.begin();
i != theCTPPSFastRecHit.end();
251 output_recHits->push_back(*
i);
bool get_CellCenter(int cell_id, double &x, double &y)
T getParameter(std::string const &) const
edm::EDGetTokenT< CrossingFrame< PSimHit > > cf_token
~CTPPSRecHitProducer() override
int findCellId(double x, double y)
std::vector< PSimHit > PSimHitContainer
#define DEFINE_FWK_MODULE(type)
std::vector< CTPPSFastRecHit > CTPPSFastRecHitContainer
T const * product() const
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
void produce(edm::Event &, const edm::EventSetup &) override
T getUntrackedParameter(std::string const &, T const &) const
void setCellId(unsigned int cellId)
CTPPSRecHitProducer(const edm::ParameterSet &)
void setDetUnitId(unsigned int detId)
static const double um_to_mm
void beginStream(edm::StreamID) override
std::vector< double > fToFCellWidth
void setLocal3DPoint(const Local3DPoint &entry)
void endStream() override
Point3DBase< float, LocalTag > Local3DPoint