14 #include "CLHEP/Random/RandGaussQ.h"
15 #include "CLHEP/Random/RandFlat.h"
24 produces<ME0DigiPreRecoCollection>();
27 if (!rng.isAvailable()){
29 <<
"ME0ReDigiProducer::ME0PreRecoDigiProducer() - RandomNumberGeneratorService is not present in configuration file.\n"
30 <<
"Add the service in the configuration file or remove the modules that require it.";
69 <<
"Extracting central TOFs:" << std::endl;
73 if (detId.chamber() != 1
or detId.region() != 1)
continue;
75 const GlobalPoint centralGP(roll->toGlobal(centralLP));
76 const float centralTOF(centralGP.mag() / 29.98);
79 <<
"ME0DetId " << detId <<
" central TOF " << centralTOF << std::endl;
106 CLHEP::HepRandomEngine* engine)
127 auto digis = input_digis.get(detId);
128 for (
auto d = digis.first;
d != digis.second; ++
d) {
131 <<
"Check detId " << detId <<
" digi " << me0Digi << std::endl;
142 <<
"\tPassed selection" << std::endl;
145 float newTof(me0Digi.
tof());
152 <<
"size "<<
centralTOF_.size()<<
" nPartitions "<<
nPartitions_<<
" layer "<<detId.layer()<<
" roll "<<detId.roll()<<
" index "<<index<<std::endl;
155 const float correctedNewTof(newTof - t0);
158 <<
" t0 "<< t0 <<
" originalTOF " << me0Digi.
tof() <<
"\tnew TOF " << newTof <<
" corrected new TOF " << correctedNewTof << std::endl;
161 float newTime = correctedNewTof;
164 if (-12.5 + iBunch*25 < newTime and newTime <= 12.5 + iBunch*25){
165 newTime = iBunch * 25;
172 <<
"\tBX " << newTime << std::endl;
178 const std::vector<float>
parameters(roll->specs()->parameters());
182 const float oldR(oldGP.perp());
190 LocalPoint radialSmearedLP = roll->toLocal(radialSmearedGP);
194 float newLPy = radialSmearedLP.
y();
196 newLPy = CLHEP::RandGaussQ::shoot(engine, radialSmearedLP.
y(), targetYResolution);
199 LocalPoint newLP(radialSmearedLP.
x(), newLPy, radialSmearedLP.
z());
203 int newRoll = detId.roll();
204 if (newLP.y() > height) --newRoll;
205 if (newLP.y() < -height) ++newRoll;
207 if (newRoll != detId.roll()){
210 newRoll = detId.roll();
218 if (!newPart
or newRoll == detId.roll()){
221 if (newLP.y() > height) newLP =
LocalPoint(newLP.x(), height, newLP.z());
222 if (newLP.y() < -height) newLP =
LocalPoint(newLP.x(), -height, newLP.z());
225 newLP = newPart->
toLocal(newGP);
234 float newLPx = newLP.x();
236 newLPx = CLHEP::RandGaussQ::shoot(engine, newLP.x(), targetXResolution);
239 newLP =
LocalPoint(newLPx, newLP.y(), newLP.z());
241 float newY(newLP.y());
245 <<
"\tnew Y " << newY << std::endl;
247 float newX(newLP.x());
249 <<
"\tnew X " << newX << std::endl;
252 int strip(newPart->
strip(newLP));
253 float stripF(
float(strip) - 0.5);
257 <<
"\t\tdiscretized X " << newX << std::endl;
263 output_digis.insertDigi(newPart->
id(), out_digi);
272 double rollRadius = top_->radius();
273 double Rmax = rollRadius+height;
274 double Rx = rollRadius+
y;
const ME0EtaPartitionSpecs * specs() const
T getParameter(std::string const &) const
bool reDigitizeNeutronBkg_
void buildDigis(const ME0DigiPreRecoCollection &, ME0DigiPreRecoCollection &, CLHEP::HepRandomEngine *engine)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
double correctSigmaU(const ME0EtaPartition *roll, double y)
static const int maxRollId
edm::Service< edm::RandomNumberGenerator > rng
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
bool getByToken(EDGetToken token, Handle< PROD > &result) const
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
const ME0Specs & parameters() const
virtual ~ME0ReDigiProducer()
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
LocalPoint centreOfStrip(int strip) const
float strip(const LocalPoint &lp) const
const ME0EtaPartition * etaPartition(ME0DetId id) const
Return a etaPartition given its id.
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
const ME0Geometry * geometry_
edm::EDGetTokenT< ME0DigiPreRecoCollection > token_
MuonDigiCollection< ME0DetId, ME0DigiPreReco > ME0DigiPreRecoCollection
Abs< T >::type abs(const T &t)
bool reDigitizeOnlyMuons_
const std::vector< ME0EtaPartition const * > & etaPartitions() const
Return a vector of all ME0 eta partitions.
T const * product() const
std::vector< double > centralTOF_
const Topology & topology() const
ME0ReDigiProducer(const edm::ParameterSet &ps)
StreamID streamID() const
const double Rmax[kNumberCalorimeter]
virtual void produce(edm::Event &, const edm::EventSetup &) override
virtual void beginRun(const edm::Run &, const edm::EventSetup &) override