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;
155 const PSimHit* simHit = &(*ihit);
156 unsigned int detlayerId = simHit->
detUnitId();
164 bool outside =
false;
168 if (detlayerId == 2014314496 || detlayerId == 2031091712) {
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) {
194 double y_trk2 = simHit->
entryPoint().
y() + CLHEP::RandGauss::shoot(engine, 0,
fHitSigmaY * um_to_mm);
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) {
216 float t = simHit->
tof();
217 unsigned int cellId = 0;
218 float tof = CLHEP::RandGauss::shoot(engine, t,
fTimeSigma);
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);
255 iEvent.
put(
std::move(output_recHits),
"CTPPSFastRecHits");
bool get_CellCenter(int cell_id, double &x, double &y)
T getUntrackedParameter(std::string const &, T const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
float tof() const
deprecated name for timeOfFlight()
edm::EDGetTokenT< CrossingFrame< PSimHit > > cf_token
~CTPPSRecHitProducer() override
int findCellId(double x, double y)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< PSimHit > PSimHitContainer
#define DEFINE_FWK_MODULE(type)
std::vector< CTPPSFastRecHit > CTPPSFastRecHitContainer
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
void produce(edm::Event &, const edm::EventSetup &) override
void setCellId(unsigned int cellId)
CTPPSRecHitProducer(const edm::ParameterSet &)
void setDetUnitId(unsigned int detId)
static const double um_to_mm
T getParameter(std::string const &) const
void beginStream(edm::StreamID) override
std::vector< double > fToFCellWidth
void setLocal3DPoint(const Local3DPoint &entry)
void endStream() override
StreamID streamID() const
Local3DPoint entryPoint() const
Entry point in the local Det frame.
unsigned int detUnitId() const
Point3DBase< float, LocalTag > Local3DPoint