34 #include <CLHEP/Random/RandGauss.h> 59 #include "HepMC/GenEvent.h" 98 produces<edm::CTPPSFastRecHitContainer>(
"CTPPSFastRecHits");
128 if ( ! rng.isAvailable() ) {
130 <<
"CTPPSRecHitProducer requires the RandomNumberGeneratorService\n" 131 "which is not present in the configuration file. You must add the service\n" 132 "in the configuration file or remove the modules that require it.";
152 if ( engine->name() !=
"TRandom3" ) {
154 <<
"The TRandom3 engine type must be used with CTPPSRecHitProducer, Random Number Generator Service not correctly configured!";
161 std::unique_ptr<MixCollection<PSimHit> >
164 std::vector<CTPPSFastRecHit> theCTPPSFastRecHit;
170 unsigned int detlayerId = simHit->
detUnitId();
178 bool outside =
false;
182 if(detlayerId == 2014314496 || detlayerId == 2031091712) {
193 unsigned int cellId = 1;
200 theCTPPSFastRecHit.push_back(rechit);
203 if(detlayerId == 2014838784 || detlayerId == 2031616000) {
214 unsigned int cellId = 2;
221 theCTPPSFastRecHit.push_back(rechit);
226 if(detlayerId == 2046820352 || detlayerId == 2063597568) {
227 float t = simHit->
tof();
228 unsigned int cellId = 0;
229 float tof = CLHEP::RandGauss::shoot(engine,t,
fTimeSigma);
235 std::vector<double> vToFCellWidth;
236 for (
int i = 0 ;
i < 8 ;
i++){
242 double xc_tof =0., yc_tof=0.;
249 theCTPPSFastRecHit.push_back(rechit);
257 output_recHits->reserve(simHits->size());
260 for ( std::vector<CTPPSFastRecHit>::const_iterator
i = theCTPPSFastRecHit.begin();
261 i != theCTPPSFastRecHit.end();
i++ ) {
262 output_recHits->push_back(*
i);
266 iEvent.
put(
std::move(output_recHits),
"CTPPSFastRecHits");
T getParameter(std::string const &) const
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
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
#define DEFINE_FWK_MODULE(type)
void setCellId(unsigned int cellId)
CTPPSRecHitProducer(const edm::ParameterSet &)
void setDetUnitId(unsigned int detId)
static const double um_to_mm
Point3DBase< float, LocalTag > Local3DPoint
T const * product() 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